History

Merge branch 'errata/tx2-219' into for-next/fixes

Workaround for Cavium/Marvell ThunderX2 erratum #219. * errata/tx2-219: arm64: Allow CAVIUM_TX2_ERRATUM_219 to be selected arm64: Avoid Cavium TX2 erratum 219 when switching TTBR arm64: Enable workaround for Cavium TX2 erratum 219 when running SMT arm64: KVM: Trap VM ops when ARM64_WORKAROUND_CAVIUM_TX2_219_TVM is set

Will Deacon committed 7 years ago

Commit 777d0622 parents 597399d 603afdc298 files · +2755 −1802Browse files

Unified · Split

298 files
  1. Documentation/arm64/silicon-errata.rst +2 −0
  2. Documentation/devicetree/bindings/dsp/fsl,dsp.yaml +1 −0
  3. Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml +3 −4
  4. Documentation/devicetree/bindings/media/rc.yaml +0 −1
  5. Documentation/devicetree/bindings/phy/lantiq,vrx200-pcie-phy.yaml +1 −1
  6. Documentation/kbuild/makefiles.rst +0 −5
  7. Documentation/kbuild/modules.rst +4 −3
  8. Documentation/kbuild/reproducible-builds.rst +9 −4
  9. Documentation/networking/device_drivers/index.rst +1 −0
  10. Documentation/networking/j1939.rst +1 −1
  11. MAINTAINERS +4 −0
  12. Makefile +4 −24
  13. arch/arm/boot/dts/am335x-icev2.dts +1 −1
  14. arch/arm/boot/dts/am33xx-l4.dtsi +4 −2
  15. arch/arm/boot/dts/am4372.dtsi +2 −0
  16. arch/arm/boot/dts/dra7-l4.dtsi +21 −27
  17. arch/arm/boot/dts/omap3-gta04.dtsi +1 −0
  18. arch/arm/boot/dts/ste-dbx5x0.dtsi +8 −3
  19. arch/arm/configs/davinci_all_defconfig +1 −1
  20. arch/arm/configs/multi_v7_defconfig +2 −2
  21. arch/arm/configs/omap2plus_defconfig +4 −1
  22. arch/arm/include/asm/xen/xen-ops.h +0 −6
  23. arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c +2 −1
  24. arch/arm/mach-omap2/omap_hwmod_33xx_data.c +3 −2
  25. arch/arm/mach-omap2/pm.c +0 −100
  26. arch/arm/xen/Makefile +0 −1
  27. arch/arm/xen/efi.c +0 −28
  28. arch/arm/xen/enlighten.c +1 −2
  29. arch/arm/xen/mm.c +4 −1
  30. arch/arm64/Kconfig +17 −0
  31. arch/arm64/configs/defconfig +1 −1
  32. arch/arm64/include/asm/cpucaps.h +3 −1
  33. arch/arm64/include/asm/kvm_hyp.h +0 −24
  34. arch/arm64/include/asm/xen/xen-ops.h +0 −7
  35. arch/arm64/kernel/cpu_errata.c +38 −0
  36. arch/arm64/kernel/entry.S +2 −0
  37. arch/arm64/kvm/hyp/switch.c +69 −17
  38. arch/arm64/kvm/hyp/tlb.c +22 −14
  39. arch/arm64/xen/Makefile +0 −1
  40. arch/mips/boot/dts/qca/ar9331.dtsi +1 −1
  41. arch/mips/fw/arc/memory.c +0 −1
  42. arch/mips/include/asm/octeon/cvmx-ipd.h +1 −0
  43. arch/mips/include/asm/unistd.h +1 −0
  44. arch/mips/kernel/cpu-bugs64.c +8 −6
  45. arch/mips/kernel/setup.c +4 −1
  46. arch/mips/kernel/syscall.c +1 −0
  47. arch/mips/kernel/syscalls/syscall_n32.tbl +1 −1
  48. arch/mips/kernel/syscalls/syscall_n64.tbl +1 −1
  49. arch/mips/kernel/syscalls/syscall_o32.tbl +1 −1
  50. arch/mips/loongson64/common/mem.c +17 −18
  51. arch/mips/loongson64/common/serial.c +1 −1
  52. arch/mips/loongson64/loongson-3/numa.c +1 −10
  53. arch/mips/pmcs-msp71xx/msp_prom.c +2 −2
  54. arch/mips/vdso/Makefile +1 −1
  55. arch/mips/vdso/gettimeofday.c +0 −269
  56. arch/powerpc/boot/Makefile +1 −1
  57. arch/powerpc/kvm/book3s.c +4 −4
  58. arch/riscv/include/asm/asm.h +1 −0
  59. arch/riscv/kernel/entry.S +20 −1
  60. arch/riscv/mm/init.c +11 −1
  61. arch/s390/configs/debug_defconfig +16 −8
  62. arch/s390/configs/defconfig +16 −9
  63. arch/s390/configs/zfcpdump_defconfig +1 −1
  64. arch/s390/include/asm/atomic_ops.h +1 −1
  65. arch/s390/include/asm/bitops.h +4 −4
  66. arch/s390/include/asm/cpacf.h +1 −1
  67. arch/s390/include/asm/cpu_mf.h +6 −2
  68. arch/s390/include/asm/hugetlb.h +7 −2
  69. arch/s390/include/asm/jump_label.h +2 −2
  70. arch/s390/include/asm/pgtable.h +13 −12
  71. arch/s390/include/asm/qdio.h +1 −1
  72. arch/s390/kernel/perf_cpum_cf_diag.c +2 −2
  73. arch/s390/kernel/perf_cpum_sf.c +7 −1
  74. arch/s390/kvm/kvm-s390.c +3 −3
  75. arch/s390/pci/pci_clp.c +1 −1
  76. arch/x86/include/asm/kvm_host.h +0 −7
  77. arch/x86/kvm/cpuid.c +60 −42
  78. arch/x86/kvm/lapic.c +7 −6
  79. arch/x86/kvm/mmu.c +49 −16
  80. arch/x86/kvm/vmx/nested.c +1 −1
  81. arch/x86/kvm/vmx/pmu_intel.c +5 −2
  82. arch/x86/kvm/vmx/vmx.c +9 −6
  83. arch/x86/kvm/x86.c +36 −36
  84. arch/x86/xen/efi.c +1 −13
  85. block/blk-mq.c +9 −3
  86. block/sed-opal.c +3 −3
  87. drivers/block/loop.c +10 −0
  88. drivers/char/random.c +1 −1
  89. drivers/clk/ti/clk-7xx.c +3 −3
  90. drivers/clocksource/timer-of.c +3 −1
  91. drivers/gpu/drm/amd/amdgpu/Makefile +1 −1
  92. drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c +22 −12
  93. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 −1
  94. drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +1 −0
  95. drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 −0
  96. drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 −2
  97. drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +12 −0
  98. drivers/gpu/drm/amd/amdgpu/nv.c +4 −2
  99. drivers/gpu/drm/amd/amdgpu/soc15.c +4 −4
  100. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 −2
  101. drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c +1 −0
  102. drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +1 −0
  103. drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +1 −0
  104. drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +1 −0
  105. drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c +1 −0
  106. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +1 −0
  107. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +1 −0
  108. drivers/gpu/drm/amd/display/dc/dcn21/Makefile +11 −1
  109. drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c +5 −8
  110. drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +2 −0
  111. drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +2 −0
  112. drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 −0
  113. drivers/gpu/drm/amd/powerplay/navi10_ppt.c +3 −1
  114. drivers/gpu/drm/amd/powerplay/vega20_ppt.c +2 −0
  115. drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c +4 −3
  116. drivers/gpu/drm/arm/malidp_mw.c +2 −2
  117. drivers/gpu/drm/drm_atomic.c +9 −4
  118. drivers/gpu/drm/drm_writeback.c +15 −8
  119. drivers/gpu/drm/i915/display/intel_display.c +8 −4
  120. drivers/gpu/drm/i915/display/intel_display.h +1 −1
  121. drivers/gpu/drm/i915/display/intel_dp.c +95 −89
  122. drivers/gpu/drm/i915/display/intel_dp.h +2 −4
  123. drivers/gpu/drm/i915/display/intel_dp_mst.c +2 −2
  124. drivers/gpu/drm/i915/display/intel_sprite.c +3 −2
  125. drivers/gpu/drm/omapdrm/dss/dss.c +1 −1
  126. drivers/gpu/drm/rcar-du/rcar_du_writeback.c +2 −2
  127. drivers/gpu/drm/tilcdc/tilcdc_tfp410.c +1 −0
  128. drivers/gpu/drm/vc4/vc4_txp.c +2 −3
  129. drivers/net/dsa/qca8k.c +2 −2
  130. drivers/net/dsa/rtl8366.c +7 −4
  131. drivers/net/dsa/rtl8366rb.c +10 −6
  132. drivers/net/dsa/sja1105/sja1105_main.c +14 −10
  133. drivers/net/dsa/sja1105/sja1105_spi.c +4 −2
  134. drivers/net/ethernet/atheros/ag71xx.c +4 −2
  135. drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c +6 −3
  136. drivers/net/ethernet/hisilicon/hns_mdio.c +5 −1
  137. drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c +2 −1
  138. drivers/net/ethernet/mscc/ocelot_board.c +8 −6
  139. drivers/net/ethernet/pensando/Kconfig +1 −0
  140. drivers/net/ethernet/qlogic/qla3xxx.c +1 −0
  141. drivers/net/ethernet/socionext/netsec.c +7 −23
  142. drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +7 −6
  143. drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +2 −1
  144. drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +5 −4
  145. drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +1 −0
  146. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +17 −8
  147. drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +0 −4
  148. drivers/net/ieee802154/atusb.c +2 −1
  149. drivers/net/ieee802154/ca8210.c +1 −1
  150. drivers/net/ieee802154/mcr20a.c +1 −1
  151. drivers/net/phy/at803x.c +69 −0
  152. drivers/net/phy/mdio_device.c +1 −1
  153. drivers/net/phy/phy-core.c +13 −7
  154. drivers/net/phy/phy.c +5 −0
  155. drivers/net/phy/phy_device.c +40 −25
  156. drivers/net/ppp/pptp.c +2 −2
  157. drivers/net/tun.c +1 −1
  158. drivers/net/usb/hso.c +8 −4
  159. drivers/net/usb/qmi_wwan.c +1 −0
  160. drivers/net/usb/r8152.c +1 −2
  161. drivers/net/virtio_net.c +1 −1
  162. drivers/net/vrf.c +4 −4
  163. drivers/net/wireless/mac80211_hwsim.c +2 −2
  164. drivers/net/xen-netfront.c +9 −8
  165. drivers/nvme/host/core.c +113 −19
  166. drivers/nvme/host/nvme.h +1 −1
  167. drivers/nvme/host/pci.c +13 −7
  168. drivers/nvme/host/rdma.c +13 −6
  169. drivers/nvme/host/tcp.c +2 −2
  170. drivers/nvme/target/io-cmd-bdev.c +8 −8
  171. drivers/nvme/target/tcp.c +4 −8
  172. drivers/ptp/ptp_qoriq.c +2 −1
  173. drivers/s390/block/dasd_eckd.c +11 −70
  174. drivers/s390/cio/qdio_setup.c +1 −1
  175. drivers/s390/net/qeth_core_main.c +1 −2
  176. drivers/scsi/bnx2fc/bnx2fc_io.c +24 −5
  177. drivers/scsi/hisi_sas/hisi_sas_main.c +3 −3
  178. drivers/scsi/megaraid.c +2 −2
  179. drivers/scsi/qedf/qedf_main.c +1 −1
  180. drivers/scsi/qla2xxx/qla_attr.c +2 −0
  181. drivers/scsi/qla2xxx/qla_def.h +3 −1
  182. drivers/scsi/qla2xxx/qla_gs.c +2 −1
  183. drivers/scsi/qla2xxx/qla_init.c +78 −31
  184. drivers/scsi/qla2xxx/qla_iocb.c +4 −3
  185. drivers/scsi/qla2xxx/qla_mbx.c +22 −3
  186. drivers/scsi/qla2xxx/qla_mid.c +22 −10
  187. drivers/scsi/qla2xxx/qla_os.c +13 −5
  188. drivers/scsi/qla2xxx/qla_target.c +13 −13
  189. drivers/scsi/storvsc_drv.c +1 −2
  190. drivers/scsi/ufs/ufshcd.c +3 −0
  191. drivers/staging/octeon/ethernet-tx.c +2 −4
  192. drivers/video/logo/Makefile +2 −19
  193. drivers/xen/balloon.c +7 −17
  194. drivers/xen/efi.c +47 −37
  195. drivers/xen/xenbus/xenbus_dev_frontend.c +18 −2
  196. fs/binfmt_elf.c +3 −10
  197. fs/erofs/data.c +7 −3
  198. fs/erofs/super.c +2 −2
  199. fs/erofs/zdata.c +10 −2
  200. fs/io_uring.c +4 −4
  201. fs/readdir.c +133 −35
  202. fs/statfs.c +4 −13
  203. include/linux/bitops.h +7 −0
  204. include/linux/dsa/sja1105.h +3 −1
  205. include/linux/kvm_host.h +2 −0
  206. include/linux/mii.h +9 −0
  207. include/linux/phy.h +2 −0
  208. include/linux/skbuff.h +1 −4
  209. include/linux/uaccess.h +70 −0
  210. include/trace/events/rxrpc.h +1 −1
  211. include/uapi/drm/amdgpu_drm.h +2 −0
  212. include/uapi/linux/nvme_ioctl.h +23 −0
  213. include/uapi/linux/pg.h +4 −1
  214. include/uapi/linux/sched.h +28 −2
  215. include/xen/xen-ops.h +1 −24
  216. kernel/dma/remap.c +2 −2
  217. kernel/events/core.c +9 −38
  218. kernel/fork.c +18 −27
  219. kernel/gen_kheaders.sh +4 −1
  220. kernel/sched/core.c +7 −36
  221. kernel/sched/membarrier.c +0 −1
  222. kernel/time/tick-broadcast-hrtimer.c +29 −33
  223. lib/strnlen_user.c +1 −7
  224. lib/test_user_copy.c +130 −6
  225. lib/textsearch.c +2 −2
  226. lib/usercopy.c +55 −0
  227. net/batman-adv/soft-interface.c +1 −1
  228. net/core/devlink.c +3 −3
  229. net/core/skbuff.c +1 −1
  230. net/core/sock.c +9 −4
  231. net/dccp/ipv4.c +1 −1
  232. net/dsa/tag_sja1105.c +11 −1
  233. net/ipv4/ip_gre.c +1 −0
  234. net/ipv4/ip_input.c +1 −1
  235. net/ipv4/ipmr.c +2 −2
  236. net/ipv4/netfilter/nf_dup_ipv4.c +1 −1
  237. net/ipv4/raw.c +1 −1
  238. net/ipv4/route.c +2 −3
  239. net/ipv4/tcp.c +2 −4
  240. net/ipv4/tcp_ipv4.c +1 −1
  241. net/ipv4/tcp_timer.c +7 −2
  242. net/ipv4/udp.c +9 −6
  243. net/ipv6/addrconf.c +12 −5
  244. net/ipv6/ip6_input.c +11 −1
  245. net/ipv6/netfilter/nf_dup_ipv6.c +1 −1
  246. net/ipv6/raw.c +1 −1
  247. net/ipv6/udp.c +7 −2
  248. net/l2tp/l2tp_core.c +1 −1
  249. net/l2tp/l2tp_eth.c +1 −1
  250. net/l2tp/l2tp_ip.c +1 −1
  251. net/l2tp/l2tp_ip6.c +1 −1
  252. net/mac80211/debugfs_netdev.c +9 −2
  253. net/mac80211/util.c +8 −5
  254. net/netfilter/ipvs/ip_vs_xmit.c +1 −1
  255. net/netfilter/nft_connlimit.c +6 −1
  256. net/nfc/llcp_sock.c +6 −1
  257. net/openvswitch/vport-internal_dev.c +1 −1
  258. net/packet/af_packet.c +2 −2
  259. net/rds/ib.c +3 −3
  260. net/sched/sch_cbq.c +29 −14
  261. net/sched/sch_cbs.c +1 −1
  262. net/sched/sch_dsmark.c +2 −0
  263. net/sched/sch_taprio.c +2 −3
  264. net/sctp/input.c +1 −1
  265. net/tipc/link.c +18 −11
  266. net/tipc/msg.c +1 −4
  267. net/vmw_vsock/af_vsock.c +12 −4
  268. net/vmw_vsock/hyperv_transport.c +1 −1
  269. net/vmw_vsock/virtio_transport_common.c +1 −1
  270. net/wireless/nl80211.c +41 −3
  271. net/wireless/reg.c +1 −1
  272. net/wireless/scan.c +6 −1
  273. net/wireless/wext-compat.c +1 −1
  274. net/xfrm/xfrm_input.c +1 −1
  275. net/xfrm/xfrm_interface.c +1 −1
  276. net/xfrm/xfrm_output.c +1 −1
  277. net/xfrm/xfrm_policy.c +1 −1
  278. scripts/Kbuild.include +0 −5
  279. scripts/Makefile.build +1 −1
  280. scripts/Makefile.lib +1 −1
  281. scripts/mod/modpost.c +9 −4
  282. scripts/namespace.pl +7 −6
  283. scripts/setlocalversion +1 −1
  284. security/integrity/Makefile +0 −3
  285. tools/testing/selftests/kvm/Makefile +2 −1
  286. tools/testing/selftests/kvm/include/x86_64/processor.h +3 −0
  287. tools/testing/selftests/kvm/include/x86_64/vmx.h +14 −0
  288. tools/testing/selftests/kvm/lib/kvm_util.c +1 −1
  289. tools/testing/selftests/kvm/lib/kvm_util_internal.h +3 −0
  290. tools/testing/selftests/kvm/lib/x86_64/processor.c +1 −1
  291. tools/testing/selftests/kvm/lib/x86_64/vmx.c +199 −2
  292. tools/testing/selftests/kvm/x86_64/vmx_dirty_log_test.c +156 −0
  293. tools/testing/selftests/net/.gitignore +1 −0
  294. tools/testing/selftests/net/udpgso.c +4 −12
  295. tools/testing/selftests/pidfd/Makefile +1 −1
  296. usr/include/Makefile +0 −10
  297. virt/kvm/arm/vgic/trace.h +1 −1
  298. virt/kvm/kvm_main.c +7 −3
Documentation/arm64/silicon-errata.rst+2−0
@@ -107,6 +107,8 @@ stable kernels. · 106 unmodified lines
107107 +----------------+-----------------+-----------------+-----------------------------+
108108 | Cavium | ThunderX2 SMMUv3| #126 | N/A |
109109 +----------------+-----------------+-----------------+-----------------------------+
110+| Cavium | ThunderX2 Core | #219 | CAVIUM_TX2_ERRATUM_219 |
111++----------------+-----------------+-----------------+-----------------------------+
110112 +----------------+-----------------+-----------------+-----------------------------+
111113 | Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 |
112114 +----------------+-----------------+-----------------+-----------------------------+
Documentation/devicetree/bindings/dsp/fsl,dsp.yaml+1−0
@@ -85,4 +85,5 @@ examples: · 84 unmodified lines
8585 <&pd IMX_SC_R_DSP_RAM>;
8686 mbox-names = "txdb0", "txdb1", "rxdb0", "rxdb1";
8787 mboxes = <&lsio_mu13 2 0>, <&lsio_mu13 2 1>, <&lsio_mu13 3 0>, <&lsio_mu13 3 1>;
88+ memory-region = <&dsp_reserved>;
8889 };
Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml+3−4
@@ -43,13 +43,9 @@ properties: · 42 unmodified lines
4343
4444 dvdd-supply:
4545 description: DVdd voltage supply
46− items:
47− - const: dvdd
4846
4947 avdd-supply:
5048 description: AVdd voltage supply
51− items:
52− - const: avdd
5349
5450 adi,rejection-60-Hz-enable:
5551 description: |
@@ -99,6 +95,9 @@ required: · 43 unmodified lines
9995 examples:
10096 - |
10197 spi0 {
98+ #address-cells = <1>;
99+ #size-cells = <0>;
100+
102101 adc@0 {
103102 compatible = "adi,ad7192";
104103 reg = <0>;
Documentation/devicetree/bindings/media/rc.yaml+0−1
@@ -73,7 +73,6 @@ properties: · 72 unmodified lines
7373 - rc-genius-tvgo-a11mce
7474 - rc-gotview7135
7575 - rc-hauppauge
76− - rc-hauppauge
7776 - rc-hisi-poplar
7877 - rc-hisi-tv-demo
7978 - rc-imon-mce
Documentation/devicetree/bindings/phy/lantiq,vrx200-pcie-phy.yaml+1−1
@@ -37,7 +37,7 @@ properties: · 36 unmodified lines
3737 - description: exclusive PHY reset line
3838 - description: shared reset line between the PCIe PHY and PCIe controller
3939
40− resets-names:
40+ reset-names:
4141 items:
4242 - const: phy
4343 - const: pcie
Documentation/kbuild/makefiles.rst+0−5
@@ -954,11 +954,6 @@ When kbuild executes, the following steps are followed (roughly): · 953 unmodified lines
954954
955955 From commandline LDFLAGS_MODULE shall be used (see kbuild.txt).
956956
957− KBUILD_ARFLAGS Options for $(AR) when creating archives
958−
959− $(KBUILD_ARFLAGS) set by the top level Makefile to "D" (deterministic
960− mode) if this option is supported by $(AR).
961−
962957 KBUILD_LDS
963958
964959 The linker script with full path. Assigned by the top-level Makefile.
Documentation/kbuild/modules.rst+4−3
@@ -498,10 +498,11 @@ build. · 497 unmodified lines
498498 will be written containing all exported symbols that were not
499499 defined in the kernel.
500500
501−--- 6.3 Symbols From Another External Module
501+6.3 Symbols From Another External Module
502+----------------------------------------
502503
503504 Sometimes, an external module uses exported symbols from
504− another external module. kbuild needs to have full knowledge of
505+ another external module. Kbuild needs to have full knowledge of
505506 all symbols to avoid spitting out warnings about undefined
506507 symbols. Three solutions exist for this situation.
507508
@@ -521,7 +522,7 @@ build. · 13 unmodified lines
521522 The top-level kbuild file would then look like::
522523
523524 #./Kbuild (or ./Makefile):
524− obj-y := foo/ bar/
525+ obj-m := foo/ bar/
525526
526527 And executing::
527528
Documentation/kbuild/reproducible-builds.rst+9−4
@@ -16,16 +16,21 @@ the kernel may be unreproducible, and how to avoid them. · 15 unmodified lines
1616 Timestamps
1717 ----------
1818
19−The kernel embeds a timestamp in two places:
19+The kernel embeds timestamps in three places:
2020
2121 * The version string exposed by ``uname()`` and included in
2222 ``/proc/version``
2323
2424 * File timestamps in the embedded initramfs
2525
26−By default the timestamp is the current time. This must be overridden
27−using the `KBUILD_BUILD_TIMESTAMP`_ variable. If you are building
28−from a git commit, you could use its commit date.
26+* If enabled via ``CONFIG_IKHEADERS``, file timestamps of kernel
27+ headers embedded in the kernel or respective module,
28+ exposed via ``/sys/kernel/kheaders.tar.xz``
29+
30+By default the timestamp is the current time and in the case of
31+``kheaders`` the various files' modification times. This must
32+be overridden using the `KBUILD_BUILD_TIMESTAMP`_ variable.
33+If you are building from a git commit, you could use its commit date.
2934
3035 The kernel does *not* use the ``__DATE__`` and ``__TIME__`` macros,
3136 and enables warnings if they are used. If you incorporate external
Documentation/networking/device_drivers/index.rst+1−0
@@ -23,6 +23,7 @@ Contents: · 22 unmodified lines
2323 intel/ice
2424 google/gve
2525 mellanox/mlx5
26+ netronome/nfp
2627 pensando/ionic
2728
2829 .. only:: subproject and html
Documentation/networking/j1939.rst+1−1
@@ -272,7 +272,7 @@ supported flags are: · 271 unmodified lines
272272 * MSG_DONTWAIT, i.e. non-blocking operation.
273273
274274 recvmsg(2)
275−^^^^^^^^^
275+^^^^^^^^^^
276276
277277 In most cases recvmsg(2) is needed if you want to extract more information than
278278 recvfrom(2) can provide. For example package priority and timestamp. The
MAINTAINERS+4−0
@@ -6112,7 +6112,10 @@ M: Gao Xiang <gaoxiang25@huawei.com> · 6111 unmodified lines
61126112 M: Chao Yu <yuchao0@huawei.com>
61136113 L: linux-erofs@lists.ozlabs.org
61146114 S: Maintained
6115+T: git git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
6116+F: Documentation/filesystems/erofs.txt
61156117 F: fs/erofs/
6118+F: include/trace/events/erofs.h
61166119
61176120 ERRSEQ ERROR TRACKING INFRASTRUCTURE
61186121 M: Jeff Layton <jlayton@kernel.org>
@@ -9075,6 +9078,7 @@ F: security/keys/ · 2956 unmodified lines
90759078 KGDB / KDB /debug_core
90769079 M: Jason Wessel <jason.wessel@windriver.com>
90779080 M: Daniel Thompson <daniel.thompson@linaro.org>
9081+R: Douglas Anderson <dianders@chromium.org>
90789082 W: http://kgdb.wiki.kernel.org/
90799083 L: kgdb-bugreport@lists.sourceforge.net
90809084 T: git git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/kgdb.git
Makefile+4−24
@@ -2,8 +2,8 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 4
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc1
6−NAME = Bobtail Squid
5+EXTRAVERSION = -rc2
6+NAME = Nesting Opossum
77
88 # *DOCUMENTATION*
99 # To see a list of typical targets execute "make help"
@@ -206,24 +206,8 @@ ifndef KBUILD_CHECKSRC · 196 unmodified lines
206206 KBUILD_CHECKSRC = 0
207207 endif
208208
209−# Use make M=dir to specify directory of external module to build
210−# Old syntax make ... SUBDIRS=$PWD is still supported
211−# Setting the environment variable KBUILD_EXTMOD take precedence
212−ifdef SUBDIRS
213− $(warning ================= WARNING ================)
214− $(warning 'SUBDIRS' will be removed after Linux 5.3)
215− $(warning )
216− $(warning If you are building an individual subdirectory)
217− $(warning in the kernel tree, you can do like this:)
218− $(warning $$ make path/to/dir/you/want/to/build/)
219− $(warning (Do not forget the trailing slash))
220− $(warning )
221− $(warning If you are building an external module,)
222− $(warning Please use 'M=' or 'KBUILD_EXTMOD' instead)
223− $(warning ==========================================)
224− KBUILD_EXTMOD ?= $(SUBDIRS)
225−endif
226−
209+# Use make M=dir or set the environment variable KBUILD_EXTMOD to specify the
210+# directory of external module to build. Setting M= takes precedence.
227211 ifeq ("$(origin M)", "command line")
228212 KBUILD_EXTMOD := $(M)
229213 endif
@@ -498,7 +482,6 @@ export CFLAGS_KASAN CFLAGS_KASAN_NOSANITIZE CFLAGS_UBSAN · 268 unmodified lines
498482 export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
499483 export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
500484 export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
501−export KBUILD_ARFLAGS
502485
503486 # Files to ignore in find ... statements
504487
@@ -914,9 +897,6 @@ ifdef CONFIG_RETPOLINE · 409 unmodified lines
914897 KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none)
915898 endif
916899
917−# use the deterministic mode of AR if available
918−KBUILD_ARFLAGS := $(call ar-option,D)
919−
920900 include scripts/Makefile.kasan
921901 include scripts/Makefile.extrawarn
922902 include scripts/Makefile.ubsan
arch/arm/boot/dts/am335x-icev2.dts+1−1
@@ -432,7 +432,7 @@ · 431 unmodified lines
432432 pinctrl-0 = <&mmc0_pins_default>;
433433 };
434434
435−&gpio0 {
435+&gpio0_target {
436436 /* Do not idle the GPIO used for holding the VTT regulator */
437437 ti,no-reset-on-init;
438438 ti,no-idle-on-init;
arch/arm/boot/dts/am33xx-l4.dtsi+4−2
@@ -127,7 +127,7 @@ · 126 unmodified lines
127127 ranges = <0x0 0x5000 0x1000>;
128128 };
129129
130− target-module@7000 { /* 0x44e07000, ap 14 20.0 */
130+ gpio0_target: target-module@7000 { /* 0x44e07000, ap 14 20.0 */
131131 compatible = "ti,sysc-omap2", "ti,sysc";
132132 ti,hwmods = "gpio1";
133133 reg = <0x7000 0x4>,
@@ -2038,7 +2038,9 @@ · 1904 unmodified lines
20382038 reg = <0xe000 0x4>,
20392039 <0xe054 0x4>;
20402040 reg-names = "rev", "sysc";
2041− ti,sysc-midle ;
2041+ ti,sysc-midle = <SYSC_IDLE_FORCE>,
2042+ <SYSC_IDLE_NO>,
2043+ <SYSC_IDLE_SMART>;
20422044 ti,sysc-sidle = <SYSC_IDLE_FORCE>,
20432045 <SYSC_IDLE_NO>,
20442046 <SYSC_IDLE_SMART>;
arch/arm/boot/dts/am4372.dtsi+2−0
@@ -337,6 +337,8 @@ · 336 unmodified lines
337337 ti,hwmods = "dss_dispc";
338338 clocks = <&disp_clk>;
339339 clock-names = "fck";
340+
341+ max-memory-bandwidth = <230000000>;
340342 };
341343
342344 rfbi: rfbi@4832a800 {
arch/arm/boot/dts/dra7-l4.dtsi+21−27
@@ -2732,7 +2732,7 @@ · 2731 unmodified lines
27322732 interrupt-names = "tx", "rx";
27332733 dmas = <&edma_xbar 129 1>, <&edma_xbar 128 1>;
27342734 dma-names = "tx", "rx";
2735− clocks = <&ipu_clkctrl DRA7_IPU_MCASP1_CLKCTRL 22>,
2735+ clocks = <&ipu_clkctrl DRA7_IPU_MCASP1_CLKCTRL 0>,
27362736 <&ipu_clkctrl DRA7_IPU_MCASP1_CLKCTRL 24>,
27372737 <&ipu_clkctrl DRA7_IPU_MCASP1_CLKCTRL 28>;
27382738 clock-names = "fck", "ahclkx", "ahclkr";
@@ -2768,8 +2768,8 @@ · 29 unmodified lines
27682768 interrupt-names = "tx", "rx";
27692769 dmas = <&edma_xbar 131 1>, <&edma_xbar 130 1>;
27702770 dma-names = "tx", "rx";
2771− clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP2_CLKCTRL 22>,
2772− <&l4per2_clkctrl DRA7_L4PER2_MCASP2_CLKCTRL 24>,
2771+ clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP2_CLKCTRL 0>,
2772+ <&ipu_clkctrl DRA7_IPU_MCASP1_CLKCTRL 24>,
27732773 <&l4per2_clkctrl DRA7_L4PER2_MCASP2_CLKCTRL 28>;
27742774 clock-names = "fck", "ahclkx", "ahclkr";
27752775 status = "disabled";
@@ -2786,9 +2786,8 @@ · 10 unmodified lines
27862786 <SYSC_IDLE_SMART>;
27872787 /* Domains (P, C): l4per_pwrdm, l4per2_clkdm */
27882788 clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 0>,
2789− <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 24>,
2790− <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 28>;
2791− clock-names = "fck", "ahclkx", "ahclkr";
2789+ <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 24>;
2790+ clock-names = "fck", "ahclkx";
27922791 #address-cells = <1>;
27932792 #size-cells = <1>;
27942793 ranges = <0x0 0x68000 0x2000>,
@@ -2804,7 +2803,7 @@ · 9 unmodified lines
28042803 interrupt-names = "tx", "rx";
28052804 dmas = <&edma_xbar 133 1>, <&edma_xbar 132 1>;
28062805 dma-names = "tx", "rx";
2807− clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 22>,
2806+ clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 0>,
28082807 <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 24>;
28092808 clock-names = "fck", "ahclkx";
28102809 status = "disabled";
@@ -2821,9 +2820,8 @@ · 10 unmodified lines
28212820 <SYSC_IDLE_SMART>;
28222821 /* Domains (P, C): l4per_pwrdm, l4per2_clkdm */
28232822 clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP4_CLKCTRL 0>,
2824− <&l4per2_clkctrl DRA7_L4PER2_MCASP4_CLKCTRL 24>,
2825− <&l4per2_clkctrl DRA7_L4PER2_MCASP4_CLKCTRL 28>;
2826− clock-names = "fck", "ahclkx", "ahclkr";
2823+ <&l4per2_clkctrl DRA7_L4PER2_MCASP4_CLKCTRL 24>;
2824+ clock-names = "fck", "ahclkx";
28272825 #address-cells = <1>;
28282826 #size-cells = <1>;
28292827 ranges = <0x0 0x6c000 0x2000>,
@@ -2839,7 +2837,7 @@ · 9 unmodified lines
28392837 interrupt-names = "tx", "rx";
28402838 dmas = <&edma_xbar 135 1>, <&edma_xbar 134 1>;
28412839 dma-names = "tx", "rx";
2842− clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP4_CLKCTRL 22>,
2840+ clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP4_CLKCTRL 0>,
28432841 <&l4per2_clkctrl DRA7_L4PER2_MCASP4_CLKCTRL 24>;
28442842 clock-names = "fck", "ahclkx";
28452843 status = "disabled";
@@ -2856,9 +2854,8 @@ · 10 unmodified lines
28562854 <SYSC_IDLE_SMART>;
28572855 /* Domains (P, C): l4per_pwrdm, l4per2_clkdm */
28582856 clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP5_CLKCTRL 0>,
2859− <&l4per2_clkctrl DRA7_L4PER2_MCASP5_CLKCTRL 24>,
2860− <&l4per2_clkctrl DRA7_L4PER2_MCASP5_CLKCTRL 28>;
2861− clock-names = "fck", "ahclkx", "ahclkr";
2857+ <&l4per2_clkctrl DRA7_L4PER2_MCASP5_CLKCTRL 24>;
2858+ clock-names = "fck", "ahclkx";
28622859 #address-cells = <1>;
28632860 #size-cells = <1>;
28642861 ranges = <0x0 0x70000 0x2000>,
@@ -2874,7 +2871,7 @@ · 9 unmodified lines
28742871 interrupt-names = "tx", "rx";
28752872 dmas = <&edma_xbar 137 1>, <&edma_xbar 136 1>;
28762873 dma-names = "tx", "rx";
2877− clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP5_CLKCTRL 22>,
2874+ clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP5_CLKCTRL 0>,
28782875 <&l4per2_clkctrl DRA7_L4PER2_MCASP5_CLKCTRL 24>;
28792876 clock-names = "fck", "ahclkx";
28802877 status = "disabled";
@@ -2891,9 +2888,8 @@ · 10 unmodified lines
28912888 <SYSC_IDLE_SMART>;
28922889 /* Domains (P, C): l4per_pwrdm, l4per2_clkdm */
28932890 clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP6_CLKCTRL 0>,
2894− <&l4per2_clkctrl DRA7_L4PER2_MCASP6_CLKCTRL 24>,
2895− <&l4per2_clkctrl DRA7_L4PER2_MCASP6_CLKCTRL 28>;
2896− clock-names = "fck", "ahclkx", "ahclkr";
2891+ <&l4per2_clkctrl DRA7_L4PER2_MCASP6_CLKCTRL 24>;
2892+ clock-names = "fck", "ahclkx";
28972893 #address-cells = <1>;
28982894 #size-cells = <1>;
28992895 ranges = <0x0 0x74000 0x2000>,
@@ -2909,7 +2905,7 @@ · 9 unmodified lines
29092905 interrupt-names = "tx", "rx";
29102906 dmas = <&edma_xbar 139 1>, <&edma_xbar 138 1>;
29112907 dma-names = "tx", "rx";
2912− clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP6_CLKCTRL 22>,
2908+ clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP6_CLKCTRL 0>,
29132909 <&l4per2_clkctrl DRA7_L4PER2_MCASP6_CLKCTRL 24>;
29142910 clock-names = "fck", "ahclkx";
29152911 status = "disabled";
@@ -2926,9 +2922,8 @@ · 10 unmodified lines
29262922 <SYSC_IDLE_SMART>;
29272923 /* Domains (P, C): l4per_pwrdm, l4per2_clkdm */
29282924 clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP7_CLKCTRL 0>,
2929− <&l4per2_clkctrl DRA7_L4PER2_MCASP7_CLKCTRL 24>,
2930− <&l4per2_clkctrl DRA7_L4PER2_MCASP7_CLKCTRL 28>;
2931− clock-names = "fck", "ahclkx", "ahclkr";
2925+ <&l4per2_clkctrl DRA7_L4PER2_MCASP7_CLKCTRL 24>;
2926+ clock-names = "fck", "ahclkx";
29322927 #address-cells = <1>;
29332928 #size-cells = <1>;
29342929 ranges = <0x0 0x78000 0x2000>,
@@ -2944,7 +2939,7 @@ · 9 unmodified lines
29442939 interrupt-names = "tx", "rx";
29452940 dmas = <&edma_xbar 141 1>, <&edma_xbar 140 1>;
29462941 dma-names = "tx", "rx";
2947− clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP7_CLKCTRL 22>,
2942+ clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP7_CLKCTRL 0>,
29482943 <&l4per2_clkctrl DRA7_L4PER2_MCASP7_CLKCTRL 24>;
29492944 clock-names = "fck", "ahclkx";
29502945 status = "disabled";
@@ -2961,9 +2956,8 @@ · 10 unmodified lines
29612956 <SYSC_IDLE_SMART>;
29622957 /* Domains (P, C): l4per_pwrdm, l4per2_clkdm */
29632958 clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP8_CLKCTRL 0>,
2964− <&l4per2_clkctrl DRA7_L4PER2_MCASP8_CLKCTRL 24>,
2965− <&l4per2_clkctrl DRA7_L4PER2_MCASP8_CLKCTRL 28>;
2966− clock-names = "fck", "ahclkx", "ahclkr";
2959+ <&l4per2_clkctrl DRA7_L4PER2_MCASP8_CLKCTRL 24>;
2960+ clock-names = "fck", "ahclkx";
29672961 #address-cells = <1>;
29682962 #size-cells = <1>;
29692963 ranges = <0x0 0x7c000 0x2000>,
@@ -2979,7 +2973,7 @@ · 9 unmodified lines
29792973 interrupt-names = "tx", "rx";
29802974 dmas = <&edma_xbar 143 1>, <&edma_xbar 142 1>;
29812975 dma-names = "tx", "rx";
2982− clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP8_CLKCTRL 22>,
2976+ clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP8_CLKCTRL 0>,
29832977 <&l4per2_clkctrl DRA7_L4PER2_MCASP8_CLKCTRL 24>;
29842978 clock-names = "fck", "ahclkx";
29852979 status = "disabled";
arch/arm/boot/dts/omap3-gta04.dtsi+1−0
@@ -124,6 +124,7 @@ · 123 unmodified lines
124124 spi-max-frequency = <100000>;
125125 spi-cpol;
126126 spi-cpha;
127+ spi-cs-high;
127128
128129 backlight= <&backlight>;
129130 label = "lcd";
arch/arm/boot/dts/ste-dbx5x0.dtsi+8−3
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #include <dt-bindings/mfd/dbx500-prcmu.h>
99 #include <dt-bindings/arm/ux500_pm_domains.h>
1010 #include <dt-bindings/gpio/gpio.h>
11+#include <dt-bindings/thermal/thermal.h>
1112
1213 / {
1314 #address-cells = <1>;
@@ -59,8 +60,12 @@ · 45 unmodified lines
5960 * cooling.
6061 */
6162 cpu_thermal: cpu-thermal {
62− polling-delay-passive = <0>;
63− polling-delay = <1000>;
63+ polling-delay-passive = <250>;
64+ /*
65+ * This sensor fires interrupts to update the thermal
66+ * zone, so no polling is needed.
67+ */
68+ polling-delay = <0>;
6469
6570 thermal-sensors = <&thermal>;
6671
@@ -79,7 +84,7 @@ · 12 unmodified lines
7984
8085 cooling-maps {
8186 trip = <&cpu_alert>;
82− cooling-device = <&CPU0 0 2>;
87+ cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
8388 contribution = <100>;
8489 };
8590 };
arch/arm/configs/davinci_all_defconfig+1−1
@@ -228,7 +228,7 @@ CONFIG_RTC_DRV_OMAP=m · 227 unmodified lines
228228 CONFIG_DMADEVICES=y
229229 CONFIG_TI_EDMA=y
230230 CONFIG_COMMON_CLK_PWM=m
231−CONFIG_REMOTEPROC=m
231+CONFIG_REMOTEPROC=y
232232 CONFIG_DA8XX_REMOTEPROC=m
233233 CONFIG_MEMORY=y
234234 CONFIG_TI_AEMIF=m
arch/arm/configs/multi_v7_defconfig+2−2
@@ -415,7 +415,7 @@ CONFIG_SPI_SH_MSIOF=m · 414 unmodified lines
415415 CONFIG_SPI_SH_HSPI=y
416416 CONFIG_SPI_SIRF=y
417417 CONFIG_SPI_STM32=m
418−CONFIG_SPI_STM32_QSPI=m
418+CONFIG_SPI_STM32_QSPI=y
419419 CONFIG_SPI_SUN4I=y
420420 CONFIG_SPI_SUN6I=y
421421 CONFIG_SPI_TEGRA114=y
@@ -933,7 +933,7 @@ CONFIG_BCM2835_MBOX=y · 511 unmodified lines
933933 CONFIG_ROCKCHIP_IOMMU=y
934934 CONFIG_TEGRA_IOMMU_GART=y
935935 CONFIG_TEGRA_IOMMU_SMMU=y
936−CONFIG_REMOTEPROC=m
936+CONFIG_REMOTEPROC=y
937937 CONFIG_ST_REMOTEPROC=m
938938 CONFIG_RPMSG_VIRTIO=m
939939 CONFIG_ASPEED_LPC_CTRL=m
arch/arm/configs/omap2plus_defconfig+4−1
@@ -364,6 +364,7 @@ CONFIG_DRM_OMAP_PANEL_TPO_TD043MTEA1=m · 363 unmodified lines
364364 CONFIG_DRM_OMAP_PANEL_NEC_NL8048HL11=m
365365 CONFIG_DRM_TILCDC=m
366366 CONFIG_DRM_PANEL_SIMPLE=m
367+CONFIG_DRM_TI_TFP410=m
367368 CONFIG_FB=y
368369 CONFIG_FIRMWARE_EDID=y
369370 CONFIG_FB_MODE_HELPERS=y
@@ -423,6 +424,7 @@ CONFIG_USB_SERIAL_GENERIC=y · 53 unmodified lines
423424 CONFIG_USB_SERIAL_SIMPLE=m
424425 CONFIG_USB_SERIAL_FTDI_SIO=m
425426 CONFIG_USB_SERIAL_PL2303=m
427+CONFIG_USB_SERIAL_OPTION=m
426428 CONFIG_USB_TEST=m
427429 CONFIG_NOP_USB_XCEIV=m
428430 CONFIG_AM335X_PHY_USB=m
@@ -460,6 +462,7 @@ CONFIG_MMC_SDHCI_OMAP=y · 31 unmodified lines
460462 CONFIG_NEW_LEDS=y
461463 CONFIG_LEDS_CLASS=m
462464 CONFIG_LEDS_CPCAP=m
465+CONFIG_LEDS_LM3532=m
463466 CONFIG_LEDS_GPIO=m
464467 CONFIG_LEDS_PCA963X=m
465468 CONFIG_LEDS_PWM=m
@@ -481,7 +484,7 @@ CONFIG_RTC_DRV_OMAP=m · 15 unmodified lines
481484 CONFIG_RTC_DRV_CPCAP=m
482485 CONFIG_DMADEVICES=y
483486 CONFIG_OMAP_IOMMU=y
484−CONFIG_REMOTEPROC=m
487+CONFIG_REMOTEPROC=y
485488 CONFIG_OMAP_REMOTEPROC=m
486489 CONFIG_WKUP_M3_RPROC=m
487490 CONFIG_SOC_TI=y
arch/arm/include/asm/xen/xen-ops.h+0−6
@@ -1,6 +0,0 @@
1−#ifndef _ASM_XEN_OPS_H
2−#define _ASM_XEN_OPS_H
3−
4−void xen_efi_runtime_setup(void);
5−
6−#endif /* _ASM_XEN_OPS_H */
arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c+2−1
@@ -763,7 +763,8 @@ static struct omap_hwmod_class_sysconfig am33xx_timer_sysc = { · 762 unmodified lines
763763 .rev_offs = 0x0000,
764764 .sysc_offs = 0x0010,
765765 .syss_offs = 0x0014,
766− .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
766+ .sysc_flags = SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
767+ SYSC_HAS_RESET_STATUS,
767768 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
768769 SIDLE_SMART_WKUP),
769770 .sysc_fields = &omap_hwmod_sysc_type2,
arch/arm/mach-omap2/omap_hwmod_33xx_data.c+3−2
@@ -231,8 +231,9 @@ static struct omap_hwmod am33xx_control_hwmod = { · 230 unmodified lines
231231 static struct omap_hwmod_class_sysconfig lcdc_sysc = {
232232 .rev_offs = 0x0,
233233 .sysc_offs = 0x54,
234− .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE),
235− .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
234+ .sysc_flags = SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE,
235+ .idlemodes = SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
236+ MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART,
236237 .sysc_fields = &omap_hwmod_sysc_type2,
237238 };
238239
arch/arm/mach-omap2/pm.c+0−100
@@ -74,83 +74,6 @@ int omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused) · 73 unmodified lines
7474 return 0;
7575 }
7676
77−/*
78− * This API is to be called during init to set the various voltage
79− * domains to the voltage as per the opp table. Typically we boot up
80− * at the nominal voltage. So this function finds out the rate of
81− * the clock associated with the voltage domain, finds out the correct
82− * opp entry and sets the voltage domain to the voltage specified
83− * in the opp entry
84− */
85−static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
86− const char *oh_name)
87−{
88− struct voltagedomain *voltdm;
89− struct clk *clk;
90− struct dev_pm_opp *opp;
91− unsigned long freq, bootup_volt;
92− struct device *dev;
93−
94− if (!vdd_name || !clk_name || !oh_name) {
95− pr_err("%s: invalid parameters\n", __func__);
96− goto exit;
97− }
98−
99− if (!strncmp(oh_name, "mpu", 3))
100− /*
101− * All current OMAPs share voltage rail and clock
102− * source, so CPU0 is used to represent the MPU-SS.
103− */
104− dev = get_cpu_device(0);
105− else
106− dev = omap_device_get_by_hwmod_name(oh_name);
107−
108− if (IS_ERR(dev)) {
109− pr_err("%s: Unable to get dev pointer for hwmod %s\n",
110− __func__, oh_name);
111− goto exit;
112− }
113−
114− voltdm = voltdm_lookup(vdd_name);
115− if (!voltdm) {
116− pr_err("%s: unable to get vdd pointer for vdd_%s\n",
117− __func__, vdd_name);
118− goto exit;
119− }
120−
121− clk = clk_get(NULL, clk_name);
122− if (IS_ERR(clk)) {
123− pr_err("%s: unable to get clk %s\n", __func__, clk_name);
124− goto exit;
125− }
126−
127− freq = clk_get_rate(clk);
128− clk_put(clk);
129−
130− opp = dev_pm_opp_find_freq_ceil(dev, &freq);
131− if (IS_ERR(opp)) {
132− pr_err("%s: unable to find boot up OPP for vdd_%s\n",
133− __func__, vdd_name);
134− goto exit;
135− }
136−
137− bootup_volt = dev_pm_opp_get_voltage(opp);
138− dev_pm_opp_put(opp);
139−
140− if (!bootup_volt) {
141− pr_err("%s: unable to find voltage corresponding to the bootup OPP for vdd_%s\n",
142− __func__, vdd_name);
143− goto exit;
144− }
145−
146− voltdm_scale(voltdm, bootup_volt);
147− return 0;
148−
149−exit:
150− pr_err("%s: unable to set vdd_%s\n", __func__, vdd_name);
151− return -EINVAL;
152−}
153−
15477 #ifdef CONFIG_SUSPEND
15578 static int omap_pm_enter(suspend_state_t suspend_state)
15679 {
@@ -208,25 +131,6 @@ void omap_common_suspend_init(void *pm_suspend) · 51 unmodified lines
208131 }
209132 #endif /* CONFIG_SUSPEND */
210133
211−static void __init omap3_init_voltages(void)
212−{
213− if (!soc_is_omap34xx())
214− return;
215−
216− omap2_set_init_voltage("mpu_iva", "dpll1_ck", "mpu");
217− omap2_set_init_voltage("core", "l3_ick", "l3_main");
218−}
219−
220−static void __init omap4_init_voltages(void)
221−{
222− if (!soc_is_omap44xx())
223− return;
224−
225− omap2_set_init_voltage("mpu", "dpll_mpu_ck", "mpu");
226− omap2_set_init_voltage("core", "l3_div_ck", "l3_main_1");
227− omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", "iva");
228−}
229−
230134 int __maybe_unused omap_pm_nop_init(void)
231135 {
232136 return 0;
@@ -246,10 +150,6 @@ int __init omap2_common_pm_late_init(void) · 13 unmodified lines
246150 omap4_twl_init();
247151 omap_voltage_late_init();
248152
249− /* Initialize the voltages */
250− omap3_init_voltages();
251− omap4_init_voltages();
252−
253153 /* Smartreflex device init */
254154 omap_devinit_smartreflex();
255155
arch/arm/xen/Makefile+0−1
@@ -1,3 +1,2 @@
11 # SPDX-License-Identifier: GPL-2.0-only
22 obj-y := enlighten.o hypercall.o grant-table.o p2m.o mm.o
3−obj-$(CONFIG_XEN_EFI) += efi.o
arch/arm/xen/efi.c+0−28
@@ -1,28 +0,0 @@
1−// SPDX-License-Identifier: GPL-2.0-or-later
2−/*
3− * Copyright (c) 2015, Linaro Limited, Shannon Zhao
4− */
5−
6−#include <linux/efi.h>
7−#include <xen/xen-ops.h>
8−#include <asm/xen/xen-ops.h>
9−
10−/* Set XEN EFI runtime services function pointers. Other fields of struct efi,
11− * e.g. efi.systab, will be set like normal EFI.
12− */
13−void __init xen_efi_runtime_setup(void)
14−{
15− efi.get_time = xen_efi_get_time;
16− efi.set_time = xen_efi_set_time;
17− efi.get_wakeup_time = xen_efi_get_wakeup_time;
18− efi.set_wakeup_time = xen_efi_set_wakeup_time;
19− efi.get_variable = xen_efi_get_variable;
20− efi.get_next_variable = xen_efi_get_next_variable;
21− efi.set_variable = xen_efi_set_variable;
22− efi.query_variable_info = xen_efi_query_variable_info;
23− efi.update_capsule = xen_efi_update_capsule;
24− efi.query_capsule_caps = xen_efi_query_capsule_caps;
25− efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count;
26− efi.reset_system = xen_efi_reset_system;
27−}
28−EXPORT_SYMBOL_GPL(xen_efi_runtime_setup);
arch/arm/xen/enlighten.c+1−2
@@ -15,7 +15,6 @@ · 14 unmodified lines
1515 #include <xen/xen-ops.h>
1616 #include <asm/xen/hypervisor.h>
1717 #include <asm/xen/hypercall.h>
18−#include <asm/xen/xen-ops.h>
1918 #include <asm/system_misc.h>
2019 #include <asm/efi.h>
2120 #include <linux/interrupt.h>
@@ -437,7 +436,7 @@ EXPORT_SYMBOL_GPL(HYPERVISOR_memory_op); · 415 unmodified lines
437436 EXPORT_SYMBOL_GPL(HYPERVISOR_physdev_op);
438437 EXPORT_SYMBOL_GPL(HYPERVISOR_vcpu_op);
439438 EXPORT_SYMBOL_GPL(HYPERVISOR_tmem_op);
440−EXPORT_SYMBOL_GPL(HYPERVISOR_platform_op);
439+EXPORT_SYMBOL_GPL(HYPERVISOR_platform_op_raw);
441440 EXPORT_SYMBOL_GPL(HYPERVISOR_multicall);
442441 EXPORT_SYMBOL_GPL(HYPERVISOR_vm_assist);
443442 EXPORT_SYMBOL_GPL(HYPERVISOR_dm_op);
arch/arm/xen/mm.c+4−1
@@ -28,7 +28,10 @@ unsigned long xen_get_swiotlb_free_pages(unsigned int order) · 27 unmodified lines
2828
2929 for_each_memblock(memory, reg) {
3030 if (reg->base < (phys_addr_t)0xffffffff) {
31− flags |= __GFP_DMA;
31+ if (IS_ENABLED(CONFIG_ZONE_DMA32))
32+ flags |= __GFP_DMA32;
33+ else
34+ flags |= __GFP_DMA;
3235 break;
3336 }
3437 }
arch/arm64/Kconfig+17−0
@@ -616,6 +616,23 @@ config CAVIUM_ERRATUM_30115 · 615 unmodified lines
616616
617617 If unsure, say Y.
618618
619+config CAVIUM_TX2_ERRATUM_219
620+ bool "Cavium ThunderX2 erratum 219: PRFM between TTBR change and ISB fails"
621+ default y
622+ help
623+ On Cavium ThunderX2, a load, store or prefetch instruction between a
624+ TTBR update and the corresponding context synchronizing operation can
625+ cause a spurious Data Abort to be delivered to any hardware thread in
626+ the CPU core.
627+
628+ Work around the issue by avoiding the problematic code sequence and
629+ trapping KVM guest TTBRx_EL1 writes to EL2 when SMT is enabled. The
630+ trap handler performs the corresponding register access, skips the
631+ instruction and ensures context synchronization by virtue of the
632+ exception return.
633+
634+ If unsure, say Y.
635+
619636 config QCOM_FALKOR_ERRATUM_1003
620637 bool "Falkor E1003: Incorrect translation due to ASID change"
621638 default y
arch/arm64/configs/defconfig+1−1
@@ -723,7 +723,7 @@ CONFIG_TEGRA_IOMMU_SMMU=y · 722 unmodified lines
723723 CONFIG_ARM_SMMU=y
724724 CONFIG_ARM_SMMU_V3=y
725725 CONFIG_QCOM_IOMMU=y
726−CONFIG_REMOTEPROC=m
726+CONFIG_REMOTEPROC=y
727727 CONFIG_QCOM_Q6V5_MSS=m
728728 CONFIG_QCOM_Q6V5_PAS=m
729729 CONFIG_QCOM_SYSMON=m
arch/arm64/include/asm/cpucaps.h+3−1
@@ -52,7 +52,9 @@ · 51 unmodified lines
5252 #define ARM64_HAS_IRQ_PRIO_MASKING 42
5353 #define ARM64_HAS_DCPODP 43
5454 #define ARM64_WORKAROUND_1463225 44
55+#define ARM64_WORKAROUND_CAVIUM_TX2_219_TVM 45
56+#define ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM 46
5557
56−#define ARM64_NCAPS 45
58+#define ARM64_NCAPS 47
5759
5860 #endif /* __ASM_CPUCAPS_H */
arch/arm64/include/asm/kvm_hyp.h+0−24
@@ -47,30 +47,6 @@ · 46 unmodified lines
4747 #define read_sysreg_el2(r) read_sysreg_elx(r, _EL2, _EL1)
4848 #define write_sysreg_el2(v,r) write_sysreg_elx(v, r, _EL2, _EL1)
4949
50−/**
51− * hyp_alternate_select - Generates patchable code sequences that are
52− * used to switch between two implementations of a function, depending
53− * on the availability of a feature.
54− *
55− * @fname: a symbol name that will be defined as a function returning a
56− * function pointer whose type will match @orig and @alt
57− * @orig: A pointer to the default function, as returned by @fname when
58− * @cond doesn't hold
59− * @alt: A pointer to the alternate function, as returned by @fname
60− * when @cond holds
61− * @cond: a CPU feature (as described in asm/cpufeature.h)
62− */
63−#define hyp_alternate_select(fname, orig, alt, cond) \
64−typeof(orig) * __hyp_text fname(void) \
65−{ \
66− typeof(alt) *val = orig; \
67− asm volatile(ALTERNATIVE("nop \n", \
68− "mov %0, %1 \n", \
69− cond) \
70− : "+r" (val) : "r" (alt)); \
71− return val; \
72−}
73−
7450 int __vgic_v2_perform_cpuif_access(struct kvm_vcpu *vcpu);
7551
7652 void __vgic_v3_save_state(struct kvm_vcpu *vcpu);
arch/arm64/include/asm/xen/xen-ops.h+0−7
@@ -1,7 +0,0 @@
1−/* SPDX-License-Identifier: GPL-2.0 */
2−#ifndef _ASM_XEN_OPS_H
3−#define _ASM_XEN_OPS_H
4−
5−void xen_efi_runtime_setup(void);
6−
7−#endif /* _ASM_XEN_OPS_H */
arch/arm64/kernel/cpu_errata.c+38−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #include <asm/cpu.h>
1313 #include <asm/cputype.h>
1414 #include <asm/cpufeature.h>
15+#include <asm/smp_plat.h>
1516
1617 static bool __maybe_unused
1718 is_affected_midr_range(const struct arm64_cpu_capabilities *entry, int scope)
@@ -623,6 +624,30 @@ check_branch_predictor(const struct arm64_cpu_capabilities *entry, int scope) · 605 unmodified lines
623624 return (need_wa > 0);
624625 }
625626
627+static const __maybe_unused struct midr_range tx2_family_cpus[] = {
628+ MIDR_ALL_VERSIONS(MIDR_BRCM_VULCAN),
629+ MIDR_ALL_VERSIONS(MIDR_CAVIUM_THUNDERX2),
630+ {},
631+};
632+
633+static bool __maybe_unused
634+needs_tx2_tvm_workaround(const struct arm64_cpu_capabilities *entry,
635+ int scope)
636+{
637+ int i;
638+
639+ if (!is_affected_midr_range_list(entry, scope) ||
640+ !is_hyp_mode_available())
641+ return false;
642+
643+ for_each_possible_cpu(i) {
644+ if (MPIDR_AFFINITY_LEVEL(cpu_logical_map(i), 0) != 0)
645+ return true;
646+ }
647+
648+ return false;
649+}
650+
626651 #ifdef CONFIG_HARDEN_EL2_VECTORS
627652
628653 static const struct midr_range arm64_harden_el2_vectors[] = {
@@ -851,6 +876,19 @@ const struct arm64_cpu_capabilities arm64_errata[] = { · 222 unmodified lines
851876 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
852877 .matches = has_cortex_a76_erratum_1463225,
853878 },
879+#endif
880+#ifdef CONFIG_CAVIUM_TX2_ERRATUM_219
881+ {
882+ .desc = "Cavium ThunderX2 erratum 219 (KVM guest sysreg trapping)",
883+ .capability = ARM64_WORKAROUND_CAVIUM_TX2_219_TVM,
884+ ERRATA_MIDR_RANGE_LIST(tx2_family_cpus),
885+ .matches = needs_tx2_tvm_workaround,
886+ },
887+ {
888+ .desc = "Cavium ThunderX2 erratum 219 (PRFM removal)",
889+ .capability = ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM,
890+ ERRATA_MIDR_RANGE_LIST(tx2_family_cpus),
891+ },
854892 #endif
855893 {
856894 }
arch/arm64/kernel/entry.S+2−0
@@ -1071,7 +1071,9 @@ alternative_insn isb, nop, ARM64_WORKAROUND_QCOM_FALKOR_E1003 · 1070 unmodified lines
10711071 #else
10721072 ldr x30, =vectors
10731073 #endif
1074+alternative_if_not ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM
10741075 prfm plil1strm, [x30, #(1b - tramp_vectors)]
1076+alternative_else_nop_endif
10751077 msr vbar_el1, x30
10761078 add x30, x30, #(1b - tramp_vectors)
10771079 isb
arch/arm64/kvm/hyp/switch.c+69−17
@@ -124,6 +124,9 @@ static void __hyp_text __activate_traps(struct kvm_vcpu *vcpu) · 123 unmodified lines
124124 {
125125 u64 hcr = vcpu->arch.hcr_el2;
126126
127+ if (cpus_have_const_cap(ARM64_WORKAROUND_CAVIUM_TX2_219_TVM))
128+ hcr |= HCR_TVM;
129+
127130 write_sysreg(hcr, hcr_el2);
128131
129132 if (cpus_have_const_cap(ARM64_HAS_RAS_EXTN) && (hcr & HCR_VSE))
@@ -174,8 +177,10 @@ static void __hyp_text __deactivate_traps(struct kvm_vcpu *vcpu) · 44 unmodified lines
174177 * the crucial bit is "On taking a vSError interrupt,
175178 * HCR_EL2.VSE is cleared to 0."
176179 */
177− if (vcpu->arch.hcr_el2 & HCR_VSE)
178− vcpu->arch.hcr_el2 = read_sysreg(hcr_el2);
180+ if (vcpu->arch.hcr_el2 & HCR_VSE) {
181+ vcpu->arch.hcr_el2 &= ~HCR_VSE;
182+ vcpu->arch.hcr_el2 |= read_sysreg(hcr_el2) & HCR_VSE;
183+ }
179184
180185 if (has_vhe())
181186 deactivate_traps_vhe();
@@ -229,20 +234,6 @@ static void __hyp_text __hyp_vgic_restore_state(struct kvm_vcpu *vcpu) · 47 unmodified lines
229234 }
230235 }
231236
232−static bool __hyp_text __true_value(void)
233−{
234− return true;
235−}
236−
237−static bool __hyp_text __false_value(void)
238−{
239− return false;
240−}
241−
242−static hyp_alternate_select(__check_arm_834220,
243− __false_value, __true_value,
244− ARM64_WORKAROUND_834220);
245−
246237 static bool __hyp_text __translate_far_to_hpfar(u64 far, u64 *hpfar)
247238 {
248239 u64 par, tmp;
@@ -298,7 +289,8 @@ static bool __hyp_text __populate_fault_info(struct kvm_vcpu *vcpu) · 49 unmodified lines
298289 * resolve the IPA using the AT instruction.
299290 */
300291 if (!(esr & ESR_ELx_S1PTW) &&
301− (__check_arm_834220()() || (esr & ESR_ELx_FSC_TYPE) == FSC_PERM)) {
292+ (cpus_have_const_cap(ARM64_WORKAROUND_834220) ||
293+ (esr & ESR_ELx_FSC_TYPE) == FSC_PERM)) {
302294 if (!__translate_far_to_hpfar(far, &hpfar))
303295 return false;
304296 } else {
@@ -393,6 +385,61 @@ static bool __hyp_text __hyp_handle_fpsimd(struct kvm_vcpu *vcpu) · 88 unmodified lines
393385 return true;
394386 }
395387
388+static bool __hyp_text handle_tx2_tvm(struct kvm_vcpu *vcpu)
389+{
390+ u32 sysreg = esr_sys64_to_sysreg(kvm_vcpu_get_hsr(vcpu));
391+ int rt = kvm_vcpu_sys_get_rt(vcpu);
392+ u64 val = vcpu_get_reg(vcpu, rt);
393+
394+ /*
395+ * The normal sysreg handling code expects to see the traps,
396+ * let's not do anything here.
397+ */
398+ if (vcpu->arch.hcr_el2 & HCR_TVM)
399+ return false;
400+
401+ switch (sysreg) {
402+ case SYS_SCTLR_EL1:
403+ write_sysreg_el1(val, SYS_SCTLR);
404+ break;
405+ case SYS_TTBR0_EL1:
406+ write_sysreg_el1(val, SYS_TTBR0);
407+ break;
408+ case SYS_TTBR1_EL1:
409+ write_sysreg_el1(val, SYS_TTBR1);
410+ break;
411+ case SYS_TCR_EL1:
412+ write_sysreg_el1(val, SYS_TCR);
413+ break;
414+ case SYS_ESR_EL1:
415+ write_sysreg_el1(val, SYS_ESR);
416+ break;
417+ case SYS_FAR_EL1:
418+ write_sysreg_el1(val, SYS_FAR);
419+ break;
420+ case SYS_AFSR0_EL1:
421+ write_sysreg_el1(val, SYS_AFSR0);
422+ break;
423+ case SYS_AFSR1_EL1:
424+ write_sysreg_el1(val, SYS_AFSR1);
425+ break;
426+ case SYS_MAIR_EL1:
427+ write_sysreg_el1(val, SYS_MAIR);
428+ break;
429+ case SYS_AMAIR_EL1:
430+ write_sysreg_el1(val, SYS_AMAIR);
431+ break;
432+ case SYS_CONTEXTIDR_EL1:
433+ write_sysreg_el1(val, SYS_CONTEXTIDR);
434+ break;
435+ default:
436+ return false;
437+ }
438+
439+ __kvm_skip_instr(vcpu);
440+ return true;
441+}
442+
396443 /*
397444 * Return true when we were able to fixup the guest exit and should return to
398445 * the guest, false when we should restore the host state and return to the
@@ -412,6 +459,11 @@ static bool __hyp_text fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code) · 13 unmodified lines
412459 if (*exit_code != ARM_EXCEPTION_TRAP)
413460 goto exit;
414461
462+ if (cpus_have_const_cap(ARM64_WORKAROUND_CAVIUM_TX2_219_TVM) &&
463+ kvm_vcpu_trap_get_class(vcpu) == ESR_ELx_EC_SYS64 &&
464+ handle_tx2_tvm(vcpu))
465+ return true;
466+
415467 /*
416468 * We trap the first access to the FP/SIMD to save the host context
417469 * and restore the guest context lazily.
arch/arm64/kvm/hyp/tlb.c+22−14
@@ -67,10 +67,14 @@ static void __hyp_text __tlb_switch_to_guest_nvhe(struct kvm *kvm, · 66 unmodified lines
6767 isb();
6868 }
6969
70−static hyp_alternate_select(__tlb_switch_to_guest,
71− __tlb_switch_to_guest_nvhe,
72− __tlb_switch_to_guest_vhe,
73− ARM64_HAS_VIRT_HOST_EXTN);
70+static void __hyp_text __tlb_switch_to_guest(struct kvm *kvm,
71+ struct tlb_inv_context *cxt)
72+{
73+ if (has_vhe())
74+ __tlb_switch_to_guest_vhe(kvm, cxt);
75+ else
76+ __tlb_switch_to_guest_nvhe(kvm, cxt);
77+}
7478
7579 static void __hyp_text __tlb_switch_to_host_vhe(struct kvm *kvm,
7680 struct tlb_inv_context *cxt)
@@ -98,10 +102,14 @@ static void __hyp_text __tlb_switch_to_host_nvhe(struct kvm *kvm, · 21 unmodified lines
98102 write_sysreg(0, vttbr_el2);
99103 }
100104
101−static hyp_alternate_select(__tlb_switch_to_host,
102− __tlb_switch_to_host_nvhe,
103− __tlb_switch_to_host_vhe,
104− ARM64_HAS_VIRT_HOST_EXTN);
105+static void __hyp_text __tlb_switch_to_host(struct kvm *kvm,
106+ struct tlb_inv_context *cxt)
107+{
108+ if (has_vhe())
109+ __tlb_switch_to_host_vhe(kvm, cxt);
110+ else
111+ __tlb_switch_to_host_nvhe(kvm, cxt);
112+}
105113
106114 void __hyp_text __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa)
107115 {
@@ -111,7 +119,7 @@ void __hyp_text __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa) · 3 unmodified lines
111119
112120 /* Switch to requested VMID */
113121 kvm = kern_hyp_va(kvm);
114− __tlb_switch_to_guest()(kvm, &cxt);
122+ __tlb_switch_to_guest(kvm, &cxt);
115123
116124 /*
117125 * We could do so much better if we had the VA as well.
@@ -154,7 +162,7 @@ void __hyp_text __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa) · 36 unmodified lines
154162 if (!has_vhe() && icache_is_vpipt())
155163 __flush_icache_all();
156164
157− __tlb_switch_to_host()(kvm, &cxt);
165+ __tlb_switch_to_host(kvm, &cxt);
158166 }
159167
160168 void __hyp_text __kvm_tlb_flush_vmid(struct kvm *kvm)
@@ -165,13 +173,13 @@ void __hyp_text __kvm_tlb_flush_vmid(struct kvm *kvm) · 4 unmodified lines
165173
166174 /* Switch to requested VMID */
167175 kvm = kern_hyp_va(kvm);
168− __tlb_switch_to_guest()(kvm, &cxt);
176+ __tlb_switch_to_guest(kvm, &cxt);
169177
170178 __tlbi(vmalls12e1is);
171179 dsb(ish);
172180 isb();
173181
174− __tlb_switch_to_host()(kvm, &cxt);
182+ __tlb_switch_to_host(kvm, &cxt);
175183 }
176184
177185 void __hyp_text __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu)
@@ -180,13 +188,13 @@ void __hyp_text __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu) · 2 unmodified lines
180188 struct tlb_inv_context cxt;
181189
182190 /* Switch to requested VMID */
183− __tlb_switch_to_guest()(kvm, &cxt);
191+ __tlb_switch_to_guest(kvm, &cxt);
184192
185193 __tlbi(vmalle1);
186194 dsb(nsh);
187195 isb();
188196
189− __tlb_switch_to_host()(kvm, &cxt);
197+ __tlb_switch_to_host(kvm, &cxt);
190198 }
191199
192200 void __hyp_text __kvm_flush_vm_context(void)
arch/arm64/xen/Makefile+0−1
@@ -1,4 +1,3 @@
11 # SPDX-License-Identifier: GPL-2.0-only
22 xen-arm-y += $(addprefix ../../arm/xen/, enlighten.o grant-table.o p2m.o mm.o)
33 obj-y := xen-arm.o hypercall.o
4−obj-$(CONFIG_XEN_EFI) += $(addprefix ../../arm/xen/, efi.o)
arch/mips/boot/dts/qca/ar9331.dtsi+1−1
@@ -99,7 +99,7 @@ · 98 unmodified lines
9999
100100 miscintc: interrupt-controller@18060010 {
101101 compatible = "qca,ar7240-misc-intc";
102− reg = <0x18060010 0x4>;
102+ reg = <0x18060010 0x8>;
103103
104104 interrupt-parent = <&cpuintc>;
105105 interrupts = <6>;
arch/mips/fw/arc/memory.c+0−1
@@ -160,7 +160,6 @@ void __init prom_meminit(void) · 159 unmodified lines
160160
161161 void __init prom_free_prom_memory(void)
162162 {
163− unsigned long addr;
164163 int i;
165164
166165 if (prom_flags & PROM_FLAG_DONT_FREE_TEMP)
arch/mips/include/asm/octeon/cvmx-ipd.h+1−0
@@ -36,6 +36,7 @@ · 35 unmodified lines
3636 #include <asm/octeon/octeon-feature.h>
3737
3838 #include <asm/octeon/cvmx-ipd-defs.h>
39+#include <asm/octeon/cvmx-pip-defs.h>
3940
4041 enum cvmx_ipd_mode {
4142 CVMX_IPD_OPC_MODE_STT = 0LL, /* All blocks DRAM, not cached in L2 */
arch/mips/include/asm/unistd.h+1−0
@@ -52,6 +52,7 @@ · 51 unmodified lines
5252 # endif
5353 #define __ARCH_WANT_SYS_FORK
5454 #define __ARCH_WANT_SYS_CLONE
55+#define __ARCH_WANT_SYS_CLONE3
5556
5657 /* whitelists for checksyscalls */
5758 #define __IGNORE_fadvise64_64
arch/mips/kernel/cpu-bugs64.c+8−6
@@ -24,7 +24,8 @@ static char r4kwar[] __initdata = · 23 unmodified lines
2424 static char daddiwar[] __initdata =
2525 "Enable CPU_DADDI_WORKAROUNDS to rectify.";
2626
27−static inline void align_mod(const int align, const int mod)
27+static __always_inline __init
28+void align_mod(const int align, const int mod)
2829 {
2930 asm volatile(
3031 ".set push\n\t"
@@ -38,8 +39,9 @@ static inline void align_mod(const int align, const int mod) · 7 unmodified lines
3839 : "n"(align), "n"(mod));
3940 }
4041
41−static __always_inline void mult_sh_align_mod(long *v1, long *v2, long *w,
42− const int align, const int mod)
42+static __always_inline __init
43+void mult_sh_align_mod(long *v1, long *v2, long *w,
44+ const int align, const int mod)
4345 {
4446 unsigned long flags;
4547 int m1, m2;
@@ -113,7 +115,7 @@ static __always_inline void mult_sh_align_mod(long *v1, long *v2, long *w, · 67 unmodified lines
113115 *w = lw;
114116 }
115117
116−static inline void check_mult_sh(void)
118+static __always_inline __init void check_mult_sh(void)
117119 {
118120 long v1[8], v2[8], w[8];
119121 int bug, fix, i;
@@ -176,7 +178,7 @@ asmlinkage void __init do_daddi_ov(struct pt_regs *regs) · 56 unmodified lines
176178 exception_exit(prev_state);
177179 }
178180
179−static inline void check_daddi(void)
181+static __init void check_daddi(void)
180182 {
181183 extern asmlinkage void handle_daddi_ov(void);
182184 unsigned long flags;
@@ -242,7 +244,7 @@ static inline void check_daddi(void) · 59 unmodified lines
242244
243245 int daddiu_bug = IS_ENABLED(CONFIG_CPU_MIPSR6) ? 0 : -1;
244246
245−static inline void check_daddiu(void)
247+static __init void check_daddiu(void)
246248 {
247249 long v, w, tmp;
248250
arch/mips/kernel/setup.c+4−1
@@ -108,6 +108,9 @@ void __init add_memory_region(phys_addr_t start, phys_addr_t size, long type) · 107 unmodified lines
108108 return;
109109 }
110110
111+ if (start < PHYS_OFFSET)
112+ return;
113+
111114 memblock_add(start, size);
112115 /* Reserve any memory except the ordinary RAM ranges. */
113116 switch (type) {
@@ -321,7 +324,7 @@ static void __init bootmem_init(void) · 207 unmodified lines
321324 * Reserve any memory between the start of RAM and PHYS_OFFSET
322325 */
323326 if (ramstart > PHYS_OFFSET)
324− memblock_reserve(PHYS_OFFSET, PFN_UP(ramstart) - PHYS_OFFSET);
327+ memblock_reserve(PHYS_OFFSET, ramstart - PHYS_OFFSET);
325328
326329 if (PFN_UP(ramstart) > ARCH_PFN_OFFSET) {
327330 pr_info("Wasting %lu bytes for tracking %lu unused pages\n",
arch/mips/kernel/syscall.c+1−0
@@ -80,6 +80,7 @@ SYSCALL_DEFINE6(mips_mmap2, unsigned long, addr, unsigned long, len, · 79 unmodified lines
8080
8181 save_static_function(sys_fork);
8282 save_static_function(sys_clone);
83+save_static_function(sys_clone3);
8384
8485 SYSCALL_DEFINE1(set_thread_area, unsigned long, addr)
8586 {
arch/mips/kernel/syscalls/syscall_n32.tbl+1−1
@@ -373,4 +373,4 @@ · 372 unmodified lines
373373 432 n32 fsmount sys_fsmount
374374 433 n32 fspick sys_fspick
375375 434 n32 pidfd_open sys_pidfd_open
376−# 435 reserved for clone3
376+435 n32 clone3 __sys_clone3
arch/mips/kernel/syscalls/syscall_n64.tbl+1−1
@@ -349,4 +349,4 @@ · 348 unmodified lines
349349 432 n64 fsmount sys_fsmount
350350 433 n64 fspick sys_fspick
351351 434 n64 pidfd_open sys_pidfd_open
352−# 435 reserved for clone3
352+435 n64 clone3 __sys_clone3
arch/mips/kernel/syscalls/syscall_o32.tbl+1−1
@@ -422,4 +422,4 @@ · 421 unmodified lines
422422 432 o32 fsmount sys_fsmount
423423 433 o32 fspick sys_fspick
424424 434 o32 pidfd_open sys_pidfd_open
425−# 435 reserved for clone3
425+435 o32 clone3 __sys_clone3
arch/mips/loongson64/common/mem.c+17−18
@@ -3,6 +3,7 @@ · 2 unmodified lines
33 */
44 #include <linux/fs.h>
55 #include <linux/fcntl.h>
6+#include <linux/memblock.h>
67 #include <linux/mm.h>
78
89 #include <asm/bootinfo.h>
@@ -64,24 +65,22 @@ void __init prom_init_memory(void) · 55 unmodified lines
6465 node_id = loongson_memmap->map[i].node_id;
6566 mem_type = loongson_memmap->map[i].mem_type;
6667
67− if (node_id == 0) {
68− switch (mem_type) {
69− case SYSTEM_RAM_LOW:
70− add_memory_region(loongson_memmap->map[i].mem_start,
71− (u64)loongson_memmap->map[i].mem_size << 20,
72− BOOT_MEM_RAM);
73− break;
74− case SYSTEM_RAM_HIGH:
75− add_memory_region(loongson_memmap->map[i].mem_start,
76− (u64)loongson_memmap->map[i].mem_size << 20,
77− BOOT_MEM_RAM);
78− break;
79− case SYSTEM_RAM_RESERVED:
80− add_memory_region(loongson_memmap->map[i].mem_start,
81− (u64)loongson_memmap->map[i].mem_size << 20,
82− BOOT_MEM_RESERVED);
83− break;
84− }
68+ if (node_id != 0)
69+ continue;
70+
71+ switch (mem_type) {
72+ case SYSTEM_RAM_LOW:
73+ memblock_add(loongson_memmap->map[i].mem_start,
74+ (u64)loongson_memmap->map[i].mem_size << 20);
75+ break;
76+ case SYSTEM_RAM_HIGH:
77+ memblock_add(loongson_memmap->map[i].mem_start,
78+ (u64)loongson_memmap->map[i].mem_size << 20);
79+ break;
80+ case SYSTEM_RAM_RESERVED:
81+ memblock_reserve(loongson_memmap->map[i].mem_start,
82+ (u64)loongson_memmap->map[i].mem_size << 20);
83+ break;
8584 }
8685 }
8786 }
arch/mips/loongson64/common/serial.c+1−1
@@ -110,7 +110,7 @@ static int __init serial_init(void) · 109 unmodified lines
110110 }
111111 module_init(serial_init);
112112
113−static void __init serial_exit(void)
113+static void __exit serial_exit(void)
114114 {
115115 platform_device_unregister(&uart8250_device);
116116 }
arch/mips/loongson64/loongson-3/numa.c+1−10
@@ -142,8 +142,6 @@ static void __init szmem(unsigned int node) · 141 unmodified lines
142142 (u32)node_id, mem_type, mem_start, mem_size);
143143 pr_info(" start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n",
144144 start_pfn, end_pfn, num_physpages);
145− add_memory_region((node_id << 44) + mem_start,
146− (u64)mem_size << 20, BOOT_MEM_RAM);
147145 memblock_add_node(PFN_PHYS(start_pfn),
148146 PFN_PHYS(end_pfn - start_pfn), node);
149147 break;
@@ -156,16 +154,12 @@ static void __init szmem(unsigned int node) · 6 unmodified lines
156154 (u32)node_id, mem_type, mem_start, mem_size);
157155 pr_info(" start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n",
158156 start_pfn, end_pfn, num_physpages);
159− add_memory_region((node_id << 44) + mem_start,
160− (u64)mem_size << 20, BOOT_MEM_RAM);
161157 memblock_add_node(PFN_PHYS(start_pfn),
162158 PFN_PHYS(end_pfn - start_pfn), node);
163159 break;
164160 case SYSTEM_RAM_RESERVED:
165161 pr_info("Node%d: mem_type:%d, mem_start:0x%llx, mem_size:0x%llx MB\n",
166162 (u32)node_id, mem_type, mem_start, mem_size);
167− add_memory_region((node_id << 44) + mem_start,
168− (u64)mem_size << 20, BOOT_MEM_RESERVED);
169163 memblock_reserve(((node_id << 44) + mem_start),
170164 mem_size << 20);
171165 break;
@@ -191,8 +185,6 @@ static void __init node_mem_init(unsigned int node) · 19 unmodified lines
191185 NODE_DATA(node)->node_start_pfn = start_pfn;
192186 NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn;
193187
194− free_bootmem_with_active_regions(node, end_pfn);
195−
196188 if (node == 0) {
197189 /* kernel end address */
198190 unsigned long kernel_end_pfn = PFN_UP(__pa_symbol(&_end));
@@ -209,8 +201,6 @@ static void __init node_mem_init(unsigned int node) · 10 unmodified lines
209201 memblock_reserve((node_addrspace_offset | 0xfe000000),
210202 32 << 20);
211203 }
212−
213− sparse_memory_present_with_active_regions(node);
214204 }
215205
216206 static __init void prom_meminit(void)
@@ -227,6 +217,7 @@ static __init void prom_meminit(void) · 10 unmodified lines
227217 cpumask_clear(&__node_data[(node)]->cpumask);
228218 }
229219 }
220+ memblocks_present();
230221 max_low_pfn = PHYS_PFN(memblock_end_of_DRAM());
231222
232223 for (cpu = 0; cpu < loongson_sysconf.nr_cpus; cpu++) {
arch/mips/pmcs-msp71xx/msp_prom.c+2−2
@@ -61,6 +61,7 @@ int init_debug = 1; · 60 unmodified lines
6161 /* memory blocks */
6262 struct prom_pmemblock mdesc[PROM_MAX_PMEMBLOCKS];
6363
64+#define MAX_PROM_MEM 5
6465 static phys_addr_t prom_mem_base[MAX_PROM_MEM] __initdata;
6566 static phys_addr_t prom_mem_size[MAX_PROM_MEM] __initdata;
6667 static unsigned int nr_prom_mem __initdata;
@@ -358,7 +359,7 @@ void __init prom_meminit(void) · 291 unmodified lines
358359 p++;
359360
360361 if (type == BOOT_MEM_ROM_DATA) {
361− if (nr_prom_mem >= 5) {
362+ if (nr_prom_mem >= MAX_PROM_MEM) {
362363 pr_err("Too many ROM DATA regions");
363364 continue;
364365 }
@@ -377,7 +378,6 @@ void __init prom_free_prom_memory(void) · 12 unmodified lines
377378 char *ptr;
378379 int len = 0;
379380 int i;
380− unsigned long addr;
381381
382382 /*
383383 * preserve environment variables and command line from pmon/bbload
arch/mips/vdso/Makefile+1−1
@@ -59,7 +59,7 @@ CFLAGS_REMOVE_vgettimeofday.o = -pg · 58 unmodified lines
5959 ifndef CONFIG_CPU_MIPSR6
6060 ifeq ($(call ld-ifversion, -lt, 225000000, y),y)
6161 $(warning MIPS VDSO requires binutils >= 2.25)
62− obj-vdso-y := $(filter-out gettimeofday.o, $(obj-vdso-y))
62+ obj-vdso-y := $(filter-out vgettimeofday.o, $(obj-vdso-y))
6363 ccflags-vdso += -DDISABLE_MIPS_VDSO
6464 endif
6565 endif
arch/mips/vdso/gettimeofday.c+0−269
@@ -1,269 +0,0 @@
1−// SPDX-License-Identifier: GPL-2.0-or-later
2−/*
3− * Copyright (C) 2015 Imagination Technologies
4− * Author: Alex Smith <alex.smith@imgtec.com>
5− */
6−
7−#include "vdso.h"
8−
9−#include <linux/compiler.h>
10−#include <linux/time.h>
11−
12−#include <asm/clocksource.h>
13−#include <asm/io.h>
14−#include <asm/unistd.h>
15−#include <asm/vdso.h>
16−
17−#ifdef CONFIG_MIPS_CLOCK_VSYSCALL
18−
19−static __always_inline long gettimeofday_fallback(struct timeval *_tv,
20− struct timezone *_tz)
21−{
22− register struct timezone *tz asm("a1") = _tz;
23− register struct timeval *tv asm("a0") = _tv;
24− register long ret asm("v0");
25− register long nr asm("v0") = __NR_gettimeofday;
26− register long error asm("a3");
27−
28− asm volatile(
29− " syscall\n"
30− : "=r" (ret), "=r" (error)
31− : "r" (tv), "r" (tz), "r" (nr)
32− : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
33− "$14", "$15", "$24", "$25", "hi", "lo", "memory");
34−
35− return error ? -ret : ret;
36−}
37−
38−#endif
39−
40−static __always_inline long clock_gettime_fallback(clockid_t _clkid,
41− struct timespec *_ts)
42−{
43− register struct timespec *ts asm("a1") = _ts;
44− register clockid_t clkid asm("a0") = _clkid;
45− register long ret asm("v0");
46− register long nr asm("v0") = __NR_clock_gettime;
47− register long error asm("a3");
48−
49− asm volatile(
50− " syscall\n"
51− : "=r" (ret), "=r" (error)
52− : "r" (clkid), "r" (ts), "r" (nr)
53− : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
54− "$14", "$15", "$24", "$25", "hi", "lo", "memory");
55−
56− return error ? -ret : ret;
57−}
58−
59−static __always_inline int do_realtime_coarse(struct timespec *ts,
60− const union mips_vdso_data *data)
61−{
62− u32 start_seq;
63−
64− do {
65− start_seq = vdso_data_read_begin(data);
66−
67− ts->tv_sec = data->xtime_sec;
68− ts->tv_nsec = data->xtime_nsec >> data->cs_shift;
69− } while (vdso_data_read_retry(data, start_seq));
70−
71− return 0;
72−}
73−
74−static __always_inline int do_monotonic_coarse(struct timespec *ts,
75− const union mips_vdso_data *data)
76−{
77− u32 start_seq;
78− u64 to_mono_sec;
79− u64 to_mono_nsec;
80−
81− do {
82− start_seq = vdso_data_read_begin(data);
83−
84− ts->tv_sec = data->xtime_sec;
85− ts->tv_nsec = data->xtime_nsec >> data->cs_shift;
86−
87− to_mono_sec = data->wall_to_mono_sec;
88− to_mono_nsec = data->wall_to_mono_nsec;
89− } while (vdso_data_read_retry(data, start_seq));
90−
91− ts->tv_sec += to_mono_sec;
92− timespec_add_ns(ts, to_mono_nsec);
93−
94− return 0;
95−}
96−
97−#ifdef CONFIG_CSRC_R4K
98−
99−static __always_inline u64 read_r4k_count(void)
100−{
101− unsigned int count;
102−
103− __asm__ __volatile__(
104− " .set push\n"
105− " .set mips32r2\n"
106− " rdhwr %0, $2\n"
107− " .set pop\n"
108− : "=r" (count));
109−
110− return count;
111−}
112−
113−#endif
114−
115−#ifdef CONFIG_CLKSRC_MIPS_GIC
116−
117−static __always_inline u64 read_gic_count(const union mips_vdso_data *data)
118−{
119− void __iomem *gic = get_gic(data);
120− u32 hi, hi2, lo;
121−
122− do {
123− hi = __raw_readl(gic + sizeof(lo));
124− lo = __raw_readl(gic);
125− hi2 = __raw_readl(gic + sizeof(lo));
126− } while (hi2 != hi);
127−
128− return (((u64)hi) << 32) + lo;
129−}
130−
131−#endif
132−
133−static __always_inline u64 get_ns(const union mips_vdso_data *data)
134−{
135− u64 cycle_now, delta, nsec;
136−
137− switch (data->clock_mode) {
138−#ifdef CONFIG_CSRC_R4K
139− case VDSO_CLOCK_R4K:
140− cycle_now = read_r4k_count();
141− break;
142−#endif
143−#ifdef CONFIG_CLKSRC_MIPS_GIC
144− case VDSO_CLOCK_GIC:
145− cycle_now = read_gic_count(data);
146− break;
147−#endif
148− default:
149− return 0;
150− }
151−
152− delta = (cycle_now - data->cs_cycle_last) & data->cs_mask;
153−
154− nsec = (delta * data->cs_mult) + data->xtime_nsec;
155− nsec >>= data->cs_shift;
156−
157− return nsec;
158−}
159−
160−static __always_inline int do_realtime(struct timespec *ts,
161− const union mips_vdso_data *data)
162−{
163− u32 start_seq;
164− u64 ns;
165−
166− do {
167− start_seq = vdso_data_read_begin(data);
168−
169− if (data->clock_mode == VDSO_CLOCK_NONE)
170− return -ENOSYS;
171−
172− ts->tv_sec = data->xtime_sec;
173− ns = get_ns(data);
174− } while (vdso_data_read_retry(data, start_seq));
175−
176− ts->tv_nsec = 0;
177− timespec_add_ns(ts, ns);
178−
179− return 0;
180−}
181−
182−static __always_inline int do_monotonic(struct timespec *ts,
183− const union mips_vdso_data *data)
184−{
185− u32 start_seq;
186− u64 ns;
187− u64 to_mono_sec;
188− u64 to_mono_nsec;
189−
190− do {
191− start_seq = vdso_data_read_begin(data);
192−
193− if (data->clock_mode == VDSO_CLOCK_NONE)
194− return -ENOSYS;
195−
196− ts->tv_sec = data->xtime_sec;
197− ns = get_ns(data);
198−
199− to_mono_sec = data->wall_to_mono_sec;
200− to_mono_nsec = data->wall_to_mono_nsec;
201− } while (vdso_data_read_retry(data, start_seq));
202−
203− ts->tv_sec += to_mono_sec;
204− ts->tv_nsec = 0;
205− timespec_add_ns(ts, ns + to_mono_nsec);
206−
207− return 0;
208−}
209−
210−#ifdef CONFIG_MIPS_CLOCK_VSYSCALL
211−
212−/*
213− * This is behind the ifdef so that we don't provide the symbol when there's no
214− * possibility of there being a usable clocksource, because there's nothing we
215− * can do without it. When libc fails the symbol lookup it should fall back on
216− * the standard syscall path.
217− */
218−int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz)
219−{
220− const union mips_vdso_data *data = get_vdso_data();
221− struct timespec ts;
222− int ret;
223−
224− ret = do_realtime(&ts, data);
225− if (ret)
226− return gettimeofday_fallback(tv, tz);
227−
228− if (tv) {
229− tv->tv_sec = ts.tv_sec;
230− tv->tv_usec = ts.tv_nsec / 1000;
231− }
232−
233− if (tz) {
234− tz->tz_minuteswest = data->tz_minuteswest;
235− tz->tz_dsttime = data->tz_dsttime;
236− }
237−
238− return 0;
239−}
240−
241−#endif /* CONFIG_MIPS_CLOCK_VSYSCALL */
242−
243−int __vdso_clock_gettime(clockid_t clkid, struct timespec *ts)
244−{
245− const union mips_vdso_data *data = get_vdso_data();
246− int ret = -1;
247−
248− switch (clkid) {
249− case CLOCK_REALTIME_COARSE:
250− ret = do_realtime_coarse(ts, data);
251− break;
252− case CLOCK_MONOTONIC_COARSE:
253− ret = do_monotonic_coarse(ts, data);
254− break;
255− case CLOCK_REALTIME:
256− ret = do_realtime(ts, data);
257− break;
258− case CLOCK_MONOTONIC:
259− ret = do_monotonic(ts, data);
260− break;
261− default:
262− break;
263− }
264−
265− if (ret)
266− ret = clock_gettime_fallback(clkid, ts);
267−
268− return ret;
269−}
arch/powerpc/boot/Makefile+1−1
@@ -50,7 +50,7 @@ endif · 49 unmodified lines
5050
5151 BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -nostdinc
5252
53−BOOTARFLAGS := -cr$(KBUILD_ARFLAGS)
53+BOOTARFLAGS := -crD
5454
5555 ifdef CONFIG_CC_IS_CLANG
5656 BOOTCFLAGS += $(CLANG_FLAGS)
arch/powerpc/kvm/book3s.c+4−4
@@ -36,8 +36,8 @@ · 35 unmodified lines
3636 #include "book3s.h"
3737 #include "trace.h"
3838
39−#define VM_STAT(x) offsetof(struct kvm, stat.x), KVM_STAT_VM
40−#define VCPU_STAT(x) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU
39+#define VM_STAT(x, ...) offsetof(struct kvm, stat.x), KVM_STAT_VM, ## __VA_ARGS__
40+#define VCPU_STAT(x, ...) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU, ## __VA_ARGS__
4141
4242 /* #define EXIT_DEBUG */
4343
@@ -69,8 +69,8 @@ struct kvm_stats_debugfs_item debugfs_entries[] = { · 25 unmodified lines
6969 { "pthru_all", VCPU_STAT(pthru_all) },
7070 { "pthru_host", VCPU_STAT(pthru_host) },
7171 { "pthru_bad_aff", VCPU_STAT(pthru_bad_aff) },
72− { "largepages_2M", VM_STAT(num_2M_pages) },
73− { "largepages_1G", VM_STAT(num_1G_pages) },
72+ { "largepages_2M", VM_STAT(num_2M_pages, .mode = 0444) },
73+ { "largepages_1G", VM_STAT(num_1G_pages, .mode = 0444) },
7474 { NULL }
7575 };
7676
arch/riscv/include/asm/asm.h+1−0
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222
2323 #define REG_L __REG_SEL(ld, lw)
2424 #define REG_S __REG_SEL(sd, sw)
25+#define REG_SC __REG_SEL(sc.d, sc.w)
2526 #define SZREG __REG_SEL(8, 4)
2627 #define LGREG __REG_SEL(3, 2)
2728
arch/riscv/kernel/entry.S+20−1
@@ -98,7 +98,26 @@ _save_context: · 97 unmodified lines
9898 */
9999 .macro RESTORE_ALL
100100 REG_L a0, PT_SSTATUS(sp)
101− REG_L a2, PT_SEPC(sp)
101+ /*
102+ * The current load reservation is effectively part of the processor's
103+ * state, in the sense that load reservations cannot be shared between
104+ * different hart contexts. We can't actually save and restore a load
105+ * reservation, so instead here we clear any existing reservation --
106+ * it's always legal for implementations to clear load reservations at
107+ * any point (as long as the forward progress guarantee is kept, but
108+ * we'll ignore that here).
109+ *
110+ * Dangling load reservations can be the result of taking a trap in the
111+ * middle of an LR/SC sequence, but can also be the result of a taken
112+ * forward branch around an SC -- which is how we implement CAS. As a
113+ * result we need to clear reservations between the last CAS and the
114+ * jump back to the new context. While it is unlikely the store
115+ * completes, implementations are allowed to expand reservations to be
116+ * arbitrarily large.
117+ */
118+ REG_L a2, PT_SEPC(sp)
119+ REG_SC x0, a2, PT_SEPC(sp)
120+
102121 csrw CSR_SSTATUS, a0
103122 csrw CSR_SEPC, a2
104123
arch/riscv/mm/init.c+11−1
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #include <linux/swap.h>
1212 #include <linux/sizes.h>
1313 #include <linux/of_fdt.h>
14+#include <linux/libfdt.h>
1415
1516 #include <asm/fixmap.h>
1617 #include <asm/tlbflush.h>
@@ -82,6 +83,8 @@ disable: · 65 unmodified lines
8283 }
8384 #endif /* CONFIG_BLK_DEV_INITRD */
8485
86+static phys_addr_t dtb_early_pa __initdata;
87+
8588 void __init setup_bootmem(void)
8689 {
8790 struct memblock_region *reg;
@@ -117,7 +120,12 @@ void __init setup_bootmem(void) · 29 unmodified lines
117120 setup_initrd();
118121 #endif /* CONFIG_BLK_DEV_INITRD */
119122
120− early_init_fdt_reserve_self();
123+ /*
124+ * Avoid using early_init_fdt_reserve_self() since __pa() does
125+ * not work for DTB pointers that are fixmap addresses
126+ */
127+ memblock_reserve(dtb_early_pa, fdt_totalsize(dtb_early_va));
128+
121129 early_init_fdt_scan_reserved_mem();
122130 memblock_allow_resize();
123131 memblock_dump_all();
@@ -393,6 +401,8 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa) · 269 unmodified lines
393401
394402 /* Save pointer to DTB for early FDT parsing */
395403 dtb_early_va = (void *)fix_to_virt(FIX_FDT) + (dtb_pa & ~PAGE_MASK);
404+ /* Save physical address for memblock reservation */
405+ dtb_early_pa = dtb_pa;
396406 }
397407
398408 static void __init setup_vm_final(void)
arch/s390/configs/debug_defconfig+16−8
@@ -44,6 +44,7 @@ CONFIG_NR_CPUS=512 · 43 unmodified lines
4444 CONFIG_NUMA=y
4545 CONFIG_HZ_100=y
4646 CONFIG_KEXEC_FILE=y
47+CONFIG_KEXEC_SIG=y
4748 CONFIG_EXPOLINE=y
4849 CONFIG_EXPOLINE_AUTO=y
4950 CONFIG_CHSC_SCH=y
@@ -69,12 +70,13 @@ CONFIG_MODULE_UNLOAD=y · 19 unmodified lines
6970 CONFIG_MODULE_FORCE_UNLOAD=y
7071 CONFIG_MODVERSIONS=y
7172 CONFIG_MODULE_SRCVERSION_ALL=y
72−CONFIG_MODULE_SIG=y
7373 CONFIG_MODULE_SIG_SHA256=y
74+CONFIG_UNUSED_SYMBOLS=y
7475 CONFIG_BLK_DEV_INTEGRITY=y
7576 CONFIG_BLK_DEV_THROTTLING=y
7677 CONFIG_BLK_WBT=y
7778 CONFIG_BLK_CGROUP_IOLATENCY=y
79+CONFIG_BLK_CGROUP_IOCOST=y
7880 CONFIG_PARTITION_ADVANCED=y
7981 CONFIG_IBM_PARTITION=y
8082 CONFIG_BSD_DISKLABEL=y
@@ -370,6 +372,7 @@ CONFIG_NETLINK_DIAG=m · 289 unmodified lines
370372 CONFIG_CGROUP_NET_PRIO=y
371373 CONFIG_BPF_JIT=y
372374 CONFIG_NET_PKTGEN=m
375+# CONFIG_NET_DROP_MONITOR is not set
373376 CONFIG_PCI=y
374377 CONFIG_PCI_DEBUG=y
375378 CONFIG_HOTPLUG_PCI=y
@@ -424,6 +427,7 @@ CONFIG_DM_CRYPT=m · 48 unmodified lines
424427 CONFIG_DM_SNAPSHOT=m
425428 CONFIG_DM_THIN_PROVISIONING=m
426429 CONFIG_DM_WRITECACHE=m
430+CONFIG_DM_CLONE=m
427431 CONFIG_DM_MIRROR=m
428432 CONFIG_DM_LOG_USERSPACE=m
429433 CONFIG_DM_RAID=m
@@ -435,6 +439,7 @@ CONFIG_DM_DELAY=m · 5 unmodified lines
435439 CONFIG_DM_UEVENT=y
436440 CONFIG_DM_FLAKEY=m
437441 CONFIG_DM_VERITY=m
442+CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG=y
438443 CONFIG_DM_SWITCH=m
439444 CONFIG_NETDEVICES=y
440445 CONFIG_BONDING=m
@@ -489,6 +494,7 @@ CONFIG_MLX5_CORE_EN=y · 48 unmodified lines
489494 # CONFIG_NET_VENDOR_NVIDIA is not set
490495 # CONFIG_NET_VENDOR_OKI is not set
491496 # CONFIG_NET_VENDOR_PACKET_ENGINES is not set
497+# CONFIG_NET_VENDOR_PENSANDO is not set
492498 # CONFIG_NET_VENDOR_QLOGIC is not set
493499 # CONFIG_NET_VENDOR_QUALCOMM is not set
494500 # CONFIG_NET_VENDOR_RDC is not set
@@ -538,15 +544,16 @@ CONFIG_WATCHDOG=y · 43 unmodified lines
538544 CONFIG_WATCHDOG_NOWAYOUT=y
539545 CONFIG_SOFT_WATCHDOG=m
540546 CONFIG_DIAG288_WATCHDOG=m
541−CONFIG_DRM=y
542−CONFIG_DRM_VIRTIO_GPU=y
547+CONFIG_FB=y
543548 CONFIG_FRAMEBUFFER_CONSOLE=y
549+CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
544550 # CONFIG_HID is not set
545551 # CONFIG_USB_SUPPORT is not set
546552 CONFIG_INFINIBAND=m
547553 CONFIG_INFINIBAND_USER_ACCESS=m
548554 CONFIG_MLX4_INFINIBAND=m
549555 CONFIG_MLX5_INFINIBAND=m
556+CONFIG_SYNC_FILE=y
550557 CONFIG_VFIO=m
551558 CONFIG_VFIO_PCI=m
552559 CONFIG_VFIO_MDEV=m
@@ -580,6 +587,8 @@ CONFIG_NILFS2_FS=m · 27 unmodified lines
580587 CONFIG_FS_DAX=y
581588 CONFIG_EXPORTFS_BLOCK_OPS=y
582589 CONFIG_FS_ENCRYPTION=y
590+CONFIG_FS_VERITY=y
591+CONFIG_FS_VERITY_BUILTIN_SIGNATURES=y
583592 CONFIG_FANOTIFY=y
584593 CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y
585594 CONFIG_QUOTA_NETLINK_INTERFACE=y
@@ -589,6 +598,7 @@ CONFIG_QFMT_V2=m · 3 unmodified lines
589598 CONFIG_AUTOFS4_FS=m
590599 CONFIG_FUSE_FS=y
591600 CONFIG_CUSE=m
601+CONFIG_VIRTIO_FS=m
592602 CONFIG_OVERLAY_FS=m
593603 CONFIG_FSCACHE=m
594604 CONFIG_CACHEFILES=m
@@ -648,12 +658,15 @@ CONFIG_FORTIFY_SOURCE=y · 53 unmodified lines
648658 CONFIG_SECURITY_SELINUX=y
649659 CONFIG_SECURITY_SELINUX_BOOTPARAM=y
650660 CONFIG_SECURITY_SELINUX_DISABLE=y
661+CONFIG_SECURITY_LOCKDOWN_LSM=y
662+CONFIG_SECURITY_LOCKDOWN_LSM_EARLY=y
651663 CONFIG_INTEGRITY_SIGNATURE=y
652664 CONFIG_INTEGRITY_ASYMMETRIC_KEYS=y
653665 CONFIG_IMA=y
654666 CONFIG_IMA_DEFAULT_HASH_SHA256=y
655667 CONFIG_IMA_WRITE_POLICY=y
656668 CONFIG_IMA_APPRAISE=y
669+CONFIG_LSM="yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor"
657670 CONFIG_CRYPTO_USER=m
658671 # CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
659672 CONFIG_CRYPTO_PCRYPT=m
@@ -664,10 +677,6 @@ CONFIG_CRYPTO_ECDH=m · 4 unmodified lines
664677 CONFIG_CRYPTO_ECRDSA=m
665678 CONFIG_CRYPTO_CHACHA20POLY1305=m
666679 CONFIG_CRYPTO_AEGIS128=m
667−CONFIG_CRYPTO_AEGIS128L=m
668−CONFIG_CRYPTO_AEGIS256=m
669−CONFIG_CRYPTO_MORUS640=m
670−CONFIG_CRYPTO_MORUS1280=m
671680 CONFIG_CRYPTO_CFB=m
672681 CONFIG_CRYPTO_LRW=m
673682 CONFIG_CRYPTO_PCBC=m
@@ -739,7 +748,6 @@ CONFIG_DEBUG_INFO=y · 65 unmodified lines
739748 CONFIG_DEBUG_INFO_DWARF4=y
740749 CONFIG_GDB_SCRIPTS=y
741750 CONFIG_FRAME_WARN=1024
742−CONFIG_UNUSED_SYMBOLS=y
743751 CONFIG_HEADERS_INSTALL=y
744752 CONFIG_HEADERS_CHECK=y
745753 CONFIG_DEBUG_SECTION_MISMATCH=y
arch/s390/configs/defconfig+16−9
@@ -44,6 +44,7 @@ CONFIG_NUMA=y · 43 unmodified lines
4444 # CONFIG_NUMA_EMU is not set
4545 CONFIG_HZ_100=y
4646 CONFIG_KEXEC_FILE=y
47+CONFIG_KEXEC_SIG=y
4748 CONFIG_EXPOLINE=y
4849 CONFIG_EXPOLINE_AUTO=y
4950 CONFIG_CHSC_SCH=y
@@ -66,11 +67,12 @@ CONFIG_MODULE_UNLOAD=y · 16 unmodified lines
6667 CONFIG_MODULE_FORCE_UNLOAD=y
6768 CONFIG_MODVERSIONS=y
6869 CONFIG_MODULE_SRCVERSION_ALL=y
69−CONFIG_MODULE_SIG=y
7070 CONFIG_MODULE_SIG_SHA256=y
71+CONFIG_UNUSED_SYMBOLS=y
7172 CONFIG_BLK_DEV_THROTTLING=y
7273 CONFIG_BLK_WBT=y
7374 CONFIG_BLK_CGROUP_IOLATENCY=y
75+CONFIG_BLK_CGROUP_IOCOST=y
7476 CONFIG_PARTITION_ADVANCED=y
7577 CONFIG_IBM_PARTITION=y
7678 CONFIG_BSD_DISKLABEL=y
@@ -363,6 +365,7 @@ CONFIG_NETLINK_DIAG=m · 286 unmodified lines
363365 CONFIG_CGROUP_NET_PRIO=y
364366 CONFIG_BPF_JIT=y
365367 CONFIG_NET_PKTGEN=m
368+# CONFIG_NET_DROP_MONITOR is not set
366369 CONFIG_PCI=y
367370 CONFIG_HOTPLUG_PCI=y
368371 CONFIG_HOTPLUG_PCI_S390=y
@@ -418,6 +421,7 @@ CONFIG_DM_CRYPT=m · 49 unmodified lines
418421 CONFIG_DM_SNAPSHOT=m
419422 CONFIG_DM_THIN_PROVISIONING=m
420423 CONFIG_DM_WRITECACHE=m
424+CONFIG_DM_CLONE=m
421425 CONFIG_DM_MIRROR=m
422426 CONFIG_DM_LOG_USERSPACE=m
423427 CONFIG_DM_RAID=m
@@ -429,6 +433,7 @@ CONFIG_DM_DELAY=m · 5 unmodified lines
429433 CONFIG_DM_UEVENT=y
430434 CONFIG_DM_FLAKEY=m
431435 CONFIG_DM_VERITY=m
436+CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG=y
432437 CONFIG_DM_SWITCH=m
433438 CONFIG_DM_INTEGRITY=m
434439 CONFIG_NETDEVICES=y
@@ -484,6 +489,7 @@ CONFIG_MLX5_CORE_EN=y · 49 unmodified lines
484489 # CONFIG_NET_VENDOR_NVIDIA is not set
485490 # CONFIG_NET_VENDOR_OKI is not set
486491 # CONFIG_NET_VENDOR_PACKET_ENGINES is not set
492+# CONFIG_NET_VENDOR_PENSANDO is not set
487493 # CONFIG_NET_VENDOR_QLOGIC is not set
488494 # CONFIG_NET_VENDOR_QUALCOMM is not set
489495 # CONFIG_NET_VENDOR_RDC is not set
@@ -533,16 +539,16 @@ CONFIG_WATCHDOG_CORE=y · 43 unmodified lines
533539 CONFIG_WATCHDOG_NOWAYOUT=y
534540 CONFIG_SOFT_WATCHDOG=m
535541 CONFIG_DIAG288_WATCHDOG=m
536−CONFIG_DRM=y
537−CONFIG_DRM_VIRTIO_GPU=y
538−# CONFIG_BACKLIGHT_CLASS_DEVICE is not set
542+CONFIG_FB=y
539543 CONFIG_FRAMEBUFFER_CONSOLE=y
544+CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
540545 # CONFIG_HID is not set
541546 # CONFIG_USB_SUPPORT is not set
542547 CONFIG_INFINIBAND=m
543548 CONFIG_INFINIBAND_USER_ACCESS=m
544549 CONFIG_MLX4_INFINIBAND=m
545550 CONFIG_MLX5_INFINIBAND=m
551+CONFIG_SYNC_FILE=y
546552 CONFIG_VFIO=m
547553 CONFIG_VFIO_PCI=m
548554 CONFIG_VFIO_MDEV=m
@@ -573,6 +579,8 @@ CONFIG_NILFS2_FS=m · 24 unmodified lines
573579 CONFIG_FS_DAX=y
574580 CONFIG_EXPORTFS_BLOCK_OPS=y
575581 CONFIG_FS_ENCRYPTION=y
582+CONFIG_FS_VERITY=y
583+CONFIG_FS_VERITY_BUILTIN_SIGNATURES=y
576584 CONFIG_FANOTIFY=y
577585 CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y
578586 CONFIG_QUOTA_NETLINK_INTERFACE=y
@@ -581,6 +589,7 @@ CONFIG_QFMT_V2=m · 2 unmodified lines
581589 CONFIG_AUTOFS4_FS=m
582590 CONFIG_FUSE_FS=y
583591 CONFIG_CUSE=m
592+CONFIG_VIRTIO_FS=m
584593 CONFIG_OVERLAY_FS=m
585594 CONFIG_FSCACHE=m
586595 CONFIG_CACHEFILES=m
@@ -639,12 +648,15 @@ CONFIG_SECURITY_NETWORK=y · 52 unmodified lines
639648 CONFIG_SECURITY_SELINUX=y
640649 CONFIG_SECURITY_SELINUX_BOOTPARAM=y
641650 CONFIG_SECURITY_SELINUX_DISABLE=y
651+CONFIG_SECURITY_LOCKDOWN_LSM=y
652+CONFIG_SECURITY_LOCKDOWN_LSM_EARLY=y
642653 CONFIG_INTEGRITY_SIGNATURE=y
643654 CONFIG_INTEGRITY_ASYMMETRIC_KEYS=y
644655 CONFIG_IMA=y
645656 CONFIG_IMA_DEFAULT_HASH_SHA256=y
646657 CONFIG_IMA_WRITE_POLICY=y
647658 CONFIG_IMA_APPRAISE=y
659+CONFIG_LSM="yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor"
648660 CONFIG_CRYPTO_FIPS=y
649661 CONFIG_CRYPTO_USER=m
650662 # CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
@@ -656,10 +668,6 @@ CONFIG_CRYPTO_ECDH=m · 5 unmodified lines
656668 CONFIG_CRYPTO_ECRDSA=m
657669 CONFIG_CRYPTO_CHACHA20POLY1305=m
658670 CONFIG_CRYPTO_AEGIS128=m
659−CONFIG_CRYPTO_AEGIS128L=m
660−CONFIG_CRYPTO_AEGIS256=m
661−CONFIG_CRYPTO_MORUS640=m
662−CONFIG_CRYPTO_MORUS1280=m
663671 CONFIG_CRYPTO_CFB=m
664672 CONFIG_CRYPTO_LRW=m
665673 CONFIG_CRYPTO_OFB=m
@@ -727,7 +735,6 @@ CONFIG_DEBUG_INFO=y · 61 unmodified lines
727735 CONFIG_DEBUG_INFO_DWARF4=y
728736 CONFIG_GDB_SCRIPTS=y
729737 CONFIG_FRAME_WARN=1024
730−CONFIG_UNUSED_SYMBOLS=y
731738 CONFIG_DEBUG_SECTION_MISMATCH=y
732739 CONFIG_MAGIC_SYSRQ=y
733740 CONFIG_DEBUG_MEMORY_INIT=y
arch/s390/configs/zfcpdump_defconfig+1−1
@@ -61,7 +61,7 @@ CONFIG_RAW_DRIVER=y · 60 unmodified lines
6161 CONFIG_CONFIGFS_FS=y
6262 # CONFIG_MISC_FILESYSTEMS is not set
6363 # CONFIG_NETWORK_FILESYSTEMS is not set
64−# CONFIG_DIMLIB is not set
64+CONFIG_LSM="yama,loadpin,safesetid,integrity"
6565 CONFIG_PRINTK_TIME=y
6666 CONFIG_DEBUG_INFO=y
6767 CONFIG_DEBUG_FS=y
arch/s390/include/asm/atomic_ops.h+1−1
@@ -41,7 +41,7 @@ __ATOMIC_OPS(__atomic64_xor, long, "laxg") · 40 unmodified lines
4141 #undef __ATOMIC_OP
4242
4343 #define __ATOMIC_CONST_OP(op_name, op_type, op_string, op_barrier) \
44−static inline void op_name(op_type val, op_type *ptr) \
44+static __always_inline void op_name(op_type val, op_type *ptr) \
4545 { \
4646 asm volatile( \
4747 op_string " %[ptr],%[val]\n" \
arch/s390/include/asm/bitops.h+4−4
@@ -56,7 +56,7 @@ __bitops_byte(unsigned long nr, volatile unsigned long *ptr) · 55 unmodified lines
5656 return ((unsigned char *)ptr) + ((nr ^ (BITS_PER_LONG - 8)) >> 3);
5757 }
5858
59−static inline void arch_set_bit(unsigned long nr, volatile unsigned long *ptr)
59+static __always_inline void arch_set_bit(unsigned long nr, volatile unsigned long *ptr)
6060 {
6161 unsigned long *addr = __bitops_word(nr, ptr);
6262 unsigned long mask;
@@ -77,7 +77,7 @@ static inline void arch_set_bit(unsigned long nr, volatile unsigned long *ptr) · 14 unmodified lines
7777 __atomic64_or(mask, (long *)addr);
7878 }
7979
80−static inline void arch_clear_bit(unsigned long nr, volatile unsigned long *ptr)
80+static __always_inline void arch_clear_bit(unsigned long nr, volatile unsigned long *ptr)
8181 {
8282 unsigned long *addr = __bitops_word(nr, ptr);
8383 unsigned long mask;
@@ -98,8 +98,8 @@ static inline void arch_clear_bit(unsigned long nr, volatile unsigned long *ptr) · 14 unmodified lines
9898 __atomic64_and(mask, (long *)addr);
9999 }
100100
101−static inline void arch_change_bit(unsigned long nr,
102− volatile unsigned long *ptr)
101+static __always_inline void arch_change_bit(unsigned long nr,
102+ volatile unsigned long *ptr)
103103 {
104104 unsigned long *addr = __bitops_word(nr, ptr);
105105 unsigned long mask;
arch/s390/include/asm/cpacf.h+1−1
@@ -171,7 +171,7 @@ typedef struct { unsigned char bytes[16]; } cpacf_mask_t; · 170 unmodified lines
171171 *
172172 * Returns 1 if @func is available for @opcode, 0 otherwise
173173 */
174−static inline void __cpacf_query(unsigned int opcode, cpacf_mask_t *mask)
174+static __always_inline void __cpacf_query(unsigned int opcode, cpacf_mask_t *mask)
175175 {
176176 register unsigned long r0 asm("0") = 0; /* query function */
177177 register unsigned long r1 asm("1") = (unsigned long) mask;
arch/s390/include/asm/cpu_mf.h+6−2
@@ -28,6 +28,8 @@ asm(".include \"asm/cpu_mf-insn.h\"\n"); · 27 unmodified lines
2828 CPU_MF_INT_SF_PRA|CPU_MF_INT_SF_SACA| \
2929 CPU_MF_INT_SF_LSDA)
3030
31+#define CPU_MF_SF_RIBM_NOTAV 0x1 /* Sampling unavailable */
32+
3133 /* CPU measurement facility support */
3234 static inline int cpum_cf_avail(void)
3335 {
@@ -69,7 +71,8 @@ struct hws_qsi_info_block { /* Bit(s) */ · 35 unmodified lines
6971 unsigned long max_sampl_rate; /* 16-23: maximum sampling interval*/
7072 unsigned long tear; /* 24-31: TEAR contents */
7173 unsigned long dear; /* 32-39: DEAR contents */
72− unsigned int rsvrd0; /* 40-43: reserved */
74+ unsigned int rsvrd0:24; /* 40-42: reserved */
75+ unsigned int ribm:8; /* 43: Reserved by IBM */
7376 unsigned int cpu_speed; /* 44-47: CPU speed */
7477 unsigned long long rsvrd1; /* 48-55: reserved */
7578 unsigned long long rsvrd2; /* 56-63: reserved */
@@ -220,7 +223,8 @@ enum stcctm_ctr_set { · 144 unmodified lines
220223 MT_DIAG = 5,
221224 MT_DIAG_CLEARING = 9, /* clears loss-of-MT-ctr-data alert */
222225 };
223−static inline int stcctm(enum stcctm_ctr_set set, u64 range, u64 *dest)
226+
227+static __always_inline int stcctm(enum stcctm_ctr_set set, u64 range, u64 *dest)
224228 {
225229 int cc;
226230
arch/s390/include/asm/hugetlb.h+7−2
@@ -12,8 +12,6 @@ · 11 unmodified lines
1212 #include <asm/page.h>
1313 #include <asm/pgtable.h>
1414
15−
16−#define is_hugepage_only_range(mm, addr, len) 0
1715 #define hugetlb_free_pgd_range free_pgd_range
1816 #define hugepages_supported() (MACHINE_HAS_EDAT1)
1917
@@ -23,6 +21,13 @@ pte_t huge_ptep_get(pte_t *ptep); · 3 unmodified lines
2321 pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
2422 unsigned long addr, pte_t *ptep);
2523
24+static inline bool is_hugepage_only_range(struct mm_struct *mm,
25+ unsigned long addr,
26+ unsigned long len)
27+{
28+ return false;
29+}
30+
2631 /*
2732 * If the arch doesn't supply something else, assume that hugepage
2833 * size aligned regions are ok without further preparation.
arch/s390/include/asm/jump_label.h+2−2
@@ -20,7 +20,7 @@ · 19 unmodified lines
2020 * We use a brcl 0,2 instruction for jump labels at compile time so it
2121 * can be easily distinguished from a hotpatch generated instruction.
2222 */
23−static inline bool arch_static_branch(struct static_key *key, bool branch)
23+static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
2424 {
2525 asm_volatile_goto("0: brcl 0,"__stringify(JUMP_LABEL_NOP_OFFSET)"\n"
2626 ".pushsection __jump_table,\"aw\"\n"
@@ -34,7 +34,7 @@ label: · 7 unmodified lines
3434 return true;
3535 }
3636
37−static inline bool arch_static_branch_jump(struct static_key *key, bool branch)
37+static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
3838 {
3939 asm_volatile_goto("0: brcl 15,%l[label]\n"
4040 ".pushsection __jump_table,\"aw\"\n"
arch/s390/include/asm/pgtable.h+13−12
@@ -997,9 +997,9 @@ static inline pte_t pte_mkhuge(pte_t pte) · 996 unmodified lines
997997 #define IPTE_NODAT 0x400
998998 #define IPTE_GUEST_ASCE 0x800
999999
1000−static inline void __ptep_ipte(unsigned long address, pte_t *ptep,
1001− unsigned long opt, unsigned long asce,
1002− int local)
1000+static __always_inline void __ptep_ipte(unsigned long address, pte_t *ptep,
1001+ unsigned long opt, unsigned long asce,
1002+ int local)
10031003 {
10041004 unsigned long pto = (unsigned long) ptep;
10051005
@@ -1020,8 +1020,8 @@ static inline void __ptep_ipte(unsigned long address, pte_t *ptep, · 14 unmodified lines
10201020 : [r1] "a" (pto), [m4] "i" (local) : "memory");
10211021 }
10221022
1023−static inline void __ptep_ipte_range(unsigned long address, int nr,
1024− pte_t *ptep, int local)
1023+static __always_inline void __ptep_ipte_range(unsigned long address, int nr,
1024+ pte_t *ptep, int local)
10251025 {
10261026 unsigned long pto = (unsigned long) ptep;
10271027
@@ -1269,7 +1269,8 @@ static inline pte_t *pte_offset(pmd_t *pmd, unsigned long address) · 241 unmodified lines
12691269
12701270 #define pte_offset_kernel(pmd, address) pte_offset(pmd, address)
12711271 #define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address)
1272−#define pte_unmap(pte) do { } while (0)
1272+
1273+static inline void pte_unmap(pte_t *pte) { }
12731274
12741275 static inline bool gup_fast_permitted(unsigned long start, unsigned long end)
12751276 {
@@ -1435,9 +1436,9 @@ static inline void __pmdp_csp(pmd_t *pmdp) · 159 unmodified lines
14351436 #define IDTE_NODAT 0x1000
14361437 #define IDTE_GUEST_ASCE 0x2000
14371438
1438−static inline void __pmdp_idte(unsigned long addr, pmd_t *pmdp,
1439− unsigned long opt, unsigned long asce,
1440− int local)
1439+static __always_inline void __pmdp_idte(unsigned long addr, pmd_t *pmdp,
1440+ unsigned long opt, unsigned long asce,
1441+ int local)
14411442 {
14421443 unsigned long sto;
14431444
@@ -1461,9 +1462,9 @@ static inline void __pmdp_idte(unsigned long addr, pmd_t *pmdp, · 17 unmodified lines
14611462 }
14621463 }
14631464
1464−static inline void __pudp_idte(unsigned long addr, pud_t *pudp,
1465− unsigned long opt, unsigned long asce,
1466− int local)
1465+static __always_inline void __pudp_idte(unsigned long addr, pud_t *pudp,
1466+ unsigned long opt, unsigned long asce,
1467+ int local)
14671468 {
14681469 unsigned long r3o;
14691470
arch/s390/include/asm/qdio.h+1−1
@@ -111,7 +111,7 @@ struct qib { · 110 unmodified lines
111111 /* private: */
112112 u8 res[88];
113113 /* public: */
114− u8 parm[QDIO_MAX_BUFFERS_PER_Q];
114+ u8 parm[128];
115115 } __attribute__ ((packed, aligned(256)));
116116
117117 /**
arch/s390/kernel/perf_cpum_cf_diag.c+2−2
@@ -390,7 +390,7 @@ static size_t cf_diag_getctrset(struct cf_ctrset_entry *ctrdata, int ctrset, · 389 unmodified lines
390390
391391 debug_sprintf_event(cf_diag_dbg, 6,
392392 "%s ctrset %d ctrset_size %zu cfvn %d csvn %d"
393− " need %zd rc:%d\n",
393+ " need %zd rc %d\n",
394394 __func__, ctrset, ctrset_size, cpuhw->info.cfvn,
395395 cpuhw->info.csvn, need, rc);
396396 return need;
@@ -567,7 +567,7 @@ static int cf_diag_add(struct perf_event *event, int flags) · 170 unmodified lines
567567 int err = 0;
568568
569569 debug_sprintf_event(cf_diag_dbg, 5,
570− "%s event %p cpu %d flags %#x cpuhw:%p\n",
570+ "%s event %p cpu %d flags %#x cpuhw %p\n",
571571 __func__, event, event->cpu, flags, cpuhw);
572572
573573 if (cpuhw->flags & PMU_F_IN_USE) {
arch/s390/kernel/perf_cpum_sf.c+7−1
@@ -803,6 +803,12 @@ static int __hw_perf_event_init(struct perf_event *event) · 802 unmodified lines
803803 goto out;
804804 }
805805
806+ if (si.ribm & CPU_MF_SF_RIBM_NOTAV) {
807+ pr_warn("CPU Measurement Facility sampling is temporarily not available\n");
808+ err = -EBUSY;
809+ goto out;
810+ }
811+
806812 /* Always enable basic sampling */
807813 SAMPL_FLAGS(hwc) = PERF_CPUM_SF_BASIC_MODE;
808814
@@ -895,7 +901,7 @@ static int cpumsf_pmu_event_init(struct perf_event *event) · 86 unmodified lines
895901
896902 /* Check online status of the CPU to which the event is pinned */
897903 if (event->cpu >= 0 && !cpu_online(event->cpu))
898− return -ENODEV;
904+ return -ENODEV;
899905
900906 /* Force reset of idle/hv excludes regardless of what the
901907 * user requested.
arch/s390/kvm/kvm-s390.c+3−3
@@ -332,7 +332,7 @@ static inline int plo_test_bit(unsigned char nr) · 331 unmodified lines
332332 return cc == 0;
333333 }
334334
335−static inline void __insn32_query(unsigned int opcode, u8 query[32])
335+static __always_inline void __insn32_query(unsigned int opcode, u8 *query)
336336 {
337337 register unsigned long r0 asm("0") = 0; /* query function */
338338 register unsigned long r1 asm("1") = (unsigned long) query;
@@ -340,9 +340,9 @@ static inline void __insn32_query(unsigned int opcode, u8 query[32]) · 1 unmodified line
340340 asm volatile(
341341 /* Parameter regs are ignored */
342342 " .insn rrf,%[opc] << 16,2,4,6,0\n"
343− : "=m" (*query)
343+ :
344344 : "d" (r0), "a" (r1), [opc] "i" (opcode)
345− : "cc");
345+ : "cc", "memory");
346346 }
347347
348348 #define INSN_SORTL 0xb938
arch/s390/pci/pci_clp.c+1−1
@@ -66,7 +66,7 @@ static inline int clp_get_ilp(unsigned long *ilp) · 65 unmodified lines
6666 /*
6767 * Call Logical Processor with c=0, the give constant lps and an lpcb request.
6868 */
69−static inline int clp_req(void *data, unsigned int lps)
69+static __always_inline int clp_req(void *data, unsigned int lps)
7070 {
7171 struct { u8 _[CLP_BLK_SIZE]; } *req = data;
7272 u64 ignored;
arch/x86/include/asm/kvm_host.h+0−7
@@ -219,13 +219,6 @@ enum { · 218 unmodified lines
219219 PFERR_WRITE_MASK | \
220220 PFERR_PRESENT_MASK)
221221
222−/*
223− * The mask used to denote special SPTEs, which can be either MMIO SPTEs or
224− * Access Tracking SPTEs. We use bit 62 instead of bit 63 to avoid conflicting
225− * with the SVE bit in EPT PTEs.
226− */
227−#define SPTE_SPECIAL_MASK (1ULL << 62)
228−
229222 /* apic attention bits */
230223 #define KVM_APIC_CHECK_VAPIC 0
231224 /*
arch/x86/kvm/cpuid.c+60−42
@@ -485,6 +485,7 @@ static inline int __do_cpuid_func(struct kvm_cpuid_entry2 *entry, u32 function, · 484 unmodified lines
485485
486486 /* cpuid 0x80000008.ebx */
487487 const u32 kvm_cpuid_8000_0008_ebx_x86_features =
488+ F(CLZERO) | F(XSAVEERPTR) |
488489 F(WBNOINVD) | F(AMD_IBPB) | F(AMD_IBRS) | F(AMD_SSBD) | F(VIRT_SSBD) |
489490 F(AMD_SSB_NO) | F(AMD_STIBP) | F(AMD_STIBP_ALWAYS_ON);
490491
@@ -618,16 +619,20 @@ static inline int __do_cpuid_func(struct kvm_cpuid_entry2 *entry, u32 function, · 127 unmodified lines
618619 */
619620 case 0x1f:
620621 case 0xb: {
621− int i, level_type;
622+ int i;
622623
623− /* read more entries until level_type is zero */
624− for (i = 1; ; ++i) {
624+ /*
625+ * We filled in entry[0] for CPUID(EAX=<function>,
626+ * ECX=00H) above. If its level type (ECX[15:8]) is
627+ * zero, then the leaf is unimplemented, and we're
628+ * done. Otherwise, continue to populate entries
629+ * until the level type (ECX[15:8]) of the previously
630+ * added entry is zero.
631+ */
632+ for (i = 1; entry[i - 1].ecx & 0xff00; ++i) {
625633 if (*nent >= maxnent)
626634 goto out;
627635
628− level_type = entry[i - 1].ecx & 0xff00;
629− if (!level_type)
630− break;
631636 do_host_cpuid(&entry[i], function, i);
632637 ++*nent;
633638 }
@@ -969,53 +974,66 @@ struct kvm_cpuid_entry2 *kvm_find_cpuid_entry(struct kvm_vcpu *vcpu, · 335 unmodified lines
969974 EXPORT_SYMBOL_GPL(kvm_find_cpuid_entry);
970975
971976 /*
972− * If no match is found, check whether we exceed the vCPU's limit
973− * and return the content of the highest valid _standard_ leaf instead.
974− * This is to satisfy the CPUID specification.
977+ * If the basic or extended CPUID leaf requested is higher than the
978+ * maximum supported basic or extended leaf, respectively, then it is
979+ * out of range.
975980 */
976−static struct kvm_cpuid_entry2* check_cpuid_limit(struct kvm_vcpu *vcpu,
977− u32 function, u32 index)
981+static bool cpuid_function_in_range(struct kvm_vcpu *vcpu, u32 function)
978982 {
979− struct kvm_cpuid_entry2 *maxlevel;
980−
981− maxlevel = kvm_find_cpuid_entry(vcpu, function & 0x80000000, 0);
982− if (!maxlevel || maxlevel->eax >= function)
983− return NULL;
984− if (function & 0x80000000) {
985− maxlevel = kvm_find_cpuid_entry(vcpu, 0, 0);
986− if (!maxlevel)
987− return NULL;
988− }
989− return kvm_find_cpuid_entry(vcpu, maxlevel->eax, index);
983+ struct kvm_cpuid_entry2 *max;
984+
985+ max = kvm_find_cpuid_entry(vcpu, function & 0x80000000, 0);
986+ return max && function <= max->eax;
990987 }
991988
992989 bool kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax, u32 *ebx,
993990 u32 *ecx, u32 *edx, bool check_limit)
994991 {
995992 u32 function = *eax, index = *ecx;
996− struct kvm_cpuid_entry2 *best;
997− bool entry_found = true;
998−
999− best = kvm_find_cpuid_entry(vcpu, function, index);
1000−
1001− if (!best) {
1002− entry_found = false;
1003− if (!check_limit)
1004− goto out;
993+ struct kvm_cpuid_entry2 *entry;
994+ struct kvm_cpuid_entry2 *max;
995+ bool found;
1005996
1006− best = check_cpuid_limit(vcpu, function, index);
997+ entry = kvm_find_cpuid_entry(vcpu, function, index);
998+ found = entry;
999+ /*
1000+ * Intel CPUID semantics treats any query for an out-of-range
1001+ * leaf as if the highest basic leaf (i.e. CPUID.0H:EAX) were
1002+ * requested. AMD CPUID semantics returns all zeroes for any
1003+ * undefined leaf, whether or not the leaf is in range.
1004+ */
1005+ if (!entry && check_limit && !guest_cpuid_is_amd(vcpu) &&
1006+ !cpuid_function_in_range(vcpu, function)) {
1007+ max = kvm_find_cpuid_entry(vcpu, 0, 0);
1008+ if (max) {
1009+ function = max->eax;
1010+ entry = kvm_find_cpuid_entry(vcpu, function, index);
1011+ }
10071012 }
1008−
1009−out:
1010− if (best) {
1011− *eax = best->eax;
1012− *ebx = best->ebx;
1013− *ecx = best->ecx;
1014− *edx = best->edx;
1015− } else
1013+ if (entry) {
1014+ *eax = entry->eax;
1015+ *ebx = entry->ebx;
1016+ *ecx = entry->ecx;
1017+ *edx = entry->edx;
1018+ } else {
10161019 *eax = *ebx = *ecx = *edx = 0;
1017− trace_kvm_cpuid(function, *eax, *ebx, *ecx, *edx, entry_found);
1018− return entry_found;
1020+ /*
1021+ * When leaf 0BH or 1FH is defined, CL is pass-through
1022+ * and EDX is always the x2APIC ID, even for undefined
1023+ * subleaves. Index 1 will exist iff the leaf is
1024+ * implemented, so we pass through CL iff leaf 1
1025+ * exists. EDX can be copied from any existing index.
1026+ */
1027+ if (function == 0xb || function == 0x1f) {
1028+ entry = kvm_find_cpuid_entry(vcpu, function, 1);
1029+ if (entry) {
1030+ *ecx = index & 0xff;
1031+ *edx = entry->edx;
1032+ }
1033+ }
1034+ }
1035+ trace_kvm_cpuid(function, *eax, *ebx, *ecx, *edx, found);
1036+ return found;
10191037 }
10201038 EXPORT_SYMBOL_GPL(kvm_cpuid);
10211039
arch/x86/kvm/lapic.c+7−6
@@ -66,9 +66,10 @@ · 65 unmodified lines
6666 #define X2APIC_BROADCAST 0xFFFFFFFFul
6767
6868 static bool lapic_timer_advance_dynamic __read_mostly;
69−#define LAPIC_TIMER_ADVANCE_ADJUST_MIN 100
70−#define LAPIC_TIMER_ADVANCE_ADJUST_MAX 5000
71−#define LAPIC_TIMER_ADVANCE_ADJUST_INIT 1000
69+#define LAPIC_TIMER_ADVANCE_ADJUST_MIN 100 /* clock cycles */
70+#define LAPIC_TIMER_ADVANCE_ADJUST_MAX 10000 /* clock cycles */
71+#define LAPIC_TIMER_ADVANCE_NS_INIT 1000
72+#define LAPIC_TIMER_ADVANCE_NS_MAX 5000
7273 /* step-by-step approximation to mitigate fluctuation */
7374 #define LAPIC_TIMER_ADVANCE_ADJUST_STEP 8
7475
@@ -1504,8 +1505,8 @@ static inline void adjust_lapic_timer_advance(struct kvm_vcpu *vcpu, · 1429 unmodified lines
15041505 timer_advance_ns += ns/LAPIC_TIMER_ADVANCE_ADJUST_STEP;
15051506 }
15061507
1507− if (unlikely(timer_advance_ns > LAPIC_TIMER_ADVANCE_ADJUST_MAX))
1508− timer_advance_ns = LAPIC_TIMER_ADVANCE_ADJUST_INIT;
1508+ if (unlikely(timer_advance_ns > LAPIC_TIMER_ADVANCE_NS_MAX))
1509+ timer_advance_ns = LAPIC_TIMER_ADVANCE_NS_INIT;
15091510 apic->lapic_timer.timer_advance_ns = timer_advance_ns;
15101511 }
15111512
@@ -2302,7 +2303,7 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu, int timer_advance_ns) · 790 unmodified lines
23022303 HRTIMER_MODE_ABS_HARD);
23032304 apic->lapic_timer.timer.function = apic_timer_fn;
23042305 if (timer_advance_ns == -1) {
2305− apic->lapic_timer.timer_advance_ns = LAPIC_TIMER_ADVANCE_ADJUST_INIT;
2306+ apic->lapic_timer.timer_advance_ns = LAPIC_TIMER_ADVANCE_NS_INIT;
23062307 lapic_timer_advance_dynamic = true;
23072308 } else {
23082309 apic->lapic_timer.timer_advance_ns = timer_advance_ns;
arch/x86/kvm/mmu.c+49−16
@@ -83,7 +83,17 @@ module_param(dbg, bool, 0644); · 82 unmodified lines
8383 #define PTE_PREFETCH_NUM 8
8484
8585 #define PT_FIRST_AVAIL_BITS_SHIFT 10
86−#define PT64_SECOND_AVAIL_BITS_SHIFT 52
86+#define PT64_SECOND_AVAIL_BITS_SHIFT 54
87+
88+/*
89+ * The mask used to denote special SPTEs, which can be either MMIO SPTEs or
90+ * Access Tracking SPTEs.
91+ */
92+#define SPTE_SPECIAL_MASK (3ULL << 52)
93+#define SPTE_AD_ENABLED_MASK (0ULL << 52)
94+#define SPTE_AD_DISABLED_MASK (1ULL << 52)
95+#define SPTE_AD_WRPROT_ONLY_MASK (2ULL << 52)
96+#define SPTE_MMIO_MASK (3ULL << 52)
8797
8898 #define PT64_LEVEL_BITS 9
8999
@@ -219,12 +229,11 @@ static u64 __read_mostly shadow_present_mask; · 129 unmodified lines
219229 static u64 __read_mostly shadow_me_mask;
220230
221231 /*
222− * SPTEs used by MMUs without A/D bits are marked with shadow_acc_track_value.
223− * Non-present SPTEs with shadow_acc_track_value set are in place for access
224− * tracking.
232+ * SPTEs used by MMUs without A/D bits are marked with SPTE_AD_DISABLED_MASK;
233+ * shadow_acc_track_mask is the set of bits to be cleared in non-accessed
234+ * pages.
225235 */
226236 static u64 __read_mostly shadow_acc_track_mask;
227−static const u64 shadow_acc_track_value = SPTE_SPECIAL_MASK;
228237
229238 /*
230239 * The mask/shift to use for saving the original R/X bits when marking the PTE
@@ -304,7 +313,7 @@ void kvm_mmu_set_mmio_spte_mask(u64 mmio_mask, u64 mmio_value, u64 access_mask) · 73 unmodified lines
304313 {
305314 BUG_ON((u64)(unsigned)access_mask != access_mask);
306315 BUG_ON((mmio_mask & mmio_value) != mmio_value);
307− shadow_mmio_value = mmio_value | SPTE_SPECIAL_MASK;
316+ shadow_mmio_value = mmio_value | SPTE_MMIO_MASK;
308317 shadow_mmio_mask = mmio_mask | SPTE_SPECIAL_MASK;
309318 shadow_mmio_access_mask = access_mask;
310319 }
@@ -320,10 +329,27 @@ static inline bool sp_ad_disabled(struct kvm_mmu_page *sp) · 9 unmodified lines
320329 return sp->role.ad_disabled;
321330 }
322331
332+static inline bool kvm_vcpu_ad_need_write_protect(struct kvm_vcpu *vcpu)
333+{
334+ /*
335+ * When using the EPT page-modification log, the GPAs in the log
336+ * would come from L2 rather than L1. Therefore, we need to rely
337+ * on write protection to record dirty pages. This also bypasses
338+ * PML, since writes now result in a vmexit.
339+ */
340+ return vcpu->arch.mmu == &vcpu->arch.guest_mmu;
341+}
342+
323343 static inline bool spte_ad_enabled(u64 spte)
324344 {
325345 MMU_WARN_ON(is_mmio_spte(spte));
326− return !(spte & shadow_acc_track_value);
346+ return (spte & SPTE_SPECIAL_MASK) != SPTE_AD_DISABLED_MASK;
347+}
348+
349+static inline bool spte_ad_need_write_protect(u64 spte)
350+{
351+ MMU_WARN_ON(is_mmio_spte(spte));
352+ return (spte & SPTE_SPECIAL_MASK) != SPTE_AD_ENABLED_MASK;
327353 }
328354
329355 static inline u64 spte_shadow_accessed_mask(u64 spte)
@@ -461,7 +487,7 @@ void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask, · 131 unmodified lines
461487 {
462488 BUG_ON(!dirty_mask != !accessed_mask);
463489 BUG_ON(!accessed_mask && !acc_track_mask);
464− BUG_ON(acc_track_mask & shadow_acc_track_value);
490+ BUG_ON(acc_track_mask & SPTE_SPECIAL_MASK);
465491
466492 shadow_user_mask = user_mask;
467493 shadow_accessed_mask = accessed_mask;
@@ -1589,16 +1615,16 @@ static bool spte_clear_dirty(u64 *sptep) · 1121 unmodified lines
15891615
15901616 rmap_printk("rmap_clear_dirty: spte %p %llx\n", sptep, *sptep);
15911617
1618+ MMU_WARN_ON(!spte_ad_enabled(spte));
15921619 spte &= ~shadow_dirty_mask;
1593−
15941620 return mmu_spte_update(sptep, spte);
15951621 }
15961622
1597−static bool wrprot_ad_disabled_spte(u64 *sptep)
1623+static bool spte_wrprot_for_clear_dirty(u64 *sptep)
15981624 {
15991625 bool was_writable = test_and_clear_bit(PT_WRITABLE_SHIFT,
16001626 (unsigned long *)sptep);
1601− if (was_writable)
1627+ if (was_writable && !spte_ad_enabled(*sptep))
16021628 kvm_set_pfn_dirty(spte_to_pfn(*sptep));
16031629
16041630 return was_writable;
@@ -1617,10 +1643,10 @@ static bool __rmap_clear_dirty(struct kvm *kvm, struct kvm_rmap_head *rmap_head) · 12 unmodified lines
16171643 bool flush = false;
16181644
16191645 for_each_rmap_spte(rmap_head, &iter, sptep)
1620− if (spte_ad_enabled(*sptep))
1621− flush |= spte_clear_dirty(sptep);
1646+ if (spte_ad_need_write_protect(*sptep))
1647+ flush |= spte_wrprot_for_clear_dirty(sptep);
16221648 else
1623− flush |= wrprot_ad_disabled_spte(sptep);
1649+ flush |= spte_clear_dirty(sptep);
16241650
16251651 return flush;
16261652 }
@@ -1631,6 +1657,11 @@ static bool spte_set_dirty(u64 *sptep) · 4 unmodified lines
16311657
16321658 rmap_printk("rmap_set_dirty: spte %p %llx\n", sptep, *sptep);
16331659
1660+ /*
1661+ * Similar to the !kvm_x86_ops->slot_disable_log_dirty case,
1662+ * do not bother adding back write access to pages marked
1663+ * SPTE_AD_WRPROT_ONLY_MASK.
1664+ */
16341665 spte |= shadow_dirty_mask;
16351666
16361667 return mmu_spte_update(sptep, spte);
@@ -2622,7 +2653,7 @@ static void link_shadow_page(struct kvm_vcpu *vcpu, u64 *sptep, · 985 unmodified lines
26222653 shadow_user_mask | shadow_x_mask | shadow_me_mask;
26232654
26242655 if (sp_ad_disabled(sp))
2625− spte |= shadow_acc_track_value;
2656+ spte |= SPTE_AD_DISABLED_MASK;
26262657 else
26272658 spte |= shadow_accessed_mask;
26282659
@@ -2968,7 +2999,9 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep, · 339 unmodified lines
29682999
29693000 sp = page_header(__pa(sptep));
29703001 if (sp_ad_disabled(sp))
2971− spte |= shadow_acc_track_value;
3002+ spte |= SPTE_AD_DISABLED_MASK;
3003+ else if (kvm_vcpu_ad_need_write_protect(vcpu))
3004+ spte |= SPTE_AD_WRPROT_ONLY_MASK;
29723005
29733006 /*
29743007 * For the EPT case, shadow_present_mask is 0 if hardware
arch/x86/kvm/vmx/nested.c+1−1
@@ -2610,7 +2610,7 @@ static int nested_check_vm_entry_controls(struct kvm_vcpu *vcpu, · 2609 unmodified lines
26102610
26112611 /* VM-entry exception error code */
26122612 if (CC(has_error_code &&
2613− vmcs12->vm_entry_exception_error_code & GENMASK(31, 15)))
2613+ vmcs12->vm_entry_exception_error_code & GENMASK(31, 16)))
26142614 return -EINVAL;
26152615
26162616 /* VM-entry interruption-info field: reserved bits */
arch/x86/kvm/vmx/pmu_intel.c+5−2
@@ -262,6 +262,7 @@ static int intel_pmu_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 261 unmodified lines
262262 static void intel_pmu_refresh(struct kvm_vcpu *vcpu)
263263 {
264264 struct kvm_pmu *pmu = vcpu_to_pmu(vcpu);
265+ struct x86_pmu_capability x86_pmu;
265266 struct kvm_cpuid_entry2 *entry;
266267 union cpuid10_eax eax;
267268 union cpuid10_edx edx;
@@ -283,8 +284,10 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu) · 15 unmodified lines
283284 if (!pmu->version)
284285 return;
285286
287+ perf_get_x86_pmu_capability(&x86_pmu);
288+
286289 pmu->nr_arch_gp_counters = min_t(int, eax.split.num_counters,
287− INTEL_PMC_MAX_GENERIC);
290+ x86_pmu.num_counters_gp);
288291 pmu->counter_bitmask[KVM_PMC_GP] = ((u64)1 << eax.split.bit_width) - 1;
289292 pmu->available_event_types = ~entry->ebx &
290293 ((1ull << eax.split.mask_length) - 1);
@@ -294,7 +297,7 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu) · 3 unmodified lines
294297 } else {
295298 pmu->nr_arch_fixed_counters =
296299 min_t(int, edx.split.num_counters_fixed,
297− INTEL_PMC_MAX_FIXED);
300+ x86_pmu.num_counters_fixed);
298301 pmu->counter_bitmask[KVM_PMC_FIXED] =
299302 ((u64)1 << edx.split.bit_width_fixed) - 1;
300303 }
arch/x86/kvm/vmx/vmx.c+9−6
@@ -209,6 +209,11 @@ static int vmx_setup_l1d_flush(enum vmx_l1d_flush_state l1tf) · 208 unmodified lines
209209 struct page *page;
210210 unsigned int i;
211211
212+ if (!boot_cpu_has_bug(X86_BUG_L1TF)) {
213+ l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_NOT_REQUIRED;
214+ return 0;
215+ }
216+
212217 if (!enable_ept) {
213218 l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_EPT_DISABLED;
214219 return 0;
@@ -7995,12 +8000,10 @@ static int __init vmx_init(void) · 7780 unmodified lines
79958000 * contain 'auto' which will be turned into the default 'cond'
79968001 * mitigation mode.
79978002 */
7998− if (boot_cpu_has(X86_BUG_L1TF)) {
7999− r = vmx_setup_l1d_flush(vmentry_l1d_flush_param);
8000− if (r) {
8001− vmx_exit();
8002− return r;
8003− }
8003+ r = vmx_setup_l1d_flush(vmentry_l1d_flush_param);
8004+ if (r) {
8005+ vmx_exit();
8006+ return r;
80048007 }
80058008
80068009 #ifdef CONFIG_KEXEC_CORE
arch/x86/kvm/x86.c+36−36
@@ -92,8 +92,8 @@ u64 __read_mostly efer_reserved_bits = ~((u64)(EFER_SCE | EFER_LME | EFER_LMA)); · 91 unmodified lines
9292 static u64 __read_mostly efer_reserved_bits = ~((u64)EFER_SCE);
9393 #endif
9494
95−#define VM_STAT(x) offsetof(struct kvm, stat.x), KVM_STAT_VM
96−#define VCPU_STAT(x) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU
95+#define VM_STAT(x, ...) offsetof(struct kvm, stat.x), KVM_STAT_VM, ## __VA_ARGS__
96+#define VCPU_STAT(x, ...) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU, ## __VA_ARGS__
9797
9898 #define KVM_X2APIC_API_VALID_FLAGS (KVM_X2APIC_API_USE_32BIT_IDS | \
9999 KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK)
@@ -212,7 +212,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = { · 112 unmodified lines
212212 { "mmu_cache_miss", VM_STAT(mmu_cache_miss) },
213213 { "mmu_unsync", VM_STAT(mmu_unsync) },
214214 { "remote_tlb_flush", VM_STAT(remote_tlb_flush) },
215− { "largepages", VM_STAT(lpages) },
215+ { "largepages", VM_STAT(lpages, .mode = 0444) },
216216 { "max_mmu_page_hash_collisions",
217217 VM_STAT(max_mmu_page_hash_collisions) },
218218 { NULL }
@@ -885,34 +885,42 @@ int kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr) · 666 unmodified lines
885885 }
886886 EXPORT_SYMBOL_GPL(kvm_set_xcr);
887887
888−int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
888+static int kvm_valid_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
889889 {
890− unsigned long old_cr4 = kvm_read_cr4(vcpu);
891− unsigned long pdptr_bits = X86_CR4_PGE | X86_CR4_PSE | X86_CR4_PAE |
892− X86_CR4_SMEP | X86_CR4_SMAP | X86_CR4_PKE;
893−
894890 if (cr4 & CR4_RESERVED_BITS)
895− return 1;
891+ return -EINVAL;
896892
897893 if (!guest_cpuid_has(vcpu, X86_FEATURE_XSAVE) && (cr4 & X86_CR4_OSXSAVE))
898− return 1;
894+ return -EINVAL;
899895
900896 if (!guest_cpuid_has(vcpu, X86_FEATURE_SMEP) && (cr4 & X86_CR4_SMEP))
901− return 1;
897+ return -EINVAL;
902898
903899 if (!guest_cpuid_has(vcpu, X86_FEATURE_SMAP) && (cr4 & X86_CR4_SMAP))
904− return 1;
900+ return -EINVAL;
905901
906902 if (!guest_cpuid_has(vcpu, X86_FEATURE_FSGSBASE) && (cr4 & X86_CR4_FSGSBASE))
907− return 1;
903+ return -EINVAL;
908904
909905 if (!guest_cpuid_has(vcpu, X86_FEATURE_PKU) && (cr4 & X86_CR4_PKE))
910− return 1;
906+ return -EINVAL;
911907
912908 if (!guest_cpuid_has(vcpu, X86_FEATURE_LA57) && (cr4 & X86_CR4_LA57))
913− return 1;
909+ return -EINVAL;
914910
915911 if (!guest_cpuid_has(vcpu, X86_FEATURE_UMIP) && (cr4 & X86_CR4_UMIP))
912+ return -EINVAL;
913+
914+ return 0;
915+}
916+
917+int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
918+{
919+ unsigned long old_cr4 = kvm_read_cr4(vcpu);
920+ unsigned long pdptr_bits = X86_CR4_PGE | X86_CR4_PSE | X86_CR4_PAE |
921+ X86_CR4_SMEP | X86_CR4_SMAP | X86_CR4_PKE;
922+
923+ if (kvm_valid_cr4(vcpu, cr4))
916924 return 1;
917925
918926 if (is_long_mode(vcpu)) {
@@ -1161,13 +1169,6 @@ static u32 msrs_to_save[] = { · 242 unmodified lines
11611169 MSR_ARCH_PERFMON_PERFCTR0 + 12, MSR_ARCH_PERFMON_PERFCTR0 + 13,
11621170 MSR_ARCH_PERFMON_PERFCTR0 + 14, MSR_ARCH_PERFMON_PERFCTR0 + 15,
11631171 MSR_ARCH_PERFMON_PERFCTR0 + 16, MSR_ARCH_PERFMON_PERFCTR0 + 17,
1164− MSR_ARCH_PERFMON_PERFCTR0 + 18, MSR_ARCH_PERFMON_PERFCTR0 + 19,
1165− MSR_ARCH_PERFMON_PERFCTR0 + 20, MSR_ARCH_PERFMON_PERFCTR0 + 21,
1166− MSR_ARCH_PERFMON_PERFCTR0 + 22, MSR_ARCH_PERFMON_PERFCTR0 + 23,
1167− MSR_ARCH_PERFMON_PERFCTR0 + 24, MSR_ARCH_PERFMON_PERFCTR0 + 25,
1168− MSR_ARCH_PERFMON_PERFCTR0 + 26, MSR_ARCH_PERFMON_PERFCTR0 + 27,
1169− MSR_ARCH_PERFMON_PERFCTR0 + 28, MSR_ARCH_PERFMON_PERFCTR0 + 29,
1170− MSR_ARCH_PERFMON_PERFCTR0 + 30, MSR_ARCH_PERFMON_PERFCTR0 + 31,
11711172 MSR_ARCH_PERFMON_EVENTSEL0, MSR_ARCH_PERFMON_EVENTSEL1,
11721173 MSR_ARCH_PERFMON_EVENTSEL0 + 2, MSR_ARCH_PERFMON_EVENTSEL0 + 3,
11731174 MSR_ARCH_PERFMON_EVENTSEL0 + 4, MSR_ARCH_PERFMON_EVENTSEL0 + 5,
@@ -1177,13 +1178,6 @@ static u32 msrs_to_save[] = { · 3 unmodified lines
11771178 MSR_ARCH_PERFMON_EVENTSEL0 + 12, MSR_ARCH_PERFMON_EVENTSEL0 + 13,
11781179 MSR_ARCH_PERFMON_EVENTSEL0 + 14, MSR_ARCH_PERFMON_EVENTSEL0 + 15,
11791180 MSR_ARCH_PERFMON_EVENTSEL0 + 16, MSR_ARCH_PERFMON_EVENTSEL0 + 17,
1180− MSR_ARCH_PERFMON_EVENTSEL0 + 18, MSR_ARCH_PERFMON_EVENTSEL0 + 19,
1181− MSR_ARCH_PERFMON_EVENTSEL0 + 20, MSR_ARCH_PERFMON_EVENTSEL0 + 21,
1182− MSR_ARCH_PERFMON_EVENTSEL0 + 22, MSR_ARCH_PERFMON_EVENTSEL0 + 23,
1183− MSR_ARCH_PERFMON_EVENTSEL0 + 24, MSR_ARCH_PERFMON_EVENTSEL0 + 25,
1184− MSR_ARCH_PERFMON_EVENTSEL0 + 26, MSR_ARCH_PERFMON_EVENTSEL0 + 27,
1185− MSR_ARCH_PERFMON_EVENTSEL0 + 28, MSR_ARCH_PERFMON_EVENTSEL0 + 29,
1186− MSR_ARCH_PERFMON_EVENTSEL0 + 30, MSR_ARCH_PERFMON_EVENTSEL0 + 31,
11871181 };
11881182
11891183 static unsigned num_msrs_to_save;
@@ -5097,13 +5091,14 @@ out: · 3907 unmodified lines
50975091
50985092 static void kvm_init_msr_list(void)
50995093 {
5094+ struct x86_pmu_capability x86_pmu;
51005095 u32 dummy[2];
51015096 unsigned i, j;
51025097
51035098 BUILD_BUG_ON_MSG(INTEL_PMC_MAX_FIXED != 4,
51045099 "Please update the fixed PMCs in msrs_to_save[]");
5105− BUILD_BUG_ON_MSG(INTEL_PMC_MAX_GENERIC != 32,
5106− "Please update the generic perfctr/eventsel MSRs in msrs_to_save[]");
5100+
5101+ perf_get_x86_pmu_capability(&x86_pmu);
51075102
51085103 for (i = j = 0; i < ARRAY_SIZE(msrs_to_save); i++) {
51095104 if (rdmsr_safe(msrs_to_save[i], &dummy[0], &dummy[1]) < 0)
@@ -5145,6 +5140,15 @@ static void kvm_init_msr_list(void) · 35 unmodified lines
51455140 intel_pt_validate_hw_cap(PT_CAP_num_address_ranges) * 2)
51465141 continue;
51475142 break;
5143+ case MSR_ARCH_PERFMON_PERFCTR0 ... MSR_ARCH_PERFMON_PERFCTR0 + 17:
5144+ if (msrs_to_save[i] - MSR_ARCH_PERFMON_PERFCTR0 >=
5145+ min(INTEL_PMC_MAX_GENERIC, x86_pmu.num_counters_gp))
5146+ continue;
5147+ break;
5148+ case MSR_ARCH_PERFMON_EVENTSEL0 ... MSR_ARCH_PERFMON_EVENTSEL0 + 17:
5149+ if (msrs_to_save[i] - MSR_ARCH_PERFMON_EVENTSEL0 >=
5150+ min(INTEL_PMC_MAX_GENERIC, x86_pmu.num_counters_gp))
5151+ continue;
51485152 }
51495153 default:
51505154 break;
@@ -8714,10 +8718,6 @@ EXPORT_SYMBOL_GPL(kvm_task_switch); · 3563 unmodified lines
87148718
87158719 static int kvm_valid_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
87168720 {
8717− if (!guest_cpuid_has(vcpu, X86_FEATURE_XSAVE) &&
8718− (sregs->cr4 & X86_CR4_OSXSAVE))
8719− return -EINVAL;
8720−
87218721 if ((sregs->efer & EFER_LME) && (sregs->cr0 & X86_CR0_PG)) {
87228722 /*
87238723 * When EFER.LME and CR0.PG are set, the processor is in
@@ -8736,7 +8736,7 @@ static int kvm_valid_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) · 12 unmodified lines
87368736 return -EINVAL;
87378737 }
87388738
8739− return 0;
8739+ return kvm_valid_cr4(vcpu, sregs->cr4);
87408740 }
87418741
87428742 static int __set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
arch/x86/xen/efi.c+1−13
@@ -57,19 +57,7 @@ static efi_system_table_t __init *xen_efi_probe(void) · 56 unmodified lines
5757 return NULL;
5858
5959 /* Here we know that Xen runs on EFI platform. */
60−
61− efi.get_time = xen_efi_get_time;
62− efi.set_time = xen_efi_set_time;
63− efi.get_wakeup_time = xen_efi_get_wakeup_time;
64− efi.set_wakeup_time = xen_efi_set_wakeup_time;
65− efi.get_variable = xen_efi_get_variable;
66− efi.get_next_variable = xen_efi_get_next_variable;
67− efi.set_variable = xen_efi_set_variable;
68− efi.query_variable_info = xen_efi_query_variable_info;
69− efi.update_capsule = xen_efi_update_capsule;
70− efi.query_capsule_caps = xen_efi_query_capsule_caps;
71− efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count;
72− efi.reset_system = xen_efi_reset_system;
60+ xen_efi_runtime_setup();
7361
7462 efi_systab_xen.tables = info->cfg.addr;
7563 efi_systab_xen.nr_tables = info->cfg.nent;
block/blk-mq.c+9−3
@@ -1992,10 +1992,14 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) · 1991 unmodified lines
19921992 /* bypass scheduler for flush rq */
19931993 blk_insert_flush(rq);
19941994 blk_mq_run_hw_queue(data.hctx, true);
1995− } else if (plug && (q->nr_hw_queues == 1 || q->mq_ops->commit_rqs)) {
1995+ } else if (plug && (q->nr_hw_queues == 1 || q->mq_ops->commit_rqs ||
1996+ !blk_queue_nonrot(q))) {
19961997 /*
19971998 * Use plugging if we have a ->commit_rqs() hook as well, as
19981999 * we know the driver uses bd->last in a smart fashion.
2000+ *
2001+ * Use normal plugging if this disk is slow HDD, as sequential
2002+ * IO may benefit a lot from plug merging.
19992003 */
20002004 unsigned int request_count = plug->rq_count;
20012005 struct request *last = NULL;
@@ -2012,6 +2016,8 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) · 10 unmodified lines
20122016 }
20132017
20142018 blk_add_rq_to_plug(plug, rq);
2019+ } else if (q->elevator) {
2020+ blk_mq_sched_insert_request(rq, false, true, true);
20152021 } else if (plug && !blk_queue_nomerges(q)) {
20162022 /*
20172023 * We do limited plugging. If the bio can be merged, do that.
@@ -2035,8 +2041,8 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) · 17 unmodified lines
20352041 blk_mq_try_issue_directly(data.hctx, same_queue_rq,
20362042 &cookie);
20372043 }
2038− } else if ((q->nr_hw_queues > 1 && is_sync) || (!q->elevator &&
2039− !data.hctx->dispatch_busy)) {
2044+ } else if ((q->nr_hw_queues > 1 && is_sync) ||
2045+ !data.hctx->dispatch_busy) {
20402046 blk_mq_try_issue_directly(data.hctx, rq, &cookie);
20412047 } else {
20422048 blk_mq_sched_insert_request(rq, false, true, true);
block/sed-opal.c+3−3
@@ -129,7 +129,7 @@ static const u8 opaluid[][OPAL_UID_LENGTH] = { · 128 unmodified lines
129129 { 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x84, 0x01 },
130130
131131 /* tables */
132− [OPAL_TABLE_TABLE]
132+ [OPAL_TABLE_TABLE] =
133133 { 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01 },
134134 [OPAL_LOCKINGRANGE_GLOBAL] =
135135 { 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x01 },
@@ -372,8 +372,8 @@ static void check_geometry(struct opal_dev *dev, const void *data) · 236 unmodified lines
372372 {
373373 const struct d0_geometry_features *geo = data;
374374
375− dev->align = geo->alignment_granularity;
376− dev->lowest_lba = geo->lowest_aligned_lba;
375+ dev->align = be64_to_cpu(geo->alignment_granularity);
376+ dev->lowest_lba = be64_to_cpu(geo->lowest_aligned_lba);
377377 }
378378
379379 static int execute_step(struct opal_dev *dev,
drivers/block/loop.c+10−0
@@ -994,6 +994,16 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, · 993 unmodified lines
994994 if (!(lo_flags & LO_FLAGS_READ_ONLY) && file->f_op->fsync)
995995 blk_queue_write_cache(lo->lo_queue, true, false);
996996
997+ if (io_is_direct(lo->lo_backing_file) && inode->i_sb->s_bdev) {
998+ /* In case of direct I/O, match underlying block size */
999+ unsigned short bsize = bdev_logical_block_size(
1000+ inode->i_sb->s_bdev);
1001+
1002+ blk_queue_logical_block_size(lo->lo_queue, bsize);
1003+ blk_queue_physical_block_size(lo->lo_queue, bsize);
1004+ blk_queue_io_min(lo->lo_queue, bsize);
1005+ }
1006+
9971007 loop_update_rotational(lo);
9981008 loop_update_dio(lo);
9991009 set_capacity(lo->lo_disk, size);
drivers/char/random.c+1−1
@@ -2520,4 +2520,4 @@ void add_bootloader_randomness(const void *buf, unsigned int size) · 2519 unmodified lines
25202520 else
25212521 add_device_randomness(buf, size);
25222522 }
2523−EXPORT_SYMBOL_GPL(add_bootloader_randomness);
2523+EXPORT_SYMBOL_GPL(add_bootloader_randomness);
drivers/clk/ti/clk-7xx.c+3−3
@@ -683,7 +683,7 @@ static const struct omap_clkctrl_reg_data dra7_l4per2_clkctrl_regs[] __initconst · 682 unmodified lines
683683 { DRA7_L4PER2_MCASP2_CLKCTRL, dra7_mcasp2_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:0154:22" },
684684 { DRA7_L4PER2_MCASP3_CLKCTRL, dra7_mcasp3_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:015c:22" },
685685 { DRA7_L4PER2_MCASP5_CLKCTRL, dra7_mcasp5_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:016c:22" },
686− { DRA7_L4PER2_MCASP8_CLKCTRL, dra7_mcasp8_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:0184:24" },
686+ { DRA7_L4PER2_MCASP8_CLKCTRL, dra7_mcasp8_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:0184:22" },
687687 { DRA7_L4PER2_MCASP4_CLKCTRL, dra7_mcasp4_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:018c:22" },
688688 { DRA7_L4PER2_UART7_CLKCTRL, dra7_uart7_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:01c4:24" },
689689 { DRA7_L4PER2_UART8_CLKCTRL, dra7_uart8_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:01d4:24" },
@@ -828,8 +828,8 @@ static struct ti_dt_clk dra7xx_clks[] = { · 138 unmodified lines
828828 DT_CLK(NULL, "mcasp6_aux_gfclk_mux", "l4per2-clkctrl:01f8:22"),
829829 DT_CLK(NULL, "mcasp7_ahclkx_mux", "l4per2-clkctrl:01fc:24"),
830830 DT_CLK(NULL, "mcasp7_aux_gfclk_mux", "l4per2-clkctrl:01fc:22"),
831− DT_CLK(NULL, "mcasp8_ahclkx_mux", "l4per2-clkctrl:0184:22"),
832− DT_CLK(NULL, "mcasp8_aux_gfclk_mux", "l4per2-clkctrl:0184:24"),
831+ DT_CLK(NULL, "mcasp8_ahclkx_mux", "l4per2-clkctrl:0184:24"),
832+ DT_CLK(NULL, "mcasp8_aux_gfclk_mux", "l4per2-clkctrl:0184:22"),
833833 DT_CLK(NULL, "mmc1_clk32k", "l3init-clkctrl:0008:8"),
834834 DT_CLK(NULL, "mmc1_fclk_div", "l3init-clkctrl:0008:25"),
835835 DT_CLK(NULL, "mmc1_fclk_mux", "l3init-clkctrl:0008:24"),
drivers/clocksource/timer-of.c+3−1
@@ -25,7 +25,9 @@ static __init void timer_of_irq_exit(struct of_timer_irq *of_irq) · 24 unmodified lines
2525
2626 struct clock_event_device *clkevt = &to->clkevt;
2727
28− of_irq->percpu ? free_percpu_irq(of_irq->irq, clkevt) :
28+ if (of_irq->percpu)
29+ free_percpu_irq(of_irq->irq, clkevt);
30+ else
2931 free_irq(of_irq->irq, clkevt);
3032 }
3133
drivers/gpu/drm/amd/amdgpu/Makefile+1−1
@@ -54,7 +54,7 @@ amdgpu-y += amdgpu_device.o amdgpu_kms.o \ · 53 unmodified lines
5454 amdgpu_gtt_mgr.o amdgpu_vram_mgr.o amdgpu_virt.o amdgpu_atomfirmware.o \
5555 amdgpu_vf_error.o amdgpu_sched.o amdgpu_debugfs.o amdgpu_ids.o \
5656 amdgpu_gmc.o amdgpu_xgmi.o amdgpu_csa.o amdgpu_ras.o amdgpu_vm_cpu.o \
57− amdgpu_vm_sdma.o amdgpu_pmu.o amdgpu_discovery.o amdgpu_ras_eeprom.o smu_v11_0_i2c.o
57+ amdgpu_vm_sdma.o amdgpu_discovery.o amdgpu_ras_eeprom.o smu_v11_0_i2c.o
5858
5959 amdgpu-$(CONFIG_PERF_EVENTS) += amdgpu_pmu.o
6060
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c+22−12
@@ -189,7 +189,7 @@ static int acp_hw_init(void *handle) · 188 unmodified lines
189189 u32 val = 0;
190190 u32 count = 0;
191191 struct device *dev;
192− struct i2s_platform_data *i2s_pdata;
192+ struct i2s_platform_data *i2s_pdata = NULL;
193193
194194 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
195195
@@ -231,20 +231,21 @@ static int acp_hw_init(void *handle) · 35 unmodified lines
231231 adev->acp.acp_cell = kcalloc(ACP_DEVS, sizeof(struct mfd_cell),
232232 GFP_KERNEL);
233233
234− if (adev->acp.acp_cell == NULL)
235− return -ENOMEM;
234+ if (adev->acp.acp_cell == NULL) {
235+ r = -ENOMEM;
236+ goto failure;
237+ }
236238
237239 adev->acp.acp_res = kcalloc(5, sizeof(struct resource), GFP_KERNEL);
238240 if (adev->acp.acp_res == NULL) {
239− kfree(adev->acp.acp_cell);
240− return -ENOMEM;
241+ r = -ENOMEM;
242+ goto failure;
241243 }
242244
243245 i2s_pdata = kcalloc(3, sizeof(struct i2s_platform_data), GFP_KERNEL);
244246 if (i2s_pdata == NULL) {
245− kfree(adev->acp.acp_res);
246− kfree(adev->acp.acp_cell);
247− return -ENOMEM;
247+ r = -ENOMEM;
248+ goto failure;
248249 }
249250
250251 switch (adev->asic_type) {
@@ -341,14 +342,14 @@ static int acp_hw_init(void *handle) · 90 unmodified lines
341342 r = mfd_add_hotplug_devices(adev->acp.parent, adev->acp.acp_cell,
342343 ACP_DEVS);
343344 if (r)
344− return r;
345+ goto failure;
345346
346347 for (i = 0; i < ACP_DEVS ; i++) {
347348 dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i);
348349 r = pm_genpd_add_device(&adev->acp.acp_genpd->gpd, dev);
349350 if (r) {
350351 dev_err(dev, "Failed to add dev to genpd\n");
351− return r;
352+ goto failure;
352353 }
353354 }
354355
@@ -367,7 +368,8 @@ static int acp_hw_init(void *handle) · 12 unmodified lines
367368 break;
368369 if (--count == 0) {
369370 dev_err(&adev->pdev->dev, "Failed to reset ACP\n");
370− return -ETIMEDOUT;
371+ r = -ETIMEDOUT;
372+ goto failure;
371373 }
372374 udelay(100);
373375 }
@@ -384,7 +386,8 @@ static int acp_hw_init(void *handle) · 10 unmodified lines
384386 break;
385387 if (--count == 0) {
386388 dev_err(&adev->pdev->dev, "Failed to reset ACP\n");
387− return -ETIMEDOUT;
389+ r = -ETIMEDOUT;
390+ goto failure;
388391 }
389392 udelay(100);
390393 }
@@ -393,6 +396,13 @@ static int acp_hw_init(void *handle) · 2 unmodified lines
393396 val &= ~ACP_SOFT_RESET__SoftResetAud_MASK;
394397 cgs_write_register(adev->acp.cgs_device, mmACP_SOFT_RESET, val);
395398 return 0;
399+
400+failure:
401+ kfree(i2s_pdata);
402+ kfree(adev->acp.acp_res);
403+ kfree(adev->acp.acp_cell);
404+ kfree(adev->acp.acp_genpd);
405+ return r;
396406 }
397407
398408 /**
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+2−1
@@ -81,9 +81,10 @@ · 80 unmodified lines
8181 * - 3.32.0 - Add syncobj timeline support to AMDGPU_CS.
8282 * - 3.33.0 - Fixes for GDS ENOMEM failures in AMDGPU_CS.
8383 * - 3.34.0 - Non-DC can flip correctly between buffers with different pitches
84+ * - 3.35.0 - Add drm_amdgpu_info_device::tcc_disabled_mask
8485 */
8586 #define KMS_DRIVER_MAJOR 3
86−#define KMS_DRIVER_MINOR 34
87+#define KMS_DRIVER_MINOR 35
8788 #define KMS_DRIVER_PATCHLEVEL 0
8889
8990 #define AMDGPU_MAX_TIMEOUT_PARAM_LENTH 256
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h+1−0
@@ -165,6 +165,7 @@ struct amdgpu_gfx_config { · 164 unmodified lines
165165 uint32_t num_sc_per_sh;
166166 uint32_t num_packer_per_sc;
167167 uint32_t pa_sc_tile_steering_override;
168+ uint64_t tcc_disabled_mask;
168169 };
169170
170171 struct amdgpu_cu_info {
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c+2−0
@@ -787,6 +787,8 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file · 786 unmodified lines
787787 dev_info.pa_sc_tile_steering_override =
788788 adev->gfx.config.pa_sc_tile_steering_override;
789789
790+ dev_info.tcc_disabled_mask = adev->gfx.config.tcc_disabled_mask;
791+
790792 return copy_to_user(out, &dev_info,
791793 min((size_t)size, sizeof(dev_info))) ? -EFAULT : 0;
792794 }
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c+0−2
@@ -603,14 +603,12 @@ void amdgpu_vm_move_to_lru_tail(struct amdgpu_device *adev, · 602 unmodified lines
603603 struct ttm_bo_global *glob = adev->mman.bdev.glob;
604604 struct amdgpu_vm_bo_base *bo_base;
605605
606−#if 0
607606 if (vm->bulk_moveable) {
608607 spin_lock(&glob->lru_lock);
609608 ttm_bo_bulk_move_lru_tail(&vm->lru_bulk_move);
610609 spin_unlock(&glob->lru_lock);
611610 return;
612611 }
613−#endif
614612
615613 memset(&vm->lru_bulk_move, 0, sizeof(vm->lru_bulk_move));
616614
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c+12−0
@@ -1691,6 +1691,17 @@ static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev) · 1690 unmodified lines
16911691 }
16921692 }
16931693
1694+static void gfx_v10_0_get_tcc_info(struct amdgpu_device *adev)
1695+{
1696+ /* TCCs are global (not instanced). */
1697+ uint32_t tcc_disable = RREG32_SOC15(GC, 0, mmCGTS_TCC_DISABLE) |
1698+ RREG32_SOC15(GC, 0, mmCGTS_USER_TCC_DISABLE);
1699+
1700+ adev->gfx.config.tcc_disabled_mask =
1701+ REG_GET_FIELD(tcc_disable, CGTS_TCC_DISABLE, TCC_DISABLE) |
1702+ (REG_GET_FIELD(tcc_disable, CGTS_TCC_DISABLE, HI_TCC_DISABLE) << 16);
1703+}
1704+
16941705 static void gfx_v10_0_constants_init(struct amdgpu_device *adev)
16951706 {
16961707 u32 tmp;
@@ -1702,6 +1713,7 @@ static void gfx_v10_0_constants_init(struct amdgpu_device *adev) · 5 unmodified lines
17021713
17031714 gfx_v10_0_setup_rb(adev);
17041715 gfx_v10_0_get_cu_info(adev, &adev->gfx.cu_info);
1716+ gfx_v10_0_get_tcc_info(adev);
17051717 adev->gfx.config.pa_sc_tile_steering_override =
17061718 gfx_v10_0_init_pa_sc_tile_steering_override(adev);
17071719
drivers/gpu/drm/amd/amdgpu/nv.c+4−2
@@ -317,10 +317,12 @@ static int nv_asic_reset(struct amdgpu_device *adev) · 316 unmodified lines
317317 struct smu_context *smu = &adev->smu;
318318
319319 if (nv_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) {
320− amdgpu_inc_vram_lost(adev);
320+ if (!adev->in_suspend)
321+ amdgpu_inc_vram_lost(adev);
321322 ret = smu_baco_reset(smu);
322323 } else {
323− amdgpu_inc_vram_lost(adev);
324+ if (!adev->in_suspend)
325+ amdgpu_inc_vram_lost(adev);
324326 ret = nv_asic_mode1_reset(adev);
325327 }
326328
drivers/gpu/drm/amd/amdgpu/soc15.c+4−4
@@ -558,12 +558,14 @@ static int soc15_asic_reset(struct amdgpu_device *adev) · 557 unmodified lines
558558 {
559559 switch (soc15_asic_reset_method(adev)) {
560560 case AMD_RESET_METHOD_BACO:
561− amdgpu_inc_vram_lost(adev);
561+ if (!adev->in_suspend)
562+ amdgpu_inc_vram_lost(adev);
562563 return soc15_asic_baco_reset(adev);
563564 case AMD_RESET_METHOD_MODE2:
564565 return soc15_mode2_reset(adev);
565566 default:
566− amdgpu_inc_vram_lost(adev);
567+ if (!adev->in_suspend)
568+ amdgpu_inc_vram_lost(adev);
567569 return soc15_asic_mode1_reset(adev);
568570 }
569571 }
@@ -771,8 +773,6 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev) · 201 unmodified lines
771773 #if defined(CONFIG_DRM_AMD_DC)
772774 else if (amdgpu_device_has_dc_support(adev))
773775 amdgpu_device_ip_block_add(adev, &dm_ip_block);
774−#else
775−# warning "Enable CONFIG_DRM_AMD_DC for display support on SOC15."
776776 #endif
777777 amdgpu_device_ip_block_add(adev, &vcn_v2_0_ip_block);
778778 break;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+2−2
@@ -2385,8 +2385,6 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) · 2384 unmodified lines
23852385
23862386 if (adev->asic_type != CHIP_CARRIZO && adev->asic_type != CHIP_STONEY)
23872387 dm->dc->debug.disable_stutter = amdgpu_pp_feature_mask & PP_STUTTER_MODE ? false : true;
2388− if (adev->asic_type == CHIP_RENOIR)
2389− dm->dc->debug.disable_stutter = true;
23902388
23912389 return 0;
23922390 fail:
@@ -6019,7 +6017,9 @@ static void amdgpu_dm_enable_crtc_interrupts(struct drm_device *dev, · 3626 unmodified lines
60196017 struct drm_crtc *crtc;
60206018 struct drm_crtc_state *old_crtc_state, *new_crtc_state;
60216019 int i;
6020+#ifdef CONFIG_DEBUG_FS
60226021 enum amdgpu_dm_pipe_crc_source source;
6022+#endif
60236023
60246024 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state,
60256025 new_crtc_state, i) {
drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c+1−0
@@ -668,6 +668,7 @@ struct clock_source *dce100_clock_source_create( · 667 unmodified lines
668668 return &clk_src->base;
669669 }
670670
671+ kfree(clk_src);
671672 BREAK_TO_DEBUGGER();
672673 return NULL;
673674 }
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c+1−0
@@ -714,6 +714,7 @@ struct clock_source *dce110_clock_source_create( · 713 unmodified lines
714714 return &clk_src->base;
715715 }
716716
717+ kfree(clk_src);
717718 BREAK_TO_DEBUGGER();
718719 return NULL;
719720 }
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c+1−0
@@ -687,6 +687,7 @@ struct clock_source *dce112_clock_source_create( · 686 unmodified lines
687687 return &clk_src->base;
688688 }
689689
690+ kfree(clk_src);
690691 BREAK_TO_DEBUGGER();
691692 return NULL;
692693 }
drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c+1−0
@@ -500,6 +500,7 @@ static struct clock_source *dce120_clock_source_create( · 499 unmodified lines
500500 return &clk_src->base;
501501 }
502502
503+ kfree(clk_src);
503504 BREAK_TO_DEBUGGER();
504505 return NULL;
505506 }
drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c+1−0
@@ -701,6 +701,7 @@ struct clock_source *dce80_clock_source_create( · 700 unmodified lines
701701 return &clk_src->base;
702702 }
703703
704+ kfree(clk_src);
704705 BREAK_TO_DEBUGGER();
705706 return NULL;
706707 }
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c+1−0
@@ -786,6 +786,7 @@ struct clock_source *dcn10_clock_source_create( · 785 unmodified lines
786786 return &clk_src->base;
787787 }
788788
789+ kfree(clk_src);
789790 BREAK_TO_DEBUGGER();
790791 return NULL;
791792 }
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c+1−0
@@ -1077,6 +1077,7 @@ struct clock_source *dcn20_clock_source_create( · 1076 unmodified lines
10771077 return &clk_src->base;
10781078 }
10791079
1080+ kfree(clk_src);
10801081 BREAK_TO_DEBUGGER();
10811082 return NULL;
10821083 }
drivers/gpu/drm/amd/display/dc/dcn21/Makefile+11−1
@@ -3,7 +3,17 @@ · 2 unmodified lines
33
44 DCN21 = dcn21_hubp.o dcn21_hubbub.o dcn21_resource.o
55
6−CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4
6+ifneq ($(call cc-option, -mpreferred-stack-boundary=4),)
7+ cc_stack_align := -mpreferred-stack-boundary=4
8+else ifneq ($(call cc-option, -mstack-alignment=16),)
9+ cc_stack_align := -mstack-alignment=16
10+endif
11+
12+CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse $(cc_stack_align)
13+
14+ifdef CONFIG_CC_IS_CLANG
15+CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -msse2
16+endif
717
818 AMD_DAL_DCN21 = $(addprefix $(AMDDALPATH)/dc/dcn21/,$(DCN21))
919
drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c+5−8
@@ -39,9 +39,6 @@ · 38 unmodified lines
3939 * ways. Unless there is something clearly wrong with it the code should
4040 * remain as-is as it provides us with a guarantee from HW that it is correct.
4141 */
42−
43−typedef unsigned int uint;
44−
4542 typedef struct {
4643 double DPPCLK;
4744 double DISPCLK;
@@ -4774,7 +4771,7 @@ void dml21_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l · 4726 unmodified lines
47744771 mode_lib->vba.MaximumReadBandwidthWithoutPrefetch = 0.0;
47754772 mode_lib->vba.MaximumReadBandwidthWithPrefetch = 0.0;
47764773 for (k = 0; k <= mode_lib->vba.NumberOfActivePlanes - 1; k++) {
4777− uint m;
4774+ unsigned int m;
47784775
47794776 locals->cursor_bw[k] = 0;
47804777 locals->cursor_bw_pre[k] = 0;
@@ -5285,7 +5282,7 @@ static void CalculateWatermarksAndDRAMSpeedChangeSupport( · 504 unmodified lines
52855282 double SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank;
52865283 double FullDETBufferingTimeYStutterCriticalPlane = 0;
52875284 double TimeToFinishSwathTransferStutterCriticalPlane = 0;
5288− uint k, j;
5285+ unsigned int k, j;
52895286
52905287 mode_lib->vba.TotalActiveDPP = 0;
52915288 mode_lib->vba.TotalDCCActiveDPP = 0;
@@ -5507,7 +5504,7 @@ static void CalculateDCFCLKDeepSleep( · 215 unmodified lines
55075504 double DPPCLK[],
55085505 double *DCFCLKDeepSleep)
55095506 {
5510− uint k;
5507+ unsigned int k;
55115508 double DisplayPipeLineDeliveryTimeLuma;
55125509 double DisplayPipeLineDeliveryTimeChroma;
55135510 //double DCFCLKDeepSleepPerPlane[DC__NUM_DPP__MAX];
@@ -5727,7 +5724,7 @@ static void CalculatePixelDeliveryTimes( · 213 unmodified lines
57275724 double DisplayPipeRequestDeliveryTimeChromaPrefetch[])
57285725 {
57295726 double req_per_swath_ub;
5730− uint k;
5727+ unsigned int k;
57315728
57325729 for (k = 0; k < NumberOfActivePlanes; ++k) {
57335730 if (VRatio[k] <= 1) {
@@ -5869,7 +5866,7 @@ static void CalculateMetaAndPTETimes( · 135 unmodified lines
58695866 unsigned int dpte_groups_per_row_chroma_ub;
58705867 unsigned int num_group_per_lower_vm_stage;
58715868 unsigned int num_req_per_lower_vm_stage;
5872− uint k;
5869+ unsigned int k;
58735870
58745871 for (k = 0; k < NumberOfActivePlanes; ++k) {
58755872 if (GPUVMEnable == true) {
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c+2−0
@@ -843,6 +843,8 @@ static int smu_sw_init(void *handle) · 842 unmodified lines
843843 smu->smu_baco.state = SMU_BACO_STATE_EXIT;
844844 smu->smu_baco.platform_support = false;
845845
846+ mutex_init(&smu->sensor_lock);
847+
846848 smu->watermarks_bitmap = 0;
847849 smu->power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;
848850 smu->default_power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c+2−0
@@ -1018,6 +1018,7 @@ static int arcturus_read_sensor(struct smu_context *smu, · 1017 unmodified lines
10181018 if (!data || !size)
10191019 return -EINVAL;
10201020
1021+ mutex_lock(&smu->sensor_lock);
10211022 switch (sensor) {
10221023 case AMDGPU_PP_SENSOR_MAX_FAN_RPM:
10231024 *(uint32_t *)data = pptable->FanMaximumRpm;
@@ -1044,6 +1045,7 @@ static int arcturus_read_sensor(struct smu_context *smu, · 20 unmodified lines
10441045 default:
10451046 ret = smu_smc_read_sensor(smu, sensor, data, size);
10461047 }
1048+ mutex_unlock(&smu->sensor_lock);
10471049
10481050 return ret;
10491051 }
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h+1−0
@@ -344,6 +344,7 @@ struct smu_context · 343 unmodified lines
344344 const struct smu_funcs *funcs;
345345 const struct pptable_funcs *ppt_funcs;
346346 struct mutex mutex;
347+ struct mutex sensor_lock;
347348 uint64_t pool_size;
348349
349350 struct smu_table_context smu_table;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c+3−1
@@ -547,7 +547,7 @@ static int navi10_get_metrics_table(struct smu_context *smu, · 546 unmodified lines
547547 struct smu_table_context *smu_table= &smu->smu_table;
548548 int ret = 0;
549549
550− if (!smu_table->metrics_time || time_after(jiffies, smu_table->metrics_time + HZ / 1000)) {
550+ if (!smu_table->metrics_time || time_after(jiffies, smu_table->metrics_time + msecs_to_jiffies(100))) {
551551 ret = smu_update_table(smu, SMU_TABLE_SMU_METRICS, 0,
552552 (void *)smu_table->metrics_table, false);
553553 if (ret) {
@@ -1386,6 +1386,7 @@ static int navi10_read_sensor(struct smu_context *smu, · 832 unmodified lines
13861386 if(!data || !size)
13871387 return -EINVAL;
13881388
1389+ mutex_lock(&smu->sensor_lock);
13891390 switch (sensor) {
13901391 case AMDGPU_PP_SENSOR_MAX_FAN_RPM:
13911392 *(uint32_t *)data = pptable->FanMaximumRpm;
@@ -1409,6 +1410,7 @@ static int navi10_read_sensor(struct smu_context *smu, · 17 unmodified lines
14091410 default:
14101411 ret = smu_smc_read_sensor(smu, sensor, data, size);
14111412 }
1413+ mutex_unlock(&smu->sensor_lock);
14121414
14131415 return ret;
14141416 }
drivers/gpu/drm/amd/powerplay/vega20_ppt.c+2−0
@@ -3023,6 +3023,7 @@ static int vega20_read_sensor(struct smu_context *smu, · 3022 unmodified lines
30233023 if(!data || !size)
30243024 return -EINVAL;
30253025
3026+ mutex_lock(&smu->sensor_lock);
30263027 switch (sensor) {
30273028 case AMDGPU_PP_SENSOR_MAX_FAN_RPM:
30283029 *(uint32_t *)data = pptable->FanMaximumRpm;
@@ -3048,6 +3049,7 @@ static int vega20_read_sensor(struct smu_context *smu, · 19 unmodified lines
30483049 default:
30493050 ret = smu_smc_read_sensor(smu, sensor, data, size);
30503051 }
3052+ mutex_unlock(&smu->sensor_lock);
30513053
30523054 return ret;
30533055 }
drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c+4−3
@@ -43,9 +43,8 @@ komeda_wb_encoder_atomic_check(struct drm_encoder *encoder, · 42 unmodified lines
4343 struct komeda_data_flow_cfg dflow;
4444 int err;
4545
46− if (!writeback_job || !writeback_job->fb) {
46+ if (!writeback_job)
4747 return 0;
48− }
4948
5049 if (!crtc_st->active) {
5150 DRM_DEBUG_ATOMIC("Cannot write the composition result out on a inactive CRTC.\n");
@@ -166,8 +165,10 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms, · 114 unmodified lines
166165 &komeda_wb_encoder_helper_funcs,
167166 formats, n_formats);
168167 komeda_put_fourcc_list(formats);
169− if (err)
168+ if (err) {
169+ kfree(kwb_conn);
170170 return err;
171+ }
171172
172173 drm_connector_helper_add(&wb_conn->base, &komeda_wb_conn_helper_funcs);
173174
drivers/gpu/drm/arm/malidp_mw.c+2−2
@@ -131,7 +131,7 @@ malidp_mw_encoder_atomic_check(struct drm_encoder *encoder, · 130 unmodified lines
131131 struct drm_framebuffer *fb;
132132 int i, n_planes;
133133
134− if (!conn_state->writeback_job || !conn_state->writeback_job->fb)
134+ if (!conn_state->writeback_job)
135135 return 0;
136136
137137 fb = conn_state->writeback_job->fb;
@@ -248,7 +248,7 @@ void malidp_mw_atomic_commit(struct drm_device *drm, · 110 unmodified lines
248248
249249 mw_state = to_mw_state(conn_state);
250250
251− if (conn_state->writeback_job && conn_state->writeback_job->fb) {
251+ if (conn_state->writeback_job) {
252252 struct drm_framebuffer *fb = conn_state->writeback_job->fb;
253253
254254 DRM_DEV_DEBUG_DRIVER(drm->dev,
drivers/gpu/drm/drm_atomic.c+9−4
@@ -430,10 +430,15 @@ static int drm_atomic_connector_check(struct drm_connector *connector, · 429 unmodified lines
430430 return -EINVAL;
431431 }
432432
433− if (writeback_job->out_fence && !writeback_job->fb) {
434− DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] requesting out-fence without framebuffer\n",
435− connector->base.id, connector->name);
436− return -EINVAL;
433+ if (!writeback_job->fb) {
434+ if (writeback_job->out_fence) {
435+ DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] requesting out-fence without framebuffer\n",
436+ connector->base.id, connector->name);
437+ return -EINVAL;
438+ }
439+
440+ drm_writeback_cleanup_job(writeback_job);
441+ state->writeback_job = NULL;
437442 }
438443
439444 return 0;
drivers/gpu/drm/drm_writeback.c+15−8
@@ -324,6 +324,9 @@ void drm_writeback_cleanup_job(struct drm_writeback_job *job) · 323 unmodified lines
324324 if (job->fb)
325325 drm_framebuffer_put(job->fb);
326326
327+ if (job->out_fence)
328+ dma_fence_put(job->out_fence);
329+
327330 kfree(job);
328331 }
329332 EXPORT_SYMBOL(drm_writeback_cleanup_job);
@@ -366,25 +369,29 @@ drm_writeback_signal_completion(struct drm_writeback_connector *wb_connector, · 36 unmodified lines
366369 {
367370 unsigned long flags;
368371 struct drm_writeback_job *job;
372+ struct dma_fence *out_fence;
369373
370374 spin_lock_irqsave(&wb_connector->job_lock, flags);
371375 job = list_first_entry_or_null(&wb_connector->job_queue,
372376 struct drm_writeback_job,
373377 list_entry);
374− if (job) {
378+ if (job)
375379 list_del(&job->list_entry);
376− if (job->out_fence) {
377− if (status)
378− dma_fence_set_error(job->out_fence, status);
379− dma_fence_signal(job->out_fence);
380− dma_fence_put(job->out_fence);
381− }
382− }
380+
383381 spin_unlock_irqrestore(&wb_connector->job_lock, flags);
384382
385383 if (WARN_ON(!job))
386384 return;
387385
386+ out_fence = job->out_fence;
387+ if (out_fence) {
388+ if (status)
389+ dma_fence_set_error(out_fence, status);
390+ dma_fence_signal(out_fence);
391+ dma_fence_put(out_fence);
392+ job->out_fence = NULL;
393+ }
394+
388395 INIT_WORK(&job->cleanup_work, cleanup_work);
389396 queue_work(system_long_wq, &job->cleanup_work);
390397 }
drivers/gpu/drm/i915/display/intel_display.c+8−4
@@ -7261,7 +7261,7 @@ retry: · 7260 unmodified lines
72617261 pipe_config->fdi_lanes = lane;
72627262
72637263 intel_link_compute_m_n(pipe_config->pipe_bpp, lane, fdi_dotclock,
7264− link_bw, &pipe_config->fdi_m_n, false);
7264+ link_bw, &pipe_config->fdi_m_n, false, false);
72657265
72667266 ret = ironlake_check_fdi_lanes(dev, intel_crtc->pipe, pipe_config);
72677267 if (ret == -EDEADLK)
@@ -7508,11 +7508,15 @@ void · 240 unmodified lines
75087508 intel_link_compute_m_n(u16 bits_per_pixel, int nlanes,
75097509 int pixel_clock, int link_clock,
75107510 struct intel_link_m_n *m_n,
7511− bool constant_n)
7511+ bool constant_n, bool fec_enable)
75127512 {
7513− m_n->tu = 64;
7513+ u32 data_clock = bits_per_pixel * pixel_clock;
7514+
7515+ if (fec_enable)
7516+ data_clock = intel_dp_mode_to_fec_clock(data_clock);
75147517
7515− compute_m_n(bits_per_pixel * pixel_clock,
7518+ m_n->tu = 64;
7519+ compute_m_n(data_clock,
75167520 link_clock * nlanes * 8,
75177521 &m_n->gmch_m, &m_n->gmch_n,
75187522 constant_n);
drivers/gpu/drm/i915/display/intel_display.h+1−1
@@ -414,7 +414,7 @@ enum phy_fia { · 413 unmodified lines
414414 void intel_link_compute_m_n(u16 bpp, int nlanes,
415415 int pixel_clock, int link_clock,
416416 struct intel_link_m_n *m_n,
417− bool constant_n);
417+ bool constant_n, bool fec_enable);
418418 bool is_ccs_modifier(u64 modifier);
419419 void lpt_disable_clkout_dp(struct drm_i915_private *dev_priv);
420420 u32 intel_plane_fb_max_stride(struct drm_i915_private *dev_priv,
drivers/gpu/drm/i915/display/intel_dp.c+95−89
@@ -78,8 +78,8 @@ · 77 unmodified lines
7878 #define DP_DSC_MAX_ENC_THROUGHPUT_0 340000
7979 #define DP_DSC_MAX_ENC_THROUGHPUT_1 400000
8080
81−/* DP DSC FEC Overhead factor = (100 - 2.4)/100 */
82−#define DP_DSC_FEC_OVERHEAD_FACTOR 976
81+/* DP DSC FEC Overhead factor = 1/(0.972261) */
82+#define DP_DSC_FEC_OVERHEAD_FACTOR 972261
8383
8484 /* Compliance test status bits */
8585 #define INTEL_DP_RESOLUTION_SHIFT_MASK 0
@@ -494,6 +494,97 @@ int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp, · 408 unmodified lines
494494 return 0;
495495 }
496496
497+u32 intel_dp_mode_to_fec_clock(u32 mode_clock)
498+{
499+ return div_u64(mul_u32_u32(mode_clock, 1000000U),
500+ DP_DSC_FEC_OVERHEAD_FACTOR);
501+}
502+
503+static u16 intel_dp_dsc_get_output_bpp(u32 link_clock, u32 lane_count,
504+ u32 mode_clock, u32 mode_hdisplay)
505+{
506+ u32 bits_per_pixel, max_bpp_small_joiner_ram;
507+ int i;
508+
509+ /*
510+ * Available Link Bandwidth(Kbits/sec) = (NumberOfLanes)*
511+ * (LinkSymbolClock)* 8 * (TimeSlotsPerMTP)
512+ * for SST -> TimeSlotsPerMTP is 1,
513+ * for MST -> TimeSlotsPerMTP has to be calculated
514+ */
515+ bits_per_pixel = (link_clock * lane_count * 8) /
516+ intel_dp_mode_to_fec_clock(mode_clock);
517+ DRM_DEBUG_KMS("Max link bpp: %u\n", bits_per_pixel);
518+
519+ /* Small Joiner Check: output bpp <= joiner RAM (bits) / Horiz. width */
520+ max_bpp_small_joiner_ram = DP_DSC_MAX_SMALL_JOINER_RAM_BUFFER / mode_hdisplay;
521+ DRM_DEBUG_KMS("Max small joiner bpp: %u\n", max_bpp_small_joiner_ram);
522+
523+ /*
524+ * Greatest allowed DSC BPP = MIN (output BPP from available Link BW
525+ * check, output bpp from small joiner RAM check)
526+ */
527+ bits_per_pixel = min(bits_per_pixel, max_bpp_small_joiner_ram);
528+
529+ /* Error out if the max bpp is less than smallest allowed valid bpp */
530+ if (bits_per_pixel < valid_dsc_bpp[0]) {
531+ DRM_DEBUG_KMS("Unsupported BPP %u, min %u\n",
532+ bits_per_pixel, valid_dsc_bpp[0]);
533+ return 0;
534+ }
535+
536+ /* Find the nearest match in the array of known BPPs from VESA */
537+ for (i = 0; i < ARRAY_SIZE(valid_dsc_bpp) - 1; i++) {
538+ if (bits_per_pixel < valid_dsc_bpp[i + 1])
539+ break;
540+ }
541+ bits_per_pixel = valid_dsc_bpp[i];
542+
543+ /*
544+ * Compressed BPP in U6.4 format so multiply by 16, for Gen 11,
545+ * fractional part is 0
546+ */
547+ return bits_per_pixel << 4;
548+}
549+
550+static u8 intel_dp_dsc_get_slice_count(struct intel_dp *intel_dp,
551+ int mode_clock, int mode_hdisplay)
552+{
553+ u8 min_slice_count, i;
554+ int max_slice_width;
555+
556+ if (mode_clock <= DP_DSC_PEAK_PIXEL_RATE)
557+ min_slice_count = DIV_ROUND_UP(mode_clock,
558+ DP_DSC_MAX_ENC_THROUGHPUT_0);
559+ else
560+ min_slice_count = DIV_ROUND_UP(mode_clock,
561+ DP_DSC_MAX_ENC_THROUGHPUT_1);
562+
563+ max_slice_width = drm_dp_dsc_sink_max_slice_width(intel_dp->dsc_dpcd);
564+ if (max_slice_width < DP_DSC_MIN_SLICE_WIDTH_VALUE) {
565+ DRM_DEBUG_KMS("Unsupported slice width %d by DP DSC Sink device\n",
566+ max_slice_width);
567+ return 0;
568+ }
569+ /* Also take into account max slice width */
570+ min_slice_count = min_t(u8, min_slice_count,
571+ DIV_ROUND_UP(mode_hdisplay,
572+ max_slice_width));
573+
574+ /* Find the closest match to the valid slice count values */
575+ for (i = 0; i < ARRAY_SIZE(valid_dsc_slicecount); i++) {
576+ if (valid_dsc_slicecount[i] >
577+ drm_dp_dsc_sink_max_slice_count(intel_dp->dsc_dpcd,
578+ false))
579+ break;
580+ if (min_slice_count <= valid_dsc_slicecount[i])
581+ return valid_dsc_slicecount[i];
582+ }
583+
584+ DRM_DEBUG_KMS("Unsupported Slice Count %d\n", min_slice_count);
585+ return 0;
586+}
587+
497588 static enum drm_mode_status
498589 intel_dp_mode_valid(struct drm_connector *connector,
499590 struct drm_display_mode *mode)
@@ -2226,7 +2317,7 @@ intel_dp_compute_config(struct intel_encoder *encoder, · 1726 unmodified lines
22262317 adjusted_mode->crtc_clock,
22272318 pipe_config->port_clock,
22282319 &pipe_config->dp_m_n,
2229− constant_n);
2320+ constant_n, pipe_config->fec_enable);
22302321
22312322 if (intel_connector->panel.downclock_mode != NULL &&
22322323 dev_priv->drrs.type == SEAMLESS_DRRS_SUPPORT) {
@@ -2236,7 +2327,7 @@ intel_dp_compute_config(struct intel_encoder *encoder, · 3 unmodified lines
22362327 intel_connector->panel.downclock_mode->clock,
22372328 pipe_config->port_clock,
22382329 &pipe_config->dp_m2_n2,
2239− constant_n);
2330+ constant_n, pipe_config->fec_enable);
22402331 }
22412332
22422333 if (!HAS_DDI(dev_priv))
@@ -4323,91 +4414,6 @@ intel_dp_get_sink_irq_esi(struct intel_dp *intel_dp, u8 *sink_irq_vector) · 2080 unmodified lines
43234414 DP_DPRX_ESI_LEN;
43244415 }
43254416
4326−u16 intel_dp_dsc_get_output_bpp(int link_clock, u8 lane_count,
4327− int mode_clock, int mode_hdisplay)
4328−{
4329− u16 bits_per_pixel, max_bpp_small_joiner_ram;
4330− int i;
4331−
4332− /*
4333− * Available Link Bandwidth(Kbits/sec) = (NumberOfLanes)*
4334− * (LinkSymbolClock)* 8 * ((100-FECOverhead)/100)*(TimeSlotsPerMTP)
4335− * FECOverhead = 2.4%, for SST -> TimeSlotsPerMTP is 1,
4336− * for MST -> TimeSlotsPerMTP has to be calculated
4337− */
4338− bits_per_pixel = (link_clock * lane_count * 8 *
4339− DP_DSC_FEC_OVERHEAD_FACTOR) /
4340− mode_clock;
4341−
4342− /* Small Joiner Check: output bpp <= joiner RAM (bits) / Horiz. width */
4343− max_bpp_small_joiner_ram = DP_DSC_MAX_SMALL_JOINER_RAM_BUFFER /
4344− mode_hdisplay;
4345−
4346− /*
4347− * Greatest allowed DSC BPP = MIN (output BPP from avaialble Link BW
4348− * check, output bpp from small joiner RAM check)
4349− */
4350− bits_per_pixel = min(bits_per_pixel, max_bpp_small_joiner_ram);
4351−
4352− /* Error out if the max bpp is less than smallest allowed valid bpp */
4353− if (bits_per_pixel < valid_dsc_bpp[0]) {
4354− DRM_DEBUG_KMS("Unsupported BPP %d\n", bits_per_pixel);
4355− return 0;
4356− }
4357−
4358− /* Find the nearest match in the array of known BPPs from VESA */
4359− for (i = 0; i < ARRAY_SIZE(valid_dsc_bpp) - 1; i++) {
4360− if (bits_per_pixel < valid_dsc_bpp[i + 1])
4361− break;
4362− }
4363− bits_per_pixel = valid_dsc_bpp[i];
4364−
4365− /*
4366− * Compressed BPP in U6.4 format so multiply by 16, for Gen 11,
4367− * fractional part is 0
4368− */
4369− return bits_per_pixel << 4;
4370−}
4371−
4372−u8 intel_dp_dsc_get_slice_count(struct intel_dp *intel_dp,
4373− int mode_clock,
4374− int mode_hdisplay)
4375−{
4376− u8 min_slice_count, i;
4377− int max_slice_width;
4378−
4379− if (mode_clock <= DP_DSC_PEAK_PIXEL_RATE)
4380− min_slice_count = DIV_ROUND_UP(mode_clock,
4381− DP_DSC_MAX_ENC_THROUGHPUT_0);
4382− else
4383− min_slice_count = DIV_ROUND_UP(mode_clock,
4384− DP_DSC_MAX_ENC_THROUGHPUT_1);
4385−
4386− max_slice_width = drm_dp_dsc_sink_max_slice_width(intel_dp->dsc_dpcd);
4387− if (max_slice_width < DP_DSC_MIN_SLICE_WIDTH_VALUE) {
4388− DRM_DEBUG_KMS("Unsupported slice width %d by DP DSC Sink device\n",
4389− max_slice_width);
4390− return 0;
4391− }
4392− /* Also take into account max slice width */
4393− min_slice_count = min_t(u8, min_slice_count,
4394− DIV_ROUND_UP(mode_hdisplay,
4395− max_slice_width));
4396−
4397− /* Find the closest match to the valid slice count values */
4398− for (i = 0; i < ARRAY_SIZE(valid_dsc_slicecount); i++) {
4399− if (valid_dsc_slicecount[i] >
4400− drm_dp_dsc_sink_max_slice_count(intel_dp->dsc_dpcd,
4401− false))
4402− break;
4403− if (min_slice_count <= valid_dsc_slicecount[i])
4404− return valid_dsc_slicecount[i];
4405− }
4406−
4407− DRM_DEBUG_KMS("Unsupported Slice Count %d\n", min_slice_count);
4408− return 0;
4409−}
4410−
44114417 static void
44124418 intel_pixel_encoding_setup_vsc(struct intel_dp *intel_dp,
44134419 const struct intel_crtc_state *crtc_state)
drivers/gpu/drm/i915/display/intel_dp.h+2−4
@@ -102,10 +102,6 @@ bool intel_dp_source_supports_hbr2(struct intel_dp *intel_dp); · 101 unmodified lines
102102 bool intel_dp_source_supports_hbr3(struct intel_dp *intel_dp);
103103 bool
104104 intel_dp_get_link_status(struct intel_dp *intel_dp, u8 *link_status);
105−u16 intel_dp_dsc_get_output_bpp(int link_clock, u8 lane_count,
106− int mode_clock, int mode_hdisplay);
107−u8 intel_dp_dsc_get_slice_count(struct intel_dp *intel_dp, int mode_clock,
108− int mode_hdisplay);
109105
110106 bool intel_dp_read_dpcd(struct intel_dp *intel_dp);
111107 bool intel_dp_get_colorimetry_status(struct intel_dp *intel_dp);
@@ -118,4 +114,6 @@ static inline unsigned int intel_dp_unused_lane_mask(int lane_count) · 6 unmodified lines
118114 return ~((1 << lane_count) - 1) & 0xf;
119115 }
120116
117+u32 intel_dp_mode_to_fec_clock(u32 mode_clock);
118+
121119 #endif /* __INTEL_DP_H__ */
drivers/gpu/drm/i915/display/intel_dp_mst.c+2−2
@@ -81,7 +81,7 @@ static int intel_dp_mst_compute_link_config(struct intel_encoder *encoder, · 80 unmodified lines
8181 adjusted_mode->crtc_clock,
8282 crtc_state->port_clock,
8383 &crtc_state->dp_m_n,
84− constant_n);
84+ constant_n, crtc_state->fec_enable);
8585 crtc_state->dp_m_n.tu = slots;
8686
8787 return 0;
@@ -615,7 +615,7 @@ intel_dp_create_fake_mst_encoder(struct intel_digital_port *intel_dig_port, enum · 527 unmodified lines
615615 intel_encoder->type = INTEL_OUTPUT_DP_MST;
616616 intel_encoder->power_domain = intel_dig_port->base.power_domain;
617617 intel_encoder->port = intel_dig_port->base.port;
618− intel_encoder->crtc_mask = BIT(pipe);
618+ intel_encoder->crtc_mask = 0x7;
619619 intel_encoder->cloneable = 0;
620620
621621 intel_encoder->compute_config = intel_dp_mst_compute_config;
drivers/gpu/drm/i915/display/intel_sprite.c+3−2
@@ -1528,6 +1528,7 @@ g4x_sprite_check_scaling(struct intel_crtc_state *crtc_state, · 1527 unmodified lines
15281528 int src_x, src_w, src_h, crtc_w, crtc_h;
15291529 const struct drm_display_mode *adjusted_mode =
15301530 &crtc_state->base.adjusted_mode;
1531+ unsigned int stride = plane_state->color_plane[0].stride;
15311532 unsigned int cpp = fb->format->cpp[0];
15321533 unsigned int width_bytes;
15331534 int min_width, min_height;
@@ -1569,9 +1570,9 @@ g4x_sprite_check_scaling(struct intel_crtc_state *crtc_state, · 35 unmodified lines
15691570 return -EINVAL;
15701571 }
15711572
1572− if (width_bytes > 4096 || fb->pitches[0] > 4096) {
1573+ if (stride > 4096) {
15731574 DRM_DEBUG_KMS("Stride (%u) exceeds hardware max with scaling (%u)\n",
1574− fb->pitches[0], 4096);
1575+ stride, 4096);
15751576 return -EINVAL;
15761577 }
15771578
drivers/gpu/drm/omapdrm/dss/dss.c+1−1
@@ -1083,7 +1083,7 @@ static const struct dss_features omap34xx_dss_feats = { · 1082 unmodified lines
10831083
10841084 static const struct dss_features omap3630_dss_feats = {
10851085 .model = DSS_MODEL_OMAP3,
1086− .fck_div_max = 32,
1086+ .fck_div_max = 31,
10871087 .fck_freq_max = 173000000,
10881088 .dss_fck_multiplier = 1,
10891089 .parent_clk_name = "dpll4_ck",
drivers/gpu/drm/rcar-du/rcar_du_writeback.c+2−2
@@ -147,7 +147,7 @@ static int rcar_du_wb_enc_atomic_check(struct drm_encoder *encoder, · 146 unmodified lines
147147 struct drm_device *dev = encoder->dev;
148148 struct drm_framebuffer *fb;
149149
150− if (!conn_state->writeback_job || !conn_state->writeback_job->fb)
150+ if (!conn_state->writeback_job)
151151 return 0;
152152
153153 fb = conn_state->writeback_job->fb;
@@ -221,7 +221,7 @@ void rcar_du_writeback_setup(struct rcar_du_crtc *rcrtc, · 67 unmodified lines
221221 unsigned int i;
222222
223223 state = rcrtc->writeback.base.state;
224− if (!state || !state->writeback_job || !state->writeback_job->fb)
224+ if (!state || !state->writeback_job)
225225 return;
226226
227227 fb = state->writeback_job->fb;
drivers/gpu/drm/tilcdc/tilcdc_tfp410.c+1−0
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 #include <linux/gpio.h>
88 #include <linux/mod_devicetable.h>
99 #include <linux/of_gpio.h>
10+#include <linux/pinctrl/consumer.h>
1011 #include <linux/platform_device.h>
1112
1213 #include <drm/drm_atomic_helper.h>
drivers/gpu/drm/vc4/vc4_txp.c+2−3
@@ -231,7 +231,7 @@ static int vc4_txp_connector_atomic_check(struct drm_connector *conn, · 230 unmodified lines
231231 int i;
232232
233233 conn_state = drm_atomic_get_new_connector_state(state, conn);
234− if (!conn_state->writeback_job || !conn_state->writeback_job->fb)
234+ if (!conn_state->writeback_job)
235235 return 0;
236236
237237 crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
@@ -271,8 +271,7 @@ static void vc4_txp_connector_atomic_commit(struct drm_connector *conn, · 33 unmodified lines
271271 u32 ctrl;
272272 int i;
273273
274− if (WARN_ON(!conn_state->writeback_job ||
275− !conn_state->writeback_job->fb))
274+ if (WARN_ON(!conn_state->writeback_job))
276275 return;
277276
278277 mode = &conn_state->crtc->state->adjusted_mode;
drivers/net/dsa/qca8k.c+2−2
@@ -705,7 +705,7 @@ qca8k_setup(struct dsa_switch *ds) · 704 unmodified lines
705705 BIT(0) << QCA8K_GLOBAL_FW_CTRL1_UC_DP_S);
706706
707707 /* Setup connection between CPU port & user ports */
708− for (i = 0; i < DSA_MAX_PORTS; i++) {
708+ for (i = 0; i < QCA8K_NUM_PORTS; i++) {
709709 /* CPU port gets connected to all user ports of the switch */
710710 if (dsa_is_cpu_port(ds, i)) {
711711 qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(QCA8K_CPU_PORT),
@@ -1077,7 +1077,7 @@ qca8k_sw_probe(struct mdio_device *mdiodev) · 365 unmodified lines
10771077 if (id != QCA8K_ID_QCA8337)
10781078 return -ENODEV;
10791079
1080− priv->ds = dsa_switch_alloc(&mdiodev->dev, DSA_MAX_PORTS);
1080+ priv->ds = dsa_switch_alloc(&mdiodev->dev, QCA8K_NUM_PORTS);
10811081 if (!priv->ds)
10821082 return -ENOMEM;
10831083
drivers/net/dsa/rtl8366.c+7−4
@@ -339,10 +339,12 @@ int rtl8366_vlan_prepare(struct dsa_switch *ds, int port, · 338 unmodified lines
339339 const struct switchdev_obj_port_vlan *vlan)
340340 {
341341 struct realtek_smi *smi = ds->priv;
342+ u16 vid;
342343 int ret;
343344
344− if (!smi->ops->is_vlan_valid(smi, port))
345− return -EINVAL;
345+ for (vid = vlan->vid_begin; vid < vlan->vid_end; vid++)
346+ if (!smi->ops->is_vlan_valid(smi, vid))
347+ return -EINVAL;
346348
347349 dev_info(smi->dev, "prepare VLANs %04x..%04x\n",
348350 vlan->vid_begin, vlan->vid_end);
@@ -370,8 +372,9 @@ void rtl8366_vlan_add(struct dsa_switch *ds, int port, · 21 unmodified lines
370372 u16 vid;
371373 int ret;
372374
373− if (!smi->ops->is_vlan_valid(smi, port))
374− return;
375+ for (vid = vlan->vid_begin; vid < vlan->vid_end; vid++)
376+ if (!smi->ops->is_vlan_valid(smi, vid))
377+ return;
375378
376379 dev_info(smi->dev, "add VLAN on port %d, %s, %s\n",
377380 port,
drivers/net/dsa/rtl8366rb.c+10−6
@@ -507,7 +507,8 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi) · 506 unmodified lines
507507 irq = of_irq_get(intc, 0);
508508 if (irq <= 0) {
509509 dev_err(smi->dev, "failed to get parent IRQ\n");
510− return irq ? irq : -EINVAL;
510+ ret = irq ? irq : -EINVAL;
511+ goto out_put_node;
511512 }
512513
513514 /* This clears the IRQ status register */
@@ -515,7 +516,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi) · 1 unmodified line
515516 &val);
516517 if (ret) {
517518 dev_err(smi->dev, "can't read interrupt status\n");
518− return ret;
519+ goto out_put_node;
519520 }
520521
521522 /* Fetch IRQ edge information from the descriptor */
@@ -537,7 +538,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi) · 15 unmodified lines
537538 val);
538539 if (ret) {
539540 dev_err(smi->dev, "could not configure IRQ polarity\n");
540− return ret;
541+ goto out_put_node;
541542 }
542543
543544 ret = devm_request_threaded_irq(smi->dev, irq, NULL,
@@ -545,7 +546,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi) · 1 unmodified line
545546 "RTL8366RB", smi);
546547 if (ret) {
547548 dev_err(smi->dev, "unable to request irq: %d\n", ret);
548− return ret;
549+ goto out_put_node;
549550 }
550551 smi->irqdomain = irq_domain_add_linear(intc,
551552 RTL8366RB_NUM_INTERRUPT,
@@ -553,12 +554,15 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi) · 1 unmodified line
553554 smi);
554555 if (!smi->irqdomain) {
555556 dev_err(smi->dev, "failed to create IRQ domain\n");
556− return -EINVAL;
557+ ret = -EINVAL;
558+ goto out_put_node;
557559 }
558560 for (i = 0; i < smi->num_ports; i++)
559561 irq_set_parent(irq_create_mapping(smi->irqdomain, i), irq);
560562
561− return 0;
563+out_put_node:
564+ of_node_put(intc);
565+ return ret;
562566 }
563567
564568 static int rtl8366rb_set_addr(struct realtek_smi *smi)
drivers/net/dsa/sja1105/sja1105_main.c+14−10
@@ -1897,7 +1897,9 @@ static int sja1105_set_ageing_time(struct dsa_switch *ds, · 1896 unmodified lines
18971897 return sja1105_static_config_reload(priv);
18981898 }
18991899
1900−/* Caller must hold priv->tagger_data.meta_lock */
1900+/* Must be called only with priv->tagger_data.state bit
1901+ * SJA1105_HWTS_RX_EN cleared
1902+ */
19011903 static int sja1105_change_rxtstamping(struct sja1105_private *priv,
19021904 bool on)
19031905 {
@@ -1954,16 +1956,17 @@ static int sja1105_hwtstamp_set(struct dsa_switch *ds, int port, · 50 unmodified lines
19541956 break;
19551957 }
19561958
1957− if (rx_on != priv->tagger_data.hwts_rx_en) {
1958− spin_lock(&priv->tagger_data.meta_lock);
1959+ if (rx_on != test_bit(SJA1105_HWTS_RX_EN, &priv->tagger_data.state)) {
1960+ clear_bit(SJA1105_HWTS_RX_EN, &priv->tagger_data.state);
1961+
19591962 rc = sja1105_change_rxtstamping(priv, rx_on);
1960− spin_unlock(&priv->tagger_data.meta_lock);
19611963 if (rc < 0) {
19621964 dev_err(ds->dev,
19631965 "Failed to change RX timestamping: %d\n", rc);
1964− return -EFAULT;
1966+ return rc;
19651967 }
1966− priv->tagger_data.hwts_rx_en = rx_on;
1968+ if (rx_on)
1969+ set_bit(SJA1105_HWTS_RX_EN, &priv->tagger_data.state);
19671970 }
19681971
19691972 if (copy_to_user(ifr->ifr_data, &config, sizeof(config)))
@@ -1982,7 +1985,7 @@ static int sja1105_hwtstamp_get(struct dsa_switch *ds, int port, · 12 unmodified lines
19821985 config.tx_type = HWTSTAMP_TX_ON;
19831986 else
19841987 config.tx_type = HWTSTAMP_TX_OFF;
1985− if (priv->tagger_data.hwts_rx_en)
1988+ if (test_bit(SJA1105_HWTS_RX_EN, &priv->tagger_data.state))
19861989 config.rx_filter = HWTSTAMP_FILTER_PTP_V2_L2_EVENT;
19871990 else
19881991 config.rx_filter = HWTSTAMP_FILTER_NONE;
@@ -2005,12 +2008,12 @@ static void sja1105_rxtstamp_work(struct work_struct *work) · 16 unmodified lines
20052008
20062009 mutex_lock(&priv->ptp_lock);
20072010
2008− now = priv->tstamp_cc.read(&priv->tstamp_cc);
2009−
20102011 while ((skb = skb_dequeue(&data->skb_rxtstamp_queue)) != NULL) {
20112012 struct skb_shared_hwtstamps *shwt = skb_hwtstamps(skb);
20122013 u64 ts;
20132014
2015+ now = priv->tstamp_cc.read(&priv->tstamp_cc);
2016+
20142017 *shwt = (struct skb_shared_hwtstamps) {0};
20152018
20162019 ts = SJA1105_SKB_CB(skb)->meta_tstamp;
@@ -2031,7 +2034,7 @@ static bool sja1105_port_rxtstamp(struct dsa_switch *ds, int port, · 14 unmodified lines
20312034 struct sja1105_private *priv = ds->priv;
20322035 struct sja1105_tagger_data *data = &priv->tagger_data;
20332036
2034− if (!data->hwts_rx_en)
2037+ if (!test_bit(SJA1105_HWTS_RX_EN, &data->state))
20352038 return false;
20362039
20372040 /* We need to read the full PTP clock to reconstruct the Rx
@@ -2201,6 +2204,7 @@ static int sja1105_probe(struct spi_device *spi) · 163 unmodified lines
22012204 tagger_data = &priv->tagger_data;
22022205 skb_queue_head_init(&tagger_data->skb_rxtstamp_queue);
22032206 INIT_WORK(&tagger_data->rxtstamp_work, sja1105_rxtstamp_work);
2207+ spin_lock_init(&tagger_data->meta_lock);
22042208
22052209 /* Connections between dsa_port and sja1105_port */
22062210 for (i = 0; i < SJA1105_NUM_PORTS; i++) {
drivers/net/dsa/sja1105/sja1105_spi.c+4−2
@@ -409,7 +409,8 @@ int sja1105_static_config_upload(struct sja1105_private *priv) · 408 unmodified lines
409409 rc = static_config_buf_prepare_for_upload(priv, config_buf, buf_len);
410410 if (rc < 0) {
411411 dev_err(dev, "Invalid config, cannot upload\n");
412− return -EINVAL;
412+ rc = -EINVAL;
413+ goto out;
413414 }
414415 /* Prevent PHY jabbering during switch reset by inhibiting
415416 * Tx on all ports and waiting for current packet to drain.
@@ -418,7 +419,8 @@ int sja1105_static_config_upload(struct sja1105_private *priv) · 2 unmodified lines
418419 rc = sja1105_inhibit_tx(priv, port_bitmap, true);
419420 if (rc < 0) {
420421 dev_err(dev, "Failed to inhibit Tx on ports\n");
421− return -ENXIO;
422+ rc = -ENXIO;
423+ goto out;
422424 }
423425 /* Wait for an eventual egress packet to finish transmission
424426 * (reach IFG). It is guaranteed that a second one will not
drivers/net/ethernet/atheros/ag71xx.c+4−2
@@ -526,7 +526,7 @@ static int ag71xx_mdio_probe(struct ag71xx *ag) · 525 unmodified lines
526526 struct device *dev = &ag->pdev->dev;
527527 struct net_device *ndev = ag->ndev;
528528 static struct mii_bus *mii_bus;
529− struct device_node *np;
529+ struct device_node *np, *mnp;
530530 int err;
531531
532532 np = dev->of_node;
@@ -571,7 +571,9 @@ static int ag71xx_mdio_probe(struct ag71xx *ag) · 38 unmodified lines
571571 msleep(200);
572572 }
573573
574− err = of_mdiobus_register(mii_bus, np);
574+ mnp = of_get_child_by_name(np, "mdio");
575+ err = of_mdiobus_register(mii_bus, mnp);
576+ of_node_put(mnp);
575577 if (err)
576578 goto mdio_err_put_clk;
577579
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c+6−3
@@ -137,13 +137,12 @@ static int uldrx_handler(struct sge_rspq *q, const __be64 *rsp, · 136 unmodified lines
137137 static int alloc_uld_rxqs(struct adapter *adap,
138138 struct sge_uld_rxq_info *rxq_info, bool lro)
139139 {
140− struct sge *s = &adap->sge;
141140 unsigned int nq = rxq_info->nrxq + rxq_info->nciq;
141+ int i, err, msi_idx, que_idx = 0, bmap_idx = 0;
142142 struct sge_ofld_rxq *q = rxq_info->uldrxq;
143143 unsigned short *ids = rxq_info->rspq_id;
144− unsigned int bmap_idx = 0;
144+ struct sge *s = &adap->sge;
145145 unsigned int per_chan;
146− int i, err, msi_idx, que_idx = 0;
147146
148147 per_chan = rxq_info->nrxq / adap->params.nports;
149148
@@ -161,6 +160,10 @@ static int alloc_uld_rxqs(struct adapter *adap, · 11 unmodified lines
161160
162161 if (msi_idx >= 0) {
163162 bmap_idx = get_msix_idx_from_bmap(adap);
163+ if (bmap_idx < 0) {
164+ err = -ENOSPC;
165+ goto freeout;
166+ }
164167 msi_idx = adap->msix_info_ulds[bmap_idx].idx;
165168 }
166169 err = t4_sge_alloc_rxq(adap, &q->rspq, false,
drivers/net/ethernet/hisilicon/hns_mdio.c+5−1
@@ -148,11 +148,15 @@ static int mdio_sc_cfg_reg_write(struct hns_mdio_device *mdio_dev, · 147 unmodified lines
148148 {
149149 u32 time_cnt;
150150 u32 reg_value;
151+ int ret;
151152
152153 regmap_write(mdio_dev->subctrl_vbase, cfg_reg, set_val);
153154
154155 for (time_cnt = MDIO_TIMEOUT; time_cnt; time_cnt--) {
155− regmap_read(mdio_dev->subctrl_vbase, st_reg, &reg_value);
156+ ret = regmap_read(mdio_dev->subctrl_vbase, st_reg, &reg_value);
157+ if (ret)
158+ return ret;
159+
156160 reg_value &= st_msk;
157161 if ((!!check_st) == (!!reg_value))
158162 break;
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c+2−1
@@ -137,7 +137,8 @@ dr_icm_pool_mr_create(struct mlx5dr_icm_pool *pool, · 136 unmodified lines
137137
138138 icm_mr->icm_start_addr = icm_mr->dm.addr;
139139
140− align_diff = icm_mr->icm_start_addr % align_base;
140+ /* align_base is always a power of 2 */
141+ align_diff = icm_mr->icm_start_addr & (align_base - 1);
141142 if (align_diff)
142143 icm_mr->used_length = align_base - align_diff;
143144
drivers/net/ethernet/mscc/ocelot_board.c+8−6
@@ -388,13 +388,14 @@ static int mscc_ocelot_probe(struct platform_device *pdev) · 387 unmodified lines
388388 continue;
389389
390390 phy = of_phy_find_device(phy_node);
391+ of_node_put(phy_node);
391392 if (!phy)
392393 continue;
393394
394395 err = ocelot_probe_port(ocelot, port, regs, phy);
395396 if (err) {
396397 of_node_put(portnp);
397− return err;
398+ goto out_put_ports;
398399 }
399400
400401 phy_mode = of_get_phy_mode(portnp);
@@ -422,7 +423,8 @@ static int mscc_ocelot_probe(struct platform_device *pdev) · 21 unmodified lines
422423 "invalid phy mode for port%d, (Q)SGMII only\n",
423424 port);
424425 of_node_put(portnp);
425− return -EINVAL;
426+ err = -EINVAL;
427+ goto out_put_ports;
426428 }
427429
428430 serdes = devm_of_phy_get(ocelot->dev, portnp, NULL);
@@ -435,7 +437,8 @@ static int mscc_ocelot_probe(struct platform_device *pdev) · 6 unmodified lines
435437 "missing SerDes phys for port%d\n",
436438 port);
437439
438− goto err_probe_ports;
440+ of_node_put(portnp);
441+ goto out_put_ports;
439442 }
440443
441444 ocelot->ports[port]->serdes = serdes;
@@ -447,9 +450,8 @@ static int mscc_ocelot_probe(struct platform_device *pdev) · 5 unmodified lines
447450
448451 dev_info(&pdev->dev, "Ocelot switch probed\n");
449452
450− return 0;
451−
452−err_probe_ports:
453+out_put_ports:
454+ of_node_put(ports);
453455 return err;
454456 }
455457
drivers/net/ethernet/pensando/Kconfig+1−0
@@ -20,6 +20,7 @@ if NET_VENDOR_PENSANDO · 19 unmodified lines
2020 config IONIC
2121 tristate "Pensando Ethernet IONIC Support"
2222 depends on 64BIT && PCI
23+ select NET_DEVLINK
2324 help
2425 This enables the support for the Pensando family of Ethernet
2526 adapters. More specific information on this driver can be
drivers/net/ethernet/qlogic/qla3xxx.c+1−0
@@ -2787,6 +2787,7 @@ static int ql_alloc_large_buffers(struct ql3_adapter *qdev) · 2786 unmodified lines
27872787 netdev_err(qdev->ndev,
27882788 "PCI mapping failed with error: %d\n",
27892789 err);
2790+ dev_kfree_skb_irq(skb);
27902791 ql_free_large_buffers(qdev);
27912792 return -ENOMEM;
27922793 }
drivers/net/ethernet/socionext/netsec.c+7−23
@@ -282,7 +282,6 @@ struct netsec_desc_ring { · 281 unmodified lines
282282 void *vaddr;
283283 u16 head, tail;
284284 u16 xdp_xmit; /* netsec_xdp_xmit packets */
285− bool is_xdp;
286285 struct page_pool *page_pool;
287286 struct xdp_rxq_info xdp_rxq;
288287 spinlock_t lock; /* XDP tx queue locking */
@@ -634,8 +633,7 @@ static bool netsec_clean_tx_dring(struct netsec_priv *priv) · 345 unmodified lines
634633 unsigned int bytes;
635634 int cnt = 0;
636635
637− if (dring->is_xdp)
638− spin_lock(&dring->lock);
636+ spin_lock(&dring->lock);
639637
640638 bytes = 0;
641639 entry = dring->vaddr + DESC_SZ * tail;
@@ -682,8 +680,8 @@ next: · 40 unmodified lines
682680 entry = dring->vaddr + DESC_SZ * tail;
683681 cnt++;
684682 }
685− if (dring->is_xdp)
686− spin_unlock(&dring->lock);
683+
684+ spin_unlock(&dring->lock);
687685
688686 if (!cnt)
689687 return false;
@@ -799,9 +797,6 @@ static void netsec_set_tx_de(struct netsec_priv *priv, · 109 unmodified lines
799797 de->data_buf_addr_lw = lower_32_bits(desc->dma_addr);
800798 de->buf_len_info = (tx_ctrl->tcp_seg_len << 16) | desc->len;
801799 de->attr = attr;
802− /* under spin_lock if using XDP */
803− if (!dring->is_xdp)
804− dma_wmb();
805800
806801 dring->desc[idx] = *desc;
807802 if (desc->buf_type == TYPE_NETSEC_SKB)
@@ -1123,12 +1118,10 @@ static netdev_tx_t netsec_netdev_start_xmit(struct sk_buff *skb, · 315 unmodified lines
11231118 u16 tso_seg_len = 0;
11241119 int filled;
11251120
1126− if (dring->is_xdp)
1127− spin_lock_bh(&dring->lock);
1121+ spin_lock_bh(&dring->lock);
11281122 filled = netsec_desc_used(dring);
11291123 if (netsec_check_stop_tx(priv, filled)) {
1130− if (dring->is_xdp)
1131− spin_unlock_bh(&dring->lock);
1124+ spin_unlock_bh(&dring->lock);
11321125 net_warn_ratelimited("%s %s Tx queue full\n",
11331126 dev_name(priv->dev), ndev->name);
11341127 return NETDEV_TX_BUSY;
@@ -1161,8 +1154,7 @@ static netdev_tx_t netsec_netdev_start_xmit(struct sk_buff *skb, · 26 unmodified lines
11611154 tx_desc.dma_addr = dma_map_single(priv->dev, skb->data,
11621155 skb_headlen(skb), DMA_TO_DEVICE);
11631156 if (dma_mapping_error(priv->dev, tx_desc.dma_addr)) {
1164− if (dring->is_xdp)
1165− spin_unlock_bh(&dring->lock);
1157+ spin_unlock_bh(&dring->lock);
11661158 netif_err(priv, drv, priv->ndev,
11671159 "%s: DMA mapping failed\n", __func__);
11681160 ndev->stats.tx_dropped++;
@@ -1177,8 +1169,7 @@ static netdev_tx_t netsec_netdev_start_xmit(struct sk_buff *skb, · 8 unmodified lines
11771169 netdev_sent_queue(priv->ndev, skb->len);
11781170
11791171 netsec_set_tx_de(priv, dring, &tx_ctrl, &tx_desc, skb);
1180− if (dring->is_xdp)
1181− spin_unlock_bh(&dring->lock);
1172+ spin_unlock_bh(&dring->lock);
11821173 netsec_write(priv, NETSEC_REG_NRM_TX_PKTCNT, 1); /* submit another tx */
11831174
11841175 return NETDEV_TX_OK;
@@ -1262,7 +1253,6 @@ err: · 77 unmodified lines
12621253 static void netsec_setup_tx_dring(struct netsec_priv *priv)
12631254 {
12641255 struct netsec_desc_ring *dring = &priv->desc_ring[NETSEC_RING_TX];
1265− struct bpf_prog *xdp_prog = READ_ONCE(priv->xdp_prog);
12661256 int i;
12671257
12681258 for (i = 0; i < DESC_NUM; i++) {
@@ -1275,12 +1265,6 @@ static void netsec_setup_tx_dring(struct netsec_priv *priv) · 6 unmodified lines
12751265 */
12761266 de->attr = 1U << NETSEC_TX_SHIFT_OWN_FIELD;
12771267 }
1278−
1279− if (xdp_prog)
1280− dring->is_xdp = true;
1281− else
1282− dring->is_xdp = false;
1283−
12841268 }
12851269
12861270 static int netsec_setup_rx_dring(struct netsec_priv *priv)
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c+7−6
@@ -401,8 +401,11 @@ static void dwmac4_set_filter(struct mac_device_info *hw, · 400 unmodified lines
401401 int numhashregs = (hw->multicast_filter_bins >> 5);
402402 int mcbitslog2 = hw->mcast_bits_log2;
403403 unsigned int value;
404+ u32 mc_filter[8];
404405 int i;
405406
407+ memset(mc_filter, 0, sizeof(mc_filter));
408+
406409 value = readl(ioaddr + GMAC_PACKET_FILTER);
407410 value &= ~GMAC_PACKET_FILTER_HMC;
408411 value &= ~GMAC_PACKET_FILTER_HPF;
@@ -416,16 +419,13 @@ static void dwmac4_set_filter(struct mac_device_info *hw, · 7 unmodified lines
416419 /* Pass all multi */
417420 value |= GMAC_PACKET_FILTER_PM;
418421 /* Set all the bits of the HASH tab */
419− for (i = 0; i < numhashregs; i++)
420− writel(0xffffffff, ioaddr + GMAC_HASH_TAB(i));
422+ memset(mc_filter, 0xff, sizeof(mc_filter));
421423 } else if (!netdev_mc_empty(dev)) {
422424 struct netdev_hw_addr *ha;
423− u32 mc_filter[8];
424425
425426 /* Hash filter for multicast */
426427 value |= GMAC_PACKET_FILTER_HMC;
427428
428− memset(mc_filter, 0, sizeof(mc_filter));
429429 netdev_for_each_mc_addr(ha, dev) {
430430 /* The upper n bits of the calculated CRC are used to
431431 * index the contents of the hash table. The number of
@@ -440,10 +440,11 @@ static void dwmac4_set_filter(struct mac_device_info *hw, · 8 unmodified lines
440440 */
441441 mc_filter[bit_nr >> 5] |= (1 << (bit_nr & 0x1f));
442442 }
443− for (i = 0; i < numhashregs; i++)
444− writel(mc_filter[i], ioaddr + GMAC_HASH_TAB(i));
445443 }
446444
445+ for (i = 0; i < numhashregs; i++)
446+ writel(mc_filter[i], ioaddr + GMAC_HASH_TAB(i));
447+
447448 value |= GMAC_PACKET_FILTER_HPF;
448449
449450 /* Handle multiple unicast addresses */
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h+2−1
@@ -84,7 +84,7 @@ · 83 unmodified lines
8484 #define XGMAC_TSIE BIT(12)
8585 #define XGMAC_LPIIE BIT(5)
8686 #define XGMAC_PMTIE BIT(4)
87−#define XGMAC_INT_DEFAULT_EN (XGMAC_LPIIE | XGMAC_PMTIE | XGMAC_TSIE)
87+#define XGMAC_INT_DEFAULT_EN (XGMAC_LPIIE | XGMAC_PMTIE)
8888 #define XGMAC_Qx_TX_FLOW_CTRL(x) (0x00000070 + (x) * 4)
8989 #define XGMAC_PT GENMASK(31, 16)
9090 #define XGMAC_PT_SHIFT 16
@@ -122,6 +122,7 @@ · 31 unmodified lines
122122 #define XGMAC_HWFEAT_GMIISEL BIT(1)
123123 #define XGMAC_HW_FEATURE1 0x00000120
124124 #define XGMAC_HWFEAT_L3L4FNUM GENMASK(30, 27)
125+#define XGMAC_HWFEAT_HASHTBLSZ GENMASK(25, 24)
125126 #define XGMAC_HWFEAT_RSSEN BIT(20)
126127 #define XGMAC_HWFEAT_TSOEN BIT(18)
127128 #define XGMAC_HWFEAT_SPHEN BIT(17)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c+5−4
@@ -472,7 +472,7 @@ static void dwxgmac2_set_filter(struct mac_device_info *hw, · 471 unmodified lines
472472 dwxgmac2_set_mchash(ioaddr, mc_filter, mcbitslog2);
473473
474474 /* Handle multiple unicast addresses */
475− if (netdev_uc_count(dev) > XGMAC_ADDR_MAX) {
475+ if (netdev_uc_count(dev) > hw->unicast_filter_entries) {
476476 value |= XGMAC_FILTER_PR;
477477 } else {
478478 struct netdev_hw_addr *ha;
@@ -523,8 +523,8 @@ static int dwxgmac2_rss_configure(struct mac_device_info *hw, · 44 unmodified lines
523523 struct stmmac_rss *cfg, u32 num_rxq)
524524 {
525525 void __iomem *ioaddr = hw->pcsr;
526+ u32 value, *key;
526527 int i, ret;
527− u32 value;
528528
529529 value = readl(ioaddr + XGMAC_RSS_CTRL);
530530 if (!cfg || !cfg->enable) {
@@ -533,8 +533,9 @@ static int dwxgmac2_rss_configure(struct mac_device_info *hw, · 2 unmodified lines
533533 return 0;
534534 }
535535
536− for (i = 0; i < (sizeof(cfg->key) / sizeof(u32)); i++) {
537− ret = dwxgmac2_rss_write_reg(ioaddr, true, i, cfg->key[i]);
536+ key = (u32 *)cfg->key;
537+ for (i = 0; i < (ARRAY_SIZE(cfg->key) / sizeof(u32)); i++) {
538+ ret = dwxgmac2_rss_write_reg(ioaddr, true, i, key[i]);
538539 if (ret)
539540 return ret;
540541 }
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c+1−0
@@ -380,6 +380,7 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr, · 379 unmodified lines
380380 /* MAC HW feature 1 */
381381 hw_cap = readl(ioaddr + XGMAC_HW_FEATURE1);
382382 dma_cap->l3l4fnum = (hw_cap & XGMAC_HWFEAT_L3L4FNUM) >> 27;
383+ dma_cap->hash_tb_sz = (hw_cap & XGMAC_HWFEAT_HASHTBLSZ) >> 24;
383384 dma_cap->rssen = (hw_cap & XGMAC_HWFEAT_RSSEN) >> 20;
384385 dma_cap->tsoen = (hw_cap & XGMAC_HWFEAT_TSOEN) >> 18;
385386 dma_cap->sphen = (hw_cap & XGMAC_HWFEAT_SPHEN) >> 17;
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+17−8
@@ -629,6 +629,7 @@ static int stmmac_hwtstamp_set(struct net_device *dev, struct ifreq *ifr) · 628 unmodified lines
629629 config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
630630 ptp_v2 = PTP_TCR_TSVER2ENA;
631631 snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
632+ ts_event_en = PTP_TCR_TSEVNTENA;
632633 ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA;
633634 ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA;
634635 ptp_over_ethernet = PTP_TCR_TSIPENA;
@@ -4715,11 +4716,9 @@ int stmmac_suspend(struct device *dev) · 4080 unmodified lines
47154716 if (!ndev || !netif_running(ndev))
47164717 return 0;
47174718
4718− mutex_lock(&priv->lock);
4719+ phylink_mac_change(priv->phylink, false);
47194720
4720− rtnl_lock();
4721− phylink_stop(priv->phylink);
4722− rtnl_unlock();
4721+ mutex_lock(&priv->lock);
47234722
47244723 netif_device_detach(ndev);
47254724 stmmac_stop_all_queues(priv);
@@ -4734,6 +4733,12 @@ int stmmac_suspend(struct device *dev) · 8 unmodified lines
47344733 stmmac_pmt(priv, priv->hw, priv->wolopts);
47354734 priv->irq_wake = 1;
47364735 } else {
4736+ mutex_unlock(&priv->lock);
4737+ rtnl_lock();
4738+ phylink_stop(priv->phylink);
4739+ rtnl_unlock();
4740+ mutex_lock(&priv->lock);
4741+
47374742 stmmac_mac_set(priv, priv->ioaddr, false);
47384743 pinctrl_pm_select_sleep_state(priv->device);
47394744 /* Disable clock in case of PWM is off */
@@ -4824,12 +4829,16 @@ int stmmac_resume(struct device *dev) · 84 unmodified lines
48244829
48254830 stmmac_start_all_queues(priv);
48264831
4827− rtnl_lock();
4828− phylink_start(priv->phylink);
4829− rtnl_unlock();
4830−
48314832 mutex_unlock(&priv->lock);
48324833
4834+ if (!device_may_wakeup(priv->device)) {
4835+ rtnl_lock();
4836+ phylink_start(priv->phylink);
4837+ rtnl_unlock();
4838+ }
4839+
4840+ phylink_mac_change(priv->phylink, true);
4841+
48334842 return 0;
48344843 }
48354844 EXPORT_SYMBOL_GPL(stmmac_resume);
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c+0−4
@@ -1564,10 +1564,6 @@ static int __stmmac_test_jumbo(struct stmmac_priv *priv, u16 queue) · 1563 unmodified lines
15641564 struct stmmac_packet_attrs attr = { };
15651565 int size = priv->dma_buf_sz;
15661566
1567− /* Only XGMAC has SW support for multiple RX descs in same packet */
1568− if (priv->plat->has_xgmac)
1569− size = priv->dev->max_mtu;
1570−
15711567 attr.dst = priv->dev->dev_addr;
15721568 attr.max_size = size - ETH_FCS_LEN;
15731569 attr.queue_mapping = queue;
drivers/net/ieee802154/atusb.c+2−1
@@ -1137,10 +1137,11 @@ static void atusb_disconnect(struct usb_interface *interface) · 1136 unmodified lines
11371137
11381138 ieee802154_unregister_hw(atusb->hw);
11391139
1140+ usb_put_dev(atusb->usb_dev);
1141+
11401142 ieee802154_free_hw(atusb->hw);
11411143
11421144 usb_set_intfdata(interface, NULL);
1143− usb_put_dev(atusb->usb_dev);
11441145
11451146 pr_debug("%s done\n", __func__);
11461147 }
drivers/net/ieee802154/ca8210.c+1−1
@@ -3145,12 +3145,12 @@ static int ca8210_probe(struct spi_device *spi_device) · 3144 unmodified lines
31453145 goto error;
31463146 }
31473147
3148+ priv->spi->dev.platform_data = pdata;
31483149 ret = ca8210_get_platform_data(priv->spi, pdata);
31493150 if (ret) {
31503151 dev_crit(&spi_device->dev, "ca8210_get_platform_data failed\n");
31513152 goto error;
31523153 }
3153− priv->spi->dev.platform_data = pdata;
31543154
31553155 ret = ca8210_dev_com_init(priv);
31563156 if (ret) {
drivers/net/ieee802154/mcr20a.c+1−1
@@ -800,7 +800,7 @@ mcr20a_handle_rx_read_buf_complete(void *context) · 799 unmodified lines
800800 if (!skb)
801801 return;
802802
803− memcpy(skb_put(skb, len), lp->rx_buf, len);
803+ __skb_put_data(skb, lp->rx_buf, len);
804804 ieee802154_rx_irqsafe(lp->hw, skb, lp->rx_lqi[0]);
805805
806806 print_hex_dump_debug("mcr20a rx: ", DUMP_PREFIX_OFFSET, 16, 1,
drivers/net/phy/at803x.c+69−0
@@ -15,6 +15,15 @@ · 14 unmodified lines
1515 #include <linux/of_gpio.h>
1616 #include <linux/gpio/consumer.h>
1717
18+#define AT803X_SPECIFIC_STATUS 0x11
19+#define AT803X_SS_SPEED_MASK (3 << 14)
20+#define AT803X_SS_SPEED_1000 (2 << 14)
21+#define AT803X_SS_SPEED_100 (1 << 14)
22+#define AT803X_SS_SPEED_10 (0 << 14)
23+#define AT803X_SS_DUPLEX BIT(13)
24+#define AT803X_SS_SPEED_DUPLEX_RESOLVED BIT(11)
25+#define AT803X_SS_MDIX BIT(6)
26+
1827 #define AT803X_INTR_ENABLE 0x12
1928 #define AT803X_INTR_ENABLE_AUTONEG_ERR BIT(15)
2029 #define AT803X_INTR_ENABLE_SPEED_CHANGED BIT(14)
@@ -357,6 +366,64 @@ static int at803x_aneg_done(struct phy_device *phydev) · 336 unmodified lines
357366 return aneg_done;
358367 }
359368
369+static int at803x_read_status(struct phy_device *phydev)
370+{
371+ int ss, err, old_link = phydev->link;
372+
373+ /* Update the link, but return if there was an error */
374+ err = genphy_update_link(phydev);
375+ if (err)
376+ return err;
377+
378+ /* why bother the PHY if nothing can have changed */
379+ if (phydev->autoneg == AUTONEG_ENABLE && old_link && phydev->link)
380+ return 0;
381+
382+ phydev->speed = SPEED_UNKNOWN;
383+ phydev->duplex = DUPLEX_UNKNOWN;
384+ phydev->pause = 0;
385+ phydev->asym_pause = 0;
386+
387+ err = genphy_read_lpa(phydev);
388+ if (err < 0)
389+ return err;
390+
391+ /* Read the AT8035 PHY-Specific Status register, which indicates the
392+ * speed and duplex that the PHY is actually using, irrespective of
393+ * whether we are in autoneg mode or not.
394+ */
395+ ss = phy_read(phydev, AT803X_SPECIFIC_STATUS);
396+ if (ss < 0)
397+ return ss;
398+
399+ if (ss & AT803X_SS_SPEED_DUPLEX_RESOLVED) {
400+ switch (ss & AT803X_SS_SPEED_MASK) {
401+ case AT803X_SS_SPEED_10:
402+ phydev->speed = SPEED_10;
403+ break;
404+ case AT803X_SS_SPEED_100:
405+ phydev->speed = SPEED_100;
406+ break;
407+ case AT803X_SS_SPEED_1000:
408+ phydev->speed = SPEED_1000;
409+ break;
410+ }
411+ if (ss & AT803X_SS_DUPLEX)
412+ phydev->duplex = DUPLEX_FULL;
413+ else
414+ phydev->duplex = DUPLEX_HALF;
415+ if (ss & AT803X_SS_MDIX)
416+ phydev->mdix = ETH_TP_MDI_X;
417+ else
418+ phydev->mdix = ETH_TP_MDI;
419+ }
420+
421+ if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete)
422+ phy_resolve_aneg_pause(phydev);
423+
424+ return 0;
425+}
426+
360427 static struct phy_driver at803x_driver[] = {
361428 {
362429 /* ATHEROS 8035 */
@@ -370,6 +437,7 @@ static struct phy_driver at803x_driver[] = { · 7 unmodified lines
370437 .suspend = at803x_suspend,
371438 .resume = at803x_resume,
372439 /* PHY_GBIT_FEATURES */
440+ .read_status = at803x_read_status,
373441 .ack_interrupt = at803x_ack_interrupt,
374442 .config_intr = at803x_config_intr,
375443 }, {
@@ -399,6 +467,7 @@ static struct phy_driver at803x_driver[] = { · 23 unmodified lines
399467 .suspend = at803x_suspend,
400468 .resume = at803x_resume,
401469 /* PHY_GBIT_FEATURES */
470+ .read_status = at803x_read_status,
402471 .aneg_done = at803x_aneg_done,
403472 .ack_interrupt = &at803x_ack_interrupt,
404473 .config_intr = &at803x_config_intr,
drivers/net/phy/mdio_device.c+1−1
@@ -121,7 +121,7 @@ void mdio_device_reset(struct mdio_device *mdiodev, int value) · 120 unmodified lines
121121 return;
122122
123123 if (mdiodev->reset_gpio)
124− gpiod_set_value(mdiodev->reset_gpio, value);
124+ gpiod_set_value_cansleep(mdiodev->reset_gpio, value);
125125
126126 if (mdiodev->reset_ctrl) {
127127 if (value)
drivers/net/phy/phy-core.c+13−7
@@ -283,6 +283,18 @@ void of_set_phy_eee_broken(struct phy_device *phydev) · 282 unmodified lines
283283 phydev->eee_broken_modes = broken;
284284 }
285285
286+void phy_resolve_aneg_pause(struct phy_device *phydev)
287+{
288+ if (phydev->duplex == DUPLEX_FULL) {
289+ phydev->pause = linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT,
290+ phydev->lp_advertising);
291+ phydev->asym_pause = linkmode_test_bit(
292+ ETHTOOL_LINK_MODE_Asym_Pause_BIT,
293+ phydev->lp_advertising);
294+ }
295+}
296+EXPORT_SYMBOL_GPL(phy_resolve_aneg_pause);
297+
286298 /**
287299 * phy_resolve_aneg_linkmode - resolve the advertisements into phy settings
288300 * @phydev: The phy_device struct
@@ -305,13 +317,7 @@ void phy_resolve_aneg_linkmode(struct phy_device *phydev) · 16 unmodified lines
305317 break;
306318 }
307319
308− if (phydev->duplex == DUPLEX_FULL) {
309− phydev->pause = linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT,
310− phydev->lp_advertising);
311− phydev->asym_pause = linkmode_test_bit(
312− ETHTOOL_LINK_MODE_Asym_Pause_BIT,
313− phydev->lp_advertising);
314− }
320+ phy_resolve_aneg_pause(phydev);
315321 }
316322 EXPORT_SYMBOL_GPL(phy_resolve_aneg_linkmode);
317323
drivers/net/phy/phy.c+5−0
@@ -457,6 +457,11 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd) · 456 unmodified lines
457457 val);
458458 change_autoneg = true;
459459 break;
460+ case MII_CTRL1000:
461+ mii_ctrl1000_mod_linkmode_adv_t(phydev->advertising,
462+ val);
463+ change_autoneg = true;
464+ break;
460465 default:
461466 /* do nothing */
462467 break;
drivers/net/phy/phy_device.c+40−25
@@ -1783,32 +1783,9 @@ done: · 1782 unmodified lines
17831783 }
17841784 EXPORT_SYMBOL(genphy_update_link);
17851785
1786−/**
1787− * genphy_read_status - check the link status and update current link state
1788− * @phydev: target phy_device struct
1789− *
1790− * Description: Check the link, then figure out the current state
1791− * by comparing what we advertise with what the link partner
1792− * advertises. Start by checking the gigabit possibilities,
1793− * then move on to 10/100.
1794− */
1795−int genphy_read_status(struct phy_device *phydev)
1786+int genphy_read_lpa(struct phy_device *phydev)
17961787 {
1797− int lpa, lpagb, err, old_link = phydev->link;
1798−
1799− /* Update the link, but return if there was an error */
1800− err = genphy_update_link(phydev);
1801− if (err)
1802− return err;
1803−
1804− /* why bother the PHY if nothing can have changed */
1805− if (phydev->autoneg == AUTONEG_ENABLE && old_link && phydev->link)
1806− return 0;
1807−
1808− phydev->speed = SPEED_UNKNOWN;
1809− phydev->duplex = DUPLEX_UNKNOWN;
1810− phydev->pause = 0;
1811− phydev->asym_pause = 0;
1788+ int lpa, lpagb;
18121789
18131790 if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) {
18141791 if (phydev->is_gigabit_capable) {
@@ -1838,6 +1815,44 @@ int genphy_read_status(struct phy_device *phydev) · 23 unmodified lines
18381815 return lpa;
18391816
18401817 mii_lpa_mod_linkmode_lpa_t(phydev->lp_advertising, lpa);
1818+ }
1819+
1820+ return 0;
1821+}
1822+EXPORT_SYMBOL(genphy_read_lpa);
1823+
1824+/**
1825+ * genphy_read_status - check the link status and update current link state
1826+ * @phydev: target phy_device struct
1827+ *
1828+ * Description: Check the link, then figure out the current state
1829+ * by comparing what we advertise with what the link partner
1830+ * advertises. Start by checking the gigabit possibilities,
1831+ * then move on to 10/100.
1832+ */
1833+int genphy_read_status(struct phy_device *phydev)
1834+{
1835+ int err, old_link = phydev->link;
1836+
1837+ /* Update the link, but return if there was an error */
1838+ err = genphy_update_link(phydev);
1839+ if (err)
1840+ return err;
1841+
1842+ /* why bother the PHY if nothing can have changed */
1843+ if (phydev->autoneg == AUTONEG_ENABLE && old_link && phydev->link)
1844+ return 0;
1845+
1846+ phydev->speed = SPEED_UNKNOWN;
1847+ phydev->duplex = DUPLEX_UNKNOWN;
1848+ phydev->pause = 0;
1849+ phydev->asym_pause = 0;
1850+
1851+ err = genphy_read_lpa(phydev);
1852+ if (err < 0)
1853+ return err;
1854+
1855+ if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) {
18411856 phy_resolve_aneg_linkmode(phydev);
18421857 } else if (phydev->autoneg == AUTONEG_DISABLE) {
18431858 int bmcr = phy_read(phydev, MII_BMCR);
drivers/net/ppp/pptp.c+2−2
@@ -238,7 +238,7 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb) · 237 unmodified lines
238238 skb_dst_drop(skb);
239239 skb_dst_set(skb, &rt->dst);
240240
241− nf_reset(skb);
241+ nf_reset_ct(skb);
242242
243243 skb->ip_summed = CHECKSUM_NONE;
244244 ip_select_ident(net, skb, NULL);
@@ -358,7 +358,7 @@ static int pptp_rcv(struct sk_buff *skb) · 113 unmodified lines
358358 po = lookup_chan(htons(header->call_id), iph->saddr);
359359 if (po) {
360360 skb_dst_drop(skb);
361− nf_reset(skb);
361+ nf_reset_ct(skb);
362362 return sk_receive_skb(sk_pppox(po), skb, 0);
363363 }
364364 drop:
drivers/net/tun.c+1−1
@@ -1104,7 +1104,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) · 1103 unmodified lines
11041104 */
11051105 skb_orphan(skb);
11061106
1107− nf_reset(skb);
1107+ nf_reset_ct(skb);
11081108
11091109 if (ptr_ring_produce(&tfile->tx_ring, skb))
11101110 goto drop;
drivers/net/usb/hso.c+8−4
@@ -2620,14 +2620,18 @@ static struct hso_device *hso_create_bulk_serial_device( · 2619 unmodified lines
26202620 */
26212621 if (serial->tiocmget) {
26222622 tiocmget = serial->tiocmget;
2623+ tiocmget->endp = hso_get_ep(interface,
2624+ USB_ENDPOINT_XFER_INT,
2625+ USB_DIR_IN);
2626+ if (!tiocmget->endp) {
2627+ dev_err(&interface->dev, "Failed to find INT IN ep\n");
2628+ goto exit;
2629+ }
2630+
26232631 tiocmget->urb = usb_alloc_urb(0, GFP_KERNEL);
26242632 if (tiocmget->urb) {
26252633 mutex_init(&tiocmget->mutex);
26262634 init_waitqueue_head(&tiocmget->waitq);
2627− tiocmget->endp = hso_get_ep(
2628− interface,
2629− USB_ENDPOINT_XFER_INT,
2630− USB_DIR_IN);
26312635 } else
26322636 hso_free_tiomget(serial);
26332637 }
drivers/net/usb/qmi_wwan.c+1−0
@@ -1350,6 +1350,7 @@ static const struct usb_device_id products[] = { · 1349 unmodified lines
13501350 {QMI_FIXED_INTF(0x1e2d, 0x0082, 4)}, /* Cinterion PHxx,PXxx (2 RmNet) */
13511351 {QMI_FIXED_INTF(0x1e2d, 0x0082, 5)}, /* Cinterion PHxx,PXxx (2 RmNet) */
13521352 {QMI_FIXED_INTF(0x1e2d, 0x0083, 4)}, /* Cinterion PHxx,PXxx (1 RmNet + USB Audio)*/
1353+ {QMI_QUIRK_SET_DTR(0x1e2d, 0x00b0, 4)}, /* Cinterion CLS8 */
13531354 {QMI_FIXED_INTF(0x413c, 0x81a2, 8)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */
13541355 {QMI_FIXED_INTF(0x413c, 0x81a3, 8)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */
13551356 {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */
drivers/net/usb/r8152.c+1−2
@@ -4799,10 +4799,9 @@ static int rtl8152_reset_resume(struct usb_interface *intf) · 4798 unmodified lines
47994799 struct r8152 *tp = usb_get_intfdata(intf);
48004800
48014801 clear_bit(SELECTIVE_SUSPEND, &tp->flags);
4802− mutex_lock(&tp->control);
48034802 tp->rtl_ops.init(tp);
48044803 queue_delayed_work(system_long_wq, &tp->hw_phy_work, 0);
4805− mutex_unlock(&tp->control);
4804+ set_ethernet_addr(tp);
48064805 return rtl8152_resume(intf);
48074806 }
48084807
drivers/net/virtio_net.c+1−1
@@ -1585,7 +1585,7 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) · 1584 unmodified lines
15851585 /* Don't wait up for transmitted skbs to be freed. */
15861586 if (!use_napi) {
15871587 skb_orphan(skb);
1588− nf_reset(skb);
1588+ nf_reset_ct(skb);
15891589 }
15901590
15911591 /* If running out of space, stop queue to avoid getting packets that we
drivers/net/vrf.c+4−4
@@ -366,7 +366,7 @@ static int vrf_finish_output6(struct net *net, struct sock *sk, · 365 unmodified lines
366366 struct neighbour *neigh;
367367 int ret;
368368
369− nf_reset(skb);
369+ nf_reset_ct(skb);
370370
371371 skb->protocol = htons(ETH_P_IPV6);
372372 skb->dev = dev;
@@ -459,7 +459,7 @@ static struct sk_buff *vrf_ip6_out_direct(struct net_device *vrf_dev, · 86 unmodified lines
459459
460460 /* reset skb device */
461461 if (likely(err == 1))
462− nf_reset(skb);
462+ nf_reset_ct(skb);
463463 else
464464 skb = NULL;
465465
@@ -560,7 +560,7 @@ static int vrf_finish_output(struct net *net, struct sock *sk, struct sk_buff *s · 94 unmodified lines
560560 bool is_v6gw = false;
561561 int ret = -EINVAL;
562562
563− nf_reset(skb);
563+ nf_reset_ct(skb);
564564
565565 /* Be paranoid, rather than too clever. */
566566 if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) {
@@ -670,7 +670,7 @@ static struct sk_buff *vrf_ip_out_direct(struct net_device *vrf_dev, · 103 unmodified lines
670670
671671 /* reset skb device */
672672 if (likely(err == 1))
673− nf_reset(skb);
673+ nf_reset_ct(skb);
674674 else
675675 skb = NULL;
676676
drivers/net/wireless/mac80211_hwsim.c+2−2
@@ -1261,8 +1261,8 @@ static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw, · 1260 unmodified lines
12611261 skb_orphan(skb);
12621262 skb_dst_drop(skb);
12631263 skb->mark = 0;
1264− secpath_reset(skb);
1265− nf_reset(skb);
1264+ skb_ext_reset(skb);
1265+ nf_reset_ct(skb);
12661266
12671267 /*
12681268 * Get absolute mactime here so all HWs RX at the "same time", and
drivers/net/xen-netfront.c+9−8
@@ -887,9 +887,9 @@ static int xennet_set_skb_gso(struct sk_buff *skb, · 886 unmodified lines
887887 return 0;
888888 }
889889
890−static RING_IDX xennet_fill_frags(struct netfront_queue *queue,
891− struct sk_buff *skb,
892− struct sk_buff_head *list)
890+static int xennet_fill_frags(struct netfront_queue *queue,
891+ struct sk_buff *skb,
892+ struct sk_buff_head *list)
893893 {
894894 RING_IDX cons = queue->rx.rsp_cons;
895895 struct sk_buff *nskb;
@@ -908,7 +908,7 @@ static RING_IDX xennet_fill_frags(struct netfront_queue *queue, · 12 unmodified lines
908908 if (unlikely(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS)) {
909909 queue->rx.rsp_cons = ++cons + skb_queue_len(list);
910910 kfree_skb(nskb);
911− return ~0U;
911+ return -ENOENT;
912912 }
913913
914914 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
@@ -919,7 +919,9 @@ static RING_IDX xennet_fill_frags(struct netfront_queue *queue, · 4 unmodified lines
919919 kfree_skb(nskb);
920920 }
921921
922− return cons;
922+ queue->rx.rsp_cons = cons;
923+
924+ return 0;
923925 }
924926
925927 static int checksum_setup(struct net_device *dev, struct sk_buff *skb)
@@ -1045,8 +1047,7 @@ err: · 119 unmodified lines
10451047 skb->data_len = rx->status;
10461048 skb->len += rx->status;
10471049
1048− i = xennet_fill_frags(queue, skb, &tmpq);
1049− if (unlikely(i == ~0U))
1050+ if (unlikely(xennet_fill_frags(queue, skb, &tmpq)))
10501051 goto err;
10511052
10521053 if (rx->flags & XEN_NETRXF_csum_blank)
@@ -1056,7 +1057,7 @@ err: · 3 unmodified lines
10561057
10571058 __skb_queue_tail(&rxq, skb);
10581059
1059− queue->rx.rsp_cons = ++i;
1060+ i = ++queue->rx.rsp_cons;
10601061 work_done++;
10611062 }
10621063
drivers/nvme/host/core.c+113−19
@@ -102,10 +102,13 @@ static void nvme_set_queue_dying(struct nvme_ns *ns) · 101 unmodified lines
102102 */
103103 if (!ns->disk || test_and_set_bit(NVME_NS_DEAD, &ns->flags))
104104 return;
105− revalidate_disk(ns->disk);
106105 blk_set_queue_dying(ns->queue);
107106 /* Forcibly unquiesce queues to avoid blocking dispatch */
108107 blk_mq_unquiesce_queue(ns->queue);
108+ /*
109+ * Revalidate after unblocking dispatchers that may be holding bd_butex
110+ */
111+ revalidate_disk(ns->disk);
109112 }
110113
111114 static void nvme_queue_scan(struct nvme_ctrl *ctrl)
@@ -847,7 +850,7 @@ out: · 735 unmodified lines
847850 static int nvme_submit_user_cmd(struct request_queue *q,
848851 struct nvme_command *cmd, void __user *ubuffer,
849852 unsigned bufflen, void __user *meta_buffer, unsigned meta_len,
850− u32 meta_seed, u32 *result, unsigned timeout)
853+ u32 meta_seed, u64 *result, unsigned timeout)
851854 {
852855 bool write = nvme_is_write(cmd);
853856 struct nvme_ns *ns = q->queuedata;
@@ -888,7 +891,7 @@ static int nvme_submit_user_cmd(struct request_queue *q, · 34 unmodified lines
888891 else
889892 ret = nvme_req(req)->status;
890893 if (result)
891− *result = le32_to_cpu(nvme_req(req)->result.u32);
894+ *result = le64_to_cpu(nvme_req(req)->result.u64);
892895 if (meta && !ret && !write) {
893896 if (copy_to_user(meta_buffer, meta, meta_len))
894897 ret = -EFAULT;
@@ -1335,6 +1338,54 @@ static int nvme_user_cmd(struct nvme_ctrl *ctrl, struct nvme_ns *ns, · 440 unmodified lines
13351338 struct nvme_command c;
13361339 unsigned timeout = 0;
13371340 u32 effects;
1341+ u64 result;
1342+ int status;
1343+
1344+ if (!capable(CAP_SYS_ADMIN))
1345+ return -EACCES;
1346+ if (copy_from_user(&cmd, ucmd, sizeof(cmd)))
1347+ return -EFAULT;
1348+ if (cmd.flags)
1349+ return -EINVAL;
1350+
1351+ memset(&c, 0, sizeof(c));
1352+ c.common.opcode = cmd.opcode;
1353+ c.common.flags = cmd.flags;
1354+ c.common.nsid = cpu_to_le32(cmd.nsid);
1355+ c.common.cdw2[0] = cpu_to_le32(cmd.cdw2);
1356+ c.common.cdw2[1] = cpu_to_le32(cmd.cdw3);
1357+ c.common.cdw10 = cpu_to_le32(cmd.cdw10);
1358+ c.common.cdw11 = cpu_to_le32(cmd.cdw11);
1359+ c.common.cdw12 = cpu_to_le32(cmd.cdw12);
1360+ c.common.cdw13 = cpu_to_le32(cmd.cdw13);
1361+ c.common.cdw14 = cpu_to_le32(cmd.cdw14);
1362+ c.common.cdw15 = cpu_to_le32(cmd.cdw15);
1363+
1364+ if (cmd.timeout_ms)
1365+ timeout = msecs_to_jiffies(cmd.timeout_ms);
1366+
1367+ effects = nvme_passthru_start(ctrl, ns, cmd.opcode);
1368+ status = nvme_submit_user_cmd(ns ? ns->queue : ctrl->admin_q, &c,
1369+ (void __user *)(uintptr_t)cmd.addr, cmd.data_len,
1370+ (void __user *)(uintptr_t)cmd.metadata,
1371+ cmd.metadata_len, 0, &result, timeout);
1372+ nvme_passthru_end(ctrl, effects);
1373+
1374+ if (status >= 0) {
1375+ if (put_user(result, &ucmd->result))
1376+ return -EFAULT;
1377+ }
1378+
1379+ return status;
1380+}
1381+
1382+static int nvme_user_cmd64(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
1383+ struct nvme_passthru_cmd64 __user *ucmd)
1384+{
1385+ struct nvme_passthru_cmd64 cmd;
1386+ struct nvme_command c;
1387+ unsigned timeout = 0;
1388+ u32 effects;
13381389 int status;
13391390
13401391 if (!capable(CAP_SYS_ADMIN))
@@ -1405,6 +1456,41 @@ static void nvme_put_ns_from_disk(struct nvme_ns_head *head, int idx) · 64 unmodified lines
14051456 srcu_read_unlock(&head->srcu, idx);
14061457 }
14071458
1459+static bool is_ctrl_ioctl(unsigned int cmd)
1460+{
1461+ if (cmd == NVME_IOCTL_ADMIN_CMD || cmd == NVME_IOCTL_ADMIN64_CMD)
1462+ return true;
1463+ if (is_sed_ioctl(cmd))
1464+ return true;
1465+ return false;
1466+}
1467+
1468+static int nvme_handle_ctrl_ioctl(struct nvme_ns *ns, unsigned int cmd,
1469+ void __user *argp,
1470+ struct nvme_ns_head *head,
1471+ int srcu_idx)
1472+{
1473+ struct nvme_ctrl *ctrl = ns->ctrl;
1474+ int ret;
1475+
1476+ nvme_get_ctrl(ns->ctrl);
1477+ nvme_put_ns_from_disk(head, srcu_idx);
1478+
1479+ switch (cmd) {
1480+ case NVME_IOCTL_ADMIN_CMD:
1481+ ret = nvme_user_cmd(ctrl, NULL, argp);
1482+ break;
1483+ case NVME_IOCTL_ADMIN64_CMD:
1484+ ret = nvme_user_cmd64(ctrl, NULL, argp);
1485+ break;
1486+ default:
1487+ ret = sed_ioctl(ctrl->opal_dev, cmd, argp);
1488+ break;
1489+ }
1490+ nvme_put_ctrl(ctrl);
1491+ return ret;
1492+}
1493+
14081494 static int nvme_ioctl(struct block_device *bdev, fmode_t mode,
14091495 unsigned int cmd, unsigned long arg)
14101496 {
@@ -1422,20 +1508,8 @@ static int nvme_ioctl(struct block_device *bdev, fmode_t mode, · 11 unmodified lines
14221508 * seperately and drop the ns SRCU reference early. This avoids a
14231509 * deadlock when deleting namespaces using the passthrough interface.
14241510 */
1425− if (cmd == NVME_IOCTL_ADMIN_CMD || is_sed_ioctl(cmd)) {
1426− struct nvme_ctrl *ctrl = ns->ctrl;
1427−
1428− nvme_get_ctrl(ns->ctrl);
1429− nvme_put_ns_from_disk(head, srcu_idx);
1430−
1431− if (cmd == NVME_IOCTL_ADMIN_CMD)
1432− ret = nvme_user_cmd(ctrl, NULL, argp);
1433− else
1434− ret = sed_ioctl(ctrl->opal_dev, cmd, argp);
1435−
1436− nvme_put_ctrl(ctrl);
1437− return ret;
1438− }
1511+ if (is_ctrl_ioctl(cmd))
1512+ return nvme_handle_ctrl_ioctl(ns, cmd, argp, head, srcu_idx);
14391513
14401514 switch (cmd) {
14411515 case NVME_IOCTL_ID:
@@ -1448,6 +1522,9 @@ static int nvme_ioctl(struct block_device *bdev, fmode_t mode, · 6 unmodified lines
14481522 case NVME_IOCTL_SUBMIT_IO:
14491523 ret = nvme_submit_io(ns, argp);
14501524 break;
1525+ case NVME_IOCTL_IO64_CMD:
1526+ ret = nvme_user_cmd64(ns->ctrl, ns, argp);
1527+ break;
14511528 default:
14521529 if (ns->ndev)
14531530 ret = nvme_nvm_ioctl(ns, cmd, arg);
@@ -2289,6 +2366,16 @@ static const struct nvme_core_quirk_entry core_quirks[] = { · 835 unmodified lines
22892366 .vid = 0x14a4,
22902367 .fr = "22301111",
22912368 .quirks = NVME_QUIRK_SIMPLE_SUSPEND,
2369+ },
2370+ {
2371+ /*
2372+ * This Kingston E8FK11.T firmware version has no interrupt
2373+ * after resume with actions related to suspend to idle
2374+ * https://bugzilla.kernel.org/show_bug.cgi?id=204887
2375+ */
2376+ .vid = 0x2646,
2377+ .fr = "E8FK11.T",
2378+ .quirks = NVME_QUIRK_SIMPLE_SUSPEND,
22922379 }
22932380 };
22942381
@@ -2540,8 +2627,9 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) · 245 unmodified lines
25402627 list_add_tail(&subsys->entry, &nvme_subsystems);
25412628 }
25422629
2543− if (sysfs_create_link(&subsys->dev.kobj, &ctrl->device->kobj,
2544− dev_name(ctrl->device))) {
2630+ ret = sysfs_create_link(&subsys->dev.kobj, &ctrl->device->kobj,
2631+ dev_name(ctrl->device));
2632+ if (ret) {
25452633 dev_err(ctrl->device,
25462634 "failed to create sysfs link from subsystem.\n");
25472635 goto out_put_subsystem;
@@ -2838,6 +2926,8 @@ static long nvme_dev_ioctl(struct file *file, unsigned int cmd, · 290 unmodified lines
28382926 switch (cmd) {
28392927 case NVME_IOCTL_ADMIN_CMD:
28402928 return nvme_user_cmd(ctrl, NULL, argp);
2929+ case NVME_IOCTL_ADMIN64_CMD:
2930+ return nvme_user_cmd64(ctrl, NULL, argp);
28412931 case NVME_IOCTL_IO_CMD:
28422932 return nvme_dev_user_cmd(ctrl, argp);
28432933 case NVME_IOCTL_RESET:
@@ -3045,6 +3135,8 @@ static DEVICE_ATTR(field, S_IRUGO, field##_show, NULL); · 201 unmodified lines
30453135
30463136 nvme_show_int_function(cntlid);
30473137 nvme_show_int_function(numa_node);
3138+nvme_show_int_function(queue_count);
3139+nvme_show_int_function(sqsize);
30483140
30493141 static ssize_t nvme_sysfs_delete(struct device *dev,
30503142 struct device_attribute *attr, const char *buf,
@@ -3125,6 +3217,8 @@ static struct attribute *nvme_dev_attrs[] = { · 74 unmodified lines
31253217 &dev_attr_address.attr,
31263218 &dev_attr_state.attr,
31273219 &dev_attr_numa_node.attr,
3220+ &dev_attr_queue_count.attr,
3221+ &dev_attr_sqsize.attr,
31283222 NULL
31293223 };
31303224
drivers/nvme/host/nvme.h+1−1
@@ -221,6 +221,7 @@ struct nvme_ctrl { · 220 unmodified lines
221221 u16 oacs;
222222 u16 nssa;
223223 u16 nr_streams;
224+ u16 sqsize;
224225 u32 max_namespaces;
225226 atomic_t abort_limit;
226227 u8 vwc;
@@ -269,7 +270,6 @@ struct nvme_ctrl { · 42 unmodified lines
269270 u16 hmmaxd;
270271
271272 /* Fabrics only */
272− u16 sqsize;
273273 u32 ioccsz;
274274 u32 iorcsz;
275275 u16 icdoff;
drivers/nvme/host/pci.c+13−7
@@ -2946,11 +2946,21 @@ static int nvme_suspend(struct device *dev) · 2945 unmodified lines
29462946 if (ret < 0)
29472947 goto unfreeze;
29482948
2949+ /*
2950+ * A saved state prevents pci pm from generically controlling the
2951+ * device's power. If we're using protocol specific settings, we don't
2952+ * want pci interfering.
2953+ */
2954+ pci_save_state(pdev);
2955+
29492956 ret = nvme_set_power_state(ctrl, ctrl->npss);
29502957 if (ret < 0)
29512958 goto unfreeze;
29522959
29532960 if (ret) {
2961+ /* discard the saved state */
2962+ pci_load_saved_state(pdev, NULL);
2963+
29542964 /*
29552965 * Clearing npss forces a controller reset on resume. The
29562966 * correct value will be resdicovered then.
@@ -2958,14 +2968,7 @@ static int nvme_suspend(struct device *dev) · 1 unmodified line
29582968 nvme_dev_disable(ndev, true);
29592969 ctrl->npss = 0;
29602970 ret = 0;
2961− goto unfreeze;
29622971 }
2963− /*
2964− * A saved state prevents pci pm from generically controlling the
2965− * device's power. If we're using protocol specific settings, we don't
2966− * want pci interfering.
2967− */
2968− pci_save_state(pdev);
29692972 unfreeze:
29702973 nvme_unfreeze(ctrl);
29712974 return ret;
@@ -3090,6 +3093,9 @@ static const struct pci_device_id nvme_id_table[] = { · 118 unmodified lines
30903093 .driver_data = NVME_QUIRK_LIGHTNVM, },
30913094 { PCI_DEVICE(0x10ec, 0x5762), /* ADATA SX6000LNP */
30923095 .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, },
3096+ { PCI_DEVICE(0x1cc1, 0x8201), /* ADATA SX8200PNP 512GB */
3097+ .driver_data = NVME_QUIRK_NO_DEEPEST_PS |
3098+ NVME_QUIRK_IGNORE_DEV_SUBNQN, },
30933099 { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) },
30943100 { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001) },
30953101 { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2003) },
drivers/nvme/host/rdma.c+13−6
@@ -427,7 +427,7 @@ static void nvme_rdma_destroy_queue_ib(struct nvme_rdma_queue *queue) · 426 unmodified lines
427427 static int nvme_rdma_get_max_fr_pages(struct ib_device *ibdev)
428428 {
429429 return min_t(u32, NVME_RDMA_MAX_SEGMENTS,
430− ibdev->attrs.max_fast_reg_page_list_len);
430+ ibdev->attrs.max_fast_reg_page_list_len - 1);
431431 }
432432
433433 static int nvme_rdma_create_queue_ib(struct nvme_rdma_queue *queue)
@@ -437,7 +437,7 @@ static int nvme_rdma_create_queue_ib(struct nvme_rdma_queue *queue) · 3 unmodified lines
437437 const int cq_factor = send_wr_factor + 1; /* + RECV */
438438 int comp_vector, idx = nvme_rdma_queue_idx(queue);
439439 enum ib_poll_context poll_ctx;
440− int ret;
440+ int ret, pages_per_mr;
441441
442442 queue->device = nvme_rdma_find_get_device(queue->cm_id);
443443 if (!queue->device) {
@@ -479,10 +479,16 @@ static int nvme_rdma_create_queue_ib(struct nvme_rdma_queue *queue) · 35 unmodified lines
479479 goto out_destroy_qp;
480480 }
481481
482+ /*
483+ * Currently we don't use SG_GAPS MR's so if the first entry is
484+ * misaligned we'll end up using two entries for a single data page,
485+ * so one additional entry is required.
486+ */
487+ pages_per_mr = nvme_rdma_get_max_fr_pages(ibdev) + 1;
482488 ret = ib_mr_pool_init(queue->qp, &queue->qp->rdma_mrs,
483489 queue->queue_size,
484490 IB_MR_TYPE_MEM_REG,
485− nvme_rdma_get_max_fr_pages(ibdev), 0);
491+ pages_per_mr, 0);
486492 if (ret) {
487493 dev_err(queue->ctrl->ctrl.device,
488494 "failed to initialize MR pool sized %d for QID %d\n",
@@ -614,7 +620,8 @@ static int nvme_rdma_start_queue(struct nvme_rdma_ctrl *ctrl, int idx) · 125 unmodified lines
614620 if (!ret) {
615621 set_bit(NVME_RDMA_Q_LIVE, &queue->flags);
616622 } else {
617− __nvme_rdma_stop_queue(queue);
623+ if (test_bit(NVME_RDMA_Q_ALLOCATED, &queue->flags))
624+ __nvme_rdma_stop_queue(queue);
618625 dev_info(ctrl->ctrl.device,
619626 "failed to connect queue: %d ret=%d\n", idx, ret);
620627 }
@@ -820,8 +827,8 @@ static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl, · 199 unmodified lines
820827 if (error)
821828 goto out_stop_queue;
822829
823− ctrl->ctrl.max_hw_sectors =
824− (ctrl->max_fr_pages - 1) << (ilog2(SZ_4K) - 9);
830+ ctrl->ctrl.max_segments = ctrl->max_fr_pages;
831+ ctrl->ctrl.max_hw_sectors = ctrl->max_fr_pages << (ilog2(SZ_4K) - 9);
825832
826833 blk_mq_unquiesce_queue(ctrl->ctrl.admin_q);
827834
drivers/nvme/host/tcp.c+2−2
@@ -1042,7 +1042,7 @@ static void nvme_tcp_io_work(struct work_struct *w) · 1041 unmodified lines
10421042 {
10431043 struct nvme_tcp_queue *queue =
10441044 container_of(w, struct nvme_tcp_queue, io_work);
1045− unsigned long start = jiffies + msecs_to_jiffies(1);
1045+ unsigned long deadline = jiffies + msecs_to_jiffies(1);
10461046
10471047 do {
10481048 bool pending = false;
@@ -1067,7 +1067,7 @@ static void nvme_tcp_io_work(struct work_struct *w) · 18 unmodified lines
10671067 if (!pending)
10681068 return;
10691069
1070− } while (time_after(jiffies, start)); /* quota is exhausted */
1070+ } while (!time_after(jiffies, deadline)); /* quota is exhausted */
10711071
10721072 queue_work_on(queue->io_cpu, nvme_tcp_wq, &queue->io_work);
10731073 }
drivers/nvme/target/io-cmd-bdev.c+8−8
@@ -11,10 +11,10 @@ · 10 unmodified lines
1111 void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id)
1212 {
1313 const struct queue_limits *ql = &bdev_get_queue(bdev)->limits;
14− /* Number of physical blocks per logical block. */
15− const u32 ppl = ql->physical_block_size / ql->logical_block_size;
16− /* Physical blocks per logical block, 0's based. */
17− const __le16 ppl0b = to0based(ppl);
14+ /* Number of logical blocks per physical block. */
15+ const u32 lpp = ql->physical_block_size / ql->logical_block_size;
16+ /* Logical blocks per physical block, 0's based. */
17+ const __le16 lpp0b = to0based(lpp);
1818
1919 /*
2020 * For NVMe 1.2 and later, bit 1 indicates that the fields NAWUN,
@@ -25,9 +25,9 @@ void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id) · 4 unmodified lines
2525 * field from the identify controller data structure should be used.
2626 */
2727 id->nsfeat |= 1 << 1;
28− id->nawun = ppl0b;
29− id->nawupf = ppl0b;
30− id->nacwu = ppl0b;
28+ id->nawun = lpp0b;
29+ id->nawupf = lpp0b;
30+ id->nacwu = lpp0b;
3131
3232 /*
3333 * Bit 4 indicates that the fields NPWG, NPWA, NPDG, NPDA, and
@@ -36,7 +36,7 @@ void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id) · 2 unmodified lines
3636 */
3737 id->nsfeat |= 1 << 4;
3838 /* NPWG = Namespace Preferred Write Granularity. 0's based */
39− id->npwg = ppl0b;
39+ id->npwg = lpp0b;
4040 /* NPWA = Namespace Preferred Write Alignment. 0's based */
4141 id->npwa = id->npwg;
4242 /* NPDG = Namespace Preferred Deallocate Granularity. 0's based */
drivers/nvme/target/tcp.c+4−8
@@ -348,8 +348,7 @@ static int nvmet_tcp_map_data(struct nvmet_tcp_cmd *cmd) · 347 unmodified lines
348348
349349 return 0;
350350 err:
351− if (cmd->req.sg_cnt)
352− sgl_free(cmd->req.sg);
351+ sgl_free(cmd->req.sg);
353352 return NVME_SC_INTERNAL;
354353 }
355354
@@ -554,8 +553,7 @@ static int nvmet_try_send_data(struct nvmet_tcp_cmd *cmd) · 198 unmodified lines
554553
555554 if (queue->nvme_sq.sqhd_disabled) {
556555 kfree(cmd->iov);
557− if (cmd->req.sg_cnt)
558− sgl_free(cmd->req.sg);
556+ sgl_free(cmd->req.sg);
559557 }
560558
561559 return 1;
@@ -586,8 +584,7 @@ static int nvmet_try_send_response(struct nvmet_tcp_cmd *cmd, · 24 unmodified lines
586584 return -EAGAIN;
587585
588586 kfree(cmd->iov);
589− if (cmd->req.sg_cnt)
590− sgl_free(cmd->req.sg);
587+ sgl_free(cmd->req.sg);
591588 cmd->queue->snd_cmd = NULL;
592589 nvmet_tcp_put_cmd(cmd);
593590 return 1;
@@ -1310,8 +1307,7 @@ static void nvmet_tcp_finish_cmd(struct nvmet_tcp_cmd *cmd) · 716 unmodified lines
13101307 nvmet_req_uninit(&cmd->req);
13111308 nvmet_tcp_unmap_pdu_iovec(cmd);
13121309 kfree(cmd->iov);
1313− if (cmd->req.sg_cnt)
1314− sgl_free(cmd->req.sg);
1310+ sgl_free(cmd->req.sg);
13151311 }
13161312
13171313 static void nvmet_tcp_uninit_data_in_cmds(struct nvmet_tcp_queue *queue)
drivers/ptp/ptp_qoriq.c+2−1
@@ -507,6 +507,8 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base, · 506 unmodified lines
507507 ptp_qoriq->regs.etts_regs = base + ETTS_REGS_OFFSET;
508508 }
509509
510+ spin_lock_init(&ptp_qoriq->lock);
511+
510512 ktime_get_real_ts64(&now);
511513 ptp_qoriq_settime(&ptp_qoriq->caps, &now);
512514
@@ -514,7 +516,6 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base, · 1 unmodified line
514516 (ptp_qoriq->tclk_period & TCLK_PERIOD_MASK) << TCLK_PERIOD_SHIFT |
515517 (ptp_qoriq->cksel & CKSEL_MASK) << CKSEL_SHIFT;
516518
517− spin_lock_init(&ptp_qoriq->lock);
518519 spin_lock_irqsave(&ptp_qoriq->lock, flags);
519520
520521 regs = &ptp_qoriq->regs;
drivers/s390/block/dasd_eckd.c+11−70
@@ -1553,8 +1553,8 @@ static int dasd_eckd_read_vol_info(struct dasd_device *device) · 1552 unmodified lines
15531553 if (rc == 0) {
15541554 memcpy(&private->vsq, vsq, sizeof(*vsq));
15551555 } else {
1556− dev_warn(&device->cdev->dev,
1557− "Reading the volume storage information failed with rc=%d\n", rc);
1556+ DBF_EVENT_DEVID(DBF_WARNING, device->cdev,
1557+ "Reading the volume storage information failed with rc=%d", rc);
15581558 }
15591559
15601560 if (useglobal)
@@ -1737,8 +1737,8 @@ static int dasd_eckd_read_ext_pool_info(struct dasd_device *device) · 176 unmodified lines
17371737 if (rc == 0) {
17381738 dasd_eckd_cpy_ext_pool_data(device, lcq);
17391739 } else {
1740− dev_warn(&device->cdev->dev,
1741− "Reading the logical configuration failed with rc=%d\n", rc);
1740+ DBF_EVENT_DEVID(DBF_WARNING, device->cdev,
1741+ "Reading the logical configuration failed with rc=%d", rc);
17421742 }
17431743
17441744 dasd_sfree_request(cqr, cqr->memdev);
@@ -2020,14 +2020,10 @@ dasd_eckd_check_characteristics(struct dasd_device *device) · 275 unmodified lines
20202020 dasd_eckd_read_features(device);
20212021
20222022 /* Read Volume Information */
2023− rc = dasd_eckd_read_vol_info(device);
2024− if (rc)
2025− goto out_err3;
2023+ dasd_eckd_read_vol_info(device);
20262024
20272025 /* Read Extent Pool Information */
2028− rc = dasd_eckd_read_ext_pool_info(device);
2029− if (rc)
2030− goto out_err3;
2026+ dasd_eckd_read_ext_pool_info(device);
20312027
20322028 /* Read Device Characteristics */
20332029 rc = dasd_generic_read_dev_chars(device, DASD_ECKD_MAGIC,
@@ -2059,9 +2055,6 @@ dasd_eckd_check_characteristics(struct dasd_device *device) · 25 unmodified lines
20592055 if (readonly)
20602056 set_bit(DASD_FLAG_DEVICE_RO, &device->flags);
20612057
2062− if (dasd_eckd_is_ese(device))
2063− dasd_set_feature(device->cdev, DASD_FEATURE_DISCARD, 1);
2064−
20652058 dev_info(&device->cdev->dev, "New DASD %04X/%02X (CU %04X/%02X) "
20662059 "with %d cylinders, %d heads, %d sectors%s\n",
20672060 private->rdc_data.dev_type,
@@ -3695,14 +3688,6 @@ static int dasd_eckd_release_space(struct dasd_device *device, · 1627 unmodified lines
36953688 return -EINVAL;
36963689 }
36973690
3698−static struct dasd_ccw_req *
3699−dasd_eckd_build_cp_discard(struct dasd_device *device, struct dasd_block *block,
3700− struct request *req, sector_t first_trk,
3701− sector_t last_trk)
3702−{
3703− return dasd_eckd_dso_ras(device, block, req, first_trk, last_trk, 1);
3704−}
3705−
37063691 static struct dasd_ccw_req *dasd_eckd_build_cp_cmd_single(
37073692 struct dasd_device *startdev,
37083693 struct dasd_block *block,
@@ -4447,10 +4432,6 @@ static struct dasd_ccw_req *dasd_eckd_build_cp(struct dasd_device *startdev, · 738 unmodified lines
44474432 cmdwtd = private->features.feature[12] & 0x40;
44484433 use_prefix = private->features.feature[8] & 0x01;
44494434
4450− if (req_op(req) == REQ_OP_DISCARD)
4451− return dasd_eckd_build_cp_discard(startdev, block, req,
4452− first_trk, last_trk);
4453−
44544435 cqr = NULL;
44554436 if (cdlspecial || dasd_page_cache) {
44564437 /* do nothing, just fall through to the cmd mode single case */
@@ -4729,14 +4710,12 @@ static struct dasd_ccw_req *dasd_eckd_build_alias_cp(struct dasd_device *base, · 272 unmodified lines
47294710 struct dasd_block *block,
47304711 struct request *req)
47314712 {
4732− struct dasd_device *startdev = NULL;
47334713 struct dasd_eckd_private *private;
4734− struct dasd_ccw_req *cqr;
4714+ struct dasd_device *startdev;
47354715 unsigned long flags;
4716+ struct dasd_ccw_req *cqr;
47364717
4737− /* Discard requests can only be processed on base devices */
4738− if (req_op(req) != REQ_OP_DISCARD)
4739− startdev = dasd_alias_get_start_dev(base);
4718+ startdev = dasd_alias_get_start_dev(base);
47404719 if (!startdev)
47414720 startdev = base;
47424721 private = startdev->private;
@@ -5663,14 +5642,10 @@ static int dasd_eckd_restore_device(struct dasd_device *device) · 920 unmodified lines
56635642 dasd_eckd_read_features(device);
56645643
56655644 /* Read Volume Information */
5666− rc = dasd_eckd_read_vol_info(device);
5667− if (rc)
5668− goto out_err2;
5645+ dasd_eckd_read_vol_info(device);
56695646
56705647 /* Read Extent Pool Information */
5671− rc = dasd_eckd_read_ext_pool_info(device);
5672− if (rc)
5673− goto out_err2;
5648+ dasd_eckd_read_ext_pool_info(device);
56745649
56755650 /* Read Device Characteristics */
56765651 rc = dasd_generic_read_dev_chars(device, DASD_ECKD_MAGIC,
@@ -6521,20 +6496,8 @@ static void dasd_eckd_setup_blk_queue(struct dasd_block *block) · 844 unmodified lines
65216496 unsigned int logical_block_size = block->bp_block;
65226497 struct request_queue *q = block->request_queue;
65236498 struct dasd_device *device = block->base;
6524− struct dasd_eckd_private *private;
6525− unsigned int max_discard_sectors;
6526− unsigned int max_bytes;
6527− unsigned int ext_bytes; /* Extent Size in Bytes */
6528− int recs_per_trk;
6529− int trks_per_cyl;
6530− int ext_limit;
6531− int ext_size; /* Extent Size in Cylinders */
65326499 int max;
65336500
6534− private = device->private;
6535− trks_per_cyl = private->rdc_data.trk_per_cyl;
6536− recs_per_trk = recs_per_track(&private->rdc_data, 0, logical_block_size);
6537−
65386501 if (device->features & DASD_FEATURE_USERAW) {
65396502 /*
65406503 * the max_blocks value for raw_track access is 256
@@ -6555,28 +6518,6 @@ static void dasd_eckd_setup_blk_queue(struct dasd_block *block) · 14 unmodified lines
65556518 /* With page sized segments each segment can be translated into one idaw/tidaw */
65566519 blk_queue_max_segment_size(q, PAGE_SIZE);
65576520 blk_queue_segment_boundary(q, PAGE_SIZE - 1);
6558−
6559− if (dasd_eckd_is_ese(device)) {
6560− /*
6561− * Depending on the extent size, up to UINT_MAX bytes can be
6562− * accepted. However, neither DASD_ECKD_RAS_EXTS_MAX nor the
6563− * device limits should be exceeded.
6564− */
6565− ext_size = dasd_eckd_ext_size(device);
6566− ext_limit = min(private->real_cyl / ext_size, DASD_ECKD_RAS_EXTS_MAX);
6567− ext_bytes = ext_size * trks_per_cyl * recs_per_trk *
6568− logical_block_size;
6569− max_bytes = UINT_MAX - (UINT_MAX % ext_bytes);
6570− if (max_bytes / ext_bytes > ext_limit)
6571− max_bytes = ext_bytes * ext_limit;
6572−
6573− max_discard_sectors = max_bytes / 512;
6574−
6575− blk_queue_max_discard_sectors(q, max_discard_sectors);
6576− blk_queue_flag_set(QUEUE_FLAG_DISCARD, q);
6577− q->limits.discard_granularity = ext_bytes;
6578− q->limits.discard_alignment = ext_bytes;
6579− }
65806521 }
65816522
65826523 static struct ccw_driver dasd_eckd_driver = {
drivers/s390/cio/qdio_setup.c+1−1
@@ -113,7 +113,7 @@ static void set_impl_params(struct qdio_irq *irq_ptr, · 112 unmodified lines
113113 irq_ptr->qib.pfmt = qib_param_field_format;
114114 if (qib_param_field)
115115 memcpy(irq_ptr->qib.parm, qib_param_field,
116− QDIO_MAX_BUFFERS_PER_Q);
116+ sizeof(irq_ptr->qib.parm));
117117
118118 if (!input_slib_elements)
119119 goto output;
drivers/s390/net/qeth_core_main.c+1−2
@@ -4715,8 +4715,7 @@ static int qeth_qdio_establish(struct qeth_card *card) · 4714 unmodified lines
47154715
47164716 QETH_CARD_TEXT(card, 2, "qdioest");
47174717
4718− qib_param_field = kzalloc(QDIO_MAX_BUFFERS_PER_Q,
4719− GFP_KERNEL);
4718+ qib_param_field = kzalloc(FIELD_SIZEOF(struct qib, parm), GFP_KERNEL);
47204719 if (!qib_param_field) {
47214720 rc = -ENOMEM;
47224721 goto out_free_nothing;
drivers/scsi/bnx2fc/bnx2fc_io.c+24−5
@@ -1923,6 +1923,7 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req, · 1922 unmodified lines
19231923 struct fcoe_fcp_rsp_payload *fcp_rsp;
19241924 struct bnx2fc_rport *tgt = io_req->tgt;
19251925 struct scsi_cmnd *sc_cmd;
1926+ u16 scope = 0, qualifier = 0;
19261927
19271928 /* scsi_cmd_cmpl is called with tgt lock held */
19281929
@@ -1990,12 +1991,30 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req, · 61 unmodified lines
19901991
19911992 if (io_req->cdb_status == SAM_STAT_TASK_SET_FULL ||
19921993 io_req->cdb_status == SAM_STAT_BUSY) {
1993− /* Set the jiffies + retry_delay_timer * 100ms
1994− for the rport/tgt */
1995− tgt->retry_delay_timestamp = jiffies +
1996− fcp_rsp->retry_delay_timer * HZ / 10;
1994+ /* Newer array firmware with BUSY or
1995+ * TASK_SET_FULL may return a status that needs
1996+ * the scope bits masked.
1997+ * Or a huge delay timestamp up to 27 minutes
1998+ * can result.
1999+ */
2000+ if (fcp_rsp->retry_delay_timer) {
2001+ /* Upper 2 bits */
2002+ scope = fcp_rsp->retry_delay_timer
2003+ & 0xC000;
2004+ /* Lower 14 bits */
2005+ qualifier = fcp_rsp->retry_delay_timer
2006+ & 0x3FFF;
2007+ }
2008+ if (scope > 0 && qualifier > 0 &&
2009+ qualifier <= 0x3FEF) {
2010+ /* Set the jiffies +
2011+ * retry_delay_timer * 100ms
2012+ * for the rport/tgt
2013+ */
2014+ tgt->retry_delay_timestamp = jiffies +
2015+ (qualifier * HZ / 10);
2016+ }
19972017 }
1998−
19992018 }
20002019 if (io_req->fcp_resid)
20012020 scsi_set_resid(sc_cmd, io_req->fcp_resid);
drivers/scsi/hisi_sas/hisi_sas_main.c+3−3
@@ -3683,7 +3683,7 @@ void hisi_sas_debugfs_work_handler(struct work_struct *work) · 3682 unmodified lines
36833683 }
36843684 EXPORT_SYMBOL_GPL(hisi_sas_debugfs_work_handler);
36853685
3686−void hisi_sas_debugfs_release(struct hisi_hba *hisi_hba)
3686+static void hisi_sas_debugfs_release(struct hisi_hba *hisi_hba)
36873687 {
36883688 struct device *dev = hisi_hba->dev;
36893689 int i;
@@ -3705,7 +3705,7 @@ void hisi_sas_debugfs_release(struct hisi_hba *hisi_hba) · 15 unmodified lines
37053705 devm_kfree(dev, hisi_hba->debugfs_port_reg[i]);
37063706 }
37073707
3708−int hisi_sas_debugfs_alloc(struct hisi_hba *hisi_hba)
3708+static int hisi_sas_debugfs_alloc(struct hisi_hba *hisi_hba)
37093709 {
37103710 const struct hisi_sas_hw *hw = hisi_hba->hw;
37113711 struct device *dev = hisi_hba->dev;
@@ -3796,7 +3796,7 @@ fail: · 84 unmodified lines
37963796 return -ENOMEM;
37973797 }
37983798
3799−void hisi_sas_debugfs_bist_init(struct hisi_hba *hisi_hba)
3799+static void hisi_sas_debugfs_bist_init(struct hisi_hba *hisi_hba)
38003800 {
38013801 hisi_hba->debugfs_bist_dentry =
38023802 debugfs_create_dir("bist", hisi_hba->debugfs_dir);
drivers/scsi/megaraid.c+2−2
@@ -4183,11 +4183,11 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) · 4182 unmodified lines
41834183 */
41844184 if (pdev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ &&
41854185 pdev->subsystem_device == 0xC000)
4186− return -ENODEV;
4186+ goto out_disable_device;
41874187 /* Now check the magic signature byte */
41884188 pci_read_config_word(pdev, PCI_CONF_AMISIG, &magic);
41894189 if (magic != HBA_SIGNATURE_471 && magic != HBA_SIGNATURE)
4190− return -ENODEV;
4190+ goto out_disable_device;
41914191 /* Ok it is probably a megaraid */
41924192 }
41934193
drivers/scsi/qedf/qedf_main.c+1−1
@@ -596,7 +596,7 @@ static void qedf_dcbx_handler(void *dev, struct qed_dcbx_get *get, u32 mib_type) · 595 unmodified lines
596596 tmp_prio = get->operational.app_prio.fcoe;
597597 if (qedf_default_prio > -1)
598598 qedf->prio = qedf_default_prio;
599− else if (tmp_prio < 0 || tmp_prio > 7) {
599+ else if (tmp_prio > 7) {
600600 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC,
601601 "FIP/FCoE prio %d out of range, setting to %d.\n",
602602 tmp_prio, QEDF_DEFAULT_PRIO);
drivers/scsi/qla2xxx/qla_attr.c+2−0
@@ -2920,6 +2920,8 @@ qla24xx_vport_delete(struct fc_vport *fc_vport) · 2919 unmodified lines
29202920 struct qla_hw_data *ha = vha->hw;
29212921 uint16_t id = vha->vp_idx;
29222922
2923+ set_bit(VPORT_DELETE, &vha->dpc_flags);
2924+
29232925 while (test_bit(LOOP_RESYNC_ACTIVE, &vha->dpc_flags) ||
29242926 test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags))
29252927 msleep(1000);
drivers/scsi/qla2xxx/qla_def.h+3−1
@@ -2396,6 +2396,7 @@ typedef struct fc_port { · 2395 unmodified lines
23962396 unsigned int query:1;
23972397 unsigned int id_changed:1;
23982398 unsigned int scan_needed:1;
2399+ unsigned int n2n_flag:1;
23992400
24002401 struct completion nvme_del_done;
24012402 uint32_t nvme_prli_service_param;
@@ -2446,7 +2447,6 @@ typedef struct fc_port { · 44 unmodified lines
24462447 uint8_t fc4_type;
24472448 uint8_t fc4f_nvme;
24482449 uint8_t scan_state;
2449− uint8_t n2n_flag;
24502450
24512451 unsigned long last_queue_full;
24522452 unsigned long last_ramp_up;
@@ -3036,6 +3036,7 @@ enum scan_flags_t { · 583 unmodified lines
30363036 enum fc4type_t {
30373037 FS_FC4TYPE_FCP = BIT_0,
30383038 FS_FC4TYPE_NVME = BIT_1,
3039+ FS_FCP_IS_N2N = BIT_7,
30393040 };
30403041
30413042 struct fab_scan_rp {
@@ -4394,6 +4395,7 @@ typedef struct scsi_qla_host { · 1352 unmodified lines
43944395 #define IOCB_WORK_ACTIVE 31
43954396 #define SET_ZIO_THRESHOLD_NEEDED 32
43964397 #define ISP_ABORT_TO_ROM 33
4398+#define VPORT_DELETE 34
43974399
43984400 unsigned long pci_flags;
43994401 #define PFLG_DISCONNECTED 0 /* PCI device removed */
drivers/scsi/qla2xxx/qla_gs.c+2−1
@@ -3102,7 +3102,8 @@ int qla24xx_post_gpnid_work(struct scsi_qla_host *vha, port_id_t *id) · 3101 unmodified lines
31023102 {
31033103 struct qla_work_evt *e;
31043104
3105− if (test_bit(UNLOADING, &vha->dpc_flags))
3105+ if (test_bit(UNLOADING, &vha->dpc_flags) ||
3106+ (vha->vp_idx && test_bit(VPORT_DELETE, &vha->dpc_flags)))
31063107 return 0;
31073108
31083109 e = qla2x00_alloc_work(vha, QLA_EVT_GPNID);
drivers/scsi/qla2xxx/qla_init.c+78−31
@@ -746,12 +746,15 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha, · 745 unmodified lines
746746 break;
747747 default:
748748 if ((id.b24 != fcport->d_id.b24 &&
749− fcport->d_id.b24) ||
749+ fcport->d_id.b24 &&
750+ fcport->loop_id != FC_NO_LOOP_ID) ||
750751 (fcport->loop_id != FC_NO_LOOP_ID &&
751752 fcport->loop_id != loop_id)) {
752753 ql_dbg(ql_dbg_disc, vha, 0x20e3,
753754 "%s %d %8phC post del sess\n",
754755 __func__, __LINE__, fcport->port_name);
756+ if (fcport->n2n_flag)
757+ fcport->d_id.b24 = 0;
755758 qlt_schedule_sess_for_deletion(fcport);
756759 return;
757760 }
@@ -759,6 +762,8 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha, · 1 unmodified line
759762 }
760763
761764 fcport->loop_id = loop_id;
765+ if (fcport->n2n_flag)
766+ fcport->d_id.b24 = id.b24;
762767
763768 wwn = wwn_to_u64(fcport->port_name);
764769 qlt_find_sess_invalidate_other(vha, wwn,
@@ -972,7 +977,7 @@ static void qla24xx_async_gnl_sp_done(srb_t *sp, int res) · 207 unmodified lines
972977 wwn = wwn_to_u64(e->port_name);
973978
974979 ql_dbg(ql_dbg_disc + ql_dbg_verbose, vha, 0x20e8,
975− "%s %8phC %02x:%02x:%02x state %d/%d lid %x \n",
980+ "%s %8phC %02x:%02x:%02x CLS %x/%x lid %x \n",
976981 __func__, (void *)&wwn, e->port_id[2], e->port_id[1],
977982 e->port_id[0], e->current_login_state, e->last_login_state,
978983 (loop_id & 0x7fff));
@@ -1499,7 +1504,8 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport) · 520 unmodified lines
14991504 (fcport->fw_login_state == DSC_LS_PRLI_PEND)))
15001505 return 0;
15011506
1502− if (fcport->fw_login_state == DSC_LS_PLOGI_COMP) {
1507+ if (fcport->fw_login_state == DSC_LS_PLOGI_COMP &&
1508+ !N2N_TOPO(vha->hw)) {
15031509 if (time_before_eq(jiffies, fcport->plogi_nack_done_deadline)) {
15041510 set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
15051511 return 0;
@@ -1570,8 +1576,9 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport) · 64 unmodified lines
15701576 qla24xx_post_gpdb_work(vha, fcport, 0);
15711577 } else {
15721578 ql_dbg(ql_dbg_disc, vha, 0x2118,
1573− "%s %d %8phC post NVMe PRLI\n",
1574− __func__, __LINE__, fcport->port_name);
1579+ "%s %d %8phC post %s PRLI\n",
1580+ __func__, __LINE__, fcport->port_name,
1581+ fcport->fc4f_nvme ? "NVME" : "FC");
15751582 qla24xx_post_prli_work(vha, fcport);
15761583 }
15771584 break;
@@ -1853,17 +1860,38 @@ qla24xx_handle_prli_done_event(struct scsi_qla_host *vha, struct event_arg *ea) · 275 unmodified lines
18531860 break;
18541861 }
18551862
1856− if (ea->fcport->n2n_flag) {
1863+ if (ea->fcport->fc4f_nvme) {
18571864 ql_dbg(ql_dbg_disc, vha, 0x2118,
18581865 "%s %d %8phC post fc4 prli\n",
18591866 __func__, __LINE__, ea->fcport->port_name);
18601867 ea->fcport->fc4f_nvme = 0;
1861− ea->fcport->n2n_flag = 0;
18621868 qla24xx_post_prli_work(vha, ea->fcport);
1869+ return;
1870+ }
1871+
1872+ /* at this point both PRLI NVME & PRLI FCP failed */
1873+ if (N2N_TOPO(vha->hw)) {
1874+ if (ea->fcport->n2n_link_reset_cnt < 3) {
1875+ ea->fcport->n2n_link_reset_cnt++;
1876+ /*
1877+ * remote port is not sending Plogi. Reset
1878+ * link to kick start his state machine
1879+ */
1880+ set_bit(N2N_LINK_RESET, &vha->dpc_flags);
1881+ } else {
1882+ ql_log(ql_log_warn, vha, 0x2119,
1883+ "%s %d %8phC Unable to reconnect\n",
1884+ __func__, __LINE__, ea->fcport->port_name);
1885+ }
1886+ } else {
1887+ /*
1888+ * switch connect. login failed. Take connection
1889+ * down and allow relogin to retrigger
1890+ */
1891+ ea->fcport->flags &= ~FCF_ASYNC_SENT;
1892+ ea->fcport->keep_nport_handle = 0;
1893+ qlt_schedule_sess_for_deletion(ea->fcport);
18631894 }
1864− ql_dbg(ql_dbg_disc, vha, 0x2119,
1865− "%s %d %8phC unhandle event of %x\n",
1866− __func__, __LINE__, ea->fcport->port_name, ea->data[0]);
18671895 break;
18681896 }
18691897 }
@@ -3190,7 +3218,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) · 1320 unmodified lines
31903218
31913219 for (j = 0; j < 2; j++, fwdt++) {
31923220 if (!fwdt->template) {
3193− ql_log(ql_log_warn, vha, 0x00ba,
3221+ ql_dbg(ql_dbg_init, vha, 0x00ba,
31943222 "-> fwdt%u no template\n", j);
31953223 continue;
31963224 }
@@ -4986,28 +5014,47 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha) · 1789 unmodified lines
49865014 unsigned long flags;
49875015
49885016 /* Inititae N2N login. */
4989− if (test_and_clear_bit(N2N_LOGIN_NEEDED, &vha->dpc_flags)) {
4990− /* borrowing */
4991− u32 *bp, i, sz;
4992−
4993− memset(ha->init_cb, 0, ha->init_cb_size);
4994− sz = min_t(int, sizeof(struct els_plogi_payload),
4995− ha->init_cb_size);
4996− rval = qla24xx_get_port_login_templ(vha, ha->init_cb_dma,
4997− (void *)ha->init_cb, sz);
4998− if (rval == QLA_SUCCESS) {
4999− bp = (uint32_t *)ha->init_cb;
5000− for (i = 0; i < sz/4 ; i++, bp++)
5001− *bp = cpu_to_be32(*bp);
5017+ if (N2N_TOPO(ha)) {
5018+ if (test_and_clear_bit(N2N_LOGIN_NEEDED, &vha->dpc_flags)) {
5019+ /* borrowing */
5020+ u32 *bp, i, sz;
5021+
5022+ memset(ha->init_cb, 0, ha->init_cb_size);
5023+ sz = min_t(int, sizeof(struct els_plogi_payload),
5024+ ha->init_cb_size);
5025+ rval = qla24xx_get_port_login_templ(vha,
5026+ ha->init_cb_dma, (void *)ha->init_cb, sz);
5027+ if (rval == QLA_SUCCESS) {
5028+ bp = (uint32_t *)ha->init_cb;
5029+ for (i = 0; i < sz/4 ; i++, bp++)
5030+ *bp = cpu_to_be32(*bp);
50025031
5003− memcpy(&ha->plogi_els_payld.data, (void *)ha->init_cb,
5004− sizeof(ha->plogi_els_payld.data));
5005− set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
5006− } else {
5007− ql_dbg(ql_dbg_init, vha, 0x00d1,
5008− "PLOGI ELS param read fail.\n");
5032+ memcpy(&ha->plogi_els_payld.data,
5033+ (void *)ha->init_cb,
5034+ sizeof(ha->plogi_els_payld.data));
5035+ set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
5036+ } else {
5037+ ql_dbg(ql_dbg_init, vha, 0x00d1,
5038+ "PLOGI ELS param read fail.\n");
5039+ goto skip_login;
5040+ }
5041+ }
5042+
5043+ list_for_each_entry(fcport, &vha->vp_fcports, list) {
5044+ if (fcport->n2n_flag) {
5045+ qla24xx_fcport_handle_login(vha, fcport);
5046+ return QLA_SUCCESS;
5047+ }
5048+ }
5049+skip_login:
5050+ spin_lock_irqsave(&vha->work_lock, flags);
5051+ vha->scan.scan_retry++;
5052+ spin_unlock_irqrestore(&vha->work_lock, flags);
5053+
5054+ if (vha->scan.scan_retry < MAX_SCAN_RETRIES) {
5055+ set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);
5056+ set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
50095057 }
5010− return QLA_SUCCESS;
50115058 }
50125059
50135060 found_devs = 0;
drivers/scsi/qla2xxx/qla_iocb.c+4−3
@@ -2656,9 +2656,10 @@ qla24xx_els_logo_iocb(srb_t *sp, struct els_entry_24xx *els_iocb) · 2655 unmodified lines
26562656 els_iocb->port_id[0] = sp->fcport->d_id.b.al_pa;
26572657 els_iocb->port_id[1] = sp->fcport->d_id.b.area;
26582658 els_iocb->port_id[2] = sp->fcport->d_id.b.domain;
2659− els_iocb->s_id[0] = vha->d_id.b.al_pa;
2660− els_iocb->s_id[1] = vha->d_id.b.area;
2661− els_iocb->s_id[2] = vha->d_id.b.domain;
2659+ /* For SID the byte order is different than DID */
2660+ els_iocb->s_id[1] = vha->d_id.b.al_pa;
2661+ els_iocb->s_id[2] = vha->d_id.b.area;
2662+ els_iocb->s_id[0] = vha->d_id.b.domain;
26622663
26632664 if (elsio->u.els_logo.els_cmd == ELS_DCMD_PLOGI) {
26642665 els_iocb->control_flags = 0;
drivers/scsi/qla2xxx/qla_mbx.c+22−3
@@ -2249,7 +2249,7 @@ qla2x00_lip_reset(scsi_qla_host_t *vha) · 2248 unmodified lines
22492249 mbx_cmd_t mc;
22502250 mbx_cmd_t *mcp = &mc;
22512251
2252− ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x105a,
2252+ ql_dbg(ql_dbg_disc, vha, 0x105a,
22532253 "Entered %s.\n", __func__);
22542254
22552255 if (IS_CNA_CAPABLE(vha->hw)) {
@@ -3883,14 +3883,24 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, · 1627 unmodified lines
38833883 case TOPO_N2N:
38843884 ha->current_topology = ISP_CFG_N;
38853885 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags);
3886+ list_for_each_entry(fcport, &vha->vp_fcports, list) {
3887+ fcport->scan_state = QLA_FCPORT_SCAN;
3888+ fcport->n2n_flag = 0;
3889+ }
3890+
38863891 fcport = qla2x00_find_fcport_by_wwpn(vha,
38873892 rptid_entry->u.f1.port_name, 1);
38883893 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags);
38893894
38903895 if (fcport) {
38913896 fcport->plogi_nack_done_deadline = jiffies + HZ;
3892− fcport->dm_login_expire = jiffies + 3*HZ;
3897+ fcport->dm_login_expire = jiffies + 2*HZ;
38933898 fcport->scan_state = QLA_FCPORT_FOUND;
3899+ fcport->n2n_flag = 1;
3900+ fcport->keep_nport_handle = 1;
3901+ if (vha->flags.nvme_enabled)
3902+ fcport->fc4f_nvme = 1;
3903+
38943904 switch (fcport->disc_state) {
38953905 case DSC_DELETED:
38963906 set_bit(RELOGIN_NEEDED,
@@ -3924,7 +3934,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, · 27 unmodified lines
39243934 rptid_entry->u.f1.port_name,
39253935 rptid_entry->u.f1.node_name,
39263936 NULL,
3927− FC4_TYPE_UNKNOWN);
3937+ FS_FCP_IS_N2N);
39283938 }
39293939
39303940 /* if our portname is higher then initiate N2N login */
@@ -4023,6 +4033,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, · 92 unmodified lines
40234033
40244034 list_for_each_entry(fcport, &vha->vp_fcports, list) {
40254035 fcport->scan_state = QLA_FCPORT_SCAN;
4036+ fcport->n2n_flag = 0;
40264037 }
40274038
40284039 fcport = qla2x00_find_fcport_by_wwpn(vha,
@@ -4032,6 +4043,14 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, · 3 unmodified lines
40324043 fcport->login_retry = vha->hw->login_retry_count;
40334044 fcport->plogi_nack_done_deadline = jiffies + HZ;
40344045 fcport->scan_state = QLA_FCPORT_FOUND;
4046+ fcport->keep_nport_handle = 1;
4047+ fcport->n2n_flag = 1;
4048+ fcport->d_id.b.domain =
4049+ rptid_entry->u.f2.remote_nport_id[2];
4050+ fcport->d_id.b.area =
4051+ rptid_entry->u.f2.remote_nport_id[1];
4052+ fcport->d_id.b.al_pa =
4053+ rptid_entry->u.f2.remote_nport_id[0];
40354054 }
40364055 }
40374056 }
drivers/scsi/qla2xxx/qla_mid.c+22−10
@@ -66,6 +66,7 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha) · 65 unmodified lines
6666 uint16_t vp_id;
6767 struct qla_hw_data *ha = vha->hw;
6868 unsigned long flags = 0;
69+ u8 i;
6970
7071 mutex_lock(&ha->vport_lock);
7172 /*
@@ -75,8 +76,9 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha) · 3 unmodified lines
7576 * ensures no active vp_list traversal while the vport is removed
7677 * from the queue)
7778 */
78− wait_event_timeout(vha->vref_waitq, !atomic_read(&vha->vref_count),
79− 10*HZ);
79+ for (i = 0; i < 10 && atomic_read(&vha->vref_count); i++)
80+ wait_event_timeout(vha->vref_waitq,
81+ atomic_read(&vha->vref_count), HZ);
8082
8183 spin_lock_irqsave(&ha->vport_slock, flags);
8284 if (atomic_read(&vha->vref_count)) {
@@ -262,6 +264,9 @@ qla2x00_alert_all_vps(struct rsp_que *rsp, uint16_t *mb) · 179 unmodified lines
262264 spin_lock_irqsave(&ha->vport_slock, flags);
263265 list_for_each_entry(vha, &ha->vp_list, list) {
264266 if (vha->vp_idx) {
267+ if (test_bit(VPORT_DELETE, &vha->dpc_flags))
268+ continue;
269+
265270 atomic_inc(&vha->vref_count);
266271 spin_unlock_irqrestore(&ha->vport_slock, flags);
267272
@@ -300,6 +305,20 @@ qla2x00_alert_all_vps(struct rsp_que *rsp, uint16_t *mb) · 32 unmodified lines
300305 int
301306 qla2x00_vp_abort_isp(scsi_qla_host_t *vha)
302307 {
308+ fc_port_t *fcport;
309+
310+ /*
311+ * To exclusively reset vport, we need to log it out first.
312+ * Note: This control_vp can fail if ISP reset is already
313+ * issued, this is expected, as the vp would be already
314+ * logged out due to ISP reset.
315+ */
316+ if (!test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) {
317+ qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL);
318+ list_for_each_entry(fcport, &vha->vp_fcports, list)
319+ fcport->logout_on_delete = 0;
320+ }
321+
303322 /*
304323 * Physical port will do most of the abort and recovery work. We can
305324 * just treat it as a loop down
@@ -312,16 +331,9 @@ qla2x00_vp_abort_isp(scsi_qla_host_t *vha) · 6 unmodified lines
312331 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
313332 }
314333
315− /*
316− * To exclusively reset vport, we need to log it out first. Note: this
317− * control_vp can fail if ISP reset is already issued, this is
318− * expected, as the vp would be already logged out due to ISP reset.
319− */
320− if (!test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags))
321− qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL);
322−
323334 ql_dbg(ql_dbg_taskm, vha, 0x801d,
324335 "Scheduling enable of Vport %d.\n", vha->vp_idx);
336+
325337 return qla24xx_enable_vp(vha);
326338 }
327339
drivers/scsi/qla2xxx/qla_os.c+13−5
@@ -1115,9 +1115,15 @@ static inline int test_fcport_count(scsi_qla_host_t *vha) · 1114 unmodified lines
11151115 void
11161116 qla2x00_wait_for_sess_deletion(scsi_qla_host_t *vha)
11171117 {
1118+ u8 i;
1119+
11181120 qla2x00_mark_all_devices_lost(vha, 0);
11191121
1120− wait_event_timeout(vha->fcport_waitQ, test_fcport_count(vha), 10*HZ);
1122+ for (i = 0; i < 10; i++)
1123+ wait_event_timeout(vha->fcport_waitQ, test_fcport_count(vha),
1124+ HZ);
1125+
1126+ flush_workqueue(vha->hw->wq);
11211127 }
11221128
11231129 /*
@@ -5036,6 +5042,10 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e) · 3912 unmodified lines
50365042
50375043 memcpy(fcport->port_name, e->u.new_sess.port_name,
50385044 WWN_SIZE);
5045+
5046+ if (e->u.new_sess.fc4_type & FS_FCP_IS_N2N)
5047+ fcport->n2n_flag = 1;
5048+
50395049 } else {
50405050 ql_dbg(ql_dbg_disc, vha, 0xffff,
50415051 "%s %8phC mem alloc fail.\n",
@@ -5134,11 +5144,9 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e) · 92 unmodified lines
51345144 if (dfcp)
51355145 qlt_schedule_sess_for_deletion(tfcp);
51365146
5137−
5138− if (N2N_TOPO(vha->hw))
5139− fcport->flags &= ~FCF_FABRIC_DEVICE;
5140−
51415147 if (N2N_TOPO(vha->hw)) {
5148+ fcport->flags &= ~FCF_FABRIC_DEVICE;
5149+ fcport->keep_nport_handle = 1;
51425150 if (vha->flags.nvme_enabled) {
51435151 fcport->fc4f_nvme = 1;
51445152 fcport->n2n_flag = 1;
drivers/scsi/qla2xxx/qla_target.c+13−13
@@ -953,7 +953,7 @@ void qlt_free_session_done(struct work_struct *work) · 952 unmodified lines
953953 struct qla_hw_data *ha = vha->hw;
954954 unsigned long flags;
955955 bool logout_started = false;
956− scsi_qla_host_t *base_vha;
956+ scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);
957957 struct qlt_plogi_ack_t *own =
958958 sess->plogi_link[QLT_PLOGI_LINK_SAME_WWN];
959959
@@ -1020,6 +1020,7 @@ void qlt_free_session_done(struct work_struct *work) · 60 unmodified lines
10201020
10211021 if (logout_started) {
10221022 bool traced = false;
1023+ u16 cnt = 0;
10231024
10241025 while (!READ_ONCE(sess->logout_completed)) {
10251026 if (!traced) {
@@ -1029,6 +1030,9 @@ void qlt_free_session_done(struct work_struct *work) · 3 unmodified lines
10291030 traced = true;
10301031 }
10311032 msleep(100);
1033+ cnt++;
1034+ if (cnt > 200)
1035+ break;
10321036 }
10331037
10341038 ql_dbg(ql_dbg_disc, vha, 0xf087,
@@ -1101,6 +1105,7 @@ void qlt_free_session_done(struct work_struct *work) · 66 unmodified lines
11011105 }
11021106
11031107 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags);
1108+ sess->free_pending = 0;
11041109
11051110 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf001,
11061111 "Unregistration of sess %p %8phC finished fcp_cnt %d\n",
@@ -1109,17 +1114,9 @@ void qlt_free_session_done(struct work_struct *work) · 2 unmodified lines
11091114 if (tgt && (tgt->sess_count == 0))
11101115 wake_up_all(&tgt->waitQ);
11111116
1112− if (vha->fcport_count == 0)
1113− wake_up_all(&vha->fcport_waitQ);
1114−
1115− base_vha = pci_get_drvdata(ha->pdev);
1116−
1117− sess->free_pending = 0;
1118−
1119− if (test_bit(PFLG_DRIVER_REMOVING, &base_vha->pci_flags))
1120− return;
1121−
1122− if ((!tgt || !tgt->tgt_stop) && !LOOP_TRANSITION(vha)) {
1117+ if (!test_bit(PFLG_DRIVER_REMOVING, &base_vha->pci_flags) &&
1118+ !(vha->vp_idx && test_bit(VPORT_DELETE, &vha->dpc_flags)) &&
1119+ (!tgt || !tgt->tgt_stop) && !LOOP_TRANSITION(vha)) {
11231120 switch (vha->host->active_mode) {
11241121 case MODE_INITIATOR:
11251122 case MODE_DUAL:
@@ -1132,6 +1129,9 @@ void qlt_free_session_done(struct work_struct *work) · 6 unmodified lines
11321129 break;
11331130 }
11341131 }
1132+
1133+ if (vha->fcport_count == 0)
1134+ wake_up_all(&vha->fcport_waitQ);
11351135 }
11361136
11371137 /* ha->tgt.sess_lock supposed to be held on entry */
@@ -1161,7 +1161,7 @@ void qlt_unreg_sess(struct fc_port *sess) · 23 unmodified lines
11611161 sess->last_login_gen = sess->login_gen;
11621162
11631163 INIT_WORK(&sess->free_work, qlt_free_session_done);
1164− schedule_work(&sess->free_work);
1164+ queue_work(sess->vha->hw->wq, &sess->free_work);
11651165 }
11661166 EXPORT_SYMBOL(qlt_unreg_sess);
11671167
drivers/scsi/storvsc_drv.c+1−2
@@ -1837,8 +1837,7 @@ static int storvsc_probe(struct hv_device *device, · 1836 unmodified lines
18371837 /*
18381838 * Set the number of HW queues we are supporting.
18391839 */
1840− if (stor_device->num_sc != 0)
1841− host->nr_hw_queues = stor_device->num_sc + 1;
1840+ host->nr_hw_queues = num_present_cpus();
18421841
18431842 /*
18441843 * Set the error handler work queue.
drivers/scsi/ufs/ufshcd.c+3−0
@@ -8143,6 +8143,9 @@ int ufshcd_shutdown(struct ufs_hba *hba) · 8142 unmodified lines
81438143 {
81448144 int ret = 0;
81458145
8146+ if (!hba->is_powered)
8147+ goto out;
8148+
81468149 if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba))
81478150 goto out;
81488151
drivers/staging/octeon/ethernet-tx.c+2−4
@@ -349,10 +349,8 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev) · 348 unmodified lines
349349 */
350350 dst_release(skb_dst(skb));
351351 skb_dst_set(skb, NULL);
352−#ifdef CONFIG_XFRM
353− secpath_reset(skb);
354−#endif
355− nf_reset(skb);
352+ skb_ext_reset(skb);
353+ nf_reset_ct(skb);
356354
357355 #ifdef CONFIG_NET_SCHED
358356 skb->tc_index = 0;
drivers/video/logo/Makefile+2−19
@@ -18,23 +18,6 @@ obj-$(CONFIG_SPU_BASE) += logo_spe_clut224.o · 17 unmodified lines
1818
1919 # How to generate logo's
2020
21−# Use logo-cfiles to retrieve list of .c files to be built
22−logo-cfiles = $(notdir $(patsubst %.$(2), %.c, \
23− $(wildcard $(srctree)/$(src)/*$(1).$(2))))
24−
25−
26−# Mono logos
27−extra-y += $(call logo-cfiles,_mono,pbm)
28−
29−# VGA16 logos
30−extra-y += $(call logo-cfiles,_vga16,ppm)
31−
32−# 224 Logos
33−extra-y += $(call logo-cfiles,_clut224,ppm)
34−
35−# Gray 256
36−extra-y += $(call logo-cfiles,_gray256,pgm)
37−
3821 pnmtologo := scripts/pnmtologo
3922
4023 # Create commands like "pnmtologo -t mono -n logo_mac_mono -o ..."
@@ -55,5 +38,5 @@ $(obj)/%_clut224.c: $(src)/%_clut224.ppm $(pnmtologo) FORCE · 14 unmodified lines
5538 $(obj)/%_gray256.c: $(src)/%_gray256.pgm $(pnmtologo) FORCE
5639 $(call if_changed,logo)
5740
58−# Files generated that shall be removed upon make clean
59−clean-files := *.o *_mono.c *_vga16.c *_clut224.c *_gray256.c
41+# generated C files
42+targets += *_mono.c *_vga16.c *_clut224.c *_gray256.c
drivers/xen/balloon.c+7−17
@@ -156,8 +156,10 @@ static DECLARE_DELAYED_WORK(balloon_worker, balloon_process); · 155 unmodified lines
156156 (GFP_HIGHUSER | __GFP_NOWARN | __GFP_NORETRY | __GFP_NOMEMALLOC)
157157
158158 /* balloon_append: add the given page to the balloon. */
159−static void __balloon_append(struct page *page)
159+static void balloon_append(struct page *page)
160160 {
161+ __SetPageOffline(page);
162+
161163 /* Lowmem is re-populated first, so highmem pages go at list tail. */
162164 if (PageHighMem(page)) {
163165 list_add_tail(&page->lru, &ballooned_pages);
@@ -169,11 +171,6 @@ static void __balloon_append(struct page *page) · 5 unmodified lines
169171 wake_up(&balloon_wq);
170172 }
171173
172−static void balloon_append(struct page *page)
173−{
174− __balloon_append(page);
175−}
176−
177174 /* balloon_retrieve: rescue a page from the balloon, if it is not empty. */
178175 static struct page *balloon_retrieve(bool require_lowmem)
179176 {
@@ -192,6 +189,7 @@ static struct page *balloon_retrieve(bool require_lowmem) · 12 unmodified lines
192189 else
193190 balloon_stats.balloon_low--;
194191
192+ __ClearPageOffline(page);
195193 return page;
196194 }
197195
@@ -377,8 +375,7 @@ static void xen_online_page(struct page *page, unsigned int order) · 179 unmodified lines
377375 for (i = 0; i < size; i++) {
378376 p = pfn_to_page(start_pfn + i);
379377 __online_page_set_limits(p);
380− __SetPageOffline(p);
381− __balloon_append(p);
378+ balloon_append(p);
382379 }
383380 mutex_unlock(&balloon_mutex);
384381 }
@@ -444,7 +441,6 @@ static enum bp_state increase_reservation(unsigned long nr_pages) · 59 unmodified lines
444441 xenmem_reservation_va_mapping_update(1, &page, &frame_list[i]);
445442
446443 /* Relinquish the page back to the allocator. */
447− __ClearPageOffline(page);
448444 free_reserved_page(page);
449445 }
450446
@@ -471,7 +467,6 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) · 20 unmodified lines
471467 state = BP_EAGAIN;
472468 break;
473469 }
474− __SetPageOffline(page);
475470 adjust_managed_page_count(page, -1);
476471 xenmem_reservation_scrub_page(page);
477472 list_add(&page->lru, &pages);
@@ -611,7 +606,6 @@ int alloc_xenballooned_pages(int nr_pages, struct page **pages) · 133 unmodified lines
611606 while (pgno < nr_pages) {
612607 page = balloon_retrieve(true);
613608 if (page) {
614− __ClearPageOffline(page);
615609 pages[pgno++] = page;
616610 #ifdef CONFIG_XEN_HAVE_PVMMU
617611 /*
@@ -653,10 +647,8 @@ void free_xenballooned_pages(int nr_pages, struct page **pages) · 35 unmodified lines
653647 mutex_lock(&balloon_mutex);
654648
655649 for (i = 0; i < nr_pages; i++) {
656− if (pages[i]) {
657− __SetPageOffline(pages[i]);
650+ if (pages[i])
658651 balloon_append(pages[i]);
659− }
660652 }
661653
662654 balloon_stats.target_unpopulated -= nr_pages;
@@ -674,7 +666,6 @@ static void __init balloon_add_region(unsigned long start_pfn, · 11 unmodified lines
674666 unsigned long pages)
675667 {
676668 unsigned long pfn, extra_pfn_end;
677− struct page *page;
678669
679670 /*
680671 * If the amount of usable memory has been limited (e.g., with
@@ -684,11 +675,10 @@ static void __init balloon_add_region(unsigned long start_pfn, · 3 unmodified lines
684675 extra_pfn_end = min(max_pfn, start_pfn + pages);
685676
686677 for (pfn = start_pfn; pfn < extra_pfn_end; pfn++) {
687− page = pfn_to_page(pfn);
688678 /* totalram_pages and totalhigh_pages do not
689679 include the boot-time balloon extension, so
690680 don't subtract from it. */
691− __balloon_append(page);
681+ balloon_append(pfn_to_page(pfn));
692682 }
693683
694684 balloon_stats.total_pages += extra_pfn_end - start_pfn;
drivers/xen/efi.c+47−37
@@ -40,7 +40,7 @@ · 39 unmodified lines
4040
4141 #define efi_data(op) (op.u.efi_runtime_call)
4242
43−efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
43+static efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
4444 {
4545 struct xen_platform_op op = INIT_EFI_OP(get_time);
4646
@@ -61,9 +61,8 @@ efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) · 14 unmodified lines
6161
6262 return efi_data(op).status;
6363 }
64−EXPORT_SYMBOL_GPL(xen_efi_get_time);
6564
66−efi_status_t xen_efi_set_time(efi_time_t *tm)
65+static efi_status_t xen_efi_set_time(efi_time_t *tm)
6766 {
6867 struct xen_platform_op op = INIT_EFI_OP(set_time);
6968
@@ -75,10 +74,10 @@ efi_status_t xen_efi_set_time(efi_time_t *tm) · 5 unmodified lines
7574
7675 return efi_data(op).status;
7776 }
78−EXPORT_SYMBOL_GPL(xen_efi_set_time);
7977
80−efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending,
81− efi_time_t *tm)
78+static efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled,
79+ efi_bool_t *pending,
80+ efi_time_t *tm)
8281 {
8382 struct xen_platform_op op = INIT_EFI_OP(get_wakeup_time);
8483
@@ -98,9 +97,8 @@ efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending, · 13 unmodified lines
9897
9998 return efi_data(op).status;
10099 }
101−EXPORT_SYMBOL_GPL(xen_efi_get_wakeup_time);
102100
103−efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm)
101+static efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm)
104102 {
105103 struct xen_platform_op op = INIT_EFI_OP(set_wakeup_time);
106104
@@ -117,11 +115,10 @@ efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm) · 10 unmodified lines
117115
118116 return efi_data(op).status;
119117 }
120−EXPORT_SYMBOL_GPL(xen_efi_set_wakeup_time);
121118
122−efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor,
123− u32 *attr, unsigned long *data_size,
124− void *data)
119+static efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor,
120+ u32 *attr, unsigned long *data_size,
121+ void *data)
125122 {
126123 struct xen_platform_op op = INIT_EFI_OP(get_variable);
127124
@@ -141,11 +138,10 @@ efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor, · 13 unmodified lines
141138
142139 return efi_data(op).status;
143140 }
144−EXPORT_SYMBOL_GPL(xen_efi_get_variable);
145141
146−efi_status_t xen_efi_get_next_variable(unsigned long *name_size,
147− efi_char16_t *name,
148− efi_guid_t *vendor)
142+static efi_status_t xen_efi_get_next_variable(unsigned long *name_size,
143+ efi_char16_t *name,
144+ efi_guid_t *vendor)
149145 {
150146 struct xen_platform_op op = INIT_EFI_OP(get_next_variable_name);
151147
@@ -165,11 +161,10 @@ efi_status_t xen_efi_get_next_variable(unsigned long *name_size, · 13 unmodified lines
165161
166162 return efi_data(op).status;
167163 }
168−EXPORT_SYMBOL_GPL(xen_efi_get_next_variable);
169164
170−efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor,
171− u32 attr, unsigned long data_size,
172− void *data)
165+static efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor,
166+ u32 attr, unsigned long data_size,
167+ void *data)
173168 {
174169 struct xen_platform_op op = INIT_EFI_OP(set_variable);
175170
@@ -186,11 +181,10 @@ efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor, · 10 unmodified lines
186181
187182 return efi_data(op).status;
188183 }
189−EXPORT_SYMBOL_GPL(xen_efi_set_variable);
190184
191−efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space,
192− u64 *remaining_space,
193− u64 *max_variable_size)
185+static efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space,
186+ u64 *remaining_space,
187+ u64 *max_variable_size)
194188 {
195189 struct xen_platform_op op = INIT_EFI_OP(query_variable_info);
196190
@@ -208,9 +202,8 @@ efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space, · 11 unmodified lines
208202
209203 return efi_data(op).status;
210204 }
211−EXPORT_SYMBOL_GPL(xen_efi_query_variable_info);
212205
213−efi_status_t xen_efi_get_next_high_mono_count(u32 *count)
206+static efi_status_t xen_efi_get_next_high_mono_count(u32 *count)
214207 {
215208 struct xen_platform_op op = INIT_EFI_OP(get_next_high_monotonic_count);
216209
@@ -221,10 +214,9 @@ efi_status_t xen_efi_get_next_high_mono_count(u32 *count) · 4 unmodified lines
221214
222215 return efi_data(op).status;
223216 }
224−EXPORT_SYMBOL_GPL(xen_efi_get_next_high_mono_count);
225217
226−efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules,
227− unsigned long count, unsigned long sg_list)
218+static efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules,
219+ unsigned long count, unsigned long sg_list)
228220 {
229221 struct xen_platform_op op = INIT_EFI_OP(update_capsule);
230222
@@ -241,11 +233,9 @@ efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules, · 10 unmodified lines
241233
242234 return efi_data(op).status;
243235 }
244−EXPORT_SYMBOL_GPL(xen_efi_update_capsule);
245236
246−efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
247− unsigned long count, u64 *max_size,
248− int *reset_type)
237+static efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
238+ unsigned long count, u64 *max_size, int *reset_type)
249239 {
250240 struct xen_platform_op op = INIT_EFI_OP(query_capsule_capabilities);
251241
@@ -264,10 +254,9 @@ efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules, · 12 unmodified lines
264254
265255 return efi_data(op).status;
266256 }
267−EXPORT_SYMBOL_GPL(xen_efi_query_capsule_caps);
268257
269−void xen_efi_reset_system(int reset_type, efi_status_t status,
270− unsigned long data_size, efi_char16_t *data)
258+static void xen_efi_reset_system(int reset_type, efi_status_t status,
259+ unsigned long data_size, efi_char16_t *data)
271260 {
272261 switch (reset_type) {
273262 case EFI_RESET_COLD:
@@ -281,4 +270,25 @@ void xen_efi_reset_system(int reset_type, efi_status_t status, · 7 unmodified lines
281270 BUG();
282271 }
283272 }
284−EXPORT_SYMBOL_GPL(xen_efi_reset_system);
273+
274+/*
275+ * Set XEN EFI runtime services function pointers. Other fields of struct efi,
276+ * e.g. efi.systab, will be set like normal EFI.
277+ */
278+void __init xen_efi_runtime_setup(void)
279+{
280+ efi.get_time = xen_efi_get_time;
281+ efi.set_time = xen_efi_set_time;
282+ efi.get_wakeup_time = xen_efi_get_wakeup_time;
283+ efi.set_wakeup_time = xen_efi_set_wakeup_time;
284+ efi.get_variable = xen_efi_get_variable;
285+ efi.get_next_variable = xen_efi_get_next_variable;
286+ efi.set_variable = xen_efi_set_variable;
287+ efi.set_variable_nonblocking = xen_efi_set_variable;
288+ efi.query_variable_info = xen_efi_query_variable_info;
289+ efi.query_variable_info_nonblocking = xen_efi_query_variable_info;
290+ efi.update_capsule = xen_efi_update_capsule;
291+ efi.query_capsule_caps = xen_efi_query_capsule_caps;
292+ efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count;
293+ efi.reset_system = xen_efi_reset_system;
294+}
drivers/xen/xenbus/xenbus_dev_frontend.c+18−2
@@ -55,6 +55,7 @@ · 54 unmodified lines
5555 #include <linux/string.h>
5656 #include <linux/slab.h>
5757 #include <linux/miscdevice.h>
58+#include <linux/workqueue.h>
5859
5960 #include <xen/xenbus.h>
6061 #include <xen/xen.h>
@@ -116,6 +117,8 @@ struct xenbus_file_priv { · 55 unmodified lines
116117 wait_queue_head_t read_waitq;
117118
118119 struct kref kref;
120+
121+ struct work_struct wq;
119122 };
120123
121124 /* Read out any raw xenbus messages queued up. */
@@ -300,14 +303,14 @@ static void watch_fired(struct xenbus_watch *watch, · 178 unmodified lines
300303 mutex_unlock(&adap->dev_data->reply_mutex);
301304 }
302305
303−static void xenbus_file_free(struct kref *kref)
306+static void xenbus_worker(struct work_struct *wq)
304307 {
305308 struct xenbus_file_priv *u;
306309 struct xenbus_transaction_holder *trans, *tmp;
307310 struct watch_adapter *watch, *tmp_watch;
308311 struct read_buffer *rb, *tmp_rb;
309312
310− u = container_of(kref, struct xenbus_file_priv, kref);
313+ u = container_of(wq, struct xenbus_file_priv, wq);
311314
312315 /*
313316 * No need for locking here because there are no other users,
@@ -333,6 +336,18 @@ static void xenbus_file_free(struct kref *kref) · 19 unmodified lines
333336 kfree(u);
334337 }
335338
339+static void xenbus_file_free(struct kref *kref)
340+{
341+ struct xenbus_file_priv *u;
342+
343+ /*
344+ * We might be called in xenbus_thread().
345+ * Use workqueue to avoid deadlock.
346+ */
347+ u = container_of(kref, struct xenbus_file_priv, kref);
348+ schedule_work(&u->wq);
349+}
350+
336351 static struct xenbus_transaction_holder *xenbus_get_transaction(
337352 struct xenbus_file_priv *u, uint32_t tx_id)
338353 {
@@ -650,6 +665,7 @@ static int xenbus_file_open(struct inode *inode, struct file *filp) · 311 unmodified lines
650665 INIT_LIST_HEAD(&u->watches);
651666 INIT_LIST_HEAD(&u->read_buffers);
652667 init_waitqueue_head(&u->read_waitq);
668+ INIT_WORK(&u->wq, xenbus_worker);
653669
654670 mutex_init(&u->reply_mutex);
655671 mutex_init(&u->msgbuffer_mutex);
fs/binfmt_elf.c+3−10
@@ -879,7 +879,7 @@ out_free_interp: · 878 unmodified lines
879879 the correct location in memory. */
880880 for(i = 0, elf_ppnt = elf_phdata;
881881 i < loc->elf_ex.e_phnum; i++, elf_ppnt++) {
882− int elf_prot, elf_flags, elf_fixed = MAP_FIXED_NOREPLACE;
882+ int elf_prot, elf_flags;
883883 unsigned long k, vaddr;
884884 unsigned long total_size = 0;
885885
@@ -911,13 +911,6 @@ out_free_interp: · 25 unmodified lines
911911 */
912912 }
913913 }
914−
915− /*
916− * Some binaries have overlapping elf segments and then
917− * we have to forcefully map over an existing mapping
918− * e.g. over this newly established brk mapping.
919− */
920− elf_fixed = MAP_FIXED;
921914 }
922915
923916 elf_prot = make_prot(elf_ppnt->p_flags);
@@ -930,7 +923,7 @@ out_free_interp: · 6 unmodified lines
930923 * the ET_DYN load_addr calculations, proceed normally.
931924 */
932925 if (loc->elf_ex.e_type == ET_EXEC || load_addr_set) {
933− elf_flags |= elf_fixed;
926+ elf_flags |= MAP_FIXED;
934927 } else if (loc->elf_ex.e_type == ET_DYN) {
935928 /*
936929 * This logic is run once for the first LOAD Program
@@ -966,7 +959,7 @@ out_free_interp: · 29 unmodified lines
966959 load_bias = ELF_ET_DYN_BASE;
967960 if (current->flags & PF_RANDOMIZE)
968961 load_bias += arch_mmap_rnd();
969− elf_flags |= elf_fixed;
962+ elf_flags |= MAP_FIXED;
970963 } else
971964 load_bias = 0;
972965
fs/erofs/data.c+7−3
@@ -34,11 +34,15 @@ static void erofs_readendio(struct bio *bio) · 33 unmodified lines
3434
3535 struct page *erofs_get_meta_page(struct super_block *sb, erofs_blk_t blkaddr)
3636 {
37− struct inode *const bd_inode = sb->s_bdev->bd_inode;
38− struct address_space *const mapping = bd_inode->i_mapping;
37+ struct address_space *const mapping = sb->s_bdev->bd_inode->i_mapping;
38+ struct page *page;
3939
40− return read_cache_page_gfp(mapping, blkaddr,
40+ page = read_cache_page_gfp(mapping, blkaddr,
4141 mapping_gfp_constraint(mapping, ~__GFP_FS));
42+ /* should already be PageUptodate */
43+ if (!IS_ERR(page))
44+ lock_page(page);
45+ return page;
4246 }
4347
4448 static int erofs_map_blocks_flatmode(struct inode *inode,
fs/erofs/super.c+2−2
@@ -105,9 +105,9 @@ static int erofs_read_superblock(struct super_block *sb) · 104 unmodified lines
105105 int ret;
106106
107107 page = read_mapping_page(sb->s_bdev->bd_inode->i_mapping, 0, NULL);
108− if (!page) {
108+ if (IS_ERR(page)) {
109109 erofs_err(sb, "cannot read erofs superblock");
110− return -EIO;
110+ return PTR_ERR(page);
111111 }
112112
113113 sbi = EROFS_SB(sb);
fs/erofs/zdata.c+10−2
@@ -575,7 +575,7 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe, · 574 unmodified lines
575575 struct erofs_map_blocks *const map = &fe->map;
576576 struct z_erofs_collector *const clt = &fe->clt;
577577 const loff_t offset = page_offset(page);
578− bool tight = (clt->mode >= COLLECT_PRIMARY_HOOKED);
578+ bool tight = true;
579579
580580 enum z_erofs_cache_alloctype cache_strategy;
581581 enum z_erofs_page_type page_type;
@@ -628,8 +628,16 @@ restart_now: · 46 unmodified lines
628628 preload_compressed_pages(clt, MNGD_MAPPING(sbi),
629629 cache_strategy, pagepool);
630630
631− tight &= (clt->mode >= COLLECT_PRIMARY_HOOKED);
632631 hitted:
632+ /*
633+ * Ensure the current partial page belongs to this submit chain rather
634+ * than other concurrent submit chains or the noio(bypass) chain since
635+ * those chains are handled asynchronously thus the page cannot be used
636+ * for inplace I/O or pagevec (should be processed in strict order.)
637+ */
638+ tight &= (clt->mode >= COLLECT_PRIMARY_HOOKED &&
639+ clt->mode != COLLECT_PRIMARY_FOLLOWED_NOINPLACE);
640+
633641 cur = end - min_t(unsigned int, offset + end - map->m_la, end);
634642 if (!(map->m_flags & EROFS_MAP_MAPPED)) {
635643 zero_user_segment(page, cur, end);
fs/io_uring.c+4−4
@@ -1892,15 +1892,15 @@ static int io_timeout(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 1891 unmodified lines
18921892 unsigned count, req_dist, tail_index;
18931893 struct io_ring_ctx *ctx = req->ctx;
18941894 struct list_head *entry;
1895− struct timespec ts;
1895+ struct timespec64 ts;
18961896
18971897 if (unlikely(ctx->flags & IORING_SETUP_IOPOLL))
18981898 return -EINVAL;
18991899 if (sqe->flags || sqe->ioprio || sqe->buf_index || sqe->timeout_flags ||
19001900 sqe->len != 1)
19011901 return -EINVAL;
1902− if (copy_from_user(&ts, (void __user *) (unsigned long) sqe->addr,
1903− sizeof(ts)))
1902+
1903+ if (get_timespec64(&ts, u64_to_user_ptr(sqe->addr)))
19041904 return -EFAULT;
19051905
19061906 /*
@@ -1934,7 +1934,7 @@ static int io_timeout(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 27 unmodified lines
19341934
19351935 hrtimer_init(&req->timeout.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
19361936 req->timeout.timer.function = io_timeout_fn;
1937− hrtimer_start(&req->timeout.timer, timespec_to_ktime(ts),
1937+ hrtimer_start(&req->timeout.timer, timespec64_to_ktime(ts),
19381938 HRTIMER_MODE_REL);
19391939 return 0;
19401940 }
fs/readdir.c+133−35
@@ -20,9 +20,63 @@ · 19 unmodified lines
2020 #include <linux/syscalls.h>
2121 #include <linux/unistd.h>
2222 #include <linux/compat.h>
23−
2423 #include <linux/uaccess.h>
2524
25+#include <asm/unaligned.h>
26+
27+/*
28+ * Note the "unsafe_put_user() semantics: we goto a
29+ * label for errors.
30+ *
31+ * Also note how we use a "while()" loop here, even though
32+ * only the biggest size needs to loop. The compiler (well,
33+ * at least gcc) is smart enough to turn the smaller sizes
34+ * into just if-statements, and this way we don't need to
35+ * care whether 'u64' or 'u32' is the biggest size.
36+ */
37+#define unsafe_copy_loop(dst, src, len, type, label) \
38+ while (len >= sizeof(type)) { \
39+ unsafe_put_user(get_unaligned((type *)src), \
40+ (type __user *)dst, label); \
41+ dst += sizeof(type); \
42+ src += sizeof(type); \
43+ len -= sizeof(type); \
44+ }
45+
46+/*
47+ * We avoid doing 64-bit copies on 32-bit architectures. They
48+ * might be better, but the component names are mostly small,
49+ * and the 64-bit cases can end up being much more complex and
50+ * put much more register pressure on the code, so it's likely
51+ * not worth the pain of unaligned accesses etc.
52+ *
53+ * So limit the copies to "unsigned long" size. I did verify
54+ * that at least the x86-32 case is ok without this limiting,
55+ * but I worry about random other legacy 32-bit cases that
56+ * might not do as well.
57+ */
58+#define unsafe_copy_type(dst, src, len, type, label) do { \
59+ if (sizeof(type) <= sizeof(unsigned long)) \
60+ unsafe_copy_loop(dst, src, len, type, label); \
61+} while (0)
62+
63+/*
64+ * Copy the dirent name to user space, and NUL-terminate
65+ * it. This should not be a function call, since we're doing
66+ * the copy inside a "user_access_begin/end()" section.
67+ */
68+#define unsafe_copy_dirent_name(_dst, _src, _len, label) do { \
69+ char __user *dst = (_dst); \
70+ const char *src = (_src); \
71+ size_t len = (_len); \
72+ unsafe_copy_type(dst, src, len, u64, label); \
73+ unsafe_copy_type(dst, src, len, u32, label); \
74+ unsafe_copy_type(dst, src, len, u16, label); \
75+ unsafe_copy_type(dst, src, len, u8, label); \
76+ unsafe_put_user(0, dst, label); \
77+} while (0)
78+
79+
2680 int iterate_dir(struct file *file, struct dir_context *ctx)
2781 {
2882 struct inode *inode = file_inode(file);
@@ -64,6 +118,40 @@ out: · 35 unmodified lines
64118 }
65119 EXPORT_SYMBOL(iterate_dir);
66120
121+/*
122+ * POSIX says that a dirent name cannot contain NULL or a '/'.
123+ *
124+ * It's not 100% clear what we should really do in this case.
125+ * The filesystem is clearly corrupted, but returning a hard
126+ * error means that you now don't see any of the other names
127+ * either, so that isn't a perfect alternative.
128+ *
129+ * And if you return an error, what error do you use? Several
130+ * filesystems seem to have decided on EUCLEAN being the error
131+ * code for EFSCORRUPTED, and that may be the error to use. Or
132+ * just EIO, which is perhaps more obvious to users.
133+ *
134+ * In order to see the other file names in the directory, the
135+ * caller might want to make this a "soft" error: skip the
136+ * entry, and return the error at the end instead.
137+ *
138+ * Note that this should likely do a "memchr(name, 0, len)"
139+ * check too, since that would be filesystem corruption as
140+ * well. However, that case can't actually confuse user space,
141+ * which has to do a strlen() on the name anyway to find the
142+ * filename length, and the above "soft error" worry means
143+ * that it's probably better left alone until we have that
144+ * issue clarified.
145+ */
146+static int verify_dirent_name(const char *name, int len)
147+{
148+ if (WARN_ON_ONCE(!len))
149+ return -EIO;
150+ if (WARN_ON_ONCE(memchr(name, '/', len)))
151+ return -EIO;
152+ return 0;
153+}
154+
67155 /*
68156 * Traditional linux readdir() handling..
69157 *
@@ -173,6 +261,9 @@ static int filldir(struct dir_context *ctx, const char *name, int namlen, · 103 unmodified lines
173261 int reclen = ALIGN(offsetof(struct linux_dirent, d_name) + namlen + 2,
174262 sizeof(long));
175263
264+ buf->error = verify_dirent_name(name, namlen);
265+ if (unlikely(buf->error))
266+ return buf->error;
176267 buf->error = -EINVAL; /* only used if we fail.. */
177268 if (reclen > buf->count)
178269 return -EINVAL;
@@ -182,28 +273,31 @@ static int filldir(struct dir_context *ctx, const char *name, int namlen, · 3 unmodified lines
182273 return -EOVERFLOW;
183274 }
184275 dirent = buf->previous;
185− if (dirent) {
186− if (signal_pending(current))
187− return -EINTR;
188− if (__put_user(offset, &dirent->d_off))
189− goto efault;
190− }
191− dirent = buf->current_dir;
192− if (__put_user(d_ino, &dirent->d_ino))
193− goto efault;
194− if (__put_user(reclen, &dirent->d_reclen))
195− goto efault;
196− if (copy_to_user(dirent->d_name, name, namlen))
197− goto efault;
198− if (__put_user(0, dirent->d_name + namlen))
199− goto efault;
200− if (__put_user(d_type, (char __user *) dirent + reclen - 1))
276+ if (dirent && signal_pending(current))
277+ return -EINTR;
278+
279+ /*
280+ * Note! This range-checks 'previous' (which may be NULL).
281+ * The real range was checked in getdents
282+ */
283+ if (!user_access_begin(dirent, sizeof(*dirent)))
201284 goto efault;
285+ if (dirent)
286+ unsafe_put_user(offset, &dirent->d_off, efault_end);
287+ dirent = buf->current_dir;
288+ unsafe_put_user(d_ino, &dirent->d_ino, efault_end);
289+ unsafe_put_user(reclen, &dirent->d_reclen, efault_end);
290+ unsafe_put_user(d_type, (char __user *) dirent + reclen - 1, efault_end);
291+ unsafe_copy_dirent_name(dirent->d_name, name, namlen, efault_end);
292+ user_access_end();
293+
202294 buf->previous = dirent;
203295 dirent = (void __user *)dirent + reclen;
204296 buf->current_dir = dirent;
205297 buf->count -= reclen;
206298 return 0;
299+efault_end:
300+ user_access_end();
207301 efault:
208302 buf->error = -EFAULT;
209303 return -EFAULT;
@@ -259,34 +353,38 @@ static int filldir64(struct dir_context *ctx, const char *name, int namlen, · 49 unmodified lines
259353 int reclen = ALIGN(offsetof(struct linux_dirent64, d_name) + namlen + 1,
260354 sizeof(u64));
261355
356+ buf->error = verify_dirent_name(name, namlen);
357+ if (unlikely(buf->error))
358+ return buf->error;
262359 buf->error = -EINVAL; /* only used if we fail.. */
263360 if (reclen > buf->count)
264361 return -EINVAL;
265362 dirent = buf->previous;
266− if (dirent) {
267− if (signal_pending(current))
268− return -EINTR;
269− if (__put_user(offset, &dirent->d_off))
270− goto efault;
271− }
272− dirent = buf->current_dir;
273− if (__put_user(ino, &dirent->d_ino))
274− goto efault;
275− if (__put_user(0, &dirent->d_off))
276− goto efault;
277− if (__put_user(reclen, &dirent->d_reclen))
278− goto efault;
279− if (__put_user(d_type, &dirent->d_type))
280− goto efault;
281− if (copy_to_user(dirent->d_name, name, namlen))
282− goto efault;
283− if (__put_user(0, dirent->d_name + namlen))
363+ if (dirent && signal_pending(current))
364+ return -EINTR;
365+
366+ /*
367+ * Note! This range-checks 'previous' (which may be NULL).
368+ * The real range was checked in getdents
369+ */
370+ if (!user_access_begin(dirent, sizeof(*dirent)))
284371 goto efault;
372+ if (dirent)
373+ unsafe_put_user(offset, &dirent->d_off, efault_end);
374+ dirent = buf->current_dir;
375+ unsafe_put_user(ino, &dirent->d_ino, efault_end);
376+ unsafe_put_user(reclen, &dirent->d_reclen, efault_end);
377+ unsafe_put_user(d_type, &dirent->d_type, efault_end);
378+ unsafe_copy_dirent_name(dirent->d_name, name, namlen, efault_end);
379+ user_access_end();
380+
285381 buf->previous = dirent;
286382 dirent = (void __user *)dirent + reclen;
287383 buf->current_dir = dirent;
288384 buf->count -= reclen;
289385 return 0;
386+efault_end:
387+ user_access_end();
290388 efault:
291389 buf->error = -EFAULT;
292390 return -EFAULT;
fs/statfs.c+4−13
@@ -318,19 +318,10 @@ COMPAT_SYSCALL_DEFINE2(fstatfs, unsigned int, fd, struct compat_statfs __user *, · 317 unmodified lines
318318 static int put_compat_statfs64(struct compat_statfs64 __user *ubuf, struct kstatfs *kbuf)
319319 {
320320 struct compat_statfs64 buf;
321− if (sizeof(ubuf->f_bsize) == 4) {
322− if ((kbuf->f_type | kbuf->f_bsize | kbuf->f_namelen |
323− kbuf->f_frsize | kbuf->f_flags) & 0xffffffff00000000ULL)
324− return -EOVERFLOW;
325− /* f_files and f_ffree may be -1; it's okay
326− * to stuff that into 32 bits */
327− if (kbuf->f_files != 0xffffffffffffffffULL
328− && (kbuf->f_files & 0xffffffff00000000ULL))
329− return -EOVERFLOW;
330− if (kbuf->f_ffree != 0xffffffffffffffffULL
331− && (kbuf->f_ffree & 0xffffffff00000000ULL))
332− return -EOVERFLOW;
333− }
321+
322+ if ((kbuf->f_bsize | kbuf->f_frsize) & 0xffffffff00000000ULL)
323+ return -EOVERFLOW;
324+
334325 memset(&buf, 0, sizeof(struct compat_statfs64));
335326 buf.f_type = kbuf->f_type;
336327 buf.f_bsize = kbuf->f_bsize;
include/linux/bitops.h+7−0
@@ -4,6 +4,13 @@ · 3 unmodified lines
44 #include <asm/types.h>
55 #include <linux/bits.h>
66
7+/* Set bits in the first 'n' bytes when loaded from memory */
8+#ifdef __LITTLE_ENDIAN
9+# define aligned_byte_mask(n) ((1UL << 8*(n))-1)
10+#else
11+# define aligned_byte_mask(n) (~0xffUL << (BITS_PER_LONG - 8 - 8*(n)))
12+#endif
13+
714 #define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE)
815 #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long))
916
include/linux/dsa/sja1105.h+3−1
@@ -31,6 +31,8 @@ · 30 unmodified lines
3131 #define SJA1105_META_SMAC 0x222222222222ull
3232 #define SJA1105_META_DMAC 0x0180C200000Eull
3333
34+#define SJA1105_HWTS_RX_EN 0
35+
3436 /* Global tagger data: each struct sja1105_port has a reference to
3537 * the structure defined in struct sja1105_private.
3638 */
@@ -42,7 +44,7 @@ struct sja1105_tagger_data { · 5 unmodified lines
4244 * from taggers running on multiple ports on SMP systems
4345 */
4446 spinlock_t meta_lock;
45− bool hwts_rx_en;
47+ unsigned long state;
4648 };
4749
4850 struct sja1105_skb_cb {
include/linux/kvm_host.h+2−0
@@ -1090,6 +1090,7 @@ enum kvm_stat_kind { · 1089 unmodified lines
10901090
10911091 struct kvm_stat_data {
10921092 int offset;
1093+ int mode;
10931094 struct kvm *kvm;
10941095 };
10951096
@@ -1097,6 +1098,7 @@ struct kvm_stats_debugfs_item { · 1 unmodified line
10971098 const char *name;
10981099 int offset;
10991100 enum kvm_stat_kind kind;
1101+ int mode;
11001102 };
11011103 extern struct kvm_stats_debugfs_item debugfs_entries[];
11021104 extern struct dentry *kvm_debugfs_dir;
include/linux/mii.h+9−0
@@ -455,6 +455,15 @@ static inline void mii_lpa_mod_linkmode_lpa_t(unsigned long *lp_advertising, · 454 unmodified lines
455455 lp_advertising, lpa & LPA_LPACK);
456456 }
457457
458+static inline void mii_ctrl1000_mod_linkmode_adv_t(unsigned long *advertising,
459+ u32 ctrl1000)
460+{
461+ linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, advertising,
462+ ctrl1000 & ADVERTISE_1000HALF);
463+ linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, advertising,
464+ ctrl1000 & ADVERTISE_1000FULL);
465+}
466+
458467 /**
459468 * linkmode_adv_to_lcl_adv_t
460469 * @advertising:pointer to linkmode advertising
include/linux/phy.h+2−0
@@ -678,6 +678,7 @@ static inline bool phy_is_started(struct phy_device *phydev) · 677 unmodified lines
678678 return phydev->state >= PHY_UP;
679679 }
680680
681+void phy_resolve_aneg_pause(struct phy_device *phydev);
681682 void phy_resolve_aneg_linkmode(struct phy_device *phydev);
682683
683684 /**
@@ -1076,6 +1077,7 @@ int genphy_config_eee_advert(struct phy_device *phydev); · 392 unmodified lines
10761077 int __genphy_config_aneg(struct phy_device *phydev, bool changed);
10771078 int genphy_aneg_done(struct phy_device *phydev);
10781079 int genphy_update_link(struct phy_device *phydev);
1080+int genphy_read_lpa(struct phy_device *phydev);
10791081 int genphy_read_status(struct phy_device *phydev);
10801082 int genphy_suspend(struct phy_device *phydev);
10811083 int genphy_resume(struct phy_device *phydev);
include/linux/skbuff.h+1−4
@@ -4160,15 +4160,12 @@ static inline void __skb_ext_copy(struct sk_buff *d, const struct sk_buff *s) {} · 4159 unmodified lines
41604160 static inline void skb_ext_copy(struct sk_buff *dst, const struct sk_buff *s) {}
41614161 #endif /* CONFIG_SKB_EXTENSIONS */
41624162
4163−static inline void nf_reset(struct sk_buff *skb)
4163+static inline void nf_reset_ct(struct sk_buff *skb)
41644164 {
41654165 #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
41664166 nf_conntrack_put(skb_nfct(skb));
41674167 skb->_nfct = 0;
41684168 #endif
4169−#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
4170− skb_ext_del(skb, SKB_EXT_BRIDGE_NF);
4171−#endif
41724169 }
41734170
41744171 static inline void nf_reset_trace(struct sk_buff *skb)
include/linux/uaccess.h+70−0
@@ -231,6 +231,76 @@ __copy_from_user_inatomic_nocache(void *to, const void __user *from, · 230 unmodified lines
231231
232232 #endif /* ARCH_HAS_NOCACHE_UACCESS */
233233
234+extern __must_check int check_zeroed_user(const void __user *from, size_t size);
235+
236+/**
237+ * copy_struct_from_user: copy a struct from userspace
238+ * @dst: Destination address, in kernel space. This buffer must be @ksize
239+ * bytes long.
240+ * @ksize: Size of @dst struct.
241+ * @src: Source address, in userspace.
242+ * @usize: (Alleged) size of @src struct.
243+ *
244+ * Copies a struct from userspace to kernel space, in a way that guarantees
245+ * backwards-compatibility for struct syscall arguments (as long as future
246+ * struct extensions are made such that all new fields are *appended* to the
247+ * old struct, and zeroed-out new fields have the same meaning as the old
248+ * struct).
249+ *
250+ * @ksize is just sizeof(*dst), and @usize should've been passed by userspace.
251+ * The recommended usage is something like the following:
252+ *
253+ * SYSCALL_DEFINE2(foobar, const struct foo __user *, uarg, size_t, usize)
254+ * {
255+ * int err;
256+ * struct foo karg = {};
257+ *
258+ * if (usize > PAGE_SIZE)
259+ * return -E2BIG;
260+ * if (usize < FOO_SIZE_VER0)
261+ * return -EINVAL;
262+ *
263+ * err = copy_struct_from_user(&karg, sizeof(karg), uarg, usize);
264+ * if (err)
265+ * return err;
266+ *
267+ * // ...
268+ * }
269+ *
270+ * There are three cases to consider:
271+ * * If @usize == @ksize, then it's copied verbatim.
272+ * * If @usize < @ksize, then the userspace has passed an old struct to a
273+ * newer kernel. The rest of the trailing bytes in @dst (@ksize - @usize)
274+ * are to be zero-filled.
275+ * * If @usize > @ksize, then the userspace has passed a new struct to an
276+ * older kernel. The trailing bytes unknown to the kernel (@usize - @ksize)
277+ * are checked to ensure they are zeroed, otherwise -E2BIG is returned.
278+ *
279+ * Returns (in all cases, some data may have been copied):
280+ * * -E2BIG: (@usize > @ksize) and there are non-zero trailing bytes in @src.
281+ * * -EFAULT: access to userspace failed.
282+ */
283+static __always_inline __must_check int
284+copy_struct_from_user(void *dst, size_t ksize, const void __user *src,
285+ size_t usize)
286+{
287+ size_t size = min(ksize, usize);
288+ size_t rest = max(ksize, usize) - size;
289+
290+ /* Deal with trailing bytes. */
291+ if (usize < ksize) {
292+ memset(dst + size, 0, rest);
293+ } else if (usize > ksize) {
294+ int ret = check_zeroed_user(src + size, rest);
295+ if (ret <= 0)
296+ return ret ?: -E2BIG;
297+ }
298+ /* Copy the interoperable parts of the struct. */
299+ if (copy_from_user(dst, src, size))
300+ return -EFAULT;
301+ return 0;
302+}
303+
234304 /*
235305 * probe_kernel_read(): safely attempt to read from a location
236306 * @dst: pointer to the buffer that shall take the data
include/trace/events/rxrpc.h+1−1
@@ -1068,7 +1068,7 @@ TRACE_EVENT(rxrpc_recvmsg, · 1067 unmodified lines
10681068 ),
10691069
10701070 TP_fast_assign(
1071− __entry->call = call->debug_id;
1071+ __entry->call = call ? call->debug_id : 0;
10721072 __entry->why = why;
10731073 __entry->seq = seq;
10741074 __entry->offset = offset;
include/uapi/drm/amdgpu_drm.h+2−0
@@ -1003,6 +1003,8 @@ struct drm_amdgpu_info_device { · 1002 unmodified lines
10031003 __u64 high_va_max;
10041004 /* gfx10 pa_sc_tile_steering_override */
10051005 __u32 pa_sc_tile_steering_override;
1006+ /* disabled TCCs */
1007+ __u64 tcc_disabled_mask;
10061008 };
10071009
10081010 struct drm_amdgpu_info_hw_ip {
include/uapi/linux/nvme_ioctl.h+23−0
@@ -45,6 +45,27 @@ struct nvme_passthru_cmd { · 44 unmodified lines
4545 __u32 result;
4646 };
4747
48+struct nvme_passthru_cmd64 {
49+ __u8 opcode;
50+ __u8 flags;
51+ __u16 rsvd1;
52+ __u32 nsid;
53+ __u32 cdw2;
54+ __u32 cdw3;
55+ __u64 metadata;
56+ __u64 addr;
57+ __u32 metadata_len;
58+ __u32 data_len;
59+ __u32 cdw10;
60+ __u32 cdw11;
61+ __u32 cdw12;
62+ __u32 cdw13;
63+ __u32 cdw14;
64+ __u32 cdw15;
65+ __u32 timeout_ms;
66+ __u64 result;
67+};
68+
4869 #define nvme_admin_cmd nvme_passthru_cmd
4970
5071 #define NVME_IOCTL_ID _IO('N', 0x40)
@@ -54,5 +75,7 @@ struct nvme_passthru_cmd { · 3 unmodified lines
5475 #define NVME_IOCTL_RESET _IO('N', 0x44)
5576 #define NVME_IOCTL_SUBSYS_RESET _IO('N', 0x45)
5677 #define NVME_IOCTL_RESCAN _IO('N', 0x46)
78+#define NVME_IOCTL_ADMIN64_CMD _IOWR('N', 0x47, struct nvme_passthru_cmd64)
79+#define NVME_IOCTL_IO64_CMD _IOWR('N', 0x48, struct nvme_passthru_cmd64)
5780
5881 #endif /* _UAPI_LINUX_NVME_IOCTL_H */
include/uapi/linux/pg.h+4−1
@@ -35,6 +35,9 @@ · 34 unmodified lines
3535
3636 */
3737
38+#ifndef _UAPI_LINUX_PG_H
39+#define _UAPI_LINUX_PG_H
40+
3841 #define PG_MAGIC 'P'
3942 #define PG_RESET 'Z'
4043 #define PG_COMMAND 'C'
@@ -61,4 +64,4 @@ struct pg_read_hdr { · 20 unmodified lines
6164
6265 };
6366
64−/* end of pg.h */
67+#endif /* _UAPI_LINUX_PG_H */
include/uapi/linux/sched.h+28−2
@@ -33,8 +33,31 @@ · 32 unmodified lines
3333 #define CLONE_NEWNET 0x40000000 /* New network namespace */
3434 #define CLONE_IO 0x80000000 /* Clone io context */
3535
36−/*
37− * Arguments for the clone3 syscall
36+#ifndef __ASSEMBLY__
37+/**
38+ * struct clone_args - arguments for the clone3 syscall
39+ * @flags: Flags for the new process as listed above.
40+ * All flags are valid except for CSIGNAL and
41+ * CLONE_DETACHED.
42+ * @pidfd: If CLONE_PIDFD is set, a pidfd will be
43+ * returned in this argument.
44+ * @child_tid: If CLONE_CHILD_SETTID is set, the TID of the
45+ * child process will be returned in the child's
46+ * memory.
47+ * @parent_tid: If CLONE_PARENT_SETTID is set, the TID of
48+ * the child process will be returned in the
49+ * parent's memory.
50+ * @exit_signal: The exit_signal the parent process will be
51+ * sent when the child exits.
52+ * @stack: Specify the location of the stack for the
53+ * child process.
54+ * @stack_size: The size of the stack for the child process.
55+ * @tls: If CLONE_SETTLS is set, the tls descriptor
56+ * is set to tls.
57+ *
58+ * The structure is versioned by size and thus extensible.
59+ * New struct members must go at the end of the struct and
60+ * must be properly 64bit aligned.
3861 */
3962 struct clone_args {
4063 __aligned_u64 flags;
@@ -46,6 +69,9 @@ struct clone_args { · 5 unmodified lines
4669 __aligned_u64 stack_size;
4770 __aligned_u64 tls;
4871 };
72+#endif
73+
74+#define CLONE_ARGS_SIZE_VER0 64 /* sizeof first published struct */
4975
5076 /*
5177 * Scheduling policies
include/xen/xen-ops.h+1−24
@@ -212,30 +212,7 @@ int xen_xlate_map_ballooned_pages(xen_pfn_t **pfns, void **vaddr, · 211 unmodified lines
212212
213213 bool xen_running_on_version_or_later(unsigned int major, unsigned int minor);
214214
215−efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc);
216−efi_status_t xen_efi_set_time(efi_time_t *tm);
217−efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending,
218− efi_time_t *tm);
219−efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm);
220−efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor,
221− u32 *attr, unsigned long *data_size,
222− void *data);
223−efi_status_t xen_efi_get_next_variable(unsigned long *name_size,
224− efi_char16_t *name, efi_guid_t *vendor);
225−efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor,
226− u32 attr, unsigned long data_size,
227− void *data);
228−efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space,
229− u64 *remaining_space,
230− u64 *max_variable_size);
231−efi_status_t xen_efi_get_next_high_mono_count(u32 *count);
232−efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules,
233− unsigned long count, unsigned long sg_list);
234−efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
235− unsigned long count, u64 *max_size,
236− int *reset_type);
237−void xen_efi_reset_system(int reset_type, efi_status_t status,
238− unsigned long data_size, efi_char16_t *data);
215+void xen_efi_runtime_setup(void);
239216
240217
241218 #ifdef CONFIG_PREEMPT
kernel/dma/remap.c+2−2
@@ -87,9 +87,9 @@ void *dma_common_contiguous_remap(struct page *page, size_t size, · 86 unmodified lines
8787 */
8888 void dma_common_free_remap(void *cpu_addr, size_t size)
8989 {
90− struct page **pages = dma_common_find_pages(cpu_addr);
90+ struct vm_struct *area = find_vm_area(cpu_addr);
9191
92− if (!pages) {
92+ if (!area || area->flags != VM_DMA_COHERENT) {
9393 WARN(1, "trying to free invalid coherent area: %p\n", cpu_addr);
9494 return;
9595 }
kernel/events/core.c+9−38
@@ -10586,55 +10586,26 @@ static int perf_copy_attr(struct perf_event_attr __user *uattr, · 10585 unmodified lines
1058610586 u32 size;
1058710587 int ret;
1058810588
10589− if (!access_ok(uattr, PERF_ATTR_SIZE_VER0))
10590− return -EFAULT;
10591−
10592− /*
10593− * zero the full structure, so that a short copy will be nice.
10594− */
10589+ /* Zero the full structure, so that a short copy will be nice. */
1059510590 memset(attr, 0, sizeof(*attr));
1059610591
1059710592 ret = get_user(size, &uattr->size);
1059810593 if (ret)
1059910594 return ret;
1060010595
10601− if (size > PAGE_SIZE) /* silly large */
10602− goto err_size;
10603−
10604− if (!size) /* abi compat */
10596+ /* ABI compatibility quirk: */
10597+ if (!size)
1060510598 size = PERF_ATTR_SIZE_VER0;
10606−
10607− if (size < PERF_ATTR_SIZE_VER0)
10599+ if (size < PERF_ATTR_SIZE_VER0 || size > PAGE_SIZE)
1060810600 goto err_size;
1060910601
10610− /*
10611− * If we're handed a bigger struct than we know of,
10612− * ensure all the unknown bits are 0 - i.e. new
10613− * user-space does not rely on any kernel feature
10614− * extensions we dont know about yet.
10615− */
10616− if (size > sizeof(*attr)) {
10617− unsigned char __user *addr;
10618− unsigned char __user *end;
10619− unsigned char val;
10620−
10621− addr = (void __user *)uattr + sizeof(*attr);
10622− end = (void __user *)uattr + size;
10623−
10624− for (; addr < end; addr++) {
10625− ret = get_user(val, addr);
10626− if (ret)
10627− return ret;
10628− if (val)
10629− goto err_size;
10630− }
10631− size = sizeof(*attr);
10602+ ret = copy_struct_from_user(attr, sizeof(*attr), uattr, size);
10603+ if (ret) {
10604+ if (ret == -E2BIG)
10605+ goto err_size;
10606+ return ret;
1063210607 }
1063310608
10634− ret = copy_from_user(attr, uattr, size);
10635− if (ret)
10636− return -EFAULT;
10637−
1063810609 attr->size = size;
1063910610
1064010611 if (attr->__reserved_1)
kernel/fork.c+18−27
@@ -2525,39 +2525,19 @@ SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, · 2524 unmodified lines
25252525 #ifdef __ARCH_WANT_SYS_CLONE3
25262526 noinline static int copy_clone_args_from_user(struct kernel_clone_args *kargs,
25272527 struct clone_args __user *uargs,
2528− size_t size)
2528+ size_t usize)
25292529 {
2530+ int err;
25302531 struct clone_args args;
25312532
2532− if (unlikely(size > PAGE_SIZE))
2533+ if (unlikely(usize > PAGE_SIZE))
25332534 return -E2BIG;
2534−
2535− if (unlikely(size < sizeof(struct clone_args)))
2535+ if (unlikely(usize < CLONE_ARGS_SIZE_VER0))
25362536 return -EINVAL;
25372537
2538− if (unlikely(!access_ok(uargs, size)))
2539− return -EFAULT;
2540−
2541− if (size > sizeof(struct clone_args)) {
2542− unsigned char __user *addr;
2543− unsigned char __user *end;
2544− unsigned char val;
2545−
2546− addr = (void __user *)uargs + sizeof(struct clone_args);
2547− end = (void __user *)uargs + size;
2548−
2549− for (; addr < end; addr++) {
2550− if (get_user(val, addr))
2551− return -EFAULT;
2552− if (val)
2553− return -E2BIG;
2554− }
2555−
2556− size = sizeof(struct clone_args);
2557− }
2558−
2559− if (copy_from_user(&args, uargs, size))
2560− return -EFAULT;
2538+ err = copy_struct_from_user(&args, sizeof(args), uargs, usize);
2539+ if (err)
2540+ return err;
25612541
25622542 /*
25632543 * Verify that higher 32bits of exit_signal are unset and that
@@ -2604,6 +2584,17 @@ static bool clone3_args_valid(const struct kernel_clone_args *kargs) · 40 unmodified lines
26042584 return true;
26052585 }
26062586
2587+/**
2588+ * clone3 - create a new process with specific properties
2589+ * @uargs: argument structure
2590+ * @size: size of @uargs
2591+ *
2592+ * clone3() is the extensible successor to clone()/clone2().
2593+ * It takes a struct as argument that is versioned by its size.
2594+ *
2595+ * Return: On success, a positive PID for the child process.
2596+ * On error, a negative errno number.
2597+ */
26072598 SYSCALL_DEFINE2(clone3, struct clone_args __user *, uargs, size_t, size)
26082599 {
26092600 int err;
kernel/gen_kheaders.sh+4−1
@@ -71,7 +71,10 @@ done | cpio --quiet -pd $cpio_dir >/dev/null 2>&1 · 70 unmodified lines
7171 find $cpio_dir -type f -print0 |
7272 xargs -0 -P8 -n1 perl -pi -e 'BEGIN {undef $/;}; s/\/\*((?!SPDX).)*?\*\///smg;'
7373
74−tar -Jcf $tarfile -C $cpio_dir/ . > /dev/null
74+# Create archive and try to normalize metadata for reproducibility
75+tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \
76+ --owner=0 --group=0 --sort=name --numeric-owner \
77+ -Jcf $tarfile -C $cpio_dir/ . > /dev/null
7578
7679 echo "$src_files_md5" > kernel/kheaders.md5
7780 echo "$obj_files_md5" >> kernel/kheaders.md5
kernel/sched/core.c+7−36
@@ -5106,9 +5106,6 @@ static int sched_copy_attr(struct sched_attr __user *uattr, struct sched_attr *a · 5105 unmodified lines
51065106 u32 size;
51075107 int ret;
51085108
5109− if (!access_ok(uattr, SCHED_ATTR_SIZE_VER0))
5110− return -EFAULT;
5111−
51125109 /* Zero the full structure, so that a short copy will be nice: */
51135110 memset(attr, 0, sizeof(*attr));
51145111
@@ -5116,45 +5113,19 @@ static int sched_copy_attr(struct sched_attr __user *uattr, struct sched_attr *a · 1 unmodified line
51165113 if (ret)
51175114 return ret;
51185115
5119− /* Bail out on silly large: */
5120− if (size > PAGE_SIZE)
5121− goto err_size;
5122−
51235116 /* ABI compatibility quirk: */
51245117 if (!size)
51255118 size = SCHED_ATTR_SIZE_VER0;
5126−
5127− if (size < SCHED_ATTR_SIZE_VER0)
5119+ if (size < SCHED_ATTR_SIZE_VER0 || size > PAGE_SIZE)
51285120 goto err_size;
51295121
5130− /*
5131− * If we're handed a bigger struct than we know of,
5132− * ensure all the unknown bits are 0 - i.e. new
5133− * user-space does not rely on any kernel feature
5134− * extensions we dont know about yet.
5135− */
5136− if (size > sizeof(*attr)) {
5137− unsigned char __user *addr;
5138− unsigned char __user *end;
5139− unsigned char val;
5140−
5141− addr = (void __user *)uattr + sizeof(*attr);
5142− end = (void __user *)uattr + size;
5143−
5144− for (; addr < end; addr++) {
5145− ret = get_user(val, addr);
5146− if (ret)
5147− return ret;
5148− if (val)
5149− goto err_size;
5150− }
5151− size = sizeof(*attr);
5122+ ret = copy_struct_from_user(attr, sizeof(*attr), uattr, size);
5123+ if (ret) {
5124+ if (ret == -E2BIG)
5125+ goto err_size;
5126+ return ret;
51525127 }
51535128
5154− ret = copy_from_user(attr, uattr, size);
5155− if (ret)
5156− return -EFAULT;
5157−
51585129 if ((attr->sched_flags & SCHED_FLAG_UTIL_CLAMP) &&
51595130 size < SCHED_ATTR_SIZE_VER1)
51605131 return -EINVAL;
@@ -5354,7 +5325,7 @@ sched_attr_copy_to_user(struct sched_attr __user *uattr, · 193 unmodified lines
53545325 * sys_sched_getattr - similar to sched_getparam, but with sched_attr
53555326 * @pid: the pid in question.
53565327 * @uattr: structure containing the extended parameters.
5357− * @usize: sizeof(attr) that user-space knows about, for forwards and backwards compatibility.
5328+ * @usize: sizeof(attr) for fwd/bwd comp.
53585329 * @flags: for future extension.
53595330 */
53605331 SYSCALL_DEFINE4(sched_getattr, pid_t, pid, struct sched_attr __user *, uattr,
kernel/sched/membarrier.c+0−1
@@ -174,7 +174,6 @@ static int membarrier_private_expedited(int flags) · 173 unmodified lines
174174 */
175175 if (cpu == raw_smp_processor_id())
176176 continue;
177− rcu_read_lock();
178177 p = rcu_dereference(cpu_rq(cpu)->curr);
179178 if (p && p->mm == mm)
180179 __cpumask_set_cpu(cpu, tmpmask);
kernel/time/tick-broadcast-hrtimer.c+29−33
@@ -42,39 +42,39 @@ static int bc_shutdown(struct clock_event_device *evt) · 41 unmodified lines
4242 */
4343 static int bc_set_next(ktime_t expires, struct clock_event_device *bc)
4444 {
45− int bc_moved;
4645 /*
47− * We try to cancel the timer first. If the callback is on
48− * flight on some other cpu then we let it handle it. If we
49− * were able to cancel the timer nothing can rearm it as we
50− * own broadcast_lock.
46+ * This is called either from enter/exit idle code or from the
47+ * broadcast handler. In all cases tick_broadcast_lock is held.
5148 *
52− * However we can also be called from the event handler of
53− * ce_broadcast_hrtimer itself when it expires. We cannot
54− * restart the timer because we are in the callback, but we
55− * can set the expiry time and let the callback return
56− * HRTIMER_RESTART.
49+ * hrtimer_cancel() cannot be called here neither from the
50+ * broadcast handler nor from the enter/exit idle code. The idle
51+ * code can run into the problem described in bc_shutdown() and the
52+ * broadcast handler cannot wait for itself to complete for obvious
53+ * reasons.
5754 *
58− * Since we are in the idle loop at this point and because
59− * hrtimer_{start/cancel} functions call into tracing,
60− * calls to these functions must be bound within RCU_NONIDLE.
55+ * Each caller tries to arm the hrtimer on its own CPU, but if the
56+ * hrtimer callbback function is currently running, then
57+ * hrtimer_start() cannot move it and the timer stays on the CPU on
58+ * which it is assigned at the moment.
59+ *
60+ * As this can be called from idle code, the hrtimer_start()
61+ * invocation has to be wrapped with RCU_NONIDLE() as
62+ * hrtimer_start() can call into tracing.
6163 */
62− RCU_NONIDLE(
63− {
64− bc_moved = hrtimer_try_to_cancel(&bctimer) >= 0;
65− if (bc_moved) {
66− hrtimer_start(&bctimer, expires,
67− HRTIMER_MODE_ABS_PINNED_HARD);
68− }
69− }
70− );
71−
72− if (bc_moved) {
73− /* Bind the "device" to the cpu */
74− bc->bound_on = smp_processor_id();
75− } else if (bc->bound_on == smp_processor_id()) {
76− hrtimer_set_expires(&bctimer, expires);
77− }
64+ RCU_NONIDLE( {
65+ hrtimer_start(&bctimer, expires, HRTIMER_MODE_ABS_PINNED_HARD);
66+ /*
67+ * The core tick broadcast mode expects bc->bound_on to be set
68+ * correctly to prevent a CPU which has the broadcast hrtimer
69+ * armed from going deep idle.
70+ *
71+ * As tick_broadcast_lock is held, nothing can change the cpu
72+ * base which was just established in hrtimer_start() above. So
73+ * the below access is safe even without holding the hrtimer
74+ * base lock.
75+ */
76+ bc->bound_on = bctimer.base->cpu_base->cpu;
77+ } );
7878 return 0;
7979 }
8080
@@ -100,10 +100,6 @@ static enum hrtimer_restart bc_handler(struct hrtimer *t) · 19 unmodified lines
100100 {
101101 ce_broadcast_hrtimer.event_handler(&ce_broadcast_hrtimer);
102102
103− if (clockevent_state_oneshot(&ce_broadcast_hrtimer))
104− if (ce_broadcast_hrtimer.next_event != KTIME_MAX)
105− return HRTIMER_RESTART;
106−
107103 return HRTIMER_NORESTART;
108104 }
109105
lib/strnlen_user.c+1−7
@@ -3,16 +3,10 @@ · 2 unmodified lines
33 #include <linux/export.h>
44 #include <linux/uaccess.h>
55 #include <linux/mm.h>
6+#include <linux/bitops.h>
67
78 #include <asm/word-at-a-time.h>
89
9−/* Set bits in the first 'n' bytes when loaded from memory */
10−#ifdef __LITTLE_ENDIAN
11−# define aligned_byte_mask(n) ((1ul << 8*(n))-1)
12−#else
13−# define aligned_byte_mask(n) (~0xfful << (BITS_PER_LONG - 8 - 8*(n)))
14−#endif
15−
1610 /*
1711 * Do a strnlen, return length of string *with* final '\0'.
1812 * 'count' is the user-supplied count, while 'max' is the
lib/test_user_copy.c+130−6
@@ -31,14 +31,133 @@ · 30 unmodified lines
3131 # define TEST_U64
3232 #endif
3333
34−#define test(condition, msg) \
35−({ \
36− int cond = (condition); \
37− if (cond) \
38− pr_warn("%s\n", msg); \
39− cond; \
34+#define test(condition, msg, ...) \
35+({ \
36+ int cond = (condition); \
37+ if (cond) \
38+ pr_warn("[%d] " msg "\n", __LINE__, ##__VA_ARGS__); \
39+ cond; \
4040 })
4141
42+static bool is_zeroed(void *from, size_t size)
43+{
44+ return memchr_inv(from, 0x0, size) == NULL;
45+}
46+
47+static int test_check_nonzero_user(char *kmem, char __user *umem, size_t size)
48+{
49+ int ret = 0;
50+ size_t start, end, i;
51+ size_t zero_start = size / 4;
52+ size_t zero_end = size - zero_start;
53+
54+ /*
55+ * We conduct a series of check_nonzero_user() tests on a block of memory
56+ * with the following byte-pattern (trying every possible [start,end]
57+ * pair):
58+ *
59+ * [ 00 ff 00 ff ... 00 00 00 00 ... ff 00 ff 00 ]
60+ *
61+ * And we verify that check_nonzero_user() acts identically to memchr_inv().
62+ */
63+
64+ memset(kmem, 0x0, size);
65+ for (i = 1; i < zero_start; i += 2)
66+ kmem[i] = 0xff;
67+ for (i = zero_end; i < size; i += 2)
68+ kmem[i] = 0xff;
69+
70+ ret |= test(copy_to_user(umem, kmem, size),
71+ "legitimate copy_to_user failed");
72+
73+ for (start = 0; start <= size; start++) {
74+ for (end = start; end <= size; end++) {
75+ size_t len = end - start;
76+ int retval = check_zeroed_user(umem + start, len);
77+ int expected = is_zeroed(kmem + start, len);
78+
79+ ret |= test(retval != expected,
80+ "check_nonzero_user(=%d) != memchr_inv(=%d) mismatch (start=%zu, end=%zu)",
81+ retval, expected, start, end);
82+ }
83+ }
84+
85+ return ret;
86+}
87+
88+static int test_copy_struct_from_user(char *kmem, char __user *umem,
89+ size_t size)
90+{
91+ int ret = 0;
92+ char *umem_src = NULL, *expected = NULL;
93+ size_t ksize, usize;
94+
95+ umem_src = kmalloc(size, GFP_KERNEL);
96+ if ((ret |= test(umem_src == NULL, "kmalloc failed")))
97+ goto out_free;
98+
99+ expected = kmalloc(size, GFP_KERNEL);
100+ if ((ret |= test(expected == NULL, "kmalloc failed")))
101+ goto out_free;
102+
103+ /* Fill umem with a fixed byte pattern. */
104+ memset(umem_src, 0x3e, size);
105+ ret |= test(copy_to_user(umem, umem_src, size),
106+ "legitimate copy_to_user failed");
107+
108+ /* Check basic case -- (usize == ksize). */
109+ ksize = size;
110+ usize = size;
111+
112+ memcpy(expected, umem_src, ksize);
113+
114+ memset(kmem, 0x0, size);
115+ ret |= test(copy_struct_from_user(kmem, ksize, umem, usize),
116+ "copy_struct_from_user(usize == ksize) failed");
117+ ret |= test(memcmp(kmem, expected, ksize),
118+ "copy_struct_from_user(usize == ksize) gives unexpected copy");
119+
120+ /* Old userspace case -- (usize < ksize). */
121+ ksize = size;
122+ usize = size / 2;
123+
124+ memcpy(expected, umem_src, usize);
125+ memset(expected + usize, 0x0, ksize - usize);
126+
127+ memset(kmem, 0x0, size);
128+ ret |= test(copy_struct_from_user(kmem, ksize, umem, usize),
129+ "copy_struct_from_user(usize < ksize) failed");
130+ ret |= test(memcmp(kmem, expected, ksize),
131+ "copy_struct_from_user(usize < ksize) gives unexpected copy");
132+
133+ /* New userspace (-E2BIG) case -- (usize > ksize). */
134+ ksize = size / 2;
135+ usize = size;
136+
137+ memset(kmem, 0x0, size);
138+ ret |= test(copy_struct_from_user(kmem, ksize, umem, usize) != -E2BIG,
139+ "copy_struct_from_user(usize > ksize) didn't give E2BIG");
140+
141+ /* New userspace (success) case -- (usize > ksize). */
142+ ksize = size / 2;
143+ usize = size;
144+
145+ memcpy(expected, umem_src, ksize);
146+ ret |= test(clear_user(umem + ksize, usize - ksize),
147+ "legitimate clear_user failed");
148+
149+ memset(kmem, 0x0, size);
150+ ret |= test(copy_struct_from_user(kmem, ksize, umem, usize),
151+ "copy_struct_from_user(usize > ksize) failed");
152+ ret |= test(memcmp(kmem, expected, ksize),
153+ "copy_struct_from_user(usize > ksize) gives unexpected copy");
154+
155+out_free:
156+ kfree(expected);
157+ kfree(umem_src);
158+ return ret;
159+}
160+
42161 static int __init test_user_copy_init(void)
43162 {
44163 int ret = 0;
@@ -106,6 +225,11 @@ static int __init test_user_copy_init(void) · 61 unmodified lines
106225 #endif
107226 #undef test_legit
108227
228+ /* Test usage of check_nonzero_user(). */
229+ ret |= test_check_nonzero_user(kmem, usermem, 2 * PAGE_SIZE);
230+ /* Test usage of copy_struct_from_user(). */
231+ ret |= test_copy_struct_from_user(kmem, usermem, 2 * PAGE_SIZE);
232+
109233 /*
110234 * Invalid usage: none of these copies should succeed.
111235 */
lib/textsearch.c+2−2
@@ -89,9 +89,9 @@ · 88 unmodified lines
8989 * goto errout;
9090 * }
9191 *
92− * pos = textsearch_find_continuous(conf, \&state, example, strlen(example));
92+ * pos = textsearch_find_continuous(conf, &state, example, strlen(example));
9393 * if (pos != UINT_MAX)
94− * panic("Oh my god, dancing chickens at \%d\n", pos);
94+ * panic("Oh my god, dancing chickens at %d\n", pos);
9595 *
9696 * textsearch_destroy(conf);
9797 */
lib/usercopy.c+55−0
@@ -1,5 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0
22 #include <linux/uaccess.h>
3+#include <linux/bitops.h>
34
45 /* out-of-line parts */
56
@@ -31,3 +32,57 @@ unsigned long _copy_to_user(void __user *to, const void *from, unsigned long n) · 25 unmodified lines
3132 }
3233 EXPORT_SYMBOL(_copy_to_user);
3334 #endif
35+
36+/**
37+ * check_zeroed_user: check if a userspace buffer only contains zero bytes
38+ * @from: Source address, in userspace.
39+ * @size: Size of buffer.
40+ *
41+ * This is effectively shorthand for "memchr_inv(from, 0, size) == NULL" for
42+ * userspace addresses (and is more efficient because we don't care where the
43+ * first non-zero byte is).
44+ *
45+ * Returns:
46+ * * 0: There were non-zero bytes present in the buffer.
47+ * * 1: The buffer was full of zero bytes.
48+ * * -EFAULT: access to userspace failed.
49+ */
50+int check_zeroed_user(const void __user *from, size_t size)
51+{
52+ unsigned long val;
53+ uintptr_t align = (uintptr_t) from % sizeof(unsigned long);
54+
55+ if (unlikely(size == 0))
56+ return 1;
57+
58+ from -= align;
59+ size += align;
60+
61+ if (!user_access_begin(from, size))
62+ return -EFAULT;
63+
64+ unsafe_get_user(val, (unsigned long __user *) from, err_fault);
65+ if (align)
66+ val &= ~aligned_byte_mask(align);
67+
68+ while (size > sizeof(unsigned long)) {
69+ if (unlikely(val))
70+ goto done;
71+
72+ from += sizeof(unsigned long);
73+ size -= sizeof(unsigned long);
74+
75+ unsafe_get_user(val, (unsigned long __user *) from, err_fault);
76+ }
77+
78+ if (size < sizeof(unsigned long))
79+ val &= aligned_byte_mask(size);
80+
81+done:
82+ user_access_end();
83+ return (val == 0);
84+err_fault:
85+ user_access_end();
86+ return -EFAULT;
87+}
88+EXPORT_SYMBOL(check_zeroed_user);
net/batman-adv/soft-interface.c+1−1
@@ -436,7 +436,7 @@ void batadv_interface_rx(struct net_device *soft_iface, · 435 unmodified lines
436436 /* clean the netfilter state now that the batman-adv header has been
437437 * removed
438438 */
439− nf_reset(skb);
439+ nf_reset_ct(skb);
440440
441441 if (unlikely(!pskb_may_pull(skb, ETH_HLEN)))
442442 goto dropped;
net/core/devlink.c+3−3
@@ -3172,7 +3172,7 @@ static int devlink_nl_cmd_param_get_dumpit(struct sk_buff *msg, · 3171 unmodified lines
31723172 NETLINK_CB(cb->skb).portid,
31733173 cb->nlh->nlmsg_seq,
31743174 NLM_F_MULTI);
3175− if (err) {
3175+ if (err && err != -EOPNOTSUPP) {
31763176 mutex_unlock(&devlink->lock);
31773177 goto out;
31783178 }
@@ -3432,7 +3432,7 @@ static int devlink_nl_cmd_port_param_get_dumpit(struct sk_buff *msg, · 253 unmodified lines
34323432 NETLINK_CB(cb->skb).portid,
34333433 cb->nlh->nlmsg_seq,
34343434 NLM_F_MULTI);
3435− if (err) {
3435+ if (err && err != -EOPNOTSUPP) {
34363436 mutex_unlock(&devlink->lock);
34373437 goto out;
34383438 }
@@ -4088,7 +4088,7 @@ static int devlink_nl_cmd_info_get_dumpit(struct sk_buff *msg, · 649 unmodified lines
40884088 cb->nlh->nlmsg_seq, NLM_F_MULTI,
40894089 cb->extack);
40904090 mutex_unlock(&devlink->lock);
4091− if (err)
4091+ if (err && err != -EOPNOTSUPP)
40924092 break;
40934093 idx++;
40944094 }
net/core/skbuff.c+1−1
@@ -5120,7 +5120,7 @@ void skb_scrub_packet(struct sk_buff *skb, bool xnet) · 5119 unmodified lines
51205120 skb->ignore_df = 0;
51215121 skb_dst_drop(skb);
51225122 skb_ext_reset(skb);
5123− nf_reset(skb);
5123+ nf_reset_ct(skb);
51245124 nf_reset_trace(skb);
51255125
51265126 #ifdef CONFIG_NET_SWITCHDEV
net/core/sock.c+9−4
@@ -1700,8 +1700,6 @@ static void __sk_destruct(struct rcu_head *head) · 1699 unmodified lines
17001700 sk_filter_uncharge(sk, filter);
17011701 RCU_INIT_POINTER(sk->sk_filter, NULL);
17021702 }
1703− if (rcu_access_pointer(sk->sk_reuseport_cb))
1704− reuseport_detach_sock(sk);
17051703
17061704 sock_disable_timestamp(sk, SK_FLAGS_TIMESTAMP);
17071705
@@ -1728,7 +1726,14 @@ static void __sk_destruct(struct rcu_head *head) · 20 unmodified lines
17281726
17291727 void sk_destruct(struct sock *sk)
17301728 {
1731− if (sock_flag(sk, SOCK_RCU_FREE))
1729+ bool use_call_rcu = sock_flag(sk, SOCK_RCU_FREE);
1730+
1731+ if (rcu_access_pointer(sk->sk_reuseport_cb)) {
1732+ reuseport_detach_sock(sk);
1733+ use_call_rcu = true;
1734+ }
1735+
1736+ if (use_call_rcu)
17321737 call_rcu(&sk->sk_rcu, __sk_destruct);
17331738 else
17341739 __sk_destruct(&sk->sk_rcu);
@@ -3492,7 +3497,7 @@ static long sock_prot_memory_allocated(struct proto *proto) · 1757 unmodified lines
34923497 return proto->memory_allocated != NULL ? proto_memory_allocated(proto) : -1L;
34933498 }
34943499
3495−static char *sock_prot_memory_pressure(struct proto *proto)
3500+static const char *sock_prot_memory_pressure(struct proto *proto)
34963501 {
34973502 return proto->memory_pressure != NULL ?
34983503 proto_memory_pressure(proto) ? "yes" : "no" : "NI";
net/dccp/ipv4.c+1−1
@@ -871,7 +871,7 @@ lookup: · 870 unmodified lines
871871
872872 if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb))
873873 goto discard_and_relse;
874− nf_reset(skb);
874+ nf_reset_ct(skb);
875875
876876 return __sk_receive_skb(sk, skb, 1, dh->dccph_doff * 4, refcounted);
877877
net/dsa/tag_sja1105.c+11−1
@@ -156,7 +156,11 @@ static struct sk_buff · 155 unmodified lines
156156 /* Step 1: A timestampable frame was received.
157157 * Buffer it until we get its meta frame.
158158 */
159− if (is_link_local && sp->data->hwts_rx_en) {
159+ if (is_link_local) {
160+ if (!test_bit(SJA1105_HWTS_RX_EN, &sp->data->state))
161+ /* Do normal processing. */
162+ return skb;
163+
160164 spin_lock(&sp->data->meta_lock);
161165 /* Was this a link-local frame instead of the meta
162166 * that we were expecting?
@@ -187,6 +191,12 @@ static struct sk_buff · 24 unmodified lines
187191 } else if (is_meta) {
188192 struct sk_buff *stampable_skb;
189193
194+ /* Drop the meta frame if we're not in the right state
195+ * to process it.
196+ */
197+ if (!test_bit(SJA1105_HWTS_RX_EN, &sp->data->state))
198+ return NULL;
199+
190200 spin_lock(&sp->data->meta_lock);
191201
192202 stampable_skb = sp->data->stampable_skb;
net/ipv4/ip_gre.c+1−0
@@ -1446,6 +1446,7 @@ static void erspan_setup(struct net_device *dev) · 1445 unmodified lines
14461446 struct ip_tunnel *t = netdev_priv(dev);
14471447
14481448 ether_setup(dev);
1449+ dev->max_mtu = 0;
14491450 dev->netdev_ops = &erspan_netdev_ops;
14501451 dev->priv_flags &= ~IFF_TX_SKB_SHARING;
14511452 dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
net/ipv4/ip_input.c+1−1
@@ -199,7 +199,7 @@ resubmit: · 198 unmodified lines
199199 kfree_skb(skb);
200200 return;
201201 }
202− nf_reset(skb);
202+ nf_reset_ct(skb);
203203 }
204204 ret = INDIRECT_CALL_2(ipprot->handler, tcp_v4_rcv, udp_rcv,
205205 skb);
net/ipv4/ipmr.c+2−2
@@ -1794,7 +1794,7 @@ static void ip_encap(struct net *net, struct sk_buff *skb, · 1793 unmodified lines
17941794 ip_send_check(iph);
17951795
17961796 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
1797− nf_reset(skb);
1797+ nf_reset_ct(skb);
17981798 }
17991799
18001800 static inline int ipmr_forward_finish(struct net *net, struct sock *sk,
@@ -2140,7 +2140,7 @@ int ip_mr_input(struct sk_buff *skb) · 339 unmodified lines
21402140
21412141 mroute_sk = rcu_dereference(mrt->mroute_sk);
21422142 if (mroute_sk) {
2143− nf_reset(skb);
2143+ nf_reset_ct(skb);
21442144 raw_rcv(mroute_sk, skb);
21452145 return 0;
21462146 }
net/ipv4/netfilter/nf_dup_ipv4.c+1−1
@@ -65,7 +65,7 @@ void nf_dup_ipv4(struct net *net, struct sk_buff *skb, unsigned int hooknum, · 64 unmodified lines
6565
6666 #if IS_ENABLED(CONFIG_NF_CONNTRACK)
6767 /* Avoid counting cloned packets towards the original connection. */
68− nf_reset(skb);
68+ nf_reset_ct(skb);
6969 nf_ct_set(skb, NULL, IP_CT_UNTRACKED);
7070 #endif
7171 /*
net/ipv4/raw.c+1−1
@@ -332,7 +332,7 @@ int raw_rcv(struct sock *sk, struct sk_buff *skb) · 331 unmodified lines
332332 kfree_skb(skb);
333333 return NET_RX_DROP;
334334 }
335− nf_reset(skb);
335+ nf_reset_ct(skb);
336336
337337 skb_push(skb, skb->data - skb_network_header(skb));
338338
net/ipv4/route.c+2−3
@@ -916,16 +916,15 @@ void ip_rt_send_redirect(struct sk_buff *skb) · 915 unmodified lines
916916 if (peer->rate_tokens == 0 ||
917917 time_after(jiffies,
918918 (peer->rate_last +
919− (ip_rt_redirect_load << peer->rate_tokens)))) {
919+ (ip_rt_redirect_load << peer->n_redirects)))) {
920920 __be32 gw = rt_nexthop(rt, ip_hdr(skb)->daddr);
921921
922922 icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, gw);
923923 peer->rate_last = jiffies;
924− ++peer->rate_tokens;
925924 ++peer->n_redirects;
926925 #ifdef CONFIG_IP_ROUTE_VERBOSE
927926 if (log_martians &&
928− peer->rate_tokens == ip_rt_redirect_number)
927+ peer->n_redirects == ip_rt_redirect_number)
929928 net_warn_ratelimited("host %pI4/if%d ignores redirects for %pI4 to %pI4\n",
930929 &ip_hdr(skb)->saddr, inet_iif(skb),
931930 &ip_hdr(skb)->daddr, &gw);
net/ipv4/tcp.c+2−4
@@ -1798,13 +1798,11 @@ static int tcp_zerocopy_receive(struct sock *sk, · 1797 unmodified lines
17981798 }
17991799 if (skb_frag_size(frags) != PAGE_SIZE || skb_frag_off(frags)) {
18001800 int remaining = zc->recv_skip_hint;
1801− int size = skb_frag_size(frags);
18021801
1803− while (remaining && (size != PAGE_SIZE ||
1802+ while (remaining && (skb_frag_size(frags) != PAGE_SIZE ||
18041803 skb_frag_off(frags))) {
1805− remaining -= size;
1804+ remaining -= skb_frag_size(frags);
18061805 frags++;
1807− size = skb_frag_size(frags);
18081806 }
18091807 zc->recv_skip_hint -= remaining;
18101808 break;
net/ipv4/tcp_ipv4.c+1−1
@@ -1916,7 +1916,7 @@ process: · 1915 unmodified lines
19161916 if (tcp_v4_inbound_md5_hash(sk, skb))
19171917 goto discard_and_relse;
19181918
1919− nf_reset(skb);
1919+ nf_reset_ct(skb);
19201920
19211921 if (tcp_filter(sk, skb))
19221922 goto discard_and_relse;
net/ipv4/tcp_timer.c+7−2
@@ -198,8 +198,13 @@ static bool retransmits_timed_out(struct sock *sk, · 197 unmodified lines
198198 return false;
199199
200200 start_ts = tcp_sk(sk)->retrans_stamp;
201− if (likely(timeout == 0))
202− timeout = tcp_model_timeout(sk, boundary, TCP_RTO_MIN);
201+ if (likely(timeout == 0)) {
202+ unsigned int rto_base = TCP_RTO_MIN;
203+
204+ if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV))
205+ rto_base = tcp_timeout_init(sk);
206+ timeout = tcp_model_timeout(sk, boundary, rto_base);
207+ }
203208
204209 return (s32)(tcp_time_stamp(tcp_sk(sk)) - start_ts - timeout) >= 0;
205210 }
net/ipv4/udp.c+9−6
@@ -821,6 +821,7 @@ static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4, · 820 unmodified lines
821821 int is_udplite = IS_UDPLITE(sk);
822822 int offset = skb_transport_offset(skb);
823823 int len = skb->len - offset;
824+ int datalen = len - sizeof(*uh);
824825 __wsum csum = 0;
825826
826827 /*
@@ -854,10 +855,12 @@ static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4, · 27 unmodified lines
854855 return -EIO;
855856 }
856857
857− skb_shinfo(skb)->gso_size = cork->gso_size;
858− skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4;
859− skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(len - sizeof(uh),
860− cork->gso_size);
858+ if (datalen > cork->gso_size) {
859+ skb_shinfo(skb)->gso_size = cork->gso_size;
860+ skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4;
861+ skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(datalen,
862+ cork->gso_size);
863+ }
861864 goto csum_partial;
862865 }
863866
@@ -1969,7 +1972,7 @@ static int udp_queue_rcv_one_skb(struct sock *sk, struct sk_buff *skb) · 1105 unmodified lines
19691972 */
19701973 if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb))
19711974 goto drop;
1972− nf_reset(skb);
1975+ nf_reset_ct(skb);
19731976
19741977 if (static_branch_unlikely(&udp_encap_needed_key) && up->encap_type) {
19751978 int (*encap_rcv)(struct sock *sk, struct sk_buff *skb);
@@ -2298,7 +2301,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, · 322 unmodified lines
22982301
22992302 if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb))
23002303 goto drop;
2301− nf_reset(skb);
2304+ nf_reset_ct(skb);
23022305
23032306 /* No socket. Drop packet silently, if checksum is wrong */
23042307 if (udp_lib_checksum_complete(skb))
net/ipv6/addrconf.c+12−5
@@ -5964,13 +5964,20 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) · 5963 unmodified lines
59645964 switch (event) {
59655965 case RTM_NEWADDR:
59665966 /*
5967− * If the address was optimistic
5968− * we inserted the route at the start of
5969− * our DAD process, so we don't need
5970− * to do it again
5967+ * If the address was optimistic we inserted the route at the
5968+ * start of our DAD process, so we don't need to do it again.
5969+ * If the device was taken down in the middle of the DAD
5970+ * cycle there is a race where we could get here without a
5971+ * host route, so nothing to insert. That will be fixed when
5972+ * the device is brought up.
59715973 */
5972− if (!rcu_access_pointer(ifp->rt->fib6_node))
5974+ if (ifp->rt && !rcu_access_pointer(ifp->rt->fib6_node)) {
59735975 ip6_ins_rt(net, ifp->rt);
5976+ } else if (!ifp->rt && (ifp->idev->dev->flags & IFF_UP)) {
5977+ pr_warn("BUG: Address %pI6c on device %s is missing its host route.\n",
5978+ &ifp->addr, ifp->idev->dev->name);
5979+ }
5980+
59745981 if (ifp->idev->cnf.forwarding)
59755982 addrconf_join_anycast(ifp);
59765983 if (!ipv6_addr_any(&ifp->peer_addr))
net/ipv6/ip6_input.c+11−1
@@ -223,6 +223,16 @@ static struct sk_buff *ip6_rcv_core(struct sk_buff *skb, struct net_device *dev, · 222 unmodified lines
223223 if (ipv6_addr_is_multicast(&hdr->saddr))
224224 goto err;
225225
226+ /* While RFC4291 is not explicit about v4mapped addresses
227+ * in IPv6 headers, it seems clear linux dual-stack
228+ * model can not deal properly with these.
229+ * Security models could be fooled by ::ffff:127.0.0.1 for example.
230+ *
231+ * https://tools.ietf.org/html/draft-itojun-v6ops-v4mapped-harmful-02
232+ */
233+ if (ipv6_addr_v4mapped(&hdr->saddr))
234+ goto err;
235+
226236 skb->transport_header = skb->network_header + sizeof(*hdr);
227237 IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr);
228238
@@ -371,7 +381,7 @@ resubmit_final: · 142 unmodified lines
371381 /* Free reference early: we don't need it any more,
372382 and it may hold ip_conntrack module loaded
373383 indefinitely. */
374− nf_reset(skb);
384+ nf_reset_ct(skb);
375385
376386 skb_postpull_rcsum(skb, skb_network_header(skb),
377387 skb_network_header_len(skb));
net/ipv6/netfilter/nf_dup_ipv6.c+1−1
@@ -54,7 +54,7 @@ void nf_dup_ipv6(struct net *net, struct sk_buff *skb, unsigned int hooknum, · 53 unmodified lines
5454 return;
5555
5656 #if IS_ENABLED(CONFIG_NF_CONNTRACK)
57− nf_reset(skb);
57+ nf_reset_ct(skb);
5858 nf_ct_set(skb, NULL, IP_CT_UNTRACKED);
5959 #endif
6060 if (hooknum == NF_INET_PRE_ROUTING ||
net/ipv6/raw.c+1−1
@@ -215,7 +215,7 @@ static bool ipv6_raw_deliver(struct sk_buff *skb, int nexthdr) · 214 unmodified lines
215215
216216 /* Not releasing hash table! */
217217 if (clone) {
218− nf_reset(clone);
218+ nf_reset_ct(clone);
219219 rawv6_rcv(sk, clone);
220220 }
221221 }
net/ipv6/udp.c+7−2
@@ -1109,6 +1109,7 @@ static int udp_v6_send_skb(struct sk_buff *skb, struct flowi6 *fl6, · 1108 unmodified lines
11091109 __wsum csum = 0;
11101110 int offset = skb_transport_offset(skb);
11111111 int len = skb->len - offset;
1112+ int datalen = len - sizeof(*uh);
11121113
11131114 /*
11141115 * Create a UDP header
@@ -1141,8 +1142,12 @@ static int udp_v6_send_skb(struct sk_buff *skb, struct flowi6 *fl6, · 26 unmodified lines
11411142 return -EIO;
11421143 }
11431144
1144− skb_shinfo(skb)->gso_size = cork->gso_size;
1145− skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4;
1145+ if (datalen > cork->gso_size) {
1146+ skb_shinfo(skb)->gso_size = cork->gso_size;
1147+ skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4;
1148+ skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(datalen,
1149+ cork->gso_size);
1150+ }
11461151 goto csum_partial;
11471152 }
11481153
net/l2tp/l2tp_core.c+1−1
@@ -1078,7 +1078,7 @@ int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, int hdr_len · 1077 unmodified lines
10781078 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
10791079 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED |
10801080 IPSKB_REROUTED);
1081− nf_reset(skb);
1081+ nf_reset_ct(skb);
10821082
10831083 bh_lock_sock(sk);
10841084 if (sock_owned_by_user(sk)) {
net/l2tp/l2tp_eth.c+1−1
@@ -151,7 +151,7 @@ static void l2tp_eth_dev_recv(struct l2tp_session *session, struct sk_buff *skb, · 150 unmodified lines
151151 skb->ip_summed = CHECKSUM_NONE;
152152
153153 skb_dst_drop(skb);
154− nf_reset(skb);
154+ nf_reset_ct(skb);
155155
156156 rcu_read_lock();
157157 dev = rcu_dereference(spriv->dev);
net/l2tp/l2tp_ip.c+1−1
@@ -193,7 +193,7 @@ pass_up: · 192 unmodified lines
193193 if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb))
194194 goto discard_put;
195195
196− nf_reset(skb);
196+ nf_reset_ct(skb);
197197
198198 return sk_receive_skb(sk, skb, 1);
199199
net/l2tp/l2tp_ip6.c+1−1
@@ -206,7 +206,7 @@ pass_up: · 205 unmodified lines
206206 if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb))
207207 goto discard_put;
208208
209− nf_reset(skb);
209+ nf_reset_ct(skb);
210210
211211 return sk_receive_skb(sk, skb, 1);
212212
net/mac80211/debugfs_netdev.c+9−2
@@ -487,9 +487,14 @@ static ssize_t ieee80211_if_fmt_aqm( · 486 unmodified lines
487487 const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
488488 {
489489 struct ieee80211_local *local = sdata->local;
490− struct txq_info *txqi = to_txq_info(sdata->vif.txq);
490+ struct txq_info *txqi;
491491 int len;
492492
493+ if (!sdata->vif.txq)
494+ return 0;
495+
496+ txqi = to_txq_info(sdata->vif.txq);
497+
493498 spin_lock_bh(&local->fq.lock);
494499 rcu_read_lock();
495500
@@ -658,7 +663,9 @@ static void add_common_files(struct ieee80211_sub_if_data *sdata) · 162 unmodified lines
658663 DEBUGFS_ADD(rc_rateidx_vht_mcs_mask_5ghz);
659664 DEBUGFS_ADD(hw_queues);
660665
661− if (sdata->local->ops->wake_tx_queue)
666+ if (sdata->local->ops->wake_tx_queue &&
667+ sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE &&
668+ sdata->vif.type != NL80211_IFTYPE_NAN)
662669 DEBUGFS_ADD(aqm);
663670 }
664671
net/mac80211/util.c+8−5
@@ -247,7 +247,8 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac) · 246 unmodified lines
247247 struct sta_info *sta;
248248 int i;
249249
250− spin_lock_bh(&fq->lock);
250+ local_bh_disable();
251+ spin_lock(&fq->lock);
251252
252253 if (sdata->vif.type == NL80211_IFTYPE_AP)
253254 ps = &sdata->bss->ps;
@@ -273,9 +274,9 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac) · 19 unmodified lines
273274 &txqi->flags))
274275 continue;
275276
276− spin_unlock_bh(&fq->lock);
277+ spin_unlock(&fq->lock);
277278 drv_wake_tx_queue(local, txqi);
278− spin_lock_bh(&fq->lock);
279+ spin_lock(&fq->lock);
279280 }
280281 }
281282
@@ -288,12 +289,14 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac) · 6 unmodified lines
288289 (ps && atomic_read(&ps->num_sta_ps)) || ac != vif->txq->ac)
289290 goto out;
290291
291− spin_unlock_bh(&fq->lock);
292+ spin_unlock(&fq->lock);
292293
293294 drv_wake_tx_queue(local, txqi);
295+ local_bh_enable();
294296 return;
295297 out:
296− spin_unlock_bh(&fq->lock);
298+ spin_unlock(&fq->lock);
299+ local_bh_enable();
297300 }
298301
299302 static void
net/netfilter/ipvs/ip_vs_xmit.c+1−1
@@ -613,7 +613,7 @@ static inline int ip_vs_tunnel_xmit_prepare(struct sk_buff *skb, · 612 unmodified lines
613613 if (unlikely(cp->flags & IP_VS_CONN_F_NFCT))
614614 ret = ip_vs_confirm_conntrack(skb);
615615 if (ret == NF_ACCEPT) {
616− nf_reset(skb);
616+ nf_reset_ct(skb);
617617 skb_forward_csum(skb);
618618 }
619619 return ret;
net/netfilter/nft_connlimit.c+6−1
@@ -218,8 +218,13 @@ static void nft_connlimit_destroy_clone(const struct nft_ctx *ctx, · 217 unmodified lines
218218 static bool nft_connlimit_gc(struct net *net, const struct nft_expr *expr)
219219 {
220220 struct nft_connlimit *priv = nft_expr_priv(expr);
221+ bool ret;
221222
222− return nf_conncount_gc_list(net, &priv->list);
223+ local_bh_disable();
224+ ret = nf_conncount_gc_list(net, &priv->list);
225+ local_bh_enable();
226+
227+ return ret;
223228 }
224229
225230 static struct nft_expr_type nft_connlimit_type;
net/nfc/llcp_sock.c+6−1
@@ -107,9 +107,14 @@ static int llcp_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) · 106 unmodified lines
107107 llcp_sock->service_name = kmemdup(llcp_addr.service_name,
108108 llcp_sock->service_name_len,
109109 GFP_KERNEL);
110−
110+ if (!llcp_sock->service_name) {
111+ ret = -ENOMEM;
112+ goto put_dev;
113+ }
111114 llcp_sock->ssap = nfc_llcp_get_sdp_ssap(local, llcp_sock);
112115 if (llcp_sock->ssap == LLCP_SAP_MAX) {
116+ kfree(llcp_sock->service_name);
117+ llcp_sock->service_name = NULL;
113118 ret = -EADDRINUSE;
114119 goto put_dev;
115120 }
net/openvswitch/vport-internal_dev.c+1−1
@@ -237,7 +237,7 @@ static netdev_tx_t internal_dev_recv(struct sk_buff *skb) · 236 unmodified lines
237237 }
238238
239239 skb_dst_drop(skb);
240− nf_reset(skb);
240+ nf_reset_ct(skb);
241241 secpath_reset(skb);
242242
243243 skb->pkt_type = PACKET_HOST;
net/packet/af_packet.c+2−2
@@ -1821,7 +1821,7 @@ static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, · 1820 unmodified lines
18211821 skb_dst_drop(skb);
18221822
18231823 /* drop conntrack reference */
1824− nf_reset(skb);
1824+ nf_reset_ct(skb);
18251825
18261826 spkt = &PACKET_SKB_CB(skb)->sa.pkt;
18271827
@@ -2121,7 +2121,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, · 293 unmodified lines
21212121 skb_dst_drop(skb);
21222122
21232123 /* drop conntrack reference */
2124− nf_reset(skb);
2124+ nf_reset_ct(skb);
21252125
21262126 spin_lock(&sk->sk_receive_queue.lock);
21272127 po->stats.stats1.tp_packets++;
net/rds/ib.c+3−3
@@ -143,6 +143,9 @@ static void rds_ib_add_one(struct ib_device *device) · 142 unmodified lines
143143 refcount_set(&rds_ibdev->refcount, 1);
144144 INIT_WORK(&rds_ibdev->free_work, rds_ib_dev_free);
145145
146+ INIT_LIST_HEAD(&rds_ibdev->ipaddr_list);
147+ INIT_LIST_HEAD(&rds_ibdev->conn_list);
148+
146149 rds_ibdev->max_wrs = device->attrs.max_qp_wr;
147150 rds_ibdev->max_sge = min(device->attrs.max_send_sge, RDS_IB_MAX_SGE);
148151
@@ -203,9 +206,6 @@ static void rds_ib_add_one(struct ib_device *device) · 54 unmodified lines
203206 device->name,
204207 rds_ibdev->use_fastreg ? "FRMR" : "FMR");
205208
206− INIT_LIST_HEAD(&rds_ibdev->ipaddr_list);
207− INIT_LIST_HEAD(&rds_ibdev->conn_list);
208−
209209 down_write(&rds_ib_devices_lock);
210210 list_add_tail_rcu(&rds_ibdev->list, &rds_ib_devices);
211211 up_write(&rds_ib_devices_lock);
net/sched/sch_cbq.c+29−14
@@ -1127,6 +1127,33 @@ static const struct nla_policy cbq_policy[TCA_CBQ_MAX + 1] = { · 1126 unmodified lines
11271127 [TCA_CBQ_POLICE] = { .len = sizeof(struct tc_cbq_police) },
11281128 };
11291129
1130+static int cbq_opt_parse(struct nlattr *tb[TCA_CBQ_MAX + 1],
1131+ struct nlattr *opt,
1132+ struct netlink_ext_ack *extack)
1133+{
1134+ int err;
1135+
1136+ if (!opt) {
1137+ NL_SET_ERR_MSG(extack, "CBQ options are required for this operation");
1138+ return -EINVAL;
1139+ }
1140+
1141+ err = nla_parse_nested_deprecated(tb, TCA_CBQ_MAX, opt,
1142+ cbq_policy, extack);
1143+ if (err < 0)
1144+ return err;
1145+
1146+ if (tb[TCA_CBQ_WRROPT]) {
1147+ const struct tc_cbq_wrropt *wrr = nla_data(tb[TCA_CBQ_WRROPT]);
1148+
1149+ if (wrr->priority > TC_CBQ_MAXPRIO) {
1150+ NL_SET_ERR_MSG(extack, "priority is bigger than TC_CBQ_MAXPRIO");
1151+ err = -EINVAL;
1152+ }
1153+ }
1154+ return err;
1155+}
1156+
11301157 static int cbq_init(struct Qdisc *sch, struct nlattr *opt,
11311158 struct netlink_ext_ack *extack)
11321159 {
@@ -1139,13 +1166,7 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt, · 6 unmodified lines
11391166 hrtimer_init(&q->delay_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED);
11401167 q->delay_timer.function = cbq_undelay;
11411168
1142− if (!opt) {
1143− NL_SET_ERR_MSG(extack, "CBQ options are required for this operation");
1144− return -EINVAL;
1145− }
1146−
1147− err = nla_parse_nested_deprecated(tb, TCA_CBQ_MAX, opt, cbq_policy,
1148− extack);
1169+ err = cbq_opt_parse(tb, opt, extack);
11491170 if (err < 0)
11501171 return err;
11511172
@@ -1464,13 +1485,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t · 312 unmodified lines
14641485 struct cbq_class *parent;
14651486 struct qdisc_rate_table *rtab = NULL;
14661487
1467− if (!opt) {
1468− NL_SET_ERR_MSG(extack, "Mandatory qdisc options missing");
1469− return -EINVAL;
1470− }
1471−
1472− err = nla_parse_nested_deprecated(tb, TCA_CBQ_MAX, opt, cbq_policy,
1473− extack);
1488+ err = cbq_opt_parse(tb, opt, extack);
14741489 if (err < 0)
14751490 return err;
14761491
net/sched/sch_cbs.c+1−1
@@ -306,7 +306,7 @@ static void cbs_set_port_rate(struct net_device *dev, struct cbs_sched_data *q) · 305 unmodified lines
306306 if (err < 0)
307307 goto skip;
308308
309− if (ecmd.base.speed != SPEED_UNKNOWN)
309+ if (ecmd.base.speed && ecmd.base.speed != SPEED_UNKNOWN)
310310 speed = ecmd.base.speed;
311311
312312 skip:
net/sched/sch_dsmark.c+2−0
@@ -361,6 +361,8 @@ static int dsmark_init(struct Qdisc *sch, struct nlattr *opt, · 360 unmodified lines
361361 goto errout;
362362
363363 err = -EINVAL;
364+ if (!tb[TCA_DSMARK_INDICES])
365+ goto errout;
364366 indices = nla_get_u16(tb[TCA_DSMARK_INDICES]);
365367
366368 if (hweight32(indices) != 1)
net/sched/sch_taprio.c+2−3
@@ -1044,12 +1044,11 @@ static void taprio_set_picos_per_byte(struct net_device *dev, · 1043 unmodified lines
10441044 if (err < 0)
10451045 goto skip;
10461046
1047− if (ecmd.base.speed != SPEED_UNKNOWN)
1047+ if (ecmd.base.speed && ecmd.base.speed != SPEED_UNKNOWN)
10481048 speed = ecmd.base.speed;
10491049
10501050 skip:
1051− picos_per_byte = div64_s64(NSEC_PER_SEC * 1000LL * 8,
1052− speed * 1000 * 1000);
1051+ picos_per_byte = (USEC_PER_SEC * 8) / speed;
10531052
10541053 atomic64_set(&q->picos_per_byte, picos_per_byte);
10551054 netdev_dbg(dev, "taprio: set %s's picos_per_byte to: %lld, linkspeed: %d\n",
net/sctp/input.c+1−1
@@ -201,7 +201,7 @@ int sctp_rcv(struct sk_buff *skb) · 200 unmodified lines
201201
202202 if (!xfrm_policy_check(sk, XFRM_POLICY_IN, skb, family))
203203 goto discard_release;
204− nf_reset(skb);
204+ nf_reset_ct(skb);
205205
206206 if (sk_filter(sk, skb))
207207 goto discard_release;
net/tipc/link.c+18−11
@@ -160,6 +160,7 @@ struct tipc_link { · 159 unmodified lines
160160 struct {
161161 u16 len;
162162 u16 limit;
163+ struct sk_buff *target_bskb;
163164 } backlog[5];
164165 u16 snd_nxt;
165166 u16 window;
@@ -880,6 +881,7 @@ static void link_prepare_wakeup(struct tipc_link *l) · 714 unmodified lines
880881 void tipc_link_reset(struct tipc_link *l)
881882 {
882883 struct sk_buff_head list;
884+ u32 imp;
883885
884886 __skb_queue_head_init(&list);
885887
@@ -901,11 +903,10 @@ void tipc_link_reset(struct tipc_link *l) · 15 unmodified lines
901903 __skb_queue_purge(&l->deferdq);
902904 __skb_queue_purge(&l->backlogq);
903905 __skb_queue_purge(&l->failover_deferdq);
904− l->backlog[TIPC_LOW_IMPORTANCE].len = 0;
905− l->backlog[TIPC_MEDIUM_IMPORTANCE].len = 0;
906− l->backlog[TIPC_HIGH_IMPORTANCE].len = 0;
907− l->backlog[TIPC_CRITICAL_IMPORTANCE].len = 0;
908− l->backlog[TIPC_SYSTEM_IMPORTANCE].len = 0;
906+ for (imp = 0; imp <= TIPC_SYSTEM_IMPORTANCE; imp++) {
907+ l->backlog[imp].len = 0;
908+ l->backlog[imp].target_bskb = NULL;
909+ }
909910 kfree_skb(l->reasm_buf);
910911 kfree_skb(l->reasm_tnlmsg);
911912 kfree_skb(l->failover_reasm_skb);
@@ -947,7 +948,7 @@ int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list, · 35 unmodified lines
947948 u16 bc_ack = l->bc_rcvlink->rcv_nxt - 1;
948949 struct sk_buff_head *transmq = &l->transmq;
949950 struct sk_buff_head *backlogq = &l->backlogq;
950− struct sk_buff *skb, *_skb, *bskb;
951+ struct sk_buff *skb, *_skb, **tskb;
951952 int pkt_cnt = skb_queue_len(list);
952953 int rc = 0;
953954
@@ -999,19 +1000,21 @@ int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list, · 45 unmodified lines
9991000 seqno++;
10001001 continue;
10011002 }
1002− if (tipc_msg_bundle(skb_peek_tail(backlogq), hdr, mtu)) {
1003+ tskb = &l->backlog[imp].target_bskb;
1004+ if (tipc_msg_bundle(*tskb, hdr, mtu)) {
10031005 kfree_skb(__skb_dequeue(list));
10041006 l->stats.sent_bundled++;
10051007 continue;
10061008 }
1007− if (tipc_msg_make_bundle(&bskb, hdr, mtu, l->addr)) {
1009+ if (tipc_msg_make_bundle(tskb, hdr, mtu, l->addr)) {
10081010 kfree_skb(__skb_dequeue(list));
1009− __skb_queue_tail(backlogq, bskb);
1010− l->backlog[msg_importance(buf_msg(bskb))].len++;
1011+ __skb_queue_tail(backlogq, *tskb);
1012+ l->backlog[imp].len++;
10111013 l->stats.sent_bundled++;
10121014 l->stats.sent_bundles++;
10131015 continue;
10141016 }
1017+ l->backlog[imp].target_bskb = NULL;
10151018 l->backlog[imp].len += skb_queue_len(list);
10161019 skb_queue_splice_tail_init(list, backlogq);
10171020 }
@@ -1027,6 +1030,7 @@ static void tipc_link_advance_backlog(struct tipc_link *l, · 9 unmodified lines
10271030 u16 seqno = l->snd_nxt;
10281031 u16 ack = l->rcv_nxt - 1;
10291032 u16 bc_ack = l->bc_rcvlink->rcv_nxt - 1;
1033+ u32 imp;
10301034
10311035 while (skb_queue_len(&l->transmq) < l->window) {
10321036 skb = skb_peek(&l->backlogq);
@@ -1037,7 +1041,10 @@ static void tipc_link_advance_backlog(struct tipc_link *l, · 4 unmodified lines
10371041 break;
10381042 __skb_dequeue(&l->backlogq);
10391043 hdr = buf_msg(skb);
1040− l->backlog[msg_importance(hdr)].len--;
1044+ imp = msg_importance(hdr);
1045+ l->backlog[imp].len--;
1046+ if (unlikely(skb == l->backlog[imp].target_bskb))
1047+ l->backlog[imp].target_bskb = NULL;
10411048 __skb_queue_tail(&l->transmq, skb);
10421049 /* next retransmit attempt */
10431050 if (link_is_bc_sndlink(l))
net/tipc/msg.c+1−4
@@ -543,10 +543,7 @@ bool tipc_msg_make_bundle(struct sk_buff **skb, struct tipc_msg *msg, · 542 unmodified lines
543543 bmsg = buf_msg(_skb);
544544 tipc_msg_init(msg_prevnode(msg), bmsg, MSG_BUNDLER, 0,
545545 INT_H_SIZE, dnode);
546− if (msg_isdata(msg))
547− msg_set_importance(bmsg, TIPC_CRITICAL_IMPORTANCE);
548− else
549− msg_set_importance(bmsg, TIPC_SYSTEM_IMPORTANCE);
546+ msg_set_importance(bmsg, msg_importance(msg));
550547 msg_set_seqno(bmsg, msg_seqno(msg));
551548 msg_set_ack(bmsg, msg_ack(msg));
552549 msg_set_bcast_ack(bmsg, msg_bcast_ack(msg));
net/vmw_vsock/af_vsock.c+12−4
@@ -638,7 +638,7 @@ struct sock *__vsock_create(struct net *net, · 637 unmodified lines
638638 }
639639 EXPORT_SYMBOL_GPL(__vsock_create);
640640
641−static void __vsock_release(struct sock *sk)
641+static void __vsock_release(struct sock *sk, int level)
642642 {
643643 if (sk) {
644644 struct sk_buff *skb;
@@ -648,9 +648,17 @@ static void __vsock_release(struct sock *sk) · 3 unmodified lines
648648 vsk = vsock_sk(sk);
649649 pending = NULL; /* Compiler warning. */
650650
651+ /* The release call is supposed to use lock_sock_nested()
652+ * rather than lock_sock(), if a sock lock should be acquired.
653+ */
651654 transport->release(vsk);
652655
653− lock_sock(sk);
656+ /* When "level" is SINGLE_DEPTH_NESTING, use the nested
657+ * version to avoid the warning "possible recursive locking
658+ * detected". When "level" is 0, lock_sock_nested(sk, level)
659+ * is the same as lock_sock(sk).
660+ */
661+ lock_sock_nested(sk, level);
654662 sock_orphan(sk);
655663 sk->sk_shutdown = SHUTDOWN_MASK;
656664
@@ -659,7 +667,7 @@ static void __vsock_release(struct sock *sk) · 2 unmodified lines
659667
660668 /* Clean up any sockets that never were accepted. */
661669 while ((pending = vsock_dequeue_accept(sk)) != NULL) {
662− __vsock_release(pending);
670+ __vsock_release(pending, SINGLE_DEPTH_NESTING);
663671 sock_put(pending);
664672 }
665673
@@ -708,7 +716,7 @@ EXPORT_SYMBOL_GPL(vsock_stream_has_space); · 42 unmodified lines
708716
709717 static int vsock_release(struct socket *sock)
710718 {
711− __vsock_release(sock->sk);
719+ __vsock_release(sock->sk, 0);
712720 sock->sk = NULL;
713721 sock->state = SS_FREE;
714722
net/vmw_vsock/hyperv_transport.c+1−1
@@ -559,7 +559,7 @@ static void hvs_release(struct vsock_sock *vsk) · 558 unmodified lines
559559 struct sock *sk = sk_vsock(vsk);
560560 bool remove_sock;
561561
562− lock_sock(sk);
562+ lock_sock_nested(sk, SINGLE_DEPTH_NESTING);
563563 remove_sock = hvs_close_lock_held(vsk);
564564 release_sock(sk);
565565 if (remove_sock)
net/vmw_vsock/virtio_transport_common.c+1−1
@@ -820,7 +820,7 @@ void virtio_transport_release(struct vsock_sock *vsk) · 819 unmodified lines
820820 struct sock *sk = &vsk->sk;
821821 bool remove_sock = true;
822822
823− lock_sock(sk);
823+ lock_sock_nested(sk, SINGLE_DEPTH_NESTING);
824824 if (sk->sk_type == SOCK_STREAM)
825825 remove_sock = virtio_transport_close(vsk);
826826
net/wireless/nl80211.c+41−3
@@ -201,6 +201,38 @@ cfg80211_get_dev_from_info(struct net *netns, struct genl_info *info) · 200 unmodified lines
201201 return __cfg80211_rdev_from_attrs(netns, info->attrs);
202202 }
203203
204+static int validate_beacon_head(const struct nlattr *attr,
205+ struct netlink_ext_ack *extack)
206+{
207+ const u8 *data = nla_data(attr);
208+ unsigned int len = nla_len(attr);
209+ const struct element *elem;
210+ const struct ieee80211_mgmt *mgmt = (void *)data;
211+ unsigned int fixedlen = offsetof(struct ieee80211_mgmt,
212+ u.beacon.variable);
213+
214+ if (len < fixedlen)
215+ goto err;
216+
217+ if (ieee80211_hdrlen(mgmt->frame_control) !=
218+ offsetof(struct ieee80211_mgmt, u.beacon))
219+ goto err;
220+
221+ data += fixedlen;
222+ len -= fixedlen;
223+
224+ for_each_element(elem, data, len) {
225+ /* nothing */
226+ }
227+
228+ if (for_each_element_completed(elem, data, len))
229+ return 0;
230+
231+err:
232+ NL_SET_ERR_MSG_ATTR(extack, attr, "malformed beacon head");
233+ return -EINVAL;
234+}
235+
204236 static int validate_ie_attr(const struct nlattr *attr,
205237 struct netlink_ext_ack *extack)
206238 {
@@ -338,8 +370,9 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { · 131 unmodified lines
338370
339371 [NL80211_ATTR_BEACON_INTERVAL] = { .type = NLA_U32 },
340372 [NL80211_ATTR_DTIM_PERIOD] = { .type = NLA_U32 },
341− [NL80211_ATTR_BEACON_HEAD] = { .type = NLA_BINARY,
342− .len = IEEE80211_MAX_DATA_LEN },
373+ [NL80211_ATTR_BEACON_HEAD] =
374+ NLA_POLICY_VALIDATE_FN(NLA_BINARY, validate_beacon_head,
375+ IEEE80211_MAX_DATA_LEN),
343376 [NL80211_ATTR_BEACON_TAIL] =
344377 NLA_POLICY_VALIDATE_FN(NLA_BINARY, validate_ie_attr,
345378 IEEE80211_MAX_DATA_LEN),
@@ -2636,6 +2669,8 @@ int nl80211_parse_chandef(struct cfg80211_registered_device *rdev, · 2290 unmodified lines
26362669
26372670 control_freq = nla_get_u32(attrs[NL80211_ATTR_WIPHY_FREQ]);
26382671
2672+ memset(chandef, 0, sizeof(*chandef));
2673+
26392674 chandef->chan = ieee80211_get_channel(&rdev->wiphy, control_freq);
26402675 chandef->width = NL80211_CHAN_WIDTH_20_NOHT;
26412676 chandef->center_freq1 = control_freq;
@@ -3176,7 +3211,7 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag · 534 unmodified lines
31763211
31773212 if (rdev->ops->get_channel) {
31783213 int ret;
3179− struct cfg80211_chan_def chandef;
3214+ struct cfg80211_chan_def chandef = {};
31803215
31813216 ret = rdev_get_channel(rdev, wdev, &chandef);
31823217 if (ret == 0) {
@@ -6270,6 +6305,9 @@ static int nl80211_del_mpath(struct sk_buff *skb, struct genl_info *info) · 3087 unmodified lines
62706305 if (!rdev->ops->del_mpath)
62716306 return -EOPNOTSUPP;
62726307
6308+ if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT)
6309+ return -EOPNOTSUPP;
6310+
62736311 return rdev_del_mpath(rdev, dev, dst);
62746312 }
62756313
net/wireless/reg.c+1−1
@@ -2108,7 +2108,7 @@ static void reg_call_notifier(struct wiphy *wiphy, · 2107 unmodified lines
21082108
21092109 static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev)
21102110 {
2111− struct cfg80211_chan_def chandef;
2111+ struct cfg80211_chan_def chandef = {};
21122112 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
21132113 enum nl80211_iftype iftype;
21142114
net/wireless/scan.c+6−1
@@ -1723,7 +1723,12 @@ cfg80211_update_notlisted_nontrans(struct wiphy *wiphy, · 1722 unmodified lines
17231723 return;
17241724 new_ie_len -= trans_ssid[1];
17251725 mbssid = cfg80211_find_ie(WLAN_EID_MULTIPLE_BSSID, ie, ielen);
1726− if (!mbssid)
1726+ /*
1727+ * It's not valid to have the MBSSID element before SSID
1728+ * ignore if that happens - the code below assumes it is
1729+ * after (while copying things inbetween).
1730+ */
1731+ if (!mbssid || mbssid < trans_ssid)
17271732 return;
17281733 new_ie_len -= mbssid[1];
17291734 rcu_read_lock();
net/wireless/wext-compat.c+1−1
@@ -798,7 +798,7 @@ static int cfg80211_wext_giwfreq(struct net_device *dev, · 797 unmodified lines
798798 {
799799 struct wireless_dev *wdev = dev->ieee80211_ptr;
800800 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
801− struct cfg80211_chan_def chandef;
801+ struct cfg80211_chan_def chandef = {};
802802 int ret;
803803
804804 switch (wdev->iftype) {
net/xfrm/xfrm_input.c+1−1
@@ -706,7 +706,7 @@ resume: · 705 unmodified lines
706706 if (err)
707707 goto drop;
708708
709− nf_reset(skb);
709+ nf_reset_ct(skb);
710710
711711 if (decaps) {
712712 sp = skb_sec_path(skb);
net/xfrm/xfrm_interface.c+1−1
@@ -185,7 +185,7 @@ static void xfrmi_scrub_packet(struct sk_buff *skb, bool xnet) · 184 unmodified lines
185185 skb->skb_iif = 0;
186186 skb->ignore_df = 0;
187187 skb_dst_drop(skb);
188− nf_reset(skb);
188+ nf_reset_ct(skb);
189189 nf_reset_trace(skb);
190190
191191 if (!xnet)
net/xfrm/xfrm_output.c+1−1
@@ -502,7 +502,7 @@ int xfrm_output_resume(struct sk_buff *skb, int err) · 501 unmodified lines
502502 struct net *net = xs_net(skb_dst(skb)->xfrm);
503503
504504 while (likely((err = xfrm_output_one(skb, err)) == 0)) {
505− nf_reset(skb);
505+ nf_reset_ct(skb);
506506
507507 err = skb_dst(skb)->ops->local_out(net, skb->sk, skb);
508508 if (unlikely(err != 1))
net/xfrm/xfrm_policy.c+1−1
@@ -2808,7 +2808,7 @@ static void xfrm_policy_queue_process(struct timer_list *t) · 2807 unmodified lines
28082808 continue;
28092809 }
28102810
2811− nf_reset(skb);
2811+ nf_reset_ct(skb);
28122812 skb_dst_drop(skb);
28132813 skb_dst_set(skb, dst);
28142814
scripts/Kbuild.include+0−5
@@ -143,11 +143,6 @@ cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || e · 142 unmodified lines
143143 # Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
144144 ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
145145
146−# ar-option
147−# Usage: KBUILD_ARFLAGS := $(call ar-option,D)
148−# Important: no spaces around options
149−ar-option = $(call try-run, $(AR) rc$(1) "$$TMP",$(1),$(2))
150−
151146 # ld-version
152147 # Note this is mainly for HJ Lu's 3 number binutil versions
153148 ld-version = $(shell $(LD) --version | $(srctree)/scripts/ld-version.sh)
scripts/Makefile.build+1−1
@@ -389,7 +389,7 @@ $(sort $(subdir-obj-y)): $(subdir-ym) ; · 388 unmodified lines
389389 ifdef builtin-target
390390
391391 quiet_cmd_ar_builtin = AR $@
392− cmd_ar_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(real-prereqs)
392+ cmd_ar_builtin = rm -f $@; $(AR) cDPrST $@ $(real-prereqs)
393393
394394 $(builtin-target): $(real-obj-y) FORCE
395395 $(call if_changed,ar_builtin)
scripts/Makefile.lib+1−1
@@ -232,7 +232,7 @@ quiet_cmd_ld = LD $@ · 231 unmodified lines
232232 # ---------------------------------------------------------------------------
233233
234234 quiet_cmd_ar = AR $@
235− cmd_ar = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(real-prereqs)
235+ cmd_ar = rm -f $@; $(AR) cDPrsT $@ $(real-prereqs)
236236
237237 # Objcopy
238238 # ---------------------------------------------------------------------------
scripts/mod/modpost.c+9−4
@@ -2652,15 +2652,20 @@ int main(int argc, char **argv) · 2651 unmodified lines
26522652 fatal("modpost: Section mismatches detected.\n"
26532653 "Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n");
26542654 for (n = 0; n < SYMBOL_HASH_SIZE; n++) {
2655− struct symbol *s = symbolhash[n];
2655+ struct symbol *s;
2656+
2657+ for (s = symbolhash[n]; s; s = s->next) {
2658+ /*
2659+ * Do not check "vmlinux". This avoids the same warnings
2660+ * shown twice, and false-positives for ARCH=um.
2661+ */
2662+ if (is_vmlinux(s->module->name) && !s->module->is_dot_o)
2663+ continue;
26562664
2657− while (s) {
26582665 if (s->is_static)
26592666 warn("\"%s\" [%s] is a static %s\n",
26602667 s->name, s->module->name,
26612668 export_str(s->export));
2662−
2663− s = s->next;
26642669 }
26652670 }
26662671
scripts/namespace.pl+7−6
@@ -65,13 +65,14 @@ · 64 unmodified lines
6565 use warnings;
6666 use strict;
6767 use File::Find;
68+use File::Spec;
6869
6970 my $nm = ($ENV{'NM'} || "nm") . " -p";
7071 my $objdump = ($ENV{'OBJDUMP'} || "objdump") . " -s -j .comment";
71−my $srctree = "";
72−my $objtree = "";
73−$srctree = "$ENV{'srctree'}/" if (exists($ENV{'srctree'}));
74−$objtree = "$ENV{'objtree'}/" if (exists($ENV{'objtree'}));
72+my $srctree = File::Spec->curdir();
73+my $objtree = File::Spec->curdir();
74+$srctree = File::Spec->rel2abs($ENV{'srctree'}) if (exists($ENV{'srctree'}));
75+$objtree = File::Spec->rel2abs($ENV{'objtree'}) if (exists($ENV{'objtree'}));
7576
7677 if ($#ARGV != -1) {
7778 print STDERR "usage: $0 takes no parameters\n";
@@ -231,9 +232,9 @@ sub do_nm · 153 unmodified lines
231232 }
232233 ($source = $basename) =~ s/\.o$//;
233234 if (-e "$source.c" || -e "$source.S") {
234− $source = "$objtree$File::Find::dir/$source";
235+ $source = File::Spec->catfile($objtree, $File::Find::dir, $source)
235236 } else {
236− $source = "$srctree$File::Find::dir/$source";
237+ $source = File::Spec->catfile($srctree, $File::Find::dir, $source)
237238 }
238239 if (! -e "$source.c" && ! -e "$source.S") {
239240 # No obvious source, exclude the object if it is conglomerate
scripts/setlocalversion+1−1
@@ -126,7 +126,7 @@ scm_version() · 125 unmodified lines
126126
127127 collect_files()
128128 {
129− local file res
129+ local file res=
130130
131131 for file; do
132132 case "$file" in
security/integrity/Makefile+0−3
@@ -13,9 +13,6 @@ integrity-$(CONFIG_INTEGRITY_PLATFORM_KEYRING) += platform_certs/platform_keyrin · 12 unmodified lines
1313 integrity-$(CONFIG_LOAD_UEFI_KEYS) += platform_certs/efi_parser.o \
1414 platform_certs/load_uefi.o
1515 integrity-$(CONFIG_LOAD_IPL_KEYS) += platform_certs/load_ipl_s390.o
16−$(obj)/load_uefi.o: KBUILD_CFLAGS += -fshort-wchar
1716
18−subdir-$(CONFIG_IMA) += ima
1917 obj-$(CONFIG_IMA) += ima/
20−subdir-$(CONFIG_EVM) += evm
2118 obj-$(CONFIG_EVM) += evm/
tools/testing/selftests/kvm/Makefile+2−1
@@ -22,6 +22,7 @@ TEST_GEN_PROGS_x86_64 += x86_64/smm_test · 21 unmodified lines
2222 TEST_GEN_PROGS_x86_64 += x86_64/state_test
2323 TEST_GEN_PROGS_x86_64 += x86_64/sync_regs_test
2424 TEST_GEN_PROGS_x86_64 += x86_64/vmx_close_while_nested_test
25+TEST_GEN_PROGS_x86_64 += x86_64/vmx_dirty_log_test
2526 TEST_GEN_PROGS_x86_64 += x86_64/vmx_set_nested_state_test
2627 TEST_GEN_PROGS_x86_64 += x86_64/vmx_tsc_adjust_test
2728 TEST_GEN_PROGS_x86_64 += clear_dirty_log_test
@@ -48,7 +49,7 @@ CFLAGS += -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 \ · 20 unmodified lines
4849 -I$(LINUX_HDR_PATH) -Iinclude -I$(<D) -Iinclude/$(UNAME_M) -I..
4950
5051 no-pie-option := $(call try-run, echo 'int main() { return 0; }' | \
51− $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -no-pie -x c - -o "$$TMP", -no-pie)
52+ $(CC) -Werror -no-pie -x c - -o "$$TMP", -no-pie)
5253
5354 # On s390, build the testcases KVM-enabled
5455 pgste-option = $(call try-run, echo 'int main() { return 0; }' | \
tools/testing/selftests/kvm/include/x86_64/processor.h+3−0
@@ -1083,6 +1083,9 @@ void kvm_get_cpu_address_width(unsigned int *pa_bits, unsigned int *va_bits); · 1082 unmodified lines
10831083 #define VMX_BASIC_MEM_TYPE_WB 6LLU
10841084 #define VMX_BASIC_INOUT 0x0040000000000000LLU
10851085
1086+/* VMX_EPT_VPID_CAP bits */
1087+#define VMX_EPT_VPID_CAP_AD_BITS (1ULL << 21)
1088+
10861089 /* MSR_IA32_VMX_MISC bits */
10871090 #define MSR_IA32_VMX_MISC_VMWRITE_SHADOW_RO_FIELDS (1ULL << 29)
10881091 #define MSR_IA32_VMX_MISC_PREEMPTION_TIMER_SCALE 0x1F
tools/testing/selftests/kvm/include/x86_64/vmx.h+14−0
@@ -569,6 +569,10 @@ struct vmx_pages { · 568 unmodified lines
569569 void *enlightened_vmcs_hva;
570570 uint64_t enlightened_vmcs_gpa;
571571 void *enlightened_vmcs;
572+
573+ void *eptp_hva;
574+ uint64_t eptp_gpa;
575+ void *eptp;
572576 };
573577
574578 struct vmx_pages *vcpu_alloc_vmx(struct kvm_vm *vm, vm_vaddr_t *p_vmx_gva);
@@ -576,4 +580,14 @@ bool prepare_for_vmx_operation(struct vmx_pages *vmx); · 1 unmodified line
576580 void prepare_vmcs(struct vmx_pages *vmx, void *guest_rip, void *guest_rsp);
577581 bool load_vmcs(struct vmx_pages *vmx);
578582
583+void nested_pg_map(struct vmx_pages *vmx, struct kvm_vm *vm,
584+ uint64_t nested_paddr, uint64_t paddr, uint32_t eptp_memslot);
585+void nested_map(struct vmx_pages *vmx, struct kvm_vm *vm,
586+ uint64_t nested_paddr, uint64_t paddr, uint64_t size,
587+ uint32_t eptp_memslot);
588+void nested_map_memslot(struct vmx_pages *vmx, struct kvm_vm *vm,
589+ uint32_t memslot, uint32_t eptp_memslot);
590+void prepare_eptp(struct vmx_pages *vmx, struct kvm_vm *vm,
591+ uint32_t eptp_memslot);
592+
579593 #endif /* SELFTEST_KVM_VMX_H */
tools/testing/selftests/kvm/lib/kvm_util.c+1−1
@@ -705,7 +705,7 @@ void vm_userspace_mem_region_add(struct kvm_vm *vm, · 704 unmodified lines
705705 * on error (e.g. currently no memory region using memslot as a KVM
706706 * memory slot ID).
707707 */
708−static struct userspace_mem_region *
708+struct userspace_mem_region *
709709 memslot2region(struct kvm_vm *vm, uint32_t memslot)
710710 {
711711 struct userspace_mem_region *region;
tools/testing/selftests/kvm/lib/kvm_util_internal.h+3−0
@@ -68,4 +68,7 @@ void virt_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent); · 67 unmodified lines
6868 void regs_dump(FILE *stream, struct kvm_regs *regs, uint8_t indent);
6969 void sregs_dump(FILE *stream, struct kvm_sregs *sregs, uint8_t indent);
7070
71+struct userspace_mem_region *
72+memslot2region(struct kvm_vm *vm, uint32_t memslot);
73+
7174 #endif /* SELFTEST_KVM_UTIL_INTERNAL_H */
tools/testing/selftests/kvm/lib/x86_64/processor.c+1−1
@@ -1085,7 +1085,7 @@ struct kvm_x86_state *vcpu_save_state(struct kvm_vm *vm, uint32_t vcpuid) · 1084 unmodified lines
10851085 for (i = 0; i < nmsrs; i++)
10861086 state->msrs.entries[i].index = list->indices[i];
10871087 r = ioctl(vcpu->fd, KVM_GET_MSRS, &state->msrs);
1088− TEST_ASSERT(r == nmsrs, "Unexpected result from KVM_GET_MSRS, r: %i (failed at %x)",
1088+ TEST_ASSERT(r == nmsrs, "Unexpected result from KVM_GET_MSRS, r: %i (failed MSR was 0x%x)",
10891089 r, r == nmsrs ? -1 : list->indices[r]);
10901090
10911091 r = ioctl(vcpu->fd, KVM_GET_DEBUGREGS, &state->debugregs);
tools/testing/selftests/kvm/lib/x86_64/vmx.c+199−2
@@ -7,11 +7,39 @@ · 6 unmodified lines
77
88 #include "test_util.h"
99 #include "kvm_util.h"
10+#include "../kvm_util_internal.h"
1011 #include "processor.h"
1112 #include "vmx.h"
1213
14+#define PAGE_SHIFT_4K 12
15+
16+#define KVM_EPT_PAGE_TABLE_MIN_PADDR 0x1c0000
17+
1318 bool enable_evmcs;
1419
20+struct eptPageTableEntry {
21+ uint64_t readable:1;
22+ uint64_t writable:1;
23+ uint64_t executable:1;
24+ uint64_t memory_type:3;
25+ uint64_t ignore_pat:1;
26+ uint64_t page_size:1;
27+ uint64_t accessed:1;
28+ uint64_t dirty:1;
29+ uint64_t ignored_11_10:2;
30+ uint64_t address:40;
31+ uint64_t ignored_62_52:11;
32+ uint64_t suppress_ve:1;
33+};
34+
35+struct eptPageTablePointer {
36+ uint64_t memory_type:3;
37+ uint64_t page_walk_length:3;
38+ uint64_t ad_enabled:1;
39+ uint64_t reserved_11_07:5;
40+ uint64_t address:40;
41+ uint64_t reserved_63_52:12;
42+};
1543 int vcpu_enable_evmcs(struct kvm_vm *vm, int vcpu_id)
1644 {
1745 uint16_t evmcs_ver;
@@ -174,15 +202,35 @@ bool load_vmcs(struct vmx_pages *vmx) · 156 unmodified lines
174202 */
175203 static inline void init_vmcs_control_fields(struct vmx_pages *vmx)
176204 {
205+ uint32_t sec_exec_ctl = 0;
206+
177207 vmwrite(VIRTUAL_PROCESSOR_ID, 0);
178208 vmwrite(POSTED_INTR_NV, 0);
179209
180210 vmwrite(PIN_BASED_VM_EXEC_CONTROL, rdmsr(MSR_IA32_VMX_TRUE_PINBASED_CTLS));
181− if (!vmwrite(SECONDARY_VM_EXEC_CONTROL, 0))
211+
212+ if (vmx->eptp_gpa) {
213+ uint64_t ept_paddr;
214+ struct eptPageTablePointer eptp = {
215+ .memory_type = VMX_BASIC_MEM_TYPE_WB,
216+ .page_walk_length = 3, /* + 1 */
217+ .ad_enabled = !!(rdmsr(MSR_IA32_VMX_EPT_VPID_CAP) & VMX_EPT_VPID_CAP_AD_BITS),
218+ .address = vmx->eptp_gpa >> PAGE_SHIFT_4K,
219+ };
220+
221+ memcpy(&ept_paddr, &eptp, sizeof(ept_paddr));
222+ vmwrite(EPT_POINTER, ept_paddr);
223+ sec_exec_ctl |= SECONDARY_EXEC_ENABLE_EPT;
224+ }
225+
226+ if (!vmwrite(SECONDARY_VM_EXEC_CONTROL, sec_exec_ctl))
182227 vmwrite(CPU_BASED_VM_EXEC_CONTROL,
183228 rdmsr(MSR_IA32_VMX_TRUE_PROCBASED_CTLS) | CPU_BASED_ACTIVATE_SECONDARY_CONTROLS);
184− else
229+ else {
185230 vmwrite(CPU_BASED_VM_EXEC_CONTROL, rdmsr(MSR_IA32_VMX_TRUE_PROCBASED_CTLS));
231+ GUEST_ASSERT(!sec_exec_ctl);
232+ }
233+
186234 vmwrite(EXCEPTION_BITMAP, 0);
187235 vmwrite(PAGE_FAULT_ERROR_CODE_MASK, 0);
188236 vmwrite(PAGE_FAULT_ERROR_CODE_MATCH, -1); /* Never match */
@@ -327,3 +375,152 @@ void prepare_vmcs(struct vmx_pages *vmx, void *guest_rip, void *guest_rsp) · 138 unmodified lines
327375 init_vmcs_host_state();
328376 init_vmcs_guest_state(guest_rip, guest_rsp);
329377 }
378+
379+void nested_pg_map(struct vmx_pages *vmx, struct kvm_vm *vm,
380+ uint64_t nested_paddr, uint64_t paddr, uint32_t eptp_memslot)
381+{
382+ uint16_t index[4];
383+ struct eptPageTableEntry *pml4e;
384+
385+ TEST_ASSERT(vm->mode == VM_MODE_PXXV48_4K, "Attempt to use "
386+ "unknown or unsupported guest mode, mode: 0x%x", vm->mode);
387+
388+ TEST_ASSERT((nested_paddr % vm->page_size) == 0,
389+ "Nested physical address not on page boundary,\n"
390+ " nested_paddr: 0x%lx vm->page_size: 0x%x",
391+ nested_paddr, vm->page_size);
392+ TEST_ASSERT((nested_paddr >> vm->page_shift) <= vm->max_gfn,
393+ "Physical address beyond beyond maximum supported,\n"
394+ " nested_paddr: 0x%lx vm->max_gfn: 0x%lx vm->page_size: 0x%x",
395+ paddr, vm->max_gfn, vm->page_size);
396+ TEST_ASSERT((paddr % vm->page_size) == 0,
397+ "Physical address not on page boundary,\n"
398+ " paddr: 0x%lx vm->page_size: 0x%x",
399+ paddr, vm->page_size);
400+ TEST_ASSERT((paddr >> vm->page_shift) <= vm->max_gfn,
401+ "Physical address beyond beyond maximum supported,\n"
402+ " paddr: 0x%lx vm->max_gfn: 0x%lx vm->page_size: 0x%x",
403+ paddr, vm->max_gfn, vm->page_size);
404+
405+ index[0] = (nested_paddr >> 12) & 0x1ffu;
406+ index[1] = (nested_paddr >> 21) & 0x1ffu;
407+ index[2] = (nested_paddr >> 30) & 0x1ffu;
408+ index[3] = (nested_paddr >> 39) & 0x1ffu;
409+
410+ /* Allocate page directory pointer table if not present. */
411+ pml4e = vmx->eptp_hva;
412+ if (!pml4e[index[3]].readable) {
413+ pml4e[index[3]].address = vm_phy_page_alloc(vm,
414+ KVM_EPT_PAGE_TABLE_MIN_PADDR, eptp_memslot)
415+ >> vm->page_shift;
416+ pml4e[index[3]].writable = true;
417+ pml4e[index[3]].readable = true;
418+ pml4e[index[3]].executable = true;
419+ }
420+
421+ /* Allocate page directory table if not present. */
422+ struct eptPageTableEntry *pdpe;
423+ pdpe = addr_gpa2hva(vm, pml4e[index[3]].address * vm->page_size);
424+ if (!pdpe[index[2]].readable) {
425+ pdpe[index[2]].address = vm_phy_page_alloc(vm,
426+ KVM_EPT_PAGE_TABLE_MIN_PADDR, eptp_memslot)
427+ >> vm->page_shift;
428+ pdpe[index[2]].writable = true;
429+ pdpe[index[2]].readable = true;
430+ pdpe[index[2]].executable = true;
431+ }
432+
433+ /* Allocate page table if not present. */
434+ struct eptPageTableEntry *pde;
435+ pde = addr_gpa2hva(vm, pdpe[index[2]].address * vm->page_size);
436+ if (!pde[index[1]].readable) {
437+ pde[index[1]].address = vm_phy_page_alloc(vm,
438+ KVM_EPT_PAGE_TABLE_MIN_PADDR, eptp_memslot)
439+ >> vm->page_shift;
440+ pde[index[1]].writable = true;
441+ pde[index[1]].readable = true;
442+ pde[index[1]].executable = true;
443+ }
444+
445+ /* Fill in page table entry. */
446+ struct eptPageTableEntry *pte;
447+ pte = addr_gpa2hva(vm, pde[index[1]].address * vm->page_size);
448+ pte[index[0]].address = paddr >> vm->page_shift;
449+ pte[index[0]].writable = true;
450+ pte[index[0]].readable = true;
451+ pte[index[0]].executable = true;
452+
453+ /*
454+ * For now mark these as accessed and dirty because the only
455+ * testcase we have needs that. Can be reconsidered later.
456+ */
457+ pte[index[0]].accessed = true;
458+ pte[index[0]].dirty = true;
459+}
460+
461+/*
462+ * Map a range of EPT guest physical addresses to the VM's physical address
463+ *
464+ * Input Args:
465+ * vm - Virtual Machine
466+ * nested_paddr - Nested guest physical address to map
467+ * paddr - VM Physical Address
468+ * size - The size of the range to map
469+ * eptp_memslot - Memory region slot for new virtual translation tables
470+ *
471+ * Output Args: None
472+ *
473+ * Return: None
474+ *
475+ * Within the VM given by vm, creates a nested guest translation for the
476+ * page range starting at nested_paddr to the page range starting at paddr.
477+ */
478+void nested_map(struct vmx_pages *vmx, struct kvm_vm *vm,
479+ uint64_t nested_paddr, uint64_t paddr, uint64_t size,
480+ uint32_t eptp_memslot)
481+{
482+ size_t page_size = vm->page_size;
483+ size_t npages = size / page_size;
484+
485+ TEST_ASSERT(nested_paddr + size > nested_paddr, "Vaddr overflow");
486+ TEST_ASSERT(paddr + size > paddr, "Paddr overflow");
487+
488+ while (npages--) {
489+ nested_pg_map(vmx, vm, nested_paddr, paddr, eptp_memslot);
490+ nested_paddr += page_size;
491+ paddr += page_size;
492+ }
493+}
494+
495+/* Prepare an identity extended page table that maps all the
496+ * physical pages in VM.
497+ */
498+void nested_map_memslot(struct vmx_pages *vmx, struct kvm_vm *vm,
499+ uint32_t memslot, uint32_t eptp_memslot)
500+{
501+ sparsebit_idx_t i, last;
502+ struct userspace_mem_region *region =
503+ memslot2region(vm, memslot);
504+
505+ i = (region->region.guest_phys_addr >> vm->page_shift) - 1;
506+ last = i + (region->region.memory_size >> vm->page_shift);
507+ for (;;) {
508+ i = sparsebit_next_clear(region->unused_phy_pages, i);
509+ if (i > last)
510+ break;
511+
512+ nested_map(vmx, vm,
513+ (uint64_t)i << vm->page_shift,
514+ (uint64_t)i << vm->page_shift,
515+ 1 << vm->page_shift,
516+ eptp_memslot);
517+ }
518+}
519+
520+void prepare_eptp(struct vmx_pages *vmx, struct kvm_vm *vm,
521+ uint32_t eptp_memslot)
522+{
523+ vmx->eptp = (void *)vm_vaddr_alloc(vm, getpagesize(), 0x10000, 0, 0);
524+ vmx->eptp_hva = addr_gva2hva(vm, (uintptr_t)vmx->eptp);
525+ vmx->eptp_gpa = addr_gva2gpa(vm, (uintptr_t)vmx->eptp);
526+}
tools/testing/selftests/kvm/x86_64/vmx_dirty_log_test.c+156−0
@@ -0,0 +1,156 @@
1+// SPDX-License-Identifier: GPL-2.0
2+/*
3+ * KVM dirty page logging test
4+ *
5+ * Copyright (C) 2018, Red Hat, Inc.
6+ */
7+
8+#define _GNU_SOURCE /* for program_invocation_name */
9+
10+#include <stdio.h>
11+#include <stdlib.h>
12+#include <linux/bitmap.h>
13+#include <linux/bitops.h>
14+
15+#include "test_util.h"
16+#include "kvm_util.h"
17+#include "processor.h"
18+#include "vmx.h"
19+
20+#define VCPU_ID 1
21+
22+/* The memory slot index to track dirty pages */
23+#define TEST_MEM_SLOT_INDEX 1
24+#define TEST_MEM_SIZE 3
25+
26+/* L1 guest test virtual memory offset */
27+#define GUEST_TEST_MEM 0xc0000000
28+
29+/* L2 guest test virtual memory offset */
30+#define NESTED_TEST_MEM1 0xc0001000
31+#define NESTED_TEST_MEM2 0xc0002000
32+
33+static void l2_guest_code(void)
34+{
35+ *(volatile uint64_t *)NESTED_TEST_MEM1;
36+ *(volatile uint64_t *)NESTED_TEST_MEM1 = 1;
37+ GUEST_SYNC(true);
38+ GUEST_SYNC(false);
39+
40+ *(volatile uint64_t *)NESTED_TEST_MEM2 = 1;
41+ GUEST_SYNC(true);
42+ *(volatile uint64_t *)NESTED_TEST_MEM2 = 1;
43+ GUEST_SYNC(true);
44+ GUEST_SYNC(false);
45+
46+ /* Exit to L1 and never come back. */
47+ vmcall();
48+}
49+
50+void l1_guest_code(struct vmx_pages *vmx)
51+{
52+#define L2_GUEST_STACK_SIZE 64
53+ unsigned long l2_guest_stack[L2_GUEST_STACK_SIZE];
54+
55+ GUEST_ASSERT(vmx->vmcs_gpa);
56+ GUEST_ASSERT(prepare_for_vmx_operation(vmx));
57+ GUEST_ASSERT(load_vmcs(vmx));
58+
59+ prepare_vmcs(vmx, l2_guest_code,
60+ &l2_guest_stack[L2_GUEST_STACK_SIZE]);
61+
62+ GUEST_SYNC(false);
63+ GUEST_ASSERT(!vmlaunch());
64+ GUEST_SYNC(false);
65+ GUEST_ASSERT(vmreadz(VM_EXIT_REASON) == EXIT_REASON_VMCALL);
66+ GUEST_DONE();
67+}
68+
69+int main(int argc, char *argv[])
70+{
71+ vm_vaddr_t vmx_pages_gva = 0;
72+ struct vmx_pages *vmx;
73+ unsigned long *bmap;
74+ uint64_t *host_test_mem;
75+
76+ struct kvm_vm *vm;
77+ struct kvm_run *run;
78+ struct ucall uc;
79+ bool done = false;
80+
81+ /* Create VM */
82+ vm = vm_create_default(VCPU_ID, 0, l1_guest_code);
83+ vcpu_set_cpuid(vm, VCPU_ID, kvm_get_supported_cpuid());
84+ vmx = vcpu_alloc_vmx(vm, &vmx_pages_gva);
85+ vcpu_args_set(vm, VCPU_ID, 1, vmx_pages_gva);
86+ run = vcpu_state(vm, VCPU_ID);
87+
88+ /* Add an extra memory slot for testing dirty logging */
89+ vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS,
90+ GUEST_TEST_MEM,
91+ TEST_MEM_SLOT_INDEX,
92+ TEST_MEM_SIZE,
93+ KVM_MEM_LOG_DIRTY_PAGES);
94+
95+ /*
96+ * Add an identity map for GVA range [0xc0000000, 0xc0002000). This
97+ * affects both L1 and L2. However...
98+ */
99+ virt_map(vm, GUEST_TEST_MEM, GUEST_TEST_MEM,
100+ TEST_MEM_SIZE * 4096, 0);
101+
102+ /*
103+ * ... pages in the L2 GPA range [0xc0001000, 0xc0003000) will map to
104+ * 0xc0000000.
105+ *
106+ * Note that prepare_eptp should be called only L1's GPA map is done,
107+ * meaning after the last call to virt_map.
108+ */
109+ prepare_eptp(vmx, vm, 0);
110+ nested_map_memslot(vmx, vm, 0, 0);
111+ nested_map(vmx, vm, NESTED_TEST_MEM1, GUEST_TEST_MEM, 4096, 0);
112+ nested_map(vmx, vm, NESTED_TEST_MEM2, GUEST_TEST_MEM, 4096, 0);
113+
114+ bmap = bitmap_alloc(TEST_MEM_SIZE);
115+ host_test_mem = addr_gpa2hva(vm, GUEST_TEST_MEM);
116+
117+ while (!done) {
118+ memset(host_test_mem, 0xaa, TEST_MEM_SIZE * 4096);
119+ _vcpu_run(vm, VCPU_ID);
120+ TEST_ASSERT(run->exit_reason == KVM_EXIT_IO,
121+ "Unexpected exit reason: %u (%s),\n",
122+ run->exit_reason,
123+ exit_reason_str(run->exit_reason));
124+
125+ switch (get_ucall(vm, VCPU_ID, &uc)) {
126+ case UCALL_ABORT:
127+ TEST_ASSERT(false, "%s at %s:%d", (const char *)uc.args[0],
128+ __FILE__, uc.args[1]);
129+ /* NOT REACHED */
130+ case UCALL_SYNC:
131+ /*
132+ * The nested guest wrote at offset 0x1000 in the memslot, but the
133+ * dirty bitmap must be filled in according to L1 GPA, not L2.
134+ */
135+ kvm_vm_get_dirty_log(vm, TEST_MEM_SLOT_INDEX, bmap);
136+ if (uc.args[1]) {
137+ TEST_ASSERT(test_bit(0, bmap), "Page 0 incorrectly reported clean\n");
138+ TEST_ASSERT(host_test_mem[0] == 1, "Page 0 not written by guest\n");
139+ } else {
140+ TEST_ASSERT(!test_bit(0, bmap), "Page 0 incorrectly reported dirty\n");
141+ TEST_ASSERT(host_test_mem[0] == 0xaaaaaaaaaaaaaaaaULL, "Page 0 written by guest\n");
142+ }
143+
144+ TEST_ASSERT(!test_bit(1, bmap), "Page 1 incorrectly reported dirty\n");
145+ TEST_ASSERT(host_test_mem[4096 / 8] == 0xaaaaaaaaaaaaaaaaULL, "Page 1 written by guest\n");
146+ TEST_ASSERT(!test_bit(2, bmap), "Page 2 incorrectly reported dirty\n");
147+ TEST_ASSERT(host_test_mem[8192 / 8] == 0xaaaaaaaaaaaaaaaaULL, "Page 2 written by guest\n");
148+ break;
149+ case UCALL_DONE:
150+ done = true;
151+ break;
152+ default:
153+ TEST_ASSERT(false, "Unknown ucall 0x%x.", uc.cmd);
154+ }
155+ }
156+}
tools/testing/selftests/net/.gitignore+1−0
@@ -21,3 +21,4 @@ ipv6_flowlabel · 20 unmodified lines
2121 ipv6_flowlabel_mgr
2222 so_txtime
2323 tcp_fastopen_backup_key
24+nettest
tools/testing/selftests/net/udpgso.c+4−12
@@ -89,12 +89,9 @@ struct testcase testcases_v4[] = { · 88 unmodified lines
8989 .tfail = true,
9090 },
9191 {
92− /* send a single MSS: will fail with GSO, because the segment
93− * logic in udp4_ufo_fragment demands a gso skb to be > MTU
94− */
92+ /* send a single MSS: will fall back to no GSO */
9593 .tlen = CONST_MSS_V4,
9694 .gso_len = CONST_MSS_V4,
97− .tfail = true,
9895 .r_num_mss = 1,
9996 },
10097 {
@@ -139,10 +136,9 @@ struct testcase testcases_v4[] = { · 38 unmodified lines
139136 .tfail = true,
140137 },
141138 {
142− /* send a single 1B MSS: will fail, see single MSS above */
139+ /* send a single 1B MSS: will fall back to no GSO */
143140 .tlen = 1,
144141 .gso_len = 1,
145− .tfail = true,
146142 .r_num_mss = 1,
147143 },
148144 {
@@ -196,12 +192,9 @@ struct testcase testcases_v6[] = { · 47 unmodified lines
196192 .tfail = true,
197193 },
198194 {
199− /* send a single MSS: will fail with GSO, because the segment
200− * logic in udp4_ufo_fragment demands a gso skb to be > MTU
201− */
195+ /* send a single MSS: will fall back to no GSO */
202196 .tlen = CONST_MSS_V6,
203197 .gso_len = CONST_MSS_V6,
204− .tfail = true,
205198 .r_num_mss = 1,
206199 },
207200 {
@@ -246,10 +239,9 @@ struct testcase testcases_v6[] = { · 38 unmodified lines
246239 .tfail = true,
247240 },
248241 {
249− /* send a single 1B MSS: will fail, see single MSS above */
242+ /* send a single 1B MSS: will fall back to no GSO */
250243 .tlen = 1,
251244 .gso_len = 1,
252− .tfail = true,
253245 .r_num_mss = 1,
254246 },
255247 {
tools/testing/selftests/pidfd/Makefile+1−1
@@ -1,5 +1,5 @@
11 # SPDX-License-Identifier: GPL-2.0-only
2−CFLAGS += -g -I../../../../usr/include/ -lpthread
2+CFLAGS += -g -I../../../../usr/include/ -pthread
33
44 TEST_GEN_PROGS := pidfd_test pidfd_open_test pidfd_poll_test pidfd_wait
55
usr/include/Makefile+0−10
@@ -29,13 +29,11 @@ header-test- += linux/android/binderfs.h · 28 unmodified lines
2929 header-test-$(CONFIG_CPU_BIG_ENDIAN) += linux/byteorder/big_endian.h
3030 header-test-$(CONFIG_CPU_LITTLE_ENDIAN) += linux/byteorder/little_endian.h
3131 header-test- += linux/coda.h
32−header-test- += linux/coda_psdev.h
3332 header-test- += linux/elfcore.h
3433 header-test- += linux/errqueue.h
3534 header-test- += linux/fsmap.h
3635 header-test- += linux/hdlc/ioctl.h
3736 header-test- += linux/ivtv.h
38−header-test- += linux/jffs2.h
3937 header-test- += linux/kexec.h
4038 header-test- += linux/matroxfb.h
4139 header-test- += linux/netfilter_ipv4/ipt_LOG.h
@@ -55,20 +53,12 @@ header-test- += linux/v4l2-mediabus.h · 13 unmodified lines
5553 header-test- += linux/v4l2-subdev.h
5654 header-test- += linux/videodev2.h
5755 header-test- += linux/vm_sockets.h
58−header-test- += scsi/scsi_bsg_fc.h
59−header-test- += scsi/scsi_netlink.h
60−header-test- += scsi/scsi_netlink_fc.h
6156 header-test- += sound/asequencer.h
6257 header-test- += sound/asoc.h
6358 header-test- += sound/asound.h
6459 header-test- += sound/compress_offload.h
6560 header-test- += sound/emu10k1.h
6661 header-test- += sound/sfnt_info.h
67−header-test- += sound/sof/eq.h
68−header-test- += sound/sof/fw.h
69−header-test- += sound/sof/header.h
70−header-test- += sound/sof/manifest.h
71−header-test- += sound/sof/trace.h
7262 header-test- += xen/evtchn.h
7363 header-test- += xen/gntdev.h
7464 header-test- += xen/privcmd.h
virt/kvm/arm/vgic/trace.h+1−1
@@ -30,7 +30,7 @@ TRACE_EVENT(vgic_update_irq_pending, · 29 unmodified lines
3030 #endif /* _TRACE_VGIC_H */
3131
3232 #undef TRACE_INCLUDE_PATH
33−#define TRACE_INCLUDE_PATH ../../../virt/kvm/arm/vgic
33+#define TRACE_INCLUDE_PATH ../../virt/kvm/arm/vgic
3434 #undef TRACE_INCLUDE_FILE
3535 #define TRACE_INCLUDE_FILE trace
3636
virt/kvm/kvm_main.c+7−3
@@ -617,8 +617,9 @@ static int kvm_create_vm_debugfs(struct kvm *kvm, int fd) · 616 unmodified lines
617617
618618 stat_data->kvm = kvm;
619619 stat_data->offset = p->offset;
620+ stat_data->mode = p->mode ? p->mode : 0644;
620621 kvm->debugfs_stat_data[p - debugfs_entries] = stat_data;
621− debugfs_create_file(p->name, 0644, kvm->debugfs_dentry,
622+ debugfs_create_file(p->name, stat_data->mode, kvm->debugfs_dentry,
622623 stat_data, stat_fops_per_vm[p->kind]);
623624 }
624625 return 0;
@@ -3929,7 +3930,9 @@ static int kvm_debugfs_open(struct inode *inode, struct file *file, · 3304 unmodified lines
39293930 if (!refcount_inc_not_zero(&stat_data->kvm->users_count))
39303931 return -ENOENT;
39313932
3932− if (simple_attr_open(inode, file, get, set, fmt)) {
3933+ if (simple_attr_open(inode, file, get,
3934+ stat_data->mode & S_IWUGO ? set : NULL,
3935+ fmt)) {
39333936 kvm_put_kvm(stat_data->kvm);
39343937 return -ENOMEM;
39353938 }
@@ -4177,7 +4180,8 @@ static void kvm_init_debug(void) · 241 unmodified lines
41774180
41784181 kvm_debugfs_num_entries = 0;
41794182 for (p = debugfs_entries; p->name; ++p, kvm_debugfs_num_entries++) {
4180− debugfs_create_file(p->name, 0644, kvm_debugfs_dir,
4183+ int mode = p->mode ? p->mode : 0644;
4184+ debugfs_create_file(p->name, mode, kvm_debugfs_dir,
41814185 (void *)(long)p->offset,
41824186 stat_fops[p->kind]);
41834187 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t