History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

No conflicts.

Jakub Kicinski committed 4 years ago

Commit c59400a2 parents 9c30918 dcb85f8405 files · +4030 −2043Browse files

Unified · Split

405 files
  1. .mailmap +3 −0
  2. Documentation/admin-guide/gpio/index.rst +1 −0
  3. Documentation/arm/marvell.rst +2 −0
  4. Documentation/arm64/silicon-errata.rst +12 −0
  5. Documentation/dev-tools/kselftest.rst +8 −0
  6. Documentation/devicetree/bindings/interrupt-controller/renesas,irqc.yaml +1 −0
  7. Documentation/devicetree/bindings/interrupt-controller/sifive,plic-1.0.0.yaml +6 −6
  8. Documentation/devicetree/bindings/net/qcom,ipa.yaml +6 −0
  9. Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml +3 −2
  10. Documentation/index.rst +1 −0
  11. Documentation/kernel-hacking/locking.rst +1 −1
  12. Documentation/tools/index.rst +20 −0
  13. Documentation/tools/rtla/index.rst +26 −0
  14. Documentation/virt/kvm/api.rst +3 −1
  15. Documentation/vm/page_table_check.rst +1 −1
  16. MAINTAINERS +1 −2
  17. Makefile +1 −1
  18. arch/arm/Kconfig +1 −0
  19. arch/arm64/Kconfig +75 −6
  20. arch/arm64/include/asm/cputype.h +4 −0
  21. arch/arm64/kernel/cpu_errata.c +29 −0
  22. arch/arm64/kernel/cpufeature.c +3 −0
  23. arch/arm64/kernel/stacktrace.c +3 −2
  24. arch/arm64/kernel/vdso/Makefile +4 −1
  25. arch/arm64/kvm/hyp/exception.c +4 −1
  26. arch/arm64/kvm/hyp/pgtable.c +6 −12
  27. arch/arm64/kvm/hyp/vgic-v3-sr.c +3 −0
  28. arch/arm64/kvm/vgic/vgic-v3.c +15 −2
  29. arch/arm64/mm/extable.c +2 −2
  30. arch/arm64/tools/cpucaps +3 −0
  31. arch/ia64/Kconfig +1 −1
  32. arch/ia64/pci/fixup.c +2 −2
  33. arch/mips/cavium-octeon/octeon-memcpy.S +1 −1
  34. arch/mips/include/asm/asm.h +2 −2
  35. arch/mips/include/asm/ftrace.h +2 −2
  36. arch/mips/include/asm/r4kcache.h +2 −2
  37. arch/mips/include/asm/unaligned-emul.h +88 −88
  38. arch/mips/kernel/mips-r2-to-r6-emul.c +52 −52
  39. arch/mips/kernel/r2300_fpu.S +3 −3
  40. arch/mips/kernel/r4k_fpu.S +1 −1
  41. arch/mips/kernel/relocate_kernel.S +11 −11
  42. arch/mips/kernel/scall32-o32.S +5 −5
  43. arch/mips/kernel/scall64-n32.S +1 −1
  44. arch/mips/kernel/scall64-n64.S +1 −1
  45. arch/mips/kernel/scall64-o32.S +5 −5
  46. arch/mips/kernel/syscall.c +4 −4
  47. arch/mips/kvm/vz.c +9 −3
  48. arch/mips/lib/csum_partial.S +2 −2
  49. arch/mips/lib/memcpy.S +2 −2
  50. arch/mips/lib/memset.S +1 −1
  51. arch/mips/lib/strncpy_user.S +2 −2
  52. arch/mips/lib/strnlen_user.S +1 −1
  53. arch/mips/loongson64/vbios_quirk.c +4 −5
  54. arch/powerpc/include/asm/book3s/32/pgtable.h +1 −0
  55. arch/powerpc/include/asm/book3s/64/pgtable.h +2 −0
  56. arch/powerpc/include/asm/fixmap.h +4 −2
  57. arch/powerpc/include/asm/kvm_book3s_64.h +0 −1
  58. arch/powerpc/include/asm/kvm_host.h +1 −0
  59. arch/powerpc/include/asm/nohash/32/pgtable.h +1 −0
  60. arch/powerpc/include/asm/nohash/64/pgtable.h +1 −0
  61. arch/powerpc/kernel/time.c +3 −2
  62. arch/powerpc/kvm/book3s_hv.c +1 −2
  63. arch/powerpc/kvm/book3s_hv_nested.c +1 −1
  64. arch/powerpc/mm/pgtable.c +9 −0
  65. arch/powerpc/perf/core-book3s.c +14 −3
  66. arch/s390/Kconfig +15 −0
  67. arch/s390/configs/debug_defconfig +10 −10
  68. arch/s390/configs/defconfig +9 −7
  69. arch/s390/configs/zfcpdump_defconfig +3 −0
  70. arch/s390/hypfs/hypfs_vm.c +4 −2
  71. arch/s390/include/asm/uaccess.h +2 −2
  72. arch/s390/kernel/module.c +18 −19
  73. arch/s390/kernel/nmi.c +22 −5
  74. arch/s390/lib/Makefile +3 −0
  75. arch/s390/lib/test_modules.c +35 −0
  76. arch/s390/lib/test_modules.h +50 −0
  77. arch/s390/lib/test_modules_helpers.c +13 −0
  78. arch/x86/Kconfig +1 −0
  79. arch/x86/include/asm/kvm_host.h +3 −2
  80. arch/x86/include/uapi/asm/kvm.h +3 −0
  81. arch/x86/kernel/cpu/mce/amd.c +1 −1
  82. arch/x86/kernel/cpu/mce/intel.c +1 −0
  83. arch/x86/kvm/cpuid.c +55 −35
  84. arch/x86/kvm/lapic.c +1 −1
  85. arch/x86/kvm/svm/nested.c +5 −4
  86. arch/x86/kvm/svm/sev.c +7 −2
  87. arch/x86/kvm/svm/svm.c +122 −55
  88. arch/x86/kvm/svm/svm.h +1 −6
  89. arch/x86/kvm/svm/svm_onhyperv.h +4 −8
  90. arch/x86/kvm/vmx/capabilities.h +0 −1
  91. arch/x86/kvm/vmx/evmcs.c +2 −2
  92. arch/x86/kvm/vmx/evmcs.h +39 −9
  93. arch/x86/kvm/vmx/nested.c +54 −28
  94. arch/x86/kvm/vmx/vmcs12.c +2 −2
  95. arch/x86/kvm/vmx/vmcs12.h +3 −3
  96. arch/x86/kvm/vmx/vmx.c +38 −9
  97. arch/x86/kvm/x86.c +81 −13
  98. arch/x86/kvm/xen.c +2 −8
  99. arch/x86/pci/fixup.c +2 −2
  100. block/blk-core.c +19 −6
  101. block/blk-ia-ranges.c +1 −1
  102. block/blk-mq.c +2 −0
  103. drivers/ata/pata_platform.c +2 −0
  104. drivers/counter/counter-core.c +6 −9
  105. drivers/firmware/efi/efi.c +7 −0
  106. drivers/firmware/efi/libstub/arm64-stub.c +3 −3
  107. drivers/gpio/gpio-sim.c +1 −1
  108. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +81 −0
  109. drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c +2 −2
  110. drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +0 −1
  111. drivers/gpu/drm/amd/display/dc/core/dc.c +27 −13
  112. drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +3 −3
  113. drivers/gpu/drm/amd/display/dc/core/dc_resource.c +54 −0
  114. drivers/gpu/drm/amd/display/dc/dc.h +1 −0
  115. drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +9 −1
  116. drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c +2 −2
  117. drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c +12 −1
  118. drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c +3 −0
  119. drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20.c +0 −2
  120. drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20v2.c +0 −2
  121. drivers/gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.c +0 −2
  122. drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c +0 −2
  123. drivers/gpu/drm/amd/display/dc/dml/dcn301/dcn301_fpu.c +1 −1
  124. drivers/gpu/drm/amd/display/dc/dml/dcn301/dcn301_fpu.h +1 −1
  125. drivers/gpu/drm/amd/display/dc/dml/display_mode_structs.h +0 −1
  126. drivers/gpu/drm/amd/display/dc/dml/display_rq_dlg_helpers.c +0 −3
  127. drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.c +0 −4
  128. drivers/gpu/drm/amd/display/dc/inc/core_types.h +1 −0
  129. drivers/gpu/drm/amd/display/dc/inc/resource.h +11 −0
  130. drivers/gpu/drm/ast/ast_tables.h +0 −2
  131. drivers/gpu/drm/drm_atomic.c +8 −4
  132. drivers/gpu/drm/drm_panel_orientation_quirks.c +12 −0
  133. drivers/gpu/drm/drm_privacy_screen_x86.c +3 −0
  134. drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +2 −2
  135. drivers/gpu/drm/msm/adreno/a6xx_gpu.c +2 −0
  136. drivers/gpu/drm/msm/adreno/adreno_device.c +18 −0
  137. drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c +9 −2
  138. drivers/gpu/drm/msm/dsi/dsi.c +6 −1
  139. drivers/gpu/drm/msm/dsi/phy/dsi_phy.c +3 −1
  140. drivers/gpu/drm/msm/hdmi/hdmi.c +6 −1
  141. drivers/gpu/drm/msm/msm_drv.c +1 −4
  142. drivers/gpu/drm/msm/msm_gpu.c +3 −0
  143. drivers/gpu/drm/msm/msm_gpu.h +3 −0
  144. drivers/gpu/drm/msm/msm_gpu_devfreq.c +19 −2
  145. drivers/gpu/drm/vc4/vc4_dsi.c +4 −10
  146. drivers/hv/hv_balloon.c +7 −0
  147. drivers/hwmon/adt7470.c +3 −0
  148. drivers/hwmon/lm90.c +11 −10
  149. drivers/hwmon/nct6775.c +3 −3
  150. drivers/hwmon/pmbus/ir38064.c +1 −1
  151. drivers/irqchip/irq-apple-aic.c +0 −1
  152. drivers/irqchip/irq-gic-v3-its.c +101 −22
  153. drivers/irqchip/irq-loongson-pch-msi.c +1 −1
  154. drivers/irqchip/irq-realtek-rtl.c +12 −6
  155. drivers/md/dm.c +3 −17
  156. drivers/misc/eeprom/at25.c +4 −0
  157. drivers/net/dsa/Kconfig +1 −0
  158. drivers/net/ethernet/amd/xgbe/xgbe-drv.c +13 −1
  159. drivers/net/ethernet/google/gve/gve_adminq.c +1 −1
  160. drivers/net/ethernet/intel/e1000e/e1000.h +3 −1
  161. drivers/net/ethernet/intel/e1000e/ich8lan.c +20 −0
  162. drivers/net/ethernet/intel/e1000e/netdev.c +21 −18
  163. drivers/net/ethernet/intel/i40e/i40e.h +1 −0
  164. drivers/net/ethernet/intel/i40e/i40e_main.c +29 −2
  165. drivers/net/ethernet/mellanox/mlx5/core/en.h +3 −3
  166. drivers/net/ethernet/mellanox/mlx5/core/en/qos.c +2 −1
  167. drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c +14 −18
  168. drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c +4 −2
  169. drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h +5 −0
  170. drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c +3 −1
  171. drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c +11 −2
  172. drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h +6 −3
  173. drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +19 −11
  174. drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +14 −1
  175. drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +1 −1
  176. drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c +4 −0
  177. drivers/net/ethernet/mellanox/mlx5/core/esw/diag/bridge_tracepoint.h +1 −1
  178. drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c +1 −1
  179. drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c +5 −4
  180. drivers/net/ethernet/mellanox/mlx5/core/port.c +5 −4
  181. drivers/net/ethernet/microchip/sparx5/sparx5_packet.c +1 −1
  182. drivers/net/ethernet/smsc/smc911x.c +4 −4
  183. drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c +7 −2
  184. drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h +1 −0
  185. drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +17 −2
  186. drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c +12 −7
  187. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +4 −2
  188. drivers/net/ieee802154/at86rf230.c +11 −2
  189. drivers/net/ieee802154/ca8210.c +1 −0
  190. drivers/net/ieee802154/mac802154_hwsim.c +1 −0
  191. drivers/net/ieee802154/mcr20a.c +2 −2
  192. drivers/net/ipa/ipa_power.c +52 −0
  193. drivers/net/ipa/ipa_power.h +7 −0
  194. drivers/net/ipa/ipa_uc.c +5 −0
  195. drivers/net/macsec.c +21 −12
  196. drivers/net/phy/at803x.c +13 −13
  197. drivers/net/usb/ipheth.c +3 −3
  198. drivers/nvme/host/fabrics.c +1 −2
  199. drivers/nvme/host/pci.c +2 −1
  200. drivers/pci/controller/pcie-mt7621.c +1 −10
  201. drivers/pinctrl/Makefile +1 −1
  202. drivers/pinctrl/bcm/Kconfig +1 −0
  203. drivers/pinctrl/bcm/pinctrl-bcm2835.c +15 −8
  204. drivers/pinctrl/intel/pinctrl-cherryview.c +3 −2
  205. drivers/pinctrl/intel/pinctrl-intel.c +36 −28
  206. drivers/pinctrl/pinctrl-microchip-sgpio.c +2 −1
  207. drivers/pinctrl/pinctrl-thunderbay.c +35 −55
  208. drivers/pinctrl/pinctrl-zynqmp.c +4 −6
  209. drivers/pinctrl/sunxi/pinctrl-sun50i-h616.c +4 −4
  210. drivers/platform/surface/Kconfig +1 −0
  211. drivers/platform/x86/amd-pmc.c +9 −6
  212. drivers/platform/x86/asus-tf103c-dock.c +2 −2
  213. drivers/platform/x86/intel/crystal_cove_charger.c +13 −13
  214. drivers/platform/x86/intel/speed_select_if/isst_if_common.c +63 −34
  215. drivers/platform/x86/thinkpad_acpi.c +22 −3
  216. drivers/platform/x86/touchscreen_dmi.c +24 −0
  217. drivers/platform/x86/x86-android-tablets.c +95 −10
  218. drivers/regulator/max20086-regulator.c +2 −1
  219. drivers/s390/scsi/zfcp_fc.c +12 −1
  220. drivers/scsi/3w-sas.c +0 −4
  221. drivers/scsi/53c700.c +0 −1
  222. drivers/scsi/bfa/bfad.c +0 −6
  223. drivers/scsi/bnx2fc/bnx2fc_fcoe.c +5 −15
  224. drivers/scsi/elx/libefc/efc_els.c +2 −6
  225. drivers/scsi/hisi_sas/hisi_sas_main.c +0 −3
  226. drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +0 −2
  227. drivers/scsi/myrs.c +2 −1
  228. drivers/scsi/pm8001/pm80xx_hwi.c +14 −2
  229. drivers/scsi/pm8001/pm80xx_hwi.h +5 −1
  230. drivers/scsi/qedf/qedf_io.c +1 −0
  231. drivers/scsi/qedf/qedf_main.c +5 −2
  232. drivers/scsi/ufs/ufshcd-pltfrm.c +7 −0
  233. drivers/scsi/ufs/ufshcd.c +6 −3
  234. drivers/scsi/ufs/ufshci.h +2 −1
  235. drivers/spi/spi-bcm-qspi.c +1 −1
  236. drivers/spi/spi-meson-spicc.c +5 −0
  237. drivers/spi/spi-mt65xx.c +1 −1
  238. drivers/spi/spi-stm32-qspi.c +17 −30
  239. drivers/spi/spi-stm32.c +4 −3
  240. drivers/spi/spi-uniphier.c +14 −4
  241. drivers/target/iscsi/iscsi_target_tpg.c +3 −0
  242. drivers/tty/n_gsm.c +3 −1
  243. drivers/tty/rpmsg_tty.c +26 −14
  244. drivers/tty/serial/8250/8250_of.c +10 −1
  245. drivers/tty/serial/8250/8250_pci.c +98 −2
  246. drivers/tty/serial/8250/8250_port.c +6 −55
  247. drivers/tty/serial/amba-pl011.c +1 −10
  248. drivers/tty/serial/serial_core.c +12 −22
  249. drivers/tty/serial/stm32-usart.c +13 −1
  250. drivers/usb/cdns3/drd.c +3 −3
  251. drivers/usb/common/ulpi.c +5 −2
  252. drivers/usb/core/hcd.c +14 −0
  253. drivers/usb/core/urb.c +12 −0
  254. drivers/usb/dwc2/gadget.c +1 −1
  255. drivers/usb/dwc3/dwc3-xilinx.c +18 −5
  256. drivers/usb/gadget/function/f_sourcesink.c +1 −0
  257. drivers/usb/gadget/udc/at91_udc.c +1 −1
  258. drivers/usb/host/xhci-plat.c +3 −0
  259. drivers/usb/storage/unusual_devs.h +10 −0
  260. drivers/usb/typec/port-mapper.c +7 −1
  261. drivers/usb/typec/tcpm/tcpci.c +26 −0
  262. drivers/usb/typec/tcpm/tcpci.h +1 −0
  263. drivers/usb/typec/tcpm/tcpm.c +6 −1
  264. drivers/usb/typec/ucsi/ucsi_ccg.c +1 −1
  265. drivers/video/fbdev/hyperv_fb.c +3 −13
  266. fs/Makefile +1 −1
  267. fs/binfmt_misc.c +4 −4
  268. fs/btrfs/ioctl.c +2 −4
  269. fs/ceph/caps.c +37 −18
  270. fs/ceph/file.c +9 −0
  271. fs/configfs/dir.c +3 −3
  272. fs/devpts/inode.c +1 −1
  273. fs/ext4/ext4.h +7 −7
  274. fs/ext4/hash.c +1 −1
  275. fs/ext4/namei.c +6 −6
  276. fs/ext4/super.c +5 −5
  277. fs/ext4/sysfs.c +4 −4
  278. fs/f2fs/dir.c +5 −5
  279. fs/f2fs/f2fs.h +1 −1
  280. fs/f2fs/hash.c +1 −1
  281. fs/f2fs/namei.c +2 −2
  282. fs/f2fs/recovery.c +2 −2
  283. fs/f2fs/super.c +5 −5
  284. fs/f2fs/sysfs.c +5 −5
  285. fs/io_uring.c +8 −3
  286. fs/jbd2/journal.c +2 −0
  287. fs/libfs.c +5 −5
  288. fs/lockd/svcsubs.c +10 −8
  289. fs/namei.c +5 −5
  290. fs/nfsd/nfs4state.c +3 −1
  291. fs/nfsd/nfsctl.c +3 −2
  292. fs/notify/fanotify/fanotify_user.c +3 −6
  293. fs/ocfs2/stackglue.c +1 −12
  294. fs/ocfs2/suballoc.c +11 −14
  295. fs/overlayfs/copy_up.c +13 −3
  296. fs/udf/inode.c +4 −5
  297. fs/unicode/Kconfig +5 −13
  298. fs/unicode/Makefile +4 −2
  299. include/linux/blkdev.h +1 −0
  300. include/linux/fs.h +1 −1
  301. include/linux/fsnotify.h +43 −6
  302. include/linux/if_vlan.h +4 −2
  303. include/linux/lsm_hook_defs.h +1 −1
  304. include/linux/mm.h +12 −5
  305. include/linux/mm_types.h +1 −0
  306. include/linux/psi.h +5 −6
  307. include/linux/quota.h +1 −1
  308. include/linux/sched.h +0 −1
  309. include/linux/suspend.h +1 −10
  310. include/linux/sysctl.h +1 −1
  311. include/linux/usb/role.h +6 −0
  312. include/net/ax25.h +12 −0
  313. include/net/neighbour.h +13 −5
  314. include/trace/perf.h +3 −2
  315. include/trace/trace_events.h +5 −4
  316. include/uapi/linux/cyclades.h +35 −0
  317. include/uapi/linux/kvm.h +1 −0
  318. include/uapi/linux/smc_diag.h +5 −6
  319. kernel/async.c +0 −3
  320. kernel/audit.c +43 −19
  321. kernel/bpf/bpf_lsm.c +1 −1
  322. kernel/bpf/ringbuf.c +1 −1
  323. kernel/bpf/trampoline.c +3 −2
  324. kernel/cgroup/cgroup-v1.c +14 −0
  325. kernel/cgroup/cpuset.c +51 −14
  326. kernel/events/core.c +19 −4
  327. kernel/module.c +5 −20
  328. kernel/power/snapshot.c +7 −14
  329. kernel/power/wakelock.c +4 −7
  330. kernel/printk/sysctl.c +1 −1
  331. kernel/rcu/tasks.h +8 −4
  332. kernel/sched/membarrier.c +5 −4
  333. kernel/sched/psi.c +41 −38
  334. kernel/stackleak.c +2 −3
  335. kernel/trace/Kconfig +7 −1
  336. kernel/trace/trace.c +2 −1
  337. kernel/trace/trace_events_hist.c +8 −2
  338. kernel/ucount.c +2 −0
  339. lib/sbitmap.c +6 −2
  340. lib/test_kasan.c +5 −0
  341. mm/gup.c +30 −5
  342. mm/memory-failure.c +6 −0
  343. net/ax25/af_ax25.c +16 −7
  344. net/ax25/ax25_dev.c +23 −5
  345. net/ax25/ax25_route.c +11 −2
  346. net/bridge/netfilter/nft_reject_bridge.c +4 −4
  347. net/core/neighbour.c +12 −6
  348. net/core/rtnetlink.c +4 −2
  349. net/ieee802154/nl802154.c +4 −4
  350. net/ipv4/netfilter/Kconfig +0 −4
  351. net/ipv4/tcp.c +5 −2
  352. net/ipv4/tcp_input.c +2 −0
  353. net/ipv6/netfilter/Kconfig +0 −4
  354. net/ipv6/netfilter/Makefile +0 −3
  355. net/ipv6/netfilter/nf_flow_table_ipv6.c +0 −0
  356. net/netfilter/nf_tables_api.c +0 −1
  357. net/netfilter/nft_byteorder.c +12 −0
  358. net/netfilter/nft_ct.c +4 −1
  359. net/packet/af_packet.c +6 −2
  360. net/sched/cls_api.c +7 −4
  361. net/smc/af_smc.c +118 −15
  362. net/smc/smc.h +19 −1
  363. net/smc/smc_diag.c +0 −2
  364. net/sunrpc/rpc_pipe.c +2 −2
  365. scripts/Makefile +1 −1
  366. security/security.c +13 −2
  367. security/selinux/ss/conditional.c +2 −1
  368. tools/arch/x86/include/uapi/asm/kvm.h +3 −0
  369. tools/bpf/resolve_btfids/Makefile +5 −1
  370. tools/include/uapi/linux/kvm.h +1 −0
  371. tools/include/uapi/linux/lirc.h +0 −229
  372. tools/scripts/Makefile.include +1 −1
  373. tools/testing/kunit/kunit_kernel.py +1 −0
  374. tools/testing/scatterlist/linux/mm.h +2 −1
  375. tools/testing/selftests/arm64/fp/sve-ptrace.c +9 −2
  376. tools/testing/selftests/bpf/test_lirc_mode2_user.c +0 −1
  377. tools/testing/selftests/cpufreq/main.sh +1 −1
  378. tools/testing/selftests/exec/Makefile +1 −1
  379. tools/testing/selftests/futex/Makefile +2 −2
  380. tools/testing/selftests/kselftest_harness.h +3 −1
  381. tools/testing/selftests/kvm/Makefile +1 −0
  382. tools/testing/selftests/kvm/include/kvm_util_base.h +0 −1
  383. tools/testing/selftests/kvm/include/x86_64/processor.h +1 −0
  384. tools/testing/selftests/kvm/lib/kvm_util.c +0 −7
  385. tools/testing/selftests/kvm/lib/x86_64/processor.c +21 −6
  386. tools/testing/selftests/kvm/x86_64/amx_test.c +2 −0
  387. tools/testing/selftests/kvm/x86_64/smm_test.c +0 −1
  388. tools/testing/selftests/mincore/mincore_selftest.c +14 −6
  389. tools/testing/selftests/netfilter/nft_concat_range.sh +71 −1
  390. tools/testing/selftests/netfilter/nft_nat.sh +152 −0
  391. tools/testing/selftests/netfilter/nft_zones_many.sh +6 −6
  392. tools/testing/selftests/openat2/Makefile +1 −1
  393. tools/testing/selftests/openat2/helpers.h +7 −5
  394. tools/testing/selftests/openat2/openat2_test.c +11 −1
  395. tools/testing/selftests/rtc/settings +1 −1
  396. tools/testing/selftests/vDSO/vdso_test_abi.c +62 −73
  397. tools/testing/selftests/zram/zram.sh +1 −14
  398. tools/testing/selftests/zram/zram01.sh +9 −24
  399. tools/testing/selftests/zram/zram02.sh +0 −1
  400. tools/testing/selftests/zram/zram_lib.sh +88 −46
  401. tools/tracing/Makefile +14 −4
  402. tools/tracing/rtla/Makefile +1 −1
  403. usr/include/Makefile +1 −0
  404. virt/kvm/eventfd.c +4 −4
  405. virt/kvm/kvm_main.c +3 −5
.mailmap+3−0
@@ -80,6 +80,9 @@ Chris Chiu <chris.chiu@canonical.com> <chiu@endlessos.org> · 79 unmodified lines
8080 Christian Borntraeger <borntraeger@linux.ibm.com> <borntraeger@de.ibm.com>
8181 Christian Borntraeger <borntraeger@linux.ibm.com> <cborntra@de.ibm.com>
8282 Christian Borntraeger <borntraeger@linux.ibm.com> <borntrae@de.ibm.com>
83+Christian Brauner <brauner@kernel.org> <christian@brauner.io>
84+Christian Brauner <brauner@kernel.org> <christian.brauner@canonical.com>
85+Christian Brauner <brauner@kernel.org> <christian.brauner@ubuntu.com>
8386 Christophe Ricard <christophe.ricard@gmail.com>
8487 Christoph Hellwig <hch@lst.de>
8588 Colin Ian King <colin.king@intel.com> <colin.king@canonical.com>
Documentation/admin-guide/gpio/index.rst+1−0
@@ -10,6 +10,7 @@ gpio · 9 unmodified lines
1010 gpio-aggregator
1111 sysfs
1212 gpio-mockup
13+ gpio-sim
1314
1415 .. only:: subproject and html
1516
Documentation/arm/marvell.rst+2−0
@@ -266,10 +266,12 @@ Avanta family · 265 unmodified lines
266266 -------------
267267
268268 Flavors:
269+ - 88F6500
269270 - 88F6510
270271 - 88F6530P
271272 - 88F6550
272273 - 88F6560
274+ - 88F6601
273275
274276 Homepage:
275277 https://web.archive.org/web/20181005145041/http://www.marvell.com/broadband/
Documentation/arm64/silicon-errata.rst+12−0
@@ -52,6 +52,12 @@ stable kernels. · 51 unmodified lines
5252 | Allwinner | A64/R18 | UNKNOWN1 | SUN50I_ERRATUM_UNKNOWN1 |
5353 +----------------+-----------------+-----------------+-----------------------------+
5454 +----------------+-----------------+-----------------+-----------------------------+
55+| ARM | Cortex-A510 | #2064142 | ARM64_ERRATUM_2064142 |
56++----------------+-----------------+-----------------+-----------------------------+
57+| ARM | Cortex-A510 | #2038923 | ARM64_ERRATUM_2038923 |
58++----------------+-----------------+-----------------+-----------------------------+
59+| ARM | Cortex-A510 | #1902691 | ARM64_ERRATUM_1902691 |
60++----------------+-----------------+-----------------+-----------------------------+
5561 | ARM | Cortex-A53 | #826319 | ARM64_ERRATUM_826319 |
5662 +----------------+-----------------+-----------------+-----------------------------+
5763 | ARM | Cortex-A53 | #827319 | ARM64_ERRATUM_827319 |
@@ -92,12 +98,18 @@ stable kernels. · 34 unmodified lines
9298 +----------------+-----------------+-----------------+-----------------------------+
9399 | ARM | Cortex-A77 | #1508412 | ARM64_ERRATUM_1508412 |
94100 +----------------+-----------------+-----------------+-----------------------------+
101+| ARM | Cortex-A510 | #2051678 | ARM64_ERRATUM_2051678 |
102++----------------+-----------------+-----------------+-----------------------------+
95103 | ARM | Cortex-A710 | #2119858 | ARM64_ERRATUM_2119858 |
96104 +----------------+-----------------+-----------------+-----------------------------+
97105 | ARM | Cortex-A710 | #2054223 | ARM64_ERRATUM_2054223 |
98106 +----------------+-----------------+-----------------+-----------------------------+
99107 | ARM | Cortex-A710 | #2224489 | ARM64_ERRATUM_2224489 |
100108 +----------------+-----------------+-----------------+-----------------------------+
109+| ARM | Cortex-X2 | #2119858 | ARM64_ERRATUM_2119858 |
110++----------------+-----------------+-----------------+-----------------------------+
111+| ARM | Cortex-X2 | #2224489 | ARM64_ERRATUM_2224489 |
112++----------------+-----------------+-----------------+-----------------------------+
101113 | ARM | Neoverse-N1 | #1188873,1418040| ARM64_ERRATUM_1418040 |
102114 +----------------+-----------------+-----------------+-----------------------------+
103115 | ARM | Neoverse-N1 | #1349291 | N/A |
Documentation/dev-tools/kselftest.rst+8−0
@@ -7,6 +7,14 @@ directory. These are intended to be small tests to exercise individual code · 6 unmodified lines
77 paths in the kernel. Tests are intended to be run after building, installing
88 and booting a kernel.
99
10+Kselftest from mainline can be run on older stable kernels. Running tests
11+from mainline offers the best coverage. Several test rings run mainline
12+kselftest suite on stable releases. The reason is that when a new test
13+gets added to test existing code to regression test a bug, we should be
14+able to run that test on an older kernel. Hence, it is important to keep
15+code that can still test an older kernel and make sure it skips the test
16+gracefully on newer releases.
17+
1018 You can find additional information on Kselftest framework, how to
1119 write new tests using the framework on Kselftest wiki:
1220
Documentation/devicetree/bindings/interrupt-controller/renesas,irqc.yaml+1−0
@@ -36,6 +36,7 @@ properties: · 35 unmodified lines
3636 - renesas,intc-ex-r8a77980 # R-Car V3H
3737 - renesas,intc-ex-r8a77990 # R-Car E3
3838 - renesas,intc-ex-r8a77995 # R-Car D3
39+ - renesas,intc-ex-r8a779a0 # R-Car V3U
3940 - const: renesas,irqc
4041
4142 '#interrupt-cells':
Documentation/devicetree/bindings/interrupt-controller/sifive,plic-1.0.0.yaml+6−6
@@ -62,6 +62,7 @@ properties: · 61 unmodified lines
6262
6363 interrupts-extended:
6464 minItems: 1
65+ maxItems: 15872
6566 description:
6667 Specifies which contexts are connected to the PLIC, with "-1" specifying
6768 that a context is not present. Each node pointed to should be a
@@ -90,12 +91,11 @@ examples: · 22 unmodified lines
9091 #interrupt-cells = <1>;
9192 compatible = "sifive,fu540-c000-plic", "sifive,plic-1.0.0";
9293 interrupt-controller;
93− interrupts-extended = <
94− &cpu0_intc 11
95− &cpu1_intc 11 &cpu1_intc 9
96− &cpu2_intc 11 &cpu2_intc 9
97− &cpu3_intc 11 &cpu3_intc 9
98− &cpu4_intc 11 &cpu4_intc 9>;
94+ interrupts-extended = <&cpu0_intc 11>,
95+ <&cpu1_intc 11>, <&cpu1_intc 9>,
96+ <&cpu2_intc 11>, <&cpu2_intc 9>,
97+ <&cpu3_intc 11>, <&cpu3_intc 9>,
98+ <&cpu4_intc 11>, <&cpu4_intc 9>;
9999 reg = <0xc000000 0x4000000>;
100100 riscv,ndev = <10>;
101101 };
Documentation/devicetree/bindings/net/qcom,ipa.yaml+6−0
@@ -107,6 +107,10 @@ properties: · 106 unmodified lines
107107 - const: imem
108108 - const: config
109109
110+ qcom,qmp:
111+ $ref: /schemas/types.yaml#/definitions/phandle
112+ description: phandle to the AOSS side-channel message RAM
113+
110114 qcom,smem-states:
111115 $ref: /schemas/types.yaml#/definitions/phandle-array
112116 description: State bits used in by the AP to signal the modem.
@@ -222,6 +226,8 @@ examples: · 109 unmodified lines
222226 "imem",
223227 "config";
224228
229+ qcom,qmp = <&aoss_qmp>;
230+
225231 qcom,smem-states = <&ipa_smp2p_out 0>,
226232 <&ipa_smp2p_out 1>;
227233 qcom,smem-state-names = "ipa-clock-enabled-valid",
Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml+3−2
@@ -23,8 +23,9 @@ properties: · 22 unmodified lines
2323 minItems: 1
2424 maxItems: 256
2525 items:
26− minimum: 0
27− maximum: 256
26+ items:
27+ - minimum: 0
28+ maximum: 256
2829 description:
2930 Chip select used by the device.
3031
Documentation/index.rst+1−0
@@ -166,6 +166,7 @@ to ReStructured Text format, or are simply too old. · 165 unmodified lines
166166 .. toctree::
167167 :maxdepth: 2
168168
169+ tools/index
169170 staging/index
170171 watch_queue
171172
Documentation/kernel-hacking/locking.rst+1−1
@@ -295,7 +295,7 @@ Pete Zaitcev gives the following summary: · 294 unmodified lines
295295
296296 - If you are in a process context (any syscall) and want to lock other
297297 process out, use a mutex. You can take a mutex and sleep
298− (``copy_from_user*(`` or ``kmalloc(x,GFP_KERNEL)``).
298+ (``copy_from_user()`` or ``kmalloc(x,GFP_KERNEL)``).
299299
300300 - Otherwise (== data can be touched in an interrupt), use
301301 spin_lock_irqsave() and
Documentation/tools/index.rst+20−0
@@ -0,0 +1,20 @@
1+.. SPDX-License-Identifier: GPL-2.0
2+
3+============
4+Kernel tools
5+============
6+
7+This book covers user-space tools that are shipped with the kernel source;
8+more additions are needed here:
9+
10+.. toctree::
11+ :maxdepth: 1
12+
13+ rtla/index
14+
15+.. only:: subproject and html
16+
17+ Indices
18+ =======
19+
20+ * :ref:`genindex`
Documentation/tools/rtla/index.rst+26−0
@@ -0,0 +1,26 @@
1+.. SPDX-License-Identifier: GPL-2.0
2+
3+================================
4+The realtime Linux analysis tool
5+================================
6+
7+RTLA provides a set of tools for the analysis of the kernel's realtime
8+behavior on specific hardware.
9+
10+.. toctree::
11+ :maxdepth: 1
12+
13+ rtla
14+ rtla-osnoise
15+ rtla-osnoise-hist
16+ rtla-osnoise-top
17+ rtla-timerlat
18+ rtla-timerlat-hist
19+ rtla-timerlat-top
20+
21+.. only:: subproject and html
22+
23+ Indices
24+ =======
25+
26+ * :ref:`genindex`
Documentation/virt/kvm/api.rst+3−1
@@ -3268,6 +3268,7 @@ number. · 3267 unmodified lines
32683268
32693269 :Capability: KVM_CAP_DEVICE_CTRL, KVM_CAP_VM_ATTRIBUTES for vm device,
32703270 KVM_CAP_VCPU_ATTRIBUTES for vcpu device
3271+ KVM_CAP_SYS_ATTRIBUTES for system (/dev/kvm) device (no set)
32713272 :Type: device ioctl, vm ioctl, vcpu ioctl
32723273 :Parameters: struct kvm_device_attr
32733274 :Returns: 0 on success, -1 on error
@@ -3302,7 +3303,8 @@ transferred is defined by the particular attribute. · 28 unmodified lines
33023303 ------------------------
33033304
33043305 :Capability: KVM_CAP_DEVICE_CTRL, KVM_CAP_VM_ATTRIBUTES for vm device,
3305− KVM_CAP_VCPU_ATTRIBUTES for vcpu device
3306+ KVM_CAP_VCPU_ATTRIBUTES for vcpu device
3307+ KVM_CAP_SYS_ATTRIBUTES for system (/dev/kvm) device
33063308 :Type: device ioctl, vm ioctl, vcpu ioctl
33073309 :Parameters: struct kvm_device_attr
33083310 :Returns: 0 on success, -1 on error
Documentation/vm/page_table_check.rst+1−1
@@ -9,7 +9,7 @@ Page Table Check · 8 unmodified lines
99 Introduction
1010 ============
1111
12−Page table check allows to hardern the kernel by ensuring that some types of
12+Page table check allows to harden the kernel by ensuring that some types of
1313 the memory corruptions are prevented.
1414
1515 Page table check performs extra verifications at the time when new pages become
MAINTAINERS+1−2
@@ -4157,9 +4157,8 @@ N: csky · 4156 unmodified lines
41574157 K: csky
41584158
41594159 CA8210 IEEE-802.15.4 RADIO DRIVER
4160−M: Harry Morris <h.morris@cascoda.com>
41614160 L: linux-wpan@vger.kernel.org
4162−S: Maintained
4161+S: Orphan
41634162 W: https://github.com/Cascoda/ca8210-linux.git
41644163 F: Documentation/devicetree/bindings/net/ieee802154/ca8210.txt
41654164 F: drivers/net/ieee802154/ca8210.c
Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 17
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc1
5+EXTRAVERSION = -rc2
66 NAME = Gobble Gobble
77
88 # *DOCUMENTATION*
arch/arm/Kconfig+1−0
@@ -83,6 +83,7 @@ config ARM · 82 unmodified lines
8383 select HAVE_EBPF_JIT if !CPU_ENDIAN_BE32
8484 select HAVE_CONTEXT_TRACKING
8585 select HAVE_C_RECORDMCOUNT
86+ select HAVE_BUILDTIME_MCOUNT_SORT
8687 select HAVE_DEBUG_KMEMLEAK if !XIP_KERNEL
8788 select HAVE_DMA_CONTIGUOUS if MMU
8889 select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
arch/arm64/Kconfig+75−6
@@ -670,15 +670,25 @@ config ARM64_ERRATUM_1508412 · 669 unmodified lines
670670 config ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE
671671 bool
672672
673+config ARM64_ERRATUM_2051678
674+ bool "Cortex-A510: 2051678: disable Hardware Update of the page table dirty bit"
675+ help
676+ This options adds the workaround for ARM Cortex-A510 erratum ARM64_ERRATUM_2051678.
677+ Affected Coretex-A510 might not respect the ordering rules for
678+ hardware update of the page table's dirty bit. The workaround
679+ is to not enable the feature on affected CPUs.
680+
681+ If unsure, say Y.
682+
673683 config ARM64_ERRATUM_2119858
674− bool "Cortex-A710: 2119858: workaround TRBE overwriting trace data in FILL mode"
684+ bool "Cortex-A710/X2: 2119858: workaround TRBE overwriting trace data in FILL mode"
675685 default y
676686 depends on CORESIGHT_TRBE
677687 select ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE
678688 help
679− This option adds the workaround for ARM Cortex-A710 erratum 2119858.
689+ This option adds the workaround for ARM Cortex-A710/X2 erratum 2119858.
680690
681− Affected Cortex-A710 cores could overwrite up to 3 cache lines of trace
691+ Affected Cortex-A710/X2 cores could overwrite up to 3 cache lines of trace
682692 data at the base of the buffer (pointed to by TRBASER_EL1) in FILL mode in
683693 the event of a WRAP event.
684694
@@ -761,14 +771,14 @@ config ARM64_ERRATUM_2253138 · 76 unmodified lines
761771 If unsure, say Y.
762772
763773 config ARM64_ERRATUM_2224489
764− bool "Cortex-A710: 2224489: workaround TRBE writing to address out-of-range"
774+ bool "Cortex-A710/X2: 2224489: workaround TRBE writing to address out-of-range"
765775 depends on CORESIGHT_TRBE
766776 default y
767777 select ARM64_WORKAROUND_TRBE_WRITE_OUT_OF_RANGE
768778 help
769− This option adds the workaround for ARM Cortex-A710 erratum 2224489.
779+ This option adds the workaround for ARM Cortex-A710/X2 erratum 2224489.
770780
771− Affected Cortex-A710 cores might write to an out-of-range address, not reserved
781+ Affected Cortex-A710/X2 cores might write to an out-of-range address, not reserved
772782 for TRBE. Under some conditions, the TRBE might generate a write to the next
773783 virtually addressed page following the last page of the TRBE address space
774784 (i.e., the TRBLIMITR_EL1.LIMIT), instead of wrapping around to the base.
@@ -778,6 +788,65 @@ config ARM64_ERRATUM_2224489 · 3 unmodified lines
778788
779789 If unsure, say Y.
780790
791+config ARM64_ERRATUM_2064142
792+ bool "Cortex-A510: 2064142: workaround TRBE register writes while disabled"
793+ depends on COMPILE_TEST # Until the CoreSight TRBE driver changes are in
794+ default y
795+ help
796+ This option adds the workaround for ARM Cortex-A510 erratum 2064142.
797+
798+ Affected Cortex-A510 core might fail to write into system registers after the
799+ TRBE has been disabled. Under some conditions after the TRBE has been disabled
800+ writes into TRBE registers TRBLIMITR_EL1, TRBPTR_EL1, TRBBASER_EL1, TRBSR_EL1,
801+ and TRBTRG_EL1 will be ignored and will not be effected.
802+
803+ Work around this in the driver by executing TSB CSYNC and DSB after collection
804+ is stopped and before performing a system register write to one of the affected
805+ registers.
806+
807+ If unsure, say Y.
808+
809+config ARM64_ERRATUM_2038923
810+ bool "Cortex-A510: 2038923: workaround TRBE corruption with enable"
811+ depends on COMPILE_TEST # Until the CoreSight TRBE driver changes are in
812+ default y
813+ help
814+ This option adds the workaround for ARM Cortex-A510 erratum 2038923.
815+
816+ Affected Cortex-A510 core might cause an inconsistent view on whether trace is
817+ prohibited within the CPU. As a result, the trace buffer or trace buffer state
818+ might be corrupted. This happens after TRBE buffer has been enabled by setting
819+ TRBLIMITR_EL1.E, followed by just a single context synchronization event before
820+ execution changes from a context, in which trace is prohibited to one where it
821+ isn't, or vice versa. In these mentioned conditions, the view of whether trace
822+ is prohibited is inconsistent between parts of the CPU, and the trace buffer or
823+ the trace buffer state might be corrupted.
824+
825+ Work around this in the driver by preventing an inconsistent view of whether the
826+ trace is prohibited or not based on TRBLIMITR_EL1.E by immediately following a
827+ change to TRBLIMITR_EL1.E with at least one ISB instruction before an ERET, or
828+ two ISB instructions if no ERET is to take place.
829+
830+ If unsure, say Y.
831+
832+config ARM64_ERRATUM_1902691
833+ bool "Cortex-A510: 1902691: workaround TRBE trace corruption"
834+ depends on COMPILE_TEST # Until the CoreSight TRBE driver changes are in
835+ default y
836+ help
837+ This option adds the workaround for ARM Cortex-A510 erratum 1902691.
838+
839+ Affected Cortex-A510 core might cause trace data corruption, when being written
840+ into the memory. Effectively TRBE is broken and hence cannot be used to capture
841+ trace data.
842+
843+ Work around this problem in the driver by just preventing TRBE initialization on
844+ affected cpus. The firmware must have disabled the access to TRBE for the kernel
845+ on such implementations. This will cover the kernel for any firmware that doesn't
846+ do this already.
847+
848+ If unsure, say Y.
849+
781850 config CAVIUM_ERRATUM_22375
782851 bool "Cavium erratum 22375, 24313"
783852 default y
arch/arm64/include/asm/cputype.h+4−0
@@ -73,7 +73,9 @@ · 72 unmodified lines
7373 #define ARM_CPU_PART_CORTEX_A76 0xD0B
7474 #define ARM_CPU_PART_NEOVERSE_N1 0xD0C
7575 #define ARM_CPU_PART_CORTEX_A77 0xD0D
76+#define ARM_CPU_PART_CORTEX_A510 0xD46
7677 #define ARM_CPU_PART_CORTEX_A710 0xD47
78+#define ARM_CPU_PART_CORTEX_X2 0xD48
7779 #define ARM_CPU_PART_NEOVERSE_N2 0xD49
7880
7981 #define APM_CPU_PART_POTENZA 0x000
@@ -115,7 +117,9 @@ · 35 unmodified lines
115117 #define MIDR_CORTEX_A76 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A76)
116118 #define MIDR_NEOVERSE_N1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N1)
117119 #define MIDR_CORTEX_A77 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A77)
120+#define MIDR_CORTEX_A510 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A510)
118121 #define MIDR_CORTEX_A710 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A710)
122+#define MIDR_CORTEX_X2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X2)
119123 #define MIDR_NEOVERSE_N2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N2)
120124 #define MIDR_THUNDERX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX)
121125 #define MIDR_THUNDERX_81XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_81XX)
arch/arm64/kernel/cpu_errata.c+29−0
@@ -347,6 +347,7 @@ static const struct midr_range trbe_overwrite_fill_mode_cpus[] = { · 346 unmodified lines
347347 #endif
348348 #ifdef CONFIG_ARM64_ERRATUM_2119858
349349 MIDR_ALL_VERSIONS(MIDR_CORTEX_A710),
350+ MIDR_RANGE(MIDR_CORTEX_X2, 0, 0, 2, 0),
350351 #endif
351352 {},
352353 };
@@ -371,6 +372,7 @@ static struct midr_range trbe_write_out_of_range_cpus[] = { · 18 unmodified lines
371372 #endif
372373 #ifdef CONFIG_ARM64_ERRATUM_2224489
373374 MIDR_ALL_VERSIONS(MIDR_CORTEX_A710),
375+ MIDR_RANGE(MIDR_CORTEX_X2, 0, 0, 2, 0),
374376 #endif
375377 {},
376378 };
@@ -597,6 +599,33 @@ const struct arm64_cpu_capabilities arm64_errata[] = { · 220 unmodified lines
597599 .type = ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE,
598600 CAP_MIDR_RANGE_LIST(trbe_write_out_of_range_cpus),
599601 },
602+#endif
603+#ifdef CONFIG_ARM64_ERRATUM_2064142
604+ {
605+ .desc = "ARM erratum 2064142",
606+ .capability = ARM64_WORKAROUND_2064142,
607+
608+ /* Cortex-A510 r0p0 - r0p2 */
609+ ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2)
610+ },
611+#endif
612+#ifdef CONFIG_ARM64_ERRATUM_2038923
613+ {
614+ .desc = "ARM erratum 2038923",
615+ .capability = ARM64_WORKAROUND_2038923,
616+
617+ /* Cortex-A510 r0p0 - r0p2 */
618+ ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2)
619+ },
620+#endif
621+#ifdef CONFIG_ARM64_ERRATUM_1902691
622+ {
623+ .desc = "ARM erratum 1902691",
624+ .capability = ARM64_WORKAROUND_1902691,
625+
626+ /* Cortex-A510 r0p0 - r0p1 */
627+ ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 1)
628+ },
600629 #endif
601630 {
602631 }
arch/arm64/kernel/cpufeature.c+3−0
@@ -1645,6 +1645,9 @@ static bool cpu_has_broken_dbm(void) · 1644 unmodified lines
16451645 MIDR_ALL_VERSIONS(MIDR_CORTEX_A55),
16461646 /* Kryo4xx Silver (rdpe => r1p0) */
16471647 MIDR_REV(MIDR_QCOM_KRYO_4XX_SILVER, 0xd, 0xe),
1648+#endif
1649+#ifdef CONFIG_ARM64_ERRATUM_2051678
1650+ MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2),
16481651 #endif
16491652 {},
16501653 };
arch/arm64/kernel/stacktrace.c+3−2
@@ -33,8 +33,8 @@ · 32 unmodified lines
3333 */
3434
3535
36−static void start_backtrace(struct stackframe *frame, unsigned long fp,
37− unsigned long pc)
36+static notrace void start_backtrace(struct stackframe *frame, unsigned long fp,
37+ unsigned long pc)
3838 {
3939 frame->fp = fp;
4040 frame->pc = pc;
@@ -55,6 +55,7 @@ static void start_backtrace(struct stackframe *frame, unsigned long fp, · 14 unmodified lines
5555 frame->prev_fp = 0;
5656 frame->prev_type = STACK_TYPE_UNKNOWN;
5757 }
58+NOKPROBE_SYMBOL(start_backtrace);
5859
5960 /*
6061 * Unwind from one frame record (A) to the next frame record (B).
arch/arm64/kernel/vdso/Makefile+4−1
@@ -29,8 +29,11 @@ ldflags-y := -shared -soname=linux-vdso.so.1 --hash-style=sysv \ · 28 unmodified lines
2929 ccflags-y := -fno-common -fno-builtin -fno-stack-protector -ffixed-x18
3030 ccflags-y += -DDISABLE_BRANCH_PROFILING -DBUILD_VDSO
3131
32+# -Wmissing-prototypes and -Wmissing-declarations are removed from
33+# the CFLAGS of vgettimeofday.c to make possible to build the
34+# kernel with CONFIG_WERROR enabled.
3235 CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os $(CC_FLAGS_SCS) $(GCC_PLUGINS_CFLAGS) \
33− $(CC_FLAGS_LTO)
36+ $(CC_FLAGS_LTO) -Wmissing-prototypes -Wmissing-declarations
3437 KASAN_SANITIZE := n
3538 KCSAN_SANITIZE := n
3639 UBSAN_SANITIZE := n
arch/arm64/kvm/hyp/exception.c+4−1
@@ -38,7 +38,10 @@ static inline void __vcpu_write_sys_reg(struct kvm_vcpu *vcpu, u64 val, int reg) · 37 unmodified lines
3838
3939 static void __vcpu_write_spsr(struct kvm_vcpu *vcpu, u64 val)
4040 {
41− write_sysreg_el1(val, SYS_SPSR);
41+ if (has_vhe())
42+ write_sysreg_el1(val, SYS_SPSR);
43+ else
44+ __vcpu_sys_reg(vcpu, SPSR_EL1) = val;
4245 }
4346
4447 static void __vcpu_write_spsr_abt(struct kvm_vcpu *vcpu, u64 val)
arch/arm64/kvm/hyp/pgtable.c+6−12
@@ -983,13 +983,9 @@ static int stage2_unmap_walker(u64 addr, u64 end, u32 level, kvm_pte_t *ptep, · 982 unmodified lines
983983 */
984984 stage2_put_pte(ptep, mmu, addr, level, mm_ops);
985985
986− if (need_flush) {
987− kvm_pte_t *pte_follow = kvm_pte_follow(pte, mm_ops);
988−
989− dcache_clean_inval_poc((unsigned long)pte_follow,
990− (unsigned long)pte_follow +
991− kvm_granule_size(level));
992− }
986+ if (need_flush && mm_ops->dcache_clean_inval_poc)
987+ mm_ops->dcache_clean_inval_poc(kvm_pte_follow(pte, mm_ops),
988+ kvm_granule_size(level));
993989
994990 if (childp)
995991 mm_ops->put_page(childp);
@@ -1151,15 +1147,13 @@ static int stage2_flush_walker(u64 addr, u64 end, u32 level, kvm_pte_t *ptep, · 155 unmodified lines
11511147 struct kvm_pgtable *pgt = arg;
11521148 struct kvm_pgtable_mm_ops *mm_ops = pgt->mm_ops;
11531149 kvm_pte_t pte = *ptep;
1154− kvm_pte_t *pte_follow;
11551150
11561151 if (!kvm_pte_valid(pte) || !stage2_pte_cacheable(pgt, pte))
11571152 return 0;
11581153
1159− pte_follow = kvm_pte_follow(pte, mm_ops);
1160− dcache_clean_inval_poc((unsigned long)pte_follow,
1161− (unsigned long)pte_follow +
1162− kvm_granule_size(level));
1154+ if (mm_ops->dcache_clean_inval_poc)
1155+ mm_ops->dcache_clean_inval_poc(kvm_pte_follow(pte, mm_ops),
1156+ kvm_granule_size(level));
11631157 return 0;
11641158 }
11651159
arch/arm64/kvm/hyp/vgic-v3-sr.c+3−0
@@ -983,6 +983,9 @@ static void __vgic_v3_read_ctlr(struct kvm_vcpu *vcpu, u32 vmcr, int rt) · 982 unmodified lines
983983 val = ((vtr >> 29) & 7) << ICC_CTLR_EL1_PRI_BITS_SHIFT;
984984 /* IDbits */
985985 val |= ((vtr >> 23) & 7) << ICC_CTLR_EL1_ID_BITS_SHIFT;
986+ /* SEIS */
987+ if (kvm_vgic_global_state.ich_vtr_el2 & ICH_VTR_SEIS_MASK)
988+ val |= BIT(ICC_CTLR_EL1_SEIS_SHIFT);
986989 /* A3V */
987990 val |= ((vtr >> 21) & 1) << ICC_CTLR_EL1_A3V_SHIFT;
988991 /* EOImode */
arch/arm64/kvm/vgic/vgic-v3.c+15−2
@@ -609,6 +609,18 @@ static int __init early_gicv4_enable(char *buf) · 608 unmodified lines
609609 }
610610 early_param("kvm-arm.vgic_v4_enable", early_gicv4_enable);
611611
612+static const struct midr_range broken_seis[] = {
613+ MIDR_ALL_VERSIONS(MIDR_APPLE_M1_ICESTORM),
614+ MIDR_ALL_VERSIONS(MIDR_APPLE_M1_FIRESTORM),
615+ {},
616+};
617+
618+static bool vgic_v3_broken_seis(void)
619+{
620+ return ((kvm_vgic_global_state.ich_vtr_el2 & ICH_VTR_SEIS_MASK) &&
621+ is_midr_in_range_list(read_cpuid_id(), broken_seis));
622+}
623+
612624 /**
613625 * vgic_v3_probe - probe for a VGICv3 compatible interrupt controller
614626 * @info: pointer to the GIC description
@@ -676,9 +688,10 @@ int vgic_v3_probe(const struct gic_kvm_info *info) · 61 unmodified lines
676688 group1_trap = true;
677689 }
678690
679− if (kvm_vgic_global_state.ich_vtr_el2 & ICH_VTR_SEIS_MASK) {
680− kvm_info("GICv3 with locally generated SEI\n");
691+ if (vgic_v3_broken_seis()) {
692+ kvm_info("GICv3 with broken locally generated SEI\n");
681693
694+ kvm_vgic_global_state.ich_vtr_el2 &= ~ICH_VTR_SEIS_MASK;
682695 group0_trap = true;
683696 group1_trap = true;
684697 if (ich_vtr_el2 & ICH_VTR_TDS_MASK)
arch/arm64/mm/extable.c+2−2
@@ -40,8 +40,8 @@ static bool · 39 unmodified lines
4040 ex_handler_load_unaligned_zeropad(const struct exception_table_entry *ex,
4141 struct pt_regs *regs)
4242 {
43− int reg_data = FIELD_GET(EX_DATA_REG_DATA, ex->type);
44− int reg_addr = FIELD_GET(EX_DATA_REG_ADDR, ex->type);
43+ int reg_data = FIELD_GET(EX_DATA_REG_DATA, ex->data);
44+ int reg_addr = FIELD_GET(EX_DATA_REG_ADDR, ex->data);
4545 unsigned long data, addr, offset;
4646
4747 addr = pt_regs_read_reg(regs, reg_addr);
arch/arm64/tools/cpucaps+3−0
@@ -55,6 +55,9 @@ WORKAROUND_1418040 · 54 unmodified lines
5555 WORKAROUND_1463225
5656 WORKAROUND_1508412
5757 WORKAROUND_1542419
58+WORKAROUND_2064142
59+WORKAROUND_2038923
60+WORKAROUND_1902691
5861 WORKAROUND_TRBE_OVERWRITE_FILL_MODE
5962 WORKAROUND_TSB_FLUSH_FAILURE
6063 WORKAROUND_TRBE_WRITE_OUT_OF_RANGE
arch/ia64/Kconfig+1−1
@@ -318,7 +318,7 @@ config ARCH_PROC_KCORE_TEXT · 317 unmodified lines
318318 depends on PROC_KCORE
319319
320320 config IA64_MCA_RECOVERY
321− tristate "MCA recovery from errors other than TLB."
321+ bool "MCA recovery from errors other than TLB."
322322
323323 config IA64_PALINFO
324324 tristate "/proc/pal support"
arch/ia64/pci/fixup.c+2−2
@@ -76,5 +76,5 @@ static void pci_fixup_video(struct pci_dev *pdev) · 75 unmodified lines
7676 }
7777 }
7878 }
79−DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,
80− PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video);
79+DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_ANY_ID, PCI_ANY_ID,
80+ PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video);
arch/mips/cavium-octeon/octeon-memcpy.S+1−1
@@ -74,7 +74,7 @@ · 73 unmodified lines
7474 #define EXC(inst_reg,addr,handler) \
7575 9: inst_reg, addr; \
7676 .section __ex_table,"a"; \
77− PTR 9b, handler; \
77+ PTR_WD 9b, handler; \
7878 .previous
7979
8080 /*
arch/mips/include/asm/asm.h+2−2
@@ -285,7 +285,7 @@ symbol = value · 284 unmodified lines
285285
286286 #define PTR_SCALESHIFT 2
287287
288−#define PTR .word
288+#define PTR_WD .word
289289 #define PTRSIZE 4
290290 #define PTRLOG 2
291291 #endif
@@ -310,7 +310,7 @@ symbol = value · 18 unmodified lines
310310
311311 #define PTR_SCALESHIFT 3
312312
313−#define PTR .dword
313+#define PTR_WD .dword
314314 #define PTRSIZE 8
315315 #define PTRLOG 3
316316 #endif
arch/mips/include/asm/ftrace.h+2−2
@@ -32,7 +32,7 @@ do { \ · 31 unmodified lines
3232 ".previous\n" \
3333 \
3434 ".section\t__ex_table,\"a\"\n\t" \
35− STR(PTR) "\t1b, 3b\n\t" \
35+ STR(PTR_WD) "\t1b, 3b\n\t" \
3636 ".previous\n" \
3737 \
3838 : [tmp_dst] "=&r" (dst), [tmp_err] "=r" (error)\
@@ -54,7 +54,7 @@ do { \ · 15 unmodified lines
5454 ".previous\n" \
5555 \
5656 ".section\t__ex_table,\"a\"\n\t"\
57− STR(PTR) "\t1b, 3b\n\t" \
57+ STR(PTR_WD) "\t1b, 3b\n\t" \
5858 ".previous\n" \
5959 \
6060 : [tmp_err] "=r" (error) \
arch/mips/include/asm/r4kcache.h+2−2
@@ -119,7 +119,7 @@ static inline void flush_scache_line(unsigned long addr) · 118 unmodified lines
119119 " j 2b \n" \
120120 " .previous \n" \
121121 " .section __ex_table,\"a\" \n" \
122− " "STR(PTR)" 1b, 3b \n" \
122+ " "STR(PTR_WD)" 1b, 3b \n" \
123123 " .previous" \
124124 : "+r" (__err) \
125125 : "i" (op), "r" (addr), "i" (-EFAULT)); \
@@ -142,7 +142,7 @@ static inline void flush_scache_line(unsigned long addr) · 16 unmodified lines
142142 " j 2b \n" \
143143 " .previous \n" \
144144 " .section __ex_table,\"a\" \n" \
145− " "STR(PTR)" 1b, 3b \n" \
145+ " "STR(PTR_WD)" 1b, 3b \n" \
146146 " .previous" \
147147 : "+r" (__err) \
148148 : "i" (op), "r" (addr), "i" (-EFAULT)); \
arch/mips/include/asm/unaligned-emul.h+88−88
@@ -20,8 +20,8 @@ do { \ · 19 unmodified lines
2020 "j\t3b\n\t" \
2121 ".previous\n\t" \
2222 ".section\t__ex_table,\"a\"\n\t" \
23− STR(PTR)"\t1b, 4b\n\t" \
24− STR(PTR)"\t2b, 4b\n\t" \
23+ STR(PTR_WD)"\t1b, 4b\n\t" \
24+ STR(PTR_WD)"\t2b, 4b\n\t" \
2525 ".previous" \
2626 : "=&r" (value), "=r" (res) \
2727 : "r" (addr), "i" (-EFAULT)); \
@@ -41,8 +41,8 @@ do { \ · 13 unmodified lines
4141 "j\t3b\n\t" \
4242 ".previous\n\t" \
4343 ".section\t__ex_table,\"a\"\n\t" \
44− STR(PTR)"\t1b, 4b\n\t" \
45− STR(PTR)"\t2b, 4b\n\t" \
44+ STR(PTR_WD)"\t1b, 4b\n\t" \
45+ STR(PTR_WD)"\t2b, 4b\n\t" \
4646 ".previous" \
4747 : "=&r" (value), "=r" (res) \
4848 : "r" (addr), "i" (-EFAULT)); \
@@ -74,10 +74,10 @@ do { \ · 25 unmodified lines
7474 "j\t10b\n\t" \
7575 ".previous\n\t" \
7676 ".section\t__ex_table,\"a\"\n\t" \
77− STR(PTR)"\t1b, 11b\n\t" \
78− STR(PTR)"\t2b, 11b\n\t" \
79− STR(PTR)"\t3b, 11b\n\t" \
80− STR(PTR)"\t4b, 11b\n\t" \
77+ STR(PTR_WD)"\t1b, 11b\n\t" \
78+ STR(PTR_WD)"\t2b, 11b\n\t" \
79+ STR(PTR_WD)"\t3b, 11b\n\t" \
80+ STR(PTR_WD)"\t4b, 11b\n\t" \
8181 ".previous" \
8282 : "=&r" (value), "=r" (res) \
8383 : "r" (addr), "i" (-EFAULT)); \
@@ -102,8 +102,8 @@ do { \ · 18 unmodified lines
102102 "j\t3b\n\t" \
103103 ".previous\n\t" \
104104 ".section\t__ex_table,\"a\"\n\t" \
105− STR(PTR)"\t1b, 4b\n\t" \
106− STR(PTR)"\t2b, 4b\n\t" \
105+ STR(PTR_WD)"\t1b, 4b\n\t" \
106+ STR(PTR_WD)"\t2b, 4b\n\t" \
107107 ".previous" \
108108 : "=&r" (value), "=r" (res) \
109109 : "r" (addr), "i" (-EFAULT)); \
@@ -125,8 +125,8 @@ do { \ · 15 unmodified lines
125125 "j\t3b\n\t" \
126126 ".previous\n\t" \
127127 ".section\t__ex_table,\"a\"\n\t" \
128− STR(PTR)"\t1b, 4b\n\t" \
129− STR(PTR)"\t2b, 4b\n\t" \
128+ STR(PTR_WD)"\t1b, 4b\n\t" \
129+ STR(PTR_WD)"\t2b, 4b\n\t" \
130130 ".previous" \
131131 : "=&r" (value), "=r" (res) \
132132 : "r" (addr), "i" (-EFAULT)); \
@@ -145,8 +145,8 @@ do { \ · 12 unmodified lines
145145 "j\t3b\n\t" \
146146 ".previous\n\t" \
147147 ".section\t__ex_table,\"a\"\n\t" \
148− STR(PTR)"\t1b, 4b\n\t" \
149− STR(PTR)"\t2b, 4b\n\t" \
148+ STR(PTR_WD)"\t1b, 4b\n\t" \
149+ STR(PTR_WD)"\t2b, 4b\n\t" \
150150 ".previous" \
151151 : "=&r" (value), "=r" (res) \
152152 : "r" (addr), "i" (-EFAULT)); \
@@ -178,10 +178,10 @@ do { \ · 25 unmodified lines
178178 "j\t10b\n\t" \
179179 ".previous\n\t" \
180180 ".section\t__ex_table,\"a\"\n\t" \
181− STR(PTR)"\t1b, 11b\n\t" \
182− STR(PTR)"\t2b, 11b\n\t" \
183− STR(PTR)"\t3b, 11b\n\t" \
184− STR(PTR)"\t4b, 11b\n\t" \
181+ STR(PTR_WD)"\t1b, 11b\n\t" \
182+ STR(PTR_WD)"\t2b, 11b\n\t" \
183+ STR(PTR_WD)"\t3b, 11b\n\t" \
184+ STR(PTR_WD)"\t4b, 11b\n\t" \
185185 ".previous" \
186186 : "=&r" (value), "=r" (res) \
187187 : "r" (addr), "i" (-EFAULT)); \
@@ -223,14 +223,14 @@ do { \ · 35 unmodified lines
223223 "j\t10b\n\t" \
224224 ".previous\n\t" \
225225 ".section\t__ex_table,\"a\"\n\t" \
226− STR(PTR)"\t1b, 11b\n\t" \
227− STR(PTR)"\t2b, 11b\n\t" \
228− STR(PTR)"\t3b, 11b\n\t" \
229− STR(PTR)"\t4b, 11b\n\t" \
230− STR(PTR)"\t5b, 11b\n\t" \
231− STR(PTR)"\t6b, 11b\n\t" \
232− STR(PTR)"\t7b, 11b\n\t" \
233− STR(PTR)"\t8b, 11b\n\t" \
226+ STR(PTR_WD)"\t1b, 11b\n\t" \
227+ STR(PTR_WD)"\t2b, 11b\n\t" \
228+ STR(PTR_WD)"\t3b, 11b\n\t" \
229+ STR(PTR_WD)"\t4b, 11b\n\t" \
230+ STR(PTR_WD)"\t5b, 11b\n\t" \
231+ STR(PTR_WD)"\t6b, 11b\n\t" \
232+ STR(PTR_WD)"\t7b, 11b\n\t" \
233+ STR(PTR_WD)"\t8b, 11b\n\t" \
234234 ".previous" \
235235 : "=&r" (value), "=r" (res) \
236236 : "r" (addr), "i" (-EFAULT)); \
@@ -255,8 +255,8 @@ do { \ · 18 unmodified lines
255255 "j\t3b\n\t" \
256256 ".previous\n\t" \
257257 ".section\t__ex_table,\"a\"\n\t" \
258− STR(PTR)"\t1b, 4b\n\t" \
259− STR(PTR)"\t2b, 4b\n\t" \
258+ STR(PTR_WD)"\t1b, 4b\n\t" \
259+ STR(PTR_WD)"\t2b, 4b\n\t" \
260260 ".previous" \
261261 : "=r" (res) \
262262 : "r" (value), "r" (addr), "i" (-EFAULT));\
@@ -276,8 +276,8 @@ do { \ · 13 unmodified lines
276276 "j\t3b\n\t" \
277277 ".previous\n\t" \
278278 ".section\t__ex_table,\"a\"\n\t" \
279− STR(PTR)"\t1b, 4b\n\t" \
280− STR(PTR)"\t2b, 4b\n\t" \
279+ STR(PTR_WD)"\t1b, 4b\n\t" \
280+ STR(PTR_WD)"\t2b, 4b\n\t" \
281281 ".previous" \
282282 : "=r" (res) \
283283 : "r" (value), "r" (addr), "i" (-EFAULT)); \
@@ -296,8 +296,8 @@ do { \ · 12 unmodified lines
296296 "j\t3b\n\t" \
297297 ".previous\n\t" \
298298 ".section\t__ex_table,\"a\"\n\t" \
299− STR(PTR)"\t1b, 4b\n\t" \
300− STR(PTR)"\t2b, 4b\n\t" \
299+ STR(PTR_WD)"\t1b, 4b\n\t" \
300+ STR(PTR_WD)"\t2b, 4b\n\t" \
301301 ".previous" \
302302 : "=r" (res) \
303303 : "r" (value), "r" (addr), "i" (-EFAULT)); \
@@ -325,10 +325,10 @@ do { \ · 21 unmodified lines
325325 "j\t10b\n\t" \
326326 ".previous\n\t" \
327327 ".section\t__ex_table,\"a\"\n\t" \
328− STR(PTR)"\t1b, 11b\n\t" \
329− STR(PTR)"\t2b, 11b\n\t" \
330− STR(PTR)"\t3b, 11b\n\t" \
331− STR(PTR)"\t4b, 11b\n\t" \
328+ STR(PTR_WD)"\t1b, 11b\n\t" \
329+ STR(PTR_WD)"\t2b, 11b\n\t" \
330+ STR(PTR_WD)"\t3b, 11b\n\t" \
331+ STR(PTR_WD)"\t4b, 11b\n\t" \
332332 ".previous" \
333333 : "=&r" (res) \
334334 : "r" (value), "r" (addr), "i" (-EFAULT) \
@@ -365,14 +365,14 @@ do { \ · 30 unmodified lines
365365 "j\t10b\n\t" \
366366 ".previous\n\t" \
367367 ".section\t__ex_table,\"a\"\n\t" \
368− STR(PTR)"\t1b, 11b\n\t" \
369− STR(PTR)"\t2b, 11b\n\t" \
370− STR(PTR)"\t3b, 11b\n\t" \
371− STR(PTR)"\t4b, 11b\n\t" \
372− STR(PTR)"\t5b, 11b\n\t" \
373− STR(PTR)"\t6b, 11b\n\t" \
374− STR(PTR)"\t7b, 11b\n\t" \
375− STR(PTR)"\t8b, 11b\n\t" \
368+ STR(PTR_WD)"\t1b, 11b\n\t" \
369+ STR(PTR_WD)"\t2b, 11b\n\t" \
370+ STR(PTR_WD)"\t3b, 11b\n\t" \
371+ STR(PTR_WD)"\t4b, 11b\n\t" \
372+ STR(PTR_WD)"\t5b, 11b\n\t" \
373+ STR(PTR_WD)"\t6b, 11b\n\t" \
374+ STR(PTR_WD)"\t7b, 11b\n\t" \
375+ STR(PTR_WD)"\t8b, 11b\n\t" \
376376 ".previous" \
377377 : "=&r" (res) \
378378 : "r" (value), "r" (addr), "i" (-EFAULT) \
@@ -398,8 +398,8 @@ do { \ · 19 unmodified lines
398398 "j\t3b\n\t" \
399399 ".previous\n\t" \
400400 ".section\t__ex_table,\"a\"\n\t" \
401− STR(PTR)"\t1b, 4b\n\t" \
402− STR(PTR)"\t2b, 4b\n\t" \
401+ STR(PTR_WD)"\t1b, 4b\n\t" \
402+ STR(PTR_WD)"\t2b, 4b\n\t" \
403403 ".previous" \
404404 : "=&r" (value), "=r" (res) \
405405 : "r" (addr), "i" (-EFAULT)); \
@@ -419,8 +419,8 @@ do { \ · 13 unmodified lines
419419 "j\t3b\n\t" \
420420 ".previous\n\t" \
421421 ".section\t__ex_table,\"a\"\n\t" \
422− STR(PTR)"\t1b, 4b\n\t" \
423− STR(PTR)"\t2b, 4b\n\t" \
422+ STR(PTR_WD)"\t1b, 4b\n\t" \
423+ STR(PTR_WD)"\t2b, 4b\n\t" \
424424 ".previous" \
425425 : "=&r" (value), "=r" (res) \
426426 : "r" (addr), "i" (-EFAULT)); \
@@ -452,10 +452,10 @@ do { \ · 25 unmodified lines
452452 "j\t10b\n\t" \
453453 ".previous\n\t" \
454454 ".section\t__ex_table,\"a\"\n\t" \
455− STR(PTR)"\t1b, 11b\n\t" \
456− STR(PTR)"\t2b, 11b\n\t" \
457− STR(PTR)"\t3b, 11b\n\t" \
458− STR(PTR)"\t4b, 11b\n\t" \
455+ STR(PTR_WD)"\t1b, 11b\n\t" \
456+ STR(PTR_WD)"\t2b, 11b\n\t" \
457+ STR(PTR_WD)"\t3b, 11b\n\t" \
458+ STR(PTR_WD)"\t4b, 11b\n\t" \
459459 ".previous" \
460460 : "=&r" (value), "=r" (res) \
461461 : "r" (addr), "i" (-EFAULT)); \
@@ -481,8 +481,8 @@ do { \ · 19 unmodified lines
481481 "j\t3b\n\t" \
482482 ".previous\n\t" \
483483 ".section\t__ex_table,\"a\"\n\t" \
484− STR(PTR)"\t1b, 4b\n\t" \
485− STR(PTR)"\t2b, 4b\n\t" \
484+ STR(PTR_WD)"\t1b, 4b\n\t" \
485+ STR(PTR_WD)"\t2b, 4b\n\t" \
486486 ".previous" \
487487 : "=&r" (value), "=r" (res) \
488488 : "r" (addr), "i" (-EFAULT)); \
@@ -504,8 +504,8 @@ do { \ · 15 unmodified lines
504504 "j\t3b\n\t" \
505505 ".previous\n\t" \
506506 ".section\t__ex_table,\"a\"\n\t" \
507− STR(PTR)"\t1b, 4b\n\t" \
508− STR(PTR)"\t2b, 4b\n\t" \
507+ STR(PTR_WD)"\t1b, 4b\n\t" \
508+ STR(PTR_WD)"\t2b, 4b\n\t" \
509509 ".previous" \
510510 : "=&r" (value), "=r" (res) \
511511 : "r" (addr), "i" (-EFAULT)); \
@@ -524,8 +524,8 @@ do { \ · 12 unmodified lines
524524 "j\t3b\n\t" \
525525 ".previous\n\t" \
526526 ".section\t__ex_table,\"a\"\n\t" \
527− STR(PTR)"\t1b, 4b\n\t" \
528− STR(PTR)"\t2b, 4b\n\t" \
527+ STR(PTR_WD)"\t1b, 4b\n\t" \
528+ STR(PTR_WD)"\t2b, 4b\n\t" \
529529 ".previous" \
530530 : "=&r" (value), "=r" (res) \
531531 : "r" (addr), "i" (-EFAULT)); \
@@ -557,10 +557,10 @@ do { \ · 25 unmodified lines
557557 "j\t10b\n\t" \
558558 ".previous\n\t" \
559559 ".section\t__ex_table,\"a\"\n\t" \
560− STR(PTR)"\t1b, 11b\n\t" \
561− STR(PTR)"\t2b, 11b\n\t" \
562− STR(PTR)"\t3b, 11b\n\t" \
563− STR(PTR)"\t4b, 11b\n\t" \
560+ STR(PTR_WD)"\t1b, 11b\n\t" \
561+ STR(PTR_WD)"\t2b, 11b\n\t" \
562+ STR(PTR_WD)"\t3b, 11b\n\t" \
563+ STR(PTR_WD)"\t4b, 11b\n\t" \
564564 ".previous" \
565565 : "=&r" (value), "=r" (res) \
566566 : "r" (addr), "i" (-EFAULT)); \
@@ -602,14 +602,14 @@ do { \ · 35 unmodified lines
602602 "j\t10b\n\t" \
603603 ".previous\n\t" \
604604 ".section\t__ex_table,\"a\"\n\t" \
605− STR(PTR)"\t1b, 11b\n\t" \
606− STR(PTR)"\t2b, 11b\n\t" \
607− STR(PTR)"\t3b, 11b\n\t" \
608− STR(PTR)"\t4b, 11b\n\t" \
609− STR(PTR)"\t5b, 11b\n\t" \
610− STR(PTR)"\t6b, 11b\n\t" \
611− STR(PTR)"\t7b, 11b\n\t" \
612− STR(PTR)"\t8b, 11b\n\t" \
605+ STR(PTR_WD)"\t1b, 11b\n\t" \
606+ STR(PTR_WD)"\t2b, 11b\n\t" \
607+ STR(PTR_WD)"\t3b, 11b\n\t" \
608+ STR(PTR_WD)"\t4b, 11b\n\t" \
609+ STR(PTR_WD)"\t5b, 11b\n\t" \
610+ STR(PTR_WD)"\t6b, 11b\n\t" \
611+ STR(PTR_WD)"\t7b, 11b\n\t" \
612+ STR(PTR_WD)"\t8b, 11b\n\t" \
613613 ".previous" \
614614 : "=&r" (value), "=r" (res) \
615615 : "r" (addr), "i" (-EFAULT)); \
@@ -632,8 +632,8 @@ do { \ · 16 unmodified lines
632632 "j\t3b\n\t" \
633633 ".previous\n\t" \
634634 ".section\t__ex_table,\"a\"\n\t" \
635− STR(PTR)"\t1b, 4b\n\t" \
636− STR(PTR)"\t2b, 4b\n\t" \
635+ STR(PTR_WD)"\t1b, 4b\n\t" \
636+ STR(PTR_WD)"\t2b, 4b\n\t" \
637637 ".previous" \
638638 : "=r" (res) \
639639 : "r" (value), "r" (addr), "i" (-EFAULT));\
@@ -653,8 +653,8 @@ do { \ · 13 unmodified lines
653653 "j\t3b\n\t" \
654654 ".previous\n\t" \
655655 ".section\t__ex_table,\"a\"\n\t" \
656− STR(PTR)"\t1b, 4b\n\t" \
657− STR(PTR)"\t2b, 4b\n\t" \
656+ STR(PTR_WD)"\t1b, 4b\n\t" \
657+ STR(PTR_WD)"\t2b, 4b\n\t" \
658658 ".previous" \
659659 : "=r" (res) \
660660 : "r" (value), "r" (addr), "i" (-EFAULT)); \
@@ -673,8 +673,8 @@ do { \ · 12 unmodified lines
673673 "j\t3b\n\t" \
674674 ".previous\n\t" \
675675 ".section\t__ex_table,\"a\"\n\t" \
676− STR(PTR)"\t1b, 4b\n\t" \
677− STR(PTR)"\t2b, 4b\n\t" \
676+ STR(PTR_WD)"\t1b, 4b\n\t" \
677+ STR(PTR_WD)"\t2b, 4b\n\t" \
678678 ".previous" \
679679 : "=r" (res) \
680680 : "r" (value), "r" (addr), "i" (-EFAULT)); \
@@ -703,10 +703,10 @@ do { \ · 22 unmodified lines
703703 "j\t10b\n\t" \
704704 ".previous\n\t" \
705705 ".section\t__ex_table,\"a\"\n\t" \
706− STR(PTR)"\t1b, 11b\n\t" \
707− STR(PTR)"\t2b, 11b\n\t" \
708− STR(PTR)"\t3b, 11b\n\t" \
709− STR(PTR)"\t4b, 11b\n\t" \
706+ STR(PTR_WD)"\t1b, 11b\n\t" \
707+ STR(PTR_WD)"\t2b, 11b\n\t" \
708+ STR(PTR_WD)"\t3b, 11b\n\t" \
709+ STR(PTR_WD)"\t4b, 11b\n\t" \
710710 ".previous" \
711711 : "=&r" (res) \
712712 : "r" (value), "r" (addr), "i" (-EFAULT) \
@@ -743,14 +743,14 @@ do { \ · 30 unmodified lines
743743 "j\t10b\n\t" \
744744 ".previous\n\t" \
745745 ".section\t__ex_table,\"a\"\n\t" \
746− STR(PTR)"\t1b, 11b\n\t" \
747− STR(PTR)"\t2b, 11b\n\t" \
748− STR(PTR)"\t3b, 11b\n\t" \
749− STR(PTR)"\t4b, 11b\n\t" \
750− STR(PTR)"\t5b, 11b\n\t" \
751− STR(PTR)"\t6b, 11b\n\t" \
752− STR(PTR)"\t7b, 11b\n\t" \
753− STR(PTR)"\t8b, 11b\n\t" \
746+ STR(PTR_WD)"\t1b, 11b\n\t" \
747+ STR(PTR_WD)"\t2b, 11b\n\t" \
748+ STR(PTR_WD)"\t3b, 11b\n\t" \
749+ STR(PTR_WD)"\t4b, 11b\n\t" \
750+ STR(PTR_WD)"\t5b, 11b\n\t" \
751+ STR(PTR_WD)"\t6b, 11b\n\t" \
752+ STR(PTR_WD)"\t7b, 11b\n\t" \
753+ STR(PTR_WD)"\t8b, 11b\n\t" \
754754 ".previous" \
755755 : "=&r" (res) \
756756 : "r" (value), "r" (addr), "i" (-EFAULT) \
arch/mips/kernel/mips-r2-to-r6-emul.c+52−52
@@ -1258,10 +1258,10 @@ fpu_emul: · 1257 unmodified lines
12581258 " j 10b\n"
12591259 " .previous\n"
12601260 " .section __ex_table,\"a\"\n"
1261− STR(PTR) " 1b,8b\n"
1262− STR(PTR) " 2b,8b\n"
1263− STR(PTR) " 3b,8b\n"
1264− STR(PTR) " 4b,8b\n"
1261+ STR(PTR_WD) " 1b,8b\n"
1262+ STR(PTR_WD) " 2b,8b\n"
1263+ STR(PTR_WD) " 3b,8b\n"
1264+ STR(PTR_WD) " 4b,8b\n"
12651265 " .previous\n"
12661266 " .set pop\n"
12671267 : "+&r"(rt), "=&r"(rs),
@@ -1333,10 +1333,10 @@ fpu_emul: · 65 unmodified lines
13331333 " j 10b\n"
13341334 " .previous\n"
13351335 " .section __ex_table,\"a\"\n"
1336− STR(PTR) " 1b,8b\n"
1337− STR(PTR) " 2b,8b\n"
1338− STR(PTR) " 3b,8b\n"
1339− STR(PTR) " 4b,8b\n"
1336+ STR(PTR_WD) " 1b,8b\n"
1337+ STR(PTR_WD) " 2b,8b\n"
1338+ STR(PTR_WD) " 3b,8b\n"
1339+ STR(PTR_WD) " 4b,8b\n"
13401340 " .previous\n"
13411341 " .set pop\n"
13421342 : "+&r"(rt), "=&r"(rs),
@@ -1404,10 +1404,10 @@ fpu_emul: · 61 unmodified lines
14041404 " j 9b\n"
14051405 " .previous\n"
14061406 " .section __ex_table,\"a\"\n"
1407− STR(PTR) " 1b,8b\n"
1408− STR(PTR) " 2b,8b\n"
1409− STR(PTR) " 3b,8b\n"
1410− STR(PTR) " 4b,8b\n"
1407+ STR(PTR_WD) " 1b,8b\n"
1408+ STR(PTR_WD) " 2b,8b\n"
1409+ STR(PTR_WD) " 3b,8b\n"
1410+ STR(PTR_WD) " 4b,8b\n"
14111411 " .previous\n"
14121412 " .set pop\n"
14131413 : "+&r"(rt), "=&r"(rs),
@@ -1474,10 +1474,10 @@ fpu_emul: · 60 unmodified lines
14741474 " j 9b\n"
14751475 " .previous\n"
14761476 " .section __ex_table,\"a\"\n"
1477− STR(PTR) " 1b,8b\n"
1478− STR(PTR) " 2b,8b\n"
1479− STR(PTR) " 3b,8b\n"
1480− STR(PTR) " 4b,8b\n"
1477+ STR(PTR_WD) " 1b,8b\n"
1478+ STR(PTR_WD) " 2b,8b\n"
1479+ STR(PTR_WD) " 3b,8b\n"
1480+ STR(PTR_WD) " 4b,8b\n"
14811481 " .previous\n"
14821482 " .set pop\n"
14831483 : "+&r"(rt), "=&r"(rs),
@@ -1589,14 +1589,14 @@ fpu_emul: · 105 unmodified lines
15891589 " j 9b\n"
15901590 " .previous\n"
15911591 " .section __ex_table,\"a\"\n"
1592− STR(PTR) " 1b,8b\n"
1593− STR(PTR) " 2b,8b\n"
1594− STR(PTR) " 3b,8b\n"
1595− STR(PTR) " 4b,8b\n"
1596− STR(PTR) " 5b,8b\n"
1597− STR(PTR) " 6b,8b\n"
1598− STR(PTR) " 7b,8b\n"
1599− STR(PTR) " 0b,8b\n"
1592+ STR(PTR_WD) " 1b,8b\n"
1593+ STR(PTR_WD) " 2b,8b\n"
1594+ STR(PTR_WD) " 3b,8b\n"
1595+ STR(PTR_WD) " 4b,8b\n"
1596+ STR(PTR_WD) " 5b,8b\n"
1597+ STR(PTR_WD) " 6b,8b\n"
1598+ STR(PTR_WD) " 7b,8b\n"
1599+ STR(PTR_WD) " 0b,8b\n"
16001600 " .previous\n"
16011601 " .set pop\n"
16021602 : "+&r"(rt), "=&r"(rs),
@@ -1708,14 +1708,14 @@ fpu_emul: · 105 unmodified lines
17081708 " j 9b\n"
17091709 " .previous\n"
17101710 " .section __ex_table,\"a\"\n"
1711− STR(PTR) " 1b,8b\n"
1712− STR(PTR) " 2b,8b\n"
1713− STR(PTR) " 3b,8b\n"
1714− STR(PTR) " 4b,8b\n"
1715− STR(PTR) " 5b,8b\n"
1716− STR(PTR) " 6b,8b\n"
1717− STR(PTR) " 7b,8b\n"
1718− STR(PTR) " 0b,8b\n"
1711+ STR(PTR_WD) " 1b,8b\n"
1712+ STR(PTR_WD) " 2b,8b\n"
1713+ STR(PTR_WD) " 3b,8b\n"
1714+ STR(PTR_WD) " 4b,8b\n"
1715+ STR(PTR_WD) " 5b,8b\n"
1716+ STR(PTR_WD) " 6b,8b\n"
1717+ STR(PTR_WD) " 7b,8b\n"
1718+ STR(PTR_WD) " 0b,8b\n"
17191719 " .previous\n"
17201720 " .set pop\n"
17211721 : "+&r"(rt), "=&r"(rs),
@@ -1827,14 +1827,14 @@ fpu_emul: · 105 unmodified lines
18271827 " j 9b\n"
18281828 " .previous\n"
18291829 " .section __ex_table,\"a\"\n"
1830− STR(PTR) " 1b,8b\n"
1831− STR(PTR) " 2b,8b\n"
1832− STR(PTR) " 3b,8b\n"
1833− STR(PTR) " 4b,8b\n"
1834− STR(PTR) " 5b,8b\n"
1835− STR(PTR) " 6b,8b\n"
1836− STR(PTR) " 7b,8b\n"
1837− STR(PTR) " 0b,8b\n"
1830+ STR(PTR_WD) " 1b,8b\n"
1831+ STR(PTR_WD) " 2b,8b\n"
1832+ STR(PTR_WD) " 3b,8b\n"
1833+ STR(PTR_WD) " 4b,8b\n"
1834+ STR(PTR_WD) " 5b,8b\n"
1835+ STR(PTR_WD) " 6b,8b\n"
1836+ STR(PTR_WD) " 7b,8b\n"
1837+ STR(PTR_WD) " 0b,8b\n"
18381838 " .previous\n"
18391839 " .set pop\n"
18401840 : "+&r"(rt), "=&r"(rs),
@@ -1945,14 +1945,14 @@ fpu_emul: · 104 unmodified lines
19451945 " j 9b\n"
19461946 " .previous\n"
19471947 " .section __ex_table,\"a\"\n"
1948− STR(PTR) " 1b,8b\n"
1949− STR(PTR) " 2b,8b\n"
1950− STR(PTR) " 3b,8b\n"
1951− STR(PTR) " 4b,8b\n"
1952− STR(PTR) " 5b,8b\n"
1953− STR(PTR) " 6b,8b\n"
1954− STR(PTR) " 7b,8b\n"
1955− STR(PTR) " 0b,8b\n"
1948+ STR(PTR_WD) " 1b,8b\n"
1949+ STR(PTR_WD) " 2b,8b\n"
1950+ STR(PTR_WD) " 3b,8b\n"
1951+ STR(PTR_WD) " 4b,8b\n"
1952+ STR(PTR_WD) " 5b,8b\n"
1953+ STR(PTR_WD) " 6b,8b\n"
1954+ STR(PTR_WD) " 7b,8b\n"
1955+ STR(PTR_WD) " 0b,8b\n"
19561956 " .previous\n"
19571957 " .set pop\n"
19581958 : "+&r"(rt), "=&r"(rs),
@@ -2007,7 +2007,7 @@ fpu_emul: · 48 unmodified lines
20072007 "j 2b\n"
20082008 ".previous\n"
20092009 ".section __ex_table,\"a\"\n"
2010− STR(PTR) " 1b,3b\n"
2010+ STR(PTR_WD) " 1b,3b\n"
20112011 ".previous\n"
20122012 : "=&r"(res), "+&r"(err)
20132013 : "r"(vaddr), "i"(SIGSEGV)
@@ -2065,7 +2065,7 @@ fpu_emul: · 51 unmodified lines
20652065 "j 2b\n"
20662066 ".previous\n"
20672067 ".section __ex_table,\"a\"\n"
2068− STR(PTR) " 1b,3b\n"
2068+ STR(PTR_WD) " 1b,3b\n"
20692069 ".previous\n"
20702070 : "+&r"(res), "+&r"(err)
20712071 : "r"(vaddr), "i"(SIGSEGV));
@@ -2126,7 +2126,7 @@ fpu_emul: · 54 unmodified lines
21262126 "j 2b\n"
21272127 ".previous\n"
21282128 ".section __ex_table,\"a\"\n"
2129− STR(PTR) " 1b,3b\n"
2129+ STR(PTR_WD) " 1b,3b\n"
21302130 ".previous\n"
21312131 : "=&r"(res), "+&r"(err)
21322132 : "r"(vaddr), "i"(SIGSEGV)
@@ -2189,7 +2189,7 @@ fpu_emul: · 56 unmodified lines
21892189 "j 2b\n"
21902190 ".previous\n"
21912191 ".section __ex_table,\"a\"\n"
2192− STR(PTR) " 1b,3b\n"
2192+ STR(PTR_WD) " 1b,3b\n"
21932193 ".previous\n"
21942194 : "+&r"(res), "+&r"(err)
21952195 : "r"(vaddr), "i"(SIGSEGV));
arch/mips/kernel/r2300_fpu.S+3−3
@@ -23,14 +23,14 @@ · 22 unmodified lines
2323 #define EX(a,b) \
2424 9: a,##b; \
2525 .section __ex_table,"a"; \
26− PTR 9b,fault; \
26+ PTR_WD 9b,fault; \
2727 .previous
2828
2929 #define EX2(a,b) \
3030 9: a,##b; \
3131 .section __ex_table,"a"; \
32− PTR 9b,fault; \
33− PTR 9b+4,fault; \
32+ PTR_WD 9b,fault; \
33+ PTR_WD 9b+4,fault; \
3434 .previous
3535
3636 .set mips1
arch/mips/kernel/r4k_fpu.S+1−1
@@ -31,7 +31,7 @@ · 30 unmodified lines
3131 .ex\@: \insn \reg, \src
3232 .set pop
3333 .section __ex_table,"a"
34− PTR .ex\@, fault
34+ PTR_WD .ex\@, fault
3535 .previous
3636 .endm
3737
arch/mips/kernel/relocate_kernel.S+11−11
@@ -147,10 +147,10 @@ LEAF(kexec_smp_wait) · 146 unmodified lines
147147
148148 kexec_args:
149149 EXPORT(kexec_args)
150−arg0: PTR 0x0
151−arg1: PTR 0x0
152−arg2: PTR 0x0
153−arg3: PTR 0x0
150+arg0: PTR_WD 0x0
151+arg1: PTR_WD 0x0
152+arg2: PTR_WD 0x0
153+arg3: PTR_WD 0x0
154154 .size kexec_args,PTRSIZE*4
155155
156156 #ifdef CONFIG_SMP
@@ -161,10 +161,10 @@ arg3: PTR 0x0 · 4 unmodified lines
161161 */
162162 secondary_kexec_args:
163163 EXPORT(secondary_kexec_args)
164−s_arg0: PTR 0x0
165−s_arg1: PTR 0x0
166−s_arg2: PTR 0x0
167−s_arg3: PTR 0x0
164+s_arg0: PTR_WD 0x0
165+s_arg1: PTR_WD 0x0
166+s_arg2: PTR_WD 0x0
167+s_arg3: PTR_WD 0x0
168168 .size secondary_kexec_args,PTRSIZE*4
169169 kexec_flag:
170170 LONG 0x1
@@ -173,17 +173,17 @@ kexec_flag: · 2 unmodified lines
173173
174174 kexec_start_address:
175175 EXPORT(kexec_start_address)
176− PTR 0x0
176+ PTR_WD 0x0
177177 .size kexec_start_address, PTRSIZE
178178
179179 kexec_indirection_page:
180180 EXPORT(kexec_indirection_page)
181− PTR 0
181+ PTR_WD 0
182182 .size kexec_indirection_page, PTRSIZE
183183
184184 relocate_new_kernel_end:
185185
186186 relocate_new_kernel_size:
187187 EXPORT(relocate_new_kernel_size)
188− PTR relocate_new_kernel_end - relocate_new_kernel
188+ PTR_WD relocate_new_kernel_end - relocate_new_kernel
189189 .size relocate_new_kernel_size, PTRSIZE
arch/mips/kernel/scall32-o32.S+5−5
@@ -72,10 +72,10 @@ loads_done: · 71 unmodified lines
7272 .set pop
7373
7474 .section __ex_table,"a"
75− PTR load_a4, bad_stack_a4
76− PTR load_a5, bad_stack_a5
77− PTR load_a6, bad_stack_a6
78− PTR load_a7, bad_stack_a7
75+ PTR_WD load_a4, bad_stack_a4
76+ PTR_WD load_a5, bad_stack_a5
77+ PTR_WD load_a6, bad_stack_a6
78+ PTR_WD load_a7, bad_stack_a7
7979 .previous
8080
8181 lw t0, TI_FLAGS($28) # syscall tracing enabled?
@@ -216,7 +216,7 @@ einval: li v0, -ENOSYS · 134 unmodified lines
216216 #endif /* CONFIG_MIPS_MT_FPAFF */
217217
218218 #define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, native)
219−#define __SYSCALL(nr, entry) PTR entry
219+#define __SYSCALL(nr, entry) PTR_WD entry
220220 .align 2
221221 .type sys_call_table, @object
222222 EXPORT(sys_call_table)
arch/mips/kernel/scall64-n32.S+1−1
@@ -101,7 +101,7 @@ not_n32_scall: · 100 unmodified lines
101101
102102 END(handle_sysn32)
103103
104−#define __SYSCALL(nr, entry) PTR entry
104+#define __SYSCALL(nr, entry) PTR_WD entry
105105 .type sysn32_call_table, @object
106106 EXPORT(sysn32_call_table)
107107 #include <asm/syscall_table_n32.h>
arch/mips/kernel/scall64-n64.S+1−1
@@ -109,7 +109,7 @@ illegal_syscall: · 108 unmodified lines
109109 j n64_syscall_exit
110110 END(handle_sys64)
111111
112−#define __SYSCALL(nr, entry) PTR entry
112+#define __SYSCALL(nr, entry) PTR_WD entry
113113 .align 3
114114 .type sys_call_table, @object
115115 EXPORT(sys_call_table)
arch/mips/kernel/scall64-o32.S+5−5
@@ -73,10 +73,10 @@ load_a7: lw a7, 28(t0) # argument #8 from usp · 72 unmodified lines
7373 loads_done:
7474
7575 .section __ex_table,"a"
76− PTR load_a4, bad_stack_a4
77− PTR load_a5, bad_stack_a5
78− PTR load_a6, bad_stack_a6
79− PTR load_a7, bad_stack_a7
76+ PTR_WD load_a4, bad_stack_a4
77+ PTR_WD load_a5, bad_stack_a5
78+ PTR_WD load_a6, bad_stack_a6
79+ PTR_WD load_a7, bad_stack_a7
8080 .previous
8181
8282 li t1, _TIF_WORK_SYSCALL_ENTRY
@@ -214,7 +214,7 @@ einval: li v0, -ENOSYS · 131 unmodified lines
214214 END(sys32_syscall)
215215
216216 #define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, compat)
217−#define __SYSCALL(nr, entry) PTR entry
217+#define __SYSCALL(nr, entry) PTR_WD entry
218218 .align 3
219219 .type sys32_call_table,@object
220220 EXPORT(sys32_call_table)
arch/mips/kernel/syscall.c+4−4
@@ -122,8 +122,8 @@ static inline int mips_atomic_set(unsigned long addr, unsigned long new) · 121 unmodified lines
122122 " j 3b \n"
123123 " .previous \n"
124124 " .section __ex_table,\"a\" \n"
125− " "STR(PTR)" 1b, 4b \n"
126− " "STR(PTR)" 2b, 4b \n"
125+ " "STR(PTR_WD)" 1b, 4b \n"
126+ " "STR(PTR_WD)" 2b, 4b \n"
127127 " .previous \n"
128128 " .set pop \n"
129129 : [old] "=&r" (old),
@@ -152,8 +152,8 @@ static inline int mips_atomic_set(unsigned long addr, unsigned long new) · 22 unmodified lines
152152 " j 3b \n"
153153 " .previous \n"
154154 " .section __ex_table,\"a\" \n"
155− " "STR(PTR)" 1b, 5b \n"
156− " "STR(PTR)" 2b, 5b \n"
155+ " "STR(PTR_WD)" 1b, 5b \n"
156+ " "STR(PTR_WD)" 2b, 5b \n"
157157 " .previous \n"
158158 " .set pop \n"
159159 : [old] "=&r" (old),
arch/mips/kvm/vz.c+9−3
@@ -458,8 +458,8 @@ void kvm_vz_acquire_htimer(struct kvm_vcpu *vcpu) · 457 unmodified lines
458458 /**
459459 * _kvm_vz_save_htimer() - Switch to software emulation of guest timer.
460460 * @vcpu: Virtual CPU.
461− * @compare: Pointer to write compare value to.
462− * @cause: Pointer to write cause value to.
461+ * @out_compare: Pointer to write compare value to.
462+ * @out_cause: Pointer to write cause value to.
463463 *
464464 * Save VZ guest timer state and switch to software emulation of guest CP0
465465 * timer. The hard timer must already be in use, so preemption should be
@@ -1541,11 +1541,14 @@ static int kvm_trap_vz_handle_guest_exit(struct kvm_vcpu *vcpu) · 1075 unmodified lines
15411541 }
15421542
15431543 /**
1544− * kvm_trap_vz_handle_cop_unusuable() - Guest used unusable coprocessor.
1544+ * kvm_trap_vz_handle_cop_unusable() - Guest used unusable coprocessor.
15451545 * @vcpu: Virtual CPU context.
15461546 *
15471547 * Handle when the guest attempts to use a coprocessor which hasn't been allowed
15481548 * by the root context.
1549+ *
1550+ * Return: value indicating whether to resume the host or the guest
1551+ * (RESUME_HOST or RESUME_GUEST)
15491552 */
15501553 static int kvm_trap_vz_handle_cop_unusable(struct kvm_vcpu *vcpu)
15511554 {
@@ -1592,6 +1595,9 @@ static int kvm_trap_vz_handle_cop_unusable(struct kvm_vcpu *vcpu) · 40 unmodified lines
15921595 *
15931596 * Handle when the guest attempts to use MSA when it is disabled in the root
15941597 * context.
1598+ *
1599+ * Return: value indicating whether to resume the host or the guest
1600+ * (RESUME_HOST or RESUME_GUEST)
15951601 */
15961602 static int kvm_trap_vz_handle_msa_disabled(struct kvm_vcpu *vcpu)
15971603 {
arch/mips/lib/csum_partial.S+2−2
@@ -347,7 +347,7 @@ EXPORT_SYMBOL(csum_partial) · 346 unmodified lines
347347 .if \mode == LEGACY_MODE; \
348348 9: insn reg, addr; \
349349 .section __ex_table,"a"; \
350− PTR 9b, .L_exc; \
350+ PTR_WD 9b, .L_exc; \
351351 .previous; \
352352 /* This is enabled in EVA mode */ \
353353 .else; \
@@ -356,7 +356,7 @@ EXPORT_SYMBOL(csum_partial) · 2 unmodified lines
356356 ((\to == USEROP) && (type == ST_INSN)); \
357357 9: __BUILD_EVA_INSN(insn##e, reg, addr); \
358358 .section __ex_table,"a"; \
359− PTR 9b, .L_exc; \
359+ PTR_WD 9b, .L_exc; \
360360 .previous; \
361361 .else; \
362362 /* EVA without exception */ \
arch/mips/lib/memcpy.S+2−2
@@ -116,7 +116,7 @@ · 115 unmodified lines
116116 .if \mode == LEGACY_MODE; \
117117 9: insn reg, addr; \
118118 .section __ex_table,"a"; \
119− PTR 9b, handler; \
119+ PTR_WD 9b, handler; \
120120 .previous; \
121121 /* This is assembled in EVA mode */ \
122122 .else; \
@@ -125,7 +125,7 @@ · 2 unmodified lines
125125 ((\to == USEROP) && (type == ST_INSN)); \
126126 9: __BUILD_EVA_INSN(insn##e, reg, addr); \
127127 .section __ex_table,"a"; \
128− PTR 9b, handler; \
128+ PTR_WD 9b, handler; \
129129 .previous; \
130130 .else; \
131131 /* \
arch/mips/lib/memset.S+1−1
@@ -52,7 +52,7 @@ · 51 unmodified lines
5252 9: ___BUILD_EVA_INSN(insn, reg, addr); \
5353 .endif; \
5454 .section __ex_table,"a"; \
55− PTR 9b, handler; \
55+ PTR_WD 9b, handler; \
5656 .previous
5757
5858 .macro f_fill64 dst, offset, val, fixup, mode
arch/mips/lib/strncpy_user.S+2−2
@@ -15,7 +15,7 @@ · 14 unmodified lines
1515 #define EX(insn,reg,addr,handler) \
1616 9: insn reg, addr; \
1717 .section __ex_table,"a"; \
18− PTR 9b, handler; \
18+ PTR_WD 9b, handler; \
1919 .previous
2020
2121 /*
@@ -59,7 +59,7 @@ LEAF(__strncpy_from_user_asm) · 37 unmodified lines
5959 jr ra
6060
6161 .section __ex_table,"a"
62− PTR 1b, .Lfault
62+ PTR_WD 1b, .Lfault
6363 .previous
6464
6565 EXPORT_SYMBOL(__strncpy_from_user_asm)
arch/mips/lib/strnlen_user.S+1−1
@@ -14,7 +14,7 @@ · 13 unmodified lines
1414 #define EX(insn,reg,addr,handler) \
1515 9: insn reg, addr; \
1616 .section __ex_table,"a"; \
17− PTR 9b, handler; \
17+ PTR_WD 9b, handler; \
1818 .previous
1919
2020 /*
arch/mips/loongson64/vbios_quirk.c+4−5
@@ -3,7 +3,7 @@ · 2 unmodified lines
33 #include <linux/pci.h>
44 #include <loongson.h>
55
6−static void pci_fixup_radeon(struct pci_dev *pdev)
6+static void pci_fixup_video(struct pci_dev *pdev)
77 {
88 struct resource *res = &pdev->resource[PCI_ROM_RESOURCE];
99
@@ -22,8 +22,7 @@ static void pci_fixup_radeon(struct pci_dev *pdev) · 12 unmodified lines
2222 res->flags = IORESOURCE_MEM | IORESOURCE_ROM_SHADOW |
2323 IORESOURCE_PCI_FIXED;
2424
25− dev_info(&pdev->dev, "BAR %d: assigned %pR for Radeon ROM\n",
26− PCI_ROM_RESOURCE, res);
25+ dev_info(&pdev->dev, "Video device with shadowed ROM at %pR\n", res);
2726 }
28−DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_ATI, 0x9615,
29− PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_radeon);
27+DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_ATI, 0x9615,
28+ PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video);
arch/powerpc/include/asm/book3s/32/pgtable.h+1−0
@@ -178,6 +178,7 @@ static inline bool pte_user(pte_t pte) · 177 unmodified lines
178178 #ifndef __ASSEMBLY__
179179
180180 int map_kernel_page(unsigned long va, phys_addr_t pa, pgprot_t prot);
181+void unmap_kernel_page(unsigned long va);
181182
182183 #endif /* !__ASSEMBLY__ */
183184
arch/powerpc/include/asm/book3s/64/pgtable.h+2−0
@@ -1082,6 +1082,8 @@ static inline int map_kernel_page(unsigned long ea, unsigned long pa, pgprot_t p · 1081 unmodified lines
10821082 return hash__map_kernel_page(ea, pa, prot);
10831083 }
10841084
1085+void unmap_kernel_page(unsigned long va);
1086+
10851087 static inline int __meminit vmemmap_create_mapping(unsigned long start,
10861088 unsigned long page_size,
10871089 unsigned long phys)
arch/powerpc/include/asm/fixmap.h+4−2
@@ -111,8 +111,10 @@ static inline void __set_fixmap(enum fixed_addresses idx, · 110 unmodified lines
111111 BUILD_BUG_ON(idx >= __end_of_fixed_addresses);
112112 else if (WARN_ON(idx >= __end_of_fixed_addresses))
113113 return;
114−
115− map_kernel_page(__fix_to_virt(idx), phys, flags);
114+ if (pgprot_val(flags))
115+ map_kernel_page(__fix_to_virt(idx), phys, flags);
116+ else
117+ unmap_kernel_page(__fix_to_virt(idx));
116118 }
117119
118120 #define __early_set_fixmap __set_fixmap
arch/powerpc/include/asm/kvm_book3s_64.h+0−1
@@ -39,7 +39,6 @@ struct kvm_nested_guest { · 38 unmodified lines
3939 pgd_t *shadow_pgtable; /* our page table for this guest */
4040 u64 l1_gr_to_hr; /* L1's addr of part'n-scoped table */
4141 u64 process_table; /* process table entry for this guest */
42− u64 hfscr; /* HFSCR that the L1 requested for this nested guest */
4342 long refcnt; /* number of pointers to this struct */
4443 struct mutex tlb_lock; /* serialize page faults and tlbies */
4544 struct kvm_nested_guest *next;
arch/powerpc/include/asm/kvm_host.h+1−0
@@ -818,6 +818,7 @@ struct kvm_vcpu_arch { · 817 unmodified lines
818818
819819 /* For support of nested guests */
820820 struct kvm_nested_guest *nested;
821+ u64 nested_hfscr; /* HFSCR that the L1 requested for the nested guest */
821822 u32 nested_vcpu_id;
822823 gpa_t nested_io_gpr;
823824 #endif
arch/powerpc/include/asm/nohash/32/pgtable.h+1−0
@@ -64,6 +64,7 @@ extern int icache_44x_need_flush; · 63 unmodified lines
6464 #ifndef __ASSEMBLY__
6565
6666 int map_kernel_page(unsigned long va, phys_addr_t pa, pgprot_t prot);
67+void unmap_kernel_page(unsigned long va);
6768
6869 #endif /* !__ASSEMBLY__ */
6970
arch/powerpc/include/asm/nohash/64/pgtable.h+1−0
@@ -308,6 +308,7 @@ static inline void __ptep_set_access_flags(struct vm_area_struct *vma, · 307 unmodified lines
308308 #define __swp_entry_to_pte(x) __pte((x).val)
309309
310310 int map_kernel_page(unsigned long ea, unsigned long pa, pgprot_t prot);
311+void unmap_kernel_page(unsigned long va);
311312 extern int __meminit vmemmap_create_mapping(unsigned long start,
312313 unsigned long page_size,
313314 unsigned long phys);
arch/powerpc/kernel/time.c+3−2
@@ -649,8 +649,9 @@ DEFINE_INTERRUPT_HANDLER_ASYNC(timer_interrupt) · 648 unmodified lines
649649 __this_cpu_inc(irq_stat.timer_irqs_event);
650650 } else {
651651 now = *next_tb - now;
652− if (now <= decrementer_max)
653− set_dec_or_work(now);
652+ if (now > decrementer_max)
653+ now = decrementer_max;
654+ set_dec_or_work(now);
654655 __this_cpu_inc(irq_stat.timer_irqs_others);
655656 }
656657
arch/powerpc/kvm/book3s_hv.c+1−2
@@ -1816,7 +1816,6 @@ static int kvmppc_handle_exit_hv(struct kvm_vcpu *vcpu, · 1815 unmodified lines
18161816
18171817 static int kvmppc_handle_nested_exit(struct kvm_vcpu *vcpu)
18181818 {
1819− struct kvm_nested_guest *nested = vcpu->arch.nested;
18201819 int r;
18211820 int srcu_idx;
18221821
@@ -1922,7 +1921,7 @@ static int kvmppc_handle_nested_exit(struct kvm_vcpu *vcpu) · 99 unmodified lines
19221921 * it into a HEAI.
19231922 */
19241923 if (!(vcpu->arch.hfscr_permitted & (1UL << cause)) ||
1925− (nested->hfscr & (1UL << cause))) {
1924+ (vcpu->arch.nested_hfscr & (1UL << cause))) {
19261925 vcpu->arch.trap = BOOK3S_INTERRUPT_H_EMUL_ASSIST;
19271926
19281927 /*
arch/powerpc/kvm/book3s_hv_nested.c+1−1
@@ -363,7 +363,7 @@ long kvmhv_enter_nested_guest(struct kvm_vcpu *vcpu) · 362 unmodified lines
363363 /* set L1 state to L2 state */
364364 vcpu->arch.nested = l2;
365365 vcpu->arch.nested_vcpu_id = l2_hv.vcpu_token;
366− l2->hfscr = l2_hv.hfscr;
366+ vcpu->arch.nested_hfscr = l2_hv.hfscr;
367367 vcpu->arch.regs = l2_regs;
368368
369369 /* Guest must always run with ME enabled, HV disabled. */
arch/powerpc/mm/pgtable.c+9−0
@@ -206,6 +206,15 @@ void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, · 205 unmodified lines
206206 __set_pte_at(mm, addr, ptep, pte, 0);
207207 }
208208
209+void unmap_kernel_page(unsigned long va)
210+{
211+ pmd_t *pmdp = pmd_off_k(va);
212+ pte_t *ptep = pte_offset_kernel(pmdp, va);
213+
214+ pte_clear(&init_mm, va, ptep);
215+ flush_tlb_kernel_range(va, va + PAGE_SIZE);
216+}
217+
209218 /*
210219 * This is called when relaxing access to a PTE. It's also called in the page
211220 * fault path when we don't hit any of the major fault cases, ie, a minor
arch/powerpc/perf/core-book3s.c+14−3
@@ -1355,9 +1355,20 @@ static void power_pmu_disable(struct pmu *pmu) · 1354 unmodified lines
13551355 * Otherwise provide a warning if there is PMI pending, but
13561356 * no counter is found overflown.
13571357 */
1358− if (any_pmc_overflown(cpuhw))
1359− clear_pmi_irq_pending();
1360− else
1358+ if (any_pmc_overflown(cpuhw)) {
1359+ /*
1360+ * Since power_pmu_disable runs under local_irq_save, it
1361+ * could happen that code hits a PMC overflow without PMI
1362+ * pending in paca. Hence only clear PMI pending if it was
1363+ * set.
1364+ *
1365+ * If a PMI is pending, then MSR[EE] must be disabled (because
1366+ * the masked PMI handler disabling EE). So it is safe to
1367+ * call clear_pmi_irq_pending().
1368+ */
1369+ if (pmi_irq_pending())
1370+ clear_pmi_irq_pending();
1371+ } else
13611372 WARN_ON(pmi_irq_pending());
13621373
13631374 val = mmcra = cpuhw->mmcr.mmcra;
arch/s390/Kconfig+15−0
@@ -945,6 +945,9 @@ config S390_GUEST · 944 unmodified lines
945945
946946 endmenu
947947
948+config S390_MODULES_SANITY_TEST_HELPERS
949+ def_bool n
950+
948951 menu "Selftests"
949952
950953 config S390_UNWIND_SELFTEST
@@ -971,4 +974,16 @@ config S390_KPROBES_SANITY_TEST · 20 unmodified lines
971974
972975 Say N if you are unsure.
973976
977+config S390_MODULES_SANITY_TEST
978+ def_tristate n
979+ depends on KUNIT
980+ default KUNIT_ALL_TESTS
981+ prompt "Enable s390 specific modules tests"
982+ select S390_MODULES_SANITY_TEST_HELPERS
983+ help
984+ This option enables an s390 specific modules test. This option is
985+ not useful for distributions or general kernels, but only for
986+ kernel developers working on architecture code.
987+
988+ Say N if you are unsure.
974989 endmenu
arch/s390/configs/debug_defconfig+10−10
@@ -63,6 +63,7 @@ CONFIG_APPLDATA_BASE=y · 62 unmodified lines
6363 CONFIG_KVM=m
6464 CONFIG_S390_UNWIND_SELFTEST=m
6565 CONFIG_S390_KPROBES_SANITY_TEST=m
66+CONFIG_S390_MODULES_SANITY_TEST=m
6667 CONFIG_KPROBES=y
6768 CONFIG_JUMP_LABEL=y
6869 CONFIG_STATIC_KEYS_SELFTEST=y
@@ -96,7 +97,6 @@ CONFIG_MEMORY_HOTPLUG=y · 27 unmodified lines
9697 CONFIG_MEMORY_HOTREMOVE=y
9798 CONFIG_KSM=y
9899 CONFIG_TRANSPARENT_HUGEPAGE=y
99−CONFIG_FRONTSWAP=y
100100 CONFIG_CMA_DEBUG=y
101101 CONFIG_CMA_DEBUGFS=y
102102 CONFIG_CMA_SYSFS=y
@@ -109,6 +109,7 @@ CONFIG_DEFERRED_STRUCT_PAGE_INIT=y · 6 unmodified lines
109109 CONFIG_IDLE_PAGE_TRACKING=y
110110 CONFIG_PERCPU_STATS=y
111111 CONFIG_GUP_TEST=y
112+CONFIG_ANON_VMA_NAME=y
112113 CONFIG_NET=y
113114 CONFIG_PACKET=y
114115 CONFIG_PACKET_DIAG=m
@@ -116,7 +117,6 @@ CONFIG_UNIX=y · 1 unmodified line
116117 CONFIG_UNIX_DIAG=m
117118 CONFIG_XFRM_USER=m
118119 CONFIG_NET_KEY=m
119−CONFIG_NET_SWITCHDEV=y
120120 CONFIG_SMC=m
121121 CONFIG_SMC_DIAG=m
122122 CONFIG_INET=y
@@ -185,7 +185,6 @@ CONFIG_NF_CT_NETLINK_TIMEOUT=m · 62 unmodified lines
185185 CONFIG_NF_TABLES=m
186186 CONFIG_NF_TABLES_INET=y
187187 CONFIG_NFT_CT=m
188−CONFIG_NFT_COUNTER=m
189188 CONFIG_NFT_LOG=m
190189 CONFIG_NFT_LIMIT=m
191190 CONFIG_NFT_NAT=m
@@ -391,6 +390,7 @@ CONFIG_OPENVSWITCH=m · 199 unmodified lines
391390 CONFIG_VSOCKETS=m
392391 CONFIG_VIRTIO_VSOCKETS=m
393392 CONFIG_NETLINK_DIAG=m
393+CONFIG_NET_SWITCHDEV=y
394394 CONFIG_CGROUP_NET_PRIO=y
395395 CONFIG_NET_PKTGEN=m
396396 CONFIG_PCI=y
@@ -400,6 +400,7 @@ CONFIG_PCI_IOV=y · 3 unmodified lines
400400 CONFIG_HOTPLUG_PCI=y
401401 CONFIG_HOTPLUG_PCI_S390=y
402402 CONFIG_DEVTMPFS=y
403+CONFIG_DEVTMPFS_SAFE=y
403404 CONFIG_CONNECTOR=y
404405 CONFIG_ZRAM=y
405406 CONFIG_BLK_DEV_LOOP=m
@@ -501,6 +502,7 @@ CONFIG_NLMON=m · 95 unmodified lines
501502 # CONFIG_NET_VENDOR_DEC is not set
502503 # CONFIG_NET_VENDOR_DLINK is not set
503504 # CONFIG_NET_VENDOR_EMULEX is not set
505+# CONFIG_NET_VENDOR_ENGLEDER is not set
504506 # CONFIG_NET_VENDOR_EZCHIP is not set
505507 # CONFIG_NET_VENDOR_GOOGLE is not set
506508 # CONFIG_NET_VENDOR_HUAWEI is not set
@@ -511,7 +513,6 @@ CONFIG_NLMON=m · 4 unmodified lines
511513 CONFIG_MLX4_EN=m
512514 CONFIG_MLX5_CORE=m
513515 CONFIG_MLX5_CORE_EN=y
514−CONFIG_MLX5_ESWITCH=y
515516 # CONFIG_NET_VENDOR_MICREL is not set
516517 # CONFIG_NET_VENDOR_MICROCHIP is not set
517518 # CONFIG_NET_VENDOR_MICROSEMI is not set
@@ -542,6 +543,7 @@ CONFIG_MLX5_ESWITCH=y · 24 unmodified lines
542543 # CONFIG_NET_VENDOR_SYNOPSYS is not set
543544 # CONFIG_NET_VENDOR_TEHUTI is not set
544545 # CONFIG_NET_VENDOR_TI is not set
546+# CONFIG_NET_VENDOR_VERTEXCOM is not set
545547 # CONFIG_NET_VENDOR_VIA is not set
546548 # CONFIG_NET_VENDOR_WIZNET is not set
547549 # CONFIG_NET_VENDOR_XILINX is not set
@@ -592,6 +594,7 @@ CONFIG_VIRTIO_BALLOON=m · 44 unmodified lines
592594 CONFIG_VIRTIO_INPUT=y
593595 CONFIG_VHOST_NET=m
594596 CONFIG_VHOST_VSOCK=m
597+# CONFIG_SURFACE_PLATFORMS is not set
595598 CONFIG_S390_CCW_IOMMU=y
596599 CONFIG_S390_AP_IOMMU=y
597600 CONFIG_EXT4_FS=y
@@ -756,9 +759,6 @@ CONFIG_CRYPTO_USER_API_SKCIPHER=m · 158 unmodified lines
756759 CONFIG_CRYPTO_USER_API_RNG=m
757760 CONFIG_CRYPTO_USER_API_AEAD=m
758761 CONFIG_CRYPTO_STATS=y
759−CONFIG_CRYPTO_LIB_BLAKE2S=m
760−CONFIG_CRYPTO_LIB_CURVE25519=m
761−CONFIG_CRYPTO_LIB_CHACHA20POLY1305=m
762762 CONFIG_ZCRYPT=m
763763 CONFIG_PKEY=m
764764 CONFIG_CRYPTO_PAES_S390=m
@@ -774,6 +774,8 @@ CONFIG_CRYPTO_GHASH_S390=m · 9 unmodified lines
774774 CONFIG_CRYPTO_CRC32_S390=y
775775 CONFIG_CRYPTO_DEV_VIRTIO=m
776776 CONFIG_CORDIC=m
777+CONFIG_CRYPTO_LIB_CURVE25519=m
778+CONFIG_CRYPTO_LIB_CHACHA20POLY1305=m
777779 CONFIG_CRC32_SELFTEST=y
778780 CONFIG_CRC4=m
779781 CONFIG_CRC7=m
@@ -807,7 +809,6 @@ CONFIG_SLUB_DEBUG_ON=y · 27 unmodified lines
807809 CONFIG_SLUB_STATS=y
808810 CONFIG_DEBUG_STACK_USAGE=y
809811 CONFIG_DEBUG_VM=y
810−CONFIG_DEBUG_VM_VMACACHE=y
811812 CONFIG_DEBUG_VM_PGFLAGS=y
812813 CONFIG_DEBUG_MEMORY_INIT=y
813814 CONFIG_MEMORY_NOTIFIER_ERROR_INJECT=m
@@ -819,12 +820,11 @@ CONFIG_PANIC_ON_OOPS=y · 5 unmodified lines
819820 CONFIG_DETECT_HUNG_TASK=y
820821 CONFIG_WQ_WATCHDOG=y
821822 CONFIG_TEST_LOCKUP=m
822−CONFIG_DEBUG_TIMEKEEPING=y
823823 CONFIG_PROVE_LOCKING=y
824824 CONFIG_LOCK_STAT=y
825−CONFIG_DEBUG_LOCKDEP=y
826825 CONFIG_DEBUG_ATOMIC_SLEEP=y
827826 CONFIG_DEBUG_LOCKING_API_SELFTESTS=y
827+CONFIG_DEBUG_IRQFLAGS=y
828828 CONFIG_DEBUG_SG=y
829829 CONFIG_DEBUG_NOTIFIERS=y
830830 CONFIG_BUG_ON_DATA_CORRUPTION=y
arch/s390/configs/defconfig+9−7
@@ -61,6 +61,7 @@ CONFIG_APPLDATA_BASE=y · 60 unmodified lines
6161 CONFIG_KVM=m
6262 CONFIG_S390_UNWIND_SELFTEST=m
6363 CONFIG_S390_KPROBES_SANITY_TEST=m
64+CONFIG_S390_MODULES_SANITY_TEST=m
6465 CONFIG_KPROBES=y
6566 CONFIG_JUMP_LABEL=y
6667 # CONFIG_GCC_PLUGINS is not set
@@ -91,7 +92,6 @@ CONFIG_MEMORY_HOTPLUG=y · 24 unmodified lines
9192 CONFIG_MEMORY_HOTREMOVE=y
9293 CONFIG_KSM=y
9394 CONFIG_TRANSPARENT_HUGEPAGE=y
94−CONFIG_FRONTSWAP=y
9595 CONFIG_CMA_SYSFS=y
9696 CONFIG_CMA_AREAS=7
9797 CONFIG_MEM_SOFT_DIRTY=y
@@ -101,6 +101,7 @@ CONFIG_ZSMALLOC_STAT=y · 3 unmodified lines
101101 CONFIG_DEFERRED_STRUCT_PAGE_INIT=y
102102 CONFIG_IDLE_PAGE_TRACKING=y
103103 CONFIG_PERCPU_STATS=y
104+CONFIG_ANON_VMA_NAME=y
104105 CONFIG_NET=y
105106 CONFIG_PACKET=y
106107 CONFIG_PACKET_DIAG=m
@@ -108,7 +109,6 @@ CONFIG_UNIX=y · 1 unmodified line
108109 CONFIG_UNIX_DIAG=m
109110 CONFIG_XFRM_USER=m
110111 CONFIG_NET_KEY=m
111−CONFIG_NET_SWITCHDEV=y
112112 CONFIG_SMC=m
113113 CONFIG_SMC_DIAG=m
114114 CONFIG_INET=y
@@ -177,7 +177,6 @@ CONFIG_NF_CT_NETLINK_TIMEOUT=m · 62 unmodified lines
177177 CONFIG_NF_TABLES=m
178178 CONFIG_NF_TABLES_INET=y
179179 CONFIG_NFT_CT=m
180−CONFIG_NFT_COUNTER=m
181180 CONFIG_NFT_LOG=m
182181 CONFIG_NFT_LIMIT=m
183182 CONFIG_NFT_NAT=m
@@ -382,6 +381,7 @@ CONFIG_OPENVSWITCH=m · 198 unmodified lines
382381 CONFIG_VSOCKETS=m
383382 CONFIG_VIRTIO_VSOCKETS=m
384383 CONFIG_NETLINK_DIAG=m
384+CONFIG_NET_SWITCHDEV=y
385385 CONFIG_CGROUP_NET_PRIO=y
386386 CONFIG_NET_PKTGEN=m
387387 CONFIG_PCI=y
@@ -391,6 +391,7 @@ CONFIG_HOTPLUG_PCI=y · 3 unmodified lines
391391 CONFIG_HOTPLUG_PCI_S390=y
392392 CONFIG_UEVENT_HELPER=y
393393 CONFIG_DEVTMPFS=y
394+CONFIG_DEVTMPFS_SAFE=y
394395 CONFIG_CONNECTOR=y
395396 CONFIG_ZRAM=y
396397 CONFIG_BLK_DEV_LOOP=m
@@ -492,6 +493,7 @@ CONFIG_NLMON=m · 95 unmodified lines
492493 # CONFIG_NET_VENDOR_DEC is not set
493494 # CONFIG_NET_VENDOR_DLINK is not set
494495 # CONFIG_NET_VENDOR_EMULEX is not set
496+# CONFIG_NET_VENDOR_ENGLEDER is not set
495497 # CONFIG_NET_VENDOR_EZCHIP is not set
496498 # CONFIG_NET_VENDOR_GOOGLE is not set
497499 # CONFIG_NET_VENDOR_HUAWEI is not set
@@ -502,7 +504,6 @@ CONFIG_NLMON=m · 4 unmodified lines
502504 CONFIG_MLX4_EN=m
503505 CONFIG_MLX5_CORE=m
504506 CONFIG_MLX5_CORE_EN=y
505−CONFIG_MLX5_ESWITCH=y
506507 # CONFIG_NET_VENDOR_MICREL is not set
507508 # CONFIG_NET_VENDOR_MICROCHIP is not set
508509 # CONFIG_NET_VENDOR_MICROSEMI is not set
@@ -533,6 +534,7 @@ CONFIG_MLX5_ESWITCH=y · 24 unmodified lines
533534 # CONFIG_NET_VENDOR_SYNOPSYS is not set
534535 # CONFIG_NET_VENDOR_TEHUTI is not set
535536 # CONFIG_NET_VENDOR_TI is not set
537+# CONFIG_NET_VENDOR_VERTEXCOM is not set
536538 # CONFIG_NET_VENDOR_VIA is not set
537539 # CONFIG_NET_VENDOR_WIZNET is not set
538540 # CONFIG_NET_VENDOR_XILINX is not set
@@ -582,6 +584,7 @@ CONFIG_VIRTIO_BALLOON=m · 43 unmodified lines
582584 CONFIG_VIRTIO_INPUT=y
583585 CONFIG_VHOST_NET=m
584586 CONFIG_VHOST_VSOCK=m
587+# CONFIG_SURFACE_PLATFORMS is not set
585588 CONFIG_S390_CCW_IOMMU=y
586589 CONFIG_S390_AP_IOMMU=y
587590 CONFIG_EXT4_FS=y
@@ -743,9 +746,6 @@ CONFIG_CRYPTO_USER_API_SKCIPHER=m · 155 unmodified lines
743746 CONFIG_CRYPTO_USER_API_RNG=m
744747 CONFIG_CRYPTO_USER_API_AEAD=m
745748 CONFIG_CRYPTO_STATS=y
746−CONFIG_CRYPTO_LIB_BLAKE2S=m
747−CONFIG_CRYPTO_LIB_CURVE25519=m
748−CONFIG_CRYPTO_LIB_CHACHA20POLY1305=m
749749 CONFIG_ZCRYPT=m
750750 CONFIG_PKEY=m
751751 CONFIG_CRYPTO_PAES_S390=m
@@ -762,6 +762,8 @@ CONFIG_CRYPTO_CRC32_S390=y · 10 unmodified lines
762762 CONFIG_CRYPTO_DEV_VIRTIO=m
763763 CONFIG_CORDIC=m
764764 CONFIG_PRIME_NUMBERS=m
765+CONFIG_CRYPTO_LIB_CURVE25519=m
766+CONFIG_CRYPTO_LIB_CHACHA20POLY1305=m
765767 CONFIG_CRC4=m
766768 CONFIG_CRC7=m
767769 CONFIG_CRC8=m
arch/s390/configs/zfcpdump_defconfig+3−0
@@ -1,6 +1,7 @@
11 # CONFIG_SWAP is not set
22 CONFIG_NO_HZ_IDLE=y
33 CONFIG_HIGH_RES_TIMERS=y
4+CONFIG_BPF_SYSCALL=y
45 # CONFIG_CPU_ISOLATION is not set
56 # CONFIG_UTS_NS is not set
67 # CONFIG_TIME_NS is not set
@@ -34,6 +35,7 @@ CONFIG_NET=y · 27 unmodified lines
3435 # CONFIG_PCPU_DEV_REFCNT is not set
3536 # CONFIG_ETHTOOL_NETLINK is not set
3637 CONFIG_DEVTMPFS=y
38+CONFIG_DEVTMPFS_SAFE=y
3739 CONFIG_BLK_DEV_RAM=y
3840 # CONFIG_DCSSBLK is not set
3941 # CONFIG_DASD is not set
@@ -58,6 +60,7 @@ CONFIG_ZFCP=y · 18 unmodified lines
5860 # CONFIG_HID is not set
5961 # CONFIG_VIRTIO_MENU is not set
6062 # CONFIG_VHOST_MENU is not set
63+# CONFIG_SURFACE_PLATFORMS is not set
6164 # CONFIG_IOMMU_SUPPORT is not set
6265 # CONFIG_DNOTIFY is not set
6366 # CONFIG_INOTIFY_USER is not set
arch/s390/hypfs/hypfs_vm.c+4−2
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020
2121 static char local_guest[] = " ";
2222 static char all_guests[] = "* ";
23+static char *all_groups = all_guests;
2324 static char *guest_query;
2425
2526 struct diag2fc_data {
@@ -62,10 +63,11 @@ static int diag2fc(int size, char* query, void *addr) · 36 unmodified lines
6263
6364 memcpy(parm_list.userid, query, NAME_LEN);
6465 ASCEBC(parm_list.userid, NAME_LEN);
65− parm_list.addr = (unsigned long) addr ;
66+ memcpy(parm_list.aci_grp, all_groups, NAME_LEN);
67+ ASCEBC(parm_list.aci_grp, NAME_LEN);
68+ parm_list.addr = (unsigned long)addr;
6669 parm_list.size = size;
6770 parm_list.fmt = 0x02;
68− memset(parm_list.aci_grp, 0x40, NAME_LEN);
6971 rc = -1;
7072
7173 diag_stat_inc(DIAG_STAT_X2FC);
arch/s390/include/asm/uaccess.h+2−2
@@ -47,8 +47,6 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n); · 46 unmodified lines
4747 int __put_user_bad(void) __attribute__((noreturn));
4848 int __get_user_bad(void) __attribute__((noreturn));
4949
50−#ifdef CONFIG_HAVE_MARCH_Z10_FEATURES
51−
5250 union oac {
5351 unsigned int val;
5452 struct {
@@ -71,6 +69,8 @@ union oac { · 16 unmodified lines
7169 };
7270 };
7371
72+#ifdef CONFIG_HAVE_MARCH_Z10_FEATURES
73+
7474 #define __put_get_user_asm(to, from, size, oac_spec) \
7575 ({ \
7676 int __rc; \
arch/s390/kernel/module.c+18−19
@@ -33,7 +33,7 @@ · 32 unmodified lines
3333 #define DEBUGP(fmt , ...)
3434 #endif
3535
36−#define PLT_ENTRY_SIZE 20
36+#define PLT_ENTRY_SIZE 22
3737
3838 void *module_alloc(unsigned long size)
3939 {
@@ -341,27 +341,26 @@ static int apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab, · 301 unmodified lines
341341 case R_390_PLTOFF32: /* 32 bit offset from GOT to PLT. */
342342 case R_390_PLTOFF64: /* 16 bit offset from GOT to PLT. */
343343 if (info->plt_initialized == 0) {
344− unsigned int insn[5];
345− unsigned int *ip = me->core_layout.base +
346− me->arch.plt_offset +
347− info->plt_offset;
348−
349− insn[0] = 0x0d10e310; /* basr 1,0 */
350− insn[1] = 0x100a0004; /* lg 1,10(1) */
344+ unsigned char insn[PLT_ENTRY_SIZE];
345+ char *plt_base;
346+ char *ip;
347+
348+ plt_base = me->core_layout.base + me->arch.plt_offset;
349+ ip = plt_base + info->plt_offset;
350+ *(int *)insn = 0x0d10e310; /* basr 1,0 */
351+ *(int *)&insn[4] = 0x100c0004; /* lg 1,12(1) */
351352 if (IS_ENABLED(CONFIG_EXPOLINE) && !nospec_disable) {
352− unsigned int *ij;
353− ij = me->core_layout.base +
354− me->arch.plt_offset +
355− me->arch.plt_size - PLT_ENTRY_SIZE;
356− insn[2] = 0xa7f40000 + /* j __jump_r1 */
357− (unsigned int)(u16)
358− (((unsigned long) ij - 8 -
359− (unsigned long) ip) / 2);
353+ char *jump_r1;
354+
355+ jump_r1 = plt_base + me->arch.plt_size -
356+ PLT_ENTRY_SIZE;
357+ /* brcl 0xf,__jump_r1 */
358+ *(short *)&insn[8] = 0xc0f4;
359+ *(int *)&insn[10] = (jump_r1 - (ip + 8)) / 2;
360360 } else {
361− insn[2] = 0x07f10000; /* br %r1 */
361+ *(int *)&insn[8] = 0x07f10000; /* br %r1 */
362362 }
363− insn[3] = (unsigned int) (val >> 32);
364− insn[4] = (unsigned int) val;
363+ *(long *)&insn[14] = val;
365364
366365 write(ip, insn, sizeof(insn));
367366 info->plt_initialized = 1;
arch/s390/kernel/nmi.c+22−5
@@ -264,7 +264,14 @@ static int notrace s390_validate_registers(union mci mci, int umode) · 263 unmodified lines
264264 /* Validate vector registers */
265265 union ctlreg0 cr0;
266266
267− if (!mci.vr) {
267+ /*
268+ * The vector validity must only be checked if not running a
269+ * KVM guest. For KVM guests the machine check is forwarded by
270+ * KVM and it is the responsibility of the guest to take
271+ * appropriate actions. The host vector or FPU values have been
272+ * saved by KVM and will be restored by KVM.
273+ */
274+ if (!mci.vr && !test_cpu_flag(CIF_MCCK_GUEST)) {
268275 /*
269276 * Vector registers can't be restored. If the kernel
270277 * currently uses vector registers the system is
@@ -307,11 +314,21 @@ static int notrace s390_validate_registers(union mci mci, int umode) · 36 unmodified lines
307314 if (cr2.gse) {
308315 if (!mci.gs) {
309316 /*
310− * Guarded storage register can't be restored and
311− * the current processes uses guarded storage.
312− * It has to be terminated.
317+ * 2 cases:
318+ * - machine check in kernel or userspace
319+ * - machine check while running SIE (KVM guest)
320+ * For kernel or userspace the userspace values of
321+ * guarded storage control can not be recreated, the
322+ * process must be terminated.
323+ * For SIE the guest values of guarded storage can not
324+ * be recreated. This is either due to a bug or due to
325+ * GS being disabled in the guest. The guest will be
326+ * notified by KVM code and the guests machine check
327+ * handling must take care of this. The host values
328+ * are saved by KVM and are not affected.
313329 */
314− kill_task = 1;
330+ if (!test_cpu_flag(CIF_MCCK_GUEST))
331+ kill_task = 1;
315332 } else {
316333 load_gs_cb((struct gs_cb *)mcesa->guarded_storage_save_area);
317334 }
arch/s390/lib/Makefile+3−0
@@ -17,4 +17,7 @@ KASAN_SANITIZE_uaccess.o := n · 16 unmodified lines
1717 obj-$(CONFIG_S390_UNWIND_SELFTEST) += test_unwind.o
1818 CFLAGS_test_unwind.o += -fno-optimize-sibling-calls
1919
20+obj-$(CONFIG_S390_MODULES_SANITY_TEST) += test_modules.o
21+obj-$(CONFIG_S390_MODULES_SANITY_TEST_HELPERS) += test_modules_helpers.o
22+
2023 lib-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o
arch/s390/lib/test_modules.c+35−0
@@ -0,0 +1,35 @@
1+// SPDX-License-Identifier: GPL-2.0+
2+
3+#include <kunit/test.h>
4+#include <linux/module.h>
5+
6+#include "test_modules.h"
7+
8+#define DECLARE_RETURN(i) int test_modules_return_ ## i(void)
9+REPEAT_10000(DECLARE_RETURN);
10+
11+/*
12+ * Test that modules with many relocations are loaded properly.
13+ */
14+static void test_modules_many_vmlinux_relocs(struct kunit *test)
15+{
16+ int result = 0;
17+
18+#define CALL_RETURN(i) result += test_modules_return_ ## i()
19+ REPEAT_10000(CALL_RETURN);
20+ KUNIT_ASSERT_EQ(test, result, 49995000);
21+}
22+
23+static struct kunit_case modules_testcases[] = {
24+ KUNIT_CASE(test_modules_many_vmlinux_relocs),
25+ {}
26+};
27+
28+static struct kunit_suite modules_test_suite = {
29+ .name = "modules_test_s390",
30+ .test_cases = modules_testcases,
31+};
32+
33+kunit_test_suites(&modules_test_suite);
34+
35+MODULE_LICENSE("GPL");
arch/s390/lib/test_modules.h+50−0
@@ -0,0 +1,50 @@
1+/* SPDX-License-Identifier: GPL-2.0+ */
2+#ifndef TEST_MODULES_H
3+#define TEST_MODULES_H
4+
5+#define __REPEAT_10000_3(f, x) \
6+ f(x ## 0); \
7+ f(x ## 1); \
8+ f(x ## 2); \
9+ f(x ## 3); \
10+ f(x ## 4); \
11+ f(x ## 5); \
12+ f(x ## 6); \
13+ f(x ## 7); \
14+ f(x ## 8); \
15+ f(x ## 9)
16+#define __REPEAT_10000_2(f, x) \
17+ __REPEAT_10000_3(f, x ## 0); \
18+ __REPEAT_10000_3(f, x ## 1); \
19+ __REPEAT_10000_3(f, x ## 2); \
20+ __REPEAT_10000_3(f, x ## 3); \
21+ __REPEAT_10000_3(f, x ## 4); \
22+ __REPEAT_10000_3(f, x ## 5); \
23+ __REPEAT_10000_3(f, x ## 6); \
24+ __REPEAT_10000_3(f, x ## 7); \
25+ __REPEAT_10000_3(f, x ## 8); \
26+ __REPEAT_10000_3(f, x ## 9)
27+#define __REPEAT_10000_1(f, x) \
28+ __REPEAT_10000_2(f, x ## 0); \
29+ __REPEAT_10000_2(f, x ## 1); \
30+ __REPEAT_10000_2(f, x ## 2); \
31+ __REPEAT_10000_2(f, x ## 3); \
32+ __REPEAT_10000_2(f, x ## 4); \
33+ __REPEAT_10000_2(f, x ## 5); \
34+ __REPEAT_10000_2(f, x ## 6); \
35+ __REPEAT_10000_2(f, x ## 7); \
36+ __REPEAT_10000_2(f, x ## 8); \
37+ __REPEAT_10000_2(f, x ## 9)
38+#define REPEAT_10000(f) \
39+ __REPEAT_10000_1(f, 0); \
40+ __REPEAT_10000_1(f, 1); \
41+ __REPEAT_10000_1(f, 2); \
42+ __REPEAT_10000_1(f, 3); \
43+ __REPEAT_10000_1(f, 4); \
44+ __REPEAT_10000_1(f, 5); \
45+ __REPEAT_10000_1(f, 6); \
46+ __REPEAT_10000_1(f, 7); \
47+ __REPEAT_10000_1(f, 8); \
48+ __REPEAT_10000_1(f, 9)
49+
50+#endif
arch/s390/lib/test_modules_helpers.c+13−0
@@ -0,0 +1,13 @@
1+// SPDX-License-Identifier: GPL-2.0+
2+
3+#include <linux/export.h>
4+
5+#include "test_modules.h"
6+
7+#define DEFINE_RETURN(i) \
8+ int test_modules_return_ ## i(void) \
9+ { \
10+ return 1 ## i - 10000; \
11+ } \
12+ EXPORT_SYMBOL_GPL(test_modules_return_ ## i)
13+REPEAT_10000(DEFINE_RETURN);
arch/x86/Kconfig+1−0
@@ -186,6 +186,7 @@ config X86 · 185 unmodified lines
186186 select HAVE_CONTEXT_TRACKING_OFFSTACK if HAVE_CONTEXT_TRACKING
187187 select HAVE_C_RECORDMCOUNT
188188 select HAVE_OBJTOOL_MCOUNT if STACK_VALIDATION
189+ select HAVE_BUILDTIME_MCOUNT_SORT
189190 select HAVE_DEBUG_KMEMLEAK
190191 select HAVE_DMA_CONTIGUOUS
191192 select HAVE_DYNAMIC_FTRACE
arch/x86/include/asm/kvm_host.h+3−2
@@ -1483,7 +1483,8 @@ struct kvm_x86_ops { · 1482 unmodified lines
14831483
14841484 int (*get_msr_feature)(struct kvm_msr_entry *entry);
14851485
1486− bool (*can_emulate_instruction)(struct kvm_vcpu *vcpu, void *insn, int insn_len);
1486+ bool (*can_emulate_instruction)(struct kvm_vcpu *vcpu, int emul_type,
1487+ void *insn, int insn_len);
14871488
14881489 bool (*apic_init_signal_blocked)(struct kvm_vcpu *vcpu);
14891490 int (*enable_direct_tlbflush)(struct kvm_vcpu *vcpu);
@@ -1496,6 +1497,7 @@ struct kvm_x86_ops { · 6 unmodified lines
14961497 };
14971498
14981499 struct kvm_x86_nested_ops {
1500+ void (*leave_nested)(struct kvm_vcpu *vcpu);
14991501 int (*check_events)(struct kvm_vcpu *vcpu);
15001502 bool (*hv_timer_pending)(struct kvm_vcpu *vcpu);
15011503 void (*triple_fault)(struct kvm_vcpu *vcpu);
@@ -1861,7 +1863,6 @@ int kvm_cpu_has_extint(struct kvm_vcpu *v); · 359 unmodified lines
18611863 int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu);
18621864 int kvm_cpu_get_interrupt(struct kvm_vcpu *v);
18631865 void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event);
1864−void kvm_vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu);
18651866
18661867 int kvm_pv_send_ipi(struct kvm *kvm, unsigned long ipi_bitmap_low,
18671868 unsigned long ipi_bitmap_high, u32 min,
arch/x86/include/uapi/asm/kvm.h+3−0
@@ -452,6 +452,9 @@ struct kvm_sync_regs { · 451 unmodified lines
452452
453453 #define KVM_STATE_VMX_PREEMPTION_TIMER_DEADLINE 0x00000001
454454
455+/* attributes for system fd (group 0) */
456+#define KVM_X86_XCOMP_GUEST_SUPP 0
457+
455458 struct kvm_vmx_nested_state_data {
456459 __u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
457460 __u8 shadow_vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
arch/x86/kernel/cpu/mce/amd.c+1−1
@@ -423,7 +423,7 @@ static void threshold_restart_bank(void *_tr) · 422 unmodified lines
423423 u32 hi, lo;
424424
425425 /* sysfs write might race against an offline operation */
426− if (this_cpu_read(threshold_banks))
426+ if (!this_cpu_read(threshold_banks) && !tr->set_lvt_off)
427427 return;
428428
429429 rdmsr(tr->b->address, lo, hi);
arch/x86/kernel/cpu/mce/intel.c+1−0
@@ -486,6 +486,7 @@ static void intel_ppin_init(struct cpuinfo_x86 *c) · 485 unmodified lines
486486 case INTEL_FAM6_BROADWELL_X:
487487 case INTEL_FAM6_SKYLAKE_X:
488488 case INTEL_FAM6_ICELAKE_X:
489+ case INTEL_FAM6_ICELAKE_D:
489490 case INTEL_FAM6_SAPPHIRERAPIDS_X:
490491 case INTEL_FAM6_XEON_PHI_KNL:
491492 case INTEL_FAM6_XEON_PHI_KNM:
arch/x86/kvm/cpuid.c+55−35
@@ -133,6 +133,7 @@ static int kvm_cpuid_check_equal(struct kvm_vcpu *vcpu, struct kvm_cpuid_entry2 · 132 unmodified lines
133133 orig = &vcpu->arch.cpuid_entries[i];
134134 if (e2[i].function != orig->function ||
135135 e2[i].index != orig->index ||
136+ e2[i].flags != orig->flags ||
136137 e2[i].eax != orig->eax || e2[i].ebx != orig->ebx ||
137138 e2[i].ecx != orig->ecx || e2[i].edx != orig->edx)
138139 return -EINVAL;
@@ -196,10 +197,26 @@ void kvm_update_pv_runtime(struct kvm_vcpu *vcpu) · 57 unmodified lines
196197 vcpu->arch.pv_cpuid.features = best->eax;
197198 }
198199
200+/*
201+ * Calculate guest's supported XCR0 taking into account guest CPUID data and
202+ * supported_xcr0 (comprised of host configuration and KVM_SUPPORTED_XCR0).
203+ */
204+static u64 cpuid_get_supported_xcr0(struct kvm_cpuid_entry2 *entries, int nent)
205+{
206+ struct kvm_cpuid_entry2 *best;
207+
208+ best = cpuid_entry2_find(entries, nent, 0xd, 0);
209+ if (!best)
210+ return 0;
211+
212+ return (best->eax | ((u64)best->edx << 32)) & supported_xcr0;
213+}
214+
199215 static void __kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu, struct kvm_cpuid_entry2 *entries,
200216 int nent)
201217 {
202218 struct kvm_cpuid_entry2 *best;
219+ u64 guest_supported_xcr0 = cpuid_get_supported_xcr0(entries, nent);
203220
204221 best = cpuid_entry2_find(entries, nent, 1, 0);
205222 if (best) {
@@ -238,6 +255,21 @@ static void __kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu, struct kvm_cpuid_e · 32 unmodified lines
238255 vcpu->arch.ia32_misc_enable_msr &
239256 MSR_IA32_MISC_ENABLE_MWAIT);
240257 }
258+
259+ /*
260+ * Bits 127:0 of the allowed SECS.ATTRIBUTES (CPUID.0x12.0x1) enumerate
261+ * the supported XSAVE Feature Request Mask (XFRM), i.e. the enclave's
262+ * requested XCR0 value. The enclave's XFRM must be a subset of XCRO
263+ * at the time of EENTER, thus adjust the allowed XFRM by the guest's
264+ * supported XCR0. Similar to XCR0 handling, FP and SSE are forced to
265+ * '1' even on CPUs that don't support XSAVE.
266+ */
267+ best = cpuid_entry2_find(entries, nent, 0x12, 0x1);
268+ if (best) {
269+ best->ecx &= guest_supported_xcr0 & 0xffffffff;
270+ best->edx &= guest_supported_xcr0 >> 32;
271+ best->ecx |= XFEATURE_MASK_FPSSE;
272+ }
241273 }
242274
243275 void kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu)
@@ -261,27 +293,8 @@ static void kvm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu) · 17 unmodified lines
261293 kvm_apic_set_version(vcpu);
262294 }
263295
264− best = kvm_find_cpuid_entry(vcpu, 0xD, 0);
265− if (!best)
266− vcpu->arch.guest_supported_xcr0 = 0;
267− else
268− vcpu->arch.guest_supported_xcr0 =
269− (best->eax | ((u64)best->edx << 32)) & supported_xcr0;
270−
271− /*
272− * Bits 127:0 of the allowed SECS.ATTRIBUTES (CPUID.0x12.0x1) enumerate
273− * the supported XSAVE Feature Request Mask (XFRM), i.e. the enclave's
274− * requested XCR0 value. The enclave's XFRM must be a subset of XCRO
275− * at the time of EENTER, thus adjust the allowed XFRM by the guest's
276− * supported XCR0. Similar to XCR0 handling, FP and SSE are forced to
277− * '1' even on CPUs that don't support XSAVE.
278− */
279− best = kvm_find_cpuid_entry(vcpu, 0x12, 0x1);
280− if (best) {
281− best->ecx &= vcpu->arch.guest_supported_xcr0 & 0xffffffff;
282− best->edx &= vcpu->arch.guest_supported_xcr0 >> 32;
283− best->ecx |= XFEATURE_MASK_FPSSE;
284− }
296+ vcpu->arch.guest_supported_xcr0 =
297+ cpuid_get_supported_xcr0(vcpu->arch.cpuid_entries, vcpu->arch.cpuid_nent);
285298
286299 kvm_update_pv_runtime(vcpu);
287300
@@ -346,8 +359,14 @@ static int kvm_set_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid_entry2 *e2, · 58 unmodified lines
346359 * KVM_SET_CPUID{,2} again. To support this legacy behavior, check
347360 * whether the supplied CPUID data is equal to what's already set.
348361 */
349− if (vcpu->arch.last_vmentry_cpu != -1)
350− return kvm_cpuid_check_equal(vcpu, e2, nent);
362+ if (vcpu->arch.last_vmentry_cpu != -1) {
363+ r = kvm_cpuid_check_equal(vcpu, e2, nent);
364+ if (r)
365+ return r;
366+
367+ kvfree(e2);
368+ return 0;
369+ }
351370
352371 r = kvm_check_cpuid(vcpu, e2, nent);
353372 if (r)
@@ -887,13 +906,14 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function) · 533 unmodified lines
887906 }
888907 break;
889908 case 0xd: {
890− u64 guest_perm = xstate_get_guest_group_perm();
909+ u64 permitted_xcr0 = supported_xcr0 & xstate_get_guest_group_perm();
910+ u64 permitted_xss = supported_xss;
891911
892− entry->eax &= supported_xcr0 & guest_perm;
893− entry->ebx = xstate_required_size(supported_xcr0, false);
912+ entry->eax &= permitted_xcr0;
913+ entry->ebx = xstate_required_size(permitted_xcr0, false);
894914 entry->ecx = entry->ebx;
895− entry->edx &= (supported_xcr0 & guest_perm) >> 32;
896− if (!supported_xcr0)
915+ entry->edx &= permitted_xcr0 >> 32;
916+ if (!permitted_xcr0)
897917 break;
898918
899919 entry = do_host_cpuid(array, function, 1);
@@ -902,20 +922,20 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function) · 2 unmodified lines
902922
903923 cpuid_entry_override(entry, CPUID_D_1_EAX);
904924 if (entry->eax & (F(XSAVES)|F(XSAVEC)))
905− entry->ebx = xstate_required_size(supported_xcr0 | supported_xss,
925+ entry->ebx = xstate_required_size(permitted_xcr0 | permitted_xss,
906926 true);
907927 else {
908− WARN_ON_ONCE(supported_xss != 0);
928+ WARN_ON_ONCE(permitted_xss != 0);
909929 entry->ebx = 0;
910930 }
911− entry->ecx &= supported_xss;
912− entry->edx &= supported_xss >> 32;
931+ entry->ecx &= permitted_xss;
932+ entry->edx &= permitted_xss >> 32;
913933
914934 for (i = 2; i < 64; ++i) {
915935 bool s_state;
916− if (supported_xcr0 & BIT_ULL(i))
936+ if (permitted_xcr0 & BIT_ULL(i))
917937 s_state = false;
918− else if (supported_xss & BIT_ULL(i))
938+ else if (permitted_xss & BIT_ULL(i))
919939 s_state = true;
920940 else
921941 continue;
@@ -929,7 +949,7 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function) · 7 unmodified lines
929949 * invalid sub-leafs. Only valid sub-leafs should
930950 * reach this point, and they should have a non-zero
931951 * save state size. Furthermore, check whether the
932− * processor agrees with supported_xcr0/supported_xss
952+ * processor agrees with permitted_xcr0/permitted_xss
933953 * on whether this is an XCR0- or IA32_XSS-managed area.
934954 */
935955 if (WARN_ON_ONCE(!entry->eax || (entry->ecx & 0x1) != s_state)) {
arch/x86/kvm/lapic.c+1−1
@@ -2629,7 +2629,7 @@ int kvm_apic_set_state(struct kvm_vcpu *vcpu, struct kvm_lapic_state *s) · 2628 unmodified lines
26292629 kvm_apic_set_version(vcpu);
26302630
26312631 apic_update_ppr(apic);
2632− hrtimer_cancel(&apic->lapic_timer.timer);
2632+ cancel_apic_timer(apic);
26332633 apic->lapic_timer.expired_tscdeadline = 0;
26342634 apic_update_lvtt(apic);
26352635 apic_manage_nmi_watchdog(apic, kvm_lapic_get_reg(apic, APIC_LVT0));
arch/x86/kvm/svm/nested.c+5−4
@@ -983,9 +983,9 @@ void svm_free_nested(struct vcpu_svm *svm) · 982 unmodified lines
983983 /*
984984 * Forcibly leave nested mode in order to be able to reset the VCPU later on.
985985 */
986−void svm_leave_nested(struct vcpu_svm *svm)
986+void svm_leave_nested(struct kvm_vcpu *vcpu)
987987 {
988− struct kvm_vcpu *vcpu = &svm->vcpu;
988+ struct vcpu_svm *svm = to_svm(vcpu);
989989
990990 if (is_guest_mode(vcpu)) {
991991 svm->nested.nested_run_pending = 0;
@@ -1411,7 +1411,7 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu, · 419 unmodified lines
14111411 return -EINVAL;
14121412
14131413 if (!(kvm_state->flags & KVM_STATE_NESTED_GUEST_MODE)) {
1414− svm_leave_nested(svm);
1414+ svm_leave_nested(vcpu);
14151415 svm_set_gif(svm, !!(kvm_state->flags & KVM_STATE_NESTED_GIF_SET));
14161416 return 0;
14171417 }
@@ -1478,7 +1478,7 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu, · 60 unmodified lines
14781478 */
14791479
14801480 if (is_guest_mode(vcpu))
1481− svm_leave_nested(svm);
1481+ svm_leave_nested(vcpu);
14821482 else
14831483 svm->nested.vmcb02.ptr->save = svm->vmcb01.ptr->save;
14841484
@@ -1532,6 +1532,7 @@ static bool svm_get_nested_state_pages(struct kvm_vcpu *vcpu) · 47 unmodified lines
15321532 }
15331533
15341534 struct kvm_x86_nested_ops svm_nested_ops = {
1535+ .leave_nested = svm_leave_nested,
15351536 .check_events = svm_check_nested_events,
15361537 .triple_fault = nested_svm_triple_fault,
15371538 .get_nested_state_pages = svm_get_nested_state_pages,
arch/x86/kvm/svm/sev.c+7−2
@@ -2100,8 +2100,13 @@ void __init sev_hardware_setup(void) · 2099 unmodified lines
21002100 if (!sev_enabled || !npt_enabled)
21012101 goto out;
21022102
2103− /* Does the CPU support SEV? */
2104− if (!boot_cpu_has(X86_FEATURE_SEV))
2103+ /*
2104+ * SEV must obviously be supported in hardware. Sanity check that the
2105+ * CPU supports decode assists, which is mandatory for SEV guests to
2106+ * support instruction emulation.
2107+ */
2108+ if (!boot_cpu_has(X86_FEATURE_SEV) ||
2109+ WARN_ON_ONCE(!boot_cpu_has(X86_FEATURE_DECODEASSISTS)))
21052110 goto out;
21062111
21072112 /* Retrieve SEV CPUID information */
arch/x86/kvm/svm/svm.c+122−55
@@ -290,7 +290,7 @@ int svm_set_efer(struct kvm_vcpu *vcpu, u64 efer) · 289 unmodified lines
290290
291291 if ((old_efer & EFER_SVME) != (efer & EFER_SVME)) {
292292 if (!(efer & EFER_SVME)) {
293− svm_leave_nested(svm);
293+ svm_leave_nested(vcpu);
294294 svm_set_gif(svm, true);
295295 /* #GP intercept is still needed for vmware backdoor */
296296 if (!enable_vmware_backdoor)
@@ -312,7 +312,11 @@ int svm_set_efer(struct kvm_vcpu *vcpu, u64 efer) · 15 unmodified lines
312312 return ret;
313313 }
314314
315− if (svm_gp_erratum_intercept)
315+ /*
316+ * Never intercept #GP for SEV guests, KVM can't
317+ * decrypt guest memory to workaround the erratum.
318+ */
319+ if (svm_gp_erratum_intercept && !sev_guest(vcpu->kvm))
316320 set_exception_intercept(svm, GP_VECTOR);
317321 }
318322 }
@@ -1010,9 +1014,10 @@ static void init_vmcb(struct kvm_vcpu *vcpu) · 691 unmodified lines
10101014 * Guest access to VMware backdoor ports could legitimately
10111015 * trigger #GP because of TSS I/O permission bitmap.
10121016 * We intercept those #GP and allow access to them anyway
1013− * as VMware does.
1017+ * as VMware does. Don't intercept #GP for SEV guests as KVM can't
1018+ * decrypt guest memory to decode the faulting instruction.
10141019 */
1015− if (enable_vmware_backdoor)
1020+ if (enable_vmware_backdoor && !sev_guest(vcpu->kvm))
10161021 set_exception_intercept(svm, GP_VECTOR);
10171022
10181023 svm_set_intercept(svm, INTERCEPT_INTR);
@@ -2091,10 +2096,6 @@ static int gp_interception(struct kvm_vcpu *vcpu) · 1072 unmodified lines
20912096 if (error_code)
20922097 goto reinject;
20932098
2094− /* All SVM instructions expect page aligned RAX */
2095− if (svm->vmcb->save.rax & ~PAGE_MASK)
2096− goto reinject;
2097−
20982099 /* Decode the instruction for usage later */
20992100 if (x86_decode_emulated_instruction(vcpu, 0, NULL, 0) != EMULATION_OK)
21002101 goto reinject;
@@ -2112,8 +2113,13 @@ static int gp_interception(struct kvm_vcpu *vcpu) · 11 unmodified lines
21122113 if (!is_guest_mode(vcpu))
21132114 return kvm_emulate_instruction(vcpu,
21142115 EMULTYPE_VMWARE_GP | EMULTYPE_NO_DECODE);
2115− } else
2116+ } else {
2117+ /* All SVM instructions expect page aligned RAX */
2118+ if (svm->vmcb->save.rax & ~PAGE_MASK)
2119+ goto reinject;
2120+
21162121 return emulate_svm_instr(vcpu, opcode);
2122+ }
21172123
21182124 reinject:
21192125 kvm_queue_exception_e(vcpu, GP_VECTOR, error_code);
@@ -4252,79 +4258,140 @@ static void svm_enable_smi_window(struct kvm_vcpu *vcpu) · 2132 unmodified lines
42524258 }
42534259 }
42544260
4255−static bool svm_can_emulate_instruction(struct kvm_vcpu *vcpu, void *insn, int insn_len)
4261+static bool svm_can_emulate_instruction(struct kvm_vcpu *vcpu, int emul_type,
4262+ void *insn, int insn_len)
42564263 {
42574264 bool smep, smap, is_user;
42584265 unsigned long cr4;
4266+ u64 error_code;
4267+
4268+ /* Emulation is always possible when KVM has access to all guest state. */
4269+ if (!sev_guest(vcpu->kvm))
4270+ return true;
4271+
4272+ /* #UD and #GP should never be intercepted for SEV guests. */
4273+ WARN_ON_ONCE(emul_type & (EMULTYPE_TRAP_UD |
4274+ EMULTYPE_TRAP_UD_FORCED |
4275+ EMULTYPE_VMWARE_GP));
42594276
42604277 /*
4261− * When the guest is an SEV-ES guest, emulation is not possible.
4278+ * Emulation is impossible for SEV-ES guests as KVM doesn't have access
4279+ * to guest register state.
42624280 */
42634281 if (sev_es_guest(vcpu->kvm))
42644282 return false;
42654283
4284+ /*
4285+ * Emulation is possible if the instruction is already decoded, e.g.
4286+ * when completing I/O after returning from userspace.
4287+ */
4288+ if (emul_type & EMULTYPE_NO_DECODE)
4289+ return true;
4290+
4291+ /*
4292+ * Emulation is possible for SEV guests if and only if a prefilled
4293+ * buffer containing the bytes of the intercepted instruction is
4294+ * available. SEV guest memory is encrypted with a guest specific key
4295+ * and cannot be decrypted by KVM, i.e. KVM would read cyphertext and
4296+ * decode garbage.
4297+ *
4298+ * Inject #UD if KVM reached this point without an instruction buffer.
4299+ * In practice, this path should never be hit by a well-behaved guest,
4300+ * e.g. KVM doesn't intercept #UD or #GP for SEV guests, but this path
4301+ * is still theoretically reachable, e.g. via unaccelerated fault-like
4302+ * AVIC access, and needs to be handled by KVM to avoid putting the
4303+ * guest into an infinite loop. Injecting #UD is somewhat arbitrary,
4304+ * but its the least awful option given lack of insight into the guest.
4305+ */
4306+ if (unlikely(!insn)) {
4307+ kvm_queue_exception(vcpu, UD_VECTOR);
4308+ return false;
4309+ }
4310+
4311+ /*
4312+ * Emulate for SEV guests if the insn buffer is not empty. The buffer
4313+ * will be empty if the DecodeAssist microcode cannot fetch bytes for
4314+ * the faulting instruction because the code fetch itself faulted, e.g.
4315+ * the guest attempted to fetch from emulated MMIO or a guest page
4316+ * table used to translate CS:RIP resides in emulated MMIO.
4317+ */
4318+ if (likely(insn_len))
4319+ return true;
4320+
42664321 /*
42674322 * Detect and workaround Errata 1096 Fam_17h_00_0Fh.
42684323 *
42694324 * Errata:
4270− * When CPU raise #NPF on guest data access and vCPU CR4.SMAP=1, it is
4271− * possible that CPU microcode implementing DecodeAssist will fail
4272− * to read bytes of instruction which caused #NPF. In this case,
4273− * GuestIntrBytes field of the VMCB on a VMEXIT will incorrectly
4274− * return 0 instead of the correct guest instruction bytes.
4275− *
4276− * This happens because CPU microcode reading instruction bytes
4277− * uses a special opcode which attempts to read data using CPL=0
4278− * privileges. The microcode reads CS:RIP and if it hits a SMAP
4279− * fault, it gives up and returns no instruction bytes.
4325+ * When CPU raises #NPF on guest data access and vCPU CR4.SMAP=1, it is
4326+ * possible that CPU microcode implementing DecodeAssist will fail to
4327+ * read guest memory at CS:RIP and vmcb.GuestIntrBytes will incorrectly
4328+ * be '0'. This happens because microcode reads CS:RIP using a _data_
4329+ * loap uop with CPL=0 privileges. If the load hits a SMAP #PF, ucode
4330+ * gives up and does not fill the instruction bytes buffer.
42804331 *
4281− * Detection:
4282− * We reach here in case CPU supports DecodeAssist, raised #NPF and
4283− * returned 0 in GuestIntrBytes field of the VMCB.
4284− * First, errata can only be triggered in case vCPU CR4.SMAP=1.
4285− * Second, if vCPU CR4.SMEP=1, errata could only be triggered
4286− * in case vCPU CPL==3 (Because otherwise guest would have triggered
4287− * a SMEP fault instead of #NPF).
4288− * Otherwise, vCPU CR4.SMEP=0, errata could be triggered by any vCPU CPL.
4289− * As most guests enable SMAP if they have also enabled SMEP, use above
4290− * logic in order to attempt minimize false-positive of detecting errata
4291− * while still preserving all cases semantic correctness.
4332+ * As above, KVM reaches this point iff the VM is an SEV guest, the CPU
4333+ * supports DecodeAssist, a #NPF was raised, KVM's page fault handler
4334+ * triggered emulation (e.g. for MMIO), and the CPU returned 0 in the
4335+ * GuestIntrBytes field of the VMCB.
42924336 *
4293− * Workaround:
4294− * To determine what instruction the guest was executing, the hypervisor
4295− * will have to decode the instruction at the instruction pointer.
4337+ * This does _not_ mean that the erratum has been encountered, as the
4338+ * DecodeAssist will also fail if the load for CS:RIP hits a legitimate
4339+ * #PF, e.g. if the guest attempt to execute from emulated MMIO and
4340+ * encountered a reserved/not-present #PF.
42964341 *
4297− * In non SEV guest, hypervisor will be able to read the guest
4298− * memory to decode the instruction pointer when insn_len is zero
4299− * so we return true to indicate that decoding is possible.
4342+ * To hit the erratum, the following conditions must be true:
4343+ * 1. CR4.SMAP=1 (obviously).
4344+ * 2. CR4.SMEP=0 || CPL=3. If SMEP=1 and CPL<3, the erratum cannot
4345+ * have been hit as the guest would have encountered a SMEP
4346+ * violation #PF, not a #NPF.
4347+ * 3. The #NPF is not due to a code fetch, in which case failure to
4348+ * retrieve the instruction bytes is legitimate (see abvoe).
43004349 *
4301− * But in the SEV guest, the guest memory is encrypted with the
4302− * guest specific key and hypervisor will not be able to decode the
4303− * instruction pointer so we will not able to workaround it. Lets
4304− * print the error and request to kill the guest.
4350+ * In addition, don't apply the erratum workaround if the #NPF occurred
4351+ * while translating guest page tables (see below).
43054352 */
4306− if (likely(!insn || insn_len))
4307− return true;
4308−
4309− /*
4310− * If RIP is invalid, go ahead with emulation which will cause an
4311− * internal error exit.
4312− */
4313− if (!kvm_vcpu_gfn_to_memslot(vcpu, kvm_rip_read(vcpu) >> PAGE_SHIFT))
4314− return true;
4353+ error_code = to_svm(vcpu)->vmcb->control.exit_info_1;
4354+ if (error_code & (PFERR_GUEST_PAGE_MASK | PFERR_FETCH_MASK))
4355+ goto resume_guest;
43154356
43164357 cr4 = kvm_read_cr4(vcpu);
43174358 smep = cr4 & X86_CR4_SMEP;
43184359 smap = cr4 & X86_CR4_SMAP;
43194360 is_user = svm_get_cpl(vcpu) == 3;
43204361 if (smap && (!smep || is_user)) {
4321− if (!sev_guest(vcpu->kvm))
4322− return true;
4323−
43244362 pr_err_ratelimited("KVM: SEV Guest triggered AMD Erratum 1096\n");
4325− kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
4363+
4364+ /*
4365+ * If the fault occurred in userspace, arbitrarily inject #GP
4366+ * to avoid killing the guest and to hopefully avoid confusing
4367+ * the guest kernel too much, e.g. injecting #PF would not be
4368+ * coherent with respect to the guest's page tables. Request
4369+ * triple fault if the fault occurred in the kernel as there's
4370+ * no fault that KVM can inject without confusing the guest.
4371+ * In practice, the triple fault is moot as no sane SEV kernel
4372+ * will execute from user memory while also running with SMAP=1.
4373+ */
4374+ if (is_user)
4375+ kvm_inject_gp(vcpu, 0);
4376+ else
4377+ kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
43264378 }
43274379
4380+resume_guest:
4381+ /*
4382+ * If the erratum was not hit, simply resume the guest and let it fault
4383+ * again. While awful, e.g. the vCPU may get stuck in an infinite loop
4384+ * if the fault is at CPL=0, it's the lesser of all evils. Exiting to
4385+ * userspace will kill the guest, and letting the emulator read garbage
4386+ * will yield random behavior and potentially corrupt the guest.
4387+ *
4388+ * Simply resuming the guest is technically not a violation of the SEV
4389+ * architecture. AMD's APM states that all code fetches and page table
4390+ * accesses for SEV guest are encrypted, regardless of the C-Bit. The
4391+ * APM also states that encrypted accesses to MMIO are "ignored", but
4392+ * doesn't explicitly define "ignored", i.e. doing nothing and letting
4393+ * the guest spin is technically "ignoring" the access.
4394+ */
43284395 return false;
43294396 }
43304397
arch/x86/kvm/svm/svm.h+1−6
@@ -304,11 +304,6 @@ static inline void vmcb_mark_all_clean(struct vmcb *vmcb) · 303 unmodified lines
304304 & ~VMCB_ALWAYS_DIRTY_MASK;
305305 }
306306
307−static inline bool vmcb_is_clean(struct vmcb *vmcb, int bit)
308−{
309− return (vmcb->control.clean & (1 << bit));
310−}
311−
312307 static inline void vmcb_mark_dirty(struct vmcb *vmcb, int bit)
313308 {
314309 vmcb->control.clean &= ~(1 << bit);
@@ -525,7 +520,7 @@ static inline bool nested_exit_on_nmi(struct vcpu_svm *svm) · 210 unmodified lines
525520
526521 int enter_svm_guest_mode(struct kvm_vcpu *vcpu,
527522 u64 vmcb_gpa, struct vmcb *vmcb12, bool from_vmrun);
528−void svm_leave_nested(struct vcpu_svm *svm);
523+void svm_leave_nested(struct kvm_vcpu *vcpu);
529524 void svm_free_nested(struct vcpu_svm *svm);
530525 int svm_allocate_nested(struct vcpu_svm *svm);
531526 int nested_svm_vmrun(struct kvm_vcpu *vcpu);
arch/x86/kvm/svm/svm_onhyperv.h+4−8
@@ -46,6 +46,9 @@ static inline void svm_hv_init_vmcb(struct vmcb *vmcb) · 45 unmodified lines
4646 if (npt_enabled &&
4747 ms_hyperv.nested_features & HV_X64_NESTED_ENLIGHTENED_TLB)
4848 hve->hv_enlightenments_control.enlightened_npt_tlb = 1;
49+
50+ if (ms_hyperv.nested_features & HV_X64_NESTED_MSR_BITMAP)
51+ hve->hv_enlightenments_control.msr_bitmap = 1;
4952 }
5053
5154 static inline void svm_hv_hardware_setup(void)
@@ -83,14 +86,7 @@ static inline void svm_hv_vmcb_dirty_nested_enlightenments( · 31 unmodified lines
8386 struct hv_enlightenments *hve =
8487 (struct hv_enlightenments *)vmcb->control.reserved_sw;
8588
86− /*
87− * vmcb can be NULL if called during early vcpu init.
88− * And its okay not to mark vmcb dirty during vcpu init
89− * as we mark it dirty unconditionally towards end of vcpu
90− * init phase.
91− */
92− if (vmcb_is_clean(vmcb, VMCB_HV_NESTED_ENLIGHTENMENTS) &&
93− hve->hv_enlightenments_control.msr_bitmap)
89+ if (hve->hv_enlightenments_control.msr_bitmap)
9490 vmcb_mark_dirty(vmcb, VMCB_HV_NESTED_ENLIGHTENMENTS);
9591 }
9692
arch/x86/kvm/vmx/capabilities.h+0−1
@@ -54,7 +54,6 @@ struct nested_vmx_msrs { · 53 unmodified lines
5454
5555 struct vmcs_config {
5656 int size;
57− int order;
5857 u32 basic_cap;
5958 u32 revision_id;
6059 u32 pin_based_exec_ctrl;
arch/x86/kvm/vmx/evmcs.c+2−2
@@ -12,8 +12,6 @@ · 11 unmodified lines
1212
1313 DEFINE_STATIC_KEY_FALSE(enable_evmcs);
1414
15−#if IS_ENABLED(CONFIG_HYPERV)
16−
1715 #define EVMCS1_OFFSET(x) offsetof(struct hv_enlightened_vmcs, x)
1816 #define EVMCS1_FIELD(number, name, clean_field)[ROL16(number, 6)] = \
1917 {EVMCS1_OFFSET(name), clean_field}
@@ -296,6 +294,7 @@ const struct evmcs_field vmcs_field_to_evmcs_1[] = { · 276 unmodified lines
296294 };
297295 const unsigned int nr_evmcs_1_fields = ARRAY_SIZE(vmcs_field_to_evmcs_1);
298296
297+#if IS_ENABLED(CONFIG_HYPERV)
299298 __init void evmcs_sanitize_exec_ctrls(struct vmcs_config *vmcs_conf)
300299 {
301300 vmcs_conf->pin_based_exec_ctrl &= ~EVMCS1_UNSUPPORTED_PINCTRL;
@@ -362,6 +361,7 @@ void nested_evmcs_filter_control_msr(u32 msr_index, u64 *pdata) · 60 unmodified lines
362361 case MSR_IA32_VMX_PROCBASED_CTLS2:
363362 ctl_high &= ~EVMCS1_UNSUPPORTED_2NDEXEC;
364363 break;
364+ case MSR_IA32_VMX_TRUE_PINBASED_CTLS:
365365 case MSR_IA32_VMX_PINBASED_CTLS:
366366 ctl_high &= ~EVMCS1_UNSUPPORTED_PINCTRL;
367367 break;
arch/x86/kvm/vmx/evmcs.h+39−9
@@ -59,12 +59,12 @@ DECLARE_STATIC_KEY_FALSE(enable_evmcs); · 58 unmodified lines
5959 SECONDARY_EXEC_SHADOW_VMCS | \
6060 SECONDARY_EXEC_TSC_SCALING | \
6161 SECONDARY_EXEC_PAUSE_LOOP_EXITING)
62−#define EVMCS1_UNSUPPORTED_VMEXIT_CTRL (VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL)
62+#define EVMCS1_UNSUPPORTED_VMEXIT_CTRL \
63+ (VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL | \
64+ VM_EXIT_SAVE_VMX_PREEMPTION_TIMER)
6365 #define EVMCS1_UNSUPPORTED_VMENTRY_CTRL (VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL)
6466 #define EVMCS1_UNSUPPORTED_VMFUNC (VMX_VMFUNC_EPTP_SWITCHING)
6567
66−#if IS_ENABLED(CONFIG_HYPERV)
67−
6868 struct evmcs_field {
6969 u16 offset;
7070 u16 clean_field;
@@ -73,26 +73,56 @@ struct evmcs_field { · 2 unmodified lines
7373 extern const struct evmcs_field vmcs_field_to_evmcs_1[];
7474 extern const unsigned int nr_evmcs_1_fields;
7575
76−static __always_inline int get_evmcs_offset(unsigned long field,
77− u16 *clean_field)
76+static __always_inline int evmcs_field_offset(unsigned long field,
77+ u16 *clean_field)
7878 {
7979 unsigned int index = ROL16(field, 6);
8080 const struct evmcs_field *evmcs_field;
8181
82− if (unlikely(index >= nr_evmcs_1_fields)) {
83− WARN_ONCE(1, "KVM: accessing unsupported EVMCS field %lx\n",
84− field);
82+ if (unlikely(index >= nr_evmcs_1_fields))
8583 return -ENOENT;
86− }
8784
8885 evmcs_field = &vmcs_field_to_evmcs_1[index];
8986
87+ /*
88+ * Use offset=0 to detect holes in eVMCS. This offset belongs to
89+ * 'revision_id' but this field has no encoding and is supposed to
90+ * be accessed directly.
91+ */
92+ if (unlikely(!evmcs_field->offset))
93+ return -ENOENT;
94+
9095 if (clean_field)
9196 *clean_field = evmcs_field->clean_field;
9297
9398 return evmcs_field->offset;
9499 }
95100
101+static inline u64 evmcs_read_any(struct hv_enlightened_vmcs *evmcs,
102+ unsigned long field, u16 offset)
103+{
104+ /*
105+ * vmcs12_read_any() doesn't care whether the supplied structure
106+ * is 'struct vmcs12' or 'struct hv_enlightened_vmcs' as it takes
107+ * the exact offset of the required field, use it for convenience
108+ * here.
109+ */
110+ return vmcs12_read_any((void *)evmcs, field, offset);
111+}
112+
113+#if IS_ENABLED(CONFIG_HYPERV)
114+
115+static __always_inline int get_evmcs_offset(unsigned long field,
116+ u16 *clean_field)
117+{
118+ int offset = evmcs_field_offset(field, clean_field);
119+
120+ WARN_ONCE(offset < 0, "KVM: accessing unsupported EVMCS field %lx\n",
121+ field);
122+
123+ return offset;
124+}
125+
96126 static __always_inline void evmcs_write64(unsigned long field, u64 value)
97127 {
98128 u16 clean_field;
arch/x86/kvm/vmx/nested.c+54−28
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 #include <asm/mmu_context.h>
88
99 #include "cpuid.h"
10+#include "evmcs.h"
1011 #include "hyperv.h"
1112 #include "mmu.h"
1213 #include "nested.h"
@@ -4851,18 +4852,20 @@ static struct vmcs *alloc_shadow_vmcs(struct kvm_vcpu *vcpu) · 4838 unmodified lines
48514852 struct loaded_vmcs *loaded_vmcs = vmx->loaded_vmcs;
48524853
48534854 /*
4854− * We should allocate a shadow vmcs for vmcs01 only when L1
4855− * executes VMXON and free it when L1 executes VMXOFF.
4856− * As it is invalid to execute VMXON twice, we shouldn't reach
4857− * here when vmcs01 already have an allocated shadow vmcs.
4855+ * KVM allocates a shadow VMCS only when L1 executes VMXON and frees it
4856+ * when L1 executes VMXOFF or the vCPU is forced out of nested
4857+ * operation. VMXON faults if the CPU is already post-VMXON, so it
4858+ * should be impossible to already have an allocated shadow VMCS. KVM
4859+ * doesn't support virtualization of VMCS shadowing, so vmcs01 should
4860+ * always be the loaded VMCS.
48584861 */
4859− WARN_ON(loaded_vmcs == &vmx->vmcs01 && loaded_vmcs->shadow_vmcs);
4862+ if (WARN_ON(loaded_vmcs != &vmx->vmcs01 || loaded_vmcs->shadow_vmcs))
4863+ return loaded_vmcs->shadow_vmcs;
4864+
4865+ loaded_vmcs->shadow_vmcs = alloc_vmcs(true);
4866+ if (loaded_vmcs->shadow_vmcs)
4867+ vmcs_clear(loaded_vmcs->shadow_vmcs);
48604868
4861− if (!loaded_vmcs->shadow_vmcs) {
4862− loaded_vmcs->shadow_vmcs = alloc_vmcs(true);
4863− if (loaded_vmcs->shadow_vmcs)
4864− vmcs_clear(loaded_vmcs->shadow_vmcs);
4865− }
48664869 return loaded_vmcs->shadow_vmcs;
48674870 }
48684871
@@ -5099,27 +5102,49 @@ static int handle_vmread(struct kvm_vcpu *vcpu) · 230 unmodified lines
50995102 if (!nested_vmx_check_permission(vcpu))
51005103 return 1;
51015104
5102− /*
5103− * In VMX non-root operation, when the VMCS-link pointer is INVALID_GPA,
5104− * any VMREAD sets the ALU flags for VMfailInvalid.
5105− */
5106− if (vmx->nested.current_vmptr == INVALID_GPA ||
5107− (is_guest_mode(vcpu) &&
5108− get_vmcs12(vcpu)->vmcs_link_pointer == INVALID_GPA))
5109− return nested_vmx_failInvalid(vcpu);
5110−
51115105 /* Decode instruction info and find the field to read */
51125106 field = kvm_register_read(vcpu, (((instr_info) >> 28) & 0xf));
51135107
5114− offset = vmcs_field_to_offset(field);
5115− if (offset < 0)
5116− return nested_vmx_fail(vcpu, VMXERR_UNSUPPORTED_VMCS_COMPONENT);
5108+ if (!evmptr_is_valid(vmx->nested.hv_evmcs_vmptr)) {
5109+ /*
5110+ * In VMX non-root operation, when the VMCS-link pointer is INVALID_GPA,
5111+ * any VMREAD sets the ALU flags for VMfailInvalid.
5112+ */
5113+ if (vmx->nested.current_vmptr == INVALID_GPA ||
5114+ (is_guest_mode(vcpu) &&
5115+ get_vmcs12(vcpu)->vmcs_link_pointer == INVALID_GPA))
5116+ return nested_vmx_failInvalid(vcpu);
51175117
5118− if (!is_guest_mode(vcpu) && is_vmcs12_ext_field(field))
5119− copy_vmcs02_to_vmcs12_rare(vcpu, vmcs12);
5118+ offset = get_vmcs12_field_offset(field);
5119+ if (offset < 0)
5120+ return nested_vmx_fail(vcpu, VMXERR_UNSUPPORTED_VMCS_COMPONENT);
5121+
5122+ if (!is_guest_mode(vcpu) && is_vmcs12_ext_field(field))
5123+ copy_vmcs02_to_vmcs12_rare(vcpu, vmcs12);
51205124
5121− /* Read the field, zero-extended to a u64 value */
5122− value = vmcs12_read_any(vmcs12, field, offset);
5125+ /* Read the field, zero-extended to a u64 value */
5126+ value = vmcs12_read_any(vmcs12, field, offset);
5127+ } else {
5128+ /*
5129+ * Hyper-V TLFS (as of 6.0b) explicitly states, that while an
5130+ * enlightened VMCS is active VMREAD/VMWRITE instructions are
5131+ * unsupported. Unfortunately, certain versions of Windows 11
5132+ * don't comply with this requirement which is not enforced in
5133+ * genuine Hyper-V. Allow VMREAD from an enlightened VMCS as a
5134+ * workaround, as misbehaving guests will panic on VM-Fail.
5135+ * Note, enlightened VMCS is incompatible with shadow VMCS so
5136+ * all VMREADs from L2 should go to L1.
5137+ */
5138+ if (WARN_ON_ONCE(is_guest_mode(vcpu)))
5139+ return nested_vmx_failInvalid(vcpu);
5140+
5141+ offset = evmcs_field_offset(field, NULL);
5142+ if (offset < 0)
5143+ return nested_vmx_fail(vcpu, VMXERR_UNSUPPORTED_VMCS_COMPONENT);
5144+
5145+ /* Read the field, zero-extended to a u64 value */
5146+ value = evmcs_read_any(vmx->nested.hv_evmcs, field, offset);
5147+ }
51235148
51245149 /*
51255150 * Now copy part of this value to register or memory, as requested.
@@ -5214,7 +5239,7 @@ static int handle_vmwrite(struct kvm_vcpu *vcpu) · 88 unmodified lines
52145239
52155240 field = kvm_register_read(vcpu, (((instr_info) >> 28) & 0xf));
52165241
5217− offset = vmcs_field_to_offset(field);
5242+ offset = get_vmcs12_field_offset(field);
52185243 if (offset < 0)
52195244 return nested_vmx_fail(vcpu, VMXERR_UNSUPPORTED_VMCS_COMPONENT);
52205245
@@ -6462,7 +6487,7 @@ static u64 nested_vmx_calc_vmcs_enum_msr(void) · 1241 unmodified lines
64626487 max_idx = 0;
64636488 for (i = 0; i < nr_vmcs12_fields; i++) {
64646489 /* The vmcs12 table is very, very sparsely populated. */
6465− if (!vmcs_field_to_offset_table[i])
6490+ if (!vmcs12_field_offsets[i])
64666491 continue;
64676492
64686493 idx = vmcs_field_index(VMCS12_IDX_TO_ENC(i));
@@ -6771,6 +6796,7 @@ __init int nested_vmx_hardware_setup(int (*exit_handlers[])(struct kvm_vcpu *)) · 302 unmodified lines
67716796 }
67726797
67736798 struct kvm_x86_nested_ops vmx_nested_ops = {
6799+ .leave_nested = vmx_leave_nested,
67746800 .check_events = vmx_check_nested_events,
67756801 .hv_timer_pending = nested_vmx_preemption_timer_pending,
67766802 .triple_fault = nested_vmx_triple_fault,
arch/x86/kvm/vmx/vmcs12.c+2−2
@@ -8,7 +8,7 @@ · 7 unmodified lines
88 FIELD(number, name), \
99 [ROL16(number##_HIGH, 6)] = VMCS12_OFFSET(name) + sizeof(u32)
1010
11−const unsigned short vmcs_field_to_offset_table[] = {
11+const unsigned short vmcs12_field_offsets[] = {
1212 FIELD(VIRTUAL_PROCESSOR_ID, virtual_processor_id),
1313 FIELD(POSTED_INTR_NV, posted_intr_nv),
1414 FIELD(GUEST_ES_SELECTOR, guest_es_selector),
@@ -151,4 +151,4 @@ const unsigned short vmcs_field_to_offset_table[] = { · 136 unmodified lines
151151 FIELD(HOST_RSP, host_rsp),
152152 FIELD(HOST_RIP, host_rip),
153153 };
154−const unsigned int nr_vmcs12_fields = ARRAY_SIZE(vmcs_field_to_offset_table);
154+const unsigned int nr_vmcs12_fields = ARRAY_SIZE(vmcs12_field_offsets);
arch/x86/kvm/vmx/vmcs12.h+3−3
@@ -361,10 +361,10 @@ static inline void vmx_check_vmcs12_offsets(void) · 360 unmodified lines
361361 CHECK_OFFSET(guest_pml_index, 996);
362362 }
363363
364−extern const unsigned short vmcs_field_to_offset_table[];
364+extern const unsigned short vmcs12_field_offsets[];
365365 extern const unsigned int nr_vmcs12_fields;
366366
367−static inline short vmcs_field_to_offset(unsigned long field)
367+static inline short get_vmcs12_field_offset(unsigned long field)
368368 {
369369 unsigned short offset;
370370 unsigned int index;
@@ -377,7 +377,7 @@ static inline short vmcs_field_to_offset(unsigned long field) · 6 unmodified lines
377377 return -ENOENT;
378378
379379 index = array_index_nospec(index, nr_vmcs12_fields);
380− offset = vmcs_field_to_offset_table[index];
380+ offset = vmcs12_field_offsets[index];
381381 if (offset == 0)
382382 return -ENOENT;
383383 return offset;
arch/x86/kvm/vmx/vmx.c+38−9
@@ -1487,11 +1487,12 @@ static int vmx_rtit_ctl_check(struct kvm_vcpu *vcpu, u64 data) · 1486 unmodified lines
14871487 return 0;
14881488 }
14891489
1490−static bool vmx_can_emulate_instruction(struct kvm_vcpu *vcpu, void *insn, int insn_len)
1490+static bool vmx_can_emulate_instruction(struct kvm_vcpu *vcpu, int emul_type,
1491+ void *insn, int insn_len)
14911492 {
14921493 /*
14931494 * Emulation of instructions in SGX enclaves is impossible as RIP does
1494− * not point tthe failing instruction, and even if it did, the code
1495+ * not point at the failing instruction, and even if it did, the code
14951496 * stream is inaccessible. Inject #UD instead of exiting to userspace
14961497 * so that guest userspace can't DoS the guest simply by triggering
14971498 * emulation (enclaves are CPL3 only).
@@ -2603,7 +2604,6 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf, · 1105 unmodified lines
26032604 return -EIO;
26042605
26052606 vmcs_conf->size = vmx_msr_high & 0x1fff;
2606− vmcs_conf->order = get_order(vmcs_conf->size);
26072607 vmcs_conf->basic_cap = vmx_msr_high & ~0x1fff;
26082608
26092609 vmcs_conf->revision_id = vmx_msr_low;
@@ -2628,7 +2628,7 @@ struct vmcs *alloc_vmcs_cpu(bool shadow, int cpu, gfp_t flags) · 18 unmodified lines
26282628 struct page *pages;
26292629 struct vmcs *vmcs;
26302630
2631− pages = __alloc_pages_node(node, flags, vmcs_config.order);
2631+ pages = __alloc_pages_node(node, flags, 0);
26322632 if (!pages)
26332633 return NULL;
26342634 vmcs = page_address(pages);
@@ -2647,7 +2647,7 @@ struct vmcs *alloc_vmcs_cpu(bool shadow, int cpu, gfp_t flags) · 12 unmodified lines
26472647
26482648 void free_vmcs(struct vmcs *vmcs)
26492649 {
2650− free_pages((unsigned long)vmcs, vmcs_config.order);
2650+ free_page((unsigned long)vmcs);
26512651 }
26522652
26532653 /*
@@ -4094,10 +4094,14 @@ void vmx_set_constant_host_state(struct vcpu_vmx *vmx) · 1440 unmodified lines
40944094 vmcs_write32(HOST_IA32_SYSENTER_CS, low32);
40954095
40964096 /*
4097− * If 32-bit syscall is enabled, vmx_vcpu_load_vcms rewrites
4098− * HOST_IA32_SYSENTER_ESP.
4097+ * SYSENTER is used for 32-bit system calls on either 32-bit or
4098+ * 64-bit kernels. It is always zero If neither is allowed, otherwise
4099+ * vmx_vcpu_load_vmcs loads it with the per-CPU entry stack (and may
4100+ * have already done so!).
40994101 */
4100− vmcs_writel(HOST_IA32_SYSENTER_ESP, 0);
4102+ if (!IS_ENABLED(CONFIG_IA32_EMULATION) && !IS_ENABLED(CONFIG_X86_32))
4103+ vmcs_writel(HOST_IA32_SYSENTER_ESP, 0);
4104+
41014105 rdmsrl(MSR_IA32_SYSENTER_EIP, tmpl);
41024106 vmcs_writel(HOST_IA32_SYSENTER_EIP, tmpl); /* 22.2.3 */
41034107
@@ -4901,8 +4905,33 @@ static int handle_exception_nmi(struct kvm_vcpu *vcpu) · 797 unmodified lines
49014905 dr6 = vmx_get_exit_qual(vcpu);
49024906 if (!(vcpu->guest_debug &
49034907 (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP))) {
4908+ /*
4909+ * If the #DB was due to ICEBP, a.k.a. INT1, skip the
4910+ * instruction. ICEBP generates a trap-like #DB, but
4911+ * despite its interception control being tied to #DB,
4912+ * is an instruction intercept, i.e. the VM-Exit occurs
4913+ * on the ICEBP itself. Note, skipping ICEBP also
4914+ * clears STI and MOVSS blocking.
4915+ *
4916+ * For all other #DBs, set vmcs.PENDING_DBG_EXCEPTIONS.BS
4917+ * if single-step is enabled in RFLAGS and STI or MOVSS
4918+ * blocking is active, as the CPU doesn't set the bit
4919+ * on VM-Exit due to #DB interception. VM-Entry has a
4920+ * consistency check that a single-step #DB is pending
4921+ * in this scenario as the previous instruction cannot
4922+ * have toggled RFLAGS.TF 0=>1 (because STI and POP/MOV
4923+ * don't modify RFLAGS), therefore the one instruction
4924+ * delay when activating single-step breakpoints must
4925+ * have already expired. Note, the CPU sets/clears BS
4926+ * as appropriate for all other VM-Exits types.
4927+ */
49044928 if (is_icebp(intr_info))
49054929 WARN_ON(!skip_emulated_instruction(vcpu));
4930+ else if ((vmx_get_rflags(vcpu) & X86_EFLAGS_TF) &&
4931+ (vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) &
4932+ (GUEST_INTR_STATE_STI | GUEST_INTR_STATE_MOV_SS)))
4933+ vmcs_writel(GUEST_PENDING_DBG_EXCEPTIONS,
4934+ vmcs_readl(GUEST_PENDING_DBG_EXCEPTIONS) | DR6_BS);
49064935
49074936 kvm_queue_exception_p(vcpu, DB_VECTOR, dr6);
49084937 return 1;
@@ -5397,7 +5426,7 @@ static int handle_ept_misconfig(struct kvm_vcpu *vcpu) · 488 unmodified lines
53975426 {
53985427 gpa_t gpa;
53995428
5400− if (!vmx_can_emulate_instruction(vcpu, NULL, 0))
5429+ if (!vmx_can_emulate_instruction(vcpu, EMULTYPE_PF, NULL, 0))
54015430 return 1;
54025431
54035432 /*
arch/x86/kvm/x86.c+81−13
@@ -3535,6 +3535,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 3534 unmodified lines
35353535 if (data & ~supported_xss)
35363536 return 1;
35373537 vcpu->arch.ia32_xss = data;
3538+ kvm_update_cpuid_runtime(vcpu);
35383539 break;
35393540 case MSR_SMI_COUNT:
35403541 if (!msr_info->host_initiated)
@@ -4229,6 +4230,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) · 688 unmodified lines
42294230 case KVM_CAP_SREGS2:
42304231 case KVM_CAP_EXIT_ON_EMULATION_FAILURE:
42314232 case KVM_CAP_VCPU_ATTRIBUTES:
4233+ case KVM_CAP_SYS_ATTRIBUTES:
42324234 r = 1;
42334235 break;
42344236 case KVM_CAP_EXIT_HYPERCALL:
@@ -4331,7 +4333,49 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) · 96 unmodified lines
43314333 break;
43324334 }
43334335 return r;
4336+}
4337+
4338+static inline void __user *kvm_get_attr_addr(struct kvm_device_attr *attr)
4339+{
4340+ void __user *uaddr = (void __user*)(unsigned long)attr->addr;
43344341
4342+ if ((u64)(unsigned long)uaddr != attr->addr)
4343+ return ERR_PTR(-EFAULT);
4344+ return uaddr;
4345+}
4346+
4347+static int kvm_x86_dev_get_attr(struct kvm_device_attr *attr)
4348+{
4349+ u64 __user *uaddr = kvm_get_attr_addr(attr);
4350+
4351+ if (attr->group)
4352+ return -ENXIO;
4353+
4354+ if (IS_ERR(uaddr))
4355+ return PTR_ERR(uaddr);
4356+
4357+ switch (attr->attr) {
4358+ case KVM_X86_XCOMP_GUEST_SUPP:
4359+ if (put_user(supported_xcr0, uaddr))
4360+ return -EFAULT;
4361+ return 0;
4362+ default:
4363+ return -ENXIO;
4364+ break;
4365+ }
4366+}
4367+
4368+static int kvm_x86_dev_has_attr(struct kvm_device_attr *attr)
4369+{
4370+ if (attr->group)
4371+ return -ENXIO;
4372+
4373+ switch (attr->attr) {
4374+ case KVM_X86_XCOMP_GUEST_SUPP:
4375+ return 0;
4376+ default:
4377+ return -ENXIO;
4378+ }
43354379 }
43364380
43374381 long kvm_arch_dev_ioctl(struct file *filp,
@@ -4422,6 +4466,22 @@ long kvm_arch_dev_ioctl(struct file *filp, · 84 unmodified lines
44224466 case KVM_GET_SUPPORTED_HV_CPUID:
44234467 r = kvm_ioctl_get_supported_hv_cpuid(NULL, argp);
44244468 break;
4469+ case KVM_GET_DEVICE_ATTR: {
4470+ struct kvm_device_attr attr;
4471+ r = -EFAULT;
4472+ if (copy_from_user(&attr, (void __user *)arg, sizeof(attr)))
4473+ break;
4474+ r = kvm_x86_dev_get_attr(&attr);
4475+ break;
4476+ }
4477+ case KVM_HAS_DEVICE_ATTR: {
4478+ struct kvm_device_attr attr;
4479+ r = -EFAULT;
4480+ if (copy_from_user(&attr, (void __user *)arg, sizeof(attr)))
4481+ break;
4482+ r = kvm_x86_dev_has_attr(&attr);
4483+ break;
4484+ }
44254485 default:
44264486 r = -EINVAL;
44274487 break;
@@ -4860,8 +4920,10 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, · 432 unmodified lines
48604920 vcpu->arch.apic->sipi_vector = events->sipi_vector;
48614921
48624922 if (events->flags & KVM_VCPUEVENT_VALID_SMM) {
4863− if (!!(vcpu->arch.hflags & HF_SMM_MASK) != events->smi.smm)
4923+ if (!!(vcpu->arch.hflags & HF_SMM_MASK) != events->smi.smm) {
4924+ kvm_x86_ops.nested_ops->leave_nested(vcpu);
48644925 kvm_smm_changed(vcpu, events->smi.smm);
4926+ }
48654927
48664928 vcpu->arch.smi_pending = events->smi.pending;
48674929
@@ -5022,11 +5084,11 @@ static int kvm_arch_tsc_has_attr(struct kvm_vcpu *vcpu, · 154 unmodified lines
50225084 static int kvm_arch_tsc_get_attr(struct kvm_vcpu *vcpu,
50235085 struct kvm_device_attr *attr)
50245086 {
5025− u64 __user *uaddr = (u64 __user *)(unsigned long)attr->addr;
5087+ u64 __user *uaddr = kvm_get_attr_addr(attr);
50265088 int r;
50275089
5028− if ((u64)(unsigned long)uaddr != attr->addr)
5029− return -EFAULT;
5090+ if (IS_ERR(uaddr))
5091+ return PTR_ERR(uaddr);
50305092
50315093 switch (attr->attr) {
50325094 case KVM_VCPU_TSC_OFFSET:
@@ -5045,12 +5107,12 @@ static int kvm_arch_tsc_get_attr(struct kvm_vcpu *vcpu, · 12 unmodified lines
50455107 static int kvm_arch_tsc_set_attr(struct kvm_vcpu *vcpu,
50465108 struct kvm_device_attr *attr)
50475109 {
5048− u64 __user *uaddr = (u64 __user *)(unsigned long)attr->addr;
5110+ u64 __user *uaddr = kvm_get_attr_addr(attr);
50495111 struct kvm *kvm = vcpu->kvm;
50505112 int r;
50515113
5052− if ((u64)(unsigned long)uaddr != attr->addr)
5053− return -EFAULT;
5114+ if (IS_ERR(uaddr))
5115+ return PTR_ERR(uaddr);
50545116
50555117 switch (attr->attr) {
50565118 case KVM_VCPU_TSC_OFFSET: {
@@ -6810,6 +6872,13 @@ int kvm_write_guest_virt_system(struct kvm_vcpu *vcpu, gva_t addr, void *val, · 1753 unmodified lines
68106872 }
68116873 EXPORT_SYMBOL_GPL(kvm_write_guest_virt_system);
68126874
6875+static int kvm_can_emulate_insn(struct kvm_vcpu *vcpu, int emul_type,
6876+ void *insn, int insn_len)
6877+{
6878+ return static_call(kvm_x86_can_emulate_instruction)(vcpu, emul_type,
6879+ insn, insn_len);
6880+}
6881+
68136882 int handle_ud(struct kvm_vcpu *vcpu)
68146883 {
68156884 static const char kvm_emulate_prefix[] = { __KVM_EMULATE_PREFIX };
@@ -6817,7 +6886,7 @@ int handle_ud(struct kvm_vcpu *vcpu) · 1 unmodified line
68176886 char sig[5]; /* ud2; .ascii "kvm" */
68186887 struct x86_exception e;
68196888
6820− if (unlikely(!static_call(kvm_x86_can_emulate_instruction)(vcpu, NULL, 0)))
6889+ if (unlikely(!kvm_can_emulate_insn(vcpu, emul_type, NULL, 0)))
68216890 return 1;
68226891
68236892 if (force_emulation_prefix &&
@@ -8193,7 +8262,7 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa, · 1369 unmodified lines
81938262 bool writeback = true;
81948263 bool write_fault_to_spt;
81958264
8196− if (unlikely(!static_call(kvm_x86_can_emulate_instruction)(vcpu, insn, insn_len)))
8265+ if (unlikely(!kvm_can_emulate_insn(vcpu, emulation_type, insn, insn_len)))
81978266 return 1;
81988267
81998268 vcpu->arch.l1tf_flush_l1d = true;
@@ -9706,7 +9775,7 @@ void kvm_arch_mmu_notifier_invalidate_range(struct kvm *kvm, · 1506 unmodified lines
97069775 kvm_make_all_cpus_request(kvm, KVM_REQ_APIC_PAGE_RELOAD);
97079776 }
97089777
9709−void kvm_vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu)
9778+static void kvm_vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu)
97109779 {
97119780 if (!lapic_in_kernel(vcpu))
97129781 return;
@@ -11209,7 +11278,8 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) · 1496 unmodified lines
1120911278
1121011279 vcpu->arch.msr_misc_features_enables = 0;
1121111280
11212− vcpu->arch.xcr0 = XFEATURE_MASK_FP;
11281+ __kvm_set_xcr(vcpu, 0, XFEATURE_MASK_FP);
11282+ __kvm_set_msr(vcpu, MSR_IA32_XSS, 0, true);
1121311283 }
1121411284
1121511285 /* All GPRs except RDX (handled below) are zeroed on RESET/INIT. */
@@ -11226,8 +11296,6 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) · 10 unmodified lines
1122611296 cpuid_0x1 = kvm_find_cpuid_entry(vcpu, 1, 0);
1122711297 kvm_rdx_write(vcpu, cpuid_0x1 ? cpuid_0x1->eax : 0x600);
1122811298
11229− vcpu->arch.ia32_xss = 0;
11230−
1123111299 static_call(kvm_x86_vcpu_reset)(vcpu, init_event);
1123211300
1123311301 kvm_set_rflags(vcpu, X86_EFLAGS_FIXED);
arch/x86/kvm/xen.c+2−8
@@ -316,10 +316,7 @@ int __kvm_xen_has_interrupt(struct kvm_vcpu *v) · 315 unmodified lines
316316 "\tnotq %0\n"
317317 "\t" LOCK_PREFIX "andq %0, %2\n"
318318 "2:\n"
319− "\t.section .fixup,\"ax\"\n"
320− "3:\tjmp\t2b\n"
321− "\t.previous\n"
322− _ASM_EXTABLE_UA(1b, 3b)
319+ _ASM_EXTABLE_UA(1b, 2b)
323320 : "=r" (evtchn_pending_sel),
324321 "+m" (vi->evtchn_pending_sel),
325322 "+m" (v->arch.xen.evtchn_pending_sel)
@@ -335,10 +332,7 @@ int __kvm_xen_has_interrupt(struct kvm_vcpu *v) · 9 unmodified lines
335332 "\tnotl %0\n"
336333 "\t" LOCK_PREFIX "andl %0, %2\n"
337334 "2:\n"
338− "\t.section .fixup,\"ax\"\n"
339− "3:\tjmp\t2b\n"
340− "\t.previous\n"
341− _ASM_EXTABLE_UA(1b, 3b)
335+ _ASM_EXTABLE_UA(1b, 2b)
342336 : "=r" (evtchn_pending_sel32),
343337 "+m" (vi->evtchn_pending_sel),
344338 "+m" (v->arch.xen.evtchn_pending_sel)
arch/x86/pci/fixup.c+2−2
@@ -353,8 +353,8 @@ static void pci_fixup_video(struct pci_dev *pdev) · 352 unmodified lines
353353 }
354354 }
355355 }
356−DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,
357− PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video);
356+DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_ANY_ID, PCI_ANY_ID,
357+ PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video);
358358
359359
360360 static const struct dmi_system_id msi_k8t_dmi_table[] = {
block/blk-core.c+19−6
@@ -1061,20 +1061,32 @@ again: · 1060 unmodified lines
10611061 }
10621062
10631063 static unsigned long __part_start_io_acct(struct block_device *part,
1064− unsigned int sectors, unsigned int op)
1064+ unsigned int sectors, unsigned int op,
1065+ unsigned long start_time)
10651066 {
10661067 const int sgrp = op_stat_group(op);
1067− unsigned long now = READ_ONCE(jiffies);
10681068
10691069 part_stat_lock();
1070− update_io_ticks(part, now, false);
1070+ update_io_ticks(part, start_time, false);
10711071 part_stat_inc(part, ios[sgrp]);
10721072 part_stat_add(part, sectors[sgrp], sectors);
10731073 part_stat_local_inc(part, in_flight[op_is_write(op)]);
10741074 part_stat_unlock();
10751075
1076− return now;
1076+ return start_time;
1077+}
1078+
1079+/**
1080+ * bio_start_io_acct_time - start I/O accounting for bio based drivers
1081+ * @bio: bio to start account for
1082+ * @start_time: start time that should be passed back to bio_end_io_acct().
1083+ */
1084+void bio_start_io_acct_time(struct bio *bio, unsigned long start_time)
1085+{
1086+ __part_start_io_acct(bio->bi_bdev, bio_sectors(bio),
1087+ bio_op(bio), start_time);
10771088 }
1089+EXPORT_SYMBOL_GPL(bio_start_io_acct_time);
10781090
10791091 /**
10801092 * bio_start_io_acct - start I/O accounting for bio based drivers
@@ -1084,14 +1096,15 @@ static unsigned long __part_start_io_acct(struct block_device *part, · 3 unmodified lines
10841096 */
10851097 unsigned long bio_start_io_acct(struct bio *bio)
10861098 {
1087− return __part_start_io_acct(bio->bi_bdev, bio_sectors(bio), bio_op(bio));
1099+ return __part_start_io_acct(bio->bi_bdev, bio_sectors(bio),
1100+ bio_op(bio), jiffies);
10881101 }
10891102 EXPORT_SYMBOL_GPL(bio_start_io_acct);
10901103
10911104 unsigned long disk_start_io_acct(struct gendisk *disk, unsigned int sectors,
10921105 unsigned int op)
10931106 {
1094− return __part_start_io_acct(disk->part0, sectors, op);
1107+ return __part_start_io_acct(disk->part0, sectors, op, jiffies);
10951108 }
10961109 EXPORT_SYMBOL(disk_start_io_acct);
10971110
block/blk-ia-ranges.c+1−1
@@ -144,7 +144,7 @@ int disk_register_independent_access_ranges(struct gendisk *disk, · 143 unmodified lines
144144 &q->kobj, "%s", "independent_access_ranges");
145145 if (ret) {
146146 q->ia_ranges = NULL;
147− kfree(iars);
147+ kobject_put(&iars->kobj);
148148 return ret;
149149 }
150150
block/blk-mq.c+2−0
@@ -2922,6 +2922,8 @@ blk_status_t blk_insert_cloned_request(struct request_queue *q, struct request * · 2921 unmodified lines
29222922 */
29232923 blk_mq_run_dispatch_ops(rq->q,
29242924 ret = blk_mq_request_issue_directly(rq, true));
2925+ if (ret)
2926+ blk_account_io_done(rq, ktime_get_ns());
29252927 return ret;
29262928 }
29272929 EXPORT_SYMBOL_GPL(blk_insert_cloned_request);
drivers/ata/pata_platform.c+2−0
@@ -128,6 +128,8 @@ int __pata_platform_probe(struct device *dev, struct resource *io_res, · 127 unmodified lines
128128 ap = host->ports[0];
129129
130130 ap->ops = devm_kzalloc(dev, sizeof(*ap->ops), GFP_KERNEL);
131+ if (!ap->ops)
132+ return -ENOMEM;
131133 ap->ops->inherits = &ata_sff_port_ops;
132134 ap->ops->cable_detect = ata_cable_unknown;
133135 ap->ops->set_mode = pata_platform_set_mode;
drivers/counter/counter-core.c+6−9
@@ -90,10 +90,8 @@ struct counter_device *counter_alloc(size_t sizeof_priv) · 89 unmodified lines
9090 int err;
9191
9292 ch = kzalloc(sizeof(*ch) + sizeof_priv, GFP_KERNEL);
93− if (!ch) {
94− err = -ENOMEM;
95− goto err_alloc_ch;
96− }
93+ if (!ch)
94+ return NULL;
9795
9896 counter = &ch->counter;
9997 dev = &counter->dev;
@@ -123,9 +121,8 @@ err_chrdev_add: · 23 unmodified lines
123121 err_ida_alloc:
124122
125123 kfree(ch);
126−err_alloc_ch:
127124
128− return ERR_PTR(err);
125+ return NULL;
129126 }
130127 EXPORT_SYMBOL_GPL(counter_alloc);
131128
@@ -208,12 +205,12 @@ struct counter_device *devm_counter_alloc(struct device *dev, size_t sizeof_priv · 76 unmodified lines
208205 int err;
209206
210207 counter = counter_alloc(sizeof_priv);
211− if (IS_ERR(counter))
212− return counter;
208+ if (!counter)
209+ return NULL;
213210
214211 err = devm_add_action_or_reset(dev, devm_counter_put, counter);
215212 if (err < 0)
216− return ERR_PTR(err);
213+ return NULL;
217214
218215 return counter;
219216 }
drivers/firmware/efi/efi.c+7−0
@@ -722,6 +722,13 @@ void __init efi_systab_report_header(const efi_table_hdr_t *systab_hdr, · 721 unmodified lines
722722 systab_hdr->revision >> 16,
723723 systab_hdr->revision & 0xffff,
724724 vendor);
725+
726+ if (IS_ENABLED(CONFIG_X86_64) &&
727+ systab_hdr->revision > EFI_1_10_SYSTEM_TABLE_REVISION &&
728+ !strcmp(vendor, "Apple")) {
729+ pr_info("Apple Mac detected, using EFI v1.10 runtime services only\n");
730+ efi.runtime_version = EFI_1_10_SYSTEM_TABLE_REVISION;
731+ }
725732 }
726733
727734 static __initdata char memory_type_name[][13] = {
drivers/firmware/efi/libstub/arm64-stub.c+3−3
@@ -119,9 +119,9 @@ efi_status_t handle_kernel_image(unsigned long *image_addr, · 118 unmodified lines
119119 if (image->image_base != _text)
120120 efi_err("FIRMWARE BUG: efi_loaded_image_t::image_base has bogus value\n");
121121
122− if (!IS_ALIGNED((u64)_text, EFI_KIMG_ALIGN))
123− efi_err("FIRMWARE BUG: kernel image not aligned on %ldk boundary\n",
124− EFI_KIMG_ALIGN >> 10);
122+ if (!IS_ALIGNED((u64)_text, SEGMENT_ALIGN))
123+ efi_err("FIRMWARE BUG: kernel image not aligned on %dk boundary\n",
124+ SEGMENT_ALIGN >> 10);
125125
126126 kernel_size = _edata - _text;
127127 kernel_memsize = kernel_size + (_end - _edata);
drivers/gpio/gpio-sim.c+1−1
@@ -816,7 +816,7 @@ gpio_sim_make_bank_swnode(struct gpio_sim_bank *bank, · 815 unmodified lines
816816
817817 properties[prop_idx++] = PROPERTY_ENTRY_U32("ngpios", bank->num_lines);
818818
819− if (bank->label)
819+ if (bank->label && (strlen(bank->label) > 0))
820820 properties[prop_idx++] = PROPERTY_ENTRY_STRING("gpio-sim,label",
821821 bank->label);
822822
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+81−0
@@ -1525,6 +1525,87 @@ static const u16 amdgpu_unsupported_pciidlist[] = { · 1524 unmodified lines
15251525 0x99A0,
15261526 0x99A2,
15271527 0x99A4,
1528+ /* radeon secondary ids */
1529+ 0x3171,
1530+ 0x3e70,
1531+ 0x4164,
1532+ 0x4165,
1533+ 0x4166,
1534+ 0x4168,
1535+ 0x4170,
1536+ 0x4171,
1537+ 0x4172,
1538+ 0x4173,
1539+ 0x496e,
1540+ 0x4a69,
1541+ 0x4a6a,
1542+ 0x4a6b,
1543+ 0x4a70,
1544+ 0x4a74,
1545+ 0x4b69,
1546+ 0x4b6b,
1547+ 0x4b6c,
1548+ 0x4c6e,
1549+ 0x4e64,
1550+ 0x4e65,
1551+ 0x4e66,
1552+ 0x4e67,
1553+ 0x4e68,
1554+ 0x4e69,
1555+ 0x4e6a,
1556+ 0x4e71,
1557+ 0x4f73,
1558+ 0x5569,
1559+ 0x556b,
1560+ 0x556d,
1561+ 0x556f,
1562+ 0x5571,
1563+ 0x5854,
1564+ 0x5874,
1565+ 0x5940,
1566+ 0x5941,
1567+ 0x5b72,
1568+ 0x5b73,
1569+ 0x5b74,
1570+ 0x5b75,
1571+ 0x5d44,
1572+ 0x5d45,
1573+ 0x5d6d,
1574+ 0x5d6f,
1575+ 0x5d72,
1576+ 0x5d77,
1577+ 0x5e6b,
1578+ 0x5e6d,
1579+ 0x7120,
1580+ 0x7124,
1581+ 0x7129,
1582+ 0x712e,
1583+ 0x712f,
1584+ 0x7162,
1585+ 0x7163,
1586+ 0x7166,
1587+ 0x7167,
1588+ 0x7172,
1589+ 0x7173,
1590+ 0x71a0,
1591+ 0x71a1,
1592+ 0x71a3,
1593+ 0x71a7,
1594+ 0x71bb,
1595+ 0x71e0,
1596+ 0x71e1,
1597+ 0x71e2,
1598+ 0x71e6,
1599+ 0x71e7,
1600+ 0x71f2,
1601+ 0x7269,
1602+ 0x726b,
1603+ 0x726e,
1604+ 0x72a0,
1605+ 0x72a8,
1606+ 0x72b1,
1607+ 0x72b3,
1608+ 0x793f,
15281609 };
15291610
15301611 static const struct pci_device_id pciidlist[] = {
drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c+2−2
@@ -2033,10 +2033,10 @@ static void calculate_bandwidth( · 2032 unmodified lines
20332033 kfree(surface_type);
20342034 free_tiling_mode:
20352035 kfree(tiling_mode);
2036−free_yclk:
2037− kfree(yclk);
20382036 free_sclk:
20392037 kfree(sclk);
2038+free_yclk:
2039+ kfree(yclk);
20402040 }
20412041
20422042 /*******************************************************************************
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c+0−1
@@ -503,7 +503,6 @@ static void dcn_bw_calc_rq_dlg_ttu( · 502 unmodified lines
503503 //input[in_idx].dout.output_standard;
504504
505505 /*todo: soc->sr_enter_plus_exit_time??*/
506− dlg_sys_param->t_srx_delay_us = dc->dcn_ip->dcfclk_cstate_latency / v->dcf_clk_deep_sleep;
507506
508507 dml1_rq_dlg_get_rq_params(dml, rq_param, &input->pipe.src);
509508 dml1_extract_rq_regs(dml, rq_regs, rq_param);
drivers/gpu/drm/amd/display/dc/core/dc.c+27−13
@@ -1404,20 +1404,34 @@ static void program_timing_sync( · 1403 unmodified lines
14041404 status->timing_sync_info.master = false;
14051405
14061406 }
1407− /* remove any other unblanked pipes as they have already been synced */
1408− for (j = j + 1; j < group_size; j++) {
1409− bool is_blanked;
14101407
1411− if (pipe_set[j]->stream_res.opp->funcs->dpg_is_blanked)
1412− is_blanked =
1413− pipe_set[j]->stream_res.opp->funcs->dpg_is_blanked(pipe_set[j]->stream_res.opp);
1414− else
1415− is_blanked =
1416− pipe_set[j]->stream_res.tg->funcs->is_blanked(pipe_set[j]->stream_res.tg);
1417− if (!is_blanked) {
1418− group_size--;
1419− pipe_set[j] = pipe_set[group_size];
1420− j--;
1408+ /* remove any other pipes that are already been synced */
1409+ if (dc->config.use_pipe_ctx_sync_logic) {
1410+ /* check pipe's syncd to decide which pipe to be removed */
1411+ for (j = 1; j < group_size; j++) {
1412+ if (pipe_set[j]->pipe_idx_syncd == pipe_set[0]->pipe_idx_syncd) {
1413+ group_size--;
1414+ pipe_set[j] = pipe_set[group_size];
1415+ j--;
1416+ } else
1417+ /* link slave pipe's syncd with master pipe */
1418+ pipe_set[j]->pipe_idx_syncd = pipe_set[0]->pipe_idx_syncd;
1419+ }
1420+ } else {
1421+ for (j = j + 1; j < group_size; j++) {
1422+ bool is_blanked;
1423+
1424+ if (pipe_set[j]->stream_res.opp->funcs->dpg_is_blanked)
1425+ is_blanked =
1426+ pipe_set[j]->stream_res.opp->funcs->dpg_is_blanked(pipe_set[j]->stream_res.opp);
1427+ else
1428+ is_blanked =
1429+ pipe_set[j]->stream_res.tg->funcs->is_blanked(pipe_set[j]->stream_res.tg);
1430+ if (!is_blanked) {
1431+ group_size--;
1432+ pipe_set[j] = pipe_set[group_size];
1433+ j--;
1434+ }
14211435 }
14221436 }
14231437
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c+3−3
@@ -202,7 +202,7 @@ void dp_wait_for_training_aux_rd_interval( · 201 unmodified lines
202202 uint32_t wait_in_micro_secs)
203203 {
204204 #if defined(CONFIG_DRM_AMD_DC_DCN)
205− if (wait_in_micro_secs > 16000)
205+ if (wait_in_micro_secs > 1000)
206206 msleep(wait_in_micro_secs/1000);
207207 else
208208 udelay(wait_in_micro_secs);
@@ -6935,7 +6935,7 @@ bool dpcd_write_128b_132b_sst_payload_allocation_table( · 6726 unmodified lines
69356935 }
69366936 }
69376937 retries++;
6938− udelay(5000);
6938+ msleep(5);
69396939 }
69406940
69416941 if (!result && retries == max_retries) {
@@ -6987,7 +6987,7 @@ bool dpcd_poll_for_allocation_change_trigger(struct dc_link *link) · 45 unmodified lines
69876987 break;
69886988 }
69896989
6990− udelay(5000);
6990+ msleep(5);
69916991 }
69926992
69936993 if (result == ACT_FAILED) {
drivers/gpu/drm/amd/display/dc/core/dc_resource.c+54−0
@@ -3217,6 +3217,60 @@ struct hpo_dp_link_encoder *resource_get_hpo_dp_link_enc_for_det_lt( · 3216 unmodified lines
32173217 }
32183218 #endif
32193219
3220+void reset_syncd_pipes_from_disabled_pipes(struct dc *dc,
3221+ struct dc_state *context)
3222+{
3223+ int i, j;
3224+ struct pipe_ctx *pipe_ctx_old, *pipe_ctx, *pipe_ctx_syncd;
3225+
3226+ /* If pipe backend is reset, need to reset pipe syncd status */
3227+ for (i = 0; i < dc->res_pool->pipe_count; i++) {
3228+ pipe_ctx_old = &dc->current_state->res_ctx.pipe_ctx[i];
3229+ pipe_ctx = &context->res_ctx.pipe_ctx[i];
3230+
3231+ if (!pipe_ctx_old->stream)
3232+ continue;
3233+
3234+ if (pipe_ctx_old->top_pipe || pipe_ctx_old->prev_odm_pipe)
3235+ continue;
3236+
3237+ if (!pipe_ctx->stream ||
3238+ pipe_need_reprogram(pipe_ctx_old, pipe_ctx)) {
3239+
3240+ /* Reset all the syncd pipes from the disabled pipe */
3241+ for (j = 0; j < dc->res_pool->pipe_count; j++) {
3242+ pipe_ctx_syncd = &context->res_ctx.pipe_ctx[j];
3243+ if ((GET_PIPE_SYNCD_FROM_PIPE(pipe_ctx_syncd) == pipe_ctx_old->pipe_idx) ||
3244+ !IS_PIPE_SYNCD_VALID(pipe_ctx_syncd))
3245+ SET_PIPE_SYNCD_TO_PIPE(pipe_ctx_syncd, j);
3246+ }
3247+ }
3248+ }
3249+}
3250+
3251+void check_syncd_pipes_for_disabled_master_pipe(struct dc *dc,
3252+ struct dc_state *context,
3253+ uint8_t disabled_master_pipe_idx)
3254+{
3255+ int i;
3256+ struct pipe_ctx *pipe_ctx, *pipe_ctx_check;
3257+
3258+ pipe_ctx = &context->res_ctx.pipe_ctx[disabled_master_pipe_idx];
3259+ if ((GET_PIPE_SYNCD_FROM_PIPE(pipe_ctx) != disabled_master_pipe_idx) ||
3260+ !IS_PIPE_SYNCD_VALID(pipe_ctx))
3261+ SET_PIPE_SYNCD_TO_PIPE(pipe_ctx, disabled_master_pipe_idx);
3262+
3263+ /* for the pipe disabled, check if any slave pipe exists and assert */
3264+ for (i = 0; i < dc->res_pool->pipe_count; i++) {
3265+ pipe_ctx_check = &context->res_ctx.pipe_ctx[i];
3266+
3267+ if ((GET_PIPE_SYNCD_FROM_PIPE(pipe_ctx_check) == disabled_master_pipe_idx) &&
3268+ IS_PIPE_SYNCD_VALID(pipe_ctx_check) && (i != disabled_master_pipe_idx))
3269+ DC_ERR("DC: Failure: pipe_idx[%d] syncd with disabled master pipe_idx[%d]\n",
3270+ i, disabled_master_pipe_idx);
3271+ }
3272+}
3273+
32203274 uint8_t resource_transmitter_to_phy_idx(const struct dc *dc, enum transmitter transmitter)
32213275 {
32223276 /* TODO - get transmitter to phy idx mapping from DMUB */
drivers/gpu/drm/amd/display/dc/dc.h+1−0
@@ -344,6 +344,7 @@ struct dc_config { · 343 unmodified lines
344344 uint8_t vblank_alignment_max_frame_time_diff;
345345 bool is_asymmetric_memory;
346346 bool is_single_rank_dimm;
347+ bool use_pipe_ctx_sync_logic;
347348 };
348349
349350 enum visual_confirm {
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c+9−1
@@ -1566,6 +1566,10 @@ static enum dc_status apply_single_controller_ctx_to_hw( · 1565 unmodified lines
15661566 &pipe_ctx->stream->audio_info);
15671567 }
15681568
1569+ /* make sure no pipes syncd to the pipe being enabled */
1570+ if (!pipe_ctx->stream->apply_seamless_boot_optimization && dc->config.use_pipe_ctx_sync_logic)
1571+ check_syncd_pipes_for_disabled_master_pipe(dc, context, pipe_ctx->pipe_idx);
1572+
15691573 #if defined(CONFIG_DRM_AMD_DC_DCN)
15701574 /* DCN3.1 FPGA Workaround
15711575 * Need to enable HPO DP Stream Encoder before setting OTG master enable.
@@ -1604,7 +1608,7 @@ static enum dc_status apply_single_controller_ctx_to_hw( · 32 unmodified lines
16041608 pipe_ctx->stream_res.stream_enc,
16051609 pipe_ctx->stream_res.tg->inst);
16061610
1607− if (dc_is_dp_signal(pipe_ctx->stream->signal) &&
1611+ if (dc_is_embedded_signal(pipe_ctx->stream->signal) &&
16081612 pipe_ctx->stream_res.stream_enc->funcs->reset_fifo)
16091613 pipe_ctx->stream_res.stream_enc->funcs->reset_fifo(
16101614 pipe_ctx->stream_res.stream_enc);
@@ -2297,6 +2301,10 @@ enum dc_status dce110_apply_ctx_to_hw( · 686 unmodified lines
22972301 enum dc_status status;
22982302 int i;
22992303
2304+ /* reset syncd pipes from disabled pipes */
2305+ if (dc->config.use_pipe_ctx_sync_logic)
2306+ reset_syncd_pipes_from_disabled_pipes(dc, context);
2307+
23002308 /* Reset old context */
23012309 /* look up the targets that have been removed since last commit */
23022310 hws->funcs.reset_hw_ctx_wrap(dc, context);
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c+2−2
@@ -1878,7 +1878,6 @@ noinline bool dcn30_internal_validate_bw( · 1877 unmodified lines
18781878 dc->res_pool->funcs->update_soc_for_wm_a(dc, context);
18791879 pipe_cnt = dc->res_pool->funcs->populate_dml_pipes(dc, context, pipes, fast_validate);
18801880
1881− DC_FP_START();
18821881 if (!pipe_cnt) {
18831882 out = true;
18841883 goto validate_out;
@@ -2104,7 +2103,6 @@ validate_fail: · 219 unmodified lines
21042103 out = false;
21052104
21062105 validate_out:
2107− DC_FP_END();
21082106 return out;
21092107 }
21102108
@@ -2306,7 +2304,9 @@ bool dcn30_validate_bandwidth(struct dc *dc, · 195 unmodified lines
23062304
23072305 BW_VAL_TRACE_COUNT();
23082306
2307+ DC_FP_START();
23092308 out = dcn30_internal_validate_bw(dc, context, pipes, &pipe_cnt, &vlevel, fast_validate);
2309+ DC_FP_END();
23102310
23112311 if (pipe_cnt == 0)
23122312 goto validate_out;
drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c+12−1
@@ -686,7 +686,7 @@ static const struct dc_debug_options debug_defaults_drv = { · 685 unmodified lines
686686 .disable_clock_gate = true,
687687 .disable_pplib_clock_request = true,
688688 .disable_pplib_wm_range = true,
689− .pipe_split_policy = MPC_SPLIT_DYNAMIC,
689+ .pipe_split_policy = MPC_SPLIT_AVOID,
690690 .force_single_disp_pipe_split = false,
691691 .disable_dcc = DCC_ENABLE,
692692 .vsr_support = true,
@@ -1380,6 +1380,17 @@ static void set_wm_ranges( · 687 unmodified lines
13801380 pp_smu->nv_funcs.set_wm_ranges(&pp_smu->nv_funcs.pp_smu, &ranges);
13811381 }
13821382
1383+static void dcn301_calculate_wm_and_dlg(
1384+ struct dc *dc, struct dc_state *context,
1385+ display_e2e_pipe_params_st *pipes,
1386+ int pipe_cnt,
1387+ int vlevel)
1388+{
1389+ DC_FP_START();
1390+ dcn301_calculate_wm_and_dlg_fp(dc, context, pipes, pipe_cnt, vlevel);
1391+ DC_FP_END();
1392+}
1393+
13831394 static struct resource_funcs dcn301_res_pool_funcs = {
13841395 .destroy = dcn301_destroy_resource_pool,
13851396 .link_enc_create = dcn301_link_encoder_create,
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c+3−0
@@ -2260,6 +2260,9 @@ static bool dcn31_resource_construct( · 2259 unmodified lines
22602260 dc->caps.color.mpc.ogam_rom_caps.hlg = 0;
22612261 dc->caps.color.mpc.ocsc = 1;
22622262
2263+ /* Use pipe context based otg sync logic */
2264+ dc->config.use_pipe_ctx_sync_logic = true;
2265+
22632266 /* read VBIOS LTTPR caps */
22642267 {
22652268 if (ctx->dc_bios->funcs->get_lttpr_caps) {
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20.c+0−2
@@ -1576,8 +1576,6 @@ void dml20_rq_dlg_get_dlg_reg(struct display_mode_lib *mode_lib, · 1575 unmodified lines
15761576 dlg_sys_param.total_flip_bytes = get_total_immediate_flip_bytes(mode_lib,
15771577 e2e_pipe_param,
15781578 num_pipes);
1579− dlg_sys_param.t_srx_delay_us = mode_lib->ip.dcfclk_cstate_latency
1580− / dlg_sys_param.deepsleep_dcfclk_mhz; // TODO: Deprecated
15811579
15821580 print__dlg_sys_params_st(mode_lib, &dlg_sys_param);
15831581
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20v2.c+0−2
@@ -1577,8 +1577,6 @@ void dml20v2_rq_dlg_get_dlg_reg(struct display_mode_lib *mode_lib, · 1576 unmodified lines
15771577 dlg_sys_param.total_flip_bytes = get_total_immediate_flip_bytes(mode_lib,
15781578 e2e_pipe_param,
15791579 num_pipes);
1580− dlg_sys_param.t_srx_delay_us = mode_lib->ip.dcfclk_cstate_latency
1581− / dlg_sys_param.deepsleep_dcfclk_mhz; // TODO: Deprecated
15821580
15831581 print__dlg_sys_params_st(mode_lib, &dlg_sys_param);
15841582
drivers/gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.c+0−2
@@ -1688,8 +1688,6 @@ void dml21_rq_dlg_get_dlg_reg( · 1687 unmodified lines
16881688 mode_lib,
16891689 e2e_pipe_param,
16901690 num_pipes);
1691− dlg_sys_param.t_srx_delay_us = mode_lib->ip.dcfclk_cstate_latency
1692− / dlg_sys_param.deepsleep_dcfclk_mhz; // TODO: Deprecated
16931691
16941692 print__dlg_sys_params_st(mode_lib, &dlg_sys_param);
16951693
drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c+0−2
@@ -1858,8 +1858,6 @@ void dml30_rq_dlg_get_dlg_reg(struct display_mode_lib *mode_lib, · 1857 unmodified lines
18581858 dlg_sys_param.total_flip_bytes = get_total_immediate_flip_bytes(mode_lib,
18591859 e2e_pipe_param,
18601860 num_pipes);
1861− dlg_sys_param.t_srx_delay_us = mode_lib->ip.dcfclk_cstate_latency
1862− / dlg_sys_param.deepsleep_dcfclk_mhz; // TODO: Deprecated
18631861
18641862 print__dlg_sys_params_st(mode_lib, &dlg_sys_param);
18651863
drivers/gpu/drm/amd/display/dc/dml/dcn301/dcn301_fpu.c+1−1
@@ -327,7 +327,7 @@ void dcn301_fpu_init_soc_bounding_box(struct bp_soc_bb_info bb_info) · 326 unmodified lines
327327 dcn3_01_soc.sr_exit_time_us = bb_info.dram_sr_exit_latency_100ns * 10;
328328 }
329329
330−void dcn301_calculate_wm_and_dlg(struct dc *dc,
330+void dcn301_calculate_wm_and_dlg_fp(struct dc *dc,
331331 struct dc_state *context,
332332 display_e2e_pipe_params_st *pipes,
333333 int pipe_cnt,
drivers/gpu/drm/amd/display/dc/dml/dcn301/dcn301_fpu.h+1−1
@@ -34,7 +34,7 @@ void dcn301_fpu_set_wm_ranges(int i, · 33 unmodified lines
3434
3535 void dcn301_fpu_init_soc_bounding_box(struct bp_soc_bb_info bb_info);
3636
37−void dcn301_calculate_wm_and_dlg(struct dc *dc,
37+void dcn301_calculate_wm_and_dlg_fp(struct dc *dc,
3838 struct dc_state *context,
3939 display_e2e_pipe_params_st *pipes,
4040 int pipe_cnt,
drivers/gpu/drm/amd/display/dc/dml/display_mode_structs.h+0−1
@@ -546,7 +546,6 @@ struct _vcs_dpi_display_dlg_sys_params_st { · 545 unmodified lines
546546 double t_sr_wm_us;
547547 double t_extra_us;
548548 double mem_trip_us;
549− double t_srx_delay_us;
550549 double deepsleep_dcfclk_mhz;
551550 double total_flip_bw;
552551 unsigned int total_flip_bytes;
drivers/gpu/drm/amd/display/dc/dml/display_rq_dlg_helpers.c+0−3
@@ -141,9 +141,6 @@ void print__dlg_sys_params_st(struct display_mode_lib *mode_lib, const struct _v · 140 unmodified lines
141141 dml_print("DML_RQ_DLG_CALC: t_urg_wm_us = %3.2f\n", dlg_sys_param->t_urg_wm_us);
142142 dml_print("DML_RQ_DLG_CALC: t_sr_wm_us = %3.2f\n", dlg_sys_param->t_sr_wm_us);
143143 dml_print("DML_RQ_DLG_CALC: t_extra_us = %3.2f\n", dlg_sys_param->t_extra_us);
144− dml_print(
145− "DML_RQ_DLG_CALC: t_srx_delay_us = %3.2f\n",
146− dlg_sys_param->t_srx_delay_us);
147144 dml_print(
148145 "DML_RQ_DLG_CALC: deepsleep_dcfclk_mhz = %3.2f\n",
149146 dlg_sys_param->deepsleep_dcfclk_mhz);
drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.c+0−4
@@ -1331,10 +1331,6 @@ void dml1_rq_dlg_get_dlg_params( · 1330 unmodified lines
13311331 if (dual_plane)
13321332 DTRACE("DLG: %s: swath_height_c = %d", __func__, swath_height_c);
13331333
1334− DTRACE(
1335− "DLG: %s: t_srx_delay_us = %3.2f",
1336− __func__,
1337− (double) dlg_sys_param->t_srx_delay_us);
13381334 DTRACE("DLG: %s: line_time_in_us = %3.2f", __func__, (double) line_time_in_us);
13391335 DTRACE("DLG: %s: vupdate_offset = %d", __func__, vupdate_offset);
13401336 DTRACE("DLG: %s: vupdate_width = %d", __func__, vupdate_width);
drivers/gpu/drm/amd/display/dc/inc/core_types.h+1−0
@@ -382,6 +382,7 @@ struct pipe_ctx { · 381 unmodified lines
382382 struct pll_settings pll_settings;
383383
384384 uint8_t pipe_idx;
385+ uint8_t pipe_idx_syncd;
385386
386387 struct pipe_ctx *top_pipe;
387388 struct pipe_ctx *bottom_pipe;
drivers/gpu/drm/amd/display/dc/inc/resource.h+11−0
@@ -34,6 +34,10 @@ · 33 unmodified lines
3434 #define MEMORY_TYPE_HBM 2
3535
3636
37+#define IS_PIPE_SYNCD_VALID(pipe) ((((pipe)->pipe_idx_syncd) & 0x80)?1:0)
38+#define GET_PIPE_SYNCD_FROM_PIPE(pipe) ((pipe)->pipe_idx_syncd & 0x7F)
39+#define SET_PIPE_SYNCD_TO_PIPE(pipe, pipe_syncd) ((pipe)->pipe_idx_syncd = (0x80 | pipe_syncd))
40+
3741 enum dce_version resource_parse_asic_id(
3842 struct hw_asic_id asic_id);
3943
@@ -208,6 +212,13 @@ struct hpo_dp_link_encoder *resource_get_hpo_dp_link_enc_for_det_lt( · 168 unmodified lines
208212 const struct dc_link *link);
209213 #endif
210214
215+void reset_syncd_pipes_from_disabled_pipes(struct dc *dc,
216+ struct dc_state *context);
217+
218+void check_syncd_pipes_for_disabled_master_pipe(struct dc *dc,
219+ struct dc_state *context,
220+ uint8_t disabled_master_pipe_idx);
221+
211222 uint8_t resource_transmitter_to_phy_idx(const struct dc *dc, enum transmitter transmitter);
212223
213224 #endif /* DRIVERS_GPU_DRM_AMD_DC_DEV_DC_INC_RESOURCE_H_ */
drivers/gpu/drm/ast/ast_tables.h+0−2
@@ -282,8 +282,6 @@ static const struct ast_vbios_enhtable res_1360x768[] = { · 281 unmodified lines
282282 };
283283
284284 static const struct ast_vbios_enhtable res_1600x900[] = {
285− {1800, 1600, 24, 80, 1000, 900, 1, 3, VCLK108, /* 60Hz */
286− (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 3, 0x3A },
287285 {1760, 1600, 48, 32, 926, 900, 3, 5, VCLK97_75, /* 60Hz CVT RB */
288286 (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo |
289287 AST2500PreCatchCRT), 60, 1, 0x3A },
drivers/gpu/drm/drm_atomic.c+8−4
@@ -1327,8 +1327,10 @@ int drm_atomic_check_only(struct drm_atomic_state *state) · 1326 unmodified lines
13271327
13281328 drm_dbg_atomic(dev, "checking %p\n", state);
13291329
1330− for_each_new_crtc_in_state(state, crtc, new_crtc_state, i)
1331− requested_crtc |= drm_crtc_mask(crtc);
1330+ for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
1331+ if (new_crtc_state->enable)
1332+ requested_crtc |= drm_crtc_mask(crtc);
1333+ }
13321334
13331335 for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
13341336 ret = drm_atomic_plane_check(old_plane_state, new_plane_state);
@@ -1377,8 +1379,10 @@ int drm_atomic_check_only(struct drm_atomic_state *state) · 42 unmodified lines
13771379 }
13781380 }
13791381
1380− for_each_new_crtc_in_state(state, crtc, new_crtc_state, i)
1381− affected_crtc |= drm_crtc_mask(crtc);
1382+ for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
1383+ if (new_crtc_state->enable)
1384+ affected_crtc |= drm_crtc_mask(crtc);
1385+ }
13821386
13831387 /*
13841388 * For commits that allow modesets drivers can add other CRTCs to the
drivers/gpu/drm/drm_panel_orientation_quirks.c+12−0
@@ -115,6 +115,12 @@ static const struct drm_dmi_panel_orientation_data lcd1280x1920_rightside_up = { · 114 unmodified lines
115115 .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
116116 };
117117
118+static const struct drm_dmi_panel_orientation_data lcd1600x2560_leftside_up = {
119+ .width = 1600,
120+ .height = 2560,
121+ .orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP,
122+};
123+
118124 static const struct dmi_system_id orientation_data[] = {
119125 { /* Acer One 10 (S1003) */
120126 .matches = {
@@ -275,6 +281,12 @@ static const struct dmi_system_id orientation_data[] = { · 154 unmodified lines
275281 DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Default string"),
276282 },
277283 .driver_data = (void *)&onegx1_pro,
284+ }, { /* OneXPlayer */
285+ .matches = {
286+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ONE-NETBOOK TECHNOLOGY CO., LTD."),
287+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ONE XPLAYER"),
288+ },
289+ .driver_data = (void *)&lcd1600x2560_leftside_up,
278290 }, { /* Samsung GalaxyBook 10.6 */
279291 .matches = {
280292 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
drivers/gpu/drm/drm_privacy_screen_x86.c+3−0
@@ -33,6 +33,9 @@ static bool __init detect_thinkpad_privacy_screen(void) · 32 unmodified lines
3333 unsigned long long output;
3434 acpi_status status;
3535
36+ if (acpi_disabled)
37+ return false;
38+
3639 /* Get embedded-controller handle */
3740 status = acpi_get_devices("PNP0C09", acpi_set_handle, NULL, &ec_handle);
3841 if (ACPI_FAILURE(status) || !ec_handle)
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c+2−2
@@ -469,8 +469,8 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data, · 468 unmodified lines
469469 return -EINVAL;
470470 }
471471
472− if (args->stream_size > SZ_64K || args->nr_relocs > SZ_64K ||
473− args->nr_bos > SZ_64K || args->nr_pmrs > 128) {
472+ if (args->stream_size > SZ_128K || args->nr_relocs > SZ_128K ||
473+ args->nr_bos > SZ_128K || args->nr_pmrs > 128) {
474474 DRM_ERROR("submit arguments out of size limits\n");
475475 return -EINVAL;
476476 }
drivers/gpu/drm/msm/adreno/a6xx_gpu.c+2−0
@@ -1560,6 +1560,8 @@ static int a6xx_pm_suspend(struct msm_gpu *gpu) · 1559 unmodified lines
15601560 for (i = 0; i < gpu->nr_rings; i++)
15611561 a6xx_gpu->shadow[i] = 0;
15621562
1563+ gpu->suspend_count++;
1564+
15631565 return 0;
15641566 }
15651567
drivers/gpu/drm/msm/adreno/adreno_device.c+18−0
@@ -608,9 +608,27 @@ static int adreno_resume(struct device *dev) · 607 unmodified lines
608608 return gpu->funcs->pm_resume(gpu);
609609 }
610610
611+static int active_submits(struct msm_gpu *gpu)
612+{
613+ int active_submits;
614+ mutex_lock(&gpu->active_lock);
615+ active_submits = gpu->active_submits;
616+ mutex_unlock(&gpu->active_lock);
617+ return active_submits;
618+}
619+
611620 static int adreno_suspend(struct device *dev)
612621 {
613622 struct msm_gpu *gpu = dev_to_gpu(dev);
623+ int remaining;
624+
625+ remaining = wait_event_timeout(gpu->retire_event,
626+ active_submits(gpu) == 0,
627+ msecs_to_jiffies(1000));
628+ if (remaining == 0) {
629+ dev_err(dev, "Timeout waiting for GPU to suspend\n");
630+ return -EBUSY;
631+ }
614632
615633 return gpu->funcs->pm_suspend(gpu);
616634 }
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c+9−2
@@ -26,9 +26,16 @@ static void dpu_setup_dspp_pcc(struct dpu_hw_dspp *ctx, · 25 unmodified lines
2626 struct dpu_hw_pcc_cfg *cfg)
2727 {
2828
29− u32 base = ctx->cap->sblk->pcc.base;
29+ u32 base;
3030
31− if (!ctx || !base) {
31+ if (!ctx) {
32+ DRM_ERROR("invalid ctx %pK\n", ctx);
33+ return;
34+ }
35+
36+ base = ctx->cap->sblk->pcc.base;
37+
38+ if (!base) {
3239 DRM_ERROR("invalid ctx %pK pcc base 0x%x\n", ctx, base);
3340 return;
3441 }
drivers/gpu/drm/msm/dsi/dsi.c+6−1
@@ -40,7 +40,12 @@ static int dsi_get_phy(struct msm_dsi *msm_dsi) · 39 unmodified lines
4040
4141 of_node_put(phy_node);
4242
43− if (!phy_pdev || !msm_dsi->phy) {
43+ if (!phy_pdev) {
44+ DRM_DEV_ERROR(&pdev->dev, "%s: phy driver is not ready\n", __func__);
45+ return -EPROBE_DEFER;
46+ }
47+ if (!msm_dsi->phy) {
48+ put_device(&phy_pdev->dev);
4449 DRM_DEV_ERROR(&pdev->dev, "%s: phy driver is not ready\n", __func__);
4550 return -EPROBE_DEFER;
4651 }
drivers/gpu/drm/msm/dsi/phy/dsi_phy.c+3−1
@@ -808,12 +808,14 @@ int msm_dsi_phy_enable(struct msm_dsi_phy *phy, · 807 unmodified lines
808808 struct msm_dsi_phy_clk_request *clk_req,
809809 struct msm_dsi_phy_shared_timings *shared_timings)
810810 {
811− struct device *dev = &phy->pdev->dev;
811+ struct device *dev;
812812 int ret;
813813
814814 if (!phy || !phy->cfg->ops.enable)
815815 return -EINVAL;
816816
817+ dev = &phy->pdev->dev;
818+
817819 ret = dsi_phy_enable_resource(phy);
818820 if (ret) {
819821 DRM_DEV_ERROR(dev, "%s: resource enable failed, %d\n",
drivers/gpu/drm/msm/hdmi/hdmi.c+6−1
@@ -97,10 +97,15 @@ static int msm_hdmi_get_phy(struct hdmi *hdmi) · 96 unmodified lines
9797
9898 of_node_put(phy_node);
9999
100− if (!phy_pdev || !hdmi->phy) {
100+ if (!phy_pdev) {
101101 DRM_DEV_ERROR(&pdev->dev, "phy driver is not ready\n");
102102 return -EPROBE_DEFER;
103103 }
104+ if (!hdmi->phy) {
105+ DRM_DEV_ERROR(&pdev->dev, "phy driver is not ready\n");
106+ put_device(&phy_pdev->dev);
107+ return -EPROBE_DEFER;
108+ }
104109
105110 hdmi->phy_dev = get_device(&phy_pdev->dev);
106111
drivers/gpu/drm/msm/msm_drv.c+1−4
@@ -461,7 +461,7 @@ static int msm_init_vram(struct drm_device *dev) · 460 unmodified lines
461461 of_node_put(node);
462462 if (ret)
463463 return ret;
464− size = r.end - r.start;
464+ size = r.end - r.start + 1;
465465 DRM_INFO("using VRAM carveout: %lx@%pa\n", size, &r.start);
466466
467467 /* if we have no IOMMU, then we need to use carveout allocator.
@@ -510,7 +510,6 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) · 42 unmodified lines
510510 struct msm_drm_private *priv = dev_get_drvdata(dev);
511511 struct drm_device *ddev;
512512 struct msm_kms *kms;
513− struct msm_mdss *mdss;
514513 int ret, i;
515514
516515 ddev = drm_dev_alloc(drv, dev);
@@ -521,8 +520,6 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) · 4 unmodified lines
521520 ddev->dev_private = priv;
522521 priv->dev = ddev;
523522
524− mdss = priv->mdss;
525−
526523 priv->wq = alloc_ordered_workqueue("msm", 0);
527524 priv->hangcheck_period = DRM_MSM_HANGCHECK_DEFAULT_PERIOD;
528525
drivers/gpu/drm/msm/msm_gpu.c+3−0
@@ -703,6 +703,8 @@ static void retire_submits(struct msm_gpu *gpu) · 702 unmodified lines
703703 }
704704 }
705705 }
706+
707+ wake_up_all(&gpu->retire_event);
706708 }
707709
708710 static void retire_worker(struct kthread_work *work)
@@ -848,6 +850,7 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev, · 139 unmodified lines
848850 INIT_LIST_HEAD(&gpu->active_list);
849851 mutex_init(&gpu->active_lock);
850852 mutex_init(&gpu->lock);
853+ init_waitqueue_head(&gpu->retire_event);
851854 kthread_init_work(&gpu->retire_work, retire_worker);
852855 kthread_init_work(&gpu->recover_work, recover_worker);
853856 kthread_init_work(&gpu->fault_work, fault_worker);
drivers/gpu/drm/msm/msm_gpu.h+3−0
@@ -230,6 +230,9 @@ struct msm_gpu { · 229 unmodified lines
230230 /* work for handling GPU recovery: */
231231 struct kthread_work recover_work;
232232
233+ /** retire_event: notified when submits are retired: */
234+ wait_queue_head_t retire_event;
235+
233236 /* work for handling active-list retiring: */
234237 struct kthread_work retire_work;
235238
drivers/gpu/drm/msm/msm_gpu_devfreq.c+19−2
@@ -133,6 +133,18 @@ void msm_devfreq_init(struct msm_gpu *gpu) · 132 unmodified lines
133133 CLOCK_MONOTONIC, HRTIMER_MODE_REL);
134134 }
135135
136+static void cancel_idle_work(struct msm_gpu_devfreq *df)
137+{
138+ hrtimer_cancel(&df->idle_work.timer);
139+ kthread_cancel_work_sync(&df->idle_work.work);
140+}
141+
142+static void cancel_boost_work(struct msm_gpu_devfreq *df)
143+{
144+ hrtimer_cancel(&df->boost_work.timer);
145+ kthread_cancel_work_sync(&df->boost_work.work);
146+}
147+
136148 void msm_devfreq_cleanup(struct msm_gpu *gpu)
137149 {
138150 struct msm_gpu_devfreq *df = &gpu->devfreq;
@@ -152,7 +164,12 @@ void msm_devfreq_resume(struct msm_gpu *gpu) · 13 unmodified lines
152164
153165 void msm_devfreq_suspend(struct msm_gpu *gpu)
154166 {
155− devfreq_suspend_device(gpu->devfreq.devfreq);
167+ struct msm_gpu_devfreq *df = &gpu->devfreq;
168+
169+ devfreq_suspend_device(df->devfreq);
170+
171+ cancel_idle_work(df);
172+ cancel_boost_work(df);
156173 }
157174
158175 static void msm_devfreq_boost_work(struct kthread_work *work)
@@ -196,7 +213,7 @@ void msm_devfreq_active(struct msm_gpu *gpu) · 37 unmodified lines
196213 /*
197214 * Cancel any pending transition to idle frequency:
198215 */
199− hrtimer_cancel(&df->idle_work.timer);
216+ cancel_idle_work(df);
200217
201218 idle_time = ktime_to_ms(ktime_sub(ktime_get(), df->idle_time));
202219
drivers/gpu/drm/vc4/vc4_dsi.c+4−10
@@ -1262,7 +1262,6 @@ static int vc4_dsi_host_attach(struct mipi_dsi_host *host, · 1261 unmodified lines
12621262 struct mipi_dsi_device *device)
12631263 {
12641264 struct vc4_dsi *dsi = host_to_dsi(host);
1265− int ret;
12661265
12671266 dsi->lanes = device->lanes;
12681267 dsi->channel = device->channel;
@@ -1297,18 +1296,15 @@ static int vc4_dsi_host_attach(struct mipi_dsi_host *host, · 28 unmodified lines
12971296 return 0;
12981297 }
12991298
1300− ret = component_add(&dsi->pdev->dev, &vc4_dsi_ops);
1301− if (ret) {
1302− mipi_dsi_host_unregister(&dsi->dsi_host);
1303− return ret;
1304− }
1305−
1306− return 0;
1299+ return component_add(&dsi->pdev->dev, &vc4_dsi_ops);
13071300 }
13081301
13091302 static int vc4_dsi_host_detach(struct mipi_dsi_host *host,
13101303 struct mipi_dsi_device *device)
13111304 {
1305+ struct vc4_dsi *dsi = host_to_dsi(host);
1306+
1307+ component_del(&dsi->pdev->dev, &vc4_dsi_ops);
13121308 return 0;
13131309 }
13141310
@@ -1686,9 +1682,7 @@ static int vc4_dsi_dev_remove(struct platform_device *pdev) · 371 unmodified lines
16861682 struct device *dev = &pdev->dev;
16871683 struct vc4_dsi *dsi = dev_get_drvdata(dev);
16881684
1689− component_del(&pdev->dev, &vc4_dsi_ops);
16901685 mipi_dsi_host_unregister(&dsi->dsi_host);
1691−
16921686 return 0;
16931687 }
16941688
drivers/hv/hv_balloon.c+7−0
@@ -1660,6 +1660,13 @@ static int balloon_connect_vsp(struct hv_device *dev) · 1659 unmodified lines
16601660 unsigned long t;
16611661 int ret;
16621662
1663+ /*
1664+ * max_pkt_size should be large enough for one vmbus packet header plus
1665+ * our receive buffer size. Hyper-V sends messages up to
1666+ * HV_HYP_PAGE_SIZE bytes long on balloon channel.
1667+ */
1668+ dev->channel->max_pkt_size = HV_HYP_PAGE_SIZE * 2;
1669+
16631670 ret = vmbus_open(dev->channel, dm_ring_size, dm_ring_size, NULL, 0,
16641671 balloon_onchannelcallback, dev);
16651672 if (ret)
drivers/hwmon/adt7470.c+3−0
@@ -662,6 +662,9 @@ static int adt7470_fan_write(struct device *dev, u32 attr, int channel, long val · 661 unmodified lines
662662 struct adt7470_data *data = dev_get_drvdata(dev);
663663 int err;
664664
665+ if (val <= 0)
666+ return -EINVAL;
667+
665668 val = FAN_RPM_TO_PERIOD(val);
666669 val = clamp_val(val, 1, 65534);
667670
drivers/hwmon/lm90.c+11−10
@@ -373,7 +373,7 @@ static const struct lm90_params lm90_params[] = { · 372 unmodified lines
373373 .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
374374 | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_CRIT,
375375 .alert_alarms = 0x7c,
376− .max_convrate = 8,
376+ .max_convrate = 7,
377377 },
378378 [lm86] = {
379379 .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
@@ -394,12 +394,13 @@ static const struct lm90_params lm90_params[] = { · 14 unmodified lines
394394 .max_convrate = 9,
395395 },
396396 [max6646] = {
397− .flags = LM90_HAVE_CRIT,
397+ .flags = LM90_HAVE_CRIT | LM90_HAVE_BROKEN_ALERT,
398398 .alert_alarms = 0x7c,
399399 .max_convrate = 6,
400400 .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL,
401401 },
402402 [max6654] = {
403+ .flags = LM90_HAVE_BROKEN_ALERT,
403404 .alert_alarms = 0x7c,
404405 .max_convrate = 7,
405406 .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL,
@@ -418,7 +419,7 @@ static const struct lm90_params lm90_params[] = { · 12 unmodified lines
418419 },
419420 [max6680] = {
420421 .flags = LM90_HAVE_OFFSET | LM90_HAVE_CRIT
421− | LM90_HAVE_CRIT_ALRM_SWP,
422+ | LM90_HAVE_CRIT_ALRM_SWP | LM90_HAVE_BROKEN_ALERT,
422423 .alert_alarms = 0x7c,
423424 .max_convrate = 7,
424425 },
@@ -848,7 +849,7 @@ static int lm90_update_device(struct device *dev) · 423 unmodified lines
848849 * Re-enable ALERT# output if it was originally enabled and
849850 * relevant alarms are all clear
850851 */
851− if (!(data->config_orig & 0x80) &&
852+ if ((client->irq || !(data->config_orig & 0x80)) &&
852853 !(data->alarms & data->alert_alarms)) {
853854 if (data->config & 0x80) {
854855 dev_dbg(&client->dev, "Re-enabling ALERT#\n");
@@ -1807,22 +1808,22 @@ static bool lm90_is_tripped(struct i2c_client *client, u16 *status) · 952 unmodified lines
18071808
18081809 if (st & LM90_STATUS_LLOW)
18091810 hwmon_notify_event(data->hwmon_dev, hwmon_temp,
1810− hwmon_temp_min, 0);
1811+ hwmon_temp_min_alarm, 0);
18111812 if (st & LM90_STATUS_RLOW)
18121813 hwmon_notify_event(data->hwmon_dev, hwmon_temp,
1813− hwmon_temp_min, 1);
1814+ hwmon_temp_min_alarm, 1);
18141815 if (st2 & MAX6696_STATUS2_R2LOW)
18151816 hwmon_notify_event(data->hwmon_dev, hwmon_temp,
1816− hwmon_temp_min, 2);
1817+ hwmon_temp_min_alarm, 2);
18171818 if (st & LM90_STATUS_LHIGH)
18181819 hwmon_notify_event(data->hwmon_dev, hwmon_temp,
1819− hwmon_temp_max, 0);
1820+ hwmon_temp_max_alarm, 0);
18201821 if (st & LM90_STATUS_RHIGH)
18211822 hwmon_notify_event(data->hwmon_dev, hwmon_temp,
1822− hwmon_temp_max, 1);
1823+ hwmon_temp_max_alarm, 1);
18231824 if (st2 & MAX6696_STATUS2_R2HIGH)
18241825 hwmon_notify_event(data->hwmon_dev, hwmon_temp,
1825− hwmon_temp_max, 2);
1826+ hwmon_temp_max_alarm, 2);
18261827
18271828 return true;
18281829 }
drivers/hwmon/nct6775.c+3−3
@@ -1175,7 +1175,7 @@ static inline u8 in_to_reg(u32 val, u8 nr) · 1174 unmodified lines
11751175
11761176 struct nct6775_data {
11771177 int addr; /* IO base of hw monitor block */
1178− int sioreg; /* SIO register address */
1178+ struct nct6775_sio_data *sio_data;
11791179 enum kinds kind;
11801180 const char *name;
11811181
@@ -3559,7 +3559,7 @@ clear_caseopen(struct device *dev, struct device_attribute *attr, · 2377 unmodified lines
35593559 const char *buf, size_t count)
35603560 {
35613561 struct nct6775_data *data = dev_get_drvdata(dev);
3562− struct nct6775_sio_data *sio_data = dev_get_platdata(dev);
3562+ struct nct6775_sio_data *sio_data = data->sio_data;
35633563 int nr = to_sensor_dev_attr(attr)->index - INTRUSION_ALARM_BASE;
35643564 unsigned long val;
35653565 u8 reg;
@@ -3967,7 +3967,7 @@ static int nct6775_probe(struct platform_device *pdev) · 401 unmodified lines
39673967 return -ENOMEM;
39683968
39693969 data->kind = sio_data->kind;
3970− data->sioreg = sio_data->sioreg;
3970+ data->sio_data = sio_data;
39713971
39723972 if (sio_data->access == access_direct) {
39733973 data->addr = res->start;
drivers/hwmon/pmbus/ir38064.c+1−1
@@ -62,7 +62,7 @@ static const struct i2c_device_id ir38064_id[] = { · 61 unmodified lines
6262
6363 MODULE_DEVICE_TABLE(i2c, ir38064_id);
6464
65−static const struct of_device_id ir38064_of_match[] = {
65+static const struct of_device_id __maybe_unused ir38064_of_match[] = {
6666 { .compatible = "infineon,ir38060" },
6767 { .compatible = "infineon,ir38064" },
6868 { .compatible = "infineon,ir38164" },
drivers/irqchip/irq-apple-aic.c+0−1
@@ -178,7 +178,6 @@ struct aic_irq_chip { · 177 unmodified lines
178178 struct irq_domain *hw_domain;
179179 struct irq_domain *ipi_domain;
180180 int nr_hw;
181− int ipi_hwirq;
182181 };
183182
184183 static DEFINE_PER_CPU(uint32_t, aic_fiq_unmasked);
drivers/irqchip/irq-gic-v3-its.c+101−22
@@ -4856,6 +4856,38 @@ static struct syscore_ops its_syscore_ops = { · 4855 unmodified lines
48564856 .resume = its_restore_enable,
48574857 };
48584858
4859+static void __init __iomem *its_map_one(struct resource *res, int *err)
4860+{
4861+ void __iomem *its_base;
4862+ u32 val;
4863+
4864+ its_base = ioremap(res->start, SZ_64K);
4865+ if (!its_base) {
4866+ pr_warn("ITS@%pa: Unable to map ITS registers\n", &res->start);
4867+ *err = -ENOMEM;
4868+ return NULL;
4869+ }
4870+
4871+ val = readl_relaxed(its_base + GITS_PIDR2) & GIC_PIDR2_ARCH_MASK;
4872+ if (val != 0x30 && val != 0x40) {
4873+ pr_warn("ITS@%pa: No ITS detected, giving up\n", &res->start);
4874+ *err = -ENODEV;
4875+ goto out_unmap;
4876+ }
4877+
4878+ *err = its_force_quiescent(its_base);
4879+ if (*err) {
4880+ pr_warn("ITS@%pa: Failed to quiesce, giving up\n", &res->start);
4881+ goto out_unmap;
4882+ }
4883+
4884+ return its_base;
4885+
4886+out_unmap:
4887+ iounmap(its_base);
4888+ return NULL;
4889+}
4890+
48594891 static int its_init_domain(struct fwnode_handle *handle, struct its_node *its)
48604892 {
48614893 struct irq_domain *inner_domain;
@@ -4963,29 +4995,14 @@ static int __init its_probe_one(struct resource *res, · 101 unmodified lines
49634995 {
49644996 struct its_node *its;
49654997 void __iomem *its_base;
4966− u32 val, ctlr;
49674998 u64 baser, tmp, typer;
49684999 struct page *page;
5000+ u32 ctlr;
49695001 int err;
49705002
4971− its_base = ioremap(res->start, SZ_64K);
4972− if (!its_base) {
4973− pr_warn("ITS@%pa: Unable to map ITS registers\n", &res->start);
4974− return -ENOMEM;
4975− }
4976−
4977− val = readl_relaxed(its_base + GITS_PIDR2) & GIC_PIDR2_ARCH_MASK;
4978− if (val != 0x30 && val != 0x40) {
4979− pr_warn("ITS@%pa: No ITS detected, giving up\n", &res->start);
4980− err = -ENODEV;
4981− goto out_unmap;
4982− }
4983−
4984− err = its_force_quiescent(its_base);
4985− if (err) {
4986− pr_warn("ITS@%pa: Failed to quiesce, giving up\n", &res->start);
4987− goto out_unmap;
4988− }
5003+ its_base = its_map_one(res, &err);
5004+ if (!its_base)
5005+ return err;
49895006
49905007 pr_info("ITS %pR\n", res);
49915008
@@ -5241,13 +5258,31 @@ static int its_cpu_memreserve_lpi(unsigned int cpu) · 249 unmodified lines
52415258
52425259 out:
52435260 /* Last CPU being brought up gets to issue the cleanup */
5244− if (cpumask_equal(&cpus_booted_once_mask, cpu_possible_mask))
5261+ if (!IS_ENABLED(CONFIG_SMP) ||
5262+ cpumask_equal(&cpus_booted_once_mask, cpu_possible_mask))
52455263 schedule_work(&rdist_memreserve_cpuhp_cleanup_work);
52465264
52475265 gic_data_rdist()->flags |= RD_LOCAL_MEMRESERVE_DONE;
52485266 return ret;
52495267 }
52505268
5269+/* Mark all the BASER registers as invalid before they get reprogrammed */
5270+static int __init its_reset_one(struct resource *res)
5271+{
5272+ void __iomem *its_base;
5273+ int err, i;
5274+
5275+ its_base = its_map_one(res, &err);
5276+ if (!its_base)
5277+ return err;
5278+
5279+ for (i = 0; i < GITS_BASER_NR_REGS; i++)
5280+ gits_write_baser(0, its_base + GITS_BASER + (i << 3));
5281+
5282+ iounmap(its_base);
5283+ return 0;
5284+}
5285+
52515286 static const struct of_device_id its_device_id[] = {
52525287 { .compatible = "arm,gic-v3-its", },
52535288 {},
@@ -5258,6 +5293,26 @@ static int __init its_of_probe(struct device_node *node) · 4 unmodified lines
52585293 struct device_node *np;
52595294 struct resource res;
52605295
5296+ /*
5297+ * Make sure *all* the ITS are reset before we probe any, as
5298+ * they may be sharing memory. If any of the ITS fails to
5299+ * reset, don't even try to go any further, as this could
5300+ * result in something even worse.
5301+ */
5302+ for (np = of_find_matching_node(node, its_device_id); np;
5303+ np = of_find_matching_node(np, its_device_id)) {
5304+ int err;
5305+
5306+ if (!of_device_is_available(np) ||
5307+ !of_property_read_bool(np, "msi-controller") ||
5308+ of_address_to_resource(np, 0, &res))
5309+ continue;
5310+
5311+ err = its_reset_one(&res);
5312+ if (err)
5313+ return err;
5314+ }
5315+
52615316 for (np = of_find_matching_node(node, its_device_id); np;
52625317 np = of_find_matching_node(np, its_device_id)) {
52635318 if (!of_device_is_available(np))
@@ -5420,11 +5475,35 @@ dom_err: · 156 unmodified lines
54205475 return err;
54215476 }
54225477
5478+static int __init its_acpi_reset(union acpi_subtable_headers *header,
5479+ const unsigned long end)
5480+{
5481+ struct acpi_madt_generic_translator *its_entry;
5482+ struct resource res;
5483+
5484+ its_entry = (struct acpi_madt_generic_translator *)header;
5485+ res = (struct resource) {
5486+ .start = its_entry->base_address,
5487+ .end = its_entry->base_address + ACPI_GICV3_ITS_MEM_SIZE - 1,
5488+ .flags = IORESOURCE_MEM,
5489+ };
5490+
5491+ return its_reset_one(&res);
5492+}
5493+
54235494 static void __init its_acpi_probe(void)
54245495 {
54255496 acpi_table_parse_srat_its();
5426− acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR,
5427− gic_acpi_parse_madt_its, 0);
5497+ /*
5498+ * Make sure *all* the ITS are reset before we probe any, as
5499+ * they may be sharing memory. If any of the ITS fails to
5500+ * reset, don't even try to go any further, as this could
5501+ * result in something even worse.
5502+ */
5503+ if (acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR,
5504+ its_acpi_reset, 0) > 0)
5505+ acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR,
5506+ gic_acpi_parse_madt_its, 0);
54285507 acpi_its_srat_maps_free();
54295508 }
54305509 #else
drivers/irqchip/irq-loongson-pch-msi.c+1−1
@@ -241,7 +241,7 @@ static int pch_msi_init(struct device_node *node, · 240 unmodified lines
241241 return 0;
242242
243243 err_map:
244− kfree(priv->msi_map);
244+ bitmap_free(priv->msi_map);
245245 err_priv:
246246 kfree(priv);
247247 return ret;
drivers/irqchip/irq-realtek-rtl.c+12−6
@@ -62,7 +62,7 @@ static struct irq_chip realtek_ictl_irq = { · 61 unmodified lines
6262
6363 static int intc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)
6464 {
65− irq_set_chip_and_handler(hw, &realtek_ictl_irq, handle_level_irq);
65+ irq_set_chip_and_handler(irq, &realtek_ictl_irq, handle_level_irq);
6666
6767 return 0;
6868 }
@@ -76,16 +76,20 @@ static void realtek_irq_dispatch(struct irq_desc *desc) · 7 unmodified lines
7676 {
7777 struct irq_chip *chip = irq_desc_get_chip(desc);
7878 struct irq_domain *domain;
79− unsigned int pending;
79+ unsigned long pending;
80+ unsigned int soc_int;
8081
8182 chained_irq_enter(chip, desc);
8283 pending = readl(REG(RTL_ICTL_GIMR)) & readl(REG(RTL_ICTL_GISR));
84+
8385 if (unlikely(!pending)) {
8486 spurious_interrupt();
8587 goto out;
8688 }
89+
8790 domain = irq_desc_get_handler_data(desc);
88− generic_handle_domain_irq(domain, __ffs(pending));
91+ for_each_set_bit(soc_int, &pending, 32)
92+ generic_handle_domain_irq(domain, soc_int);
8993
9094 out:
9195 chained_irq_exit(chip, desc);
@@ -95,7 +99,8 @@ out: · 3 unmodified lines
9599 * SoC interrupts are cascaded to MIPS CPU interrupts according to the
96100 * interrupt-map in the device tree. Each SoC interrupt gets 4 bits for
97101 * the CPU interrupt in an Interrupt Routing Register. Max 32 SoC interrupts
98− * thus go into 4 IRRs.
102+ * thus go into 4 IRRs. A routing value of '0' means the interrupt is left
103+ * disconnected. Routing values {1..15} connect to output lines {0..14}.
99104 */
100105 static int __init map_interrupts(struct device_node *node, struct irq_domain *domain)
101106 {
@@ -134,7 +139,7 @@ static int __init map_interrupts(struct device_node *node, struct irq_domain *do · 32 unmodified lines
134139 of_node_put(cpu_ictl);
135140
136141 cpu_int = be32_to_cpup(imap + 2);
137− if (cpu_int > 7)
142+ if (cpu_int > 7 || cpu_int < 2)
138143 return -EINVAL;
139144
140145 if (!(mips_irqs_set & BIT(cpu_int))) {
@@ -143,7 +148,8 @@ static int __init map_interrupts(struct device_node *node, struct irq_domain *do · 2 unmodified lines
143148 mips_irqs_set |= BIT(cpu_int);
144149 }
145150
146− regs[(soc_int * 4) / 32] |= cpu_int << (soc_int * 4) % 32;
151+ /* Use routing values (1..6) for CPU interrupts (2..7) */
152+ regs[(soc_int * 4) / 32] |= (cpu_int - 1) << (soc_int * 4) % 32;
147153 imap += 3;
148154 }
149155
drivers/md/dm.c+3−17
@@ -489,7 +489,7 @@ static void start_io_acct(struct dm_io *io) · 488 unmodified lines
489489 struct mapped_device *md = io->md;
490490 struct bio *bio = io->orig_bio;
491491
492− io->start_time = bio_start_io_acct(bio);
492+ bio_start_io_acct_time(bio, io->start_time);
493493 if (unlikely(dm_stats_used(&md->stats)))
494494 dm_stats_account_io(&md->stats, bio_data_dir(bio),
495495 bio->bi_iter.bi_sector, bio_sectors(bio),
@@ -535,7 +535,7 @@ static struct dm_io *alloc_io(struct mapped_device *md, struct bio *bio) · 39 unmodified lines
535535 io->md = md;
536536 spin_lock_init(&io->endio_lock);
537537
538− start_io_acct(io);
538+ io->start_time = jiffies;
539539
540540 return io;
541541 }
@@ -1442,9 +1442,6 @@ static void init_clone_info(struct clone_info *ci, struct mapped_device *md, · 900 unmodified lines
14421442 ci->sector = bio->bi_iter.bi_sector;
14431443 }
14441444
1445−#define __dm_part_stat_sub(part, field, subnd) \
1446− (part_stat_get(part, field) -= (subnd))
1447−
14481445 /*
14491446 * Entry point to split a bio into clones and submit them to the targets.
14501447 */
@@ -1480,23 +1477,12 @@ static void __split_and_process_bio(struct mapped_device *md, · 29 unmodified lines
14801477 GFP_NOIO, &md->queue->bio_split);
14811478 ci.io->orig_bio = b;
14821479
1483− /*
1484− * Adjust IO stats for each split, otherwise upon queue
1485− * reentry there will be redundant IO accounting.
1486− * NOTE: this is a stop-gap fix, a proper fix involves
1487− * significant refactoring of DM core's bio splitting
1488− * (by eliminating DM's splitting and just using bio_split)
1489− */
1490− part_stat_lock();
1491− __dm_part_stat_sub(dm_disk(md)->part0,
1492− sectors[op_stat_group(bio_op(bio))], ci.sector_count);
1493− part_stat_unlock();
1494−
14951480 bio_chain(b, bio);
14961481 trace_block_split(b, bio->bi_iter.bi_sector);
14971482 submit_bio_noacct(bio);
14981483 }
14991484 }
1485+ start_io_acct(ci.io);
15001486
15011487 /* drop the extra reference count */
15021488 dm_io_dec_pending(ci.io, errno_to_blk_status(error));
drivers/misc/eeprom/at25.c+4−0
@@ -440,6 +440,10 @@ static int at25_probe(struct spi_device *spi) · 439 unmodified lines
440440 return -ENXIO;
441441 }
442442
443+ at25 = devm_kzalloc(&spi->dev, sizeof(*at25), GFP_KERNEL);
444+ if (!at25)
445+ return -ENOMEM;
446+
443447 mutex_init(&at25->lock);
444448 at25->spi = spi;
445449 spi_set_drvdata(spi, at25);
drivers/net/dsa/Kconfig+1−0
@@ -36,6 +36,7 @@ config NET_DSA_LANTIQ_GSWIP · 35 unmodified lines
3636 config NET_DSA_MT7530
3737 tristate "MediaTek MT753x and MT7621 Ethernet switch support"
3838 select NET_DSA_TAG_MTK
39+ select MEDIATEK_GE_PHY
3940 help
4041 This enables support for the MediaTek MT7530, MT7531, and MT7621
4142 Ethernet switch chips.
drivers/net/ethernet/amd/xgbe/xgbe-drv.c+13−1
@@ -721,7 +721,9 @@ static void xgbe_stop_timers(struct xgbe_prv_data *pdata) · 720 unmodified lines
721721 if (!channel->tx_ring)
722722 break;
723723
724+ /* Deactivate the Tx timer */
724725 del_timer_sync(&channel->tx_timer);
726+ channel->tx_timer_active = 0;
725727 }
726728 }
727729
@@ -2550,6 +2552,14 @@ read_again: · 1822 unmodified lines
25502552 buf2_len = xgbe_rx_buf2_len(rdata, packet, len);
25512553 len += buf2_len;
25522554
2555+ if (buf2_len > rdata->rx.buf.dma_len) {
2556+ /* Hardware inconsistency within the descriptors
2557+ * that has resulted in a length underflow.
2558+ */
2559+ error = 1;
2560+ goto skip_data;
2561+ }
2562+
25532563 if (!skb) {
25542564 skb = xgbe_create_skb(pdata, napi, rdata,
25552565 buf1_len);
@@ -2579,8 +2589,10 @@ skip_data: · 23 unmodified lines
25792589 if (!last || context_next)
25802590 goto read_again;
25812591
2582− if (!skb)
2592+ if (!skb || error) {
2593+ dev_kfree_skb(skb);
25832594 goto next_packet;
2595+ }
25842596
25852597 /* Be sure we don't exceed the configured MTU */
25862598 max_len = netdev->mtu + ETH_HLEN;
drivers/net/ethernet/google/gve/gve_adminq.c+1−1
@@ -301,7 +301,7 @@ static int gve_adminq_parse_err(struct gve_priv *priv, u32 status) · 300 unmodified lines
301301 */
302302 static int gve_adminq_kick_and_wait(struct gve_priv *priv)
303303 {
304− u32 tail, head;
304+ int tail, head;
305305 int i;
306306
307307 tail = ioread32be(&priv->reg_bar0->adminq_event_counter);
drivers/net/ethernet/intel/e1000e/e1000.h+3−1
@@ -115,7 +115,8 @@ enum e1000_boards { · 114 unmodified lines
115115 board_pch_lpt,
116116 board_pch_spt,
117117 board_pch_cnp,
118− board_pch_tgp
118+ board_pch_tgp,
119+ board_pch_adp
119120 };
120121
121122 struct e1000_ps_page {
@@ -502,6 +503,7 @@ extern const struct e1000_info e1000_pch_lpt_info; · 380 unmodified lines
502503 extern const struct e1000_info e1000_pch_spt_info;
503504 extern const struct e1000_info e1000_pch_cnp_info;
504505 extern const struct e1000_info e1000_pch_tgp_info;
506+extern const struct e1000_info e1000_pch_adp_info;
505507 extern const struct e1000_info e1000_es2_info;
506508
507509 void e1000e_ptp_init(struct e1000_adapter *adapter);
drivers/net/ethernet/intel/e1000e/ich8lan.c+20−0
@@ -6021,3 +6021,23 @@ const struct e1000_info e1000_pch_tgp_info = { · 6020 unmodified lines
60216021 .phy_ops = &ich8_phy_ops,
60226022 .nvm_ops = &spt_nvm_ops,
60236023 };
6024+
6025+const struct e1000_info e1000_pch_adp_info = {
6026+ .mac = e1000_pch_adp,
6027+ .flags = FLAG_IS_ICH
6028+ | FLAG_HAS_WOL
6029+ | FLAG_HAS_HW_TIMESTAMP
6030+ | FLAG_HAS_CTRLEXT_ON_LOAD
6031+ | FLAG_HAS_AMT
6032+ | FLAG_HAS_FLASH
6033+ | FLAG_HAS_JUMBO_FRAMES
6034+ | FLAG_APME_IN_WUC,
6035+ .flags2 = FLAG2_HAS_PHY_STATS
6036+ | FLAG2_HAS_EEE,
6037+ .pba = 26,
6038+ .max_hw_frame_size = 9022,
6039+ .get_variants = e1000_get_variants_ich8lan,
6040+ .mac_ops = &ich8_mac_ops,
6041+ .phy_ops = &ich8_phy_ops,
6042+ .nvm_ops = &spt_nvm_ops,
6043+};
drivers/net/ethernet/intel/e1000e/netdev.c+21−18
@@ -52,6 +52,7 @@ static const struct e1000_info *e1000_info_tbl[] = { · 51 unmodified lines
5252 [board_pch_spt] = &e1000_pch_spt_info,
5353 [board_pch_cnp] = &e1000_pch_cnp_info,
5454 [board_pch_tgp] = &e1000_pch_tgp_info,
55+ [board_pch_adp] = &e1000_pch_adp_info,
5556 };
5657
5758 struct e1000_reg_info {
@@ -6341,7 +6342,8 @@ static void e1000e_s0ix_entry_flow(struct e1000_adapter *adapter) · 6283 unmodified lines
63416342 u32 mac_data;
63426343 u16 phy_data;
63436344
6344− if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID) {
6345+ if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID &&
6346+ hw->mac.type >= e1000_pch_adp) {
63456347 /* Request ME configure the device for S0ix */
63466348 mac_data = er32(H2ME);
63476349 mac_data |= E1000_H2ME_START_DPG;
@@ -6490,7 +6492,8 @@ static void e1000e_s0ix_exit_flow(struct e1000_adapter *adapter) · 142 unmodified lines
64906492 u16 phy_data;
64916493 u32 i = 0;
64926494
6493− if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID) {
6495+ if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID &&
6496+ hw->mac.type >= e1000_pch_adp) {
64946497 /* Request ME unconfigure the device from S0ix */
64956498 mac_data = er32(H2ME);
64966499 mac_data &= ~E1000_H2ME_START_DPG;
@@ -7890,22 +7893,22 @@ static const struct pci_device_id e1000_pci_tbl[] = { · 1393 unmodified lines
78907893 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V14), board_pch_tgp },
78917894 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_LM15), board_pch_tgp },
78927895 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V15), board_pch_tgp },
7893− { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM23), board_pch_tgp },
7894− { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V23), board_pch_tgp },
7895− { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM16), board_pch_tgp },
7896− { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V16), board_pch_tgp },
7897− { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM17), board_pch_tgp },
7898− { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V17), board_pch_tgp },
7899− { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM22), board_pch_tgp },
7900− { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V22), board_pch_tgp },
7901− { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM18), board_pch_tgp },
7902− { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V18), board_pch_tgp },
7903− { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM19), board_pch_tgp },
7904− { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V19), board_pch_tgp },
7905− { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM20), board_pch_tgp },
7906− { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V20), board_pch_tgp },
7907− { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM21), board_pch_tgp },
7908− { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V21), board_pch_tgp },
7896+ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM23), board_pch_adp },
7897+ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V23), board_pch_adp },
7898+ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM16), board_pch_adp },
7899+ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V16), board_pch_adp },
7900+ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM17), board_pch_adp },
7901+ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V17), board_pch_adp },
7902+ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM22), board_pch_adp },
7903+ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V22), board_pch_adp },
7904+ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM18), board_pch_adp },
7905+ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V18), board_pch_adp },
7906+ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM19), board_pch_adp },
7907+ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V19), board_pch_adp },
7908+ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM20), board_pch_adp },
7909+ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V20), board_pch_adp },
7910+ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM21), board_pch_adp },
7911+ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V21), board_pch_adp },
79097912
79107913 { 0, 0, 0, 0, 0, 0, 0 } /* terminate list */
79117914 };
drivers/net/ethernet/intel/i40e/i40e.h+1−0
@@ -144,6 +144,7 @@ enum i40e_state_t { · 143 unmodified lines
144144 __I40E_VIRTCHNL_OP_PENDING,
145145 __I40E_RECOVERY_MODE,
146146 __I40E_VF_RESETS_DISABLED, /* disable resets during i40e_remove */
147+ __I40E_IN_REMOVE,
147148 __I40E_VFS_RELEASING,
148149 /* This must be last as it determines the size of the BITMAP */
149150 __I40E_STATE_SIZE__,
drivers/net/ethernet/intel/i40e/i40e_main.c+29−2
@@ -5372,7 +5372,15 @@ static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc, · 5371 unmodified lines
53725372 /* There is no need to reset BW when mqprio mode is on. */
53735373 if (pf->flags & I40E_FLAG_TC_MQPRIO)
53745374 return 0;
5375− if (!vsi->mqprio_qopt.qopt.hw && !(pf->flags & I40E_FLAG_DCB_ENABLED)) {
5375+
5376+ if (!vsi->mqprio_qopt.qopt.hw) {
5377+ if (pf->flags & I40E_FLAG_DCB_ENABLED)
5378+ goto skip_reset;
5379+
5380+ if (IS_ENABLED(CONFIG_I40E_DCB) &&
5381+ i40e_dcb_hw_get_num_tc(&pf->hw) == 1)
5382+ goto skip_reset;
5383+
53765384 ret = i40e_set_bw_limit(vsi, vsi->seid, 0);
53775385 if (ret)
53785386 dev_info(&pf->pdev->dev,
@@ -5380,6 +5388,8 @@ static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc, · 1 unmodified line
53805388 vsi->seid);
53815389 return ret;
53825390 }
5391+
5392+skip_reset:
53835393 memset(&bw_data, 0, sizeof(bw_data));
53845394 bw_data.tc_valid_bits = enabled_tc;
53855395 for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++)
@@ -10853,6 +10863,9 @@ static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit, · 5467 unmodified lines
1085310863 bool lock_acquired)
1085410864 {
1085510865 int ret;
10866+
10867+ if (test_bit(__I40E_IN_REMOVE, pf->state))
10868+ return;
1085610869 /* Now we wait for GRST to settle out.
1085710870 * We don't have to delete the VEBs or VSIs from the hw switch
1085810871 * because the reset will make them disappear.
@@ -12212,6 +12225,8 @@ int i40e_reconfig_rss_queues(struct i40e_pf *pf, int queue_count) · 1353 unmodified lines
1221212225
1221312226 vsi->req_queue_pairs = queue_count;
1221412227 i40e_prep_for_reset(pf);
12228+ if (test_bit(__I40E_IN_REMOVE, pf->state))
12229+ return pf->alloc_rss_size;
1221512230
1221612231 pf->alloc_rss_size = new_rss_size;
1221712232
@@ -13038,6 +13053,10 @@ static int i40e_xdp_setup(struct i40e_vsi *vsi, struct bpf_prog *prog, · 820 unmodified lines
1303813053 if (need_reset)
1303913054 i40e_prep_for_reset(pf);
1304013055
13056+ /* VSI shall be deleted in a moment, just return EINVAL */
13057+ if (test_bit(__I40E_IN_REMOVE, pf->state))
13058+ return -EINVAL;
13059+
1304113060 old_prog = xchg(&vsi->xdp_prog, prog);
1304213061
1304313062 if (need_reset) {
@@ -15925,8 +15944,13 @@ static void i40e_remove(struct pci_dev *pdev) · 2881 unmodified lines
1592515944 i40e_write_rx_ctl(hw, I40E_PFQF_HENA(0), 0);
1592615945 i40e_write_rx_ctl(hw, I40E_PFQF_HENA(1), 0);
1592715946
15928− while (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state))
15947+ /* Grab __I40E_RESET_RECOVERY_PENDING and set __I40E_IN_REMOVE
15948+ * flags, once they are set, i40e_rebuild should not be called as
15949+ * i40e_prep_for_reset always returns early.
15950+ */
15951+ while (test_and_set_bit(__I40E_RESET_RECOVERY_PENDING, pf->state))
1592915952 usleep_range(1000, 2000);
15953+ set_bit(__I40E_IN_REMOVE, pf->state);
1593015954
1593115955 if (pf->flags & I40E_FLAG_SRIOV_ENABLED) {
1593215956 set_bit(__I40E_VF_RESETS_DISABLED, pf->state);
@@ -16125,6 +16149,9 @@ static void i40e_pci_error_reset_done(struct pci_dev *pdev) · 192 unmodified lines
1612516149 {
1612616150 struct i40e_pf *pf = pci_get_drvdata(pdev);
1612716151
16152+ if (test_bit(__I40E_IN_REMOVE, pf->state))
16153+ return;
16154+
1612816155 i40e_reset_and_rebuild(pf, false, false);
1612916156 }
1613016157
drivers/net/ethernet/mellanox/mlx5/core/en.h+3−3
@@ -224,7 +224,7 @@ static inline int mlx5e_get_max_num_channels(struct mlx5_core_dev *mdev) · 223 unmodified lines
224224 struct mlx5e_tx_wqe {
225225 struct mlx5_wqe_ctrl_seg ctrl;
226226 struct mlx5_wqe_eth_seg eth;
227− struct mlx5_wqe_data_seg data[0];
227+ struct mlx5_wqe_data_seg data[];
228228 };
229229
230230 struct mlx5e_rx_wqe_ll {
@@ -241,8 +241,8 @@ struct mlx5e_umr_wqe { · 10 unmodified lines
241241 struct mlx5_wqe_umr_ctrl_seg uctrl;
242242 struct mlx5_mkey_seg mkc;
243243 union {
244− struct mlx5_mtt inline_mtts[0];
245− struct mlx5_klm inline_klms[0];
244+ DECLARE_FLEX_ARRAY(struct mlx5_mtt, inline_mtts);
245+ DECLARE_FLEX_ARRAY(struct mlx5_klm, inline_klms);
246246 };
247247 };
248248
drivers/net/ethernet/mellanox/mlx5/core/en/qos.c+2−1
@@ -570,7 +570,8 @@ static int mlx5e_htb_convert_rate(struct mlx5e_priv *priv, u64 rate, · 569 unmodified lines
570570
571571 static void mlx5e_htb_convert_ceil(struct mlx5e_priv *priv, u64 ceil, u32 *max_average_bw)
572572 {
573− *max_average_bw = div_u64(ceil, BYTES_IN_MBIT);
573+ /* Hardware treats 0 as "unlimited", set at least 1. */
574+ *max_average_bw = max_t(u32, div_u64(ceil, BYTES_IN_MBIT), 1);
574575
575576 qos_dbg(priv->mdev, "Convert: ceil %llu -> max_average_bw %u\n",
576577 ceil, *max_average_bw);
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c+14−18
@@ -183,18 +183,7 @@ void mlx5e_rep_bond_unslave(struct mlx5_eswitch *esw, · 182 unmodified lines
183183
184184 static bool mlx5e_rep_is_lag_netdev(struct net_device *netdev)
185185 {
186− struct mlx5e_rep_priv *rpriv;
187− struct mlx5e_priv *priv;
188−
189− /* A given netdev is not a representor or not a slave of LAG configuration */
190− if (!mlx5e_eswitch_rep(netdev) || !netif_is_lag_port(netdev))
191− return false;
192−
193− priv = netdev_priv(netdev);
194− rpriv = priv->ppriv;
195−
196− /* Egress acl forward to vport is supported only non-uplink representor */
197− return rpriv->rep->vport != MLX5_VPORT_UPLINK;
186+ return netif_is_lag_port(netdev) && mlx5e_eswitch_vf_rep(netdev);
198187 }
199188
200189 static void mlx5e_rep_changelowerstate_event(struct net_device *netdev, void *ptr)
@@ -210,9 +199,6 @@ static void mlx5e_rep_changelowerstate_event(struct net_device *netdev, void *pt · 9 unmodified lines
210199 u16 fwd_vport_num;
211200 int err;
212201
213− if (!mlx5e_rep_is_lag_netdev(netdev))
214− return;
215−
216202 info = ptr;
217203 lag_info = info->lower_state_info;
218204 /* This is not an event of a representor becoming active slave */
@@ -266,9 +252,6 @@ static void mlx5e_rep_changeupper_event(struct net_device *netdev, void *ptr) · 47 unmodified lines
266252 struct net_device *lag_dev;
267253 struct mlx5e_priv *priv;
268254
269− if (!mlx5e_rep_is_lag_netdev(netdev))
270− return;
271−
272255 priv = netdev_priv(netdev);
273256 rpriv = priv->ppriv;
274257 lag_dev = info->upper_dev;
@@ -293,6 +276,19 @@ static int mlx5e_rep_esw_bond_netevent(struct notifier_block *nb, · 18 unmodified lines
293276 unsigned long event, void *ptr)
294277 {
295278 struct net_device *netdev = netdev_notifier_info_to_dev(ptr);
279+ struct mlx5e_rep_priv *rpriv;
280+ struct mlx5e_rep_bond *bond;
281+ struct mlx5e_priv *priv;
282+
283+ if (!mlx5e_rep_is_lag_netdev(netdev))
284+ return NOTIFY_DONE;
285+
286+ bond = container_of(nb, struct mlx5e_rep_bond, nb);
287+ priv = netdev_priv(netdev);
288+ rpriv = mlx5_eswitch_get_uplink_priv(priv->mdev->priv.eswitch, REP_ETH);
289+ /* Verify VF representor is on the same device of the bond handling the netevent. */
290+ if (rpriv->uplink_priv.bond != bond)
291+ return NOTIFY_DONE;
296292
297293 switch (event) {
298294 case NETDEV_CHANGELOWERSTATE:
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c+4−2
@@ -491,7 +491,7 @@ void mlx5e_rep_bridge_init(struct mlx5e_priv *priv) · 490 unmodified lines
491491 }
492492
493493 br_offloads->netdev_nb.notifier_call = mlx5_esw_bridge_switchdev_port_event;
494− err = register_netdevice_notifier(&br_offloads->netdev_nb);
494+ err = register_netdevice_notifier_net(&init_net, &br_offloads->netdev_nb);
495495 if (err) {
496496 esw_warn(mdev, "Failed to register bridge offloads netdevice notifier (err=%d)\n",
497497 err);
@@ -509,7 +509,9 @@ err_register_swdev_blk: · 11 unmodified lines
509509 err_register_swdev:
510510 destroy_workqueue(br_offloads->wq);
511511 err_alloc_wq:
512+ rtnl_lock();
512513 mlx5_esw_bridge_cleanup(esw);
514+ rtnl_unlock();
513515 }
514516
515517 void mlx5e_rep_bridge_cleanup(struct mlx5e_priv *priv)
@@ -524,7 +526,7 @@ void mlx5e_rep_bridge_cleanup(struct mlx5e_priv *priv) · 8 unmodified lines
524526 return;
525527
526528 cancel_delayed_work_sync(&br_offloads->update_work);
527− unregister_netdevice_notifier(&br_offloads->netdev_nb);
529+ unregister_netdevice_notifier_net(&init_net, &br_offloads->netdev_nb);
528530 unregister_switchdev_blocking_notifier(&br_offloads->nb_blk);
529531 unregister_switchdev_notifier(&br_offloads->nb);
530532 destroy_workqueue(br_offloads->wq);
drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h+5−0
@@ -167,6 +167,11 @@ static inline u16 mlx5e_txqsq_get_next_pi(struct mlx5e_txqsq *sq, u16 size) · 166 unmodified lines
167167 return pi;
168168 }
169169
170+static inline u16 mlx5e_shampo_get_cqe_header_index(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe)
171+{
172+ return be16_to_cpu(cqe->shampo.header_entry_index) & (rq->mpwqe.shampo->hd_per_wq - 1);
173+}
174+
170175 struct mlx5e_shampo_umr {
171176 u16 len;
172177 };
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c+3−1
@@ -341,8 +341,10 @@ mlx5e_xmit_xdp_frame(struct mlx5e_xdpsq *sq, struct mlx5e_xmit_data *xdptxd, · 340 unmodified lines
341341
342342 /* copy the inline part if required */
343343 if (sq->min_inline_mode != MLX5_INLINE_MODE_NONE) {
344− memcpy(eseg->inline_hdr.start, xdptxd->data, MLX5E_XDP_MIN_INLINE);
344+ memcpy(eseg->inline_hdr.start, xdptxd->data, sizeof(eseg->inline_hdr.start));
345345 eseg->inline_hdr.sz = cpu_to_be16(MLX5E_XDP_MIN_INLINE);
346+ memcpy(dseg, xdptxd->data + sizeof(eseg->inline_hdr.start),
347+ MLX5E_XDP_MIN_INLINE - sizeof(eseg->inline_hdr.start));
346348 dma_len -= MLX5E_XDP_MIN_INLINE;
347349 dma_addr += MLX5E_XDP_MIN_INLINE;
348350 dseg++;
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c+11−2
@@ -157,11 +157,20 @@ static void mlx5e_ipsec_set_swp(struct sk_buff *skb, · 156 unmodified lines
157157 /* Tunnel mode */
158158 if (mode == XFRM_MODE_TUNNEL) {
159159 eseg->swp_inner_l3_offset = skb_inner_network_offset(skb) / 2;
160− eseg->swp_inner_l4_offset = skb_inner_transport_offset(skb) / 2;
161160 if (xo->proto == IPPROTO_IPV6)
162161 eseg->swp_flags |= MLX5_ETH_WQE_SWP_INNER_L3_IPV6;
163− if (inner_ip_hdr(skb)->protocol == IPPROTO_UDP)
162+
163+ switch (xo->inner_ipproto) {
164+ case IPPROTO_UDP:
164165 eseg->swp_flags |= MLX5_ETH_WQE_SWP_INNER_L4_UDP;
166+ fallthrough;
167+ case IPPROTO_TCP:
168+ /* IP | ESP | IP | [TCP | UDP] */
169+ eseg->swp_inner_l4_offset = skb_inner_transport_offset(skb) / 2;
170+ break;
171+ default:
172+ break;
173+ }
165174 return;
166175 }
167176
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h+6−3
@@ -131,14 +131,17 @@ static inline bool · 130 unmodified lines
131131 mlx5e_ipsec_txwqe_build_eseg_csum(struct mlx5e_txqsq *sq, struct sk_buff *skb,
132132 struct mlx5_wqe_eth_seg *eseg)
133133 {
134− struct xfrm_offload *xo = xfrm_offload(skb);
134+ u8 inner_ipproto;
135135
136136 if (!mlx5e_ipsec_eseg_meta(eseg))
137137 return false;
138138
139139 eseg->cs_flags = MLX5_ETH_WQE_L3_CSUM;
140− if (xo->inner_ipproto) {
141− eseg->cs_flags |= MLX5_ETH_WQE_L4_INNER_CSUM | MLX5_ETH_WQE_L3_INNER_CSUM;
140+ inner_ipproto = xfrm_offload(skb)->inner_ipproto;
141+ if (inner_ipproto) {
142+ eseg->cs_flags |= MLX5_ETH_WQE_L3_INNER_CSUM;
143+ if (inner_ipproto == IPPROTO_TCP || inner_ipproto == IPPROTO_UDP)
144+ eseg->cs_flags |= MLX5_ETH_WQE_L4_INNER_CSUM;
142145 } else if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
143146 eseg->cs_flags |= MLX5_ETH_WQE_L4_CSUM;
144147 sq->stats->csum_partial_inner++;
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c+19−11
@@ -1117,7 +1117,7 @@ static void mlx5e_shampo_update_ipv6_udp_hdr(struct mlx5e_rq *rq, struct ipv6hdr · 1116 unmodified lines
11171117 static void mlx5e_shampo_update_fin_psh_flags(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe,
11181118 struct tcphdr *skb_tcp_hd)
11191119 {
1120− u16 header_index = be16_to_cpu(cqe->shampo.header_entry_index);
1120+ u16 header_index = mlx5e_shampo_get_cqe_header_index(rq, cqe);
11211121 struct tcphdr *last_tcp_hd;
11221122 void *last_hd_addr;
11231123
@@ -1871,7 +1871,7 @@ mlx5e_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi, · 747 unmodified lines
18711871 return skb;
18721872 }
18731873
1874−static void
1874+static struct sk_buff *
18751875 mlx5e_skb_from_cqe_shampo(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi,
18761876 struct mlx5_cqe64 *cqe, u16 header_index)
18771877 {
@@ -1895,7 +1895,7 @@ mlx5e_skb_from_cqe_shampo(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi, · 17 unmodified lines
18951895 skb = mlx5e_build_linear_skb(rq, hdr, frag_size, rx_headroom, head_size);
18961896
18971897 if (unlikely(!skb))
1898− return;
1898+ return NULL;
18991899
19001900 /* queue up for recycling/reuse */
19011901 page_ref_inc(head->page);
@@ -1907,7 +1907,7 @@ mlx5e_skb_from_cqe_shampo(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi, · 5 unmodified lines
19071907 ALIGN(head_size, sizeof(long)));
19081908 if (unlikely(!skb)) {
19091909 rq->stats->buff_alloc_err++;
1910− return;
1910+ return NULL;
19111911 }
19121912
19131913 prefetchw(skb->data);
@@ -1918,9 +1918,7 @@ mlx5e_skb_from_cqe_shampo(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi, · 4 unmodified lines
19181918 skb->tail += head_size;
19191919 skb->len += head_size;
19201920 }
1921− rq->hw_gro_data->skb = skb;
1922− NAPI_GRO_CB(skb)->count = 1;
1923− skb_shinfo(skb)->gso_size = mpwrq_get_cqe_byte_cnt(cqe) - head_size;
1921+ return skb;
19241922 }
19251923
19261924 static void
@@ -1973,13 +1971,14 @@ mlx5e_free_rx_shampo_hd_entry(struct mlx5e_rq *rq, u16 header_index) · 46 unmodified lines
19731971 static void mlx5e_handle_rx_cqe_mpwrq_shampo(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe)
19741972 {
19751973 u16 data_bcnt = mpwrq_get_cqe_byte_cnt(cqe) - cqe->shampo.header_size;
1976− u16 header_index = be16_to_cpu(cqe->shampo.header_entry_index);
1974+ u16 header_index = mlx5e_shampo_get_cqe_header_index(rq, cqe);
19771975 u32 wqe_offset = be32_to_cpu(cqe->shampo.data_offset);
19781976 u16 cstrides = mpwrq_get_cqe_consumed_strides(cqe);
19791977 u32 data_offset = wqe_offset & (PAGE_SIZE - 1);
19801978 u32 cqe_bcnt = mpwrq_get_cqe_byte_cnt(cqe);
19811979 u16 wqe_id = be16_to_cpu(cqe->wqe_id);
19821980 u32 page_idx = wqe_offset >> PAGE_SHIFT;
1981+ u16 head_size = cqe->shampo.header_size;
19831982 struct sk_buff **skb = &rq->hw_gro_data->skb;
19841983 bool flush = cqe->shampo.flush;
19851984 bool match = cqe->shampo.match;
@@ -2011,9 +2010,16 @@ static void mlx5e_handle_rx_cqe_mpwrq_shampo(struct mlx5e_rq *rq, struct mlx5_cq · 25 unmodified lines
20112010 }
20122011
20132012 if (!*skb) {
2014− mlx5e_skb_from_cqe_shampo(rq, wi, cqe, header_index);
2013+ if (likely(head_size))
2014+ *skb = mlx5e_skb_from_cqe_shampo(rq, wi, cqe, header_index);
2015+ else
2016+ *skb = mlx5e_skb_from_cqe_mpwrq_nonlinear(rq, wi, cqe_bcnt, data_offset,
2017+ page_idx);
20152018 if (unlikely(!*skb))
20162019 goto free_hd_entry;
2020+
2021+ NAPI_GRO_CB(*skb)->count = 1;
2022+ skb_shinfo(*skb)->gso_size = cqe_bcnt - head_size;
20172023 } else {
20182024 NAPI_GRO_CB(*skb)->count++;
20192025 if (NAPI_GRO_CB(*skb)->count == 2 &&
@@ -2027,8 +2033,10 @@ static void mlx5e_handle_rx_cqe_mpwrq_shampo(struct mlx5e_rq *rq, struct mlx5_cq · 7 unmodified lines
20272033 }
20282034 }
20292035
2030− di = &wi->umr.dma_info[page_idx];
2031− mlx5e_fill_skb_data(*skb, rq, di, data_bcnt, data_offset);
2036+ if (likely(head_size)) {
2037+ di = &wi->umr.dma_info[page_idx];
2038+ mlx5e_fill_skb_data(*skb, rq, di, data_bcnt, data_offset);
2039+ }
20322040
20332041 mlx5e_shampo_complete_rx_cqe(rq, cqe, cqe_bcnt, *skb);
20342042 if (flush)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c+14−1
@@ -1539,7 +1539,8 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv, · 1538 unmodified lines
15391539 if (err)
15401540 goto err_out;
15411541
1542− if (!attr->chain && esw_attr->int_port) {
1542+ if (!attr->chain && esw_attr->int_port &&
1543+ attr->action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) {
15431544 /* If decap route device is internal port, change the
15441545 * source vport value in reg_c0 back to uplink just in
15451546 * case the rule performs goto chain > 0. If we have a miss
@@ -3272,6 +3273,18 @@ actions_match_supported(struct mlx5e_priv *priv, · 1726 unmodified lines
32723273 return false;
32733274 }
32743275
3276+ if (!(~actions &
3277+ (MLX5_FLOW_CONTEXT_ACTION_FWD_DEST | MLX5_FLOW_CONTEXT_ACTION_DROP))) {
3278+ NL_SET_ERR_MSG_MOD(extack, "Rule cannot support forward+drop action");
3279+ return false;
3280+ }
3281+
3282+ if (actions & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR &&
3283+ actions & MLX5_FLOW_CONTEXT_ACTION_DROP) {
3284+ NL_SET_ERR_MSG_MOD(extack, "Drop with modify header action is not supported");
3285+ return false;
3286+ }
3287+
32753288 if (actions & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR &&
32763289 !modify_header_match_supported(priv, &parse_attr->spec, flow_action,
32773290 actions, ct_flow, ct_clear, extack))
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c+1−1
@@ -208,7 +208,7 @@ static inline void mlx5e_insert_vlan(void *start, struct sk_buff *skb, u16 ihs) · 207 unmodified lines
208208 int cpy1_sz = 2 * ETH_ALEN;
209209 int cpy2_sz = ihs - cpy1_sz;
210210
211− memcpy(vhdr, skb->data, cpy1_sz);
211+ memcpy(&vhdr->addrs, skb->data, cpy1_sz);
212212 vhdr->h_vlan_proto = skb->vlan_proto;
213213 vhdr->h_vlan_TCI = cpu_to_be16(skb_vlan_tag_get(skb));
214214 memcpy(&vhdr->h_vlan_encapsulated_proto, skb->data + cpy1_sz, cpy2_sz);
drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c+4−0
@@ -1574,6 +1574,8 @@ struct mlx5_esw_bridge_offloads *mlx5_esw_bridge_init(struct mlx5_eswitch *esw) · 1573 unmodified lines
15741574 {
15751575 struct mlx5_esw_bridge_offloads *br_offloads;
15761576
1577+ ASSERT_RTNL();
1578+
15771579 br_offloads = kvzalloc(sizeof(*br_offloads), GFP_KERNEL);
15781580 if (!br_offloads)
15791581 return ERR_PTR(-ENOMEM);
@@ -1590,6 +1592,8 @@ void mlx5_esw_bridge_cleanup(struct mlx5_eswitch *esw) · 10 unmodified lines
15901592 {
15911593 struct mlx5_esw_bridge_offloads *br_offloads = esw->br_offloads;
15921594
1595+ ASSERT_RTNL();
1596+
15931597 if (!br_offloads)
15941598 return;
15951599
drivers/net/ethernet/mellanox/mlx5/core/esw/diag/bridge_tracepoint.h+1−1
@@ -21,7 +21,7 @@ DECLARE_EVENT_CLASS(mlx5_esw_bridge_fdb_template, · 20 unmodified lines
2121 __field(unsigned int, used)
2222 ),
2323 TP_fast_assign(
24− strncpy(__entry->dev_name,
24+ strscpy(__entry->dev_name,
2525 netdev_name(fdb->dev),
2626 IFNAMSIZ);
2727 memcpy(__entry->addr, fdb->key.addr, ETH_ALEN);
drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c+1−1
@@ -132,7 +132,7 @@ static void mlx5_stop_sync_reset_poll(struct mlx5_core_dev *dev) · 131 unmodified lines
132132 {
133133 struct mlx5_fw_reset *fw_reset = dev->priv.fw_reset;
134134
135− del_timer(&fw_reset->timer);
135+ del_timer_sync(&fw_reset->timer);
136136 }
137137
138138 static void mlx5_sync_reset_clear_reset_requested(struct mlx5_core_dev *dev, bool poll_health)
drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c+5−4
@@ -121,12 +121,13 @@ u32 mlx5_chains_get_nf_ft_chain(struct mlx5_fs_chains *chains) · 120 unmodified lines
121121
122122 u32 mlx5_chains_get_prio_range(struct mlx5_fs_chains *chains)
123123 {
124− if (!mlx5_chains_prios_supported(chains))
125− return 1;
126−
127124 if (mlx5_chains_ignore_flow_level_supported(chains))
128125 return UINT_MAX;
129126
127+ if (!chains->dev->priv.eswitch ||
128+ chains->dev->priv.eswitch->mode != MLX5_ESWITCH_OFFLOADS)
129+ return 1;
130+
130131 /* We should get here only for eswitch case */
131132 return FDB_TC_MAX_PRIO;
132133 }
@@ -211,7 +212,7 @@ static int · 78 unmodified lines
211212 create_chain_restore(struct fs_chain *chain)
212213 {
213214 struct mlx5_eswitch *esw = chain->chains->dev->priv.eswitch;
214− char modact[MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto)];
215+ u8 modact[MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto)] = {};
215216 struct mlx5_fs_chains *chains = chain->chains;
216217 enum mlx5e_tc_attr_to_reg chain_to_reg;
217218 struct mlx5_modify_hdr *mod_hdr;
drivers/net/ethernet/mellanox/mlx5/core/port.c+5−4
@@ -406,23 +406,24 @@ int mlx5_query_module_eeprom(struct mlx5_core_dev *dev, · 405 unmodified lines
406406
407407 switch (module_id) {
408408 case MLX5_MODULE_ID_SFP:
409− mlx5_sfp_eeprom_params_set(&query.i2c_address, &query.page, &query.offset);
409+ mlx5_sfp_eeprom_params_set(&query.i2c_address, &query.page, &offset);
410410 break;
411411 case MLX5_MODULE_ID_QSFP:
412412 case MLX5_MODULE_ID_QSFP_PLUS:
413413 case MLX5_MODULE_ID_QSFP28:
414− mlx5_qsfp_eeprom_params_set(&query.i2c_address, &query.page, &query.offset);
414+ mlx5_qsfp_eeprom_params_set(&query.i2c_address, &query.page, &offset);
415415 break;
416416 default:
417417 mlx5_core_err(dev, "Module ID not recognized: 0x%x\n", module_id);
418418 return -EINVAL;
419419 }
420420
421− if (query.offset + size > MLX5_EEPROM_PAGE_LENGTH)
421+ if (offset + size > MLX5_EEPROM_PAGE_LENGTH)
422422 /* Cross pages read, read until offset 256 in low page */
423− size -= offset + size - MLX5_EEPROM_PAGE_LENGTH;
423+ size = MLX5_EEPROM_PAGE_LENGTH - offset;
424424
425425 query.size = size;
426+ query.offset = offset;
426427
427428 return mlx5_query_mcia(dev, &query, data);
428429 }
drivers/net/ethernet/microchip/sparx5/sparx5_packet.c+1−1
@@ -145,9 +145,9 @@ static void sparx5_xtr_grp(struct sparx5 *sparx5, u8 grp, bool byte_swap) · 144 unmodified lines
145145 skb_put(skb, byte_cnt - ETH_FCS_LEN);
146146 eth_skb_pad(skb);
147147 skb->protocol = eth_type_trans(skb, netdev);
148− netif_rx(skb);
149148 netdev->stats.rx_bytes += skb->len;
150149 netdev->stats.rx_packets++;
150+ netif_rx(skb);
151151 }
152152
153153 static int sparx5_inject(struct sparx5 *sparx5,
drivers/net/ethernet/smsc/smc911x.c+4−4
@@ -1648,7 +1648,7 @@ static int smc911x_ethtool_geteeprom(struct net_device *dev, · 1647 unmodified lines
16481648 return ret;
16491649 if ((ret=smc911x_ethtool_read_eeprom_byte(dev, &eebuf[i]))!=0)
16501650 return ret;
1651− }
1651+ }
16521652 memcpy(data, eebuf+eeprom->offset, eeprom->len);
16531653 return 0;
16541654 }
@@ -1667,11 +1667,11 @@ static int smc911x_ethtool_seteeprom(struct net_device *dev, · 12 unmodified lines
16671667 return ret;
16681668 /* write byte */
16691669 if ((ret=smc911x_ethtool_write_eeprom_byte(dev, *data))!=0)
1670− return ret;
1670+ return ret;
16711671 if ((ret=smc911x_ethtool_write_eeprom_cmd(dev, E2P_CMD_EPC_CMD_WRITE_, i ))!=0)
16721672 return ret;
1673− }
1674− return 0;
1673+ }
1674+ return 0;
16751675 }
16761676
16771677 static int smc911x_ethtool_geteeprom_len(struct net_device *dev)
drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c+7−2
@@ -49,13 +49,15 @@ struct visconti_eth { · 48 unmodified lines
4949 void __iomem *reg;
5050 u32 phy_intf_sel;
5151 struct clk *phy_ref_clk;
52+ struct device *dev;
5253 spinlock_t lock; /* lock to protect register update */
5354 };
5455
5556 static void visconti_eth_fix_mac_speed(void *priv, unsigned int speed)
5657 {
5758 struct visconti_eth *dwmac = priv;
58− unsigned int val, clk_sel_val;
59+ struct net_device *netdev = dev_get_drvdata(dwmac->dev);
60+ unsigned int val, clk_sel_val = 0;
5961 unsigned long flags;
6062
6163 spin_lock_irqsave(&dwmac->lock, flags);
@@ -85,7 +87,9 @@ static void visconti_eth_fix_mac_speed(void *priv, unsigned int speed) · 23 unmodified lines
8587 break;
8688 default:
8789 /* No bit control */
88− break;
90+ netdev_err(netdev, "Unsupported speed request (%d)", speed);
91+ spin_unlock_irqrestore(&dwmac->lock, flags);
92+ return;
8993 }
9094
9195 writel(val, dwmac->reg + MAC_CTRL_REG);
@@ -229,6 +233,7 @@ static int visconti_eth_dwmac_probe(struct platform_device *pdev) · 137 unmodified lines
229233
230234 spin_lock_init(&dwmac->lock);
231235 dwmac->reg = stmmac_res.addr;
236+ dwmac->dev = &pdev->dev;
232237 plat_dat->bsp_priv = dwmac;
233238 plat_dat->fix_mac_speed = visconti_eth_fix_mac_speed;
234239
drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h+1−0
@@ -150,6 +150,7 @@ · 149 unmodified lines
150150
151151 #define NUM_DWMAC100_DMA_REGS 9
152152 #define NUM_DWMAC1000_DMA_REGS 23
153+#define NUM_DWMAC4_DMA_REGS 27
153154
154155 void dwmac_enable_dma_transmission(void __iomem *ioaddr);
155156 void dwmac_enable_dma_irq(void __iomem *ioaddr, u32 chan, bool rx, bool tx);
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c+17−2
@@ -21,10 +21,18 @@ · 20 unmodified lines
2121 #include "dwxgmac2.h"
2222
2323 #define REG_SPACE_SIZE 0x1060
24+#define GMAC4_REG_SPACE_SIZE 0x116C
2425 #define MAC100_ETHTOOL_NAME "st_mac100"
2526 #define GMAC_ETHTOOL_NAME "st_gmac"
2627 #define XGMAC_ETHTOOL_NAME "st_xgmac"
2728
29+/* Same as DMA_CHAN_BASE_ADDR defined in dwmac4_dma.h
30+ *
31+ * It is here because dwmac_dma.h and dwmac4_dam.h can not be included at the
32+ * same time due to the conflicting macro names.
33+ */
34+#define GMAC4_DMA_CHAN_BASE_ADDR 0x00001100
35+
2836 #define ETHTOOL_DMA_OFFSET 55
2937
3038 struct stmmac_stats {
@@ -434,6 +442,8 @@ static int stmmac_ethtool_get_regs_len(struct net_device *dev) · 403 unmodified lines
434442
435443 if (priv->plat->has_xgmac)
436444 return XGMAC_REGSIZE * 4;
445+ else if (priv->plat->has_gmac4)
446+ return GMAC4_REG_SPACE_SIZE;
437447 return REG_SPACE_SIZE;
438448 }
439449
@@ -446,8 +456,13 @@ static void stmmac_ethtool_gregs(struct net_device *dev, · 6 unmodified lines
446456 stmmac_dump_mac_regs(priv, priv->hw, reg_space);
447457 stmmac_dump_dma_regs(priv, priv->ioaddr, reg_space);
448458
449− if (!priv->plat->has_xgmac) {
450− /* Copy DMA registers to where ethtool expects them */
459+ /* Copy DMA registers to where ethtool expects them */
460+ if (priv->plat->has_gmac4) {
461+ /* GMAC4 dumps its DMA registers at its DMA_CHAN_BASE_ADDR */
462+ memcpy(&reg_space[ETHTOOL_DMA_OFFSET],
463+ &reg_space[GMAC4_DMA_CHAN_BASE_ADDR / 4],
464+ NUM_DWMAC4_DMA_REGS * 4);
465+ } else if (!priv->plat->has_xgmac) {
451466 memcpy(&reg_space[ETHTOOL_DMA_OFFSET],
452467 &reg_space[DMA_BUS_MODE / 4],
453468 NUM_DWMAC1000_DMA_REGS * 4);
drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c+12−7
@@ -145,15 +145,20 @@ static int adjust_systime(void __iomem *ioaddr, u32 sec, u32 nsec, · 144 unmodified lines
145145
146146 static void get_systime(void __iomem *ioaddr, u64 *systime)
147147 {
148− u64 ns;
149−
150− /* Get the TSSS value */
151− ns = readl(ioaddr + PTP_STNSR);
152− /* Get the TSS and convert sec time value to nanosecond */
153− ns += readl(ioaddr + PTP_STSR) * 1000000000ULL;
148+ u64 ns, sec0, sec1;
149+
150+ /* Get the TSS value */
151+ sec1 = readl_relaxed(ioaddr + PTP_STSR);
152+ do {
153+ sec0 = sec1;
154+ /* Get the TSSS value */
155+ ns = readl_relaxed(ioaddr + PTP_STNSR);
156+ /* Get the TSS value */
157+ sec1 = readl_relaxed(ioaddr + PTP_STSR);
158+ } while (sec0 != sec1);
154159
155160 if (systime)
156− *systime = ns;
161+ *systime = ns + (sec1 * 1000000000ULL);
157162 }
158163
159164 static void get_ptptime(void __iomem *ptpaddr, u64 *ptp_time)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+4−2
@@ -7199,6 +7199,10 @@ int stmmac_dvr_remove(struct device *dev) · 7198 unmodified lines
71997199
72007200 netdev_info(priv->dev, "%s: removing driver", __func__);
72017201
7202+ pm_runtime_get_sync(dev);
7203+ pm_runtime_disable(dev);
7204+ pm_runtime_put_noidle(dev);
7205+
72027206 stmmac_stop_all_dma(priv);
72037207 stmmac_mac_set(priv, priv->ioaddr, false);
72047208 netif_carrier_off(ndev);
@@ -7217,8 +7221,6 @@ int stmmac_dvr_remove(struct device *dev) · 12 unmodified lines
72177221 if (priv->plat->stmmac_rst)
72187222 reset_control_assert(priv->plat->stmmac_rst);
72197223 reset_control_assert(priv->plat->stmmac_ahb_rst);
7220− pm_runtime_put(dev);
7221− pm_runtime_disable(dev);
72227224 if (priv->hw->pcs != STMMAC_PCS_TBI &&
72237225 priv->hw->pcs != STMMAC_PCS_RTBI)
72247226 stmmac_mdio_unregister(ndev);
drivers/net/ieee802154/at86rf230.c+11−2
@@ -100,6 +100,7 @@ struct at86rf230_local { · 99 unmodified lines
100100 unsigned long cal_timeout;
101101 bool is_tx;
102102 bool is_tx_from_off;
103+ bool was_tx;
103104 u8 tx_retry;
104105 struct sk_buff *tx_skb;
105106 struct at86rf230_state_change tx;
@@ -343,7 +344,11 @@ at86rf230_async_error_recover_complete(void *context) · 237 unmodified lines
343344 if (ctx->free)
344345 kfree(ctx);
345346
346− ieee802154_wake_queue(lp->hw);
347+ if (lp->was_tx) {
348+ lp->was_tx = 0;
349+ dev_kfree_skb_any(lp->tx_skb);
350+ ieee802154_wake_queue(lp->hw);
351+ }
347352 }
348353
349354 static void
@@ -352,7 +357,11 @@ at86rf230_async_error_recover(void *context) · 2 unmodified lines
352357 struct at86rf230_state_change *ctx = context;
353358 struct at86rf230_local *lp = ctx->lp;
354359
355− lp->is_tx = 0;
360+ if (lp->is_tx) {
361+ lp->was_tx = 1;
362+ lp->is_tx = 0;
363+ }
364+
356365 at86rf230_async_state_change(lp, ctx, STATE_RX_AACK_ON,
357366 at86rf230_async_error_recover_complete);
358367 }
drivers/net/ieee802154/ca8210.c+1−0
@@ -1771,6 +1771,7 @@ static int ca8210_async_xmit_complete( · 1770 unmodified lines
17711771 status
17721772 );
17731773 if (status != MAC_TRANSACTION_OVERFLOW) {
1774+ dev_kfree_skb_any(priv->tx_skb);
17741775 ieee802154_wake_queue(priv->hw);
17751776 return 0;
17761777 }
drivers/net/ieee802154/mac802154_hwsim.c+1−0
@@ -786,6 +786,7 @@ static int hwsim_add_one(struct genl_info *info, struct device *dev, · 785 unmodified lines
786786 goto err_pib;
787787 }
788788
789+ pib->channel = 13;
789790 rcu_assign_pointer(phy->pib, pib);
790791 phy->idx = idx;
791792 INIT_LIST_HEAD(&phy->edges);
drivers/net/ieee802154/mcr20a.c+2−2
@@ -976,8 +976,8 @@ static void mcr20a_hw_setup(struct mcr20a_local *lp) · 975 unmodified lines
976976 dev_dbg(printdev(lp), "%s\n", __func__);
977977
978978 phy->symbol_duration = 16;
979− phy->lifs_period = 40;
980− phy->sifs_period = 12;
979+ phy->lifs_period = 40 * phy->symbol_duration;
980+ phy->sifs_period = 12 * phy->symbol_duration;
981981
982982 hw->flags = IEEE802154_HW_TX_OMIT_CKSUM |
983983 IEEE802154_HW_AFILT |
drivers/net/ipa/ipa_power.c+52−0
@@ -11,6 +11,8 @@ · 10 unmodified lines
1111 #include <linux/pm_runtime.h>
1212 #include <linux/bitops.h>
1313
14+#include "linux/soc/qcom/qcom_aoss.h"
15+
1416 #include "ipa.h"
1517 #include "ipa_power.h"
1618 #include "ipa_endpoint.h"
@@ -64,6 +66,7 @@ enum ipa_power_flag { · 47 unmodified lines
6466 * struct ipa_power - IPA power management information
6567 * @dev: IPA device pointer
6668 * @core: IPA core clock
69+ * @qmp: QMP handle for AOSS communication
6770 * @spinlock: Protects modem TX queue enable/disable
6871 * @flags: Boolean state flags
6972 * @interconnect_count: Number of elements in interconnect[]
@@ -72,6 +75,7 @@ enum ipa_power_flag { · 2 unmodified lines
7275 struct ipa_power {
7376 struct device *dev;
7477 struct clk *core;
78+ struct qmp *qmp;
7579 spinlock_t spinlock; /* used with STOPPED/STARTED power flags */
7680 DECLARE_BITMAP(flags, IPA_POWER_FLAG_COUNT);
7781 u32 interconnect_count;
@@ -382,6 +386,47 @@ void ipa_power_modem_queue_active(struct ipa *ipa) · 304 unmodified lines
382386 clear_bit(IPA_POWER_FLAG_STARTED, ipa->power->flags);
383387 }
384388
389+static int ipa_power_retention_init(struct ipa_power *power)
390+{
391+ struct qmp *qmp = qmp_get(power->dev);
392+
393+ if (IS_ERR(qmp)) {
394+ if (PTR_ERR(qmp) == -EPROBE_DEFER)
395+ return -EPROBE_DEFER;
396+
397+ /* We assume any other error means it's not defined/needed */
398+ qmp = NULL;
399+ }
400+ power->qmp = qmp;
401+
402+ return 0;
403+}
404+
405+static void ipa_power_retention_exit(struct ipa_power *power)
406+{
407+ qmp_put(power->qmp);
408+ power->qmp = NULL;
409+}
410+
411+/* Control register retention on power collapse */
412+void ipa_power_retention(struct ipa *ipa, bool enable)
413+{
414+ static const char fmt[] = "{ class: bcm, res: ipa_pc, val: %c }";
415+ struct ipa_power *power = ipa->power;
416+ char buf[36]; /* Exactly enough for fmt[]; size a multiple of 4 */
417+ int ret;
418+
419+ if (!power->qmp)
420+ return; /* Not needed on this platform */
421+
422+ (void)snprintf(buf, sizeof(buf), fmt, enable ? '1' : '0');
423+
424+ ret = qmp_send(power->qmp, buf, sizeof(buf));
425+ if (ret)
426+ dev_err(power->dev, "error %d sending QMP %sable request\n",
427+ ret, enable ? "en" : "dis");
428+}
429+
385430 int ipa_power_setup(struct ipa *ipa)
386431 {
387432 int ret;
@@ -438,12 +483,18 @@ ipa_power_init(struct device *dev, const struct ipa_power_data *data) · 50 unmodified lines
438483 if (ret)
439484 goto err_kfree;
440485
486+ ret = ipa_power_retention_init(power);
487+ if (ret)
488+ goto err_interconnect_exit;
489+
441490 pm_runtime_set_autosuspend_delay(dev, IPA_AUTOSUSPEND_DELAY);
442491 pm_runtime_use_autosuspend(dev);
443492 pm_runtime_enable(dev);
444493
445494 return power;
446495
496+err_interconnect_exit:
497+ ipa_interconnect_exit(power);
447498 err_kfree:
448499 kfree(power);
449500 err_clk_put:
@@ -460,6 +511,7 @@ void ipa_power_exit(struct ipa_power *power) · 10 unmodified lines
460511
461512 pm_runtime_disable(dev);
462513 pm_runtime_dont_use_autosuspend(dev);
514+ ipa_power_retention_exit(power);
463515 ipa_interconnect_exit(power);
464516 kfree(power);
465517 clk_put(clk);
drivers/net/ipa/ipa_power.h+7−0
@@ -40,6 +40,13 @@ void ipa_power_modem_queue_wake(struct ipa *ipa); · 39 unmodified lines
4040 */
4141 void ipa_power_modem_queue_active(struct ipa *ipa);
4242
43+/**
44+ * ipa_power_retention() - Control register retention on power collapse
45+ * @ipa: IPA pointer
46+ * @enable: Whether retention should be enabled or disabled
47+ */
48+void ipa_power_retention(struct ipa *ipa, bool enable);
49+
4350 /**
4451 * ipa_power_setup() - Set up IPA power management
4552 * @ipa: IPA pointer
drivers/net/ipa/ipa_uc.c+5−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111
1212 #include "ipa.h"
1313 #include "ipa_uc.h"
14+#include "ipa_power.h"
1415
1516 /**
1617 * DOC: The IPA embedded microcontroller
@@ -154,6 +155,7 @@ static void ipa_uc_response_hdlr(struct ipa *ipa, enum ipa_irq_id irq_id) · 137 unmodified lines
154155 case IPA_UC_RESPONSE_INIT_COMPLETED:
155156 if (ipa->uc_powered) {
156157 ipa->uc_loaded = true;
158+ ipa_power_retention(ipa, true);
157159 pm_runtime_mark_last_busy(dev);
158160 (void)pm_runtime_put_autosuspend(dev);
159161 ipa->uc_powered = false;
@@ -184,6 +186,9 @@ void ipa_uc_deconfig(struct ipa *ipa) · 24 unmodified lines
184186
185187 ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_1);
186188 ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_0);
189+ if (ipa->uc_loaded)
190+ ipa_power_retention(ipa, false);
191+
187192 if (!ipa->uc_powered)
188193 return;
189194
drivers/net/macsec.c+21−12
@@ -3870,6 +3870,18 @@ static void macsec_common_dellink(struct net_device *dev, struct list_head *head · 3869 unmodified lines
38703870 struct macsec_dev *macsec = macsec_priv(dev);
38713871 struct net_device *real_dev = macsec->real_dev;
38723872
3873+ /* If h/w offloading is available, propagate to the device */
3874+ if (macsec_is_offloaded(macsec)) {
3875+ const struct macsec_ops *ops;
3876+ struct macsec_context ctx;
3877+
3878+ ops = macsec_get_ops(netdev_priv(dev), &ctx);
3879+ if (ops) {
3880+ ctx.secy = &macsec->secy;
3881+ macsec_offload(ops->mdo_del_secy, &ctx);
3882+ }
3883+ }
3884+
38733885 unregister_netdevice_queue(dev, head);
38743886 list_del_rcu(&macsec->secys);
38753887 macsec_del_dev(macsec);
@@ -3884,18 +3896,6 @@ static void macsec_dellink(struct net_device *dev, struct list_head *head) · 8 unmodified lines
38843896 struct net_device *real_dev = macsec->real_dev;
38853897 struct macsec_rxh_data *rxd = macsec_data_rtnl(real_dev);
38863898
3887− /* If h/w offloading is available, propagate to the device */
3888− if (macsec_is_offloaded(macsec)) {
3889− const struct macsec_ops *ops;
3890− struct macsec_context ctx;
3891−
3892− ops = macsec_get_ops(netdev_priv(dev), &ctx);
3893− if (ops) {
3894− ctx.secy = &macsec->secy;
3895− macsec_offload(ops->mdo_del_secy, &ctx);
3896− }
3897− }
3898−
38993899 macsec_common_dellink(dev, head);
39003900
39013901 if (list_empty(&rxd->secys)) {
@@ -4018,6 +4018,15 @@ static int macsec_newlink(struct net *net, struct net_device *dev, · 116 unmodified lines
40184018 !macsec_check_offload(macsec->offload, macsec))
40194019 return -EOPNOTSUPP;
40204020
4021+ /* send_sci must be set to true when transmit sci explicitly is set */
4022+ if ((data && data[IFLA_MACSEC_SCI]) &&
4023+ (data && data[IFLA_MACSEC_INC_SCI])) {
4024+ u8 send_sci = !!nla_get_u8(data[IFLA_MACSEC_INC_SCI]);
4025+
4026+ if (!send_sci)
4027+ return -EINVAL;
4028+ }
4029+
40214030 if (data && data[IFLA_MACSEC_ICV_LEN])
40224031 icv_len = nla_get_u8(data[IFLA_MACSEC_ICV_LEN]);
40234032 mtu = real_dev->mtu - icv_len - macsec_extra_len(true);
drivers/net/phy/at803x.c+13−13
@@ -1794,19 +1794,19 @@ static int qca808x_read_status(struct phy_device *phydev) · 1793 unmodified lines
17941794 if (ret < 0)
17951795 return ret;
17961796
1797− if (phydev->link && phydev->speed == SPEED_2500)
1798− phydev->interface = PHY_INTERFACE_MODE_2500BASEX;
1799− else
1800− phydev->interface = PHY_INTERFACE_MODE_SMII;
1801−
1802− /* generate seed as a lower random value to make PHY linked as SLAVE easily,
1803− * except for master/slave configuration fault detected.
1804− * the reason for not putting this code into the function link_change_notify is
1805− * the corner case where the link partner is also the qca8081 PHY and the seed
1806− * value is configured as the same value, the link can't be up and no link change
1807− * occurs.
1808− */
1809− if (!phydev->link) {
1797+ if (phydev->link) {
1798+ if (phydev->speed == SPEED_2500)
1799+ phydev->interface = PHY_INTERFACE_MODE_2500BASEX;
1800+ else
1801+ phydev->interface = PHY_INTERFACE_MODE_SGMII;
1802+ } else {
1803+ /* generate seed as a lower random value to make PHY linked as SLAVE easily,
1804+ * except for master/slave configuration fault detected.
1805+ * the reason for not putting this code into the function link_change_notify is
1806+ * the corner case where the link partner is also the qca8081 PHY and the seed
1807+ * value is configured as the same value, the link can't be up and no link change
1808+ * occurs.
1809+ */
18101810 if (phydev->master_slave_state == MASTER_SLAVE_STATE_ERR) {
18111811 qca808x_phy_ms_seed_enable(phydev, false);
18121812 } else {
drivers/net/usb/ipheth.c+3−3
@@ -121,7 +121,7 @@ static int ipheth_alloc_urbs(struct ipheth_device *iphone) · 120 unmodified lines
121121 if (tx_buf == NULL)
122122 goto free_rx_urb;
123123
124− rx_buf = usb_alloc_coherent(iphone->udev, IPHETH_BUF_SIZE,
124+ rx_buf = usb_alloc_coherent(iphone->udev, IPHETH_BUF_SIZE + IPHETH_IP_ALIGN,
125125 GFP_KERNEL, &rx_urb->transfer_dma);
126126 if (rx_buf == NULL)
127127 goto free_tx_buf;
@@ -146,7 +146,7 @@ error_nomem: · 18 unmodified lines
146146
147147 static void ipheth_free_urbs(struct ipheth_device *iphone)
148148 {
149− usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE, iphone->rx_buf,
149+ usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE + IPHETH_IP_ALIGN, iphone->rx_buf,
150150 iphone->rx_urb->transfer_dma);
151151 usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE, iphone->tx_buf,
152152 iphone->tx_urb->transfer_dma);
@@ -317,7 +317,7 @@ static int ipheth_rx_submit(struct ipheth_device *dev, gfp_t mem_flags) · 164 unmodified lines
317317
318318 usb_fill_bulk_urb(dev->rx_urb, udev,
319319 usb_rcvbulkpipe(udev, dev->bulk_in),
320− dev->rx_buf, IPHETH_BUF_SIZE,
320+ dev->rx_buf, IPHETH_BUF_SIZE + IPHETH_IP_ALIGN,
321321 ipheth_rcvbulk_callback,
322322 dev);
323323 dev->rx_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
drivers/nvme/host/fabrics.c+1−2
@@ -1092,7 +1092,6 @@ static void __nvmf_concat_opt_tokens(struct seq_file *seq_file) · 1091 unmodified lines
10921092 static int nvmf_dev_show(struct seq_file *seq_file, void *private)
10931093 {
10941094 struct nvme_ctrl *ctrl;
1095− int ret = 0;
10961095
10971096 mutex_lock(&nvmf_dev_mutex);
10981097 ctrl = seq_file->private;
@@ -1106,7 +1105,7 @@ static int nvmf_dev_show(struct seq_file *seq_file, void *private) · 7 unmodified lines
11061105
11071106 out_unlock:
11081107 mutex_unlock(&nvmf_dev_mutex);
1109− return ret;
1108+ return 0;
11101109 }
11111110
11121111 static int nvmf_dev_open(struct inode *inode, struct file *file)
drivers/nvme/host/pci.c+2−1
@@ -3391,7 +3391,8 @@ static const struct pci_device_id nvme_id_table[] = { · 3390 unmodified lines
33913391 NVME_QUIRK_DEALLOCATE_ZEROES, },
33923392 { PCI_VDEVICE(INTEL, 0x0a54), /* Intel P4500/P4600 */
33933393 .driver_data = NVME_QUIRK_STRIPE_SIZE |
3394− NVME_QUIRK_DEALLOCATE_ZEROES, },
3394+ NVME_QUIRK_DEALLOCATE_ZEROES |
3395+ NVME_QUIRK_IGNORE_DEV_SUBNQN, },
33953396 { PCI_VDEVICE(INTEL, 0x0a55), /* Dell Express Flash P4600 */
33963397 .driver_data = NVME_QUIRK_STRIPE_SIZE |
33973398 NVME_QUIRK_DEALLOCATE_ZEROES, },
drivers/pci/controller/pcie-mt7621.c+1−10
@@ -109,15 +109,6 @@ static inline void pcie_write(struct mt7621_pcie *pcie, u32 val, u32 reg) · 108 unmodified lines
109109 writel_relaxed(val, pcie->base + reg);
110110 }
111111
112−static inline void pcie_rmw(struct mt7621_pcie *pcie, u32 reg, u32 clr, u32 set)
113−{
114− u32 val = readl_relaxed(pcie->base + reg);
115−
116− val &= ~clr;
117− val |= set;
118− writel_relaxed(val, pcie->base + reg);
119−}
120−
121112 static inline u32 pcie_port_read(struct mt7621_pcie_port *port, u32 reg)
122113 {
123114 return readl_relaxed(port->base + reg);
@@ -557,7 +548,7 @@ static struct platform_driver mt7621_pcie_driver = { · 433 unmodified lines
557548 .remove = mt7621_pcie_remove,
558549 .driver = {
559550 .name = "mt7621-pci",
560− .of_match_table = of_match_ptr(mt7621_pcie_ids),
551+ .of_match_table = mt7621_pcie_ids,
561552 },
562553 };
563554 builtin_platform_driver(mt7621_pcie_driver);
drivers/pinctrl/Makefile+1−1
@@ -42,9 +42,9 @@ obj-$(CONFIG_PINCTRL_PISTACHIO) += pinctrl-pistachio.o · 41 unmodified lines
4242 obj-$(CONFIG_PINCTRL_RK805) += pinctrl-rk805.o
4343 obj-$(CONFIG_PINCTRL_ROCKCHIP) += pinctrl-rockchip.o
4444 obj-$(CONFIG_PINCTRL_SINGLE) += pinctrl-single.o
45+obj-$(CONFIG_PINCTRL_ST) += pinctrl-st.o
4546 obj-$(CONFIG_PINCTRL_STARFIVE) += pinctrl-starfive.o
4647 obj-$(CONFIG_PINCTRL_STMFX) += pinctrl-stmfx.o
47−obj-$(CONFIG_PINCTRL_ST) += pinctrl-st.o
4848 obj-$(CONFIG_PINCTRL_SX150X) += pinctrl-sx150x.o
4949 obj-$(CONFIG_PINCTRL_TB10X) += pinctrl-tb10x.o
5050 obj-$(CONFIG_PINCTRL_THUNDERBAY) += pinctrl-thunderbay.o
drivers/pinctrl/bcm/Kconfig+1−0
@@ -35,6 +35,7 @@ config PINCTRL_BCM63XX · 34 unmodified lines
3535 select PINCONF
3636 select GENERIC_PINCONF
3737 select GPIOLIB
38+ select REGMAP
3839 select GPIO_REGMAP
3940
4041 config PINCTRL_BCM6318
drivers/pinctrl/bcm/pinctrl-bcm2835.c+15−8
@@ -1269,16 +1269,18 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) · 1268 unmodified lines
12691269 sizeof(*girq->parents),
12701270 GFP_KERNEL);
12711271 if (!girq->parents) {
1272− pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range);
1273− return -ENOMEM;
1272+ err = -ENOMEM;
1273+ goto out_remove;
12741274 }
12751275
12761276 if (is_7211) {
12771277 pc->wake_irq = devm_kcalloc(dev, BCM2835_NUM_IRQS,
12781278 sizeof(*pc->wake_irq),
12791279 GFP_KERNEL);
1280− if (!pc->wake_irq)
1281− return -ENOMEM;
1280+ if (!pc->wake_irq) {
1281+ err = -ENOMEM;
1282+ goto out_remove;
1283+ }
12821284 }
12831285
12841286 /*
@@ -1306,8 +1308,10 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) · 21 unmodified lines
13061308
13071309 len = strlen(dev_name(pc->dev)) + 16;
13081310 name = devm_kzalloc(pc->dev, len, GFP_KERNEL);
1309− if (!name)
1310− return -ENOMEM;
1311+ if (!name) {
1312+ err = -ENOMEM;
1313+ goto out_remove;
1314+ }
13111315
13121316 snprintf(name, len, "%s:bank%d", dev_name(pc->dev), i);
13131317
@@ -1326,11 +1330,14 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) · 12 unmodified lines
13261330 err = gpiochip_add_data(&pc->gpio_chip, pc);
13271331 if (err) {
13281332 dev_err(dev, "could not add GPIO chip\n");
1329− pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range);
1330− return err;
1333+ goto out_remove;
13311334 }
13321335
13331336 return 0;
1337+
1338+out_remove:
1339+ pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range);
1340+ return err;
13341341 }
13351342
13361343 static struct platform_driver bcm2835_pinctrl_driver = {
drivers/pinctrl/intel/pinctrl-cherryview.c+3−2
@@ -1471,8 +1471,9 @@ static void chv_gpio_irq_handler(struct irq_desc *desc) · 1470 unmodified lines
14711471
14721472 offset = cctx->intr_lines[intr_line];
14731473 if (offset == CHV_INVALID_HWIRQ) {
1474− dev_err(dev, "interrupt on unused interrupt line %u\n", intr_line);
1475− continue;
1474+ dev_warn_once(dev, "interrupt on unmapped interrupt line %u\n", intr_line);
1475+ /* Some boards expect hwirq 0 to trigger in this case */
1476+ offset = 0;
14761477 }
14771478
14781479 generic_handle_domain_irq(gc->irq.domain, offset);
drivers/pinctrl/intel/pinctrl-intel.c+36−28
@@ -451,8 +451,8 @@ static void intel_gpio_set_gpio_mode(void __iomem *padcfg0) · 450 unmodified lines
451451 value &= ~PADCFG0_PMODE_MASK;
452452 value |= PADCFG0_PMODE_GPIO;
453453
454− /* Disable input and output buffers */
455− value |= PADCFG0_GPIORXDIS;
454+ /* Disable TX buffer and enable RX (this will be input) */
455+ value &= ~PADCFG0_GPIORXDIS;
456456 value |= PADCFG0_GPIOTXDIS;
457457
458458 /* Disable SCI/SMI/NMI generation */
@@ -497,9 +497,6 @@ static int intel_gpio_request_enable(struct pinctrl_dev *pctldev, · 38 unmodified lines
497497
498498 intel_gpio_set_gpio_mode(padcfg0);
499499
500− /* Disable TX buffer and enable RX (this will be input) */
501− __intel_gpio_set_direction(padcfg0, true);
502−
503500 raw_spin_unlock_irqrestore(&pctrl->lock, flags);
504501
505502 return 0;
@@ -1115,9 +1112,6 @@ static int intel_gpio_irq_type(struct irq_data *d, unsigned int type) · 609 unmodified lines
11151112
11161113 intel_gpio_set_gpio_mode(reg);
11171114
1118− /* Disable TX buffer and enable RX (this will be input) */
1119− __intel_gpio_set_direction(reg, true);
1120−
11211115 value = readl(reg);
11221116
11231117 value &= ~(PADCFG0_RXEVCFG_MASK | PADCFG0_RXINV);
@@ -1216,6 +1210,39 @@ static irqreturn_t intel_gpio_irq(int irq, void *data) · 92 unmodified lines
12161210 return IRQ_RETVAL(ret);
12171211 }
12181212
1213+static void intel_gpio_irq_init(struct intel_pinctrl *pctrl)
1214+{
1215+ int i;
1216+
1217+ for (i = 0; i < pctrl->ncommunities; i++) {
1218+ const struct intel_community *community;
1219+ void __iomem *base;
1220+ unsigned int gpp;
1221+
1222+ community = &pctrl->communities[i];
1223+ base = community->regs;
1224+
1225+ for (gpp = 0; gpp < community->ngpps; gpp++) {
1226+ /* Mask and clear all interrupts */
1227+ writel(0, base + community->ie_offset + gpp * 4);
1228+ writel(0xffff, base + community->is_offset + gpp * 4);
1229+ }
1230+ }
1231+}
1232+
1233+static int intel_gpio_irq_init_hw(struct gpio_chip *gc)
1234+{
1235+ struct intel_pinctrl *pctrl = gpiochip_get_data(gc);
1236+
1237+ /*
1238+ * Make sure the interrupt lines are in a proper state before
1239+ * further configuration.
1240+ */
1241+ intel_gpio_irq_init(pctrl);
1242+
1243+ return 0;
1244+}
1245+
12191246 static int intel_gpio_add_community_ranges(struct intel_pinctrl *pctrl,
12201247 const struct intel_community *community)
12211248 {
@@ -1320,6 +1347,7 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq) · 98 unmodified lines
13201347 girq->num_parents = 0;
13211348 girq->default_type = IRQ_TYPE_NONE;
13221349 girq->handler = handle_bad_irq;
1350+ girq->init_hw = intel_gpio_irq_init_hw;
13231351
13241352 ret = devm_gpiochip_add_data(pctrl->dev, &pctrl->chip, pctrl);
13251353 if (ret) {
@@ -1695,26 +1723,6 @@ int intel_pinctrl_suspend_noirq(struct device *dev) · 369 unmodified lines
16951723 }
16961724 EXPORT_SYMBOL_GPL(intel_pinctrl_suspend_noirq);
16971725
1698−static void intel_gpio_irq_init(struct intel_pinctrl *pctrl)
1699−{
1700− size_t i;
1701−
1702− for (i = 0; i < pctrl->ncommunities; i++) {
1703− const struct intel_community *community;
1704− void __iomem *base;
1705− unsigned int gpp;
1706−
1707− community = &pctrl->communities[i];
1708− base = community->regs;
1709−
1710− for (gpp = 0; gpp < community->ngpps; gpp++) {
1711− /* Mask and clear all interrupts */
1712− writel(0, base + community->ie_offset + gpp * 4);
1713− writel(0xffff, base + community->is_offset + gpp * 4);
1714− }
1715− }
1716−}
1717−
17181726 static bool intel_gpio_update_reg(void __iomem *reg, u32 mask, u32 value)
17191727 {
17201728 u32 curr, updated;
drivers/pinctrl/pinctrl-microchip-sgpio.c+2−1
@@ -137,7 +137,8 @@ static inline int sgpio_addr_to_pin(struct sgpio_priv *priv, int port, int bit) · 136 unmodified lines
137137
138138 static inline u32 sgpio_get_addr(struct sgpio_priv *priv, u32 rno, u32 off)
139139 {
140− return priv->properties->regoff[rno] + off;
140+ return (priv->properties->regoff[rno] + off) *
141+ regmap_get_reg_stride(priv->regs);
141142 }
142143
143144 static u32 sgpio_readl(struct sgpio_priv *priv, u32 rno, u32 off)
drivers/pinctrl/pinctrl-thunderbay.c+35−55
@@ -773,63 +773,42 @@ static int thunderbay_build_groups(struct thunderbay_pinctrl *tpc) · 772 unmodified lines
773773
774774 static int thunderbay_add_functions(struct thunderbay_pinctrl *tpc, struct function_desc *funcs)
775775 {
776− struct function_desc *function = funcs;
777776 int i;
778777
779778 /* Assign the groups for each function */
780− for (i = 0; i < tpc->soc->npins; i++) {
781− const struct pinctrl_pin_desc *pin_info = thunderbay_pins + i;
782− struct thunderbay_mux_desc *pin_mux = pin_info->drv_data;
783−
784− while (pin_mux->name) {
785− const char **grp;
786− int j, grp_num, match = 0;
787− size_t grp_size;
788− struct function_desc *func;
789−
790− for (j = 0; j < tpc->nfuncs; j++) {
791− if (!strcmp(pin_mux->name, function[j].name)) {
792− match = 1;
793− break;
794− }
795− }
796−
797− if (!match)
798− return -EINVAL;
799−
800− func = function + j;
801− grp_num = func->num_group_names;
802− grp_size = sizeof(*func->group_names);
803−
804− if (!func->group_names) {
805− func->group_names = devm_kcalloc(tpc->dev,
806− grp_num,
807− grp_size,
808− GFP_KERNEL);
809− if (!func->group_names) {
810− kfree(func);
811− return -ENOMEM;
812− }
779+ for (i = 0; i < tpc->nfuncs; i++) {
780+ struct function_desc *func = &funcs[i];
781+ const char **group_names;
782+ unsigned int grp_idx = 0;
783+ int j;
784+
785+ group_names = devm_kcalloc(tpc->dev, func->num_group_names,
786+ sizeof(*group_names), GFP_KERNEL);
787+ if (!group_names)
788+ return -ENOMEM;
789+
790+ for (j = 0; j < tpc->soc->npins; j++) {
791+ const struct pinctrl_pin_desc *pin_info = &thunderbay_pins[j];
792+ struct thunderbay_mux_desc *pin_mux;
793+
794+ for (pin_mux = pin_info->drv_data; pin_mux->name; pin_mux++) {
795+ if (!strcmp(pin_mux->name, func->name))
796+ group_names[grp_idx++] = pin_info->name;
813797 }
814−
815− grp = func->group_names;
816− while (*grp)
817− grp++;
818−
819− *grp = pin_info->name;
820− pin_mux++;
821798 }
799+
800+ func->group_names = group_names;
822801 }
823802
824803 /* Add all functions */
825804 for (i = 0; i < tpc->nfuncs; i++) {
826805 pinmux_generic_add_function(tpc->pctrl,
827− function[i].name,
828− function[i].group_names,
829− function[i].num_group_names,
830− function[i].data);
806+ funcs[i].name,
807+ funcs[i].group_names,
808+ funcs[i].num_group_names,
809+ funcs[i].data);
831810 }
832− kfree(function);
811+ kfree(funcs);
833812 return 0;
834813 }
835814
@@ -839,27 +818,30 @@ static int thunderbay_build_functions(struct thunderbay_pinctrl *tpc) · 3 unmodified lines
839818 void *ptr;
840819 int pin;
841820
842− /* Total number of functions is unknown at this point. Allocate first. */
821+ /*
822+ * Allocate maximum possible number of functions. Assume every pin
823+ * being part of 8 (hw maximum) globally unique muxes.
824+ */
843825 tpc->nfuncs = 0;
844826 thunderbay_funcs = kcalloc(tpc->soc->npins * 8,
845827 sizeof(*thunderbay_funcs), GFP_KERNEL);
846828 if (!thunderbay_funcs)
847829 return -ENOMEM;
848830
849− /* Find total number of functions and each's properties */
831+ /* Setup 1 function for each unique mux */
850832 for (pin = 0; pin < tpc->soc->npins; pin++) {
851833 const struct pinctrl_pin_desc *pin_info = thunderbay_pins + pin;
852− struct thunderbay_mux_desc *pin_mux = pin_info->drv_data;
834+ struct thunderbay_mux_desc *pin_mux;
853835
854− while (pin_mux->name) {
855− struct function_desc *func = thunderbay_funcs;
836+ for (pin_mux = pin_info->drv_data; pin_mux->name; pin_mux++) {
837+ struct function_desc *func;
856838
857− while (func->name) {
839+ /* Check if we already have function for this mux */
840+ for (func = thunderbay_funcs; func->name; func++) {
858841 if (!strcmp(pin_mux->name, func->name)) {
859842 func->num_group_names++;
860843 break;
861844 }
862− func++;
863845 }
864846
865847 if (!func->name) {
@@ -868,8 +850,6 @@ static int thunderbay_build_functions(struct thunderbay_pinctrl *tpc) · 2 unmodified lines
868850 func->data = (int *)&pin_mux->mode;
869851 tpc->nfuncs++;
870852 }
871−
872− pin_mux++;
873853 }
874854 }
875855
drivers/pinctrl/pinctrl-zynqmp.c+4−6
@@ -809,7 +809,6 @@ static int zynqmp_pinctrl_prepare_pin_desc(struct device *dev, · 808 unmodified lines
809809 unsigned int *npins)
810810 {
811811 struct pinctrl_pin_desc *pins, *pin;
812− char **pin_names;
813812 int ret;
814813 int i;
815814
@@ -821,14 +820,13 @@ static int zynqmp_pinctrl_prepare_pin_desc(struct device *dev, · 5 unmodified lines
821820 if (!pins)
822821 return -ENOMEM;
823822
824− pin_names = devm_kasprintf_strarray(dev, ZYNQMP_PIN_PREFIX, *npins);
825− if (IS_ERR(pin_names))
826− return PTR_ERR(pin_names);
827−
828823 for (i = 0; i < *npins; i++) {
829824 pin = &pins[i];
830825 pin->number = i;
831− pin->name = pin_names[i];
826+ pin->name = devm_kasprintf(dev, GFP_KERNEL, "%s%d",
827+ ZYNQMP_PIN_PREFIX, i);
828+ if (!pin->name)
829+ return -ENOMEM;
832830 }
833831
834832 *zynqmp_pins = pins;
drivers/pinctrl/sunxi/pinctrl-sun50i-h616.c+4−4
@@ -363,16 +363,16 @@ static const struct sunxi_desc_pin h616_pins[] = { · 362 unmodified lines
363363 SUNXI_FUNCTION(0x0, "gpio_in"),
364364 SUNXI_FUNCTION(0x1, "gpio_out"),
365365 SUNXI_FUNCTION(0x2, "uart2"), /* CTS */
366− SUNXI_FUNCTION(0x3, "i2s3"), /* DO0 */
366+ SUNXI_FUNCTION(0x3, "i2s3_dout0"), /* DO0 */
367367 SUNXI_FUNCTION(0x4, "spi1"), /* MISO */
368− SUNXI_FUNCTION(0x5, "i2s3"), /* DI1 */
368+ SUNXI_FUNCTION(0x5, "i2s3_din1"), /* DI1 */
369369 SUNXI_FUNCTION_IRQ_BANK(0x6, 6, 8)), /* PH_EINT8 */
370370 SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 9),
371371 SUNXI_FUNCTION(0x0, "gpio_in"),
372372 SUNXI_FUNCTION(0x1, "gpio_out"),
373− SUNXI_FUNCTION(0x3, "i2s3"), /* DI0 */
373+ SUNXI_FUNCTION(0x3, "i2s3_din0"), /* DI0 */
374374 SUNXI_FUNCTION(0x4, "spi1"), /* CS1 */
375− SUNXI_FUNCTION(0x3, "i2s3"), /* DO1 */
375+ SUNXI_FUNCTION(0x5, "i2s3_dout1"), /* DO1 */
376376 SUNXI_FUNCTION_IRQ_BANK(0x6, 6, 9)), /* PH_EINT9 */
377377 SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 10),
378378 SUNXI_FUNCTION(0x0, "gpio_in"),
drivers/platform/surface/Kconfig+1−0
@@ -5,6 +5,7 @@ · 4 unmodified lines
55
66 menuconfig SURFACE_PLATFORMS
77 bool "Microsoft Surface Platform-Specific Device Drivers"
8+ depends on ARM64 || X86 || COMPILE_TEST
89 default y
910 help
1011 Say Y here to get to see options for platform-specific device drivers
drivers/platform/x86/amd-pmc.c+9−6
@@ -124,9 +124,10 @@ struct amd_pmc_dev { · 123 unmodified lines
124124 u32 cpu_id;
125125 u32 active_ips;
126126 /* SMU version information */
127− u16 major;
128− u16 minor;
129− u16 rev;
127+ u8 smu_program;
128+ u8 major;
129+ u8 minor;
130+ u8 rev;
130131 struct device *dev;
131132 struct pci_dev *rdev;
132133 struct mutex lock; /* generic mutex lock */
@@ -180,11 +181,13 @@ static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev) · 47 unmodified lines
180181 if (rc)
181182 return rc;
182183
183− dev->major = (val >> 16) & GENMASK(15, 0);
184+ dev->smu_program = (val >> 24) & GENMASK(7, 0);
185+ dev->major = (val >> 16) & GENMASK(7, 0);
184186 dev->minor = (val >> 8) & GENMASK(7, 0);
185187 dev->rev = (val >> 0) & GENMASK(7, 0);
186188
187− dev_dbg(dev->dev, "SMU version is %u.%u.%u\n", dev->major, dev->minor, dev->rev);
189+ dev_dbg(dev->dev, "SMU program %u version is %u.%u.%u\n",
190+ dev->smu_program, dev->major, dev->minor, dev->rev);
188191
189192 return 0;
190193 }
@@ -226,7 +229,7 @@ static int amd_pmc_stb_debugfs_release(struct inode *inode, struct file *filp) · 35 unmodified lines
226229 return 0;
227230 }
228231
229−const struct file_operations amd_pmc_stb_debugfs_fops = {
232+static const struct file_operations amd_pmc_stb_debugfs_fops = {
230233 .owner = THIS_MODULE,
231234 .open = amd_pmc_stb_debugfs_open,
232235 .read = amd_pmc_stb_debugfs_read,
drivers/platform/x86/asus-tf103c-dock.c+2−2
@@ -250,7 +250,7 @@ static int tf103c_dock_hid_raw_request(struct hid_device *hid, u8 reportnum, · 249 unmodified lines
250250 return 0;
251251 }
252252
253−struct hid_ll_driver tf103c_dock_hid_ll_driver = {
253+static struct hid_ll_driver tf103c_dock_hid_ll_driver = {
254254 .parse = tf103c_dock_hid_parse,
255255 .start = tf103c_dock_hid_start,
256256 .stop = tf103c_dock_hid_stop,
@@ -921,7 +921,7 @@ static int __maybe_unused tf103c_dock_resume(struct device *dev) · 664 unmodified lines
921921 return 0;
922922 }
923923
924−SIMPLE_DEV_PM_OPS(tf103c_dock_pm_ops, tf103c_dock_suspend, tf103c_dock_resume);
924+static SIMPLE_DEV_PM_OPS(tf103c_dock_pm_ops, tf103c_dock_suspend, tf103c_dock_resume);
925925
926926 static const struct acpi_device_id tf103c_dock_acpi_match[] = {
927927 {"NPCE69A"},
drivers/platform/x86/intel/crystal_cove_charger.c+13−13
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <linux/regmap.h>
1818
1919 #define CHGRIRQ_REG 0x0a
20+#define MCHGRIRQ_REG 0x17
2021
2122 struct crystal_cove_charger_data {
2223 struct mutex buslock; /* irq_bus_lock */
@@ -25,8 +26,8 @@ struct crystal_cove_charger_data { · 2 unmodified lines
2526 struct irq_domain *irq_domain;
2627 int irq;
2728 int charger_irq;
28− bool irq_enabled;
29− bool irq_is_enabled;
29+ u8 mask;
30+ u8 new_mask;
3031 };
3132
3233 static irqreturn_t crystal_cove_charger_irq(int irq, void *data)
@@ -53,13 +54,9 @@ static void crystal_cove_charger_irq_bus_sync_unlock(struct irq_data *data) · 20 unmodified lines
5354 {
5455 struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data);
5556
56− if (charger->irq_is_enabled != charger->irq_enabled) {
57− if (charger->irq_enabled)
58− enable_irq(charger->irq);
59− else
60− disable_irq(charger->irq);
61−
62− charger->irq_is_enabled = charger->irq_enabled;
57+ if (charger->mask != charger->new_mask) {
58+ regmap_write(charger->regmap, MCHGRIRQ_REG, charger->new_mask);
59+ charger->mask = charger->new_mask;
6360 }
6461
6562 mutex_unlock(&charger->buslock);
@@ -69,14 +66,14 @@ static void crystal_cove_charger_irq_unmask(struct irq_data *data) · 3 unmodified lines
6966 {
7067 struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data);
7168
72− charger->irq_enabled = true;
69+ charger->new_mask &= ~BIT(data->hwirq);
7370 }
7471
7572 static void crystal_cove_charger_irq_mask(struct irq_data *data)
7673 {
7774 struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data);
7875
79− charger->irq_enabled = false;
76+ charger->new_mask |= BIT(data->hwirq);
8077 }
8178
8279 static void crystal_cove_charger_rm_irq_domain(void *data)
@@ -130,10 +127,13 @@ static int crystal_cove_charger_probe(struct platform_device *pdev) · 47 unmodified lines
130127 irq_set_nested_thread(charger->charger_irq, true);
131128 irq_set_noprobe(charger->charger_irq);
132129
130+ /* Mask the single 2nd level IRQ before enabling the 1st level IRQ */
131+ charger->mask = charger->new_mask = BIT(0);
132+ regmap_write(charger->regmap, MCHGRIRQ_REG, charger->mask);
133+
133134 ret = devm_request_threaded_irq(&pdev->dev, charger->irq, NULL,
134135 crystal_cove_charger_irq,
135− IRQF_ONESHOT | IRQF_NO_AUTOEN,
136− KBUILD_MODNAME, charger);
136+ IRQF_ONESHOT, KBUILD_MODNAME, charger);
137137 if (ret)
138138 return dev_err_probe(&pdev->dev, ret, "requesting irq\n");
139139
drivers/platform/x86/intel/speed_select_if/isst_if_common.c+63−34
@@ -596,7 +596,10 @@ static long isst_if_def_ioctl(struct file *file, unsigned int cmd, · 595 unmodified lines
596596 return ret;
597597 }
598598
599−static DEFINE_MUTEX(punit_misc_dev_lock);
599+/* Lock to prevent module registration when already opened by user space */
600+static DEFINE_MUTEX(punit_misc_dev_open_lock);
601+/* Lock to allow one share misc device for all ISST interace */
602+static DEFINE_MUTEX(punit_misc_dev_reg_lock);
600603 static int misc_usage_count;
601604 static int misc_device_ret;
602605 static int misc_device_open;
@@ -606,7 +609,7 @@ static int isst_if_open(struct inode *inode, struct file *file) · 3 unmodified lines
606609 int i, ret = 0;
607610
608611 /* Fail open, if a module is going away */
609− mutex_lock(&punit_misc_dev_lock);
612+ mutex_lock(&punit_misc_dev_open_lock);
610613 for (i = 0; i < ISST_IF_DEV_MAX; ++i) {
611614 struct isst_if_cmd_cb *cb = &punit_callbacks[i];
612615
@@ -628,7 +631,7 @@ static int isst_if_open(struct inode *inode, struct file *file) · 15 unmodified lines
628631 } else {
629632 misc_device_open++;
630633 }
631− mutex_unlock(&punit_misc_dev_lock);
634+ mutex_unlock(&punit_misc_dev_open_lock);
632635
633636 return ret;
634637 }
@@ -637,7 +640,7 @@ static int isst_if_relase(struct inode *inode, struct file *f) · 2 unmodified lines
637640 {
638641 int i;
639642
640− mutex_lock(&punit_misc_dev_lock);
643+ mutex_lock(&punit_misc_dev_open_lock);
641644 misc_device_open--;
642645 for (i = 0; i < ISST_IF_DEV_MAX; ++i) {
643646 struct isst_if_cmd_cb *cb = &punit_callbacks[i];
@@ -645,7 +648,7 @@ static int isst_if_relase(struct inode *inode, struct file *f) · 1 unmodified line
645648 if (cb->registered)
646649 module_put(cb->owner);
647650 }
648− mutex_unlock(&punit_misc_dev_lock);
651+ mutex_unlock(&punit_misc_dev_open_lock);
649652
650653 return 0;
651654 }
@@ -662,6 +665,43 @@ static struct miscdevice isst_if_char_driver = { · 10 unmodified lines
662665 .fops = &isst_if_char_driver_ops,
663666 };
664667
668+static int isst_misc_reg(void)
669+{
670+ mutex_lock(&punit_misc_dev_reg_lock);
671+ if (misc_device_ret)
672+ goto unlock_exit;
673+
674+ if (!misc_usage_count) {
675+ misc_device_ret = isst_if_cpu_info_init();
676+ if (misc_device_ret)
677+ goto unlock_exit;
678+
679+ misc_device_ret = misc_register(&isst_if_char_driver);
680+ if (misc_device_ret) {
681+ isst_if_cpu_info_exit();
682+ goto unlock_exit;
683+ }
684+ }
685+ misc_usage_count++;
686+
687+unlock_exit:
688+ mutex_unlock(&punit_misc_dev_reg_lock);
689+
690+ return misc_device_ret;
691+}
692+
693+static void isst_misc_unreg(void)
694+{
695+ mutex_lock(&punit_misc_dev_reg_lock);
696+ if (misc_usage_count)
697+ misc_usage_count--;
698+ if (!misc_usage_count && !misc_device_ret) {
699+ misc_deregister(&isst_if_char_driver);
700+ isst_if_cpu_info_exit();
701+ }
702+ mutex_unlock(&punit_misc_dev_reg_lock);
703+}
704+
665705 /**
666706 * isst_if_cdev_register() - Register callback for IOCTL
667707 * @device_type: The device type this callback handling.
@@ -679,38 +719,31 @@ static struct miscdevice isst_if_char_driver = { · 11 unmodified lines
679719 */
680720 int isst_if_cdev_register(int device_type, struct isst_if_cmd_cb *cb)
681721 {
682− if (misc_device_ret)
683− return misc_device_ret;
722+ int ret;
684723
685724 if (device_type >= ISST_IF_DEV_MAX)
686725 return -EINVAL;
687726
688− mutex_lock(&punit_misc_dev_lock);
727+ mutex_lock(&punit_misc_dev_open_lock);
728+ /* Device is already open, we don't want to add new callbacks */
689729 if (misc_device_open) {
690− mutex_unlock(&punit_misc_dev_lock);
730+ mutex_unlock(&punit_misc_dev_open_lock);
691731 return -EAGAIN;
692732 }
693− if (!misc_usage_count) {
694− int ret;
695−
696− misc_device_ret = misc_register(&isst_if_char_driver);
697− if (misc_device_ret)
698− goto unlock_exit;
699−
700− ret = isst_if_cpu_info_init();
701− if (ret) {
702− misc_deregister(&isst_if_char_driver);
703− misc_device_ret = ret;
704− goto unlock_exit;
705− }
706− }
707733 memcpy(&punit_callbacks[device_type], cb, sizeof(*cb));
708734 punit_callbacks[device_type].registered = 1;
709− misc_usage_count++;
710−unlock_exit:
711− mutex_unlock(&punit_misc_dev_lock);
735+ mutex_unlock(&punit_misc_dev_open_lock);
712736
713− return misc_device_ret;
737+ ret = isst_misc_reg();
738+ if (ret) {
739+ /*
740+ * No need of mutex as the misc device register failed
741+ * as no one can open device yet. Hence no contention.
742+ */
743+ punit_callbacks[device_type].registered = 0;
744+ return ret;
745+ }
746+ return 0;
714747 }
715748 EXPORT_SYMBOL_GPL(isst_if_cdev_register);
716749
@@ -725,16 +758,12 @@ EXPORT_SYMBOL_GPL(isst_if_cdev_register); · 8 unmodified lines
725758 */
726759 void isst_if_cdev_unregister(int device_type)
727760 {
728− mutex_lock(&punit_misc_dev_lock);
729− misc_usage_count--;
761+ isst_misc_unreg();
762+ mutex_lock(&punit_misc_dev_open_lock);
730763 punit_callbacks[device_type].registered = 0;
731764 if (device_type == ISST_IF_DEV_MBOX)
732765 isst_delete_hash();
733− if (!misc_usage_count && !misc_device_ret) {
734− misc_deregister(&isst_if_char_driver);
735− isst_if_cpu_info_exit();
736− }
737− mutex_unlock(&punit_misc_dev_lock);
766+ mutex_unlock(&punit_misc_dev_open_lock);
738767 }
739768 EXPORT_SYMBOL_GPL(isst_if_cdev_unregister);
740769
drivers/platform/x86/thinkpad_acpi.c+22−3
@@ -8679,9 +8679,10 @@ static const struct attribute_group fan_driver_attr_group = { · 8678 unmodified lines
86798679 .attrs = fan_driver_attributes,
86808680 };
86818681
8682−#define TPACPI_FAN_Q1 0x0001 /* Unitialized HFSP */
8683−#define TPACPI_FAN_2FAN 0x0002 /* EC 0x31 bit 0 selects fan2 */
8684−#define TPACPI_FAN_2CTL 0x0004 /* selects fan2 control */
8682+#define TPACPI_FAN_Q1 0x0001 /* Uninitialized HFSP */
8683+#define TPACPI_FAN_2FAN 0x0002 /* EC 0x31 bit 0 selects fan2 */
8684+#define TPACPI_FAN_2CTL 0x0004 /* selects fan2 control */
8685+#define TPACPI_FAN_NOFAN 0x0008 /* no fan available */
86858686
86868687 static const struct tpacpi_quirk fan_quirk_table[] __initconst = {
86878688 TPACPI_QEC_IBM('1', 'Y', TPACPI_FAN_Q1),
@@ -8702,6 +8703,7 @@ static const struct tpacpi_quirk fan_quirk_table[] __initconst = { · 14 unmodified lines
87028703 TPACPI_Q_LNV3('N', '4', '0', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (4nd gen) */
87038704 TPACPI_Q_LNV3('N', '3', '0', TPACPI_FAN_2CTL), /* P15 (1st gen) / P15v (1st gen) */
87048705 TPACPI_Q_LNV3('N', '3', '2', TPACPI_FAN_2CTL), /* X1 Carbon (9th gen) */
8706+ TPACPI_Q_LNV3('N', '1', 'O', TPACPI_FAN_NOFAN), /* X1 Tablet (2nd gen) */
87058707 };
87068708
87078709 static int __init fan_init(struct ibm_init_struct *iibm)
@@ -8730,6 +8732,11 @@ static int __init fan_init(struct ibm_init_struct *iibm) · 22 unmodified lines
87308732 quirks = tpacpi_check_quirks(fan_quirk_table,
87318733 ARRAY_SIZE(fan_quirk_table));
87328734
8735+ if (quirks & TPACPI_FAN_NOFAN) {
8736+ pr_info("No integrated ThinkPad fan available\n");
8737+ return -ENODEV;
8738+ }
8739+
87338740 if (gfan_handle) {
87348741 /* 570, 600e/x, 770e, 770x */
87358742 fan_status_access_mode = TPACPI_FAN_RD_ACPI_GFAN;
@@ -10112,6 +10119,9 @@ static struct ibm_struct proxsensor_driver_data = { · 1376 unmodified lines
1011210119 #define DYTC_CMD_MMC_GET 8 /* To get current MMC function and mode */
1011310120 #define DYTC_CMD_RESET 0x1ff /* To reset back to default */
1011410121
10122+#define DYTC_CMD_FUNC_CAP 3 /* To get DYTC capabilities */
10123+#define DYTC_FC_MMC 27 /* MMC Mode supported */
10124+
1011510125 #define DYTC_GET_FUNCTION_BIT 8 /* Bits 8-11 - function setting */
1011610126 #define DYTC_GET_MODE_BIT 12 /* Bits 12-15 - mode setting */
1011710127
@@ -10324,6 +10334,15 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) · 206 unmodified lines
1032410334 if (dytc_version < 5)
1032510335 return -ENODEV;
1032610336
10337+ /* Check what capabilities are supported. Currently MMC is needed */
10338+ err = dytc_command(DYTC_CMD_FUNC_CAP, &output);
10339+ if (err)
10340+ return err;
10341+ if (!(output & BIT(DYTC_FC_MMC))) {
10342+ dbg_printk(TPACPI_DBG_INIT, " DYTC MMC mode not supported\n");
10343+ return -ENODEV;
10344+ }
10345+
1032710346 dbg_printk(TPACPI_DBG_INIT,
1032810347 "DYTC version %d: thermal mode available\n", dytc_version);
1032910348 /*
drivers/platform/x86/touchscreen_dmi.c+24−0
@@ -770,6 +770,21 @@ static const struct ts_dmi_data predia_basic_data = { · 769 unmodified lines
770770 .properties = predia_basic_props,
771771 };
772772
773+static const struct property_entry rwc_nanote_p8_props[] = {
774+ PROPERTY_ENTRY_U32("touchscreen-min-y", 46),
775+ PROPERTY_ENTRY_U32("touchscreen-size-x", 1728),
776+ PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
777+ PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
778+ PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-rwc-nanote-p8.fw"),
779+ PROPERTY_ENTRY_U32("silead,max-fingers", 10),
780+ { }
781+};
782+
783+static const struct ts_dmi_data rwc_nanote_p8_data = {
784+ .acpi_name = "MSSL1680:00",
785+ .properties = rwc_nanote_p8_props,
786+};
787+
773788 static const struct property_entry schneider_sct101ctm_props[] = {
774789 PROPERTY_ENTRY_U32("touchscreen-size-x", 1715),
775790 PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
@@ -1394,6 +1409,15 @@ const struct dmi_system_id touchscreen_dmi_table[] = { · 618 unmodified lines
13941409 DMI_EXACT_MATCH(DMI_BOARD_NAME, "0E57"),
13951410 },
13961411 },
1412+ {
1413+ /* RWC NANOTE P8 */
1414+ .driver_data = (void *)&rwc_nanote_p8_data,
1415+ .matches = {
1416+ DMI_MATCH(DMI_BOARD_VENDOR, "Default string"),
1417+ DMI_MATCH(DMI_PRODUCT_NAME, "AY07J"),
1418+ DMI_MATCH(DMI_PRODUCT_SKU, "0001")
1419+ },
1420+ },
13971421 {
13981422 /* Schneider SCT101CTM */
13991423 .driver_data = (void *)&schneider_sct101ctm_data,
drivers/platform/x86/x86-android-tablets.c+95−10
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 #include <linux/string.h>
2727 /* For gpio_get_desc() which is EXPORT_SYMBOL_GPL() */
2828 #include "../../gpio/gpiolib.h"
29+#include "../../gpio/gpiolib-acpi.h"
2930
3031 /*
3132 * Helper code to get Linux IRQ numbers given a description of the IRQ source
@@ -47,7 +48,7 @@ struct x86_acpi_irq_data { · 15 unmodified lines
4748 int polarity; /* ACPI_ACTIVE_HIGH / ACPI_ACTIVE_LOW / ACPI_ACTIVE_BOTH */
4849 };
4950
50−static int x86_acpi_irq_helper_gpiochip_find(struct gpio_chip *gc, void *data)
51+static int gpiochip_find_match_label(struct gpio_chip *gc, void *data)
5152 {
5253 return gc->label && !strcmp(gc->label, data);
5354 }
@@ -73,7 +74,7 @@ static int x86_acpi_irq_helper_get(const struct x86_acpi_irq_data *data) · 19 unmodified lines
7374 return irq;
7475 case X86_ACPI_IRQ_TYPE_GPIOINT:
7576 /* Like acpi_dev_gpio_irq_get(), but without parsing ACPI resources */
76− chip = gpiochip_find(data->chip, x86_acpi_irq_helper_gpiochip_find);
77+ chip = gpiochip_find(data->chip, gpiochip_find_match_label);
7778 if (!chip) {
7879 pr_err("error cannot find GPIO chip %s\n", data->chip);
7980 return -ENODEV;
@@ -143,14 +144,17 @@ struct x86_serdev_info { · 63 unmodified lines
143144 };
144145
145146 struct x86_dev_info {
147+ char *invalid_aei_gpiochip;
146148 const char * const *modules;
147− struct gpiod_lookup_table **gpiod_lookup_tables;
149+ struct gpiod_lookup_table * const *gpiod_lookup_tables;
148150 const struct x86_i2c_client_info *i2c_client_info;
149151 const struct platform_device_info *pdev_info;
150152 const struct x86_serdev_info *serdev_info;
151153 int i2c_client_count;
152154 int pdev_count;
153155 int serdev_count;
156+ int (*init)(void);
157+ void (*exit)(void);
154158 };
155159
156160 /* Generic / shared bq24190 settings */
@@ -187,8 +191,8 @@ static struct bq24190_platform_data bq24190_pdata = { · 30 unmodified lines
187191 };
188192
189193 static const char * const bq24190_modules[] __initconst = {
190− "crystal_cove_charger", /* For the bq24190 IRQ */
191− "bq24190_charger", /* For the Vbus regulator for intel-int3496 */
194+ "intel_crystal_cove_charger", /* For the bq24190 IRQ */
195+ "bq24190_charger", /* For the Vbus regulator for intel-int3496 */
192196 NULL
193197 };
194198
@@ -302,7 +306,7 @@ static struct gpiod_lookup_table asus_me176c_goodix_gpios = { · 107 unmodified lines
302306 },
303307 };
304308
305−static struct gpiod_lookup_table *asus_me176c_gpios[] = {
309+static struct gpiod_lookup_table * const asus_me176c_gpios[] = {
306310 &int3496_gpo2_pin22_gpios,
307311 &asus_me176c_goodix_gpios,
308312 NULL
@@ -317,6 +321,7 @@ static const struct x86_dev_info asus_me176c_info __initconst = { · 8 unmodified lines
317321 .serdev_count = ARRAY_SIZE(asus_me176c_serdevs),
318322 .gpiod_lookup_tables = asus_me176c_gpios,
319323 .modules = bq24190_modules,
324+ .invalid_aei_gpiochip = "INT33FC:02",
320325 };
321326
322327 /* Asus TF103C tablets have an Android factory img with everything hardcoded */
@@ -405,7 +410,7 @@ static const struct x86_i2c_client_info asus_tf103c_i2c_clients[] __initconst = · 82 unmodified lines
405410 },
406411 };
407412
408−static struct gpiod_lookup_table *asus_tf103c_gpios[] = {
413+static struct gpiod_lookup_table * const asus_tf103c_gpios[] = {
409414 &int3496_gpo2_pin22_gpios,
410415 NULL
411416 };
@@ -417,6 +422,7 @@ static const struct x86_dev_info asus_tf103c_info __initconst = { · 5 unmodified lines
417422 .pdev_count = ARRAY_SIZE(int3496_pdevs),
418423 .gpiod_lookup_tables = asus_tf103c_gpios,
419424 .modules = bq24190_modules,
425+ .invalid_aei_gpiochip = "INT33FC:02",
420426 };
421427
422428 /*
@@ -490,6 +496,39 @@ static const struct x86_dev_info chuwi_hi8_info __initconst = { · 67 unmodified lines
490496 .i2c_client_count = ARRAY_SIZE(chuwi_hi8_i2c_clients),
491497 };
492498
499+#define CZC_EC_EXTRA_PORT 0x68
500+#define CZC_EC_ANDROID_KEYS 0x63
501+
502+static int __init czc_p10t_init(void)
503+{
504+ /*
505+ * The device boots up in "Windows 7" mode, when the home button sends a
506+ * Windows specific key sequence (Left Meta + D) and the second button
507+ * sends an unknown one while also toggling the Radio Kill Switch.
508+ * This is a surprising behavior when the second button is labeled "Back".
509+ *
510+ * The vendor-supplied Android-x86 build switches the device to a "Android"
511+ * mode by writing value 0x63 to the I/O port 0x68. This just seems to just
512+ * set bit 6 on address 0x96 in the EC region; switching the bit directly
513+ * seems to achieve the same result. It uses a "p10t_switcher" to do the
514+ * job. It doesn't seem to be able to do anything else, and no other use
515+ * of the port 0x68 is known.
516+ *
517+ * In the Android mode, the home button sends just a single scancode,
518+ * which can be handled in Linux userspace more reasonably and the back
519+ * button only sends a scancode without toggling the kill switch.
520+ * The scancode can then be mapped either to Back or RF Kill functionality
521+ * in userspace, depending on how the button is labeled on that particular
522+ * model.
523+ */
524+ outb(CZC_EC_ANDROID_KEYS, CZC_EC_EXTRA_PORT);
525+ return 0;
526+}
527+
528+static const struct x86_dev_info czc_p10t __initconst = {
529+ .init = czc_p10t_init,
530+};
531+
493532 /*
494533 * Whitelabel (sold as various brands) TM800A550L tablets.
495534 * These tablet's DSDT contains a whole bunch of bogus ACPI I2C devices
@@ -559,7 +598,7 @@ static struct gpiod_lookup_table whitelabel_tm800a550l_goodix_gpios = { · 63 unmodified lines
559598 },
560599 };
561600
562−static struct gpiod_lookup_table *whitelabel_tm800a550l_gpios[] = {
601+static struct gpiod_lookup_table * const whitelabel_tm800a550l_gpios[] = {
563602 &whitelabel_tm800a550l_goodix_gpios,
564603 NULL
565604 };
@@ -641,6 +680,24 @@ static const struct dmi_system_id x86_android_tablet_ids[] __initconst = { · 75 unmodified lines
641680 },
642681 .driver_data = (void *)&chuwi_hi8_info,
643682 },
683+ {
684+ /* CZC P10T */
685+ .ident = "CZC ODEON TPC-10 (\"P10T\")",
686+ .matches = {
687+ DMI_MATCH(DMI_SYS_VENDOR, "CZC"),
688+ DMI_MATCH(DMI_PRODUCT_NAME, "ODEON*TPC-10"),
689+ },
690+ .driver_data = (void *)&czc_p10t,
691+ },
692+ {
693+ /* A variant of CZC P10T */
694+ .ident = "ViewSonic ViewPad 10",
695+ .matches = {
696+ DMI_MATCH(DMI_SYS_VENDOR, "ViewSonic"),
697+ DMI_MATCH(DMI_PRODUCT_NAME, "VPAD10"),
698+ },
699+ .driver_data = (void *)&czc_p10t,
700+ },
644701 {
645702 /* Whitelabel (sold as various brands) TM800A550L */
646703 .matches = {
@@ -669,7 +726,8 @@ static int serdev_count; · 22 unmodified lines
669726 static struct i2c_client **i2c_clients;
670727 static struct platform_device **pdevs;
671728 static struct serdev_device **serdevs;
672−static struct gpiod_lookup_table **gpiod_lookup_tables;
729+static struct gpiod_lookup_table * const *gpiod_lookup_tables;
730+static void (*exit_handler)(void);
673731
674732 static __init int x86_instantiate_i2c_client(const struct x86_dev_info *dev_info,
675733 int idx)
@@ -787,6 +845,9 @@ static void x86_android_tablet_cleanup(void) · 111 unmodified lines
787845
788846 kfree(i2c_clients);
789847
848+ if (exit_handler)
849+ exit_handler();
850+
790851 for (i = 0; gpiod_lookup_tables && gpiod_lookup_tables[i]; i++)
791852 gpiod_remove_lookup_table(gpiod_lookup_tables[i]);
792853 }
@@ -795,6 +856,7 @@ static __init int x86_android_tablet_init(void) · 2 unmodified lines
795856 {
796857 const struct x86_dev_info *dev_info;
797858 const struct dmi_system_id *id;
859+ struct gpio_chip *chip;
798860 int i, ret = 0;
799861
800862 id = dmi_first_match(x86_android_tablet_ids);
@@ -803,6 +865,20 @@ static __init int x86_android_tablet_init(void) · 2 unmodified lines
803865
804866 dev_info = id->driver_data;
805867
868+ /*
869+ * The broken DSDTs on these devices often also include broken
870+ * _AEI (ACPI Event Interrupt) handlers, disable these.
871+ */
872+ if (dev_info->invalid_aei_gpiochip) {
873+ chip = gpiochip_find(dev_info->invalid_aei_gpiochip,
874+ gpiochip_find_match_label);
875+ if (!chip) {
876+ pr_err("error cannot find GPIO chip %s\n", dev_info->invalid_aei_gpiochip);
877+ return -ENODEV;
878+ }
879+ acpi_gpiochip_free_interrupts(chip);
880+ }
881+
806882 /*
807883 * Since this runs from module_init() it cannot use -EPROBE_DEFER,
808884 * instead pre-load any modules which are listed as requirements.
@@ -814,6 +890,15 @@ static __init int x86_android_tablet_init(void) · 5 unmodified lines
814890 for (i = 0; gpiod_lookup_tables && gpiod_lookup_tables[i]; i++)
815891 gpiod_add_lookup_table(gpiod_lookup_tables[i]);
816892
893+ if (dev_info->init) {
894+ ret = dev_info->init();
895+ if (ret < 0) {
896+ x86_android_tablet_cleanup();
897+ return ret;
898+ }
899+ exit_handler = dev_info->exit;
900+ }
901+
817902 i2c_clients = kcalloc(dev_info->i2c_client_count, sizeof(*i2c_clients), GFP_KERNEL);
818903 if (!i2c_clients) {
819904 x86_android_tablet_cleanup();
@@ -865,6 +950,6 @@ static __init int x86_android_tablet_init(void) · 45 unmodified lines
865950 module_init(x86_android_tablet_init);
866951 module_exit(x86_android_tablet_cleanup);
867952
868−MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com");
953+MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
869954 MODULE_DESCRIPTION("X86 Android tablets DSDT fixups driver");
870955 MODULE_LICENSE("GPL");
drivers/regulator/max20086-regulator.c+2−1
@@ -7,6 +7,7 @@ · 6 unmodified lines
77
88 #include <linux/err.h>
99 #include <linux/gpio.h>
10+#include <linux/gpio/consumer.h>
1011 #include <linux/i2c.h>
1112 #include <linux/module.h>
1213 #include <linux/regmap.h>
@@ -140,7 +141,7 @@ static int max20086_parse_regulators_dt(struct max20086 *chip, bool *boot_on) · 127 unmodified lines
140141 node = of_get_child_by_name(chip->dev->of_node, "regulators");
141142 if (!node) {
142143 dev_err(chip->dev, "regulators node not found\n");
143− return PTR_ERR(node);
144+ return -ENODEV;
144145 }
145146
146147 for (i = 0; i < chip->info->num_outputs; ++i)
drivers/s390/scsi/zfcp_fc.c+12−1
@@ -521,6 +521,8 @@ static void zfcp_fc_adisc_handler(void *data) · 520 unmodified lines
521521 goto out;
522522 }
523523
524+ /* re-init to undo drop from zfcp_fc_adisc() */
525+ port->d_id = ntoh24(adisc_resp->adisc_port_id);
524526 /* port is good, unblock rport without going through erp */
525527 zfcp_scsi_schedule_rport_register(port);
526528 out:
@@ -534,6 +536,7 @@ static int zfcp_fc_adisc(struct zfcp_port *port) · 7 unmodified lines
534536 struct zfcp_fc_req *fc_req;
535537 struct zfcp_adapter *adapter = port->adapter;
536538 struct Scsi_Host *shost = adapter->scsi_host;
539+ u32 d_id;
537540 int ret;
538541
539542 fc_req = kmem_cache_zalloc(zfcp_fc_req_cache, GFP_ATOMIC);
@@ -558,7 +561,15 @@ static int zfcp_fc_adisc(struct zfcp_port *port) · 18 unmodified lines
558561 fc_req->u.adisc.req.adisc_cmd = ELS_ADISC;
559562 hton24(fc_req->u.adisc.req.adisc_port_id, fc_host_port_id(shost));
560563
561− ret = zfcp_fsf_send_els(adapter, port->d_id, &fc_req->ct_els,
564+ d_id = port->d_id; /* remember as destination for send els below */
565+ /*
566+ * Force fresh GID_PN lookup on next port recovery.
567+ * Must happen after request setup and before sending request,
568+ * to prevent race with port->d_id re-init in zfcp_fc_adisc_handler().
569+ */
570+ port->d_id = 0;
571+
572+ ret = zfcp_fsf_send_els(adapter, d_id, &fc_req->ct_els,
562573 ZFCP_FC_CTELS_TMO);
563574 if (ret)
564575 kmem_cache_free(zfcp_fc_req_cache, fc_req);
drivers/scsi/3w-sas.c+0−4
@@ -1567,8 +1567,6 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) · 1566 unmodified lines
15671567 pci_try_set_mwi(pdev);
15681568
15691569 retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
1570− if (retval)
1571− retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
15721570 if (retval) {
15731571 TW_PRINTK(host, TW_DRIVER, 0x18, "Failed to set dma mask");
15741572 retval = -ENODEV;
@@ -1786,8 +1784,6 @@ static int __maybe_unused twl_resume(struct device *dev) · 211 unmodified lines
17861784 pci_try_set_mwi(pdev);
17871785
17881786 retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
1789− if (retval)
1790− retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
17911787 if (retval) {
17921788 TW_PRINTK(host, TW_DRIVER, 0x25, "Failed to set dma mask during resume");
17931789 retval = -ENODEV;
drivers/scsi/53c700.c+0−1
@@ -1507,7 +1507,6 @@ NCR_700_intr(int irq, void *dev_id) · 1506 unmodified lines
15071507 struct scsi_cmnd *SCp = hostdata->cmd;
15081508
15091509 handled = 1;
1510− SCp = hostdata->cmd;
15111510
15121511 if(istat & SCSI_INT_PENDING) {
15131512 udelay(10);
drivers/scsi/bfa/bfad.c+0−6
@@ -732,9 +732,6 @@ bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad) · 731 unmodified lines
732732 pci_set_master(pdev);
733733
734734 rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
735− if (rc)
736− rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
737−
738735 if (rc) {
739736 rc = -ENODEV;
740737 printk(KERN_ERR "dma_set_mask_and_coherent fail %p\n", pdev);
@@ -1559,9 +1556,6 @@ bfad_pci_slot_reset(struct pci_dev *pdev) · 818 unmodified lines
15591556 pci_set_master(pdev);
15601557
15611558 rc = dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(64));
1562− if (rc)
1563− rc = dma_set_mask_and_coherent(&bfad->pcidev->dev,
1564− DMA_BIT_MASK(32));
15651559 if (rc)
15661560 goto out_disable_device;
15671561
drivers/scsi/bnx2fc/bnx2fc_fcoe.c+5−15
@@ -82,7 +82,7 @@ static int bnx2fc_bind_pcidev(struct bnx2fc_hba *hba); · 81 unmodified lines
8282 static void bnx2fc_unbind_pcidev(struct bnx2fc_hba *hba);
8383 static struct fc_lport *bnx2fc_if_create(struct bnx2fc_interface *interface,
8484 struct device *parent, int npiv);
85−static void bnx2fc_destroy_work(struct work_struct *work);
85+static void bnx2fc_port_destroy(struct fcoe_port *port);
8686
8787 static struct bnx2fc_hba *bnx2fc_hba_lookup(struct net_device *phys_dev);
8888 static struct bnx2fc_interface *bnx2fc_interface_lookup(struct net_device
@@ -907,9 +907,6 @@ static void bnx2fc_indicate_netevent(void *context, unsigned long event, · 818 unmodified lines
907907 __bnx2fc_destroy(interface);
908908 }
909909 mutex_unlock(&bnx2fc_dev_lock);
910−
911− /* Ensure ALL destroy work has been completed before return */
912− flush_workqueue(bnx2fc_wq);
913910 return;
914911
915912 default:
@@ -1215,8 +1212,8 @@ static int bnx2fc_vport_destroy(struct fc_vport *vport) · 299 unmodified lines
12151212 mutex_unlock(&n_port->lp_mutex);
12161213 bnx2fc_free_vport(interface->hba, port->lport);
12171214 bnx2fc_port_shutdown(port->lport);
1215+ bnx2fc_port_destroy(port);
12181216 bnx2fc_interface_put(interface);
1219− queue_work(bnx2fc_wq, &port->destroy_work);
12201217 return 0;
12211218 }
12221219
@@ -1525,7 +1522,6 @@ static struct fc_lport *bnx2fc_if_create(struct bnx2fc_interface *interface, · 302 unmodified lines
15251522 port->lport = lport;
15261523 port->priv = interface;
15271524 port->get_netdev = bnx2fc_netdev;
1528− INIT_WORK(&port->destroy_work, bnx2fc_destroy_work);
15291525
15301526 /* Configure fcoe_port */
15311527 rc = bnx2fc_lport_config(lport);
@@ -1653,8 +1649,8 @@ static void __bnx2fc_destroy(struct bnx2fc_interface *interface) · 121 unmodified lines
16531649 bnx2fc_interface_cleanup(interface);
16541650 bnx2fc_stop(interface);
16551651 list_del(&interface->list);
1652+ bnx2fc_port_destroy(port);
16561653 bnx2fc_interface_put(interface);
1657− queue_work(bnx2fc_wq, &port->destroy_work);
16581654 }
16591655
16601656 /**
@@ -1694,15 +1690,12 @@ netdev_err: · 33 unmodified lines
16941690 return rc;
16951691 }
16961692
1697−static void bnx2fc_destroy_work(struct work_struct *work)
1693+static void bnx2fc_port_destroy(struct fcoe_port *port)
16981694 {
1699− struct fcoe_port *port;
17001695 struct fc_lport *lport;
17011696
1702− port = container_of(work, struct fcoe_port, destroy_work);
17031697 lport = port->lport;
1704−
1705− BNX2FC_HBA_DBG(lport, "Entered bnx2fc_destroy_work\n");
1698+ BNX2FC_HBA_DBG(lport, "Entered %s, destroying lport %p\n", __func__, lport);
17061699
17071700 bnx2fc_if_destroy(lport);
17081701 }
@@ -2556,9 +2549,6 @@ static void bnx2fc_ulp_exit(struct cnic_dev *dev) · 847 unmodified lines
25562549 __bnx2fc_destroy(interface);
25572550 mutex_unlock(&bnx2fc_dev_lock);
25582551
2559− /* Ensure ALL destroy work has been completed before return */
2560− flush_workqueue(bnx2fc_wq);
2561−
25622552 bnx2fc_ulp_stop(hba);
25632553 /* unregister cnic device */
25642554 if (test_and_clear_bit(BNX2FC_CNIC_REGISTERED, &hba->reg_with_cnic))
drivers/scsi/elx/libefc/efc_els.c+2−6
@@ -46,18 +46,14 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen) · 45 unmodified lines
4646
4747 efc = node->efc;
4848
49− spin_lock_irqsave(&node->els_ios_lock, flags);
50−
5149 if (!node->els_io_enabled) {
5250 efc_log_err(efc, "els io alloc disabled\n");
53− spin_unlock_irqrestore(&node->els_ios_lock, flags);
5451 return NULL;
5552 }
5653
5754 els = mempool_alloc(efc->els_io_pool, GFP_ATOMIC);
5855 if (!els) {
5956 atomic_add_return(1, &efc->els_io_alloc_failed_count);
60− spin_unlock_irqrestore(&node->els_ios_lock, flags);
6157 return NULL;
6258 }
6359
@@ -74,7 +70,6 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen) · 10 unmodified lines
7470 &els->io.req.phys, GFP_KERNEL);
7571 if (!els->io.req.virt) {
7672 mempool_free(els, efc->els_io_pool);
77− spin_unlock_irqrestore(&node->els_ios_lock, flags);
7873 return NULL;
7974 }
8075
@@ -94,10 +89,11 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen) · 13 unmodified lines
9489
9590 /* add els structure to ELS IO list */
9691 INIT_LIST_HEAD(&els->list_entry);
92+ spin_lock_irqsave(&node->els_ios_lock, flags);
9793 list_add_tail(&els->list_entry, &node->els_ios_list);
94+ spin_unlock_irqrestore(&node->els_ios_lock, flags);
9895 }
9996
100− spin_unlock_irqrestore(&node->els_ios_lock, flags);
10197 return els;
10298 }
10399
drivers/scsi/hisi_sas/hisi_sas_main.c+0−3
@@ -2666,9 +2666,6 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev, · 2665 unmodified lines
26662666 goto err_out;
26672667
26682668 error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
2669− if (error)
2670− error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
2671−
26722669 if (error) {
26732670 dev_err(dev, "No usable DMA addressing method\n");
26742671 goto err_out;
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c+0−2
@@ -4695,8 +4695,6 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 4694 unmodified lines
46954695 goto err_out;
46964696
46974697 rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
4698− if (rc)
4699− rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
47004698 if (rc) {
47014699 dev_err(dev, "No usable DMA addressing method\n");
47024700 rc = -ENODEV;
drivers/scsi/myrs.c+2−1
@@ -2267,7 +2267,8 @@ static void myrs_cleanup(struct myrs_hba *cs) · 2266 unmodified lines
22672267 myrs_unmap(cs);
22682268
22692269 if (cs->mmio_base) {
2270− cs->disable_intr(cs);
2270+ if (cs->disable_intr)
2271+ cs->disable_intr(cs);
22712272 iounmap(cs->mmio_base);
22722273 cs->mmio_base = NULL;
22732274 }
drivers/scsi/pm8001/pm80xx_hwi.c+14−2
@@ -4151,10 +4151,22 @@ static int process_oq(struct pm8001_hba_info *pm8001_ha, u8 vec) · 4150 unmodified lines
41514151 u32 ret = MPI_IO_STATUS_FAIL;
41524152 u32 regval;
41534153
4154+ /*
4155+ * Fatal errors are programmed to be signalled in irq vector
4156+ * pm8001_ha->max_q_num - 1 through pm8001_ha->main_cfg_tbl.pm80xx_tbl.
4157+ * fatal_err_interrupt
4158+ */
41544159 if (vec == (pm8001_ha->max_q_num - 1)) {
4160+ u32 mipsall_ready;
4161+
4162+ if (pm8001_ha->chip_id == chip_8008 ||
4163+ pm8001_ha->chip_id == chip_8009)
4164+ mipsall_ready = SCRATCH_PAD_MIPSALL_READY_8PORT;
4165+ else
4166+ mipsall_ready = SCRATCH_PAD_MIPSALL_READY_16PORT;
4167+
41554168 regval = pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_1);
4156− if ((regval & SCRATCH_PAD_MIPSALL_READY) !=
4157− SCRATCH_PAD_MIPSALL_READY) {
4169+ if ((regval & mipsall_ready) != mipsall_ready) {
41584170 pm8001_ha->controller_fatal_error = true;
41594171 pm8001_dbg(pm8001_ha, FAIL,
41604172 "Firmware Fatal error! Regval:0x%x\n",
drivers/scsi/pm8001/pm80xx_hwi.h+5−1
@@ -1405,8 +1405,12 @@ typedef struct SASProtocolTimerConfig SASProtocolTimerConfig_t; · 1404 unmodified lines
14051405 #define SCRATCH_PAD_BOOT_LOAD_SUCCESS 0x0
14061406 #define SCRATCH_PAD_IOP0_READY 0xC00
14071407 #define SCRATCH_PAD_IOP1_READY 0x3000
1408−#define SCRATCH_PAD_MIPSALL_READY (SCRATCH_PAD_IOP1_READY | \
1408+#define SCRATCH_PAD_MIPSALL_READY_16PORT (SCRATCH_PAD_IOP1_READY | \
14091409 SCRATCH_PAD_IOP0_READY | \
1410+ SCRATCH_PAD_ILA_READY | \
1411+ SCRATCH_PAD_RAAE_READY)
1412+#define SCRATCH_PAD_MIPSALL_READY_8PORT (SCRATCH_PAD_IOP0_READY | \
1413+ SCRATCH_PAD_ILA_READY | \
14101414 SCRATCH_PAD_RAAE_READY)
14111415
14121416 /* boot loader state */
drivers/scsi/qedf/qedf_io.c+1−0
@@ -2250,6 +2250,7 @@ process_els: · 2249 unmodified lines
22502250 io_req->tm_flags == FCP_TMF_TGT_RESET) {
22512251 clear_bit(QEDF_CMD_OUTSTANDING, &io_req->flags);
22522252 io_req->sc_cmd = NULL;
2253+ kref_put(&io_req->refcount, qedf_release_cmd);
22532254 complete(&io_req->tm_done);
22542255 }
22552256
drivers/scsi/qedf/qedf_main.c+5−2
@@ -911,7 +911,7 @@ void qedf_ctx_soft_reset(struct fc_lport *lport) · 910 unmodified lines
911911 struct qed_link_output if_link;
912912
913913 if (lport->vport) {
914− QEDF_ERR(NULL, "Cannot issue host reset on NPIV port.\n");
914+ printk_ratelimited("Cannot issue host reset on NPIV port.\n");
915915 return;
916916 }
917917
@@ -1864,6 +1864,7 @@ static int qedf_vport_create(struct fc_vport *vport, bool disabled) · 946 unmodified lines
18641864 vport_qedf->cmd_mgr = base_qedf->cmd_mgr;
18651865 init_completion(&vport_qedf->flogi_compl);
18661866 INIT_LIST_HEAD(&vport_qedf->fcports);
1867+ INIT_DELAYED_WORK(&vport_qedf->stag_work, qedf_stag_change_work);
18671868
18681869 rc = qedf_vport_libfc_config(vport, vn_port);
18691870 if (rc) {
@@ -3980,7 +3981,9 @@ void qedf_stag_change_work(struct work_struct *work) · 2110 unmodified lines
39803981 struct qedf_ctx *qedf =
39813982 container_of(work, struct qedf_ctx, stag_work.work);
39823983
3983− QEDF_ERR(&qedf->dbg_ctx, "Performing software context reset.\n");
3984+ printk_ratelimited("[%s]:[%s:%d]:%d: Performing software context reset.",
3985+ dev_name(&qedf->pdev->dev), __func__, __LINE__,
3986+ qedf->dbg_ctx.host_no);
39843987 qedf_ctx_soft_reset(qedf->lport);
39853988 }
39863989
drivers/scsi/ufs/ufshcd-pltfrm.c+7−0
@@ -92,6 +92,11 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba) · 91 unmodified lines
9292 clki->min_freq = clkfreq[i];
9393 clki->max_freq = clkfreq[i+1];
9494 clki->name = devm_kstrdup(dev, name, GFP_KERNEL);
95+ if (!clki->name) {
96+ ret = -ENOMEM;
97+ goto out;
98+ }
99+
95100 if (!strcmp(name, "ref_clk"))
96101 clki->keep_link_active = true;
97102 dev_dbg(dev, "%s: min %u max %u name %s\n", "freq-table-hz",
@@ -127,6 +132,8 @@ static int ufshcd_populate_vreg(struct device *dev, const char *name, · 29 unmodified lines
127132 return -ENOMEM;
128133
129134 vreg->name = devm_kstrdup(dev, name, GFP_KERNEL);
135+ if (!vreg->name)
136+ return -ENOMEM;
130137
131138 snprintf(prop_name, MAX_PROP_SIZE, "%s-max-microamp", name);
132139 if (of_property_read_u32(np, prop_name, &vreg->max_uA)) {
drivers/scsi/ufs/ufshcd.c+6−3
@@ -8613,7 +8613,7 @@ static void ufshcd_hba_exit(struct ufs_hba *hba) · 8612 unmodified lines
86138613 * @pwr_mode: device power mode to set
86148614 *
86158615 * Returns 0 if requested power mode is set successfully
8616− * Returns non-zero if failed to set the requested power mode
8616+ * Returns < 0 if failed to set the requested power mode
86178617 */
86188618 static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,
86198619 enum ufs_dev_pwr_mode pwr_mode)
@@ -8667,8 +8667,11 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, · 47 unmodified lines
86678667 sdev_printk(KERN_WARNING, sdp,
86688668 "START_STOP failed for power mode: %d, result %x\n",
86698669 pwr_mode, ret);
8670− if (ret > 0 && scsi_sense_valid(&sshdr))
8671− scsi_print_sense_hdr(sdp, NULL, &sshdr);
8670+ if (ret > 0) {
8671+ if (scsi_sense_valid(&sshdr))
8672+ scsi_print_sense_hdr(sdp, NULL, &sshdr);
8673+ ret = -EIO;
8674+ }
86728675 }
86738676
86748677 if (!ret)
drivers/scsi/ufs/ufshci.h+2−1
@@ -142,7 +142,8 @@ static inline u32 ufshci_version(u32 major, u32 minor) · 141 unmodified lines
142142 #define INT_FATAL_ERRORS (DEVICE_FATAL_ERROR |\
143143 CONTROLLER_FATAL_ERROR |\
144144 SYSTEM_BUS_FATAL_ERROR |\
145− CRYPTO_ENGINE_FATAL_ERROR)
145+ CRYPTO_ENGINE_FATAL_ERROR |\
146+ UIC_LINK_LOST)
146147
147148 /* HCS - Host Controller Status 30h */
148149 #define DEVICE_PRESENT 0x1
drivers/spi/spi-bcm-qspi.c+1−1
@@ -585,7 +585,7 @@ static void bcm_qspi_chip_select(struct bcm_qspi *qspi, int cs) · 584 unmodified lines
585585 u32 rd = 0;
586586 u32 wr = 0;
587587
588− if (qspi->base[CHIP_SELECT]) {
588+ if (cs >= 0 && qspi->base[CHIP_SELECT]) {
589589 rd = bcm_qspi_read(qspi, CHIP_SELECT, 0);
590590 wr = (rd & ~0xff) | (1 << cs);
591591 if (rd == wr)
drivers/spi/spi-meson-spicc.c+5−0
@@ -693,6 +693,11 @@ static int meson_spicc_probe(struct platform_device *pdev) · 692 unmodified lines
693693 writel_relaxed(0, spicc->base + SPICC_INTREG);
694694
695695 irq = platform_get_irq(pdev, 0);
696+ if (irq < 0) {
697+ ret = irq;
698+ goto out_master;
699+ }
700+
696701 ret = devm_request_irq(&pdev->dev, irq, meson_spicc_irq,
697702 0, NULL, spicc);
698703 if (ret) {
drivers/spi/spi-mt65xx.c+1−1
@@ -624,7 +624,7 @@ static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id) · 623 unmodified lines
624624 else
625625 mdata->state = MTK_SPI_IDLE;
626626
627− if (!master->can_dma(master, master->cur_msg->spi, trans)) {
627+ if (!master->can_dma(master, NULL, trans)) {
628628 if (trans->rx_buf) {
629629 cnt = mdata->xfer_len / 4;
630630 ioread32_rep(mdata->base + SPI_RX_DATA_REG,
drivers/spi/spi-stm32-qspi.c+17−30
@@ -688,7 +688,7 @@ static int stm32_qspi_probe(struct platform_device *pdev) · 687 unmodified lines
688688 struct resource *res;
689689 int ret, irq;
690690
691− ctrl = spi_alloc_master(dev, sizeof(*qspi));
691+ ctrl = devm_spi_alloc_master(dev, sizeof(*qspi));
692692 if (!ctrl)
693693 return -ENOMEM;
694694
@@ -697,58 +697,46 @@ static int stm32_qspi_probe(struct platform_device *pdev) · 2 unmodified lines
697697
698698 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qspi");
699699 qspi->io_base = devm_ioremap_resource(dev, res);
700− if (IS_ERR(qspi->io_base)) {
701− ret = PTR_ERR(qspi->io_base);
702− goto err_master_put;
703− }
700+ if (IS_ERR(qspi->io_base))
701+ return PTR_ERR(qspi->io_base);
704702
705703 qspi->phys_base = res->start;
706704
707705 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qspi_mm");
708706 qspi->mm_base = devm_ioremap_resource(dev, res);
709− if (IS_ERR(qspi->mm_base)) {
710− ret = PTR_ERR(qspi->mm_base);
711− goto err_master_put;
712− }
707+ if (IS_ERR(qspi->mm_base))
708+ return PTR_ERR(qspi->mm_base);
713709
714710 qspi->mm_size = resource_size(res);
715− if (qspi->mm_size > STM32_QSPI_MAX_MMAP_SZ) {
716− ret = -EINVAL;
717− goto err_master_put;
718− }
711+ if (qspi->mm_size > STM32_QSPI_MAX_MMAP_SZ)
712+ return -EINVAL;
719713
720714 irq = platform_get_irq(pdev, 0);
721− if (irq < 0) {
722− ret = irq;
723− goto err_master_put;
724− }
715+ if (irq < 0)
716+ return irq;
725717
726718 ret = devm_request_irq(dev, irq, stm32_qspi_irq, 0,
727719 dev_name(dev), qspi);
728720 if (ret) {
729721 dev_err(dev, "failed to request irq\n");
730− goto err_master_put;
722+ return ret;
731723 }
732724
733725 init_completion(&qspi->data_completion);
734726 init_completion(&qspi->match_completion);
735727
736728 qspi->clk = devm_clk_get(dev, NULL);
737− if (IS_ERR(qspi->clk)) {
738− ret = PTR_ERR(qspi->clk);
739− goto err_master_put;
740− }
729+ if (IS_ERR(qspi->clk))
730+ return PTR_ERR(qspi->clk);
741731
742732 qspi->clk_rate = clk_get_rate(qspi->clk);
743− if (!qspi->clk_rate) {
744− ret = -EINVAL;
745− goto err_master_put;
746− }
733+ if (!qspi->clk_rate)
734+ return -EINVAL;
747735
748736 ret = clk_prepare_enable(qspi->clk);
749737 if (ret) {
750738 dev_err(dev, "can not enable the clock\n");
751− goto err_master_put;
739+ return ret;
752740 }
753741
754742 rstc = devm_reset_control_get_exclusive(dev, NULL);
@@ -784,7 +772,7 @@ static int stm32_qspi_probe(struct platform_device *pdev) · 29 unmodified lines
784772 pm_runtime_enable(dev);
785773 pm_runtime_get_noresume(dev);
786774
787− ret = devm_spi_register_master(dev, ctrl);
775+ ret = spi_register_master(ctrl);
788776 if (ret)
789777 goto err_pm_runtime_free;
790778
@@ -806,8 +794,6 @@ err_dma_free: · 15 unmodified lines
806794 stm32_qspi_dma_free(qspi);
807795 err_clk_disable:
808796 clk_disable_unprepare(qspi->clk);
809−err_master_put:
810− spi_master_put(qspi->ctrl);
811797
812798 return ret;
813799 }
@@ -817,6 +803,7 @@ static int stm32_qspi_remove(struct platform_device *pdev) · 3 unmodified lines
817803 struct stm32_qspi *qspi = platform_get_drvdata(pdev);
818804
819805 pm_runtime_get_sync(qspi->dev);
806+ spi_unregister_master(qspi->ctrl);
820807 /* disable qspi */
821808 writel_relaxed(0, qspi->io_base + QSPI_CR);
822809 stm32_qspi_dma_free(qspi);
drivers/spi/spi-stm32.c+4−3
@@ -221,7 +221,6 @@ struct stm32_spi; · 220 unmodified lines
221221 * time between frames (if driver has this functionality)
222222 * @set_number_of_data: optional routine to configure registers to desired
223223 * number of data (if driver has this functionality)
224− * @can_dma: routine to determine if the transfer is eligible for DMA use
225224 * @transfer_one_dma_start: routine to start transfer a single spi_transfer
226225 * using DMA
227226 * @dma_rx_cb: routine to call after DMA RX channel operation is complete
@@ -232,7 +231,7 @@ struct stm32_spi; · 4 unmodified lines
232231 * @baud_rate_div_min: minimum baud rate divisor
233232 * @baud_rate_div_max: maximum baud rate divisor
234233 * @has_fifo: boolean to know if fifo is used for driver
235− * @has_startbit: boolean to know if start bit is used to start transfer
234+ * @flags: compatible specific SPI controller flags used at registration time
236235 */
237236 struct stm32_spi_cfg {
238237 const struct stm32_spi_regspec *regs;
@@ -253,6 +252,7 @@ struct stm32_spi_cfg { · 14 unmodified lines
253252 unsigned int baud_rate_div_min;
254253 unsigned int baud_rate_div_max;
255254 bool has_fifo;
255+ u16 flags;
256256 };
257257
258258 /**
@@ -1722,6 +1722,7 @@ static const struct stm32_spi_cfg stm32f4_spi_cfg = { · 1463 unmodified lines
17221722 .baud_rate_div_min = STM32F4_SPI_BR_DIV_MIN,
17231723 .baud_rate_div_max = STM32F4_SPI_BR_DIV_MAX,
17241724 .has_fifo = false,
1725+ .flags = SPI_MASTER_MUST_TX,
17251726 };
17261727
17271728 static const struct stm32_spi_cfg stm32h7_spi_cfg = {
@@ -1854,7 +1855,7 @@ static int stm32_spi_probe(struct platform_device *pdev) · 126 unmodified lines
18541855 master->prepare_message = stm32_spi_prepare_msg;
18551856 master->transfer_one = stm32_spi_transfer_one;
18561857 master->unprepare_message = stm32_spi_unprepare_msg;
1857− master->flags = SPI_MASTER_MUST_TX;
1858+ master->flags = spi->cfg->flags;
18581859
18591860 spi->dma_tx = dma_request_chan(spi->dev, "tx");
18601861 if (IS_ERR(spi->dma_tx)) {
drivers/spi/spi-uniphier.c+14−4
@@ -726,7 +726,7 @@ static int uniphier_spi_probe(struct platform_device *pdev) · 725 unmodified lines
726726 if (ret) {
727727 dev_err(&pdev->dev, "failed to get TX DMA capacities: %d\n",
728728 ret);
729− goto out_disable_clk;
729+ goto out_release_dma;
730730 }
731731 dma_tx_burst = caps.max_burst;
732732 }
@@ -735,7 +735,7 @@ static int uniphier_spi_probe(struct platform_device *pdev) · 2 unmodified lines
735735 if (IS_ERR_OR_NULL(master->dma_rx)) {
736736 if (PTR_ERR(master->dma_rx) == -EPROBE_DEFER) {
737737 ret = -EPROBE_DEFER;
738− goto out_disable_clk;
738+ goto out_release_dma;
739739 }
740740 master->dma_rx = NULL;
741741 dma_rx_burst = INT_MAX;
@@ -744,7 +744,7 @@ static int uniphier_spi_probe(struct platform_device *pdev) · 2 unmodified lines
744744 if (ret) {
745745 dev_err(&pdev->dev, "failed to get RX DMA capacities: %d\n",
746746 ret);
747− goto out_disable_clk;
747+ goto out_release_dma;
748748 }
749749 dma_rx_burst = caps.max_burst;
750750 }
@@ -753,10 +753,20 @@ static int uniphier_spi_probe(struct platform_device *pdev) · 2 unmodified lines
753753
754754 ret = devm_spi_register_master(&pdev->dev, master);
755755 if (ret)
756− goto out_disable_clk;
756+ goto out_release_dma;
757757
758758 return 0;
759759
760+out_release_dma:
761+ if (!IS_ERR_OR_NULL(master->dma_rx)) {
762+ dma_release_channel(master->dma_rx);
763+ master->dma_rx = NULL;
764+ }
765+ if (!IS_ERR_OR_NULL(master->dma_tx)) {
766+ dma_release_channel(master->dma_tx);
767+ master->dma_tx = NULL;
768+ }
769+
760770 out_disable_clk:
761771 clk_disable_unprepare(priv->clk);
762772
drivers/target/iscsi/iscsi_target_tpg.c+3−0
@@ -443,6 +443,9 @@ static bool iscsit_tpg_check_network_portal( · 442 unmodified lines
443443 break;
444444 }
445445 spin_unlock(&tpg->tpg_np_lock);
446+
447+ if (match)
448+ break;
446449 }
447450 spin_unlock(&tiqn->tiqn_tpg_lock);
448451
drivers/tty/n_gsm.c+3−1
@@ -322,6 +322,7 @@ static int addr_cnt; · 321 unmodified lines
322322 #define GSM1_ESCAPE_BITS 0x20
323323 #define XON 0x11
324324 #define XOFF 0x13
325+#define ISO_IEC_646_MASK 0x7F
325326
326327 static const struct tty_port_operations gsm_port_ops;
327328
@@ -531,7 +532,8 @@ static int gsm_stuff_frame(const u8 *input, u8 *output, int len) · 203 unmodified lines
531532 int olen = 0;
532533 while (len--) {
533534 if (*input == GSM1_SOF || *input == GSM1_ESCAPE
534− || *input == XON || *input == XOFF) {
535+ || (*input & ISO_IEC_646_MASK) == XON
536+ || (*input & ISO_IEC_646_MASK) == XOFF) {
535537 *output++ = GSM1_ESCAPE;
536538 *output++ = *input++ ^ GSM1_ESCAPE_BITS;
537539 olen++;
drivers/tty/rpmsg_tty.c+26−14
@@ -50,10 +50,17 @@ static int rpmsg_tty_cb(struct rpmsg_device *rpdev, void *data, int len, void *p · 49 unmodified lines
5050 static int rpmsg_tty_install(struct tty_driver *driver, struct tty_struct *tty)
5151 {
5252 struct rpmsg_tty_port *cport = idr_find(&tty_idr, tty->index);
53+ struct tty_port *port;
5354
5455 tty->driver_data = cport;
5556
56− return tty_port_install(&cport->port, driver, tty);
57+ port = tty_port_get(&cport->port);
58+ return tty_port_install(port, driver, tty);
59+}
60+
61+static void rpmsg_tty_cleanup(struct tty_struct *tty)
62+{
63+ tty_port_put(tty->port);
5764 }
5865
5966 static int rpmsg_tty_open(struct tty_struct *tty, struct file *filp)
@@ -106,12 +113,19 @@ static unsigned int rpmsg_tty_write_room(struct tty_struct *tty) · 46 unmodified lines
106113 return size;
107114 }
108115
116+static void rpmsg_tty_hangup(struct tty_struct *tty)
117+{
118+ tty_port_hangup(tty->port);
119+}
120+
109121 static const struct tty_operations rpmsg_tty_ops = {
110122 .install = rpmsg_tty_install,
111123 .open = rpmsg_tty_open,
112124 .close = rpmsg_tty_close,
113125 .write = rpmsg_tty_write,
114126 .write_room = rpmsg_tty_write_room,
127+ .hangup = rpmsg_tty_hangup,
128+ .cleanup = rpmsg_tty_cleanup,
115129 };
116130
117131 static struct rpmsg_tty_port *rpmsg_tty_alloc_cport(void)
@@ -137,8 +151,10 @@ static struct rpmsg_tty_port *rpmsg_tty_alloc_cport(void) · 19 unmodified lines
137151 return cport;
138152 }
139153
140−static void rpmsg_tty_release_cport(struct rpmsg_tty_port *cport)
154+static void rpmsg_tty_destruct_port(struct tty_port *port)
141155 {
156+ struct rpmsg_tty_port *cport = container_of(port, struct rpmsg_tty_port, port);
157+
142158 mutex_lock(&idr_lock);
143159 idr_remove(&tty_idr, cport->id);
144160 mutex_unlock(&idr_lock);
@@ -146,7 +162,10 @@ static void rpmsg_tty_release_cport(struct rpmsg_tty_port *cport) · 1 unmodified line
146162 kfree(cport);
147163 }
148164
149−static const struct tty_port_operations rpmsg_tty_port_ops = { };
165+static const struct tty_port_operations rpmsg_tty_port_ops = {
166+ .destruct = rpmsg_tty_destruct_port,
167+};
168+
150169
151170 static int rpmsg_tty_probe(struct rpmsg_device *rpdev)
152171 {
@@ -166,7 +185,8 @@ static int rpmsg_tty_probe(struct rpmsg_device *rpdev) · 13 unmodified lines
166185 cport->id, dev);
167186 if (IS_ERR(tty_dev)) {
168187 ret = dev_err_probe(dev, PTR_ERR(tty_dev), "Failed to register tty port\n");
169− goto err_destroy;
188+ tty_port_put(&cport->port);
189+ return ret;
170190 }
171191
172192 cport->rpdev = rpdev;
@@ -177,12 +197,6 @@ static int rpmsg_tty_probe(struct rpmsg_device *rpdev) · 4 unmodified lines
177197 rpdev->src, rpdev->dst, cport->id);
178198
179199 return 0;
180−
181−err_destroy:
182− tty_port_destroy(&cport->port);
183− rpmsg_tty_release_cport(cport);
184−
185− return ret;
186200 }
187201
188202 static void rpmsg_tty_remove(struct rpmsg_device *rpdev)
@@ -192,13 +206,11 @@ static void rpmsg_tty_remove(struct rpmsg_device *rpdev) · 3 unmodified lines
192206 dev_dbg(&rpdev->dev, "Removing rpmsg tty device %d\n", cport->id);
193207
194208 /* User hang up to release the tty */
195− if (tty_port_initialized(&cport->port))
196− tty_port_tty_hangup(&cport->port, false);
209+ tty_port_tty_hangup(&cport->port, false);
197210
198211 tty_unregister_device(rpmsg_tty_driver, cport->id);
199212
200− tty_port_destroy(&cport->port);
201− rpmsg_tty_release_cport(cport);
213+ tty_port_put(&cport->port);
202214 }
203215
204216 static struct rpmsg_device_id rpmsg_driver_tty_id_table[] = {
drivers/tty/serial/8250/8250_of.c+10−1
@@ -83,8 +83,17 @@ static int of_platform_serial_setup(struct platform_device *ofdev, · 82 unmodified lines
8383 port->mapsize = resource_size(&resource);
8484
8585 /* Check for shifted address mapping */
86− if (of_property_read_u32(np, "reg-offset", &prop) == 0)
86+ if (of_property_read_u32(np, "reg-offset", &prop) == 0) {
87+ if (prop >= port->mapsize) {
88+ dev_warn(&ofdev->dev, "reg-offset %u exceeds region size %pa\n",
89+ prop, &port->mapsize);
90+ ret = -EINVAL;
91+ goto err_unprepare;
92+ }
93+
8794 port->mapbase += prop;
95+ port->mapsize -= prop;
96+ }
8897
8998 port->iotype = UPIO_MEM;
9099 if (of_property_read_u32(np, "reg-io-width", &prop) == 0) {
drivers/tty/serial/8250/8250_pci.c+98−2
@@ -4779,8 +4779,30 @@ static const struct pci_device_id serial_pci_tbl[] = { · 4778 unmodified lines
47794779 { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS400,
47804780 PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0dc0 */
47814781 pbn_b2_4_115200 },
4782+ /* Brainboxes Devices */
47824783 /*
4783− * BrainBoxes UC-260
4784+ * Brainboxes UC-101
4785+ */
4786+ { PCI_VENDOR_ID_INTASHIELD, 0x0BA1,
4787+ PCI_ANY_ID, PCI_ANY_ID,
4788+ 0, 0,
4789+ pbn_b2_2_115200 },
4790+ /*
4791+ * Brainboxes UC-235/246
4792+ */
4793+ { PCI_VENDOR_ID_INTASHIELD, 0x0AA1,
4794+ PCI_ANY_ID, PCI_ANY_ID,
4795+ 0, 0,
4796+ pbn_b2_1_115200 },
4797+ /*
4798+ * Brainboxes UC-257
4799+ */
4800+ { PCI_VENDOR_ID_INTASHIELD, 0x0861,
4801+ PCI_ANY_ID, PCI_ANY_ID,
4802+ 0, 0,
4803+ pbn_b2_2_115200 },
4804+ /*
4805+ * Brainboxes UC-260/271/701/756
47844806 */
47854807 { PCI_VENDOR_ID_INTASHIELD, 0x0D21,
47864808 PCI_ANY_ID, PCI_ANY_ID,
@@ -4788,7 +4810,81 @@ static const struct pci_device_id serial_pci_tbl[] = { · 1 unmodified line
47884810 pbn_b2_4_115200 },
47894811 { PCI_VENDOR_ID_INTASHIELD, 0x0E34,
47904812 PCI_ANY_ID, PCI_ANY_ID,
4791− PCI_CLASS_COMMUNICATION_MULTISERIAL << 8, 0xffff00,
4813+ PCI_CLASS_COMMUNICATION_MULTISERIAL << 8, 0xffff00,
4814+ pbn_b2_4_115200 },
4815+ /*
4816+ * Brainboxes UC-268
4817+ */
4818+ { PCI_VENDOR_ID_INTASHIELD, 0x0841,
4819+ PCI_ANY_ID, PCI_ANY_ID,
4820+ 0, 0,
4821+ pbn_b2_4_115200 },
4822+ /*
4823+ * Brainboxes UC-275/279
4824+ */
4825+ { PCI_VENDOR_ID_INTASHIELD, 0x0881,
4826+ PCI_ANY_ID, PCI_ANY_ID,
4827+ 0, 0,
4828+ pbn_b2_8_115200 },
4829+ /*
4830+ * Brainboxes UC-302
4831+ */
4832+ { PCI_VENDOR_ID_INTASHIELD, 0x08E1,
4833+ PCI_ANY_ID, PCI_ANY_ID,
4834+ 0, 0,
4835+ pbn_b2_2_115200 },
4836+ /*
4837+ * Brainboxes UC-310
4838+ */
4839+ { PCI_VENDOR_ID_INTASHIELD, 0x08C1,
4840+ PCI_ANY_ID, PCI_ANY_ID,
4841+ 0, 0,
4842+ pbn_b2_2_115200 },
4843+ /*
4844+ * Brainboxes UC-313
4845+ */
4846+ { PCI_VENDOR_ID_INTASHIELD, 0x08A3,
4847+ PCI_ANY_ID, PCI_ANY_ID,
4848+ 0, 0,
4849+ pbn_b2_2_115200 },
4850+ /*
4851+ * Brainboxes UC-320/324
4852+ */
4853+ { PCI_VENDOR_ID_INTASHIELD, 0x0A61,
4854+ PCI_ANY_ID, PCI_ANY_ID,
4855+ 0, 0,
4856+ pbn_b2_1_115200 },
4857+ /*
4858+ * Brainboxes UC-346
4859+ */
4860+ { PCI_VENDOR_ID_INTASHIELD, 0x0B02,
4861+ PCI_ANY_ID, PCI_ANY_ID,
4862+ 0, 0,
4863+ pbn_b2_4_115200 },
4864+ /*
4865+ * Brainboxes UC-357
4866+ */
4867+ { PCI_VENDOR_ID_INTASHIELD, 0x0A81,
4868+ PCI_ANY_ID, PCI_ANY_ID,
4869+ 0, 0,
4870+ pbn_b2_2_115200 },
4871+ { PCI_VENDOR_ID_INTASHIELD, 0x0A83,
4872+ PCI_ANY_ID, PCI_ANY_ID,
4873+ 0, 0,
4874+ pbn_b2_2_115200 },
4875+ /*
4876+ * Brainboxes UC-368
4877+ */
4878+ { PCI_VENDOR_ID_INTASHIELD, 0x0C41,
4879+ PCI_ANY_ID, PCI_ANY_ID,
4880+ 0, 0,
4881+ pbn_b2_4_115200 },
4882+ /*
4883+ * Brainboxes UC-420/431
4884+ */
4885+ { PCI_VENDOR_ID_INTASHIELD, 0x0921,
4886+ PCI_ANY_ID, PCI_ANY_ID,
4887+ 0, 0,
47924888 pbn_b2_4_115200 },
47934889 /*
47944890 * Perle PCI-RAS cards
drivers/tty/serial/8250/8250_port.c+6−55
@@ -2056,7 +2056,10 @@ static void serial8250_break_ctl(struct uart_port *port, int break_state) · 2055 unmodified lines
20562056 serial8250_rpm_put(up);
20572057 }
20582058
2059−static void wait_for_lsr(struct uart_8250_port *up, int bits)
2059+/*
2060+ * Wait for transmitter & holding register to empty
2061+ */
2062+static void wait_for_xmitr(struct uart_8250_port *up, int bits)
20602063 {
20612064 unsigned int status, tmout = 10000;
20622065
@@ -2073,16 +2076,6 @@ static void wait_for_lsr(struct uart_8250_port *up, int bits) · 10 unmodified lines
20732076 udelay(1);
20742077 touch_nmi_watchdog();
20752078 }
2076−}
2077−
2078−/*
2079− * Wait for transmitter & holding register to empty
2080− */
2081−static void wait_for_xmitr(struct uart_8250_port *up, int bits)
2082−{
2083− unsigned int tmout;
2084−
2085− wait_for_lsr(up, bits);
20862079
20872080 /* Wait up to 1s for flow control if necessary */
20882081 if (up->port.flags & UPF_CONS_FLOW) {
@@ -3332,35 +3325,6 @@ static void serial8250_console_restore(struct uart_8250_port *up) · 1243 unmodified lines
33323325 serial8250_out_MCR(up, UART_MCR_DTR | UART_MCR_RTS);
33333326 }
33343327
3335−/*
3336− * Print a string to the serial port using the device FIFO
3337− *
3338− * It sends fifosize bytes and then waits for the fifo
3339− * to get empty.
3340− */
3341−static void serial8250_console_fifo_write(struct uart_8250_port *up,
3342− const char *s, unsigned int count)
3343−{
3344− int i;
3345− const char *end = s + count;
3346− unsigned int fifosize = up->port.fifosize;
3347− bool cr_sent = false;
3348−
3349− while (s != end) {
3350− wait_for_lsr(up, UART_LSR_THRE);
3351−
3352− for (i = 0; i < fifosize && s != end; ++i) {
3353− if (*s == '\n' && !cr_sent) {
3354− serial_out(up, UART_TX, '\r');
3355− cr_sent = true;
3356− } else {
3357− serial_out(up, UART_TX, *s++);
3358− cr_sent = false;
3359− }
3360− }
3361− }
3362−}
3363−
33643328 /*
33653329 * Print a string to the serial port trying not to disturb
33663330 * any possible real use of the port...
@@ -3376,7 +3340,7 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s, · 9 unmodified lines
33763340 struct uart_8250_em485 *em485 = up->em485;
33773341 struct uart_port *port = &up->port;
33783342 unsigned long flags;
3379− unsigned int ier, use_fifo;
3343+ unsigned int ier;
33803344 int locked = 1;
33813345
33823346 touch_nmi_watchdog();
@@ -3408,20 +3372,7 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s, · 25 unmodified lines
34083372 mdelay(port->rs485.delay_rts_before_send);
34093373 }
34103374
3411− use_fifo = (up->capabilities & UART_CAP_FIFO) &&
3412− port->fifosize > 1 &&
3413− (serial_port_in(port, UART_FCR) & UART_FCR_ENABLE_FIFO) &&
3414− /*
3415− * After we put a data in the fifo, the controller will send
3416− * it regardless of the CTS state. Therefore, only use fifo
3417− * if we don't use control flow.
3418− */
3419− !(up->port.flags & UPF_CONS_FLOW);
3420−
3421− if (likely(use_fifo))
3422− serial8250_console_fifo_write(up, s, count);
3423− else
3424− uart_console_write(port, s, count, serial8250_console_putchar);
3375+ uart_console_write(port, s, count, serial8250_console_putchar);
34253376
34263377 /*
34273378 * Finally, wait for transmitter to become empty
drivers/tty/serial/amba-pl011.c+1−10
@@ -1582,9 +1582,6 @@ static void pl011_set_mctrl(struct uart_port *port, unsigned int mctrl) · 1581 unmodified lines
15821582 container_of(port, struct uart_amba_port, port);
15831583 unsigned int cr;
15841584
1585− if (port->rs485.flags & SER_RS485_ENABLED)
1586− mctrl &= ~TIOCM_RTS;
1587−
15881585 cr = pl011_read(uap, REG_CR);
15891586
15901587 #define TIOCMBIT(tiocmbit, uartbit) \
@@ -1808,14 +1805,8 @@ static int pl011_startup(struct uart_port *port) · 217 unmodified lines
18081805 cr &= UART011_CR_RTS | UART011_CR_DTR;
18091806 cr |= UART01x_CR_UARTEN | UART011_CR_RXE;
18101807
1811− if (port->rs485.flags & SER_RS485_ENABLED) {
1812− if (port->rs485.flags & SER_RS485_RTS_AFTER_SEND)
1813− cr &= ~UART011_CR_RTS;
1814− else
1815− cr |= UART011_CR_RTS;
1816− } else {
1808+ if (!(port->rs485.flags & SER_RS485_ENABLED))
18171809 cr |= UART011_CR_TXE;
1818− }
18191810
18201811 pl011_write(cr, uap, REG_CR);
18211812
drivers/tty/serial/serial_core.c+12−22
@@ -144,6 +144,11 @@ uart_update_mctrl(struct uart_port *port, unsigned int set, unsigned int clear) · 143 unmodified lines
144144 unsigned long flags;
145145 unsigned int old;
146146
147+ if (port->rs485.flags & SER_RS485_ENABLED) {
148+ set &= ~TIOCM_RTS;
149+ clear &= ~TIOCM_RTS;
150+ }
151+
147152 spin_lock_irqsave(&port->lock, flags);
148153 old = port->mctrl;
149154 port->mctrl = (old & ~clear) | set;
@@ -157,23 +162,10 @@ uart_update_mctrl(struct uart_port *port, unsigned int set, unsigned int clear) · 7 unmodified lines
157162
158163 static void uart_port_dtr_rts(struct uart_port *uport, int raise)
159164 {
160− int rs485_on = uport->rs485_config &&
161− (uport->rs485.flags & SER_RS485_ENABLED);
162− int RTS_after_send = !!(uport->rs485.flags & SER_RS485_RTS_AFTER_SEND);
163−
164− if (raise) {
165− if (rs485_on && RTS_after_send) {
166− uart_set_mctrl(uport, TIOCM_DTR);
167− uart_clear_mctrl(uport, TIOCM_RTS);
168− } else {
169− uart_set_mctrl(uport, TIOCM_DTR | TIOCM_RTS);
170− }
171− } else {
172− unsigned int clear = TIOCM_DTR;
173−
174− clear |= (!rs485_on || RTS_after_send) ? TIOCM_RTS : 0;
175− uart_clear_mctrl(uport, clear);
176− }
165+ if (raise)
166+ uart_set_mctrl(uport, TIOCM_DTR | TIOCM_RTS);
167+ else
168+ uart_clear_mctrl(uport, TIOCM_DTR | TIOCM_RTS);
177169 }
178170
179171 /*
@@ -1075,11 +1067,6 @@ uart_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) · 895 unmodified lines
10751067 goto out;
10761068
10771069 if (!tty_io_error(tty)) {
1078− if (uport->rs485.flags & SER_RS485_ENABLED) {
1079− set &= ~TIOCM_RTS;
1080− clear &= ~TIOCM_RTS;
1081− }
1082−
10831070 uart_update_mctrl(uport, set, clear);
10841071 ret = 0;
10851072 }
@@ -2390,6 +2377,9 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state, · 1304 unmodified lines
23902377 */
23912378 spin_lock_irqsave(&port->lock, flags);
23922379 port->mctrl &= TIOCM_DTR;
2380+ if (port->rs485.flags & SER_RS485_ENABLED &&
2381+ !(port->rs485.flags & SER_RS485_RTS_AFTER_SEND))
2382+ port->mctrl |= TIOCM_RTS;
23932383 port->ops->set_mctrl(port, port->mctrl);
23942384 spin_unlock_irqrestore(&port->lock, flags);
23952385
drivers/tty/serial/stm32-usart.c+13−1
@@ -550,11 +550,23 @@ static void stm32_usart_transmit_chars(struct uart_port *port) · 549 unmodified lines
550550 struct stm32_port *stm32_port = to_stm32_port(port);
551551 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
552552 struct circ_buf *xmit = &port->state->xmit;
553+ u32 isr;
554+ int ret;
553555
554556 if (port->x_char) {
555557 if (stm32_usart_tx_dma_started(stm32_port) &&
556558 stm32_usart_tx_dma_enabled(stm32_port))
557559 stm32_usart_clr_bits(port, ofs->cr3, USART_CR3_DMAT);
560+
561+ /* Check that TDR is empty before filling FIFO */
562+ ret =
563+ readl_relaxed_poll_timeout_atomic(port->membase + ofs->isr,
564+ isr,
565+ (isr & USART_SR_TXE),
566+ 10, 1000);
567+ if (ret)
568+ dev_warn(port->dev, "1 character may be erased\n");
569+
558570 writel_relaxed(port->x_char, port->membase + ofs->tdr);
559571 port->x_char = 0;
560572 port->icount.tx++;
@@ -730,7 +742,7 @@ static void stm32_usart_start_tx(struct uart_port *port) · 169 unmodified lines
730742 struct serial_rs485 *rs485conf = &port->rs485;
731743 struct circ_buf *xmit = &port->state->xmit;
732744
733− if (uart_circ_empty(xmit))
745+ if (uart_circ_empty(xmit) && !port->x_char)
734746 return;
735747
736748 if (rs485conf->flags & SER_RS485_ENABLED) {
drivers/usb/cdns3/drd.c+3−3
@@ -483,11 +483,11 @@ int cdns_drd_exit(struct cdns *cdns) · 482 unmodified lines
483483 /* Indicate the cdns3 core was power lost before */
484484 bool cdns_power_is_lost(struct cdns *cdns)
485485 {
486− if (cdns->version == CDNS3_CONTROLLER_V1) {
487− if (!(readl(&cdns->otg_v1_regs->simulate) & BIT(0)))
486+ if (cdns->version == CDNS3_CONTROLLER_V0) {
487+ if (!(readl(&cdns->otg_v0_regs->simulate) & BIT(0)))
488488 return true;
489489 } else {
490− if (!(readl(&cdns->otg_v0_regs->simulate) & BIT(0)))
490+ if (!(readl(&cdns->otg_v1_regs->simulate) & BIT(0)))
491491 return true;
492492 }
493493 return false;
drivers/usb/common/ulpi.c+5−2
@@ -39,8 +39,11 @@ static int ulpi_match(struct device *dev, struct device_driver *driver) · 38 unmodified lines
3939 struct ulpi *ulpi = to_ulpi_dev(dev);
4040 const struct ulpi_device_id *id;
4141
42− /* Some ULPI devices don't have a vendor id so rely on OF match */
43− if (ulpi->id.vendor == 0)
42+ /*
43+ * Some ULPI devices don't have a vendor id
44+ * or provide an id_table so rely on OF match.
45+ */
46+ if (ulpi->id.vendor == 0 || !drv->id_table)
4447 return of_driver_match_device(dev, driver);
4548
4649 for (id = drv->id_table; id->vendor; id++)
drivers/usb/core/hcd.c+14−0
@@ -1563,6 +1563,13 @@ int usb_hcd_submit_urb (struct urb *urb, gfp_t mem_flags) · 1562 unmodified lines
15631563 urb->hcpriv = NULL;
15641564 INIT_LIST_HEAD(&urb->urb_list);
15651565 atomic_dec(&urb->use_count);
1566+ /*
1567+ * Order the write of urb->use_count above before the read
1568+ * of urb->reject below. Pairs with the memory barriers in
1569+ * usb_kill_urb() and usb_poison_urb().
1570+ */
1571+ smp_mb__after_atomic();
1572+
15661573 atomic_dec(&urb->dev->urbnum);
15671574 if (atomic_read(&urb->reject))
15681575 wake_up(&usb_kill_urb_queue);
@@ -1665,6 +1672,13 @@ static void __usb_hcd_giveback_urb(struct urb *urb) · 96 unmodified lines
16651672
16661673 usb_anchor_resume_wakeups(anchor);
16671674 atomic_dec(&urb->use_count);
1675+ /*
1676+ * Order the write of urb->use_count above before the read
1677+ * of urb->reject below. Pairs with the memory barriers in
1678+ * usb_kill_urb() and usb_poison_urb().
1679+ */
1680+ smp_mb__after_atomic();
1681+
16681682 if (unlikely(atomic_read(&urb->reject)))
16691683 wake_up(&usb_kill_urb_queue);
16701684 usb_put_urb(urb);
drivers/usb/core/urb.c+12−0
@@ -715,6 +715,12 @@ void usb_kill_urb(struct urb *urb) · 714 unmodified lines
715715 if (!(urb && urb->dev && urb->ep))
716716 return;
717717 atomic_inc(&urb->reject);
718+ /*
719+ * Order the write of urb->reject above before the read
720+ * of urb->use_count below. Pairs with the barriers in
721+ * __usb_hcd_giveback_urb() and usb_hcd_submit_urb().
722+ */
723+ smp_mb__after_atomic();
718724
719725 usb_hcd_unlink_urb(urb, -ENOENT);
720726 wait_event(usb_kill_urb_queue, atomic_read(&urb->use_count) == 0);
@@ -756,6 +762,12 @@ void usb_poison_urb(struct urb *urb) · 35 unmodified lines
756762 if (!urb)
757763 return;
758764 atomic_inc(&urb->reject);
765+ /*
766+ * Order the write of urb->reject above before the read
767+ * of urb->use_count below. Pairs with the barriers in
768+ * __usb_hcd_giveback_urb() and usb_hcd_submit_urb().
769+ */
770+ smp_mb__after_atomic();
759771
760772 if (!urb->dev || !urb->ep)
761773 return;
drivers/usb/dwc2/gadget.c+1−1
@@ -5097,7 +5097,7 @@ int dwc2_hsotg_suspend(struct dwc2_hsotg *hsotg) · 5096 unmodified lines
50975097 hsotg->gadget.speed = USB_SPEED_UNKNOWN;
50985098 spin_unlock_irqrestore(&hsotg->lock, flags);
50995099
5100− for (ep = 0; ep < hsotg->num_of_eps; ep++) {
5100+ for (ep = 1; ep < hsotg->num_of_eps; ep++) {
51015101 if (hsotg->eps_in[ep])
51025102 dwc2_hsotg_ep_disable_lock(&hsotg->eps_in[ep]->ep);
51035103 if (hsotg->eps_out[ep])
drivers/usb/dwc3/dwc3-xilinx.c+18−5
@@ -102,14 +102,26 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data) · 101 unmodified lines
102102 int ret;
103103 u32 reg;
104104
105− usb3_phy = devm_phy_get(dev, "usb3-phy");
106− if (PTR_ERR(usb3_phy) == -EPROBE_DEFER) {
107− ret = -EPROBE_DEFER;
105+ usb3_phy = devm_phy_optional_get(dev, "usb3-phy");
106+ if (IS_ERR(usb3_phy)) {
107+ ret = PTR_ERR(usb3_phy);
108+ dev_err_probe(dev, ret,
109+ "failed to get USB3 PHY\n");
108110 goto err;
109− } else if (IS_ERR(usb3_phy)) {
110− usb3_phy = NULL;
111111 }
112112
113+ /*
114+ * The following core resets are not required unless a USB3 PHY
115+ * is used, and the subsequent register settings are not required
116+ * unless a core reset is performed (they should be set properly
117+ * by the first-stage boot loader, but may be reverted by a core
118+ * reset). They may also break the configuration if USB3 is actually
119+ * in use but the usb3-phy entry is missing from the device tree.
120+ * Therefore, skip these operations in this case.
121+ */
122+ if (!usb3_phy)
123+ goto skip_usb3_phy;
124+
113125 crst = devm_reset_control_get_exclusive(dev, "usb_crst");
114126 if (IS_ERR(crst)) {
115127 ret = PTR_ERR(crst);
@@ -188,6 +200,7 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data) · 72 unmodified lines
188200 goto err;
189201 }
190202
203+skip_usb3_phy:
191204 /*
192205 * This routes the USB DMA traffic to go through FPD path instead
193206 * of reaching DDR directly. This traffic routing is needed to
drivers/usb/gadget/function/f_sourcesink.c+1−0
@@ -584,6 +584,7 @@ static int source_sink_start_ep(struct f_sourcesink *ss, bool is_in, · 583 unmodified lines
584584
585585 if (is_iso) {
586586 switch (speed) {
587+ case USB_SPEED_SUPER_PLUS:
587588 case USB_SPEED_SUPER:
588589 size = ss->isoc_maxpacket *
589590 (ss->isoc_mult + 1) *
drivers/usb/gadget/udc/at91_udc.c+1−1
@@ -1895,7 +1895,7 @@ static int at91udc_probe(struct platform_device *pdev) · 1894 unmodified lines
18951895 at91_vbus_irq, 0, driver_name, udc);
18961896 if (retval) {
18971897 DBG("request vbus irq %d failed\n",
1898− udc->board.vbus_pin);
1898+ desc_to_gpio(udc->board.vbus_pin));
18991899 goto err_unprepare_iclk;
19001900 }
19011901 }
drivers/usb/host/xhci-plat.c+3−0
@@ -437,6 +437,9 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev) · 436 unmodified lines
437437 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
438438 int ret;
439439
440+ if (pm_runtime_suspended(dev))
441+ pm_runtime_resume(dev);
442+
440443 ret = xhci_priv_suspend_quirk(hcd);
441444 if (ret)
442445 return ret;
drivers/usb/storage/unusual_devs.h+10−0
@@ -2301,6 +2301,16 @@ UNUSUAL_DEV( 0x2027, 0xa001, 0x0000, 0x9999, · 2300 unmodified lines
23012301 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init,
23022302 US_FL_SCM_MULT_TARG ),
23032303
2304+/*
2305+ * Reported by DocMAX <mail@vacharakis.de>
2306+ * and Thomas Weißschuh <linux@weissschuh.net>
2307+ */
2308+UNUSUAL_DEV( 0x2109, 0x0715, 0x9999, 0x9999,
2309+ "VIA Labs, Inc.",
2310+ "VL817 SATA Bridge",
2311+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
2312+ US_FL_IGNORE_UAS),
2313+
23042314 UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001,
23052315 "ST",
23062316 "2A",
drivers/usb/typec/port-mapper.c+7−1
@@ -56,7 +56,12 @@ int typec_link_ports(struct typec_port *con) · 55 unmodified lines
5656 {
5757 struct each_port_arg arg = { .port = con, .match = NULL };
5858
59+ if (!has_acpi_companion(&con->dev))
60+ return 0;
61+
5962 bus_for_each_dev(&acpi_bus_type, NULL, &arg, typec_port_match);
63+ if (!arg.match)
64+ return 0;
6065
6166 /*
6267 * REVISIT: Now each connector can have only a single component master.
@@ -74,5 +79,6 @@ int typec_link_ports(struct typec_port *con) · 11 unmodified lines
7479
7580 void typec_unlink_ports(struct typec_port *con)
7681 {
77− component_master_del(&con->dev, &typec_aggregate_ops);
82+ if (has_acpi_companion(&con->dev))
83+ component_master_del(&con->dev, &typec_aggregate_ops);
7884 }
drivers/usb/typec/tcpm/tcpci.c+26−0
@@ -75,9 +75,25 @@ static int tcpci_write16(struct tcpci *tcpci, unsigned int reg, u16 val) · 74 unmodified lines
7575 static int tcpci_set_cc(struct tcpc_dev *tcpc, enum typec_cc_status cc)
7676 {
7777 struct tcpci *tcpci = tcpc_to_tcpci(tcpc);
78+ bool vconn_pres;
79+ enum typec_cc_polarity polarity = TYPEC_POLARITY_CC1;
7880 unsigned int reg;
7981 int ret;
8082
83+ ret = regmap_read(tcpci->regmap, TCPC_POWER_STATUS, &reg);
84+ if (ret < 0)
85+ return ret;
86+
87+ vconn_pres = !!(reg & TCPC_POWER_STATUS_VCONN_PRES);
88+ if (vconn_pres) {
89+ ret = regmap_read(tcpci->regmap, TCPC_TCPC_CTRL, &reg);
90+ if (ret < 0)
91+ return ret;
92+
93+ if (reg & TCPC_TCPC_CTRL_ORIENTATION)
94+ polarity = TYPEC_POLARITY_CC2;
95+ }
96+
8197 switch (cc) {
8298 case TYPEC_CC_RA:
8399 reg = (TCPC_ROLE_CTRL_CC_RA << TCPC_ROLE_CTRL_CC1_SHIFT) |
@@ -112,6 +128,16 @@ static int tcpci_set_cc(struct tcpc_dev *tcpc, enum typec_cc_status cc) · 28 unmodified lines
112128 break;
113129 }
114130
131+ if (vconn_pres) {
132+ if (polarity == TYPEC_POLARITY_CC2) {
133+ reg &= ~(TCPC_ROLE_CTRL_CC1_MASK << TCPC_ROLE_CTRL_CC1_SHIFT);
134+ reg |= (TCPC_ROLE_CTRL_CC_OPEN << TCPC_ROLE_CTRL_CC1_SHIFT);
135+ } else {
136+ reg &= ~(TCPC_ROLE_CTRL_CC2_MASK << TCPC_ROLE_CTRL_CC2_SHIFT);
137+ reg |= (TCPC_ROLE_CTRL_CC_OPEN << TCPC_ROLE_CTRL_CC2_SHIFT);
138+ }
139+ }
140+
115141 ret = regmap_write(tcpci->regmap, TCPC_ROLE_CTRL, reg);
116142 if (ret < 0)
117143 return ret;
drivers/usb/typec/tcpm/tcpci.h+1−0
@@ -98,6 +98,7 @@ · 97 unmodified lines
9898 #define TCPC_POWER_STATUS_SOURCING_VBUS BIT(4)
9999 #define TCPC_POWER_STATUS_VBUS_DET BIT(3)
100100 #define TCPC_POWER_STATUS_VBUS_PRES BIT(2)
101+#define TCPC_POWER_STATUS_VCONN_PRES BIT(1)
101102 #define TCPC_POWER_STATUS_SINKING_VBUS BIT(0)
102103
103104 #define TCPC_FAULT_STATUS 0x1f
drivers/usb/typec/tcpm/tcpm.c+6−1
@@ -5156,7 +5156,8 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port) · 5155 unmodified lines
51565156 case SNK_TRYWAIT_DEBOUNCE:
51575157 break;
51585158 case SNK_ATTACH_WAIT:
5159− tcpm_set_state(port, SNK_UNATTACHED, 0);
5159+ case SNK_DEBOUNCED:
5160+ /* Do nothing, as TCPM is still waiting for vbus to reaach VSAFE5V to connect */
51605161 break;
51615162
51625163 case SNK_NEGOTIATE_CAPABILITIES:
@@ -5263,6 +5264,10 @@ static void _tcpm_pd_vbus_vsafe0v(struct tcpm_port *port) · 100 unmodified lines
52635264 case PR_SWAP_SNK_SRC_SOURCE_ON:
52645265 /* Do nothing, vsafe0v is expected during transition */
52655266 break;
5267+ case SNK_ATTACH_WAIT:
5268+ case SNK_DEBOUNCED:
5269+ /*Do nothing, still waiting for VSAFE5V for connect */
5270+ break;
52665271 default:
52675272 if (port->pwr_role == TYPEC_SINK && port->auto_vbus_discharge_enabled)
52685273 tcpm_set_state(port, SNK_UNATTACHED, 0);
drivers/usb/typec/ucsi/ucsi_ccg.c+1−1
@@ -325,7 +325,7 @@ static int ucsi_ccg_init(struct ucsi_ccg *uc) · 324 unmodified lines
325325 if (status < 0)
326326 return status;
327327
328− if (!data)
328+ if (!(data & DEV_INT))
329329 return 0;
330330
331331 status = ccg_write(uc, CCGX_RAB_INTR_REG, &data, sizeof(data));
drivers/video/fbdev/hyperv_fb.c+3−13
@@ -287,8 +287,6 @@ struct hvfb_par { · 286 unmodified lines
287287
288288 static uint screen_width = HVFB_WIDTH;
289289 static uint screen_height = HVFB_HEIGHT;
290−static uint screen_width_max = HVFB_WIDTH;
291−static uint screen_height_max = HVFB_HEIGHT;
292290 static uint screen_depth;
293291 static uint screen_fb_size;
294292 static uint dio_fb_size; /* FB size for deferred IO */
@@ -582,7 +580,6 @@ static int synthvid_get_supported_resolution(struct hv_device *hdev) · 287 unmodified lines
582580 int ret = 0;
583581 unsigned long t;
584582 u8 index;
585− int i;
586583
587584 memset(msg, 0, sizeof(struct synthvid_msg));
588585 msg->vid_hdr.type = SYNTHVID_RESOLUTION_REQUEST;
@@ -613,13 +610,6 @@ static int synthvid_get_supported_resolution(struct hv_device *hdev) · 24 unmodified lines
613610 goto out;
614611 }
615612
616− for (i = 0; i < msg->resolution_resp.resolution_count; i++) {
617− screen_width_max = max_t(unsigned int, screen_width_max,
618− msg->resolution_resp.supported_resolution[i].width);
619− screen_height_max = max_t(unsigned int, screen_height_max,
620− msg->resolution_resp.supported_resolution[i].height);
621− }
622−
623613 screen_width =
624614 msg->resolution_resp.supported_resolution[index].width;
625615 screen_height =
@@ -941,7 +931,7 @@ static void hvfb_get_option(struct fb_info *info) · 315 unmodified lines
941931
942932 if (x < HVFB_WIDTH_MIN || y < HVFB_HEIGHT_MIN ||
943933 (synthvid_ver_ge(par->synthvid_version, SYNTHVID_VERSION_WIN10) &&
944− (x > screen_width_max || y > screen_height_max)) ||
934+ (x * y * screen_depth / 8 > screen_fb_size)) ||
945935 (par->synthvid_version == SYNTHVID_VERSION_WIN8 &&
946936 x * y * screen_depth / 8 > SYNTHVID_FB_SIZE_WIN8) ||
947937 (par->synthvid_version == SYNTHVID_VERSION_WIN7 &&
@@ -1194,8 +1184,8 @@ static int hvfb_probe(struct hv_device *hdev, · 246 unmodified lines
11941184 }
11951185
11961186 hvfb_get_option(info);
1197− pr_info("Screen resolution: %dx%d, Color depth: %d\n",
1198− screen_width, screen_height, screen_depth);
1187+ pr_info("Screen resolution: %dx%d, Color depth: %d, Frame buffer size: %d\n",
1188+ screen_width, screen_height, screen_depth, screen_fb_size);
11991189
12001190 ret = hvfb_getmem(hdev, info);
12011191 if (ret) {
fs/Makefile+1−1
@@ -96,7 +96,7 @@ obj-$(CONFIG_EXPORTFS) += exportfs/ · 95 unmodified lines
9696 obj-$(CONFIG_NFSD) += nfsd/
9797 obj-$(CONFIG_LOCKD) += lockd/
9898 obj-$(CONFIG_NLS) += nls/
99−obj-$(CONFIG_UNICODE) += unicode/
99+obj-y += unicode/
100100 obj-$(CONFIG_SYSV_FS) += sysv/
101101 obj-$(CONFIG_SMBFS_COMMON) += smbfs_common/
102102 obj-$(CONFIG_CIFS) += cifs/
fs/binfmt_misc.c+4−4
@@ -817,20 +817,20 @@ static struct file_system_type bm_fs_type = { · 816 unmodified lines
817817 };
818818 MODULE_ALIAS_FS("binfmt_misc");
819819
820+static struct ctl_table_header *binfmt_misc_header;
821+
820822 static int __init init_misc_binfmt(void)
821823 {
822824 int err = register_filesystem(&bm_fs_type);
823825 if (!err)
824826 insert_binfmt(&misc_format);
825− if (!register_sysctl_mount_point("fs/binfmt_misc")) {
826− pr_warn("Failed to create fs/binfmt_misc sysctl mount point");
827− return -ENOMEM;
828− }
827+ binfmt_misc_header = register_sysctl_mount_point("fs/binfmt_misc");
829828 return 0;
830829 }
831830
832831 static void __exit exit_misc_binfmt(void)
833832 {
833+ unregister_sysctl_table(binfmt_misc_header);
834834 unregister_binfmt(&misc_format);
835835 unregister_filesystem(&bm_fs_type);
836836 }
fs/btrfs/ioctl.c+2−4
@@ -3152,10 +3152,8 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, · 3151 unmodified lines
31523152 btrfs_inode_lock(inode, 0);
31533153 err = btrfs_delete_subvolume(dir, dentry);
31543154 btrfs_inode_unlock(inode, 0);
3155− if (!err) {
3156− fsnotify_rmdir(dir, dentry);
3157− d_delete(dentry);
3158− }
3155+ if (!err)
3156+ d_delete_notify(dir, dentry);
31593157
31603158 out_dput:
31613159 dput(dentry);
fs/ceph/caps.c+37−18
@@ -2218,6 +2218,7 @@ static int unsafe_request_wait(struct inode *inode) · 2217 unmodified lines
22182218 struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
22192219 struct ceph_inode_info *ci = ceph_inode(inode);
22202220 struct ceph_mds_request *req1 = NULL, *req2 = NULL;
2221+ unsigned int max_sessions;
22212222 int ret, err = 0;
22222223
22232224 spin_lock(&ci->i_unsafe_lock);
@@ -2235,37 +2236,45 @@ static int unsafe_request_wait(struct inode *inode) · 11 unmodified lines
22352236 }
22362237 spin_unlock(&ci->i_unsafe_lock);
22372238
2239+ /*
2240+ * The mdsc->max_sessions is unlikely to be changed
2241+ * mostly, here we will retry it by reallocating the
2242+ * sessions array memory to get rid of the mdsc->mutex
2243+ * lock.
2244+ */
2245+retry:
2246+ max_sessions = mdsc->max_sessions;
2247+
22382248 /*
22392249 * Trigger to flush the journal logs in all the relevant MDSes
22402250 * manually, or in the worst case we must wait at most 5 seconds
22412251 * to wait the journal logs to be flushed by the MDSes periodically.
22422252 */
2243− if (req1 || req2) {
2253+ if ((req1 || req2) && likely(max_sessions)) {
22442254 struct ceph_mds_session **sessions = NULL;
22452255 struct ceph_mds_session *s;
22462256 struct ceph_mds_request *req;
2247− unsigned int max;
22482257 int i;
22492258
2250− /*
2251− * The mdsc->max_sessions is unlikely to be changed
2252− * mostly, here we will retry it by reallocating the
2253− * sessions arrary memory to get rid of the mdsc->mutex
2254− * lock.
2255− */
2256−retry:
2257− max = mdsc->max_sessions;
2258− sessions = krealloc(sessions, max * sizeof(s), __GFP_ZERO);
2259− if (!sessions)
2260− return -ENOMEM;
2259+ sessions = kzalloc(max_sessions * sizeof(s), GFP_KERNEL);
2260+ if (!sessions) {
2261+ err = -ENOMEM;
2262+ goto out;
2263+ }
22612264
22622265 spin_lock(&ci->i_unsafe_lock);
22632266 if (req1) {
22642267 list_for_each_entry(req, &ci->i_unsafe_dirops,
22652268 r_unsafe_dir_item) {
22662269 s = req->r_session;
2267− if (unlikely(s->s_mds >= max)) {
2270+ if (unlikely(s->s_mds >= max_sessions)) {
22682271 spin_unlock(&ci->i_unsafe_lock);
2272+ for (i = 0; i < max_sessions; i++) {
2273+ s = sessions[i];
2274+ if (s)
2275+ ceph_put_mds_session(s);
2276+ }
2277+ kfree(sessions);
22692278 goto retry;
22702279 }
22712280 if (!sessions[s->s_mds]) {
@@ -2278,8 +2287,14 @@ retry: · 6 unmodified lines
22782287 list_for_each_entry(req, &ci->i_unsafe_iops,
22792288 r_unsafe_target_item) {
22802289 s = req->r_session;
2281− if (unlikely(s->s_mds >= max)) {
2290+ if (unlikely(s->s_mds >= max_sessions)) {
22822291 spin_unlock(&ci->i_unsafe_lock);
2292+ for (i = 0; i < max_sessions; i++) {
2293+ s = sessions[i];
2294+ if (s)
2295+ ceph_put_mds_session(s);
2296+ }
2297+ kfree(sessions);
22832298 goto retry;
22842299 }
22852300 if (!sessions[s->s_mds]) {
@@ -2300,7 +2315,7 @@ retry: · 14 unmodified lines
23002315 spin_unlock(&ci->i_ceph_lock);
23012316
23022317 /* send flush mdlog request to MDSes */
2303− for (i = 0; i < max; i++) {
2318+ for (i = 0; i < max_sessions; i++) {
23042319 s = sessions[i];
23052320 if (s) {
23062321 send_flush_mdlog(s);
@@ -2317,15 +2332,19 @@ retry: · 10 unmodified lines
23172332 ceph_timeout_jiffies(req1->r_timeout));
23182333 if (ret)
23192334 err = -EIO;
2320− ceph_mdsc_put_request(req1);
23212335 }
23222336 if (req2) {
23232337 ret = !wait_for_completion_timeout(&req2->r_safe_completion,
23242338 ceph_timeout_jiffies(req2->r_timeout));
23252339 if (ret)
23262340 err = -EIO;
2327− ceph_mdsc_put_request(req2);
23282341 }
2342+
2343+out:
2344+ if (req1)
2345+ ceph_mdsc_put_request(req1);
2346+ if (req2)
2347+ ceph_mdsc_put_request(req2);
23292348 return err;
23302349 }
23312350
fs/ceph/file.c+9−0
@@ -583,6 +583,7 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry, · 582 unmodified lines
583583 struct ceph_inode_info *ci = ceph_inode(dir);
584584 struct inode *inode;
585585 struct timespec64 now;
586+ struct ceph_string *pool_ns;
586587 struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb);
587588 struct ceph_vino vino = { .ino = req->r_deleg_ino,
588589 .snap = CEPH_NOSNAP };
@@ -632,6 +633,12 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry, · 43 unmodified lines
632633 in.max_size = cpu_to_le64(lo->stripe_unit);
633634
634635 ceph_file_layout_to_legacy(lo, &in.layout);
636+ /* lo is private, so pool_ns can't change */
637+ pool_ns = rcu_dereference_raw(lo->pool_ns);
638+ if (pool_ns) {
639+ iinfo.pool_ns_len = pool_ns->len;
640+ iinfo.pool_ns_data = pool_ns->str;
641+ }
635642
636643 down_read(&mdsc->snap_rwsem);
637644 ret = ceph_fill_inode(inode, NULL, &iinfo, NULL, req->r_session,
@@ -750,8 +757,10 @@ retry: · 112 unmodified lines
750757 restore_deleg_ino(dir, req->r_deleg_ino);
751758 ceph_mdsc_put_request(req);
752759 try_async = false;
760+ ceph_put_string(rcu_dereference_raw(lo.pool_ns));
753761 goto retry;
754762 }
763+ ceph_put_string(rcu_dereference_raw(lo.pool_ns));
755764 goto out_req;
756765 }
757766 }
fs/configfs/dir.c+3−3
@@ -1780,8 +1780,8 @@ void configfs_unregister_group(struct config_group *group) · 1779 unmodified lines
17801780 configfs_detach_group(&group->cg_item);
17811781 d_inode(dentry)->i_flags |= S_DEAD;
17821782 dont_mount(dentry);
1783+ d_drop(dentry);
17831784 fsnotify_rmdir(d_inode(parent), dentry);
1784− d_delete(dentry);
17851785 inode_unlock(d_inode(parent));
17861786
17871787 dput(dentry);
@@ -1922,10 +1922,10 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys) · 134 unmodified lines
19221922 configfs_detach_group(&group->cg_item);
19231923 d_inode(dentry)->i_flags |= S_DEAD;
19241924 dont_mount(dentry);
1925− fsnotify_rmdir(d_inode(root), dentry);
19261925 inode_unlock(d_inode(dentry));
19271926
1928− d_delete(dentry);
1927+ d_drop(dentry);
1928+ fsnotify_rmdir(d_inode(root), dentry);
19291929
19301930 inode_unlock(d_inode(root));
19311931
fs/devpts/inode.c+1−1
@@ -621,8 +621,8 @@ void devpts_pty_kill(struct dentry *dentry) · 620 unmodified lines
621621
622622 dentry->d_fsdata = NULL;
623623 drop_nlink(dentry->d_inode);
624− fsnotify_unlink(d_inode(dentry->d_parent), dentry);
625624 d_drop(dentry);
625+ fsnotify_unlink(d_inode(dentry->d_parent), dentry);
626626 dput(dentry); /* d_alloc_name() in devpts_pty_new() */
627627 }
628628
fs/ext4/ext4.h+7−7
@@ -2485,7 +2485,7 @@ struct ext4_filename { · 2484 unmodified lines
24852485 #ifdef CONFIG_FS_ENCRYPTION
24862486 struct fscrypt_str crypto_buf;
24872487 #endif
2488−#ifdef CONFIG_UNICODE
2488+#if IS_ENABLED(CONFIG_UNICODE)
24892489 struct fscrypt_str cf_name;
24902490 #endif
24912491 };
@@ -2721,7 +2721,7 @@ extern unsigned ext4_free_clusters_after_init(struct super_block *sb, · 229 unmodified lines
27212721 struct ext4_group_desc *gdp);
27222722 ext4_fsblk_t ext4_inode_to_goal_block(struct inode *);
27232723
2724−#ifdef CONFIG_UNICODE
2724+#if IS_ENABLED(CONFIG_UNICODE)
27252725 extern int ext4_fname_setup_ci_filename(struct inode *dir,
27262726 const struct qstr *iname,
27272727 struct ext4_filename *fname);
@@ -2754,7 +2754,7 @@ static inline int ext4_fname_setup_filename(struct inode *dir, · 26 unmodified lines
27542754
27552755 ext4_fname_from_fscrypt_name(fname, &name);
27562756
2757−#ifdef CONFIG_UNICODE
2757+#if IS_ENABLED(CONFIG_UNICODE)
27582758 err = ext4_fname_setup_ci_filename(dir, iname, fname);
27592759 #endif
27602760 return err;
@@ -2773,7 +2773,7 @@ static inline int ext4_fname_prepare_lookup(struct inode *dir, · 12 unmodified lines
27732773
27742774 ext4_fname_from_fscrypt_name(fname, &name);
27752775
2776−#ifdef CONFIG_UNICODE
2776+#if IS_ENABLED(CONFIG_UNICODE)
27772777 err = ext4_fname_setup_ci_filename(dir, &dentry->d_name, fname);
27782778 #endif
27792779 return err;
@@ -2790,7 +2790,7 @@ static inline void ext4_fname_free_filename(struct ext4_filename *fname) · 10 unmodified lines
27902790 fname->usr_fname = NULL;
27912791 fname->disk_name.name = NULL;
27922792
2793−#ifdef CONFIG_UNICODE
2793+#if IS_ENABLED(CONFIG_UNICODE)
27942794 kfree(fname->cf_name.name);
27952795 fname->cf_name.name = NULL;
27962796 #endif
@@ -2806,7 +2806,7 @@ static inline int ext4_fname_setup_filename(struct inode *dir, · 9 unmodified lines
28062806 fname->disk_name.name = (unsigned char *) iname->name;
28072807 fname->disk_name.len = iname->len;
28082808
2809−#ifdef CONFIG_UNICODE
2809+#if IS_ENABLED(CONFIG_UNICODE)
28102810 err = ext4_fname_setup_ci_filename(dir, iname, fname);
28112811 #endif
28122812
@@ -2822,7 +2822,7 @@ static inline int ext4_fname_prepare_lookup(struct inode *dir, · 9 unmodified lines
28222822
28232823 static inline void ext4_fname_free_filename(struct ext4_filename *fname)
28242824 {
2825−#ifdef CONFIG_UNICODE
2825+#if IS_ENABLED(CONFIG_UNICODE)
28262826 kfree(fname->cf_name.name);
28272827 fname->cf_name.name = NULL;
28282828 #endif
fs/ext4/hash.c+1−1
@@ -290,7 +290,7 @@ static int __ext4fs_dirhash(const struct inode *dir, const char *name, int len, · 289 unmodified lines
290290 int ext4fs_dirhash(const struct inode *dir, const char *name, int len,
291291 struct dx_hash_info *hinfo)
292292 {
293−#ifdef CONFIG_UNICODE
293+#if IS_ENABLED(CONFIG_UNICODE)
294294 const struct unicode_map *um = dir->i_sb->s_encoding;
295295 int r, dlen;
296296 unsigned char *buff;
fs/ext4/namei.c+6−6
@@ -1317,7 +1317,7 @@ static void dx_insert_block(struct dx_frame *frame, u32 hash, ext4_lblk_t block) · 1316 unmodified lines
13171317 dx_set_count(entries, count + 1);
13181318 }
13191319
1320−#ifdef CONFIG_UNICODE
1320+#if IS_ENABLED(CONFIG_UNICODE)
13211321 /*
13221322 * Test whether a case-insensitive directory entry matches the filename
13231323 * being searched for. If quick is set, assume the name being looked up
@@ -1428,7 +1428,7 @@ static bool ext4_match(struct inode *parent, · 104 unmodified lines
14281428 f.crypto_buf = fname->crypto_buf;
14291429 #endif
14301430
1431−#ifdef CONFIG_UNICODE
1431+#if IS_ENABLED(CONFIG_UNICODE)
14321432 if (parent->i_sb->s_encoding && IS_CASEFOLDED(parent) &&
14331433 (!IS_ENCRYPTED(parent) || fscrypt_has_encryption_key(parent))) {
14341434 if (fname->cf_name.name) {
@@ -1800,7 +1800,7 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi · 365 unmodified lines
18001800 }
18011801 }
18021802
1803−#ifdef CONFIG_UNICODE
1803+#if IS_ENABLED(CONFIG_UNICODE)
18041804 if (!inode && IS_CASEFOLDED(dir)) {
18051805 /* Eventually we want to call d_add_ci(dentry, NULL)
18061806 * for negative dentries in the encoding case as
@@ -2308,7 +2308,7 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry, · 501 unmodified lines
23082308 if (fscrypt_is_nokey_name(dentry))
23092309 return -ENOKEY;
23102310
2311−#ifdef CONFIG_UNICODE
2311+#if IS_ENABLED(CONFIG_UNICODE)
23122312 if (sb_has_strict_encoding(sb) && IS_CASEFOLDED(dir) &&
23132313 sb->s_encoding && utf8_validate(sb->s_encoding, &dentry->d_name))
23142314 return -EINVAL;
@@ -3126,7 +3126,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry) · 811 unmodified lines
31263126 ext4_fc_track_unlink(handle, dentry);
31273127 retval = ext4_mark_inode_dirty(handle, dir);
31283128
3129−#ifdef CONFIG_UNICODE
3129+#if IS_ENABLED(CONFIG_UNICODE)
31303130 /* VFS negative dentries are incompatible with Encoding and
31313131 * Case-insensitiveness. Eventually we'll want avoid
31323132 * invalidating the dentries here, alongside with returning the
@@ -3231,7 +3231,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry) · 98 unmodified lines
32313231 retval = __ext4_unlink(handle, dir, &dentry->d_name, d_inode(dentry));
32323232 if (!retval)
32333233 ext4_fc_track_unlink(handle, dentry);
3234−#ifdef CONFIG_UNICODE
3234+#if IS_ENABLED(CONFIG_UNICODE)
32353235 /* VFS negative dentries are incompatible with Encoding and
32363236 * Case-insensitiveness. Eventually we'll want avoid
32373237 * invalidating the dentries here, alongside with returning the
fs/ext4/super.c+5−5
@@ -1301,7 +1301,7 @@ static void ext4_put_super(struct super_block *sb) · 1300 unmodified lines
13011301 kfree(sbi->s_blockgroup_lock);
13021302 fs_put_dax(sbi->s_daxdev);
13031303 fscrypt_free_dummy_policy(&sbi->s_dummy_enc_policy);
1304−#ifdef CONFIG_UNICODE
1304+#if IS_ENABLED(CONFIG_UNICODE)
13051305 utf8_unload(sb->s_encoding);
13061306 #endif
13071307 kfree(sbi);
@@ -1961,7 +1961,7 @@ static const struct mount_opts { · 653 unmodified lines
19611961 {Opt_err, 0, 0}
19621962 };
19631963
1964−#ifdef CONFIG_UNICODE
1964+#if IS_ENABLED(CONFIG_UNICODE)
19651965 static const struct ext4_sb_encodings {
19661966 __u16 magic;
19671967 char *name;
@@ -3606,7 +3606,7 @@ int ext4_feature_set_ok(struct super_block *sb, int readonly) · 1638 unmodified lines
36063606 return 0;
36073607 }
36083608
3609−#ifndef CONFIG_UNICODE
3609+#if !IS_ENABLED(CONFIG_UNICODE)
36103610 if (ext4_has_feature_casefold(sb)) {
36113611 ext4_msg(sb, KERN_ERR,
36123612 "Filesystem with casefold feature cannot be "
@@ -4610,7 +4610,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb) · 997 unmodified lines
46104610 if (err < 0)
46114611 goto failed_mount;
46124612
4613−#ifdef CONFIG_UNICODE
4613+#if IS_ENABLED(CONFIG_UNICODE)
46144614 if (ext4_has_feature_casefold(sb) && !sb->s_encoding) {
46154615 const struct ext4_sb_encodings *encoding_info;
46164616 struct unicode_map *encoding;
@@ -5514,7 +5514,7 @@ failed_mount: · 897 unmodified lines
55145514 if (sbi->s_chksum_driver)
55155515 crypto_free_shash(sbi->s_chksum_driver);
55165516
5517−#ifdef CONFIG_UNICODE
5517+#if IS_ENABLED(CONFIG_UNICODE)
55185518 utf8_unload(sb->s_encoding);
55195519 #endif
55205520
fs/ext4/sysfs.c+4−4
@@ -309,7 +309,7 @@ EXT4_ATTR_FEATURE(meta_bg_resize); · 308 unmodified lines
309309 EXT4_ATTR_FEATURE(encryption);
310310 EXT4_ATTR_FEATURE(test_dummy_encryption_v2);
311311 #endif
312−#ifdef CONFIG_UNICODE
312+#if IS_ENABLED(CONFIG_UNICODE)
313313 EXT4_ATTR_FEATURE(casefold);
314314 #endif
315315 #ifdef CONFIG_FS_VERITY
@@ -317,7 +317,7 @@ EXT4_ATTR_FEATURE(verity); · 1 unmodified line
317317 #endif
318318 EXT4_ATTR_FEATURE(metadata_csum_seed);
319319 EXT4_ATTR_FEATURE(fast_commit);
320−#if defined(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION)
320+#if IS_ENABLED(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION)
321321 EXT4_ATTR_FEATURE(encrypted_casefold);
322322 #endif
323323
@@ -329,7 +329,7 @@ static struct attribute *ext4_feat_attrs[] = { · 5 unmodified lines
329329 ATTR_LIST(encryption),
330330 ATTR_LIST(test_dummy_encryption_v2),
331331 #endif
332−#ifdef CONFIG_UNICODE
332+#if IS_ENABLED(CONFIG_UNICODE)
333333 ATTR_LIST(casefold),
334334 #endif
335335 #ifdef CONFIG_FS_VERITY
@@ -337,7 +337,7 @@ static struct attribute *ext4_feat_attrs[] = { · 1 unmodified line
337337 #endif
338338 ATTR_LIST(metadata_csum_seed),
339339 ATTR_LIST(fast_commit),
340−#if defined(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION)
340+#if IS_ENABLED(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION)
341341 ATTR_LIST(encrypted_casefold),
342342 #endif
343343 NULL,
fs/f2fs/dir.c+5−5
@@ -16,7 +16,7 @@ · 15 unmodified lines
1616 #include "xattr.h"
1717 #include <trace/events/f2fs.h>
1818
19−#ifdef CONFIG_UNICODE
19+#if IS_ENABLED(CONFIG_UNICODE)
2020 extern struct kmem_cache *f2fs_cf_name_slab;
2121 #endif
2222
@@ -79,7 +79,7 @@ unsigned char f2fs_get_de_type(struct f2fs_dir_entry *de) · 56 unmodified lines
7979 int f2fs_init_casefolded_name(const struct inode *dir,
8080 struct f2fs_filename *fname)
8181 {
82−#ifdef CONFIG_UNICODE
82+#if IS_ENABLED(CONFIG_UNICODE)
8383 struct super_block *sb = dir->i_sb;
8484
8585 if (IS_CASEFOLDED(dir)) {
@@ -174,7 +174,7 @@ void f2fs_free_filename(struct f2fs_filename *fname) · 88 unmodified lines
174174 kfree(fname->crypto_buf.name);
175175 fname->crypto_buf.name = NULL;
176176 #endif
177−#ifdef CONFIG_UNICODE
177+#if IS_ENABLED(CONFIG_UNICODE)
178178 if (fname->cf_name.name) {
179179 kmem_cache_free(f2fs_cf_name_slab, fname->cf_name.name);
180180 fname->cf_name.name = NULL;
@@ -208,7 +208,7 @@ static struct f2fs_dir_entry *find_in_block(struct inode *dir, · 27 unmodified lines
208208 return f2fs_find_target_dentry(&d, fname, max_slots);
209209 }
210210
211−#ifdef CONFIG_UNICODE
211+#if IS_ENABLED(CONFIG_UNICODE)
212212 /*
213213 * Test whether a case-insensitive directory entry matches the filename
214214 * being searched for.
@@ -266,7 +266,7 @@ static inline int f2fs_match_name(const struct inode *dir, · 51 unmodified lines
266266 {
267267 struct fscrypt_name f;
268268
269−#ifdef CONFIG_UNICODE
269+#if IS_ENABLED(CONFIG_UNICODE)
270270 if (fname->cf_name.name) {
271271 struct qstr cf = FSTR_TO_QSTR(&fname->cf_name);
272272
fs/f2fs/f2fs.h+1−1
@@ -488,7 +488,7 @@ struct f2fs_filename { · 487 unmodified lines
488488 */
489489 struct fscrypt_str crypto_buf;
490490 #endif
491−#ifdef CONFIG_UNICODE
491+#if IS_ENABLED(CONFIG_UNICODE)
492492 /*
493493 * For casefolded directories: the casefolded name, but it's left NULL
494494 * if the original name is not valid Unicode, if the directory is both
fs/f2fs/hash.c+1−1
@@ -105,7 +105,7 @@ void f2fs_hash_filename(const struct inode *dir, struct f2fs_filename *fname) · 104 unmodified lines
105105 return;
106106 }
107107
108−#ifdef CONFIG_UNICODE
108+#if IS_ENABLED(CONFIG_UNICODE)
109109 if (IS_CASEFOLDED(dir)) {
110110 /*
111111 * If the casefolded name is provided, hash it instead of the
fs/f2fs/namei.c+2−2
@@ -561,7 +561,7 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, · 560 unmodified lines
561561 goto out_iput;
562562 }
563563 out_splice:
564−#ifdef CONFIG_UNICODE
564+#if IS_ENABLED(CONFIG_UNICODE)
565565 if (!inode && IS_CASEFOLDED(dir)) {
566566 /* Eventually we want to call d_add_ci(dentry, NULL)
567567 * for negative dentries in the encoding case as
@@ -622,7 +622,7 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry) · 54 unmodified lines
622622 goto fail;
623623 }
624624 f2fs_delete_entry(de, page, dir, inode);
625−#ifdef CONFIG_UNICODE
625+#if IS_ENABLED(CONFIG_UNICODE)
626626 /* VFS negative dentries are incompatible with Encoding and
627627 * Case-insensitiveness. Eventually we'll want avoid
628628 * invalidating the dentries here, alongside with returning the
fs/f2fs/recovery.c+2−2
@@ -46,7 +46,7 @@ · 45 unmodified lines
4646
4747 static struct kmem_cache *fsync_entry_slab;
4848
49−#ifdef CONFIG_UNICODE
49+#if IS_ENABLED(CONFIG_UNICODE)
5050 extern struct kmem_cache *f2fs_cf_name_slab;
5151 #endif
5252
@@ -149,7 +149,7 @@ static int init_recovered_filename(const struct inode *dir, · 96 unmodified lines
149149 if (err)
150150 return err;
151151 f2fs_hash_filename(dir, fname);
152−#ifdef CONFIG_UNICODE
152+#if IS_ENABLED(CONFIG_UNICODE)
153153 /* Case-sensitive match is fine for recovery */
154154 kmem_cache_free(f2fs_cf_name_slab, fname->cf_name.name);
155155 fname->cf_name.name = NULL;
fs/f2fs/super.c+5−5
@@ -257,7 +257,7 @@ void f2fs_printk(struct f2fs_sb_info *sbi, const char *fmt, ...) · 256 unmodified lines
257257 va_end(args);
258258 }
259259
260−#ifdef CONFIG_UNICODE
260+#if IS_ENABLED(CONFIG_UNICODE)
261261 static const struct f2fs_sb_encodings {
262262 __u16 magic;
263263 char *name;
@@ -1259,7 +1259,7 @@ default_check: · 995 unmodified lines
12591259 return -EINVAL;
12601260 }
12611261 #endif
1262−#ifndef CONFIG_UNICODE
1262+#if !IS_ENABLED(CONFIG_UNICODE)
12631263 if (f2fs_sb_has_casefold(sbi)) {
12641264 f2fs_err(sbi,
12651265 "Filesystem with casefold feature cannot be mounted without CONFIG_UNICODE");
@@ -1619,7 +1619,7 @@ static void f2fs_put_super(struct super_block *sb) · 353 unmodified lines
16191619 f2fs_destroy_iostat(sbi);
16201620 for (i = 0; i < NR_PAGE_TYPE; i++)
16211621 kvfree(sbi->write_io[i]);
1622−#ifdef CONFIG_UNICODE
1622+#if IS_ENABLED(CONFIG_UNICODE)
16231623 utf8_unload(sb->s_encoding);
16241624 #endif
16251625 kfree(sbi);
@@ -3903,7 +3903,7 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi) · 2277 unmodified lines
39033903
39043904 static int f2fs_setup_casefold(struct f2fs_sb_info *sbi)
39053905 {
3906−#ifdef CONFIG_UNICODE
3906+#if IS_ENABLED(CONFIG_UNICODE)
39073907 if (f2fs_sb_has_casefold(sbi) && !sbi->sb->s_encoding) {
39083908 const struct f2fs_sb_encodings *encoding_info;
39093909 struct unicode_map *encoding;
@@ -4458,7 +4458,7 @@ free_bio_info: · 548 unmodified lines
44584458 for (i = 0; i < NR_PAGE_TYPE; i++)
44594459 kvfree(sbi->write_io[i]);
44604460
4461−#ifdef CONFIG_UNICODE
4461+#if IS_ENABLED(CONFIG_UNICODE)
44624462 utf8_unload(sb->s_encoding);
44634463 sb->s_encoding = NULL;
44644464 #endif
fs/f2fs/sysfs.c+5−5
@@ -201,7 +201,7 @@ static ssize_t unusable_show(struct f2fs_attr *a, · 200 unmodified lines
201201 static ssize_t encoding_show(struct f2fs_attr *a,
202202 struct f2fs_sb_info *sbi, char *buf)
203203 {
204−#ifdef CONFIG_UNICODE
204+#if IS_ENABLED(CONFIG_UNICODE)
205205 struct super_block *sb = sbi->sb;
206206
207207 if (f2fs_sb_has_casefold(sbi))
@@ -778,7 +778,7 @@ F2FS_GENERAL_RO_ATTR(avg_vblocks); · 570 unmodified lines
778778 #ifdef CONFIG_FS_ENCRYPTION
779779 F2FS_FEATURE_RO_ATTR(encryption);
780780 F2FS_FEATURE_RO_ATTR(test_dummy_encryption_v2);
781−#ifdef CONFIG_UNICODE
781+#if IS_ENABLED(CONFIG_UNICODE)
782782 F2FS_FEATURE_RO_ATTR(encrypted_casefold);
783783 #endif
784784 #endif /* CONFIG_FS_ENCRYPTION */
@@ -797,7 +797,7 @@ F2FS_FEATURE_RO_ATTR(lost_found); · 12 unmodified lines
797797 F2FS_FEATURE_RO_ATTR(verity);
798798 #endif
799799 F2FS_FEATURE_RO_ATTR(sb_checksum);
800−#ifdef CONFIG_UNICODE
800+#if IS_ENABLED(CONFIG_UNICODE)
801801 F2FS_FEATURE_RO_ATTR(casefold);
802802 #endif
803803 F2FS_FEATURE_RO_ATTR(readonly);
@@ -910,7 +910,7 @@ static struct attribute *f2fs_feat_attrs[] = { · 106 unmodified lines
910910 #ifdef CONFIG_FS_ENCRYPTION
911911 ATTR_LIST(encryption),
912912 ATTR_LIST(test_dummy_encryption_v2),
913−#ifdef CONFIG_UNICODE
913+#if IS_ENABLED(CONFIG_UNICODE)
914914 ATTR_LIST(encrypted_casefold),
915915 #endif
916916 #endif /* CONFIG_FS_ENCRYPTION */
@@ -929,7 +929,7 @@ static struct attribute *f2fs_feat_attrs[] = { · 12 unmodified lines
929929 ATTR_LIST(verity),
930930 #endif
931931 ATTR_LIST(sb_checksum),
932−#ifdef CONFIG_UNICODE
932+#if IS_ENABLED(CONFIG_UNICODE)
933933 ATTR_LIST(casefold),
934934 #endif
935935 ATTR_LIST(readonly),
fs/io_uring.c+8−3
@@ -7822,10 +7822,15 @@ static __cold void io_rsrc_node_ref_zero(struct percpu_ref *ref) · 7821 unmodified lines
78227822 struct io_ring_ctx *ctx = node->rsrc_data->ctx;
78237823 unsigned long flags;
78247824 bool first_add = false;
7825+ unsigned long delay = HZ;
78257826
78267827 spin_lock_irqsave(&ctx->rsrc_ref_lock, flags);
78277828 node->done = true;
78287829
7830+ /* if we are mid-quiesce then do not delay */
7831+ if (node->rsrc_data->quiesce)
7832+ delay = 0;
7833+
78297834 while (!list_empty(&ctx->rsrc_ref_list)) {
78307835 node = list_first_entry(&ctx->rsrc_ref_list,
78317836 struct io_rsrc_node, node);
@@ -7838,10 +7843,10 @@ static __cold void io_rsrc_node_ref_zero(struct percpu_ref *ref) · 6 unmodified lines
78387843 spin_unlock_irqrestore(&ctx->rsrc_ref_lock, flags);
78397844
78407845 if (first_add)
7841− mod_delayed_work(system_wq, &ctx->rsrc_put_work, HZ);
7846+ mod_delayed_work(system_wq, &ctx->rsrc_put_work, delay);
78427847 }
78437848
7844−static struct io_rsrc_node *io_rsrc_node_alloc(struct io_ring_ctx *ctx)
7849+static struct io_rsrc_node *io_rsrc_node_alloc(void)
78457850 {
78467851 struct io_rsrc_node *ref_node;
78477852
@@ -7892,7 +7897,7 @@ static int io_rsrc_node_switch_start(struct io_ring_ctx *ctx) · 44 unmodified lines
78927897 {
78937898 if (ctx->rsrc_backup_node)
78947899 return 0;
7895− ctx->rsrc_backup_node = io_rsrc_node_alloc(ctx);
7900+ ctx->rsrc_backup_node = io_rsrc_node_alloc();
78967901 return ctx->rsrc_backup_node ? 0 : -ENOMEM;
78977902 }
78987903
fs/jbd2/journal.c+2−0
@@ -2972,6 +2972,7 @@ struct journal_head *jbd2_journal_grab_journal_head(struct buffer_head *bh) · 2971 unmodified lines
29722972 jbd_unlock_bh_journal_head(bh);
29732973 return jh;
29742974 }
2975+EXPORT_SYMBOL(jbd2_journal_grab_journal_head);
29752976
29762977 static void __journal_remove_journal_head(struct buffer_head *bh)
29772978 {
@@ -3024,6 +3025,7 @@ void jbd2_journal_put_journal_head(struct journal_head *jh) · 46 unmodified lines
30243025 jbd_unlock_bh_journal_head(bh);
30253026 }
30263027 }
3028+EXPORT_SYMBOL(jbd2_journal_put_journal_head);
30273029
30283030 /*
30293031 * Initialize jbd inode head
fs/libfs.c+5−5
@@ -1379,7 +1379,7 @@ bool is_empty_dir_inode(struct inode *inode) · 1378 unmodified lines
13791379 (inode->i_op == &empty_dir_inode_operations);
13801380 }
13811381
1382−#ifdef CONFIG_UNICODE
1382+#if IS_ENABLED(CONFIG_UNICODE)
13831383 /*
13841384 * Determine if the name of a dentry should be casefolded.
13851385 *
@@ -1473,7 +1473,7 @@ static const struct dentry_operations generic_encrypted_dentry_ops = { · 87 unmodified lines
14731473 };
14741474 #endif
14751475
1476−#if defined(CONFIG_FS_ENCRYPTION) && defined(CONFIG_UNICODE)
1476+#if defined(CONFIG_FS_ENCRYPTION) && IS_ENABLED(CONFIG_UNICODE)
14771477 static const struct dentry_operations generic_encrypted_ci_dentry_ops = {
14781478 .d_hash = generic_ci_d_hash,
14791479 .d_compare = generic_ci_d_compare,
@@ -1508,10 +1508,10 @@ void generic_set_encrypted_ci_d_ops(struct dentry *dentry) · 28 unmodified lines
15081508 #ifdef CONFIG_FS_ENCRYPTION
15091509 bool needs_encrypt_ops = dentry->d_flags & DCACHE_NOKEY_NAME;
15101510 #endif
1511−#ifdef CONFIG_UNICODE
1511+#if IS_ENABLED(CONFIG_UNICODE)
15121512 bool needs_ci_ops = dentry->d_sb->s_encoding;
15131513 #endif
1514−#if defined(CONFIG_FS_ENCRYPTION) && defined(CONFIG_UNICODE)
1514+#if defined(CONFIG_FS_ENCRYPTION) && IS_ENABLED(CONFIG_UNICODE)
15151515 if (needs_encrypt_ops && needs_ci_ops) {
15161516 d_set_d_op(dentry, &generic_encrypted_ci_dentry_ops);
15171517 return;
@@ -1523,7 +1523,7 @@ void generic_set_encrypted_ci_d_ops(struct dentry *dentry) · 5 unmodified lines
15231523 return;
15241524 }
15251525 #endif
1526−#ifdef CONFIG_UNICODE
1526+#if IS_ENABLED(CONFIG_UNICODE)
15271527 if (needs_ci_ops) {
15281528 d_set_d_op(dentry, &generic_ci_dentry_ops);
15291529 return;
fs/lockd/svcsubs.c+10−8
@@ -179,19 +179,21 @@ nlm_delete_file(struct nlm_file *file) · 178 unmodified lines
179179 static int nlm_unlock_files(struct nlm_file *file)
180180 {
181181 struct file_lock lock;
182− struct file *f;
183182
183+ locks_init_lock(&lock);
184184 lock.fl_type = F_UNLCK;
185185 lock.fl_start = 0;
186186 lock.fl_end = OFFSET_MAX;
187− for (f = file->f_file[0]; f <= file->f_file[1]; f++) {
188− if (f && vfs_lock_file(f, F_SETLK, &lock, NULL) < 0) {
189− pr_warn("lockd: unlock failure in %s:%d\n",
190− __FILE__, __LINE__);
191− return 1;
192− }
193− }
187+ if (file->f_file[O_RDONLY] &&
188+ vfs_lock_file(file->f_file[O_RDONLY], F_SETLK, &lock, NULL))
189+ goto out_err;
190+ if (file->f_file[O_WRONLY] &&
191+ vfs_lock_file(file->f_file[O_WRONLY], F_SETLK, &lock, NULL))
192+ goto out_err;
194193 return 0;
194+out_err:
195+ pr_warn("lockd: unlock failure in %s:%d\n", __FILE__, __LINE__);
196+ return 1;
195197 }
196198
197199 /*
fs/namei.c+5−5
@@ -4024,13 +4024,12 @@ int vfs_rmdir(struct user_namespace *mnt_userns, struct inode *dir, · 4023 unmodified lines
40244024 dentry->d_inode->i_flags |= S_DEAD;
40254025 dont_mount(dentry);
40264026 detach_mounts(dentry);
4027− fsnotify_rmdir(dir, dentry);
40284027
40294028 out:
40304029 inode_unlock(dentry->d_inode);
40314030 dput(dentry);
40324031 if (!error)
4033− d_delete(dentry);
4032+ d_delete_notify(dir, dentry);
40344033 return error;
40354034 }
40364035 EXPORT_SYMBOL(vfs_rmdir);
@@ -4152,7 +4151,6 @@ int vfs_unlink(struct user_namespace *mnt_userns, struct inode *dir, · 115 unmodified lines
41524151 if (!error) {
41534152 dont_mount(dentry);
41544153 detach_mounts(dentry);
4155− fsnotify_unlink(dir, dentry);
41564154 }
41574155 }
41584156 }
@@ -4160,9 +4158,11 @@ out: · 1 unmodified line
41604158 inode_unlock(target);
41614159
41624160 /* We don't d_delete() NFS sillyrenamed files--they still exist. */
4163− if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) {
4161+ if (!error && dentry->d_flags & DCACHE_NFSFS_RENAMED) {
4162+ fsnotify_unlink(dir, dentry);
4163+ } else if (!error) {
41644164 fsnotify_link_count(target);
4165− d_delete(dentry);
4165+ d_delete_notify(dir, dentry);
41664166 }
41674167
41684168 return error;
fs/nfsd/nfs4state.c+3−1
@@ -4130,8 +4130,10 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, · 4129 unmodified lines
41304130 status = nfserr_clid_inuse;
41314131 if (client_has_state(old)
41324132 && !same_creds(&unconf->cl_cred,
4133− &old->cl_cred))
4133+ &old->cl_cred)) {
4134+ old = NULL;
41344135 goto out;
4136+ }
41354137 status = mark_client_expired_locked(old);
41364138 if (status) {
41374139 old = NULL;
fs/nfsd/nfsctl.c+3−2
@@ -1247,7 +1247,8 @@ static void nfsdfs_remove_file(struct inode *dir, struct dentry *dentry) · 1246 unmodified lines
12471247 clear_ncl(d_inode(dentry));
12481248 dget(dentry);
12491249 ret = simple_unlink(dir, dentry);
1250− d_delete(dentry);
1250+ d_drop(dentry);
1251+ fsnotify_unlink(dir, dentry);
12511252 dput(dentry);
12521253 WARN_ON_ONCE(ret);
12531254 }
@@ -1338,8 +1339,8 @@ void nfsd_client_rmdir(struct dentry *dentry) · 84 unmodified lines
13381339 dget(dentry);
13391340 ret = simple_rmdir(dir, dentry);
13401341 WARN_ON_ONCE(ret);
1342+ d_drop(dentry);
13411343 fsnotify_rmdir(dir, dentry);
1342− d_delete(dentry);
13431344 dput(dentry);
13441345 inode_unlock(dir);
13451346 }
fs/notify/fanotify/fanotify_user.c+3−6
@@ -158,7 +158,6 @@ static size_t fanotify_event_len(unsigned int info_mode, · 157 unmodified lines
158158 struct fanotify_event *event)
159159 {
160160 size_t event_len = FAN_EVENT_METADATA_LEN;
161− struct fanotify_info *info;
162161 int fh_len;
163162 int dot_len = 0;
164163
@@ -168,8 +167,6 @@ static size_t fanotify_event_len(unsigned int info_mode, · 3 unmodified lines
168167 if (fanotify_is_error_event(event->mask))
169168 event_len += FANOTIFY_ERROR_INFO_LEN;
170169
171− info = fanotify_event_info(event);
172−
173170 if (fanotify_event_has_any_dir_fh(event)) {
174171 event_len += fanotify_dir_name_info_len(event);
175172 } else if ((info_mode & FAN_REPORT_NAME) &&
@@ -704,9 +701,6 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group, · 528 unmodified lines
704701 if (fanotify_is_perm_event(event->mask))
705702 FANOTIFY_PERM(event)->fd = fd;
706703
707− if (f)
708− fd_install(fd, f);
709−
710704 if (info_mode) {
711705 ret = copy_info_records_to_user(event, info, info_mode, pidfd,
712706 buf, count);
@@ -714,6 +708,9 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group, · 1 unmodified line
714708 goto out_close_fd;
715709 }
716710
711+ if (f)
712+ fd_install(fd, f);
713+
717714 return metadata.event_len;
718715
719716 out_close_fd:
fs/ocfs2/stackglue.c+1−12
@@ -661,17 +661,6 @@ static struct ctl_table ocfs2_nm_table[] = { · 660 unmodified lines
661661 { }
662662 };
663663
664−static struct ctl_table ocfs2_mod_table[] = {
665− {
666− .procname = "nm",
667− .data = NULL,
668− .maxlen = 0,
669− .mode = 0555,
670− .child = ocfs2_nm_table
671− },
672− { }
673−};
674−
675664 static struct ctl_table_header *ocfs2_table_header;
676665
677666 /*
@@ -682,7 +671,7 @@ static int __init ocfs2_stack_glue_init(void) · 4 unmodified lines
682671 {
683672 strcpy(cluster_stack_name, OCFS2_STACK_PLUGIN_O2CB);
684673
685− ocfs2_table_header = register_sysctl("fs/ocfs2", ocfs2_mod_table);
674+ ocfs2_table_header = register_sysctl("fs/ocfs2/nm", ocfs2_nm_table);
686675 if (!ocfs2_table_header) {
687676 printk(KERN_ERR
688677 "ocfs2 stack glue: unable to register sysctl\n");
fs/ocfs2/suballoc.c+11−14
@@ -1251,26 +1251,23 @@ static int ocfs2_test_bg_bit_allocatable(struct buffer_head *bg_bh, · 1250 unmodified lines
12511251 {
12521252 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data;
12531253 struct journal_head *jh;
1254− int ret = 1;
1254+ int ret;
12551255
12561256 if (ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap))
12571257 return 0;
12581258
1259− if (!buffer_jbd(bg_bh))
1259+ jh = jbd2_journal_grab_journal_head(bg_bh);
1260+ if (!jh)
12601261 return 1;
12611262
1262− jbd_lock_bh_journal_head(bg_bh);
1263− if (buffer_jbd(bg_bh)) {
1264− jh = bh2jh(bg_bh);
1265− spin_lock(&jh->b_state_lock);
1266− bg = (struct ocfs2_group_desc *) jh->b_committed_data;
1267− if (bg)
1268− ret = !ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap);
1269− else
1270− ret = 1;
1271− spin_unlock(&jh->b_state_lock);
1272− }
1273− jbd_unlock_bh_journal_head(bg_bh);
1263+ spin_lock(&jh->b_state_lock);
1264+ bg = (struct ocfs2_group_desc *) jh->b_committed_data;
1265+ if (bg)
1266+ ret = !ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap);
1267+ else
1268+ ret = 1;
1269+ spin_unlock(&jh->b_state_lock);
1270+ jbd2_journal_put_journal_head(jh);
12741271
12751272 return ret;
12761273 }
fs/overlayfs/copy_up.c+13−3
@@ -145,7 +145,7 @@ static int ovl_copy_fileattr(struct inode *inode, struct path *old, · 144 unmodified lines
145145 if (err == -ENOTTY || err == -EINVAL)
146146 return 0;
147147 pr_warn("failed to retrieve lower fileattr (%pd2, err=%i)\n",
148− old, err);
148+ old->dentry, err);
149149 return err;
150150 }
151151
@@ -157,7 +157,9 @@ static int ovl_copy_fileattr(struct inode *inode, struct path *old, · 5 unmodified lines
157157 */
158158 if (oldfa.flags & OVL_PROT_FS_FLAGS_MASK) {
159159 err = ovl_set_protattr(inode, new->dentry, &oldfa);
160− if (err)
160+ if (err == -EPERM)
161+ pr_warn_once("copying fileattr: no xattr on upper\n");
162+ else if (err)
161163 return err;
162164 }
163165
@@ -167,8 +169,16 @@ static int ovl_copy_fileattr(struct inode *inode, struct path *old, · 3 unmodified lines
167169
168170 err = ovl_real_fileattr_get(new, &newfa);
169171 if (err) {
172+ /*
173+ * Returning an error if upper doesn't support fileattr will
174+ * result in a regression, so revert to the old behavior.
175+ */
176+ if (err == -ENOTTY || err == -EINVAL) {
177+ pr_warn_once("copying fileattr: no support on upper\n");
178+ return 0;
179+ }
170180 pr_warn("failed to retrieve upper fileattr (%pd2, err=%i)\n",
171− new, err);
181+ new->dentry, err);
172182 return err;
173183 }
174184
fs/udf/inode.c+4−5
@@ -258,10 +258,6 @@ int udf_expand_file_adinicb(struct inode *inode) · 257 unmodified lines
258258 char *kaddr;
259259 struct udf_inode_info *iinfo = UDF_I(inode);
260260 int err;
261− struct writeback_control udf_wbc = {
262− .sync_mode = WB_SYNC_NONE,
263− .nr_to_write = 1,
264− };
265261
266262 WARN_ON_ONCE(!inode_is_locked(inode));
267263 if (!iinfo->i_lenAlloc) {
@@ -305,8 +301,10 @@ int udf_expand_file_adinicb(struct inode *inode) · 37 unmodified lines
305301 iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG;
306302 /* from now on we have normal address_space methods */
307303 inode->i_data.a_ops = &udf_aops;
304+ set_page_dirty(page);
305+ unlock_page(page);
308306 up_write(&iinfo->i_data_sem);
309− err = inode->i_data.a_ops->writepage(page, &udf_wbc);
307+ err = filemap_fdatawrite(inode->i_mapping);
310308 if (err) {
311309 /* Restore everything back so that we don't lose data... */
312310 lock_page(page);
@@ -317,6 +315,7 @@ int udf_expand_file_adinicb(struct inode *inode) · 4 unmodified lines
317315 unlock_page(page);
318316 iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB;
319317 inode->i_data.a_ops = &udf_adinicb_aops;
318+ iinfo->i_lenAlloc = inode->i_size;
320319 up_write(&iinfo->i_data_sem);
321320 }
322321 put_page(page);
fs/unicode/Kconfig+5−13
@@ -3,21 +3,13 @@ · 2 unmodified lines
33 # UTF-8 normalization
44 #
55 config UNICODE
6− bool "UTF-8 normalization and casefolding support"
6+ tristate "UTF-8 normalization and casefolding support"
77 help
88 Say Y here to enable UTF-8 NFD normalization and NFD+CF casefolding
9− support.
10−
11−config UNICODE_UTF8_DATA
12− tristate "UTF-8 normalization and casefolding tables"
13− depends on UNICODE
14− default UNICODE
15− help
16− This contains a large table of case foldings, which can be loaded as
17− a separate module if you say M here. To be on the safe side stick
18− to the default of Y. Saying N here makes no sense, if you do not want
19− utf8 casefolding support, disable CONFIG_UNICODE instead.
9+ support. If you say M here the large table of case foldings will
10+ be a separate loadable module that gets requested only when a file
11+ system actually use it.
2012
2113 config UNICODE_NORMALIZATION_SELFTEST
2214 tristate "Test UTF-8 normalization support"
23− depends on UNICODE_UTF8_DATA
15+ depends on UNICODE
fs/unicode/Makefile+4−2
@@ -1,8 +1,10 @@
11 # SPDX-License-Identifier: GPL-2.0
22
3−obj-$(CONFIG_UNICODE) += unicode.o
3+ifneq ($(CONFIG_UNICODE),)
4+obj-y += unicode.o
5+endif
6+obj-$(CONFIG_UNICODE) += utf8data.o
47 obj-$(CONFIG_UNICODE_NORMALIZATION_SELFTEST) += utf8-selftest.o
5−obj-$(CONFIG_UNICODE_UTF8_DATA) += utf8data.o
68
79 unicode-y := utf8-norm.o utf8-core.o
810
include/linux/blkdev.h+1−0
@@ -1258,6 +1258,7 @@ unsigned long disk_start_io_acct(struct gendisk *disk, unsigned int sectors, · 1257 unmodified lines
12581258 void disk_end_io_acct(struct gendisk *disk, unsigned int op,
12591259 unsigned long start_time);
12601260
1261+void bio_start_io_acct_time(struct bio *bio, unsigned long start_time);
12611262 unsigned long bio_start_io_acct(struct bio *bio);
12621263 void bio_end_io_acct_remapped(struct bio *bio, unsigned long start_time,
12631264 struct block_device *orig_bdev);
include/linux/fs.h+1−1
@@ -1483,7 +1483,7 @@ struct super_block { · 1482 unmodified lines
14831483 #ifdef CONFIG_FS_VERITY
14841484 const struct fsverity_operations *s_vop;
14851485 #endif
1486−#ifdef CONFIG_UNICODE
1486+#if IS_ENABLED(CONFIG_UNICODE)
14871487 struct unicode_map *s_encoding;
14881488 __u16 s_encoding_flags;
14891489 #endif
include/linux/fsnotify.h+43−6
@@ -224,6 +224,43 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, · 223 unmodified lines
224224 dir, &new_dentry->d_name, 0);
225225 }
226226
227+/*
228+ * fsnotify_delete - @dentry was unlinked and unhashed
229+ *
230+ * Caller must make sure that dentry->d_name is stable.
231+ *
232+ * Note: unlike fsnotify_unlink(), we have to pass also the unlinked inode
233+ * as this may be called after d_delete() and old_dentry may be negative.
234+ */
235+static inline void fsnotify_delete(struct inode *dir, struct inode *inode,
236+ struct dentry *dentry)
237+{
238+ __u32 mask = FS_DELETE;
239+
240+ if (S_ISDIR(inode->i_mode))
241+ mask |= FS_ISDIR;
242+
243+ fsnotify_name(mask, inode, FSNOTIFY_EVENT_INODE, dir, &dentry->d_name,
244+ 0);
245+}
246+
247+/**
248+ * d_delete_notify - delete a dentry and call fsnotify_delete()
249+ * @dentry: The dentry to delete
250+ *
251+ * This helper is used to guaranty that the unlinked inode cannot be found
252+ * by lookup of this name after fsnotify_delete() event has been delivered.
253+ */
254+static inline void d_delete_notify(struct inode *dir, struct dentry *dentry)
255+{
256+ struct inode *inode = d_inode(dentry);
257+
258+ ihold(inode);
259+ d_delete(dentry);
260+ fsnotify_delete(dir, inode, dentry);
261+ iput(inode);
262+}
263+
227264 /*
228265 * fsnotify_unlink - 'name' was unlinked
229266 *
@@ -231,10 +268,10 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, · 1 unmodified line
231268 */
232269 static inline void fsnotify_unlink(struct inode *dir, struct dentry *dentry)
233270 {
234− /* Expected to be called before d_delete() */
235− WARN_ON_ONCE(d_is_negative(dentry));
271+ if (WARN_ON_ONCE(d_is_negative(dentry)))
272+ return;
236273
237− fsnotify_dirent(dir, dentry, FS_DELETE);
274+ fsnotify_delete(dir, d_inode(dentry), dentry);
238275 }
239276
240277 /*
@@ -258,10 +295,10 @@ static inline void fsnotify_mkdir(struct inode *dir, struct dentry *dentry) · 17 unmodified lines
258295 */
259296 static inline void fsnotify_rmdir(struct inode *dir, struct dentry *dentry)
260297 {
261− /* Expected to be called before d_delete() */
262− WARN_ON_ONCE(d_is_negative(dentry));
298+ if (WARN_ON_ONCE(d_is_negative(dentry)))
299+ return;
263300
264− fsnotify_dirent(dir, dentry, FS_DELETE | FS_ISDIR);
301+ fsnotify_delete(dir, d_inode(dentry), dentry);
265302 }
266303
267304 /*
include/linux/if_vlan.h+4−2
@@ -46,8 +46,10 @@ struct vlan_hdr { · 45 unmodified lines
4646 * @h_vlan_encapsulated_proto: packet type ID or len
4747 */
4848 struct vlan_ethhdr {
49− unsigned char h_dest[ETH_ALEN];
50− unsigned char h_source[ETH_ALEN];
49+ struct_group(addrs,
50+ unsigned char h_dest[ETH_ALEN];
51+ unsigned char h_source[ETH_ALEN];
52+ );
5153 __be16 h_vlan_proto;
5254 __be16 h_vlan_TCI;
5355 __be16 h_vlan_encapsulated_proto;
include/linux/lsm_hook_defs.h+1−1
@@ -80,7 +80,7 @@ LSM_HOOK(int, 0, sb_clone_mnt_opts, const struct super_block *oldsb, · 79 unmodified lines
8080 unsigned long *set_kern_flags)
8181 LSM_HOOK(int, 0, move_mount, const struct path *from_path,
8282 const struct path *to_path)
83−LSM_HOOK(int, 0, dentry_init_security, struct dentry *dentry,
83+LSM_HOOK(int, -EOPNOTSUPP, dentry_init_security, struct dentry *dentry,
8484 int mode, const struct qstr *name, const char **xattr_name,
8585 void **ctx, u32 *ctxlen)
8686 LSM_HOOK(int, 0, dentry_create_files_as, struct dentry *dentry, int mode,
include/linux/mm.h+12−5
@@ -1506,11 +1506,18 @@ static inline u8 page_kasan_tag(const struct page *page) · 1505 unmodified lines
15061506
15071507 static inline void page_kasan_tag_set(struct page *page, u8 tag)
15081508 {
1509− if (kasan_enabled()) {
1510− tag ^= 0xff;
1511− page->flags &= ~(KASAN_TAG_MASK << KASAN_TAG_PGSHIFT);
1512− page->flags |= (tag & KASAN_TAG_MASK) << KASAN_TAG_PGSHIFT;
1513− }
1509+ unsigned long old_flags, flags;
1510+
1511+ if (!kasan_enabled())
1512+ return;
1513+
1514+ tag ^= 0xff;
1515+ old_flags = READ_ONCE(page->flags);
1516+ do {
1517+ flags = old_flags;
1518+ flags &= ~(KASAN_TAG_MASK << KASAN_TAG_PGSHIFT);
1519+ flags |= (tag & KASAN_TAG_MASK) << KASAN_TAG_PGSHIFT;
1520+ } while (unlikely(!try_cmpxchg(&page->flags, &old_flags, flags)));
15141521 }
15151522
15161523 static inline void page_kasan_tag_reset(struct page *page)
include/linux/mm_types.h+1−0
@@ -261,6 +261,7 @@ static_assert(sizeof(struct page) == sizeof(struct folio)); · 260 unmodified lines
261261 static_assert(offsetof(struct page, pg) == offsetof(struct folio, fl))
262262 FOLIO_MATCH(flags, flags);
263263 FOLIO_MATCH(lru, lru);
264+FOLIO_MATCH(mapping, mapping);
264265 FOLIO_MATCH(compound_head, lru);
265266 FOLIO_MATCH(index, index);
266267 FOLIO_MATCH(private, private);
include/linux/psi.h+5−6
@@ -25,18 +25,17 @@ void psi_memstall_enter(unsigned long *flags); · 24 unmodified lines
2525 void psi_memstall_leave(unsigned long *flags);
2626
2727 int psi_show(struct seq_file *s, struct psi_group *group, enum psi_res res);
28−
29−#ifdef CONFIG_CGROUPS
30−int psi_cgroup_alloc(struct cgroup *cgrp);
31−void psi_cgroup_free(struct cgroup *cgrp);
32−void cgroup_move_task(struct task_struct *p, struct css_set *to);
33−
3428 struct psi_trigger *psi_trigger_create(struct psi_group *group,
3529 char *buf, size_t nbytes, enum psi_res res);
3630 void psi_trigger_destroy(struct psi_trigger *t);
3731
3832 __poll_t psi_trigger_poll(void **trigger_ptr, struct file *file,
3933 poll_table *wait);
34+
35+#ifdef CONFIG_CGROUPS
36+int psi_cgroup_alloc(struct cgroup *cgrp);
37+void psi_cgroup_free(struct cgroup *cgrp);
38+void cgroup_move_task(struct task_struct *p, struct css_set *to);
4039 #endif
4140
4241 #else /* CONFIG_PSI */
include/linux/quota.h+1−1
@@ -91,7 +91,7 @@ extern bool qid_valid(struct kqid qid); · 90 unmodified lines
9191 *
9292 * When there is no mapping defined for the user-namespace, type,
9393 * qid tuple an invalid kqid is returned. Callers are expected to
94− * test for and handle handle invalid kqids being returned.
94+ * test for and handle invalid kqids being returned.
9595 * Invalid kqids may be tested for using qid_valid().
9696 */
9797 static inline struct kqid make_kqid(struct user_namespace *from,
include/linux/sched.h+0−1
@@ -1680,7 +1680,6 @@ extern struct pid *cad_pid; · 1679 unmodified lines
16801680 #define PF_MEMALLOC 0x00000800 /* Allocating memory */
16811681 #define PF_NPROC_EXCEEDED 0x00001000 /* set_user() noticed that RLIMIT_NPROC was exceeded */
16821682 #define PF_USED_MATH 0x00002000 /* If unset the fpu must be initialized before use */
1683−#define PF_USED_ASYNC 0x00004000 /* Used async_schedule*(), used by module init */
16841683 #define PF_NOFREEZE 0x00008000 /* This thread should not be frozen */
16851684 #define PF_FROZEN 0x00010000 /* Frozen for system suspend */
16861685 #define PF_KSWAPD 0x00020000 /* I am kswapd */
include/linux/suspend.h+1−10
@@ -430,15 +430,7 @@ struct platform_hibernation_ops { · 429 unmodified lines
430430
431431 #ifdef CONFIG_HIBERNATION
432432 /* kernel/power/snapshot.c */
433−extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
434−static inline void __init register_nosave_region(unsigned long b, unsigned long e)
435−{
436− __register_nosave_region(b, e, 0);
437−}
438−static inline void __init register_nosave_region_late(unsigned long b, unsigned long e)
439−{
440− __register_nosave_region(b, e, 1);
441−}
433+extern void register_nosave_region(unsigned long b, unsigned long e);
442434 extern int swsusp_page_is_forbidden(struct page *);
443435 extern void swsusp_set_page_free(struct page *);
444436 extern void swsusp_unset_page_free(struct page *);
@@ -458,7 +450,6 @@ int pfn_is_nosave(unsigned long pfn); · 13 unmodified lines
458450 int hibernate_quiet_exec(int (*func)(void *data), void *data);
459451 #else /* CONFIG_HIBERNATION */
460452 static inline void register_nosave_region(unsigned long b, unsigned long e) {}
461−static inline void register_nosave_region_late(unsigned long b, unsigned long e) {}
462453 static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
463454 static inline void swsusp_set_page_free(struct page *p) {}
464455 static inline void swsusp_unset_page_free(struct page *p) {}
include/linux/sysctl.h+1−1
@@ -265,7 +265,7 @@ static inline struct ctl_table_header *register_sysctl_table(struct ctl_table * · 264 unmodified lines
265265 return NULL;
266266 }
267267
268−static inline struct sysctl_header *register_sysctl_mount_point(const char *path)
268+static inline struct ctl_table_header *register_sysctl_mount_point(const char *path)
269269 {
270270 return NULL;
271271 }
include/linux/usb/role.h+6−0
@@ -91,6 +91,12 @@ fwnode_usb_role_switch_get(struct fwnode_handle *node) · 90 unmodified lines
9191
9292 static inline void usb_role_switch_put(struct usb_role_switch *sw) { }
9393
94+static inline struct usb_role_switch *
95+usb_role_switch_find_by_fwnode(const struct fwnode_handle *fwnode)
96+{
97+ return NULL;
98+}
99+
94100 static inline struct usb_role_switch *
95101 usb_role_switch_register(struct device *parent,
96102 const struct usb_role_switch_desc *desc)
include/net/ax25.h+12−0
@@ -227,6 +227,7 @@ typedef struct ax25_dev { · 226 unmodified lines
227227 #if defined(CONFIG_AX25_DAMA_SLAVE) || defined(CONFIG_AX25_DAMA_MASTER)
228228 ax25_dama_info dama;
229229 #endif
230+ refcount_t refcount;
230231 } ax25_dev;
231232
232233 typedef struct ax25_cb {
@@ -281,6 +282,17 @@ static __inline__ void ax25_cb_put(ax25_cb *ax25) · 48 unmodified lines
281282 }
282283 }
283284
285+static inline void ax25_dev_hold(ax25_dev *ax25_dev)
286+{
287+ refcount_inc(&ax25_dev->refcount);
288+}
289+
290+static inline void ax25_dev_put(ax25_dev *ax25_dev)
291+{
292+ if (refcount_dec_and_test(&ax25_dev->refcount)) {
293+ kfree(ax25_dev);
294+ }
295+}
284296 static inline __be16 ax25_type_trans(struct sk_buff *skb, struct net_device *dev)
285297 {
286298 skb->dev = dev;
include/net/neighbour.h+13−5
@@ -350,7 +350,8 @@ static inline struct neighbour *neigh_create(struct neigh_table *tbl, · 349 unmodified lines
350350 return __neigh_create(tbl, pkey, dev, true);
351351 }
352352 void neigh_destroy(struct neighbour *neigh);
353−int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb);
353+int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb,
354+ const bool immediate_ok);
354355 int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, u32 flags,
355356 u32 nlmsg_pid);
356357 void __neigh_set_probe_once(struct neighbour *neigh);
@@ -460,17 +461,24 @@ static inline struct neighbour * neigh_clone(struct neighbour *neigh) · 103 unmodified lines
460461
461462 #define neigh_hold(n) refcount_inc(&(n)->refcnt)
462463
463−static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
464+static __always_inline int neigh_event_send_probe(struct neighbour *neigh,
465+ struct sk_buff *skb,
466+ const bool immediate_ok)
464467 {
465468 unsigned long now = jiffies;
466−
469+
467470 if (READ_ONCE(neigh->used) != now)
468471 WRITE_ONCE(neigh->used, now);
469− if (!(neigh->nud_state&(NUD_CONNECTED|NUD_DELAY|NUD_PROBE)))
470− return __neigh_event_send(neigh, skb);
472+ if (!(neigh->nud_state & (NUD_CONNECTED | NUD_DELAY | NUD_PROBE)))
473+ return __neigh_event_send(neigh, skb, immediate_ok);
471474 return 0;
472475 }
473476
477+static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
478+{
479+ return neigh_event_send_probe(neigh, skb, true);
480+}
481+
474482 #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
475483 static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb)
476484 {
include/trace/perf.h+3−2
@@ -23,8 +23,9 @@ · 22 unmodified lines
2323
2424 #undef __get_rel_dynamic_array
2525 #define __get_rel_dynamic_array(field) \
26− ((void *)(&__entry->__rel_loc_##field) + \
27− sizeof(__entry->__rel_loc_##field) + \
26+ ((void *)__entry + \
27+ offsetof(typeof(*__entry), __rel_loc_##field) + \
28+ sizeof(__entry->__rel_loc_##field) + \
2829 (__entry->__rel_loc_##field & 0xffff))
2930
3031 #undef __get_rel_dynamic_array_len
include/trace/trace_events.h+5−4
@@ -128,7 +128,7 @@ TRACE_MAKE_SYSTEM_STR(); · 127 unmodified lines
128128 struct trace_event_raw_##name { \
129129 struct trace_entry ent; \
130130 tstruct \
131− char __data[0]; \
131+ char __data[]; \
132132 }; \
133133 \
134134 static struct trace_event_class event_class_##name;
@@ -318,9 +318,10 @@ TRACE_MAKE_SYSTEM_STR(); · 183 unmodified lines
318318 #define __get_str(field) ((char *)__get_dynamic_array(field))
319319
320320 #undef __get_rel_dynamic_array
321−#define __get_rel_dynamic_array(field) \
322− ((void *)(&__entry->__rel_loc_##field) + \
323− sizeof(__entry->__rel_loc_##field) + \
321+#define __get_rel_dynamic_array(field) \
322+ ((void *)__entry + \
323+ offsetof(typeof(*__entry), __rel_loc_##field) + \
324+ sizeof(__entry->__rel_loc_##field) + \
324325 (__entry->__rel_loc_##field & 0xffff))
325326
326327 #undef __get_rel_dynamic_array_len
include/uapi/linux/cyclades.h+35−0
@@ -0,0 +1,35 @@
1+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2+
3+#ifndef _UAPI_LINUX_CYCLADES_H
4+#define _UAPI_LINUX_CYCLADES_H
5+
6+#warning "Support for features provided by this header has been removed"
7+#warning "Please consider updating your code"
8+
9+struct cyclades_monitor {
10+ unsigned long int_count;
11+ unsigned long char_count;
12+ unsigned long char_max;
13+ unsigned long char_last;
14+};
15+
16+#define CYGETMON 0x435901
17+#define CYGETTHRESH 0x435902
18+#define CYSETTHRESH 0x435903
19+#define CYGETDEFTHRESH 0x435904
20+#define CYSETDEFTHRESH 0x435905
21+#define CYGETTIMEOUT 0x435906
22+#define CYSETTIMEOUT 0x435907
23+#define CYGETDEFTIMEOUT 0x435908
24+#define CYSETDEFTIMEOUT 0x435909
25+#define CYSETRFLOW 0x43590a
26+#define CYGETRFLOW 0x43590b
27+#define CYSETRTSDTR_INV 0x43590c
28+#define CYGETRTSDTR_INV 0x43590d
29+#define CYZSETPOLLCYCLE 0x43590e
30+#define CYZGETPOLLCYCLE 0x43590f
31+#define CYGETCD1400VER 0x435910
32+#define CYSETWAIT 0x435912
33+#define CYGETWAIT 0x435913
34+
35+#endif /* _UAPI_LINUX_CYCLADES_H */
include/uapi/linux/kvm.h+1−0
@@ -1133,6 +1133,7 @@ struct kvm_ppc_resize_hpt { · 1132 unmodified lines
11331133 #define KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM 206
11341134 #define KVM_CAP_VM_GPA_BITS 207
11351135 #define KVM_CAP_XSAVE2 208
1136+#define KVM_CAP_SYS_ATTRIBUTES 209
11361137
11371138 #ifdef KVM_CAP_IRQ_ROUTING
11381139
include/uapi/linux/smc_diag.h+5−6
@@ -84,12 +84,11 @@ struct smc_diag_conninfo { · 83 unmodified lines
8484 /* SMC_DIAG_LINKINFO */
8585
8686 struct smc_diag_linkinfo {
87− __u8 link_id; /* link identifier */
88− __u8 ibname[IB_DEVICE_NAME_MAX]; /* name of the RDMA device */
89− __u8 ibport; /* RDMA device port number */
90− __u8 gid[40]; /* local GID */
91− __u8 peer_gid[40]; /* peer GID */
92− __aligned_u64 net_cookie; /* RDMA device net namespace */
87+ __u8 link_id; /* link identifier */
88+ __u8 ibname[IB_DEVICE_NAME_MAX]; /* name of the RDMA device */
89+ __u8 ibport; /* RDMA device port number */
90+ __u8 gid[40]; /* local GID */
91+ __u8 peer_gid[40]; /* peer GID */
9392 };
9493
9594 struct smc_diag_lgrinfo {
kernel/async.c+0−3
@@ -205,9 +205,6 @@ async_cookie_t async_schedule_node_domain(async_func_t func, void *data, · 204 unmodified lines
205205 atomic_inc(&entry_count);
206206 spin_unlock_irqrestore(&async_lock, flags);
207207
208− /* mark that this task has queued an async job, used by module init */
209− current->flags |= PF_USED_ASYNC;
210−
211208 /* schedule for execution */
212209 queue_work_node(node, system_unbound_wq, &entry->work);
213210
kernel/audit.c+43−19
@@ -541,20 +541,22 @@ static void kauditd_printk_skb(struct sk_buff *skb) · 540 unmodified lines
541541 /**
542542 * kauditd_rehold_skb - Handle a audit record send failure in the hold queue
543543 * @skb: audit record
544+ * @error: error code (unused)
544545 *
545546 * Description:
546547 * This should only be used by the kauditd_thread when it fails to flush the
547548 * hold queue.
548549 */
549−static void kauditd_rehold_skb(struct sk_buff *skb)
550+static void kauditd_rehold_skb(struct sk_buff *skb, __always_unused int error)
550551 {
551− /* put the record back in the queue at the same place */
552− skb_queue_head(&audit_hold_queue, skb);
552+ /* put the record back in the queue */
553+ skb_queue_tail(&audit_hold_queue, skb);
553554 }
554555
555556 /**
556557 * kauditd_hold_skb - Queue an audit record, waiting for auditd
557558 * @skb: audit record
559+ * @error: error code
558560 *
559561 * Description:
560562 * Queue the audit record, waiting for an instance of auditd. When this
@@ -564,19 +566,31 @@ static void kauditd_rehold_skb(struct sk_buff *skb) · 3 unmodified lines
564566 * and queue it, if we have room. If we want to hold on to the record, but we
565567 * don't have room, record a record lost message.
566568 */
567−static void kauditd_hold_skb(struct sk_buff *skb)
569+static void kauditd_hold_skb(struct sk_buff *skb, int error)
568570 {
569571 /* at this point it is uncertain if we will ever send this to auditd so
570572 * try to send the message via printk before we go any further */
571573 kauditd_printk_skb(skb);
572574
573575 /* can we just silently drop the message? */
574− if (!audit_default) {
575− kfree_skb(skb);
576− return;
576+ if (!audit_default)
577+ goto drop;
578+
579+ /* the hold queue is only for when the daemon goes away completely,
580+ * not -EAGAIN failures; if we are in a -EAGAIN state requeue the
581+ * record on the retry queue unless it's full, in which case drop it
582+ */
583+ if (error == -EAGAIN) {
584+ if (!audit_backlog_limit ||
585+ skb_queue_len(&audit_retry_queue) < audit_backlog_limit) {
586+ skb_queue_tail(&audit_retry_queue, skb);
587+ return;
588+ }
589+ audit_log_lost("kauditd retry queue overflow");
590+ goto drop;
577591 }
578592
579− /* if we have room, queue the message */
593+ /* if we have room in the hold queue, queue the message */
580594 if (!audit_backlog_limit ||
581595 skb_queue_len(&audit_hold_queue) < audit_backlog_limit) {
582596 skb_queue_tail(&audit_hold_queue, skb);
@@ -585,24 +599,32 @@ static void kauditd_hold_skb(struct sk_buff *skb) · 2 unmodified lines
585599
586600 /* we have no other options - drop the message */
587601 audit_log_lost("kauditd hold queue overflow");
602+drop:
588603 kfree_skb(skb);
589604 }
590605
591606 /**
592607 * kauditd_retry_skb - Queue an audit record, attempt to send again to auditd
593608 * @skb: audit record
609+ * @error: error code (unused)
594610 *
595611 * Description:
596612 * Not as serious as kauditd_hold_skb() as we still have a connected auditd,
597613 * but for some reason we are having problems sending it audit records so
598614 * queue the given record and attempt to resend.
599615 */
600−static void kauditd_retry_skb(struct sk_buff *skb)
616+static void kauditd_retry_skb(struct sk_buff *skb, __always_unused int error)
601617 {
602− /* NOTE: because records should only live in the retry queue for a
603− * short period of time, before either being sent or moved to the hold
604− * queue, we don't currently enforce a limit on this queue */
605− skb_queue_tail(&audit_retry_queue, skb);
618+ if (!audit_backlog_limit ||
619+ skb_queue_len(&audit_retry_queue) < audit_backlog_limit) {
620+ skb_queue_tail(&audit_retry_queue, skb);
621+ return;
622+ }
623+
624+ /* we have to drop the record, send it via printk as a last effort */
625+ kauditd_printk_skb(skb);
626+ audit_log_lost("kauditd retry queue overflow");
627+ kfree_skb(skb);
606628 }
607629
608630 /**
@@ -640,7 +662,7 @@ static void auditd_reset(const struct auditd_connection *ac) · 31 unmodified lines
640662 /* flush the retry queue to the hold queue, but don't touch the main
641663 * queue since we need to process that normally for multicast */
642664 while ((skb = skb_dequeue(&audit_retry_queue)))
643− kauditd_hold_skb(skb);
665+ kauditd_hold_skb(skb, -ECONNREFUSED);
644666 }
645667
646668 /**
@@ -714,16 +736,18 @@ static int kauditd_send_queue(struct sock *sk, u32 portid, · 67 unmodified lines
714736 struct sk_buff_head *queue,
715737 unsigned int retry_limit,
716738 void (*skb_hook)(struct sk_buff *skb),
717− void (*err_hook)(struct sk_buff *skb))
739+ void (*err_hook)(struct sk_buff *skb, int error))
718740 {
719741 int rc = 0;
720− struct sk_buff *skb;
742+ struct sk_buff *skb = NULL;
743+ struct sk_buff *skb_tail;
721744 unsigned int failed = 0;
722745
723746 /* NOTE: kauditd_thread takes care of all our locking, we just use
724747 * the netlink info passed to us (e.g. sk and portid) */
725748
726− while ((skb = skb_dequeue(queue))) {
749+ skb_tail = skb_peek_tail(queue);
750+ while ((skb != skb_tail) && (skb = skb_dequeue(queue))) {
727751 /* call the skb_hook for each skb we touch */
728752 if (skb_hook)
729753 (*skb_hook)(skb);
@@ -731,7 +755,7 @@ static int kauditd_send_queue(struct sock *sk, u32 portid, · 1 unmodified line
731755 /* can we send to anyone via unicast? */
732756 if (!sk) {
733757 if (err_hook)
734− (*err_hook)(skb);
758+ (*err_hook)(skb, -ECONNREFUSED);
735759 continue;
736760 }
737761
@@ -745,7 +769,7 @@ retry: · 7 unmodified lines
745769 rc == -ECONNREFUSED || rc == -EPERM) {
746770 sk = NULL;
747771 if (err_hook)
748− (*err_hook)(skb);
772+ (*err_hook)(skb, rc);
749773 if (rc == -EAGAIN)
750774 rc = 0;
751775 /* continue to drain the queue */
kernel/bpf/bpf_lsm.c+1−1
@@ -207,7 +207,7 @@ BTF_ID(func, bpf_lsm_socket_socketpair) · 206 unmodified lines
207207
208208 BTF_ID(func, bpf_lsm_syslog)
209209 BTF_ID(func, bpf_lsm_task_alloc)
210−BTF_ID(func, bpf_lsm_task_getsecid_subj)
210+BTF_ID(func, bpf_lsm_current_getsecid_subj)
211211 BTF_ID(func, bpf_lsm_task_getsecid_obj)
212212 BTF_ID(func, bpf_lsm_task_prctl)
213213 BTF_ID(func, bpf_lsm_task_setscheduler)
kernel/bpf/ringbuf.c+1−1
@@ -104,7 +104,7 @@ static struct bpf_ringbuf *bpf_ringbuf_area_alloc(size_t data_sz, int numa_node) · 103 unmodified lines
104104 }
105105
106106 rb = vmap(pages, nr_meta_pages + 2 * nr_data_pages,
107− VM_ALLOC | VM_USERMAP, PAGE_KERNEL);
107+ VM_MAP | VM_USERMAP, PAGE_KERNEL);
108108 if (rb) {
109109 kmemleak_not_leak(pages);
110110 rb->pages = pages;
kernel/bpf/trampoline.c+3−2
@@ -550,11 +550,12 @@ static __always_inline u64 notrace bpf_prog_start_time(void) · 549 unmodified lines
550550 static void notrace inc_misses_counter(struct bpf_prog *prog)
551551 {
552552 struct bpf_prog_stats *stats;
553+ unsigned int flags;
553554
554555 stats = this_cpu_ptr(prog->stats);
555− u64_stats_update_begin(&stats->syncp);
556+ flags = u64_stats_update_begin_irqsave(&stats->syncp);
556557 u64_stats_inc(&stats->misses);
557− u64_stats_update_end(&stats->syncp);
558+ u64_stats_update_end_irqrestore(&stats->syncp, flags);
558559 }
559560
560561 /* The logic is similar to bpf_prog_run(), but with an explicit
kernel/cgroup/cgroup-v1.c+14−0
@@ -549,6 +549,14 @@ static ssize_t cgroup_release_agent_write(struct kernfs_open_file *of, · 548 unmodified lines
549549
550550 BUILD_BUG_ON(sizeof(cgrp->root->release_agent_path) < PATH_MAX);
551551
552+ /*
553+ * Release agent gets called with all capabilities,
554+ * require capabilities to set release agent.
555+ */
556+ if ((of->file->f_cred->user_ns != &init_user_ns) ||
557+ !capable(CAP_SYS_ADMIN))
558+ return -EPERM;
559+
552560 cgrp = cgroup_kn_lock_live(of->kn, false);
553561 if (!cgrp)
554562 return -ENODEV;
@@ -954,6 +962,12 @@ int cgroup1_parse_param(struct fs_context *fc, struct fs_parameter *param) · 399 unmodified lines
954962 /* Specifying two release agents is forbidden */
955963 if (ctx->release_agent)
956964 return invalfc(fc, "release_agent respecified");
965+ /*
966+ * Release agent gets called with all capabilities,
967+ * require capabilities to set release agent.
968+ */
969+ if ((fc->user_ns != &init_user_ns) || !capable(CAP_SYS_ADMIN))
970+ return invalfc(fc, "Setting release_agent not allowed");
957971 ctx->release_agent = param->string;
958972 param->string = NULL;
959973 break;
kernel/cgroup/cpuset.c+51−14
@@ -590,6 +590,35 @@ static inline void free_cpuset(struct cpuset *cs) · 589 unmodified lines
590590 kfree(cs);
591591 }
592592
593+/*
594+ * validate_change_legacy() - Validate conditions specific to legacy (v1)
595+ * behavior.
596+ */
597+static int validate_change_legacy(struct cpuset *cur, struct cpuset *trial)
598+{
599+ struct cgroup_subsys_state *css;
600+ struct cpuset *c, *par;
601+ int ret;
602+
603+ WARN_ON_ONCE(!rcu_read_lock_held());
604+
605+ /* Each of our child cpusets must be a subset of us */
606+ ret = -EBUSY;
607+ cpuset_for_each_child(c, css, cur)
608+ if (!is_cpuset_subset(c, trial))
609+ goto out;
610+
611+ /* On legacy hierarchy, we must be a subset of our parent cpuset. */
612+ ret = -EACCES;
613+ par = parent_cs(cur);
614+ if (par && !is_cpuset_subset(trial, par))
615+ goto out;
616+
617+ ret = 0;
618+out:
619+ return ret;
620+}
621+
593622 /*
594623 * validate_change() - Used to validate that any proposed cpuset change
595624 * follows the structural rules for cpusets.
@@ -614,20 +643,21 @@ static int validate_change(struct cpuset *cur, struct cpuset *trial) · 18 unmodified lines
614643 {
615644 struct cgroup_subsys_state *css;
616645 struct cpuset *c, *par;
617− int ret;
618−
619− /* The checks don't apply to root cpuset */
620− if (cur == &top_cpuset)
621− return 0;
646+ int ret = 0;
622647
623648 rcu_read_lock();
624− par = parent_cs(cur);
625649
626− /* On legacy hierarchy, we must be a subset of our parent cpuset. */
627− ret = -EACCES;
628− if (!is_in_v2_mode() && !is_cpuset_subset(trial, par))
650+ if (!is_in_v2_mode())
651+ ret = validate_change_legacy(cur, trial);
652+ if (ret)
653+ goto out;
654+
655+ /* Remaining checks don't apply to root cpuset */
656+ if (cur == &top_cpuset)
629657 goto out;
630658
659+ par = parent_cs(cur);
660+
631661 /*
632662 * If either I or some sibling (!= me) is exclusive, we can't
633663 * overlap
@@ -1175,9 +1205,7 @@ enum subparts_cmd { · 541 unmodified lines
11751205 *
11761206 * Because of the implicit cpu exclusive nature of a partition root,
11771207 * cpumask changes that violates the cpu exclusivity rule will not be
1178− * permitted when checked by validate_change(). The validate_change()
1179− * function will also prevent any changes to the cpu list if it is not
1180− * a superset of children's cpu lists.
1208+ * permitted when checked by validate_change().
11811209 */
11821210 static int update_parent_subparts_cpumask(struct cpuset *cpuset, int cmd,
11831211 struct cpumask *newmask,
@@ -1522,10 +1550,15 @@ static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs, · 338 unmodified lines
15221550 struct cpuset *sibling;
15231551 struct cgroup_subsys_state *pos_css;
15241552
1553+ percpu_rwsem_assert_held(&cpuset_rwsem);
1554+
15251555 /*
15261556 * Check all its siblings and call update_cpumasks_hier()
15271557 * if their use_parent_ecpus flag is set in order for them
15281558 * to use the right effective_cpus value.
1559+ *
1560+ * The update_cpumasks_hier() function may sleep. So we have to
1561+ * release the RCU read lock before calling it.
15291562 */
15301563 rcu_read_lock();
15311564 cpuset_for_each_child(sibling, pos_css, parent) {
@@ -1533,8 +1566,13 @@ static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs, · 1 unmodified line
15331566 continue;
15341567 if (!sibling->use_parent_ecpus)
15351568 continue;
1569+ if (!css_tryget_online(&sibling->css))
1570+ continue;
15361571
1572+ rcu_read_unlock();
15371573 update_cpumasks_hier(sibling, tmp);
1574+ rcu_read_lock();
1575+ css_put(&sibling->css);
15381576 }
15391577 rcu_read_unlock();
15401578 }
@@ -1607,8 +1645,7 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs, · 66 unmodified lines
16071645 * Make sure that subparts_cpus is a subset of cpus_allowed.
16081646 */
16091647 if (cs->nr_subparts_cpus) {
1610− cpumask_andnot(cs->subparts_cpus, cs->subparts_cpus,
1611− cs->cpus_allowed);
1648+ cpumask_and(cs->subparts_cpus, cs->subparts_cpus, cs->cpus_allowed);
16121649 cs->nr_subparts_cpus = cpumask_weight(cs->subparts_cpus);
16131650 }
16141651 spin_unlock_irq(&callback_lock);
kernel/events/core.c+19−4
@@ -2462,7 +2462,11 @@ static void perf_remove_from_context(struct perf_event *event, unsigned long fla · 2461 unmodified lines
24622462 * event_function_call() user.
24632463 */
24642464 raw_spin_lock_irq(&ctx->lock);
2465− if (!ctx->is_active) {
2465+ /*
2466+ * Cgroup events are per-cpu events, and must IPI because of
2467+ * cgrp_cpuctx_list.
2468+ */
2469+ if (!ctx->is_active && !is_cgroup_event(event)) {
24662470 __perf_remove_from_context(event, __get_cpu_context(ctx),
24672471 ctx, (void *)flags);
24682472 raw_spin_unlock_irq(&ctx->lock);
@@ -2895,11 +2899,14 @@ perf_install_in_context(struct perf_event_context *ctx, · 426 unmodified lines
28952899 * perf_event_attr::disabled events will not run and can be initialized
28962900 * without IPI. Except when this is the first event for the context, in
28972901 * that case we need the magic of the IPI to set ctx->is_active.
2902+ * Similarly, cgroup events for the context also needs the IPI to
2903+ * manipulate the cgrp_cpuctx_list.
28982904 *
28992905 * The IOC_ENABLE that is sure to follow the creation of a disabled
29002906 * event will issue the IPI and reprogram the hardware.
29012907 */
2902− if (__perf_effective_state(event) == PERF_EVENT_STATE_OFF && ctx->nr_events) {
2908+ if (__perf_effective_state(event) == PERF_EVENT_STATE_OFF &&
2909+ ctx->nr_events && !is_cgroup_event(event)) {
29032910 raw_spin_lock_irq(&ctx->lock);
29042911 if (ctx->task == TASK_TOMBSTONE) {
29052912 raw_spin_unlock_irq(&ctx->lock);
@@ -5985,6 +5992,8 @@ static void ring_buffer_attach(struct perf_event *event, · 3079 unmodified lines
59855992 struct perf_buffer *old_rb = NULL;
59865993 unsigned long flags;
59875994
5995+ WARN_ON_ONCE(event->parent);
5996+
59885997 if (event->rb) {
59895998 /*
59905999 * Should be impossible, we set this when removing
@@ -6042,6 +6051,9 @@ static void ring_buffer_wakeup(struct perf_event *event) · 51 unmodified lines
60426051 {
60436052 struct perf_buffer *rb;
60446053
6054+ if (event->parent)
6055+ event = event->parent;
6056+
60456057 rcu_read_lock();
60466058 rb = rcu_dereference(event->rb);
60476059 if (rb) {
@@ -6055,6 +6067,9 @@ struct perf_buffer *ring_buffer_get(struct perf_event *event) · 7 unmodified lines
60556067 {
60566068 struct perf_buffer *rb;
60576069
6070+ if (event->parent)
6071+ event = event->parent;
6072+
60586073 rcu_read_lock();
60596074 rb = rcu_dereference(event->rb);
60606075 if (rb) {
@@ -6763,7 +6778,7 @@ static unsigned long perf_prepare_sample_aux(struct perf_event *event, · 702 unmodified lines
67636778 if (WARN_ON_ONCE(READ_ONCE(sampler->oncpu) != smp_processor_id()))
67646779 goto out;
67656780
6766− rb = ring_buffer_get(sampler->parent ? sampler->parent : sampler);
6781+ rb = ring_buffer_get(sampler);
67676782 if (!rb)
67686783 goto out;
67696784
@@ -6829,7 +6844,7 @@ static void perf_aux_sample_output(struct perf_event *event, · 59 unmodified lines
68296844 if (WARN_ON_ONCE(!sampler || !data->aux_size))
68306845 return;
68316846
6832− rb = ring_buffer_get(sampler->parent ? sampler->parent : sampler);
6847+ rb = ring_buffer_get(sampler);
68336848 if (!rb)
68346849 return;
68356850
kernel/module.c+5−20
@@ -3725,12 +3725,6 @@ static noinline int do_init_module(struct module *mod) · 3724 unmodified lines
37253725 }
37263726 freeinit->module_init = mod->init_layout.base;
37273727
3728− /*
3729− * We want to find out whether @mod uses async during init. Clear
3730− * PF_USED_ASYNC. async_schedule*() will set it.
3731− */
3732− current->flags &= ~PF_USED_ASYNC;
3733−
37343728 do_mod_ctors(mod);
37353729 /* Start the module */
37363730 if (mod->init != NULL)
@@ -3756,22 +3750,13 @@ static noinline int do_init_module(struct module *mod) · 19 unmodified lines
37563750
37573751 /*
37583752 * We need to finish all async code before the module init sequence
3759− * is done. This has potential to deadlock. For example, a newly
3760− * detected block device can trigger request_module() of the
3761− * default iosched from async probing task. Once userland helper
3762− * reaches here, async_synchronize_full() will wait on the async
3763− * task waiting on request_module() and deadlock.
3764− *
3765− * This deadlock is avoided by perfomring async_synchronize_full()
3766− * iff module init queued any async jobs. This isn't a full
3767− * solution as it will deadlock the same if module loading from
3768− * async jobs nests more than once; however, due to the various
3769− * constraints, this hack seems to be the best option for now.
3770− * Please refer to the following thread for details.
3753+ * is done. This has potential to deadlock if synchronous module
3754+ * loading is requested from async (which is not allowed!).
37713755 *
3772− * http://thread.gmane.org/gmane.linux.kernel/1420814
3756+ * See commit 0fdff3ec6d87 ("async, kmod: warn on synchronous
3757+ * request_module() from async workers") for more details.
37733758 */
3774− if (!mod->async_probe_requested && (current->flags & PF_USED_ASYNC))
3759+ if (!mod->async_probe_requested)
37753760 async_synchronize_full();
37763761
37773762 ftrace_free_mem(mod, mod->init_layout.base, mod->init_layout.base +
kernel/power/snapshot.c+7−14
@@ -978,8 +978,7 @@ static void memory_bm_recycle(struct memory_bitmap *bm) · 977 unmodified lines
978978 * Register a range of page frames the contents of which should not be saved
979979 * during hibernation (to be used in the early initialization code).
980980 */
981−void __init __register_nosave_region(unsigned long start_pfn,
982− unsigned long end_pfn, int use_kmalloc)
981+void __init register_nosave_region(unsigned long start_pfn, unsigned long end_pfn)
983982 {
984983 struct nosave_region *region;
985984
@@ -995,18 +994,12 @@ void __init __register_nosave_region(unsigned long start_pfn, · 9 unmodified lines
995994 goto Report;
996995 }
997996 }
998− if (use_kmalloc) {
999− /* During init, this shouldn't fail */
1000− region = kmalloc(sizeof(struct nosave_region), GFP_KERNEL);
1001− BUG_ON(!region);
1002− } else {
1003− /* This allocation cannot fail */
1004− region = memblock_alloc(sizeof(struct nosave_region),
1005− SMP_CACHE_BYTES);
1006− if (!region)
1007− panic("%s: Failed to allocate %zu bytes\n", __func__,
1008− sizeof(struct nosave_region));
1009− }
997+ /* This allocation cannot fail */
998+ region = memblock_alloc(sizeof(struct nosave_region),
999+ SMP_CACHE_BYTES);
1000+ if (!region)
1001+ panic("%s: Failed to allocate %zu bytes\n", __func__,
1002+ sizeof(struct nosave_region));
10101003 region->start_pfn = start_pfn;
10111004 region->end_pfn = end_pfn;
10121005 list_add_tail(&region->list, &nosave_regions);
kernel/power/wakelock.c+4−7
@@ -39,23 +39,20 @@ ssize_t pm_show_wakelocks(char *buf, bool show_active) · 38 unmodified lines
3939 {
4040 struct rb_node *node;
4141 struct wakelock *wl;
42− char *str = buf;
43− char *end = buf + PAGE_SIZE;
42+ int len = 0;
4443
4544 mutex_lock(&wakelocks_lock);
4645
4746 for (node = rb_first(&wakelocks_tree); node; node = rb_next(node)) {
4847 wl = rb_entry(node, struct wakelock, node);
4948 if (wl->ws->active == show_active)
50− str += scnprintf(str, end - str, "%s ", wl->name);
49+ len += sysfs_emit_at(buf, len, "%s ", wl->name);
5150 }
52− if (str > buf)
53− str--;
5451
55− str += scnprintf(str, end - str, "\n");
52+ len += sysfs_emit_at(buf, len, "\n");
5653
5754 mutex_unlock(&wakelocks_lock);
58− return (str - buf);
55+ return len;
5956 }
6057
6158 #if CONFIG_PM_WAKELOCKS_LIMIT > 0
kernel/printk/sysctl.c+1−1
@@ -12,7 +12,7 @@ · 11 unmodified lines
1212 static const int ten_thousand = 10000;
1313
1414 static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
15− void __user *buffer, size_t *lenp, loff_t *ppos)
15+ void *buffer, size_t *lenp, loff_t *ppos)
1616 {
1717 if (write && !capable(CAP_SYS_ADMIN))
1818 return -EPERM;
kernel/rcu/tasks.h+8−4
@@ -123,7 +123,7 @@ static struct rcu_tasks rt_name = \ · 122 unmodified lines
123123 .call_func = call, \
124124 .rtpcpu = &rt_name ## __percpu, \
125125 .name = n, \
126− .percpu_enqueue_shift = ilog2(CONFIG_NR_CPUS), \
126+ .percpu_enqueue_shift = ilog2(CONFIG_NR_CPUS) + 1, \
127127 .percpu_enqueue_lim = 1, \
128128 .percpu_dequeue_lim = 1, \
129129 .barrier_q_mutex = __MUTEX_INITIALIZER(rt_name.barrier_q_mutex), \
@@ -216,6 +216,7 @@ static void cblist_init_generic(struct rcu_tasks *rtp) · 86 unmodified lines
216216 int cpu;
217217 unsigned long flags;
218218 int lim;
219+ int shift;
219220
220221 raw_spin_lock_irqsave(&rtp->cbs_gbl_lock, flags);
221222 if (rcu_task_enqueue_lim < 0) {
@@ -229,7 +230,10 @@ static void cblist_init_generic(struct rcu_tasks *rtp) · 7 unmodified lines
229230
230231 if (lim > nr_cpu_ids)
231232 lim = nr_cpu_ids;
232− WRITE_ONCE(rtp->percpu_enqueue_shift, ilog2(nr_cpu_ids / lim));
233+ shift = ilog2(nr_cpu_ids / lim);
234+ if (((nr_cpu_ids - 1) >> shift) >= lim)
235+ shift++;
236+ WRITE_ONCE(rtp->percpu_enqueue_shift, shift);
233237 WRITE_ONCE(rtp->percpu_dequeue_lim, lim);
234238 smp_store_release(&rtp->percpu_enqueue_lim, lim);
235239 for_each_possible_cpu(cpu) {
@@ -298,7 +302,7 @@ static void call_rcu_tasks_generic(struct rcu_head *rhp, rcu_callback_t func, · 62 unmodified lines
298302 if (unlikely(needadjust)) {
299303 raw_spin_lock_irqsave(&rtp->cbs_gbl_lock, flags);
300304 if (rtp->percpu_enqueue_lim != nr_cpu_ids) {
301− WRITE_ONCE(rtp->percpu_enqueue_shift, ilog2(nr_cpu_ids));
305+ WRITE_ONCE(rtp->percpu_enqueue_shift, ilog2(nr_cpu_ids) + 1);
302306 WRITE_ONCE(rtp->percpu_dequeue_lim, nr_cpu_ids);
303307 smp_store_release(&rtp->percpu_enqueue_lim, nr_cpu_ids);
304308 pr_info("Switching %s to per-CPU callback queuing.\n", rtp->name);
@@ -413,7 +417,7 @@ static int rcu_tasks_need_gpcb(struct rcu_tasks *rtp) · 108 unmodified lines
413417 if (rcu_task_cb_adjust && ncbs <= rcu_task_collapse_lim) {
414418 raw_spin_lock_irqsave(&rtp->cbs_gbl_lock, flags);
415419 if (rtp->percpu_enqueue_lim > 1) {
416− WRITE_ONCE(rtp->percpu_enqueue_shift, ilog2(nr_cpu_ids));
420+ WRITE_ONCE(rtp->percpu_enqueue_shift, ilog2(nr_cpu_ids) + 1);
417421 smp_store_release(&rtp->percpu_enqueue_lim, 1);
418422 rtp->percpu_dequeue_gpseq = get_state_synchronize_rcu();
419423 pr_info("Starting switch %s to CPU-0 callback queuing.\n", rtp->name);
kernel/sched/membarrier.c+5−4
@@ -147,11 +147,11 @@ · 146 unmodified lines
147147 #endif
148148
149149 #ifdef CONFIG_RSEQ
150−#define MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ_BITMASK \
150+#define MEMBARRIER_PRIVATE_EXPEDITED_RSEQ_BITMASK \
151151 (MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ \
152− | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ_BITMASK)
152+ | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ)
153153 #else
154−#define MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ_BITMASK 0
154+#define MEMBARRIER_PRIVATE_EXPEDITED_RSEQ_BITMASK 0
155155 #endif
156156
157157 #define MEMBARRIER_CMD_BITMASK \
@@ -159,7 +159,8 @@ · 1 unmodified line
159159 | MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED \
160160 | MEMBARRIER_CMD_PRIVATE_EXPEDITED \
161161 | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED \
162− | MEMBARRIER_PRIVATE_EXPEDITED_SYNC_CORE_BITMASK)
162+ | MEMBARRIER_PRIVATE_EXPEDITED_SYNC_CORE_BITMASK \
163+ | MEMBARRIER_PRIVATE_EXPEDITED_RSEQ_BITMASK)
163164
164165 static void ipi_mb(void *info)
165166 {
kernel/sched/psi.c+41−38
@@ -1082,44 +1082,6 @@ int psi_show(struct seq_file *m, struct psi_group *group, enum psi_res res) · 1081 unmodified lines
10821082 return 0;
10831083 }
10841084
1085−static int psi_io_show(struct seq_file *m, void *v)
1086−{
1087− return psi_show(m, &psi_system, PSI_IO);
1088−}
1089−
1090−static int psi_memory_show(struct seq_file *m, void *v)
1091−{
1092− return psi_show(m, &psi_system, PSI_MEM);
1093−}
1094−
1095−static int psi_cpu_show(struct seq_file *m, void *v)
1096−{
1097− return psi_show(m, &psi_system, PSI_CPU);
1098−}
1099−
1100−static int psi_open(struct file *file, int (*psi_show)(struct seq_file *, void *))
1101−{
1102− if (file->f_mode & FMODE_WRITE && !capable(CAP_SYS_RESOURCE))
1103− return -EPERM;
1104−
1105− return single_open(file, psi_show, NULL);
1106−}
1107−
1108−static int psi_io_open(struct inode *inode, struct file *file)
1109−{
1110− return psi_open(file, psi_io_show);
1111−}
1112−
1113−static int psi_memory_open(struct inode *inode, struct file *file)
1114−{
1115− return psi_open(file, psi_memory_show);
1116−}
1117−
1118−static int psi_cpu_open(struct inode *inode, struct file *file)
1119−{
1120− return psi_open(file, psi_cpu_show);
1121−}
1122−
11231085 struct psi_trigger *psi_trigger_create(struct psi_group *group,
11241086 char *buf, size_t nbytes, enum psi_res res)
11251087 {
@@ -1278,6 +1240,45 @@ __poll_t psi_trigger_poll(void **trigger_ptr, · 152 unmodified lines
12781240 return ret;
12791241 }
12801242
1243+#ifdef CONFIG_PROC_FS
1244+static int psi_io_show(struct seq_file *m, void *v)
1245+{
1246+ return psi_show(m, &psi_system, PSI_IO);
1247+}
1248+
1249+static int psi_memory_show(struct seq_file *m, void *v)
1250+{
1251+ return psi_show(m, &psi_system, PSI_MEM);
1252+}
1253+
1254+static int psi_cpu_show(struct seq_file *m, void *v)
1255+{
1256+ return psi_show(m, &psi_system, PSI_CPU);
1257+}
1258+
1259+static int psi_open(struct file *file, int (*psi_show)(struct seq_file *, void *))
1260+{
1261+ if (file->f_mode & FMODE_WRITE && !capable(CAP_SYS_RESOURCE))
1262+ return -EPERM;
1263+
1264+ return single_open(file, psi_show, NULL);
1265+}
1266+
1267+static int psi_io_open(struct inode *inode, struct file *file)
1268+{
1269+ return psi_open(file, psi_io_show);
1270+}
1271+
1272+static int psi_memory_open(struct inode *inode, struct file *file)
1273+{
1274+ return psi_open(file, psi_memory_show);
1275+}
1276+
1277+static int psi_cpu_open(struct inode *inode, struct file *file)
1278+{
1279+ return psi_open(file, psi_cpu_show);
1280+}
1281+
12811282 static ssize_t psi_write(struct file *file, const char __user *user_buf,
12821283 size_t nbytes, enum psi_res res)
12831284 {
@@ -1392,3 +1393,5 @@ static int __init psi_proc_init(void) · 108 unmodified lines
13921393 return 0;
13931394 }
13941395 module_init(psi_proc_init);
1396+
1397+#endif /* CONFIG_PROC_FS */
kernel/stackleak.c+2−3
@@ -70,7 +70,7 @@ late_initcall(stackleak_sysctls_init); · 69 unmodified lines
7070 #define skip_erasing() false
7171 #endif /* CONFIG_STACKLEAK_RUNTIME_DISABLE */
7272
73−asmlinkage void notrace stackleak_erase(void)
73+asmlinkage void noinstr stackleak_erase(void)
7474 {
7575 /* It would be nice not to have 'kstack_ptr' and 'boundary' on stack */
7676 unsigned long kstack_ptr = current->lowest_stack;
@@ -124,9 +124,8 @@ asmlinkage void notrace stackleak_erase(void) · 47 unmodified lines
124124 /* Reset the 'lowest_stack' value for the next syscall */
125125 current->lowest_stack = current_top_of_stack() - THREAD_SIZE/64;
126126 }
127−NOKPROBE_SYMBOL(stackleak_erase);
128127
129−void __used __no_caller_saved_registers notrace stackleak_track_stack(void)
128+void __used __no_caller_saved_registers noinstr stackleak_track_stack(void)
130129 {
131130 unsigned long sp = current_stack_pointer;
132131
kernel/trace/Kconfig+7−1
@@ -70,10 +70,16 @@ config HAVE_C_RECORDMCOUNT · 69 unmodified lines
7070 help
7171 C version of recordmcount available?
7272
73+config HAVE_BUILDTIME_MCOUNT_SORT
74+ bool
75+ help
76+ An architecture selects this if it sorts the mcount_loc section
77+ at build time.
78+
7379 config BUILDTIME_MCOUNT_SORT
7480 bool
7581 default y
76− depends on BUILDTIME_TABLE_SORT && !S390
82+ depends on HAVE_BUILDTIME_MCOUNT_SORT && DYNAMIC_FTRACE
7783 help
7884 Sort the mcount_loc section at build time.
7985
kernel/trace/trace.c+2−1
@@ -7740,7 +7740,8 @@ static struct tracing_log_err *get_tracing_log_err(struct trace_array *tr) · 7739 unmodified lines
77407740 err = kzalloc(sizeof(*err), GFP_KERNEL);
77417741 if (!err)
77427742 err = ERR_PTR(-ENOMEM);
7743− tr->n_err_log_entries++;
7743+ else
7744+ tr->n_err_log_entries++;
77447745
77457746 return err;
77467747 }
kernel/trace/trace_events_hist.c+8−2
@@ -2503,6 +2503,8 @@ static struct hist_field *parse_unary(struct hist_trigger_data *hist_data, · 2502 unmodified lines
25032503 (HIST_FIELD_FL_TIMESTAMP | HIST_FIELD_FL_TIMESTAMP_USECS);
25042504 expr->fn = hist_field_unary_minus;
25052505 expr->operands[0] = operand1;
2506+ expr->size = operand1->size;
2507+ expr->is_signed = operand1->is_signed;
25062508 expr->operator = FIELD_OP_UNARY_MINUS;
25072509 expr->name = expr_str(expr, 0);
25082510 expr->type = kstrdup_const(operand1->type, GFP_KERNEL);
@@ -2719,6 +2721,7 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data, · 210 unmodified lines
27192721
27202722 /* The operand sizes should be the same, so just pick one */
27212723 expr->size = operand1->size;
2724+ expr->is_signed = operand1->is_signed;
27222725
27232726 expr->operator = field_op;
27242727 expr->type = kstrdup_const(operand1->type, GFP_KERNEL);
@@ -3935,6 +3938,7 @@ static int trace_action_create(struct hist_trigger_data *hist_data, · 1210 unmodified lines
39353938
39363939 var_ref_idx = find_var_ref_idx(hist_data, var_ref);
39373940 if (WARN_ON(var_ref_idx < 0)) {
3941+ kfree(p);
39383942 ret = var_ref_idx;
39393943 goto err;
39403944 }
@@ -6163,7 +6167,9 @@ static int event_hist_trigger_parse(struct event_command *cmd_ops, · 2222 unmodified lines
61636167
61646168 lockdep_assert_held(&event_mutex);
61656169
6166− if (glob && strlen(glob)) {
6170+ WARN_ON(!glob);
6171+
6172+ if (strlen(glob)) {
61676173 hist_err_clear();
61686174 last_cmd_set(file, param);
61696175 }
@@ -6196,7 +6202,7 @@ static int event_hist_trigger_parse(struct event_command *cmd_ops, · 26 unmodified lines
61966202 continue;
61976203 }
61986204 break;
6199− } while (p);
6205+ } while (1);
62006206
62016207 if (!p)
62026208 param = NULL;
kernel/ucount.c+2−0
@@ -190,6 +190,7 @@ struct ucounts *alloc_ucounts(struct user_namespace *ns, kuid_t uid) · 189 unmodified lines
190190 kfree(new);
191191 } else {
192192 hlist_add_head(&new->node, hashent);
193+ get_user_ns(new->ns);
193194 spin_unlock_irq(&ucounts_lock);
194195 return new;
195196 }
@@ -210,6 +211,7 @@ void put_ucounts(struct ucounts *ucounts) · 14 unmodified lines
210211 if (atomic_dec_and_lock_irqsave(&ucounts->count, &ucounts_lock, flags)) {
211212 hlist_del_init(&ucounts->node);
212213 spin_unlock_irqrestore(&ucounts_lock, flags);
214+ put_user_ns(ucounts->ns);
213215 kfree(ucounts);
214216 }
215217 }
lib/sbitmap.c+6−2
@@ -488,9 +488,13 @@ void sbitmap_queue_recalculate_wake_batch(struct sbitmap_queue *sbq, · 487 unmodified lines
488488 unsigned int users)
489489 {
490490 unsigned int wake_batch;
491+ unsigned int min_batch;
492+ unsigned int depth = (sbq->sb.depth + users - 1) / users;
491493
492− wake_batch = clamp_val((sbq->sb.depth + users - 1) /
493− users, 4, SBQ_WAKE_BATCH);
494+ min_batch = sbq->sb.depth >= (4 * SBQ_WAIT_QUEUES) ? 4 : 1;
495+
496+ wake_batch = clamp_val(depth / SBQ_WAIT_QUEUES,
497+ min_batch, SBQ_WAKE_BATCH);
494498 __sbitmap_queue_update_wake_batch(sbq, wake_batch);
495499 }
496500 EXPORT_SYMBOL_GPL(sbitmap_queue_recalculate_wake_batch);
lib/test_kasan.c+5−0
@@ -492,6 +492,7 @@ static void kmalloc_oob_in_memset(struct kunit *test) · 491 unmodified lines
492492 ptr = kmalloc(size, GFP_KERNEL);
493493 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr);
494494
495+ OPTIMIZER_HIDE_VAR(ptr);
495496 OPTIMIZER_HIDE_VAR(size);
496497 KUNIT_EXPECT_KASAN_FAIL(test,
497498 memset(ptr, 0, size + KASAN_GRANULE_SIZE));
@@ -515,6 +516,7 @@ static void kmalloc_memmove_negative_size(struct kunit *test) · 17 unmodified lines
515516 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr);
516517
517518 memset((char *)ptr, 0, 64);
519+ OPTIMIZER_HIDE_VAR(ptr);
518520 OPTIMIZER_HIDE_VAR(invalid_size);
519521 KUNIT_EXPECT_KASAN_FAIL(test,
520522 memmove((char *)ptr, (char *)ptr + 4, invalid_size));
@@ -531,6 +533,7 @@ static void kmalloc_memmove_invalid_size(struct kunit *test) · 10 unmodified lines
531533 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr);
532534
533535 memset((char *)ptr, 0, 64);
536+ OPTIMIZER_HIDE_VAR(ptr);
534537 KUNIT_EXPECT_KASAN_FAIL(test,
535538 memmove((char *)ptr, (char *)ptr + 4, invalid_size));
536539 kfree(ptr);
@@ -893,6 +896,7 @@ static void kasan_memchr(struct kunit *test) · 356 unmodified lines
893896 ptr = kmalloc(size, GFP_KERNEL | __GFP_ZERO);
894897 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr);
895898
899+ OPTIMIZER_HIDE_VAR(ptr);
896900 OPTIMIZER_HIDE_VAR(size);
897901 KUNIT_EXPECT_KASAN_FAIL(test,
898902 kasan_ptr_result = memchr(ptr, '1', size + 1));
@@ -919,6 +923,7 @@ static void kasan_memcmp(struct kunit *test) · 20 unmodified lines
919923 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr);
920924 memset(arr, 0, sizeof(arr));
921925
926+ OPTIMIZER_HIDE_VAR(ptr);
922927 OPTIMIZER_HIDE_VAR(size);
923928 KUNIT_EXPECT_KASAN_FAIL(test,
924929 kasan_int_result = memcmp(ptr, arr, size+1));
mm/gup.c+30−5
@@ -124,8 +124,8 @@ static inline struct page *try_get_compound_head(struct page *page, int refs) · 123 unmodified lines
124124 * considered failure, and furthermore, a likely bug in the caller, so a warning
125125 * is also emitted.
126126 */
127−struct page *try_grab_compound_head(struct page *page,
128− int refs, unsigned int flags)
127+__maybe_unused struct page *try_grab_compound_head(struct page *page,
128+ int refs, unsigned int flags)
129129 {
130130 if (flags & FOLL_GET)
131131 return try_get_compound_head(page, refs);
@@ -208,10 +208,35 @@ static void put_compound_head(struct page *page, int refs, unsigned int flags) · 76 unmodified lines
208208 */
209209 bool __must_check try_grab_page(struct page *page, unsigned int flags)
210210 {
211− if (!(flags & (FOLL_GET | FOLL_PIN)))
212− return true;
211+ WARN_ON_ONCE((flags & (FOLL_GET | FOLL_PIN)) == (FOLL_GET | FOLL_PIN));
213212
214− return try_grab_compound_head(page, 1, flags);
213+ if (flags & FOLL_GET)
214+ return try_get_page(page);
215+ else if (flags & FOLL_PIN) {
216+ int refs = 1;
217+
218+ page = compound_head(page);
219+
220+ if (WARN_ON_ONCE(page_ref_count(page) <= 0))
221+ return false;
222+
223+ if (hpage_pincount_available(page))
224+ hpage_pincount_add(page, 1);
225+ else
226+ refs = GUP_PIN_COUNTING_BIAS;
227+
228+ /*
229+ * Similar to try_grab_compound_head(): even if using the
230+ * hpage_pincount_add/_sub() routines, be sure to
231+ * *also* increment the normal page refcount field at least
232+ * once, so that the page really is pinned.
233+ */
234+ page_ref_add(page, refs);
235+
236+ mod_node_page_state(page_pgdat(page), NR_FOLL_PIN_ACQUIRED, 1);
237+ }
238+
239+ return true;
215240 }
216241
217242 /**
mm/memory-failure.c+6−0
@@ -1595,6 +1595,12 @@ static int memory_failure_dev_pagemap(unsigned long pfn, int flags, · 1594 unmodified lines
15951595 goto out;
15961596 }
15971597
1598+ /*
1599+ * Pages instantiated by device-dax (not filesystem-dax)
1600+ * may be compound pages.
1601+ */
1602+ page = compound_head(page);
1603+
15981604 /*
15991605 * Prevent the inode from being freed while we are interrogating
16001606 * the address_space, typically this would be handled by
net/ax25/af_ax25.c+16−7
@@ -77,6 +77,7 @@ static void ax25_kill_by_device(struct net_device *dev) · 76 unmodified lines
7777 {
7878 ax25_dev *ax25_dev;
7979 ax25_cb *s;
80+ struct sock *sk;
8081
8182 if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL)
8283 return;
@@ -85,13 +86,16 @@ static void ax25_kill_by_device(struct net_device *dev) · 2 unmodified lines
8586 again:
8687 ax25_for_each(s, &ax25_list) {
8788 if (s->ax25_dev == ax25_dev) {
89+ sk = s->sk;
90+ sock_hold(sk);
8891 spin_unlock_bh(&ax25_list_lock);
89− lock_sock(s->sk);
92+ lock_sock(sk);
9093 s->ax25_dev = NULL;
91− release_sock(s->sk);
94+ ax25_dev_put(ax25_dev);
95+ release_sock(sk);
9296 ax25_disconnect(s, ENETUNREACH);
9397 spin_lock_bh(&ax25_list_lock);
94−
98+ sock_put(sk);
9599 /* The entry could have been deleted from the
96100 * list meanwhile and thus the next pointer is
97101 * no longer valid. Play it safe and restart
@@ -355,21 +359,25 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg) · 257 unmodified lines
355359 if (copy_from_user(&ax25_ctl, arg, sizeof(ax25_ctl)))
356360 return -EFAULT;
357361
358− if ((ax25_dev = ax25_addr_ax25dev(&ax25_ctl.port_addr)) == NULL)
359− return -ENODEV;
360−
361362 if (ax25_ctl.digi_count > AX25_MAX_DIGIS)
362363 return -EINVAL;
363364
364365 if (ax25_ctl.arg > ULONG_MAX / HZ && ax25_ctl.cmd != AX25_KILL)
365366 return -EINVAL;
366367
368+ ax25_dev = ax25_addr_ax25dev(&ax25_ctl.port_addr);
369+ if (!ax25_dev)
370+ return -ENODEV;
371+
367372 digi.ndigi = ax25_ctl.digi_count;
368373 for (k = 0; k < digi.ndigi; k++)
369374 digi.calls[k] = ax25_ctl.digi_addr[k];
370375
371− if ((ax25 = ax25_find_cb(&ax25_ctl.source_addr, &ax25_ctl.dest_addr, &digi, ax25_dev->dev)) == NULL)
376+ ax25 = ax25_find_cb(&ax25_ctl.source_addr, &ax25_ctl.dest_addr, &digi, ax25_dev->dev);
377+ if (!ax25) {
378+ ax25_dev_put(ax25_dev);
372379 return -ENOTCONN;
380+ }
373381
374382 switch (ax25_ctl.cmd) {
375383 case AX25_KILL:
@@ -436,6 +444,7 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg) · 60 unmodified lines
436444 }
437445
438446 out_put:
447+ ax25_dev_put(ax25_dev);
439448 ax25_cb_put(ax25);
440449 return ret;
441450
net/ax25/ax25_dev.c+23−5
@@ -37,6 +37,7 @@ ax25_dev *ax25_addr_ax25dev(ax25_address *addr) · 36 unmodified lines
3737 for (ax25_dev = ax25_dev_list; ax25_dev != NULL; ax25_dev = ax25_dev->next)
3838 if (ax25cmp(addr, (const ax25_address *)ax25_dev->dev->dev_addr) == 0) {
3939 res = ax25_dev;
40+ ax25_dev_hold(ax25_dev);
4041 }
4142 spin_unlock_bh(&ax25_dev_lock);
4243
@@ -56,6 +57,7 @@ void ax25_dev_device_up(struct net_device *dev) · 13 unmodified lines
5657 return;
5758 }
5859
60+ refcount_set(&ax25_dev->refcount, 1);
5961 dev->ax25_ptr = ax25_dev;
6062 ax25_dev->dev = dev;
6163 dev_hold_track(dev, &ax25_dev->dev_tracker, GFP_ATOMIC);
@@ -84,6 +86,7 @@ void ax25_dev_device_up(struct net_device *dev) · 22 unmodified lines
8486 ax25_dev->next = ax25_dev_list;
8587 ax25_dev_list = ax25_dev;
8688 spin_unlock_bh(&ax25_dev_lock);
89+ ax25_dev_hold(ax25_dev);
8790
8891 ax25_register_dev_sysctl(ax25_dev);
8992 }
@@ -113,9 +116,10 @@ void ax25_dev_device_down(struct net_device *dev) · 23 unmodified lines
113116 if ((s = ax25_dev_list) == ax25_dev) {
114117 ax25_dev_list = s->next;
115118 spin_unlock_bh(&ax25_dev_lock);
119+ ax25_dev_put(ax25_dev);
116120 dev->ax25_ptr = NULL;
117121 dev_put_track(dev, &ax25_dev->dev_tracker);
118− kfree(ax25_dev);
122+ ax25_dev_put(ax25_dev);
119123 return;
120124 }
121125
@@ -123,9 +127,10 @@ void ax25_dev_device_down(struct net_device *dev) · 1 unmodified line
123127 if (s->next == ax25_dev) {
124128 s->next = ax25_dev->next;
125129 spin_unlock_bh(&ax25_dev_lock);
130+ ax25_dev_put(ax25_dev);
126131 dev->ax25_ptr = NULL;
127132 dev_put_track(dev, &ax25_dev->dev_tracker);
128− kfree(ax25_dev);
133+ ax25_dev_put(ax25_dev);
129134 return;
130135 }
131136
@@ -133,6 +138,7 @@ void ax25_dev_device_down(struct net_device *dev) · 1 unmodified line
133138 }
134139 spin_unlock_bh(&ax25_dev_lock);
135140 dev->ax25_ptr = NULL;
141+ ax25_dev_put(ax25_dev);
136142 }
137143
138144 int ax25_fwd_ioctl(unsigned int cmd, struct ax25_fwd_struct *fwd)
@@ -144,20 +150,32 @@ int ax25_fwd_ioctl(unsigned int cmd, struct ax25_fwd_struct *fwd) · 5 unmodified lines
144150
145151 switch (cmd) {
146152 case SIOCAX25ADDFWD:
147− if ((fwd_dev = ax25_addr_ax25dev(&fwd->port_to)) == NULL)
153+ fwd_dev = ax25_addr_ax25dev(&fwd->port_to);
154+ if (!fwd_dev) {
155+ ax25_dev_put(ax25_dev);
148156 return -EINVAL;
149− if (ax25_dev->forward != NULL)
157+ }
158+ if (ax25_dev->forward) {
159+ ax25_dev_put(fwd_dev);
160+ ax25_dev_put(ax25_dev);
150161 return -EINVAL;
162+ }
151163 ax25_dev->forward = fwd_dev->dev;
164+ ax25_dev_put(fwd_dev);
165+ ax25_dev_put(ax25_dev);
152166 break;
153167
154168 case SIOCAX25DELFWD:
155− if (ax25_dev->forward == NULL)
169+ if (!ax25_dev->forward) {
170+ ax25_dev_put(ax25_dev);
156171 return -EINVAL;
172+ }
157173 ax25_dev->forward = NULL;
174+ ax25_dev_put(ax25_dev);
158175 break;
159176
160177 default:
178+ ax25_dev_put(ax25_dev);
161179 return -EINVAL;
162180 }
163181
net/ax25/ax25_route.c+11−2
@@ -75,11 +75,13 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route) · 74 unmodified lines
7575 ax25_dev *ax25_dev;
7676 int i;
7777
78− if ((ax25_dev = ax25_addr_ax25dev(&route->port_addr)) == NULL)
79− return -EINVAL;
8078 if (route->digi_count > AX25_MAX_DIGIS)
8179 return -EINVAL;
8280
81+ ax25_dev = ax25_addr_ax25dev(&route->port_addr);
82+ if (!ax25_dev)
83+ return -EINVAL;
84+
8385 write_lock_bh(&ax25_route_lock);
8486
8587 ax25_rt = ax25_route_list;
@@ -91,6 +93,7 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route) · 5 unmodified lines
9193 if (route->digi_count != 0) {
9294 if ((ax25_rt->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) {
9395 write_unlock_bh(&ax25_route_lock);
96+ ax25_dev_put(ax25_dev);
9497 return -ENOMEM;
9598 }
9699 ax25_rt->digipeat->lastrepeat = -1;
@@ -101,6 +104,7 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route) · 4 unmodified lines
101104 }
102105 }
103106 write_unlock_bh(&ax25_route_lock);
107+ ax25_dev_put(ax25_dev);
104108 return 0;
105109 }
106110 ax25_rt = ax25_rt->next;
@@ -108,6 +112,7 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route) · 1 unmodified line
108112
109113 if ((ax25_rt = kmalloc(sizeof(ax25_route), GFP_ATOMIC)) == NULL) {
110114 write_unlock_bh(&ax25_route_lock);
115+ ax25_dev_put(ax25_dev);
111116 return -ENOMEM;
112117 }
113118
@@ -119,6 +124,7 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route) · 5 unmodified lines
119124 if ((ax25_rt->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) {
120125 write_unlock_bh(&ax25_route_lock);
121126 kfree(ax25_rt);
127+ ax25_dev_put(ax25_dev);
122128 return -ENOMEM;
123129 }
124130 ax25_rt->digipeat->lastrepeat = -1;
@@ -131,6 +137,7 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route) · 6 unmodified lines
131137 ax25_rt->next = ax25_route_list;
132138 ax25_route_list = ax25_rt;
133139 write_unlock_bh(&ax25_route_lock);
140+ ax25_dev_put(ax25_dev);
134141
135142 return 0;
136143 }
@@ -172,6 +179,7 @@ static int ax25_rt_del(struct ax25_routes_struct *route) · 35 unmodified lines
172179 }
173180 }
174181 write_unlock_bh(&ax25_route_lock);
182+ ax25_dev_put(ax25_dev);
175183
176184 return 0;
177185 }
@@ -214,6 +222,7 @@ static int ax25_rt_opt(struct ax25_route_opt_struct *rt_option) · 36 unmodified lines
214222
215223 out:
216224 write_unlock_bh(&ax25_route_lock);
225+ ax25_dev_put(ax25_dev);
217226 return err;
218227 }
219228
net/bridge/netfilter/nft_reject_bridge.c+4−4
@@ -49,7 +49,7 @@ static void nft_reject_br_send_v4_tcp_reset(struct net *net, · 48 unmodified lines
4949 {
5050 struct sk_buff *nskb;
5151
52− nskb = nf_reject_skb_v4_tcp_reset(net, oldskb, dev, hook);
52+ nskb = nf_reject_skb_v4_tcp_reset(net, oldskb, NULL, hook);
5353 if (!nskb)
5454 return;
5555
@@ -65,7 +65,7 @@ static void nft_reject_br_send_v4_unreach(struct net *net, · 9 unmodified lines
6565 {
6666 struct sk_buff *nskb;
6767
68− nskb = nf_reject_skb_v4_unreach(net, oldskb, dev, hook, code);
68+ nskb = nf_reject_skb_v4_unreach(net, oldskb, NULL, hook, code);
6969 if (!nskb)
7070 return;
7171
@@ -81,7 +81,7 @@ static void nft_reject_br_send_v6_tcp_reset(struct net *net, · 9 unmodified lines
8181 {
8282 struct sk_buff *nskb;
8383
84− nskb = nf_reject_skb_v6_tcp_reset(net, oldskb, dev, hook);
84+ nskb = nf_reject_skb_v6_tcp_reset(net, oldskb, NULL, hook);
8585 if (!nskb)
8686 return;
8787
@@ -98,7 +98,7 @@ static void nft_reject_br_send_v6_unreach(struct net *net, · 10 unmodified lines
9898 {
9999 struct sk_buff *nskb;
100100
101− nskb = nf_reject_skb_v6_unreach(net, oldskb, dev, hook, code);
101+ nskb = nf_reject_skb_v6_unreach(net, oldskb, NULL, hook, code);
102102 if (!nskb)
103103 return;
104104
net/core/neighbour.c+12−6
@@ -1133,7 +1133,8 @@ out: · 1132 unmodified lines
11331133 neigh_release(neigh);
11341134 }
11351135
1136−int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
1136+int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb,
1137+ const bool immediate_ok)
11371138 {
11381139 int rc;
11391140 bool immediate_probe = false;
@@ -1154,12 +1155,17 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) · 14 unmodified lines
11541155 atomic_set(&neigh->probes,
11551156 NEIGH_VAR(neigh->parms, UCAST_PROBES));
11561157 neigh_del_timer(neigh);
1157− neigh->nud_state = NUD_INCOMPLETE;
1158+ neigh->nud_state = NUD_INCOMPLETE;
11581159 neigh->updated = now;
1159− next = now + max(NEIGH_VAR(neigh->parms, RETRANS_TIME),
1160− HZ/100);
1160+ if (!immediate_ok) {
1161+ next = now + 1;
1162+ } else {
1163+ immediate_probe = true;
1164+ next = now + max(NEIGH_VAR(neigh->parms,
1165+ RETRANS_TIME),
1166+ HZ / 100);
1167+ }
11611168 neigh_add_timer(neigh, next);
1162− immediate_probe = true;
11631169 } else {
11641170 neigh->nud_state = NUD_FAILED;
11651171 neigh->updated = jiffies;
@@ -1571,7 +1577,7 @@ static void neigh_managed_work(struct work_struct *work) · 405 unmodified lines
15711577
15721578 write_lock_bh(&tbl->lock);
15731579 list_for_each_entry(neigh, &tbl->managed_list, managed_list)
1574− neigh_event_send(neigh, NULL);
1580+ neigh_event_send_probe(neigh, NULL, false);
15751581 queue_delayed_work(system_power_efficient_wq, &tbl->managed_work,
15761582 NEIGH_VAR(&tbl->parms, DELAY_PROBE_TIME));
15771583 write_unlock_bh(&tbl->lock);
net/core/rtnetlink.c+4−2
@@ -3275,8 +3275,8 @@ static int __rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, · 3274 unmodified lines
32753275 struct nlattr *slave_attr[RTNL_SLAVE_MAX_TYPE + 1];
32763276 unsigned char name_assign_type = NET_NAME_USER;
32773277 struct nlattr *linkinfo[IFLA_INFO_MAX + 1];
3278− const struct rtnl_link_ops *m_ops = NULL;
3279− struct net_device *master_dev = NULL;
3278+ const struct rtnl_link_ops *m_ops;
3279+ struct net_device *master_dev;
32803280 struct net *net = sock_net(skb->sk);
32813281 const struct rtnl_link_ops *ops;
32823282 struct nlattr *tb[IFLA_MAX + 1];
@@ -3314,6 +3314,8 @@ replay: · 31 unmodified lines
33143314 else
33153315 dev = NULL;
33163316
3317+ master_dev = NULL;
3318+ m_ops = NULL;
33173319 if (dev) {
33183320 master_dev = netdev_master_upper_dev_get(dev);
33193321 if (master_dev)
net/ieee802154/nl802154.c+4−4
@@ -1441,7 +1441,7 @@ static int nl802154_send_key(struct sk_buff *msg, u32 cmd, u32 portid, · 1440 unmodified lines
14411441
14421442 hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);
14431443 if (!hdr)
1444− return -1;
1444+ return -ENOBUFS;
14451445
14461446 if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))
14471447 goto nla_put_failure;
@@ -1634,7 +1634,7 @@ static int nl802154_send_device(struct sk_buff *msg, u32 cmd, u32 portid, · 186 unmodified lines
16341634
16351635 hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);
16361636 if (!hdr)
1637− return -1;
1637+ return -ENOBUFS;
16381638
16391639 if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))
16401640 goto nla_put_failure;
@@ -1812,7 +1812,7 @@ static int nl802154_send_devkey(struct sk_buff *msg, u32 cmd, u32 portid, · 171 unmodified lines
18121812
18131813 hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);
18141814 if (!hdr)
1815− return -1;
1815+ return -ENOBUFS;
18161816
18171817 if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))
18181818 goto nla_put_failure;
@@ -1988,7 +1988,7 @@ static int nl802154_send_seclevel(struct sk_buff *msg, u32 cmd, u32 portid, · 169 unmodified lines
19881988
19891989 hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);
19901990 if (!hdr)
1991− return -1;
1991+ return -ENOBUFS;
19921992
19931993 if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))
19941994 goto nla_put_failure;
net/ipv4/netfilter/Kconfig+0−4
@@ -58,10 +58,6 @@ config NF_TABLES_ARP · 57 unmodified lines
5858
5959 endif # NF_TABLES
6060
61−config NF_FLOW_TABLE_IPV4
62− tristate
63− select NF_FLOW_TABLE_INET
64−
6561 config NF_DUP_IPV4
6662 tristate "Netfilter IPv4 packet duplication to alternate destination"
6763 depends on !NF_CONNTRACK || NF_CONNTRACK
net/ipv4/tcp.c+5−2
@@ -1321,10 +1321,13 @@ new_segment: · 1320 unmodified lines
13211321
13221322 /* skb changing from pure zc to mixed, must charge zc */
13231323 if (unlikely(skb_zcopy_pure(skb))) {
1324− if (!sk_wmem_schedule(sk, skb->data_len))
1324+ u32 extra = skb->truesize -
1325+ SKB_TRUESIZE(skb_end_offset(skb));
1326+
1327+ if (!sk_wmem_schedule(sk, extra))
13251328 goto wait_for_space;
13261329
1327− sk_mem_charge(sk, skb->data_len);
1330+ sk_mem_charge(sk, extra);
13281331 skb_shinfo(skb)->flags &= ~SKBFL_PURE_ZEROCOPY;
13291332 }
13301333
net/ipv4/tcp_input.c+2−0
@@ -1660,6 +1660,8 @@ static struct sk_buff *tcp_shift_skb_data(struct sock *sk, struct sk_buff *skb, · 1659 unmodified lines
16601660 (mss != tcp_skb_seglen(skb)))
16611661 goto out;
16621662
1663+ if (!tcp_skb_can_collapse(prev, skb))
1664+ goto out;
16631665 len = skb->len;
16641666 pcount = tcp_skb_pcount(skb);
16651667 if (tcp_skb_shift(prev, skb, pcount, len))
net/ipv6/netfilter/Kconfig+0−4
@@ -47,10 +47,6 @@ config NFT_FIB_IPV6 · 46 unmodified lines
4747 endif # NF_TABLES_IPV6
4848 endif # NF_TABLES
4949
50−config NF_FLOW_TABLE_IPV6
51− tristate
52− select NF_FLOW_TABLE_INET
53−
5450 config NF_DUP_IPV6
5551 tristate "Netfilter IPv6 packet duplication to alternate destination"
5652 depends on !NF_CONNTRACK || NF_CONNTRACK
net/ipv6/netfilter/Makefile+0−3
@@ -28,9 +28,6 @@ obj-$(CONFIG_NFT_REJECT_IPV6) += nft_reject_ipv6.o · 27 unmodified lines
2828 obj-$(CONFIG_NFT_DUP_IPV6) += nft_dup_ipv6.o
2929 obj-$(CONFIG_NFT_FIB_IPV6) += nft_fib_ipv6.o
3030
31−# flow table support
32−obj-$(CONFIG_NF_FLOW_TABLE_IPV6) += nf_flow_table_ipv6.o
33−
3431 # matches
3532 obj-$(CONFIG_IP6_NF_MATCH_AH) += ip6t_ah.o
3633 obj-$(CONFIG_IP6_NF_MATCH_EUI64) += ip6t_eui64.o
net/ipv6/netfilter/nf_flow_table_ipv6.c+0−0

Empty file deleted.

net/netfilter/nf_tables_api.c+0−1
@@ -2011,7 +2011,6 @@ static void nft_last_rule(struct nft_rule_blob *blob, const void *ptr) · 2010 unmodified lines
20112011
20122012 prule = (struct nft_rule_dp *)ptr;
20132013 prule->is_last = 1;
2014− ptr += offsetof(struct nft_rule_dp, data);
20152014 /* blob size does not include the trailer rule */
20162015 }
20172016
net/netfilter/nft_byteorder.c+12−0
@@ -167,12 +167,24 @@ nla_put_failure: · 166 unmodified lines
167167 return -1;
168168 }
169169
170+static bool nft_byteorder_reduce(struct nft_regs_track *track,
171+ const struct nft_expr *expr)
172+{
173+ struct nft_byteorder *priv = nft_expr_priv(expr);
174+
175+ track->regs[priv->dreg].selector = NULL;
176+ track->regs[priv->dreg].bitwise = NULL;
177+
178+ return false;
179+}
180+
170181 static const struct nft_expr_ops nft_byteorder_ops = {
171182 .type = &nft_byteorder_type,
172183 .size = NFT_EXPR_SIZE(sizeof(struct nft_byteorder)),
173184 .eval = nft_byteorder_eval,
174185 .init = nft_byteorder_init,
175186 .dump = nft_byteorder_dump,
187+ .reduce = nft_byteorder_reduce,
176188 };
177189
178190 struct nft_expr_type nft_byteorder_type __read_mostly = {
net/netfilter/nft_ct.c+4−1
@@ -260,9 +260,12 @@ static void nft_ct_set_zone_eval(const struct nft_expr *expr, · 259 unmodified lines
260260 ct = this_cpu_read(nft_ct_pcpu_template);
261261
262262 if (likely(refcount_read(&ct->ct_general.use) == 1)) {
263+ refcount_inc(&ct->ct_general.use);
263264 nf_ct_zone_add(ct, &zone);
264265 } else {
265− /* previous skb got queued to userspace */
266+ /* previous skb got queued to userspace, allocate temporary
267+ * one until percpu template can be reused.
268+ */
266269 ct = nf_ct_tmpl_alloc(nft_net(pkt), &zone, GFP_ATOMIC);
267270 if (!ct) {
268271 regs->verdict.code = NF_DROP;
net/packet/af_packet.c+6−2
@@ -1789,7 +1789,10 @@ static int fanout_add(struct sock *sk, struct fanout_args *args) · 1788 unmodified lines
17891789 err = -ENOSPC;
17901790 if (refcount_read(&match->sk_ref) < match->max_num_members) {
17911791 __dev_remove_pack(&po->prot_hook);
1792− po->fanout = match;
1792+
1793+ /* Paired with packet_setsockopt(PACKET_FANOUT_DATA) */
1794+ WRITE_ONCE(po->fanout, match);
1795+
17931796 po->rollover = rollover;
17941797 rollover = NULL;
17951798 refcount_set(&match->sk_ref, refcount_read(&match->sk_ref) + 1);
@@ -3934,7 +3937,8 @@ packet_setsockopt(struct socket *sock, int level, int optname, sockptr_t optval, · 2138 unmodified lines
39343937 }
39353938 case PACKET_FANOUT_DATA:
39363939 {
3937− if (!po->fanout)
3940+ /* Paired with the WRITE_ONCE() in fanout_add() */
3941+ if (!READ_ONCE(po->fanout))
39383942 return -EINVAL;
39393943
39403944 return fanout_set_data(po, optval, optlen);
net/sched/cls_api.c+7−4
@@ -1945,9 +1945,9 @@ static int tc_new_tfilter(struct sk_buff *skb, struct nlmsghdr *n, · 1944 unmodified lines
19451945 bool prio_allocate;
19461946 u32 parent;
19471947 u32 chain_index;
1948− struct Qdisc *q = NULL;
1948+ struct Qdisc *q;
19491949 struct tcf_chain_info chain_info;
1950− struct tcf_chain *chain = NULL;
1950+ struct tcf_chain *chain;
19511951 struct tcf_block *block;
19521952 struct tcf_proto *tp;
19531953 unsigned long cl;
@@ -1976,6 +1976,8 @@ replay: · 22 unmodified lines
19761976 tp = NULL;
19771977 cl = 0;
19781978 block = NULL;
1979+ q = NULL;
1980+ chain = NULL;
19791981 flags = 0;
19801982
19811983 if (prio == 0) {
@@ -2798,8 +2800,8 @@ static int tc_ctl_chain(struct sk_buff *skb, struct nlmsghdr *n, · 816 unmodified lines
27982800 struct tcmsg *t;
27992801 u32 parent;
28002802 u32 chain_index;
2801− struct Qdisc *q = NULL;
2802− struct tcf_chain *chain = NULL;
2803+ struct Qdisc *q;
2804+ struct tcf_chain *chain;
28032805 struct tcf_block *block;
28042806 unsigned long cl;
28052807 int err;
@@ -2809,6 +2811,7 @@ static int tc_ctl_chain(struct sk_buff *skb, struct nlmsghdr *n, · 3 unmodified lines
28092811 return -EPERM;
28102812
28112813 replay:
2814+ q = NULL;
28122815 err = nlmsg_parse_deprecated(n, sizeof(*t), tca, TCA_MAX,
28132816 rtm_tca_policy, extack);
28142817 if (err < 0)
net/smc/af_smc.c+118−15
@@ -566,17 +566,115 @@ static void smc_stat_fallback(struct smc_sock *smc) · 565 unmodified lines
566566 mutex_unlock(&net->smc.mutex_fback_rsn);
567567 }
568568
569+/* must be called under rcu read lock */
570+static void smc_fback_wakeup_waitqueue(struct smc_sock *smc, void *key)
571+{
572+ struct socket_wq *wq;
573+ __poll_t flags;
574+
575+ wq = rcu_dereference(smc->sk.sk_wq);
576+ if (!skwq_has_sleeper(wq))
577+ return;
578+
579+ /* wake up smc sk->sk_wq */
580+ if (!key) {
581+ /* sk_state_change */
582+ wake_up_interruptible_all(&wq->wait);
583+ } else {
584+ flags = key_to_poll(key);
585+ if (flags & (EPOLLIN | EPOLLOUT))
586+ /* sk_data_ready or sk_write_space */
587+ wake_up_interruptible_sync_poll(&wq->wait, flags);
588+ else if (flags & EPOLLERR)
589+ /* sk_error_report */
590+ wake_up_interruptible_poll(&wq->wait, flags);
591+ }
592+}
593+
594+static int smc_fback_mark_woken(wait_queue_entry_t *wait,
595+ unsigned int mode, int sync, void *key)
596+{
597+ struct smc_mark_woken *mark =
598+ container_of(wait, struct smc_mark_woken, wait_entry);
599+
600+ mark->woken = true;
601+ mark->key = key;
602+ return 0;
603+}
604+
605+static void smc_fback_forward_wakeup(struct smc_sock *smc, struct sock *clcsk,
606+ void (*clcsock_callback)(struct sock *sk))
607+{
608+ struct smc_mark_woken mark = { .woken = false };
609+ struct socket_wq *wq;
610+
611+ init_waitqueue_func_entry(&mark.wait_entry,
612+ smc_fback_mark_woken);
613+ rcu_read_lock();
614+ wq = rcu_dereference(clcsk->sk_wq);
615+ if (!wq)
616+ goto out;
617+ add_wait_queue(sk_sleep(clcsk), &mark.wait_entry);
618+ clcsock_callback(clcsk);
619+ remove_wait_queue(sk_sleep(clcsk), &mark.wait_entry);
620+
621+ if (mark.woken)
622+ smc_fback_wakeup_waitqueue(smc, mark.key);
623+out:
624+ rcu_read_unlock();
625+}
626+
627+static void smc_fback_state_change(struct sock *clcsk)
628+{
629+ struct smc_sock *smc =
630+ smc_clcsock_user_data(clcsk);
631+
632+ if (!smc)
633+ return;
634+ smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_state_change);
635+}
636+
637+static void smc_fback_data_ready(struct sock *clcsk)
638+{
639+ struct smc_sock *smc =
640+ smc_clcsock_user_data(clcsk);
641+
642+ if (!smc)
643+ return;
644+ smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_data_ready);
645+}
646+
647+static void smc_fback_write_space(struct sock *clcsk)
648+{
649+ struct smc_sock *smc =
650+ smc_clcsock_user_data(clcsk);
651+
652+ if (!smc)
653+ return;
654+ smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_write_space);
655+}
656+
657+static void smc_fback_error_report(struct sock *clcsk)
658+{
659+ struct smc_sock *smc =
660+ smc_clcsock_user_data(clcsk);
661+
662+ if (!smc)
663+ return;
664+ smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_error_report);
665+}
666+
569667 static int smc_switch_to_fallback(struct smc_sock *smc, int reason_code)
570668 {
571− wait_queue_head_t *smc_wait = sk_sleep(&smc->sk);
572− wait_queue_head_t *clc_wait;
573− unsigned long flags;
669+ struct sock *clcsk;
574670
575671 mutex_lock(&smc->clcsock_release_lock);
576672 if (!smc->clcsock) {
577673 mutex_unlock(&smc->clcsock_release_lock);
578674 return -EBADF;
579675 }
676+ clcsk = smc->clcsock->sk;
677+
580678 smc->use_fallback = true;
581679 smc->fallback_rsn = reason_code;
582680 smc_stat_fallback(smc);
@@ -587,16 +685,22 @@ static int smc_switch_to_fallback(struct smc_sock *smc, int reason_code) · 4 unmodified lines
587685 smc->clcsock->wq.fasync_list =
588686 smc->sk.sk_socket->wq.fasync_list;
589687
590− /* There may be some entries remaining in
591− * smc socket->wq, which should be removed
592− * to clcsocket->wq during the fallback.
688+ /* There might be some wait entries remaining
689+ * in smc sk->sk_wq and they should be woken up
690+ * as clcsock's wait queue is woken up.
593691 */
594− clc_wait = sk_sleep(smc->clcsock->sk);
595− spin_lock_irqsave(&smc_wait->lock, flags);
596− spin_lock_nested(&clc_wait->lock, SINGLE_DEPTH_NESTING);
597− list_splice_init(&smc_wait->head, &clc_wait->head);
598− spin_unlock(&clc_wait->lock);
599− spin_unlock_irqrestore(&smc_wait->lock, flags);
692+ smc->clcsk_state_change = clcsk->sk_state_change;
693+ smc->clcsk_data_ready = clcsk->sk_data_ready;
694+ smc->clcsk_write_space = clcsk->sk_write_space;
695+ smc->clcsk_error_report = clcsk->sk_error_report;
696+
697+ clcsk->sk_state_change = smc_fback_state_change;
698+ clcsk->sk_data_ready = smc_fback_data_ready;
699+ clcsk->sk_write_space = smc_fback_write_space;
700+ clcsk->sk_error_report = smc_fback_error_report;
701+
702+ smc->clcsock->sk->sk_user_data =
703+ (void *)((uintptr_t)smc | SK_USER_DATA_NOCOPY);
600704 }
601705 mutex_unlock(&smc->clcsock_release_lock);
602706 return 0;
@@ -2115,10 +2219,9 @@ out: · 1512 unmodified lines
21152219
21162220 static void smc_clcsock_data_ready(struct sock *listen_clcsock)
21172221 {
2118− struct smc_sock *lsmc;
2222+ struct smc_sock *lsmc =
2223+ smc_clcsock_user_data(listen_clcsock);
21192224
2120− lsmc = (struct smc_sock *)
2121− ((uintptr_t)listen_clcsock->sk_user_data & ~SK_USER_DATA_NOCOPY);
21222225 if (!lsmc)
21232226 return;
21242227 lsmc->clcsk_data_ready(listen_clcsock);
net/smc/smc.h+19−1
@@ -139,6 +139,12 @@ enum smc_urg_state { · 138 unmodified lines
139139 SMC_URG_READ = 3, /* data was already read */
140140 };
141141
142+struct smc_mark_woken {
143+ bool woken;
144+ void *key;
145+ wait_queue_entry_t wait_entry;
146+};
147+
142148 struct smc_connection {
143149 struct rb_node alert_node;
144150 struct smc_link_group *lgr; /* link group of connection */
@@ -228,8 +234,14 @@ struct smc_connection { · 83 unmodified lines
228234 struct smc_sock { /* smc sock container */
229235 struct sock sk;
230236 struct socket *clcsock; /* internal tcp socket */
237+ void (*clcsk_state_change)(struct sock *sk);
238+ /* original stat_change fct. */
231239 void (*clcsk_data_ready)(struct sock *sk);
232− /* original data_ready fct. **/
240+ /* original data_ready fct. */
241+ void (*clcsk_write_space)(struct sock *sk);
242+ /* original write_space fct. */
243+ void (*clcsk_error_report)(struct sock *sk);
244+ /* original error_report fct. */
233245 struct smc_connection conn; /* smc connection */
234246 struct smc_sock *listen_smc; /* listen parent */
235247 struct work_struct connect_work; /* handle non-blocking connect*/
@@ -264,6 +276,12 @@ static inline struct smc_sock *smc_sk(const struct sock *sk) · 28 unmodified lines
264276 return (struct smc_sock *)sk;
265277 }
266278
279+static inline struct smc_sock *smc_clcsock_user_data(struct sock *clcsk)
280+{
281+ return (struct smc_sock *)
282+ ((uintptr_t)clcsk->sk_user_data & ~SK_USER_DATA_NOCOPY);
283+}
284+
267285 extern struct workqueue_struct *smc_hs_wq; /* wq for handshake work */
268286 extern struct workqueue_struct *smc_close_wq; /* wq for close work */
269287
net/smc/smc_diag.c+0−2
@@ -146,13 +146,11 @@ static int __smc_diag_dump(struct sock *sk, struct sk_buff *skb, · 145 unmodified lines
146146 (req->diag_ext & (1 << (SMC_DIAG_LGRINFO - 1))) &&
147147 !list_empty(&smc->conn.lgr->list)) {
148148 struct smc_link *link = smc->conn.lnk;
149− struct net *net = read_pnet(&link->smcibdev->ibdev->coredev.rdma_net);
150149
151150 struct smc_diag_lgrinfo linfo = {
152151 .role = smc->conn.lgr->role,
153152 .lnk[0].ibport = link->ibport,
154153 .lnk[0].link_id = link->link_id,
155− .lnk[0].net_cookie = net->net_cookie,
156154 };
157155
158156 memcpy(linfo.lnk[0].ibname,
net/sunrpc/rpc_pipe.c+2−2
@@ -600,9 +600,9 @@ static int __rpc_rmdir(struct inode *dir, struct dentry *dentry) · 599 unmodified lines
600600
601601 dget(dentry);
602602 ret = simple_rmdir(dir, dentry);
603+ d_drop(dentry);
603604 if (!ret)
604605 fsnotify_rmdir(dir, dentry);
605− d_delete(dentry);
606606 dput(dentry);
607607 return ret;
608608 }
@@ -613,9 +613,9 @@ static int __rpc_unlink(struct inode *dir, struct dentry *dentry) · 4 unmodified lines
613613
614614 dget(dentry);
615615 ret = simple_unlink(dir, dentry);
616+ d_drop(dentry);
616617 if (!ret)
617618 fsnotify_unlink(dir, dentry);
618− d_delete(dentry);
619619 dput(dentry);
620620 return ret;
621621 }
scripts/Makefile+1−1
@@ -25,7 +25,7 @@ HOSTCFLAGS_sorttable.o += -I$(srctree)/tools/arch/x86/include · 24 unmodified lines
2525 HOSTCFLAGS_sorttable.o += -DUNWINDER_ORC_ENABLED
2626 endif
2727
28−ifdef CONFIG_DYNAMIC_FTRACE
28+ifdef CONFIG_BUILDTIME_MCOUNT_SORT
2929 HOSTCFLAGS_sorttable.o += -DMCOUNT_SORT_ENABLED
3030 endif
3131
security/security.c+13−2
@@ -1048,8 +1048,19 @@ int security_dentry_init_security(struct dentry *dentry, int mode, · 1047 unmodified lines
10481048 const char **xattr_name, void **ctx,
10491049 u32 *ctxlen)
10501050 {
1051− return call_int_hook(dentry_init_security, -EOPNOTSUPP, dentry, mode,
1052− name, xattr_name, ctx, ctxlen);
1051+ struct security_hook_list *hp;
1052+ int rc;
1053+
1054+ /*
1055+ * Only one module will provide a security context.
1056+ */
1057+ hlist_for_each_entry(hp, &security_hook_heads.dentry_init_security, list) {
1058+ rc = hp->hook.dentry_init_security(dentry, mode, name,
1059+ xattr_name, ctx, ctxlen);
1060+ if (rc != LSM_RET_DEFAULT(dentry_init_security))
1061+ return rc;
1062+ }
1063+ return LSM_RET_DEFAULT(dentry_init_security);
10531064 }
10541065 EXPORT_SYMBOL(security_dentry_init_security);
10551066
security/selinux/ss/conditional.c+2−1
@@ -152,6 +152,8 @@ static void cond_list_destroy(struct policydb *p) · 151 unmodified lines
152152 for (i = 0; i < p->cond_list_len; i++)
153153 cond_node_destroy(&p->cond_list[i]);
154154 kfree(p->cond_list);
155+ p->cond_list = NULL;
156+ p->cond_list_len = 0;
155157 }
156158
157159 void cond_policydb_destroy(struct policydb *p)
@@ -441,7 +443,6 @@ int cond_read_list(struct policydb *p, void *fp) · 283 unmodified lines
441443 return 0;
442444 err:
443445 cond_list_destroy(p);
444− p->cond_list = NULL;
445446 return rc;
446447 }
447448
tools/arch/x86/include/uapi/asm/kvm.h+3−0
@@ -452,6 +452,9 @@ struct kvm_sync_regs { · 451 unmodified lines
452452
453453 #define KVM_STATE_VMX_PREEMPTION_TIMER_DEADLINE 0x00000001
454454
455+/* attributes for system fd (group 0) */
456+#define KVM_X86_XCOMP_GUEST_SUPP 0
457+
455458 struct kvm_vmx_nested_state_data {
456459 __u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
457460 __u8 shadow_vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
tools/bpf/resolve_btfids/Makefile+5−1
@@ -9,7 +9,11 @@ ifeq ($(V),1) · 8 unmodified lines
99 msg =
1010 else
1111 Q = @
12− msg = @printf ' %-8s %s%s\n' "$(1)" "$(notdir $(2))" "$(if $(3), $(3))";
12+ ifeq ($(silent),1)
13+ msg =
14+ else
15+ msg = @printf ' %-8s %s%s\n' "$(1)" "$(notdir $(2))" "$(if $(3), $(3))";
16+ endif
1317 MAKEFLAGS=--no-print-directory
1418 endif
1519
tools/include/uapi/linux/kvm.h+1−0
@@ -1133,6 +1133,7 @@ struct kvm_ppc_resize_hpt { · 1132 unmodified lines
11331133 #define KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM 206
11341134 #define KVM_CAP_VM_GPA_BITS 207
11351135 #define KVM_CAP_XSAVE2 208
1136+#define KVM_CAP_SYS_ATTRIBUTES 209
11361137
11371138 #ifdef KVM_CAP_IRQ_ROUTING
11381139
tools/include/uapi/linux/lirc.h+0−229
@@ -1,229 +0,0 @@
1−/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2−/*
3− * lirc.h - linux infrared remote control header file
4− * last modified 2010/07/13 by Jarod Wilson
5− */
6−
7−#ifndef _LINUX_LIRC_H
8−#define _LINUX_LIRC_H
9−
10−#include <linux/types.h>
11−#include <linux/ioctl.h>
12−
13−#define PULSE_BIT 0x01000000
14−#define PULSE_MASK 0x00FFFFFF
15−
16−#define LIRC_MODE2_SPACE 0x00000000
17−#define LIRC_MODE2_PULSE 0x01000000
18−#define LIRC_MODE2_FREQUENCY 0x02000000
19−#define LIRC_MODE2_TIMEOUT 0x03000000
20−
21−#define LIRC_VALUE_MASK 0x00FFFFFF
22−#define LIRC_MODE2_MASK 0xFF000000
23−
24−#define LIRC_SPACE(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_SPACE)
25−#define LIRC_PULSE(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_PULSE)
26−#define LIRC_FREQUENCY(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_FREQUENCY)
27−#define LIRC_TIMEOUT(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_TIMEOUT)
28−
29−#define LIRC_VALUE(val) ((val)&LIRC_VALUE_MASK)
30−#define LIRC_MODE2(val) ((val)&LIRC_MODE2_MASK)
31−
32−#define LIRC_IS_SPACE(val) (LIRC_MODE2(val) == LIRC_MODE2_SPACE)
33−#define LIRC_IS_PULSE(val) (LIRC_MODE2(val) == LIRC_MODE2_PULSE)
34−#define LIRC_IS_FREQUENCY(val) (LIRC_MODE2(val) == LIRC_MODE2_FREQUENCY)
35−#define LIRC_IS_TIMEOUT(val) (LIRC_MODE2(val) == LIRC_MODE2_TIMEOUT)
36−
37−/* used heavily by lirc userspace */
38−#define lirc_t int
39−
40−/*** lirc compatible hardware features ***/
41−
42−#define LIRC_MODE2SEND(x) (x)
43−#define LIRC_SEND2MODE(x) (x)
44−#define LIRC_MODE2REC(x) ((x) << 16)
45−#define LIRC_REC2MODE(x) ((x) >> 16)
46−
47−#define LIRC_MODE_RAW 0x00000001
48−#define LIRC_MODE_PULSE 0x00000002
49−#define LIRC_MODE_MODE2 0x00000004
50−#define LIRC_MODE_SCANCODE 0x00000008
51−#define LIRC_MODE_LIRCCODE 0x00000010
52−
53−
54−#define LIRC_CAN_SEND_RAW LIRC_MODE2SEND(LIRC_MODE_RAW)
55−#define LIRC_CAN_SEND_PULSE LIRC_MODE2SEND(LIRC_MODE_PULSE)
56−#define LIRC_CAN_SEND_MODE2 LIRC_MODE2SEND(LIRC_MODE_MODE2)
57−#define LIRC_CAN_SEND_LIRCCODE LIRC_MODE2SEND(LIRC_MODE_LIRCCODE)
58−
59−#define LIRC_CAN_SEND_MASK 0x0000003f
60−
61−#define LIRC_CAN_SET_SEND_CARRIER 0x00000100
62−#define LIRC_CAN_SET_SEND_DUTY_CYCLE 0x00000200
63−#define LIRC_CAN_SET_TRANSMITTER_MASK 0x00000400
64−
65−#define LIRC_CAN_REC_RAW LIRC_MODE2REC(LIRC_MODE_RAW)
66−#define LIRC_CAN_REC_PULSE LIRC_MODE2REC(LIRC_MODE_PULSE)
67−#define LIRC_CAN_REC_MODE2 LIRC_MODE2REC(LIRC_MODE_MODE2)
68−#define LIRC_CAN_REC_SCANCODE LIRC_MODE2REC(LIRC_MODE_SCANCODE)
69−#define LIRC_CAN_REC_LIRCCODE LIRC_MODE2REC(LIRC_MODE_LIRCCODE)
70−
71−#define LIRC_CAN_REC_MASK LIRC_MODE2REC(LIRC_CAN_SEND_MASK)
72−
73−#define LIRC_CAN_SET_REC_CARRIER (LIRC_CAN_SET_SEND_CARRIER << 16)
74−#define LIRC_CAN_SET_REC_DUTY_CYCLE (LIRC_CAN_SET_SEND_DUTY_CYCLE << 16)
75−
76−#define LIRC_CAN_SET_REC_DUTY_CYCLE_RANGE 0x40000000
77−#define LIRC_CAN_SET_REC_CARRIER_RANGE 0x80000000
78−#define LIRC_CAN_GET_REC_RESOLUTION 0x20000000
79−#define LIRC_CAN_SET_REC_TIMEOUT 0x10000000
80−#define LIRC_CAN_SET_REC_FILTER 0x08000000
81−
82−#define LIRC_CAN_MEASURE_CARRIER 0x02000000
83−#define LIRC_CAN_USE_WIDEBAND_RECEIVER 0x04000000
84−
85−#define LIRC_CAN_SEND(x) ((x)&LIRC_CAN_SEND_MASK)
86−#define LIRC_CAN_REC(x) ((x)&LIRC_CAN_REC_MASK)
87−
88−#define LIRC_CAN_NOTIFY_DECODE 0x01000000
89−
90−/*** IOCTL commands for lirc driver ***/
91−
92−#define LIRC_GET_FEATURES _IOR('i', 0x00000000, __u32)
93−
94−#define LIRC_GET_SEND_MODE _IOR('i', 0x00000001, __u32)
95−#define LIRC_GET_REC_MODE _IOR('i', 0x00000002, __u32)
96−#define LIRC_GET_REC_RESOLUTION _IOR('i', 0x00000007, __u32)
97−
98−#define LIRC_GET_MIN_TIMEOUT _IOR('i', 0x00000008, __u32)
99−#define LIRC_GET_MAX_TIMEOUT _IOR('i', 0x00000009, __u32)
100−
101−/* code length in bits, currently only for LIRC_MODE_LIRCCODE */
102−#define LIRC_GET_LENGTH _IOR('i', 0x0000000f, __u32)
103−
104−#define LIRC_SET_SEND_MODE _IOW('i', 0x00000011, __u32)
105−#define LIRC_SET_REC_MODE _IOW('i', 0x00000012, __u32)
106−/* Note: these can reset the according pulse_width */
107−#define LIRC_SET_SEND_CARRIER _IOW('i', 0x00000013, __u32)
108−#define LIRC_SET_REC_CARRIER _IOW('i', 0x00000014, __u32)
109−#define LIRC_SET_SEND_DUTY_CYCLE _IOW('i', 0x00000015, __u32)
110−#define LIRC_SET_TRANSMITTER_MASK _IOW('i', 0x00000017, __u32)
111−
112−/*
113− * when a timeout != 0 is set the driver will send a
114− * LIRC_MODE2_TIMEOUT data packet, otherwise LIRC_MODE2_TIMEOUT is
115− * never sent, timeout is disabled by default
116− */
117−#define LIRC_SET_REC_TIMEOUT _IOW('i', 0x00000018, __u32)
118−
119−/* 1 enables, 0 disables timeout reports in MODE2 */
120−#define LIRC_SET_REC_TIMEOUT_REPORTS _IOW('i', 0x00000019, __u32)
121−
122−/*
123− * if enabled from the next key press on the driver will send
124− * LIRC_MODE2_FREQUENCY packets
125− */
126−#define LIRC_SET_MEASURE_CARRIER_MODE _IOW('i', 0x0000001d, __u32)
127−
128−/*
129− * to set a range use LIRC_SET_REC_CARRIER_RANGE with the
130− * lower bound first and later LIRC_SET_REC_CARRIER with the upper bound
131− */
132−#define LIRC_SET_REC_CARRIER_RANGE _IOW('i', 0x0000001f, __u32)
133−
134−#define LIRC_SET_WIDEBAND_RECEIVER _IOW('i', 0x00000023, __u32)
135−
136−/*
137− * Return the recording timeout, which is either set by
138− * the ioctl LIRC_SET_REC_TIMEOUT or by the kernel after setting the protocols.
139− */
140−#define LIRC_GET_REC_TIMEOUT _IOR('i', 0x00000024, __u32)
141−
142−/*
143− * struct lirc_scancode - decoded scancode with protocol for use with
144− * LIRC_MODE_SCANCODE
145− *
146− * @timestamp: Timestamp in nanoseconds using CLOCK_MONOTONIC when IR
147− * was decoded.
148− * @flags: should be 0 for transmit. When receiving scancodes,
149− * LIRC_SCANCODE_FLAG_TOGGLE or LIRC_SCANCODE_FLAG_REPEAT can be set
150− * depending on the protocol
151− * @rc_proto: see enum rc_proto
152− * @keycode: the translated keycode. Set to 0 for transmit.
153− * @scancode: the scancode received or to be sent
154− */
155−struct lirc_scancode {
156− __u64 timestamp;
157− __u16 flags;
158− __u16 rc_proto;
159− __u32 keycode;
160− __u64 scancode;
161−};
162−
163−/* Set if the toggle bit of rc-5 or rc-6 is enabled */
164−#define LIRC_SCANCODE_FLAG_TOGGLE 1
165−/* Set if this is a nec or sanyo repeat */
166−#define LIRC_SCANCODE_FLAG_REPEAT 2
167−
168−/**
169− * enum rc_proto - the Remote Controller protocol
170− *
171− * @RC_PROTO_UNKNOWN: Protocol not known
172− * @RC_PROTO_OTHER: Protocol known but proprietary
173− * @RC_PROTO_RC5: Philips RC5 protocol
174− * @RC_PROTO_RC5X_20: Philips RC5x 20 bit protocol
175− * @RC_PROTO_RC5_SZ: StreamZap variant of RC5
176− * @RC_PROTO_JVC: JVC protocol
177− * @RC_PROTO_SONY12: Sony 12 bit protocol
178− * @RC_PROTO_SONY15: Sony 15 bit protocol
179− * @RC_PROTO_SONY20: Sony 20 bit protocol
180− * @RC_PROTO_NEC: NEC protocol
181− * @RC_PROTO_NECX: Extended NEC protocol
182− * @RC_PROTO_NEC32: NEC 32 bit protocol
183− * @RC_PROTO_SANYO: Sanyo protocol
184− * @RC_PROTO_MCIR2_KBD: RC6-ish MCE keyboard
185− * @RC_PROTO_MCIR2_MSE: RC6-ish MCE mouse
186− * @RC_PROTO_RC6_0: Philips RC6-0-16 protocol
187− * @RC_PROTO_RC6_6A_20: Philips RC6-6A-20 protocol
188− * @RC_PROTO_RC6_6A_24: Philips RC6-6A-24 protocol
189− * @RC_PROTO_RC6_6A_32: Philips RC6-6A-32 protocol
190− * @RC_PROTO_RC6_MCE: MCE (Philips RC6-6A-32 subtype) protocol
191− * @RC_PROTO_SHARP: Sharp protocol
192− * @RC_PROTO_XMP: XMP protocol
193− * @RC_PROTO_CEC: CEC protocol
194− * @RC_PROTO_IMON: iMon Pad protocol
195− * @RC_PROTO_RCMM12: RC-MM protocol 12 bits
196− * @RC_PROTO_RCMM24: RC-MM protocol 24 bits
197− * @RC_PROTO_RCMM32: RC-MM protocol 32 bits
198− */
199−enum rc_proto {
200− RC_PROTO_UNKNOWN = 0,
201− RC_PROTO_OTHER = 1,
202− RC_PROTO_RC5 = 2,
203− RC_PROTO_RC5X_20 = 3,
204− RC_PROTO_RC5_SZ = 4,
205− RC_PROTO_JVC = 5,
206− RC_PROTO_SONY12 = 6,
207− RC_PROTO_SONY15 = 7,
208− RC_PROTO_SONY20 = 8,
209− RC_PROTO_NEC = 9,
210− RC_PROTO_NECX = 10,
211− RC_PROTO_NEC32 = 11,
212− RC_PROTO_SANYO = 12,
213− RC_PROTO_MCIR2_KBD = 13,
214− RC_PROTO_MCIR2_MSE = 14,
215− RC_PROTO_RC6_0 = 15,
216− RC_PROTO_RC6_6A_20 = 16,
217− RC_PROTO_RC6_6A_24 = 17,
218− RC_PROTO_RC6_6A_32 = 18,
219− RC_PROTO_RC6_MCE = 19,
220− RC_PROTO_SHARP = 20,
221− RC_PROTO_XMP = 21,
222− RC_PROTO_CEC = 22,
223− RC_PROTO_IMON = 23,
224− RC_PROTO_RCMM12 = 24,
225− RC_PROTO_RCMM24 = 25,
226− RC_PROTO_RCMM32 = 26,
227−};
228−
229−#endif
tools/scripts/Makefile.include+1−1
@@ -90,7 +90,7 @@ EXTRA_WARNINGS += -Wstrict-aliasing=3 · 89 unmodified lines
9090
9191 else ifneq ($(CROSS_COMPILE),)
9292 CLANG_CROSS_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%))
93−GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)gcc))
93+GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)gcc 2>/dev/null))
9494 ifneq ($(GCC_TOOLCHAIN_DIR),)
9595 CLANG_CROSS_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
9696 CLANG_CROSS_FLAGS += --sysroot=$(shell $(CROSS_COMPILE)gcc -print-sysroot)
tools/testing/kunit/kunit_kernel.py+1−0
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 # Author: Felix Guo <felixguoxiuping@gmail.com>
77 # Author: Brendan Higgins <brendanhiggins@google.com>
88
9+import importlib.abc
910 import importlib.util
1011 import logging
1112 import subprocess
tools/testing/scatterlist/linux/mm.h+2−1
@@ -74,7 +74,7 @@ static inline unsigned long page_to_phys(struct page *page) · 73 unmodified lines
7474 __UNIQUE_ID(min1_), __UNIQUE_ID(min2_), \
7575 x, y)
7676
77−#define preemptible() (1)
77+#define pagefault_disabled() (0)
7878
7979 static inline void *kmap(struct page *page)
8080 {
@@ -127,6 +127,7 @@ kmalloc_array(unsigned int n, unsigned int size, unsigned int flags) · 46 unmodified lines
127127 #define kmemleak_free(a)
128128
129129 #define PageSlab(p) (0)
130+#define flush_dcache_page(p)
130131
131132 #define MAX_ERRNO 4095
132133
tools/testing/selftests/arm64/fp/sve-ptrace.c+9−2
@@ -261,7 +261,7 @@ static void ptrace_sve_fpsimd(pid_t child, const struct vec_type *type) · 260 unmodified lines
261261 }
262262
263263 ksft_test_result((sve->flags & SVE_PT_REGS_MASK) == SVE_PT_REGS_FPSIMD,
264− "Set FPSIMD registers via %s\n", type->name);
264+ "Got FPSIMD registers via %s\n", type->name);
265265 if ((sve->flags & SVE_PT_REGS_MASK) != SVE_PT_REGS_FPSIMD)
266266 goto out;
267267
@@ -557,7 +557,14 @@ static int do_parent(pid_t child) · 289 unmodified lines
557557 }
558558
559559 /* prctl() flags */
560− ptrace_set_get_inherit(child, &vec_types[i]);
560+ if (getauxval(vec_types[i].hwcap_type) & vec_types[i].hwcap) {
561+ ptrace_set_get_inherit(child, &vec_types[i]);
562+ } else {
563+ ksft_test_result_skip("%s SVE_PT_VL_INHERIT set\n",
564+ vec_types[i].name);
565+ ksft_test_result_skip("%s SVE_PT_VL_INHERIT cleared\n",
566+ vec_types[i].name);
567+ }
561568
562569 /* Step through every possible VQ */
563570 for (vq = SVE_VQ_MIN; vq <= SVE_VQ_MAX; vq++) {
tools/testing/selftests/bpf/test_lirc_mode2_user.c+0−1
@@ -28,7 +28,6 @@ · 27 unmodified lines
2828 // 5. We can read keycode from same /dev/lirc device
2929
3030 #include <linux/bpf.h>
31−#include <linux/lirc.h>
3231 #include <linux/input.h>
3332 #include <errno.h>
3433 #include <stdio.h>
tools/testing/selftests/cpufreq/main.sh+1−1
@@ -194,5 +194,5 @@ prerequisite · 193 unmodified lines
194194
195195 # Run requested functions
196196 clear_dumps $OUTFILE
197−do_test >> $OUTFILE.txt
197+do_test | tee -a $OUTFILE.txt
198198 dmesg_dumps $OUTFILE
tools/testing/selftests/exec/Makefile+1−1
@@ -5,7 +5,7 @@ CFLAGS += -D_GNU_SOURCE · 4 unmodified lines
55
66 TEST_PROGS := binfmt_script non-regular
77 TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216
8−TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir pipe
8+TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir
99 # Makefile is a run-time dependency, since it's accessed by the execveat test
1010 TEST_FILES := Makefile
1111
tools/testing/selftests/futex/Makefile+2−2
@@ -11,7 +11,7 @@ all: · 10 unmodified lines
1111 @for DIR in $(SUBDIRS); do \
1212 BUILD_TARGET=$(OUTPUT)/$$DIR; \
1313 mkdir $$BUILD_TARGET -p; \
14− make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
14+ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
1515 if [ -e $$DIR/$(TEST_PROGS) ]; then \
1616 rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/; \
1717 fi \
@@ -32,6 +32,6 @@ override define CLEAN · 14 unmodified lines
3232 @for DIR in $(SUBDIRS); do \
3333 BUILD_TARGET=$(OUTPUT)/$$DIR; \
3434 mkdir $$BUILD_TARGET -p; \
35− make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
35+ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
3636 done
3737 endef
tools/testing/selftests/kselftest_harness.h+3−1
@@ -877,7 +877,8 @@ static void __timeout_handler(int sig, siginfo_t *info, void *ucontext) · 876 unmodified lines
877877 }
878878
879879 t->timed_out = true;
880− kill(t->pid, SIGKILL);
880+ // signal process group
881+ kill(-(t->pid), SIGKILL);
881882 }
882883
883884 void __wait_for_test(struct __test_metadata *t)
@@ -987,6 +988,7 @@ void __run_test(struct __fixture_metadata *f, · 103 unmodified lines
987988 ksft_print_msg("ERROR SPAWNING TEST CHILD\n");
988989 t->passed = 0;
989990 } else if (t->pid == 0) {
991+ setpgrp();
990992 t->fn(t, variant);
991993 if (t->skip)
992994 _exit(255);
tools/testing/selftests/kvm/Makefile+1−0
@@ -85,6 +85,7 @@ TEST_GEN_PROGS_x86_64 += x86_64/xen_vmcall_test · 84 unmodified lines
8585 TEST_GEN_PROGS_x86_64 += x86_64/vmx_pi_mmio_test
8686 TEST_GEN_PROGS_x86_64 += x86_64/sev_migrate_tests
8787 TEST_GEN_PROGS_x86_64 += x86_64/amx_test
88+TEST_GEN_PROGS_x86_64 += access_tracking_perf_test
8889 TEST_GEN_PROGS_x86_64 += demand_paging_test
8990 TEST_GEN_PROGS_x86_64 += dirty_log_test
9091 TEST_GEN_PROGS_x86_64 += dirty_log_perf_test
tools/testing/selftests/kvm/include/kvm_util_base.h+0−1
@@ -345,7 +345,6 @@ struct kvm_vm *vm_create_with_vcpus(enum vm_guest_mode mode, uint32_t nr_vcpus, · 344 unmodified lines
345345 * guest_code - The vCPU's entry point
346346 */
347347 void vm_vcpu_add_default(struct kvm_vm *vm, uint32_t vcpuid, void *guest_code);
348−void vm_xsave_req_perm(void);
349348
350349 bool vm_is_unrestricted_guest(struct kvm_vm *vm);
351350
tools/testing/selftests/kvm/include/x86_64/processor.h+1−0
@@ -458,6 +458,7 @@ uint64_t kvm_hypercall(uint64_t nr, uint64_t a0, uint64_t a1, uint64_t a2, · 457 unmodified lines
458458 struct kvm_cpuid2 *kvm_get_supported_hv_cpuid(void);
459459 void vcpu_set_hv_cpuid(struct kvm_vm *vm, uint32_t vcpuid);
460460 struct kvm_cpuid2 *vcpu_get_supported_hv_cpuid(struct kvm_vm *vm, uint32_t vcpuid);
461+void vm_xsave_req_perm(int bit);
461462
462463 enum x86_page_size {
463464 X86_PAGE_SIZE_4K = 0,
tools/testing/selftests/kvm/lib/kvm_util.c+0−7
@@ -393,13 +393,6 @@ struct kvm_vm *vm_create_with_vcpus(enum vm_guest_mode mode, uint32_t nr_vcpus, · 392 unmodified lines
393393 struct kvm_vm *vm;
394394 int i;
395395
396−#ifdef __x86_64__
397− /*
398− * Permission needs to be requested before KVM_SET_CPUID2.
399− */
400− vm_xsave_req_perm();
401−#endif
402−
403396 /* Force slot0 memory size not small than DEFAULT_GUEST_PHY_PAGES */
404397 if (slot0_mem_pages < DEFAULT_GUEST_PHY_PAGES)
405398 slot0_mem_pages = DEFAULT_GUEST_PHY_PAGES;
tools/testing/selftests/kvm/lib/x86_64/processor.c+21−6
@@ -665,16 +665,31 @@ static bool is_xfd_supported(void) · 664 unmodified lines
665665 return !!(eax & CPUID_XFD_BIT);
666666 }
667667
668−void vm_xsave_req_perm(void)
668+void vm_xsave_req_perm(int bit)
669669 {
670− unsigned long bitmask;
670+ int kvm_fd;
671+ u64 bitmask;
671672 long rc;
673+ struct kvm_device_attr attr = {
674+ .group = 0,
675+ .attr = KVM_X86_XCOMP_GUEST_SUPP,
676+ .addr = (unsigned long) &bitmask
677+ };
678+
679+ kvm_fd = open_kvm_dev_path_or_exit();
680+ rc = ioctl(kvm_fd, KVM_GET_DEVICE_ATTR, &attr);
681+ close(kvm_fd);
682+ if (rc == -1 && (errno == ENXIO || errno == EINVAL))
683+ exit(KSFT_SKIP);
684+ TEST_ASSERT(rc == 0, "KVM_GET_DEVICE_ATTR(0, KVM_X86_XCOMP_GUEST_SUPP) error: %ld", rc);
685+ if (!(bitmask & (1ULL << bit)))
686+ exit(KSFT_SKIP);
672687
673688 if (!is_xfd_supported())
674− return;
689+ exit(KSFT_SKIP);
690+
691+ rc = syscall(SYS_arch_prctl, ARCH_REQ_XCOMP_GUEST_PERM, bit);
675692
676− rc = syscall(SYS_arch_prctl, ARCH_REQ_XCOMP_GUEST_PERM,
677− XSTATE_XTILE_DATA_BIT);
678693 /*
679694 * The older kernel version(<5.15) can't support
680695 * ARCH_REQ_XCOMP_GUEST_PERM and directly return.
@@ -684,7 +699,7 @@ void vm_xsave_req_perm(void) · 3 unmodified lines
684699
685700 rc = syscall(SYS_arch_prctl, ARCH_GET_XCOMP_GUEST_PERM, &bitmask);
686701 TEST_ASSERT(rc == 0, "prctl(ARCH_GET_XCOMP_GUEST_PERM) error: %ld", rc);
687− TEST_ASSERT(bitmask & XFEATURE_XTILE_MASK,
702+ TEST_ASSERT(bitmask & (1ULL << bit),
688703 "prctl(ARCH_REQ_XCOMP_GUEST_PERM) failure bitmask=0x%lx",
689704 bitmask);
690705 }
tools/testing/selftests/kvm/x86_64/amx_test.c+2−0
@@ -329,6 +329,8 @@ int main(int argc, char *argv[]) · 328 unmodified lines
329329 u32 amx_offset;
330330 int stage, ret;
331331
332+ vm_xsave_req_perm(XSTATE_XTILE_DATA_BIT);
333+
332334 /* Create VM */
333335 vm = vm_create_default(VCPU_ID, 0, guest_code);
334336
tools/testing/selftests/kvm/x86_64/smm_test.c+0−1
@@ -105,7 +105,6 @@ static void guest_code(void *arg) · 104 unmodified lines
105105
106106 if (cpu_has_svm()) {
107107 run_guest(svm->vmcb, svm->vmcb_gpa);
108− svm->vmcb->save.rip += 3;
109108 run_guest(svm->vmcb, svm->vmcb_gpa);
110109 } else {
111110 vmlaunch();
tools/testing/selftests/mincore/mincore_selftest.c+14−6
@@ -207,15 +207,21 @@ TEST(check_file_mmap) · 206 unmodified lines
207207
208208 errno = 0;
209209 fd = open(".", O_TMPFILE | O_RDWR, 0600);
210− ASSERT_NE(-1, fd) {
211− TH_LOG("Can't create temporary file: %s",
212− strerror(errno));
210+ if (fd < 0) {
211+ ASSERT_EQ(errno, EOPNOTSUPP) {
212+ TH_LOG("Can't create temporary file: %s",
213+ strerror(errno));
214+ }
215+ SKIP(goto out_free, "O_TMPFILE not supported by filesystem.");
213216 }
214217 errno = 0;
215218 retval = fallocate(fd, 0, 0, FILE_SIZE);
216− ASSERT_EQ(0, retval) {
217− TH_LOG("Error allocating space for the temporary file: %s",
218− strerror(errno));
219+ if (retval) {
220+ ASSERT_EQ(errno, EOPNOTSUPP) {
221+ TH_LOG("Error allocating space for the temporary file: %s",
222+ strerror(errno));
223+ }
224+ SKIP(goto out_close, "fallocate not supported by filesystem.");
219225 }
220226
221227 /*
@@ -271,7 +277,9 @@ TEST(check_file_mmap) · 49 unmodified lines
271277 }
272278
273279 munmap(addr, FILE_SIZE);
280+out_close:
274281 close(fd);
282+out_free:
275283 free(vec);
276284 }
277285
tools/testing/selftests/netfilter/nft_concat_range.sh+71−1
@@ -27,7 +27,7 @@ TYPES="net_port port_net net6_port port_proto net6_port_mac net6_port_mac_proto · 26 unmodified lines
2727 net6_port_net6_port net_port_mac_proto_net"
2828
2929 # Reported bugs, also described by TYPE_ variables below
30−BUGS="flush_remove_add"
30+BUGS="flush_remove_add reload"
3131
3232 # List of possible paths to pktgen script from kernel tree for performance tests
3333 PKTGEN_SCRIPT_PATHS="
@@ -354,6 +354,23 @@ TYPE_flush_remove_add=" · 320 unmodified lines
354354 display Add two elements, flush, re-add
355355 "
356356
357+TYPE_reload="
358+display net,mac with reload
359+type_spec ipv4_addr . ether_addr
360+chain_spec ip daddr . ether saddr
361+dst addr4
362+src mac
363+start 1
364+count 1
365+src_delta 2000
366+tools sendip nc bash
367+proto udp
368+
369+race_repeat 0
370+
371+perf_duration 0
372+"
373+
357374 # Set template for all tests, types and rules are filled in depending on test
358375 set_template='
359376 flush ruleset
@@ -1473,6 +1490,59 @@ test_bug_flush_remove_add() { · 1113 unmodified lines
14731490 nft flush ruleset
14741491 }
14751492
1493+# - add ranged element, check that packets match it
1494+# - reload the set, check packets still match
1495+test_bug_reload() {
1496+ setup veth send_"${proto}" set || return ${KSELFTEST_SKIP}
1497+ rstart=${start}
1498+
1499+ range_size=1
1500+ for i in $(seq "${start}" $((start + count))); do
1501+ end=$((start + range_size))
1502+
1503+ # Avoid negative or zero-sized port ranges
1504+ if [ $((end / 65534)) -gt $((start / 65534)) ]; then
1505+ start=${end}
1506+ end=$((end + 1))
1507+ fi
1508+ srcstart=$((start + src_delta))
1509+ srcend=$((end + src_delta))
1510+
1511+ add "$(format)" || return 1
1512+ range_size=$((range_size + 1))
1513+ start=$((end + range_size))
1514+ done
1515+
1516+ # check kernel does allocate pcpu sctrach map
1517+ # for reload with no elemet add/delete
1518+ ( echo flush set inet filter test ;
1519+ nft list set inet filter test ) | nft -f -
1520+
1521+ start=${rstart}
1522+ range_size=1
1523+
1524+ for i in $(seq "${start}" $((start + count))); do
1525+ end=$((start + range_size))
1526+
1527+ # Avoid negative or zero-sized port ranges
1528+ if [ $((end / 65534)) -gt $((start / 65534)) ]; then
1529+ start=${end}
1530+ end=$((end + 1))
1531+ fi
1532+ srcstart=$((start + src_delta))
1533+ srcend=$((end + src_delta))
1534+
1535+ for j in $(seq ${start} $((range_size / 2 + 1)) ${end}); do
1536+ send_match "${j}" $((j + src_delta)) || return 1
1537+ done
1538+
1539+ range_size=$((range_size + 1))
1540+ start=$((end + range_size))
1541+ done
1542+
1543+ nft flush ruleset
1544+}
1545+
14761546 test_reported_issues() {
14771547 eval test_bug_"${subtest}"
14781548 }
tools/testing/selftests/netfilter/nft_nat.sh+152−0
@@ -899,6 +899,144 @@ EOF · 898 unmodified lines
899899 ip netns exec "$ns0" nft delete table $family nat
900900 }
901901
902+test_stateless_nat_ip()
903+{
904+ local lret=0
905+
906+ ip netns exec "$ns0" sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null
907+ ip netns exec "$ns0" sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null
908+
909+ ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1
910+ if [ $? -ne 0 ] ; then
911+ echo "ERROR: cannot ping $ns1 from $ns2 before loading stateless rules"
912+ return 1
913+ fi
914+
915+ip netns exec "$ns0" nft -f /dev/stdin <<EOF
916+table ip stateless {
917+ map xlate_in {
918+ typeof meta iifname . ip saddr . ip daddr : ip daddr
919+ elements = {
920+ "veth1" . 10.0.2.99 . 10.0.1.99 : 10.0.2.2,
921+ }
922+ }
923+ map xlate_out {
924+ typeof meta iifname . ip saddr . ip daddr : ip daddr
925+ elements = {
926+ "veth0" . 10.0.1.99 . 10.0.2.2 : 10.0.2.99
927+ }
928+ }
929+
930+ chain prerouting {
931+ type filter hook prerouting priority -400; policy accept;
932+ ip saddr set meta iifname . ip saddr . ip daddr map @xlate_in
933+ ip daddr set meta iifname . ip saddr . ip daddr map @xlate_out
934+ }
935+}
936+EOF
937+ if [ $? -ne 0 ]; then
938+ echo "SKIP: Could not add ip statless rules"
939+ return $ksft_skip
940+ fi
941+
942+ reset_counters
943+
944+ ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1
945+ if [ $? -ne 0 ] ; then
946+ echo "ERROR: cannot ping $ns1 from $ns2 with stateless rules"
947+ lret=1
948+ fi
949+
950+ # ns1 should have seen packets from .2.2, due to stateless rewrite.
951+ expect="packets 1 bytes 84"
952+ cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0insl | grep -q "$expect")
953+ if [ $? -ne 0 ]; then
954+ bad_counter "$ns1" ns0insl "$expect" "test_stateless 1"
955+ lret=1
956+ fi
957+
958+ for dir in "in" "out" ; do
959+ cnt=$(ip netns exec "$ns2" nft list counter inet filter ns1${dir} | grep -q "$expect")
960+ if [ $? -ne 0 ]; then
961+ bad_counter "$ns2" ns1$dir "$expect" "test_stateless 2"
962+ lret=1
963+ fi
964+ done
965+
966+ # ns1 should not have seen packets from ns2, due to masquerade
967+ expect="packets 0 bytes 0"
968+ for dir in "in" "out" ; do
969+ cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect")
970+ if [ $? -ne 0 ]; then
971+ bad_counter "$ns1" ns0$dir "$expect" "test_stateless 3"
972+ lret=1
973+ fi
974+
975+ cnt=$(ip netns exec "$ns0" nft list counter inet filter ns1${dir} | grep -q "$expect")
976+ if [ $? -ne 0 ]; then
977+ bad_counter "$ns0" ns1$dir "$expect" "test_stateless 4"
978+ lret=1
979+ fi
980+ done
981+
982+ reset_counters
983+
984+ socat -h > /dev/null 2>&1
985+ if [ $? -ne 0 ];then
986+ echo "SKIP: Could not run stateless nat frag test without socat tool"
987+ if [ $lret -eq 0 ]; then
988+ return $ksft_skip
989+ fi
990+
991+ ip netns exec "$ns0" nft delete table ip stateless
992+ return $lret
993+ fi
994+
995+ local tmpfile=$(mktemp)
996+ dd if=/dev/urandom of=$tmpfile bs=4096 count=1 2>/dev/null
997+
998+ local outfile=$(mktemp)
999+ ip netns exec "$ns1" timeout 3 socat -u UDP4-RECV:4233 OPEN:$outfile < /dev/null &
1000+ sc_r=$!
1001+
1002+ sleep 1
1003+ # re-do with large ping -> ip fragmentation
1004+ ip netns exec "$ns2" timeout 3 socat - UDP4-SENDTO:"10.0.1.99:4233" < "$tmpfile" > /dev/null
1005+ if [ $? -ne 0 ] ; then
1006+ echo "ERROR: failed to test udp $ns1 to $ns2 with stateless ip nat" 1>&2
1007+ lret=1
1008+ fi
1009+
1010+ wait
1011+
1012+ cmp "$tmpfile" "$outfile"
1013+ if [ $? -ne 0 ]; then
1014+ ls -l "$tmpfile" "$outfile"
1015+ echo "ERROR: in and output file mismatch when checking udp with stateless nat" 1>&2
1016+ lret=1
1017+ fi
1018+
1019+ rm -f "$tmpfile" "$outfile"
1020+
1021+ # ns1 should have seen packets from 2.2, due to stateless rewrite.
1022+ expect="packets 3 bytes 4164"
1023+ cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0insl | grep -q "$expect")
1024+ if [ $? -ne 0 ]; then
1025+ bad_counter "$ns1" ns0insl "$expect" "test_stateless 5"
1026+ lret=1
1027+ fi
1028+
1029+ ip netns exec "$ns0" nft delete table ip stateless
1030+ if [ $? -ne 0 ]; then
1031+ echo "ERROR: Could not delete table ip stateless" 1>&2
1032+ lret=1
1033+ fi
1034+
1035+ test $lret -eq 0 && echo "PASS: IP statless for $ns2"
1036+
1037+ return $lret
1038+}
1039+
9021040 # ip netns exec "$ns0" ping -c 1 -q 10.0.$i.99
9031041 for i in 0 1 2; do
9041042 ip netns exec ns$i-$sfx nft -f /dev/stdin <<EOF
@@ -965,6 +1103,19 @@ table inet filter { · 60 unmodified lines
9651103 EOF
9661104 done
9671105
1106+# special case for stateless nat check, counter needs to
1107+# be done before (input) ip defragmentation
1108+ip netns exec ns1-$sfx nft -f /dev/stdin <<EOF
1109+table inet filter {
1110+ counter ns0insl {}
1111+
1112+ chain pre {
1113+ type filter hook prerouting priority -400; policy accept;
1114+ ip saddr 10.0.2.2 counter name "ns0insl"
1115+ }
1116+}
1117+EOF
1118+
9681119 sleep 3
9691120 # test basic connectivity
9701121 for i in 1 2; do
@@ -1019,6 +1170,7 @@ $test_inet_nat && test_redirect inet · 48 unmodified lines
10191170 $test_inet_nat && test_redirect6 inet
10201171
10211172 test_port_shadowing
1173+test_stateless_nat_ip
10221174
10231175 if [ $ret -ne 0 ];then
10241176 echo -n "FAIL: "
tools/testing/selftests/netfilter/nft_zones_many.sh+6−6
@@ -9,7 +9,7 @@ ns="ns-$sfx" · 8 unmodified lines
99 # Kselftest framework requirement - SKIP code is 4.
1010 ksft_skip=4
1111
12−zones=20000
12+zones=2000
1313 have_ct_tool=0
1414 ret=0
1515
@@ -75,10 +75,10 @@ EOF · 59 unmodified lines
7575
7676 while [ $i -lt $max_zones ]; do
7777 local start=$(date +%s%3N)
78− i=$((i + 10000))
78+ i=$((i + 1000))
7979 j=$((j + 1))
8080 # nft rule in output places each packet in a different zone.
81− dd if=/dev/zero of=/dev/stdout bs=8k count=10000 2>/dev/null | ip netns exec "$ns" socat STDIN UDP:127.0.0.1:12345,sourceport=12345
81+ dd if=/dev/zero of=/dev/stdout bs=8k count=1000 2>/dev/null | ip netns exec "$ns" socat STDIN UDP:127.0.0.1:12345,sourceport=12345
8282 if [ $? -ne 0 ] ;then
8383 ret=1
8484 break
@@ -86,7 +86,7 @@ EOF · 1 unmodified line
8686
8787 stop=$(date +%s%3N)
8888 local duration=$((stop-start))
89− echo "PASS: added 10000 entries in $duration ms (now $i total, loop $j)"
89+ echo "PASS: added 1000 entries in $duration ms (now $i total, loop $j)"
9090 done
9191
9292 if [ $have_ct_tool -eq 1 ]; then
@@ -128,11 +128,11 @@ test_conntrack_tool() { · 35 unmodified lines
128128 break
129129 fi
130130
131− if [ $((i%10000)) -eq 0 ];then
131+ if [ $((i%1000)) -eq 0 ];then
132132 stop=$(date +%s%3N)
133133
134134 local duration=$((stop-start))
135− echo "PASS: added 10000 entries in $duration ms (now $i total)"
135+ echo "PASS: added 1000 entries in $duration ms (now $i total)"
136136 start=$stop
137137 fi
138138 done
tools/testing/selftests/openat2/Makefile+1−1
@@ -5,4 +5,4 @@ TEST_GEN_PROGS := openat2_test resolve_test rename_attack_test · 4 unmodified lines
55
66 include ../lib.mk
77
8−$(TEST_GEN_PROGS): helpers.c
8+$(TEST_GEN_PROGS): helpers.c helpers.h
tools/testing/selftests/openat2/helpers.h+7−5
@@ -9,6 +9,7 @@ · 8 unmodified lines
99
1010 #define _GNU_SOURCE
1111 #include <stdint.h>
12+#include <stdbool.h>
1213 #include <errno.h>
1314 #include <linux/types.h>
1415 #include "../kselftest.h"
@@ -62,11 +63,12 @@ bool needs_openat2(const struct open_how *how); · 47 unmodified lines
6263 (similar to chroot(2)). */
6364 #endif /* RESOLVE_IN_ROOT */
6465
65−#define E_func(func, ...) \
66− do { \
67− if (func(__VA_ARGS__) < 0) \
68− ksft_exit_fail_msg("%s:%d %s failed\n", \
69− __FILE__, __LINE__, #func);\
66+#define E_func(func, ...) \
67+ do { \
68+ errno = 0; \
69+ if (func(__VA_ARGS__) < 0) \
70+ ksft_exit_fail_msg("%s:%d %s failed - errno:%d\n", \
71+ __FILE__, __LINE__, #func, errno); \
7072 } while (0)
7173
7274 #define E_asprintf(...) E_func(asprintf, __VA_ARGS__)
tools/testing/selftests/openat2/openat2_test.c+11−1
@@ -259,6 +259,16 @@ void test_openat2_flags(void) · 258 unmodified lines
259259 unlink(path);
260260
261261 fd = sys_openat2(AT_FDCWD, path, &test->how);
262+ if (fd < 0 && fd == -EOPNOTSUPP) {
263+ /*
264+ * Skip the testcase if it failed because not supported
265+ * by FS. (e.g. a valid O_TMPFILE combination on NFS)
266+ */
267+ ksft_test_result_skip("openat2 with %s fails with %d (%s)\n",
268+ test->name, fd, strerror(-fd));
269+ goto next;
270+ }
271+
262272 if (test->err >= 0)
263273 failed = (fd < 0);
264274 else
@@ -303,7 +313,7 @@ skip: · 38 unmodified lines
303313 else
304314 resultfn("openat2 with %s fails with %d (%s)\n",
305315 test->name, test->err, strerror(-test->err));
306−
316+next:
307317 free(fdpath);
308318 fflush(stdout);
309319 }
tools/testing/selftests/rtc/settings+1−1
@@ -1 +1 @@
1−timeout=90
1+timeout=180
tools/testing/selftests/vDSO/vdso_test_abi.c+62−73
@@ -33,110 +33,114 @@ typedef long (*vdso_clock_gettime_t)(clockid_t clk_id, struct timespec *ts); · 32 unmodified lines
3333 typedef long (*vdso_clock_getres_t)(clockid_t clk_id, struct timespec *ts);
3434 typedef time_t (*vdso_time_t)(time_t *t);
3535
36−static int vdso_test_gettimeofday(void)
36+#define VDSO_TEST_PASS_MSG() "\n%s(): PASS\n", __func__
37+#define VDSO_TEST_FAIL_MSG(x) "\n%s(): %s FAIL\n", __func__, x
38+#define VDSO_TEST_SKIP_MSG(x) "\n%s(): SKIP: Could not find %s\n", __func__, x
39+
40+static void vdso_test_gettimeofday(void)
3741 {
3842 /* Find gettimeofday. */
3943 vdso_gettimeofday_t vdso_gettimeofday =
4044 (vdso_gettimeofday_t)vdso_sym(version, name[0]);
4145
4246 if (!vdso_gettimeofday) {
43− printf("Could not find %s\n", name[0]);
44− return KSFT_SKIP;
47+ ksft_test_result_skip(VDSO_TEST_SKIP_MSG(name[0]));
48+ return;
4549 }
4650
4751 struct timeval tv;
4852 long ret = vdso_gettimeofday(&tv, 0);
4953
5054 if (ret == 0) {
51− printf("The time is %lld.%06lld\n",
52− (long long)tv.tv_sec, (long long)tv.tv_usec);
55+ ksft_print_msg("The time is %lld.%06lld\n",
56+ (long long)tv.tv_sec, (long long)tv.tv_usec);
57+ ksft_test_result_pass(VDSO_TEST_PASS_MSG());
5358 } else {
54− printf("%s failed\n", name[0]);
55− return KSFT_FAIL;
59+ ksft_test_result_fail(VDSO_TEST_FAIL_MSG(name[0]));
5660 }
57−
58− return KSFT_PASS;
5961 }
6062
61−static int vdso_test_clock_gettime(clockid_t clk_id)
63+static void vdso_test_clock_gettime(clockid_t clk_id)
6264 {
6365 /* Find clock_gettime. */
6466 vdso_clock_gettime_t vdso_clock_gettime =
6567 (vdso_clock_gettime_t)vdso_sym(version, name[1]);
6668
6769 if (!vdso_clock_gettime) {
68− printf("Could not find %s\n", name[1]);
69− return KSFT_SKIP;
70+ ksft_test_result_skip(VDSO_TEST_SKIP_MSG(name[1]));
71+ return;
7072 }
7173
7274 struct timespec ts;
7375 long ret = vdso_clock_gettime(clk_id, &ts);
7476
7577 if (ret == 0) {
76− printf("The time is %lld.%06lld\n",
77− (long long)ts.tv_sec, (long long)ts.tv_nsec);
78+ ksft_print_msg("The time is %lld.%06lld\n",
79+ (long long)ts.tv_sec, (long long)ts.tv_nsec);
80+ ksft_test_result_pass(VDSO_TEST_PASS_MSG());
7881 } else {
79− printf("%s failed\n", name[1]);
80− return KSFT_FAIL;
82+ ksft_test_result_fail(VDSO_TEST_FAIL_MSG(name[1]));
8183 }
82−
83− return KSFT_PASS;
8484 }
8585
86−static int vdso_test_time(void)
86+static void vdso_test_time(void)
8787 {
8888 /* Find time. */
8989 vdso_time_t vdso_time =
9090 (vdso_time_t)vdso_sym(version, name[2]);
9191
9292 if (!vdso_time) {
93− printf("Could not find %s\n", name[2]);
94− return KSFT_SKIP;
93+ ksft_test_result_skip(VDSO_TEST_SKIP_MSG(name[2]));
94+ return;
9595 }
9696
9797 long ret = vdso_time(NULL);
9898
9999 if (ret > 0) {
100− printf("The time in hours since January 1, 1970 is %lld\n",
100+ ksft_print_msg("The time in hours since January 1, 1970 is %lld\n",
101101 (long long)(ret / 3600));
102+ ksft_test_result_pass(VDSO_TEST_PASS_MSG());
102103 } else {
103− printf("%s failed\n", name[2]);
104− return KSFT_FAIL;
104+ ksft_test_result_fail(VDSO_TEST_FAIL_MSG(name[2]));
105105 }
106−
107− return KSFT_PASS;
108106 }
109107
110−static int vdso_test_clock_getres(clockid_t clk_id)
108+static void vdso_test_clock_getres(clockid_t clk_id)
111109 {
110+ int clock_getres_fail = 0;
111+
112112 /* Find clock_getres. */
113113 vdso_clock_getres_t vdso_clock_getres =
114114 (vdso_clock_getres_t)vdso_sym(version, name[3]);
115115
116116 if (!vdso_clock_getres) {
117− printf("Could not find %s\n", name[3]);
118− return KSFT_SKIP;
117+ ksft_test_result_skip(VDSO_TEST_SKIP_MSG(name[3]));
118+ return;
119119 }
120120
121121 struct timespec ts, sys_ts;
122122 long ret = vdso_clock_getres(clk_id, &ts);
123123
124124 if (ret == 0) {
125− printf("The resolution is %lld %lld\n",
126− (long long)ts.tv_sec, (long long)ts.tv_nsec);
125+ ksft_print_msg("The vdso resolution is %lld %lld\n",
126+ (long long)ts.tv_sec, (long long)ts.tv_nsec);
127127 } else {
128− printf("%s failed\n", name[3]);
129− return KSFT_FAIL;
128+ clock_getres_fail++;
130129 }
131130
132131 ret = syscall(SYS_clock_getres, clk_id, &sys_ts);
133132
134− if ((sys_ts.tv_sec != ts.tv_sec) || (sys_ts.tv_nsec != ts.tv_nsec)) {
135− printf("%s failed\n", name[3]);
136− return KSFT_FAIL;
137− }
133+ ksft_print_msg("The syscall resolution is %lld %lld\n",
134+ (long long)sys_ts.tv_sec, (long long)sys_ts.tv_nsec);
138135
139− return KSFT_PASS;
136+ if ((sys_ts.tv_sec != ts.tv_sec) || (sys_ts.tv_nsec != ts.tv_nsec))
137+ clock_getres_fail++;
138+
139+ if (clock_getres_fail > 0) {
140+ ksft_test_result_fail(VDSO_TEST_FAIL_MSG(name[3]));
141+ } else {
142+ ksft_test_result_pass(VDSO_TEST_PASS_MSG());
143+ }
140144 }
141145
142146 const char *vdso_clock_name[12] = {
@@ -158,36 +162,23 @@ const char *vdso_clock_name[12] = { · 15 unmodified lines
158162 * This function calls vdso_test_clock_gettime and vdso_test_clock_getres
159163 * with different values for clock_id.
160164 */
161−static inline int vdso_test_clock(clockid_t clock_id)
165+static inline void vdso_test_clock(clockid_t clock_id)
162166 {
163− int ret0, ret1;
164−
165− ret0 = vdso_test_clock_gettime(clock_id);
166− /* A skipped test is considered passed */
167− if (ret0 == KSFT_SKIP)
168− ret0 = KSFT_PASS;
169−
170− ret1 = vdso_test_clock_getres(clock_id);
171− /* A skipped test is considered passed */
172− if (ret1 == KSFT_SKIP)
173− ret1 = KSFT_PASS;
167+ ksft_print_msg("\nclock_id: %s\n", vdso_clock_name[clock_id]);
174168
175− ret0 += ret1;
169+ vdso_test_clock_gettime(clock_id);
176170
177− printf("clock_id: %s", vdso_clock_name[clock_id]);
178−
179− if (ret0 > 0)
180− printf(" [FAIL]\n");
181− else
182− printf(" [PASS]\n");
183−
184− return ret0;
171+ vdso_test_clock_getres(clock_id);
185172 }
186173
174+#define VDSO_TEST_PLAN 16
175+
187176 int main(int argc, char **argv)
188177 {
189178 unsigned long sysinfo_ehdr = getauxval(AT_SYSINFO_EHDR);
190− int ret;
179+
180+ ksft_print_header();
181+ ksft_set_plan(VDSO_TEST_PLAN);
191182
192183 if (!sysinfo_ehdr) {
193184 printf("AT_SYSINFO_EHDR is not present!\n");
@@ -201,44 +192,42 @@ int main(int argc, char **argv) · 7 unmodified lines
201192
202193 vdso_init_from_sysinfo_ehdr(getauxval(AT_SYSINFO_EHDR));
203194
204− ret = vdso_test_gettimeofday();
195+ vdso_test_gettimeofday();
205196
206197 #if _POSIX_TIMERS > 0
207198
208199 #ifdef CLOCK_REALTIME
209− ret += vdso_test_clock(CLOCK_REALTIME);
200+ vdso_test_clock(CLOCK_REALTIME);
210201 #endif
211202
212203 #ifdef CLOCK_BOOTTIME
213− ret += vdso_test_clock(CLOCK_BOOTTIME);
204+ vdso_test_clock(CLOCK_BOOTTIME);
214205 #endif
215206
216207 #ifdef CLOCK_TAI
217− ret += vdso_test_clock(CLOCK_TAI);
208+ vdso_test_clock(CLOCK_TAI);
218209 #endif
219210
220211 #ifdef CLOCK_REALTIME_COARSE
221− ret += vdso_test_clock(CLOCK_REALTIME_COARSE);
212+ vdso_test_clock(CLOCK_REALTIME_COARSE);
222213 #endif
223214
224215 #ifdef CLOCK_MONOTONIC
225− ret += vdso_test_clock(CLOCK_MONOTONIC);
216+ vdso_test_clock(CLOCK_MONOTONIC);
226217 #endif
227218
228219 #ifdef CLOCK_MONOTONIC_RAW
229− ret += vdso_test_clock(CLOCK_MONOTONIC_RAW);
220+ vdso_test_clock(CLOCK_MONOTONIC_RAW);
230221 #endif
231222
232223 #ifdef CLOCK_MONOTONIC_COARSE
233− ret += vdso_test_clock(CLOCK_MONOTONIC_COARSE);
224+ vdso_test_clock(CLOCK_MONOTONIC_COARSE);
234225 #endif
235226
236227 #endif
237228
238− ret += vdso_test_time();
239−
240− if (ret > 0)
241− return KSFT_FAIL;
229+ vdso_test_time();
242230
243− return KSFT_PASS;
231+ ksft_print_cnts();
232+ return ksft_get_fail_cnt() == 0 ? KSFT_PASS : KSFT_FAIL;
244233 }
tools/testing/selftests/zram/zram.sh+1−14
@@ -2,9 +2,6 @@ · 1 unmodified line
22 # SPDX-License-Identifier: GPL-2.0
33 TCID="zram.sh"
44
5−# Kselftest framework requirement - SKIP code is 4.
6−ksft_skip=4
7−
85 . ./zram_lib.sh
96
107 run_zram () {
@@ -18,14 +15,4 @@ echo "" · 7 unmodified lines
1815
1916 check_prereqs
2017
21−# check zram module exists
22−MODULE_PATH=/lib/modules/`uname -r`/kernel/drivers/block/zram/zram.ko
23−if [ -f $MODULE_PATH ]; then
24− run_zram
25−elif [ -b /dev/zram0 ]; then
26− run_zram
27−else
28− echo "$TCID : No zram.ko module or /dev/zram0 device file not found"
29− echo "$TCID : CONFIG_ZRAM is not set"
30− exit $ksft_skip
31−fi
18+run_zram
tools/testing/selftests/zram/zram01.sh+9−24
@@ -33,9 +33,7 @@ zram_algs="lzo" · 32 unmodified lines
3333
3434 zram_fill_fs()
3535 {
36− local mem_free0=$(free -m | awk 'NR==2 {print $4}')
37−
38− for i in $(seq 0 $(($dev_num - 1))); do
36+ for i in $(seq $dev_start $dev_end); do
3937 echo "fill zram$i..."
4038 local b=0
4139 while [ true ]; do
@@ -45,29 +43,17 @@ zram_fill_fs() · 3 unmodified lines
4543 b=$(($b + 1))
4644 done
4745 echo "zram$i can be filled with '$b' KB"
48− done
4946
50− local mem_free1=$(free -m | awk 'NR==2 {print $4}')
51− local used_mem=$(($mem_free0 - $mem_free1))
47+ local mem_used_total=`awk '{print $3}' "/sys/block/zram$i/mm_stat"`
48+ local v=$((100 * 1024 * $b / $mem_used_total))
49+ if [ "$v" -lt 100 ]; then
50+ echo "FAIL compression ratio: 0.$v:1"
51+ ERR_CODE=-1
52+ return
53+ fi
5254
53− local total_size=0
54− for sm in $zram_sizes; do
55− local s=$(echo $sm | sed 's/M//')
56− total_size=$(($total_size + $s))
55+ echo "zram compression ratio: $(echo "scale=2; $v / 100 " | bc):1: OK"
5756 done
58−
59− echo "zram used ${used_mem}M, zram disk sizes ${total_size}M"
60−
61− local v=$((100 * $total_size / $used_mem))
62−
63− if [ "$v" -lt 100 ]; then
64− echo "FAIL compression ratio: 0.$v:1"
65− ERR_CODE=-1
66− zram_cleanup
67− return
68− fi
69−
70− echo "zram compression ratio: $(echo "scale=2; $v / 100 " | bc):1: OK"
7157 }
7258
7359 check_prereqs
@@ -81,7 +67,6 @@ zram_mount · 7 unmodified lines
8167
8268 zram_fill_fs
8369 zram_cleanup
84−zram_unload
8570
8671 if [ $ERR_CODE -ne 0 ]; then
8772 echo "$TCID : [FAIL]"
tools/testing/selftests/zram/zram02.sh+0−1
@@ -36,7 +36,6 @@ zram_set_memlimit · 35 unmodified lines
3636 zram_makeswap
3737 zram_swapoff
3838 zram_cleanup
39−zram_unload
4039
4140 if [ $ERR_CODE -ne 0 ]; then
4241 echo "$TCID : [FAIL]"
tools/testing/selftests/zram/zram_lib.sh+88−46
@@ -5,12 +5,17 @@ · 4 unmodified lines
55 # Author: Alexey Kodanev <alexey.kodanev@oracle.com>
66 # Modified: Naresh Kamboju <naresh.kamboju@linaro.org>
77
8−MODULE=0
98 dev_makeswap=-1
109 dev_mounted=-1
11−
10+dev_start=0
11+dev_end=-1
12+module_load=-1
13+sys_control=-1
1214 # Kselftest framework requirement - SKIP code is 4.
1315 ksft_skip=4
16+kernel_version=`uname -r | cut -d'.' -f1,2`
17+kernel_major=${kernel_version%.*}
18+kernel_minor=${kernel_version#*.}
1419
1520 trap INT
1621
@@ -25,68 +30,104 @@ check_prereqs() · 8 unmodified lines
2530 fi
2631 }
2732
33+kernel_gte()
34+{
35+ major=${1%.*}
36+ minor=${1#*.}
37+
38+ if [ $kernel_major -gt $major ]; then
39+ return 0
40+ elif [[ $kernel_major -eq $major && $kernel_minor -ge $minor ]]; then
41+ return 0
42+ fi
43+
44+ return 1
45+}
46+
2847 zram_cleanup()
2948 {
3049 echo "zram cleanup"
3150 local i=
32− for i in $(seq 0 $dev_makeswap); do
51+ for i in $(seq $dev_start $dev_makeswap); do
3352 swapoff /dev/zram$i
3453 done
3554
36− for i in $(seq 0 $dev_mounted); do
55+ for i in $(seq $dev_start $dev_mounted); do
3756 umount /dev/zram$i
3857 done
3958
40− for i in $(seq 0 $(($dev_num - 1))); do
59+ for i in $(seq $dev_start $dev_end); do
4160 echo 1 > /sys/block/zram${i}/reset
4261 rm -rf zram$i
4362 done
4463
45−}
64+ if [ $sys_control -eq 1 ]; then
65+ for i in $(seq $dev_start $dev_end); do
66+ echo $i > /sys/class/zram-control/hot_remove
67+ done
68+ fi
4669
47−zram_unload()
48−{
49− if [ $MODULE -ne 0 ] ; then
50− echo "zram rmmod zram"
70+ if [ $module_load -eq 1 ]; then
5171 rmmod zram > /dev/null 2>&1
5272 fi
5373 }
5474
5575 zram_load()
5676 {
57− # check zram module exists
58− MODULE_PATH=/lib/modules/`uname -r`/kernel/drivers/block/zram/zram.ko
59− if [ -f $MODULE_PATH ]; then
60− MODULE=1
61− echo "create '$dev_num' zram device(s)"
62− modprobe zram num_devices=$dev_num
63− if [ $? -ne 0 ]; then
64− echo "failed to insert zram module"
65− exit 1
66− fi
67−
68− dev_num_created=$(ls /dev/zram* | wc -w)
77+ echo "create '$dev_num' zram device(s)"
78+
79+ # zram module loaded, new kernel
80+ if [ -d "/sys/class/zram-control" ]; then
81+ echo "zram modules already loaded, kernel supports" \
82+ "zram-control interface"
83+ dev_start=$(ls /dev/zram* | wc -w)
84+ dev_end=$(($dev_start + $dev_num - 1))
85+ sys_control=1
86+
87+ for i in $(seq $dev_start $dev_end); do
88+ cat /sys/class/zram-control/hot_add > /dev/null
89+ done
90+
91+ echo "all zram devices (/dev/zram$dev_start~$dev_end" \
92+ "successfully created"
93+ return 0
94+ fi
6995
70− if [ "$dev_num_created" -ne "$dev_num" ]; then
71− echo "unexpected num of devices: $dev_num_created"
72− ERR_CODE=-1
96+ # detect old kernel or built-in
97+ modprobe zram num_devices=$dev_num
98+ if [ ! -d "/sys/class/zram-control" ]; then
99+ if grep -q '^zram' /proc/modules; then
100+ rmmod zram > /dev/null 2>&1
101+ if [ $? -ne 0 ]; then
102+ echo "zram module is being used on old kernel" \
103+ "without zram-control interface"
104+ exit $ksft_skip
105+ fi
73106 else
74− echo "zram load module successful"
107+ echo "test needs CONFIG_ZRAM=m on old kernel without" \
108+ "zram-control interface"
109+ exit $ksft_skip
75110 fi
76− elif [ -b /dev/zram0 ]; then
77− echo "/dev/zram0 device file found: OK"
78− else
79− echo "ERROR: No zram.ko module or no /dev/zram0 device found"
80− echo "$TCID : CONFIG_ZRAM is not set"
81− exit 1
111+ modprobe zram num_devices=$dev_num
82112 fi
113+
114+ module_load=1
115+ dev_end=$(($dev_num - 1))
116+ echo "all zram devices (/dev/zram0~$dev_end) successfully created"
83117 }
84118
85119 zram_max_streams()
86120 {
87121 echo "set max_comp_streams to zram device(s)"
88122
89− local i=0
123+ kernel_gte 4.7
124+ if [ $? -eq 0 ]; then
125+ echo "The device attribute max_comp_streams was"\
126+ "deprecated in 4.7"
127+ return 0
128+ fi
129+
130+ local i=$dev_start
90131 for max_s in $zram_max_streams; do
91132 local sys_path="/sys/block/zram${i}/max_comp_streams"
92133 echo $max_s > $sys_path || \
@@ -98,7 +139,7 @@ zram_max_streams() · 5 unmodified lines
98139 echo "FAIL can't set max_streams '$max_s', get $max_stream"
99140
100141 i=$(($i + 1))
101− echo "$sys_path = '$max_streams' ($i/$dev_num)"
142+ echo "$sys_path = '$max_streams'"
102143 done
103144
104145 echo "zram max streams: OK"
@@ -108,15 +149,16 @@ zram_compress_alg() · 3 unmodified lines
108149 {
109150 echo "test that we can set compression algorithm"
110151
111− local algs=$(cat /sys/block/zram0/comp_algorithm)
152+ local i=$dev_start
153+ local algs=$(cat /sys/block/zram${i}/comp_algorithm)
112154 echo "supported algs: $algs"
113− local i=0
155+
114156 for alg in $zram_algs; do
115157 local sys_path="/sys/block/zram${i}/comp_algorithm"
116158 echo "$alg" > $sys_path || \
117159 echo "FAIL can't set '$alg' to $sys_path"
118160 i=$(($i + 1))
119− echo "$sys_path = '$alg' ($i/$dev_num)"
161+ echo "$sys_path = '$alg'"
120162 done
121163
122164 echo "zram set compression algorithm: OK"
@@ -125,14 +167,14 @@ zram_compress_alg() · 2 unmodified lines
125167 zram_set_disksizes()
126168 {
127169 echo "set disk size to zram device(s)"
128− local i=0
170+ local i=$dev_start
129171 for ds in $zram_sizes; do
130172 local sys_path="/sys/block/zram${i}/disksize"
131173 echo "$ds" > $sys_path || \
132174 echo "FAIL can't set '$ds' to $sys_path"
133175
134176 i=$(($i + 1))
135− echo "$sys_path = '$ds' ($i/$dev_num)"
177+ echo "$sys_path = '$ds'"
136178 done
137179
138180 echo "zram set disksizes: OK"
@@ -142,14 +184,14 @@ zram_set_memlimit() · 3 unmodified lines
142184 {
143185 echo "set memory limit to zram device(s)"
144186
145− local i=0
187+ local i=$dev_start
146188 for ds in $zram_mem_limits; do
147189 local sys_path="/sys/block/zram${i}/mem_limit"
148190 echo "$ds" > $sys_path || \
149191 echo "FAIL can't set '$ds' to $sys_path"
150192
151193 i=$(($i + 1))
152− echo "$sys_path = '$ds' ($i/$dev_num)"
194+ echo "$sys_path = '$ds'"
153195 done
154196
155197 echo "zram set memory limit: OK"
@@ -158,8 +200,8 @@ zram_set_memlimit() · 2 unmodified lines
158200 zram_makeswap()
159201 {
160202 echo "make swap with zram device(s)"
161− local i=0
162− for i in $(seq 0 $(($dev_num - 1))); do
203+ local i=$dev_start
204+ for i in $(seq $dev_start $dev_end); do
163205 mkswap /dev/zram$i > err.log 2>&1
164206 if [ $? -ne 0 ]; then
165207 cat err.log
@@ -182,7 +224,7 @@ zram_makeswap() · 16 unmodified lines
182224 zram_swapoff()
183225 {
184226 local i=
185− for i in $(seq 0 $dev_makeswap); do
227+ for i in $(seq $dev_start $dev_end); do
186228 swapoff /dev/zram$i > err.log 2>&1
187229 if [ $? -ne 0 ]; then
188230 cat err.log
@@ -196,7 +238,7 @@ zram_swapoff() · 7 unmodified lines
196238
197239 zram_makefs()
198240 {
199− local i=0
241+ local i=$dev_start
200242 for fs in $zram_filesystems; do
201243 # if requested fs not supported default it to ext2
202244 which mkfs.$fs > /dev/null 2>&1 || fs=ext2
@@ -215,7 +257,7 @@ zram_makefs() · 12 unmodified lines
215257 zram_mount()
216258 {
217259 local i=0
218− for i in $(seq 0 $(($dev_num - 1))); do
260+ for i in $(seq $dev_start $dev_end); do
219261 echo "mount /dev/zram$i"
220262 mkdir zram$i
221263 mount /dev/zram$i zram$i > /dev/null || \
tools/tracing/Makefile+14−4
@@ -1,11 +1,11 @@
11 # SPDX-License-Identifier: GPL-2.0
22 include ../scripts/Makefile.include
33
4−all: latency
4+all: latency rtla
55
6−clean: latency_clean
6+clean: latency_clean rtla_clean
77
8−install: latency_install
8+install: latency_install rtla_install
99
1010 latency:
1111 $(call descend,latency)
@@ -16,4 +16,14 @@ latency_install: · 4 unmodified lines
1616 latency_clean:
1717 $(call descend,latency,clean)
1818
19−.PHONY: all install clean latency latency_install latency_clean
19+rtla:
20+ $(call descend,rtla)
21+
22+rtla_install:
23+ $(call descend,rtla,install)
24+
25+rtla_clean:
26+ $(call descend,rtla,clean)
27+
28+.PHONY: all install clean latency latency_install latency_clean \
29+ rtla rtla_install rtla_clean
tools/tracing/rtla/Makefile+1−1
@@ -59,7 +59,7 @@ endif · 58 unmodified lines
5959 .PHONY: all
6060 all: rtla
6161
62−rtla: $(OBJ) doc
62+rtla: $(OBJ)
6363 $(CC) -o rtla $(LDFLAGS) $(OBJ) $(LIBS)
6464
6565 static: $(OBJ)
usr/include/Makefile+1−0
@@ -28,6 +28,7 @@ no-header-test += linux/am437x-vpfe.h · 27 unmodified lines
2828 no-header-test += linux/android/binder.h
2929 no-header-test += linux/android/binderfs.h
3030 no-header-test += linux/coda.h
31+no-header-test += linux/cyclades.h
3132 no-header-test += linux/errqueue.h
3233 no-header-test += linux/fsmap.h
3334 no-header-test += linux/hdlc/ioctl.h
virt/kvm/eventfd.c+4−4
@@ -463,8 +463,8 @@ bool kvm_irq_has_notifier(struct kvm *kvm, unsigned irqchip, unsigned pin) · 462 unmodified lines
463463 idx = srcu_read_lock(&kvm->irq_srcu);
464464 gsi = kvm_irq_map_chip_pin(kvm, irqchip, pin);
465465 if (gsi != -1)
466− hlist_for_each_entry_rcu(kian, &kvm->irq_ack_notifier_list,
467− link)
466+ hlist_for_each_entry_srcu(kian, &kvm->irq_ack_notifier_list,
467+ link, srcu_read_lock_held(&kvm->irq_srcu))
468468 if (kian->gsi == gsi) {
469469 srcu_read_unlock(&kvm->irq_srcu, idx);
470470 return true;
@@ -480,8 +480,8 @@ void kvm_notify_acked_gsi(struct kvm *kvm, int gsi) · 9 unmodified lines
480480 {
481481 struct kvm_irq_ack_notifier *kian;
482482
483− hlist_for_each_entry_rcu(kian, &kvm->irq_ack_notifier_list,
484− link)
483+ hlist_for_each_entry_srcu(kian, &kvm->irq_ack_notifier_list,
484+ link, srcu_read_lock_held(&kvm->irq_srcu))
485485 if (kian->gsi == gsi)
486486 kian->irq_acked(kian);
487487 }
virt/kvm/kvm_main.c+3−5
@@ -2248,7 +2248,6 @@ struct kvm_memory_slot *kvm_vcpu_gfn_to_memslot(struct kvm_vcpu *vcpu, gfn_t gfn · 2247 unmodified lines
22482248
22492249 return NULL;
22502250 }
2251−EXPORT_SYMBOL_GPL(kvm_vcpu_gfn_to_memslot);
22522251
22532252 bool kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn)
22542253 {
@@ -2463,9 +2462,8 @@ static int kvm_try_get_pfn(kvm_pfn_t pfn) · 208 unmodified lines
24632462 }
24642463
24652464 static int hva_to_pfn_remapped(struct vm_area_struct *vma,
2466− unsigned long addr, bool *async,
2467− bool write_fault, bool *writable,
2468− kvm_pfn_t *p_pfn)
2465+ unsigned long addr, bool write_fault,
2466+ bool *writable, kvm_pfn_t *p_pfn)
24692467 {
24702468 kvm_pfn_t pfn;
24712469 pte_t *ptep;
@@ -2575,7 +2573,7 @@ retry: · 103 unmodified lines
25752573 if (vma == NULL)
25762574 pfn = KVM_PFN_ERR_FAULT;
25772575 else if (vma->vm_flags & (VM_IO | VM_PFNMAP)) {
2578− r = hva_to_pfn_remapped(vma, addr, async, write_fault, writable, &pfn);
2576+ r = hva_to_pfn_remapped(vma, addr, write_fault, writable, &pfn);
25792577 if (r == -EAGAIN)
25802578 goto retry;
25812579 if (r < 0)