History

Merge branch 'master' into mm-nonmm-stable

akpm committed 4 years ago

Commit ee56c3e2 parents 00c9d56 03c765b661 files · +8401 −5638Browse files

Unified · Split

661 files
  1. .mailmap +4 −0
  2. Documentation/ABI/testing/sysfs-bus-iio-vf610 +1 −1
  3. Documentation/ABI/testing/sysfs-devices-system-cpu +1 −0
  4. Documentation/admin-guide/hw-vuln/index.rst +1 −0
  5. Documentation/admin-guide/hw-vuln/processor_mmio_stale_data.rst +246 −0
  6. Documentation/admin-guide/kernel-parameters.txt +36 −1
  7. Documentation/devicetree/bindings/hwmon/ti,tmp401.yaml +2 −3
  8. Documentation/devicetree/bindings/interrupt-controller/socionext,uniphier-aidet.yaml +1 −0
  9. Documentation/devicetree/bindings/spi/microchip,mpfs-spi.yaml +0 −1
  10. Documentation/devicetree/bindings/spi/qcom,spi-geni-qcom.yaml +0 −1
  11. Documentation/devicetree/bindings/usb/generic-ehci.yaml +2 −1
  12. Documentation/devicetree/bindings/usb/generic-ohci.yaml +2 −1
  13. Documentation/driver-api/gpio/board.rst +1 −1
  14. Documentation/driver-api/gpio/consumer.rst +3 −3
  15. Documentation/driver-api/gpio/intro.rst +3 −3
  16. Documentation/filesystems/btrfs.rst +13 −3
  17. Documentation/filesystems/ext4/attributes.rst +34 −34
  18. Documentation/filesystems/ext4/bigalloc.rst +1 −1
  19. Documentation/filesystems/ext4/bitmaps.rst +3 −3
  20. Documentation/filesystems/ext4/blockgroup.rst +15 −15
  21. Documentation/filesystems/ext4/blockmap.rst +1 −1
  22. Documentation/filesystems/ext4/checksums.rst +13 −13
  23. Documentation/filesystems/ext4/directory.rst +83 −83
  24. Documentation/filesystems/ext4/eainode.rst +5 −5
  25. Documentation/filesystems/ext4/group_descr.rst +63 −63
  26. Documentation/filesystems/ext4/ifork.rst +30 −30
  27. Documentation/filesystems/ext4/inlinedata.rst +4 −4
  28. Documentation/filesystems/ext4/inodes.rst +153 −153
  29. Documentation/filesystems/ext4/journal.rst +107 −107
  30. Documentation/filesystems/ext4/mmp.rst +18 −18
  31. Documentation/filesystems/ext4/overview.rst +1 −1
  32. Documentation/filesystems/ext4/special_inodes.rst +4 −4
  33. Documentation/filesystems/ext4/super.rst +275 −275
  34. Documentation/kbuild/llvm.rst +8 −2
  35. Documentation/loongarch/introduction.rst +9 −6
  36. Documentation/loongarch/irq-chip-model.rst +13 −9
  37. Documentation/networking/ip-sysctl.rst +37 −0
  38. Documentation/networking/phy.rst +1 −1
  39. Documentation/translations/zh_CN/loongarch/introduction.rst +8 −6
  40. Documentation/translations/zh_CN/loongarch/irq-chip-model.rst +8 −6
  41. Documentation/vm/hwpoison.rst +2 −1
  42. MAINTAINERS +93 −40
  43. Makefile +2 −2
  44. arch/arm/boot/dts/Makefile +1 −1
  45. arch/arm/boot/dts/aspeed-bmc-qcom-dc-scm-v1.dts +2 −2
  46. arch/arm/boot/dts/at91-sama5d3_ksz9477_evb.dts +5 −0
  47. arch/arm/boot/dts/bcm2711-rpi-400.dts +3 −3
  48. arch/arm/boot/dts/imx6qdl-colibri.dtsi +1 −1
  49. arch/arm/boot/dts/imx6qdl.dtsi +1 −1
  50. arch/arm/boot/dts/imx7s.dtsi +1 −1
  51. arch/arm/boot/dts/stm32mp15-scmi.dtsi +47 −0
  52. arch/arm/boot/dts/stm32mp151.dtsi +0 −41
  53. arch/arm/boot/dts/stm32mp157a-dk1-scmi.dts +1 −12
  54. arch/arm/boot/dts/stm32mp157c-dk2-scmi.dts +1 −12
  55. arch/arm/boot/dts/stm32mp157c-ed1-scmi.dts +1 −12
  56. arch/arm/boot/dts/stm32mp157c-ev1-scmi.dts +1 −12
  57. arch/arm/mach-axxia/platsmp.c +1 −0
  58. arch/arm/mach-cns3xxx/core.c +2 −0
  59. arch/arm/mach-exynos/exynos.c +1 −0
  60. arch/arm/mach-spear/time.c +6 −2
  61. arch/arm64/boot/dts/exynos/exynos7885.dtsi +6 −6
  62. arch/arm64/boot/dts/freescale/s32g2.dtsi +1 −1
  63. arch/arm64/boot/dts/ti/k3-am64-main.dtsi +0 −2
  64. arch/arm64/boot/dts/ti/k3-j721s2-main.dtsi +1 −1
  65. arch/arm64/include/asm/kvm_host.h +0 −5
  66. arch/arm64/include/asm/virt.h +3 −0
  67. arch/arm64/kernel/cpufeature.c +1 −10
  68. arch/arm64/kernel/entry-ftrace.S +0 −1
  69. arch/arm64/kernel/ftrace.c +66 −71
  70. arch/arm64/kernel/setup.c +3 −4
  71. arch/arm64/kvm/arch_timer.c +3 −0
  72. arch/arm64/kvm/arm.c +11 −5
  73. arch/arm64/kvm/fpsimd.c +2 −0
  74. arch/arm64/kvm/hyp/nvhe/mem_protect.c +0 −4
  75. arch/arm64/kvm/hyp/nvhe/sys_regs.c +34 −8
  76. arch/arm64/kvm/vgic/vgic-mmio-v2.c +2 −2
  77. arch/arm64/kvm/vgic/vgic-mmio-v3.c +2 −38
  78. arch/arm64/kvm/vgic/vgic-mmio.c +36 −4
  79. arch/arm64/kvm/vgic/vgic-mmio.h +3 −0
  80. arch/arm64/kvm/vmid.c +1 −1
  81. arch/arm64/mm/cache.S +0 −2
  82. arch/loongarch/include/asm/branch.h +1 −2
  83. arch/loongarch/include/asm/pgtable.h +5 −5
  84. arch/loongarch/kernel/cpu-probe.c +1 −1
  85. arch/loongarch/kernel/head.S +0 −2
  86. arch/loongarch/kernel/traps.c +1 −2
  87. arch/loongarch/kernel/vmlinux.lds.S +2 −0
  88. arch/loongarch/mm/tlb.c +4 −3
  89. arch/mips/boot/dts/ingenic/x1000.dtsi +3 −2
  90. arch/mips/boot/dts/ingenic/x1830.dtsi +3 −2
  91. arch/mips/generic/board-ranchu.c +1 −0
  92. arch/mips/lantiq/falcon/sysctrl.c +6 −0
  93. arch/mips/lantiq/irq.c +1 −0
  94. arch/mips/lantiq/xway/sysctrl.c +4 −0
  95. arch/mips/mti-malta/malta-time.c +2 −0
  96. arch/mips/pic32/pic32mzda/init.c +6 −1
  97. arch/mips/pic32/pic32mzda/time.c +3 −0
  98. arch/mips/ralink/of.c +2 −0
  99. arch/mips/vr41xx/common/icu.c +0 −2
  100. arch/parisc/Kconfig +1 −0
  101. arch/parisc/include/asm/fb.h +1 −1
  102. arch/parisc/kernel/cache.c +4 −1
  103. arch/parisc/math-emu/decode_exc.c +1 −1
  104. arch/powerpc/kernel/process.c +1 −1
  105. arch/powerpc/kernel/prom_init.c +1 −1
  106. arch/powerpc/kernel/rtas.c +10 −1
  107. arch/powerpc/kernel/setup-common.c +7 −6
  108. arch/powerpc/platforms/microwatt/microwatt.h +7 −0
  109. arch/powerpc/platforms/microwatt/rng.c +3 −7
  110. arch/powerpc/platforms/microwatt/setup.c +8 −0
  111. arch/powerpc/platforms/powernv/powernv.h +2 −0
  112. arch/powerpc/platforms/powernv/rng.c +36 −16
  113. arch/powerpc/platforms/powernv/setup.c +2 −0
  114. arch/powerpc/platforms/pseries/pseries.h +2 −0
  115. arch/powerpc/platforms/pseries/rng.c +3 −8
  116. arch/powerpc/platforms/pseries/setup.c +1 −0
  117. arch/riscv/Kconfig +7 −2
  118. arch/riscv/Kconfig.erratas +1 −0
  119. arch/riscv/boot/dts/microchip/mpfs.dtsi +9 −0
  120. arch/riscv/include/asm/errata_list.h +7 −7
  121. arch/riscv/kernel/cpufeature.c +1 −4
  122. arch/riscv/kvm/vmid.c +1 −1
  123. arch/s390/kernel/crash_dump.c +9 −1
  124. arch/s390/kernel/perf_cpum_cf.c +21 −1
  125. arch/s390/kernel/perf_pai_crypto.c +15 −5
  126. arch/x86/coco/tdx/tdx.c +136 −51
  127. arch/x86/hyperv/hv_init.c +6 −0
  128. arch/x86/hyperv/ivm.c +78 −6
  129. arch/x86/include/asm/cpufeatures.h +1 −0
  130. arch/x86/include/asm/e820/api.h +0 −5
  131. arch/x86/include/asm/efi.h +1 −1
  132. arch/x86/include/asm/kvm_host.h +65 −2
  133. arch/x86/include/asm/mshyperv.h +4 −0
  134. arch/x86/include/asm/msr-index.h +25 −0
  135. arch/x86/include/asm/nospec-branch.h +2 −0
  136. arch/x86/include/asm/pci_x86.h +8 −0
  137. arch/x86/include/asm/setup.h +21 −17
  138. arch/x86/kernel/Makefile +0 −4
  139. arch/x86/kernel/cpu/bugs.c +199 −36
  140. arch/x86/kernel/cpu/common.c +49 −3
  141. arch/x86/kernel/ftrace_64.S +8 −3
  142. arch/x86/kernel/resource.c +9 −5
  143. arch/x86/kernel/setup.c +0 −5
  144. arch/x86/kernel/vmlinux.lds.S +2 −2
  145. arch/x86/kvm/lapic.c +23 −4
  146. arch/x86/kvm/mmu/mmu.c +1 −1
  147. arch/x86/kvm/svm/avic.c +76 −95
  148. arch/x86/kvm/svm/nested.c +21 −18
  149. arch/x86/kvm/svm/sev.c +47 −25
  150. arch/x86/kvm/svm/svm.c +6 −13
  151. arch/x86/kvm/svm/svm.h +3 −3
  152. arch/x86/kvm/vmx/vmx.c +75 −1
  153. arch/x86/kvm/vmx/vmx.h +2 −0
  154. arch/x86/kvm/x86.c +5 −0
  155. arch/x86/net/bpf_jit_comp.c +2 −1
  156. arch/x86/pci/acpi.c +1 −7
  157. arch/xtensa/kernel/entry.S +1 −1
  158. arch/xtensa/kernel/time.c +1 −0
  159. arch/xtensa/platforms/xtfpga/setup.c +1 −0
  160. block/bfq-iosched.c +6 −0
  161. block/blk-core.c +0 −13
  162. block/blk-ia-ranges.c +0 −1
  163. block/blk-mq-debugfs.c +18 −11
  164. block/blk-mq-debugfs.h +0 −10
  165. block/blk-mq-sched.c +12 −0
  166. block/blk-mq.c +18 −22
  167. block/blk-rq-qos.c +0 −2
  168. block/blk-rq-qos.h +6 −1
  169. block/blk-sysfs.c +14 −16
  170. block/genhd.c +12 −30
  171. block/holder.c +0 −4
  172. block/kyber-iosched.c +2 −1
  173. block/mq-deadline.c +3 −0
  174. certs/.gitignore +1 −1
  175. certs/Makefile +12 −12
  176. certs/blacklist.c +4 −4
  177. certs/blacklist_hashes.c +2 −2
  178. certs/common.h +0 −9
  179. certs/system_keyring.c +3 −3
  180. crypto/Kconfig +1 −0
  181. crypto/Makefile +1 −1
  182. crypto/asymmetric_keys/Kconfig +10 −0
  183. crypto/asymmetric_keys/Makefile +2 −0
  184. crypto/asymmetric_keys/selftest.c +224 −0
  185. crypto/asymmetric_keys/x509_loader.c +4 −4
  186. crypto/asymmetric_keys/x509_parser.h +9 −0
  187. crypto/asymmetric_keys/x509_public_key.c +7 −1
  188. drivers/base/cpu.c +8 −0
  189. drivers/base/init.c +2 −0
  190. drivers/base/memory.c +1 −1
  191. drivers/base/regmap/regmap-irq.c +5 −3
  192. drivers/base/regmap/regmap.c +8 −7
  193. drivers/block/xen-blkfront.c +12 −7
  194. drivers/bus/bt1-apb.c +6 −8
  195. drivers/bus/bt1-axi.c +6 −8
  196. drivers/bus/fsl-mc/fsl-mc-bus.c +3 −3
  197. drivers/char/lp.c +1 −1
  198. drivers/char/random.c +3 −3
  199. drivers/clocksource/hyperv_timer.c +0 −1
  200. drivers/comedi/drivers/vmk80xx.c +1 −1
  201. drivers/dma-buf/udmabuf.c +4 −1
  202. drivers/firewire/core-cdev.c +1 −1
  203. drivers/firewire/core-device.c +2 −4
  204. drivers/firmware/arm_scmi/base.c +15 −9
  205. drivers/firmware/arm_scmi/clock.c +3 −4
  206. drivers/firmware/arm_scmi/perf.c +3 −3
  207. drivers/firmware/arm_scmi/power.c +1 −1
  208. drivers/firmware/arm_scmi/protocols.h +0 −2
  209. drivers/firmware/arm_scmi/reset.c +1 −1
  210. drivers/firmware/arm_scmi/sensors.c +52 −16
  211. drivers/firmware/arm_scmi/voltage.c +5 −10
  212. drivers/firmware/efi/sysfb_efi.c +0 −2
  213. drivers/gpio/gpio-grgpio.c +1 −13
  214. drivers/gpio/gpio-mxs.c +1 −1
  215. drivers/gpio/gpio-realtek-otto.c +8 −2
  216. drivers/gpio/gpio-vr41xx.c +0 −2
  217. drivers/gpio/gpio-winbond.c +4 −3
  218. drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 −2
  219. drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +14 −6
  220. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 −4
  221. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c +1 −1
  222. drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1 −1
  223. drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +2 −22
  224. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dpp.c +3 −0
  225. drivers/gpu/drm/amd/display/dc/dcn201/dcn201_dpp.c +3 −0
  226. drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp.c +3 −0
  227. drivers/gpu/drm/drm_panel_orientation_quirks.c +6 −0
  228. drivers/gpu/drm/exynos/exynos_drm_drv.c +3 −3
  229. drivers/gpu/drm/exynos/exynos_drm_mic.c +12 −30
  230. drivers/gpu/drm/i915/display/intel_dp.c +29 −3
  231. drivers/gpu/drm/i915/display/intel_dpll_mgr.c +2 −2
  232. drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +2 −1
  233. drivers/gpu/drm/i915/gt/intel_gt.c +1 −0
  234. drivers/gpu/drm/i915/gt/intel_gt_sysfs.c +12 −17
  235. drivers/gpu/drm/i915/gt/intel_gt_sysfs.h +1 −5
  236. drivers/gpu/drm/i915/gt/intel_gt_types.h +3 −0
  237. drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +1 −1
  238. drivers/gpu/drm/i915/i915_drm_client.c +3 −2
  239. drivers/gpu/drm/i915/i915_sysfs.c +14 −3
  240. drivers/gpu/drm/i915/i915_vma.c +28 −20
  241. drivers/gpu/drm/msm/adreno/adreno_gpu.c +10 −4
  242. drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c +8 −1
  243. drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +2 −0
  244. drivers/gpu/drm/msm/dp/dp_ctrl.c +25 −8
  245. drivers/gpu/drm/msm/dp/dp_ctrl.h +1 −1
  246. drivers/gpu/drm/msm/dp/dp_display.c +8 −8
  247. drivers/gpu/drm/msm/msm_drv.c +1 −1
  248. drivers/gpu/drm/msm/msm_drv.h +1 −0
  249. drivers/gpu/drm/msm/msm_fence.c +5 −3
  250. drivers/gpu/drm/msm/msm_gem.c +3 −4
  251. drivers/gpu/drm/msm/msm_gem.h +6 −5
  252. drivers/gpu/drm/msm/msm_gem_prime.c +15 −0
  253. drivers/gpu/drm/msm/msm_gem_submit.c +12 −6
  254. drivers/gpu/drm/msm/msm_gem_vma.c +2 −4
  255. drivers/gpu/drm/msm/msm_gpu.c +5 −22
  256. drivers/gpu/drm/msm/msm_iommu.c +1 −1
  257. drivers/gpu/drm/msm/msm_ringbuffer.c +1 −1
  258. drivers/gpu/drm/sun4i/sun4i_drv.c +11 −1
  259. drivers/gpu/drm/sun4i/sun4i_layer.c +1 −1
  260. drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c +4 −50
  261. drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h +0 −2
  262. drivers/gpu/drm/ttm/ttm_bo.c +14 −8
  263. drivers/gpu/drm/ttm/ttm_device.c +5 −1
  264. drivers/gpu/drm/ttm/ttm_resource.c +36 −16
  265. drivers/gpu/drm/vc4/vc4_bo.c +54 −8
  266. drivers/gpu/drm/vc4/vc4_crtc.c +145 −51
  267. drivers/gpu/drm/vc4/vc4_drv.c +81 −16
  268. drivers/gpu/drm/vc4/vc4_drv.h +13 −6
  269. drivers/gpu/drm/vc4/vc4_gem.c +40 −0
  270. drivers/gpu/drm/vc4/vc4_hdmi.c +1 −1
  271. drivers/gpu/drm/vc4/vc4_hvs.c +9 −9
  272. drivers/gpu/drm/vc4/vc4_irq.c +16 −0
  273. drivers/gpu/drm/vc4/vc4_kms.c +16 −8
  274. drivers/gpu/drm/vc4/vc4_perfmon.c +46 −1
  275. drivers/gpu/drm/vc4/vc4_plane.c +21 −8
  276. drivers/gpu/drm/vc4/vc4_render_cl.c +4 −0
  277. drivers/gpu/drm/vc4/vc4_v3d.c +15 −0
  278. drivers/gpu/drm/vc4/vc4_validate.c +16 −0
  279. drivers/gpu/drm/vc4/vc4_validate_shaders.c +4 −0
  280. drivers/gpu/drm/xen/xen_drm_front_gem.c +1 −1
  281. drivers/hid/hid-hyperv.c +3 −2
  282. drivers/hv/channel_mgmt.c +13 −5
  283. drivers/hv/hv_kvp.c +1 −1
  284. drivers/hv/vmbus_drv.c +4 −0
  285. drivers/hwmon/asus-ec-sensors.c +1 −1
  286. drivers/hwmon/occ/common.c +5 −0
  287. drivers/i2c/busses/i2c-designware-common.c +0 −3
  288. drivers/i2c/busses/i2c-designware-platdrv.c +11 −2
  289. drivers/i2c/busses/i2c-mt65xx.c +7 −2
  290. drivers/i2c/busses/i2c-npcm7xx.c +1 −2
  291. drivers/iio/accel/bma180.c +2 −1
  292. drivers/iio/accel/kxcjk-1013.c +2 −2
  293. drivers/iio/accel/mma8452.c +14 −8
  294. drivers/iio/accel/mxc4005.c +2 −2
  295. drivers/iio/adc/adi-axi-adc.c +3 −0
  296. drivers/iio/adc/aspeed_adc.c +1 −0
  297. drivers/iio/adc/axp288_adc.c +8 −0
  298. drivers/iio/adc/rzg2l_adc.c +6 −2
  299. drivers/iio/adc/stm32-adc-core.c +7 −2
  300. drivers/iio/adc/stm32-adc.c +17 −20
  301. drivers/iio/adc/ti-ads131e08.c +7 −3
  302. drivers/iio/adc/xilinx-ams.c +1 −1
  303. drivers/iio/afe/iio-rescale.c +1 −1
  304. drivers/iio/chemical/ccs811.c +2 −2
  305. drivers/iio/frequency/admv1014.c +4 −2
  306. drivers/iio/gyro/mpu3050-core.c +1 −0
  307. drivers/iio/humidity/hts221_buffer.c +4 −1
  308. drivers/iio/imu/inv_icm42600/inv_icm42600.h +1 −0
  309. drivers/iio/imu/inv_icm42600/inv_icm42600_core.c +1 −1
  310. drivers/iio/magnetometer/yamaha-yas530.c +1 −1
  311. drivers/iio/proximity/sx9324.c +3 −0
  312. drivers/iio/test/Kconfig +1 −1
  313. drivers/iio/test/Makefile +1 −1
  314. drivers/iio/trigger/iio-trig-sysfs.c +1 −0
  315. drivers/iommu/ipmmu-vmsa.c +1 −1
  316. drivers/irqchip/Kconfig +1 −1
  317. drivers/irqchip/irq-apple-aic.c +2 −0
  318. drivers/irqchip/irq-gic-realview.c +1 −0
  319. drivers/irqchip/irq-gic-v3.c +5 −2
  320. drivers/irqchip/irq-loongson-liointc.c +7 −1
  321. drivers/irqchip/irq-realtek-rtl.c +1 −1
  322. drivers/irqchip/irq-uniphier-aidet.c +1 −0
  323. drivers/md/dm-core.h +1 −0
  324. drivers/md/dm-era-target.c +7 −1
  325. drivers/md/dm-log.c +2 −3
  326. drivers/md/dm-raid.c +1 −1
  327. drivers/md/dm.c +27 −12
  328. drivers/md/md.c +5 −9
  329. drivers/md/md.h +1 −1
  330. drivers/md/raid5-ppl.c +2 −2
  331. drivers/memory/Kconfig +1 −0
  332. drivers/memory/mtk-smi.c +4 −1
  333. drivers/memory/samsung/exynos5422-dmc.c +18 −11
  334. drivers/misc/atmel-ssc.c +2 −2
  335. drivers/misc/cardreader/rts5261.c +2 −0
  336. drivers/misc/eeprom/at25.c +53 −40
  337. drivers/misc/mei/hbm.c +2 −1
  338. drivers/misc/mei/hw-me-regs.h +2 −0
  339. drivers/misc/mei/hw-me.c +2 −0
  340. drivers/misc/mei/pci-me.c +2 −0
  341. drivers/mmc/host/mtk-sd.c +12 −8
  342. drivers/mmc/host/sdhci-pci-o2micro.c +2 −0
  343. drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +1 −1
  344. drivers/mtd/nand/raw/nand_ids.c +0 −3
  345. drivers/net/bonding/bond_main.c +3 −1
  346. drivers/net/dsa/qca8k.c +21 −1
  347. drivers/net/dsa/qca8k.h +1 −1
  348. drivers/net/ethernet/amd/xgbe/xgbe-platform.c +2 −2
  349. drivers/net/ethernet/broadcom/bgmac-bcma.c +0 −1
  350. drivers/net/ethernet/hisilicon/hns3/hnae3.h +1 −0
  351. drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +1 −1
  352. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +15 −3
  353. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +68 −33
  354. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h +1 −0
  355. drivers/net/ethernet/huawei/hinic/hinic_devlink.c +1 −3
  356. drivers/net/ethernet/intel/i40e/i40e_ethtool.c +17 −8
  357. drivers/net/ethernet/intel/i40e/i40e_main.c +5 −0
  358. drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +1 −1
  359. drivers/net/ethernet/intel/iavf/iavf_main.c +1 −1
  360. drivers/net/ethernet/intel/ice/ice_ethtool.c +48 −1
  361. drivers/net/ethernet/intel/ice/ice_lib.c +37 −5
  362. drivers/net/ethernet/intel/ice/ice_main.c +31 −18
  363. drivers/net/ethernet/intel/ice/ice_ptp.c +1 −1
  364. drivers/net/ethernet/intel/ice/ice_ptp.h +31 −0
  365. drivers/net/ethernet/intel/ice/ice_tc_lib.c +4 −1
  366. drivers/net/ethernet/intel/ice/ice_vf_lib.c +5 −0
  367. drivers/net/ethernet/intel/ice/ice_virtchnl.c +26 −27
  368. drivers/net/ethernet/intel/igb/igb_main.c +10 −9
  369. drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +2 −1
  370. drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.h +1 −1
  371. drivers/net/ethernet/xilinx/xilinx_axienet.h +51 −0
  372. drivers/net/ethernet/xilinx/xilinx_axienet_main.c +5 −24
  373. drivers/net/hamradio/6pack.c +8 −1
  374. drivers/net/phy/aquantia_main.c +14 −1
  375. drivers/net/phy/at803x.c +6 −0
  376. drivers/net/phy/smsc.c +4 −2
  377. drivers/net/usb/ax88179_178a.c +13 −13
  378. drivers/net/veth.c +4 −0
  379. drivers/net/virtio_net.c +6 −19
  380. drivers/nvme/host/core.c +17 −2
  381. drivers/nvme/host/nvme.h +28 −0
  382. drivers/nvme/host/pci.c +44 −5
  383. drivers/regulator/qcom_smd-regulator.c +4 −4
  384. drivers/scsi/ibmvscsi/ibmvfc.c +64 −18
  385. drivers/scsi/ibmvscsi/ibmvfc.h +1 −1
  386. drivers/scsi/scsi_debug.c +20 −2
  387. drivers/scsi/scsi_transport_iscsi.c +6 −1
  388. drivers/scsi/storvsc_drv.c +22 −5
  389. drivers/soc/bcm/brcmstb/pm/pm-arm.c +1 −0
  390. drivers/soc/imx/imx8m-blk-ctrl.c +1 −1
  391. drivers/spi/spi-cadence.c +31 −6
  392. drivers/spi/spi-mem.c +1 −1
  393. drivers/spi/spi-rockchip.c +7 −4
  394. drivers/staging/olpc_dcon/Kconfig +1 −1
  395. drivers/staging/r8188eu/core/rtw_xmit.c +5 −15
  396. drivers/staging/r8188eu/os_dep/ioctl_linux.c +1 −1
  397. drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +4 −2
  398. drivers/tty/goldfish.c +1 −1
  399. drivers/tty/n_gsm.c +1 −1
  400. drivers/tty/serial/8250/8250_port.c +2 −0
  401. drivers/tty/serial/qcom_geni_serial.c +1 −0
  402. drivers/tty/serial/serial_core.c +6 −3
  403. drivers/tty/sysrq.c +0 −2
  404. drivers/ufs/core/ufshcd.c +48 −28
  405. drivers/usb/cdns3/cdnsp-ring.c +11 −8
  406. drivers/usb/chipidea/udc.c +3 −0
  407. drivers/usb/dwc2/hcd.c +1 −1
  408. drivers/usb/dwc3/core.c +2 −7
  409. drivers/usb/dwc3/dwc3-pci.c +1 −0
  410. drivers/usb/dwc3/gadget.c +15 −11
  411. drivers/usb/gadget/function/f_fs.c +25 −15
  412. drivers/usb/gadget/function/u_ether.c +10 −2
  413. drivers/usb/gadget/function/uvc_video.c +3 −0
  414. drivers/usb/gadget/legacy/raw_gadget.c +47 −16
  415. drivers/usb/gadget/udc/lpc32xx_udc.c +1 −0
  416. drivers/usb/host/xhci-hub.c +1 −1
  417. drivers/usb/host/xhci-pci.c +5 −1
  418. drivers/usb/host/xhci.c +40 −25
  419. drivers/usb/host/xhci.h +2 −0
  420. drivers/usb/serial/io_ti.c +2 −0
  421. drivers/usb/serial/io_usbvend.h +1 −0
  422. drivers/usb/serial/option.c +12 −0
  423. drivers/usb/serial/pl2303.c +17 −12
  424. drivers/usb/typec/tcpm/Kconfig +0 −1
  425. drivers/video/console/sticore.c +2 −0
  426. drivers/video/fbdev/au1100fb.c +2 −4
  427. drivers/video/fbdev/cirrusfb.c +0 −6
  428. drivers/video/fbdev/intelfb/intelfbdrv.c +2 −2
  429. drivers/video/fbdev/intelfb/intelfbhw.c +5 −7
  430. drivers/video/fbdev/omap/sossi.c +1 −1
  431. drivers/video/fbdev/omap2/omapfb/dss/hdmi_phy.c +1 −1
  432. drivers/video/fbdev/pxa3xx-gcu.c +1 −1
  433. drivers/video/fbdev/simplefb.c +1 −2
  434. drivers/video/fbdev/skeletonfb.c +8 −7
  435. drivers/watchdog/gxp-wdt.c +1 −0
  436. drivers/xen/features.c +1 −1
  437. drivers/xen/gntdev-common.h +7 −0
  438. drivers/xen/gntdev.c +106 −51
  439. fs/9p/fid.c +9 −13
  440. fs/9p/vfs_addr.c +13 −0
  441. fs/9p/vfs_inode.c +4 −4
  442. fs/9p/vfs_inode_dotl.c +3 −0
  443. fs/afs/inode.c +2 −1
  444. fs/attr.c +20 −6
  445. fs/btrfs/block-group.h +1 −0
  446. fs/btrfs/ctree.h +2 −0
  447. fs/btrfs/disk-io.c +11 −2
  448. fs/btrfs/extent-tree.c +18 −2
  449. fs/btrfs/extent_io.c +2 −1
  450. fs/btrfs/file.c +75 −17
  451. fs/btrfs/inode.c +3 −0
  452. fs/btrfs/locking.c +0 −3
  453. fs/btrfs/reflink.c +12 −4
  454. fs/btrfs/super.c +40 −7
  455. fs/btrfs/zoned.c +27 −0
  456. fs/btrfs/zoned.h +5 −0
  457. fs/cifs/cifs_debug.c +7 −5
  458. fs/cifs/cifsglob.h +57 −1
  459. fs/cifs/cifsproto.h +7 −0
  460. fs/cifs/connect.c +54 −5
  461. fs/cifs/misc.c +8 −1
  462. fs/cifs/sess.c +131 −38
  463. fs/cifs/smb2ops.c +90 −83
  464. fs/cifs/smb2pdu.c +17 −6
  465. fs/cifs/trace.h +38 −0
  466. fs/exfat/namei.c +3 −1
  467. fs/ext2/dir.c +3 −6
  468. fs/ext4/inode.c +1 −1
  469. fs/ext4/mballoc.c +25 −1
  470. fs/ext4/migrate.c +1 −1
  471. fs/ext4/namei.c +2 −1
  472. fs/ext4/page-io.c +1 −1
  473. fs/ext4/resize.c +10 −0
  474. fs/ext4/super.c +95 −77
  475. fs/ext4/xattr.c +1 −2
  476. fs/f2fs/iostat.c +18 −13
  477. fs/f2fs/namei.c +11 −6
  478. fs/f2fs/node.c +3 −1
  479. fs/hugetlbfs/inode.c +53 −15
  480. fs/io_uring.c +157 −216
  481. fs/jbd2/transaction.c +1 −1
  482. fs/nfs/callback_proc.c +1 −0
  483. fs/nfs/dir.c +1 −0
  484. fs/nfs/nfs4file.c +1 −0
  485. fs/nfs/pnfs.c +15 −6
  486. fs/nfs/pnfs.h +1 −0
  487. fs/tracefs/inode.c +1 −1
  488. fs/xfs/libxfs/xfs_attr.c +5 −4
  489. fs/xfs/libxfs/xfs_attr.h +1 −11
  490. fs/xfs/libxfs/xfs_attr_leaf.c +1 −1
  491. fs/xfs/libxfs/xfs_da_btree.h +3 −1
  492. fs/xfs/xfs_attr_item.c +9 −6
  493. fs/xfs/xfs_ioctl.c +2 −1
  494. fs/xfs/xfs_xattr.c +16 −1
  495. include/drm/drm_atomic.h +1 −0
  496. include/drm/ttm/ttm_resource.h +4 −4
  497. include/keys/asymmetric-type.h +3 −0
  498. include/linux/backing-dev.h +2 −0
  499. include/linux/blkdev.h +6 −7
  500. include/linux/console.h +0 −17
  501. include/linux/cpu.h +3 −0
  502. include/linux/gpio/driver.h +16 −13
  503. include/linux/mm.h +2 −1
  504. include/linux/netfs.h +1 −1
  505. include/linux/nvme.h +2 −2
  506. include/linux/objtool.h +6 −0
  507. include/linux/printk.h +0 −11
  508. include/linux/ratelimit_types.h +8 −4
  509. include/linux/scmi_protocol.h +5 −4
  510. include/linux/serial_core.h +1 −0
  511. include/linux/visorbus.h +0 −344
  512. include/linux/vmalloc.h +1 −0
  513. include/net/inet_connection_sock.h +0 −3
  514. include/net/inet_hashtables.h +1 −67
  515. include/net/inet_sock.h +5 −0
  516. include/net/sock.h +0 −14
  517. include/trace/events/io_uring.h +35 −7
  518. include/trace/events/libata.h +1 −0
  519. include/uapi/linux/io_uring.h +0 −6
  520. kernel/auditsc.c +1 −1
  521. kernel/bpf/btf.c +5 −0
  522. kernel/cfi.c +16 −6
  523. kernel/dma/direct.c +2 −3
  524. kernel/hung_task.c +1 −10
  525. kernel/irq/chip.c +4 −1
  526. kernel/kthread.c +7 −7
  527. kernel/locking/lockdep.c +1 −1
  528. kernel/panic.c +0 −4
  529. kernel/power/hibernate.c +1 −1
  530. kernel/printk/printk.c +63 −524
  531. kernel/rcu/tree_stall.h +0 −2
  532. kernel/reboot.c +1 −13
  533. kernel/sched/core.c +33 −3
  534. kernel/sched/sched.h +5 −0
  535. kernel/trace/blktrace.c +0 −3
  536. kernel/trace/bpf_trace.c +45 −15
  537. kernel/trace/ftrace.c +11 −2
  538. kernel/trace/rethook.c +9 −0
  539. kernel/trace/trace.c +0 −2
  540. kernel/trace/trace_kprobe.c +10 −1
  541. kernel/trace/trace_uprobe.c +0 −1
  542. kernel/watchdog.c +0 −4
  543. kernel/watchdog_hld.c +0 −4
  544. lib/Kconfig +3 −0
  545. lib/Kconfig.ubsan +1 −1
  546. lib/Makefile +1 −0
  547. lib/crypto/Kconfig +1 −0
  548. lib/memneq.c +0 −0
  549. mm/backing-dev.c +2 −9
  550. mm/damon/reclaim.c +8 −0
  551. mm/filemap.c +12 −3
  552. mm/huge_memory.c +1 −0
  553. mm/hwpoison-inject.c +1 −1
  554. mm/kfence/core.c +5 −2
  555. mm/madvise.c +1 −1
  556. mm/memcontrol.c +1 −1
  557. mm/memory-failure.c +12 −0
  558. mm/migrate.c +1 −0
  559. mm/page_isolation.c +2 −0
  560. mm/readahead.c +2 −0
  561. mm/slub.c +36 −7
  562. mm/swap.c +1 −1
  563. mm/usercopy.c +12 −14
  564. mm/vmalloc.c +1 −1
  565. net/ax25/af_ax25.c +28 −5
  566. net/core/dev.c +15 −10
  567. net/core/filter.c +28 −6
  568. net/core/net-sysfs.c +1 −0
  569. net/core/skmsg.c +5 −0
  570. net/dccp/proto.c +5 −28
  571. net/ethtool/eeprom.c +1 −1
  572. net/ipv4/inet_connection_sock.c +64 −183
  573. net/ipv4/inet_hashtables.c +11 −182
  574. net/ipv4/ip_gre.c +10 −5
  575. net/ipv4/ping.c +7 −3
  576. net/ipv4/tcp.c +2 −12
  577. net/ipv4/tcp_bpf.c +0 −3
  578. net/ipv6/ip6_gre.c +10 −5
  579. net/netfilter/nf_dup_netdev.c +21 −4
  580. net/netfilter/nfnetlink_cttimeout.c +1 −1
  581. net/netfilter/nft_meta.c +2 −11
  582. net/netfilter/nft_numgen.c +3 −9
  583. net/openvswitch/flow.c +1 −1
  584. net/sched/sch_netem.c +2 −2
  585. net/sunrpc/clnt.c +1 −0
  586. net/tipc/core.c +1 −2
  587. net/tls/tls_main.c +2 −0
  588. net/xdp/xsk.c +9 −7
  589. samples/fprobe/fprobe_example.c +25 −4
  590. scripts/faddr2line +34 −11
  591. scripts/gen_autoksyms.sh +3 −0
  592. scripts/mod/modpost.c +1 −1
  593. security/selinux/hooks.c +4 −7
  594. sound/core/memalloc.c +1 −22
  595. sound/hda/hdac_i915.c +6 −9
  596. sound/hda/intel-dsp-config.c +12 −0
  597. sound/hda/intel-nhlt.c +8 −9
  598. sound/pci/hda/hda_auto_parser.c +4 −3
  599. sound/pci/hda/hda_local.h +1 −0
  600. sound/pci/hda/patch_conexant.c +2 −2
  601. sound/pci/hda/patch_realtek.c +35 −1
  602. sound/pci/hda/patch_via.c +2 −2
  603. sound/usb/mixer_us16x08.c +3 −3
  604. sound/x86/intel_hdmi_audio.c +13 −2
  605. tools/arch/arm64/include/asm/cputype.h +10 −2
  606. tools/arch/x86/include/asm/cpufeatures.h +6 −2
  607. tools/arch/x86/include/asm/disabled-features.h +7 −1
  608. tools/arch/x86/include/asm/msr-index.h +25 −0
  609. tools/arch/x86/include/uapi/asm/kvm.h +6 −5
  610. tools/arch/x86/include/uapi/asm/svm.h +13 −0
  611. tools/include/linux/objtool.h +6 −0
  612. tools/include/uapi/drm/i915_drm.h +272 −81
  613. tools/include/uapi/linux/prctl.h +9 −0
  614. tools/include/uapi/linux/vhost.h +20 −6
  615. tools/kvm/kvm_stat/kvm_stat +2 −1
  616. tools/lib/perf/evsel.c +12 −5
  617. tools/perf/builtin-inject.c +4 −2
  618. tools/perf/builtin-stat.c +2 −0
  619. tools/perf/tests/bp_account.c +14 −2
  620. tools/perf/tests/expr.c +2 −0
  621. tools/perf/tests/shell/lib/perf_csv_output_lint.py +0 −48
  622. tools/perf/tests/shell/stat+csv_output.sh +45 −24
  623. tools/perf/tests/shell/test_arm_callgraph_fp.sh +1 −1
  624. tools/perf/tests/topology.c +1 −1
  625. tools/perf/trace/beauty/arch_errno_names.sh +2 −12
  626. tools/perf/trace/beauty/include/linux/socket.h +6 −1
  627. tools/perf/util/arm-spe.c +8 −14
  628. tools/perf/util/build-id.c +28 −0
  629. tools/perf/util/expr.l +1 −1
  630. tools/perf/util/header.c +14 −0
  631. tools/perf/util/header.h +2 −0
  632. tools/perf/util/metricgroup.c +9 −0
  633. tools/perf/util/unwind-libunwind-local.c +1 −1
  634. tools/testing/selftests/bpf/prog_tests/bpf_cookie.c +39 −39
  635. tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c +3 −0
  636. tools/testing/selftests/bpf/prog_tests/tailcalls.c +55 −0
  637. tools/testing/selftests/bpf/progs/kprobe_multi.c +12 −12
  638. tools/testing/selftests/bpf/progs/tailcall_bpf2bpf6.c +42 −0
  639. tools/testing/selftests/dma/Makefile +1 −0
  640. tools/testing/selftests/dma/dma_map_benchmark.c +1 −1
  641. tools/testing/selftests/kvm/Makefile +36 −13
  642. tools/testing/selftests/kvm/dirty_log_perf_test.c +7 −3
  643. tools/testing/selftests/kvm/include/perf_test_util.h +9 −0
  644. tools/testing/selftests/kvm/include/x86_64/processor.h +16 −9
  645. tools/testing/selftests/kvm/include/x86_64/vmx.h +6 −0
  646. tools/testing/selftests/kvm/lib/aarch64/ucall.c +4 −5
  647. tools/testing/selftests/kvm/lib/perf_test_util.c +45 −8
  648. tools/testing/selftests/kvm/lib/x86_64/perf_test_util.c +112 −0
  649. tools/testing/selftests/kvm/lib/x86_64/processor.c +15 −16
  650. tools/testing/selftests/kvm/lib/x86_64/vmx.c +93 −56
  651. tools/testing/selftests/kvm/max_guest_memory_test.c +1 −1
  652. tools/testing/selftests/kvm/x86_64/mmu_role_test.c +1 −1
  653. tools/testing/selftests/lib.mk +23 −2
  654. tools/testing/selftests/net/.gitignore +0 −1
  655. tools/testing/selftests/net/Makefile +0 −2
  656. tools/testing/selftests/net/bind_bhash_test.c +0 −119
  657. tools/testing/selftests/net/fcnal-test.sh +56 −5
  658. tools/testing/selftests/netfilter/nft_concat_range.sh +1 −1
  659. tools/testing/selftests/vm/gup_test.c +2 −2
  660. tools/testing/selftests/vm/ksm_tests.c +2 −0
  661. virt/kvm/kvm_main.c +6 −2
.mailmap+4−0
@@ -10,6 +10,8 @@ · 9 unmodified lines
1010 # Please keep this list dictionary sorted.
1111 #
1212 Aaron Durbin <adurbin@google.com>
13+Abel Vesa <abelvesa@kernel.org> <abel.vesa@nxp.com>
14+Abel Vesa <abelvesa@kernel.org> <abelvesa@gmail.com>
1315 Abhinav Kumar <quic_abhinavk@quicinc.com> <abhinavk@codeaurora.org>
1416 Adam Oldham <oldhamca@gmail.com>
1517 Adam Radford <aradford@gmail.com>
@@ -85,6 +87,7 @@ Christian Borntraeger <borntraeger@linux.ibm.com> <borntrae@de.ibm.com> · 69 unmodified lines
8587 Christian Brauner <brauner@kernel.org> <christian@brauner.io>
8688 Christian Brauner <brauner@kernel.org> <christian.brauner@canonical.com>
8789 Christian Brauner <brauner@kernel.org> <christian.brauner@ubuntu.com>
90+Christian Marangi <ansuelsmth@gmail.com>
8891 Christophe Ricard <christophe.ricard@gmail.com>
8992 Christoph Hellwig <hch@lst.de>
9093 Colin Ian King <colin.king@intel.com> <colin.king@canonical.com>
@@ -165,6 +168,7 @@ Jan Glauber <jan.glauber@gmail.com> <jang@de.ibm.com> · 74 unmodified lines
165168 Jan Glauber <jan.glauber@gmail.com> <jang@linux.vnet.ibm.com>
166169 Jan Glauber <jan.glauber@gmail.com> <jglauber@cavium.com>
167170 Jarkko Sakkinen <jarkko@kernel.org> <jarkko.sakkinen@linux.intel.com>
171+Jarkko Sakkinen <jarkko@kernel.org> <jarkko@profian.com>
168172 Jason Gunthorpe <jgg@ziepe.ca> <jgg@mellanox.com>
169173 Jason Gunthorpe <jgg@ziepe.ca> <jgg@nvidia.com>
170174 Jason Gunthorpe <jgg@ziepe.ca> <jgunthorpe@obsidianresearch.com>
Documentation/ABI/testing/sysfs-bus-iio-vf610+1−1
@@ -1,4 +1,4 @@
1−What: /sys/bus/iio/devices/iio:deviceX/conversion_mode
1+What: /sys/bus/iio/devices/iio:deviceX/in_conversion_mode
22 KernelVersion: 4.2
33 Contact: linux-iio@vger.kernel.org
44 Description:
Documentation/ABI/testing/sysfs-devices-system-cpu+1−0
@@ -526,6 +526,7 @@ What: /sys/devices/system/cpu/vulnerabilities · 525 unmodified lines
526526 /sys/devices/system/cpu/vulnerabilities/srbds
527527 /sys/devices/system/cpu/vulnerabilities/tsx_async_abort
528528 /sys/devices/system/cpu/vulnerabilities/itlb_multihit
529+ /sys/devices/system/cpu/vulnerabilities/mmio_stale_data
529530 Date: January 2018
530531 Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>
531532 Description: Information about CPU vulnerabilities
Documentation/admin-guide/hw-vuln/index.rst+1−0
@@ -17,3 +17,4 @@ are configurable at compile, boot or run time. · 16 unmodified lines
1717 special-register-buffer-data-sampling.rst
1818 core-scheduling.rst
1919 l1d_flush.rst
20+ processor_mmio_stale_data.rst
Documentation/admin-guide/hw-vuln/processor_mmio_stale_data.rst+246−0
@@ -0,0 +1,246 @@
1+=========================================
2+Processor MMIO Stale Data Vulnerabilities
3+=========================================
4+
5+Processor MMIO Stale Data Vulnerabilities are a class of memory-mapped I/O
6+(MMIO) vulnerabilities that can expose data. The sequences of operations for
7+exposing data range from simple to very complex. Because most of the
8+vulnerabilities require the attacker to have access to MMIO, many environments
9+are not affected. System environments using virtualization where MMIO access is
10+provided to untrusted guests may need mitigation. These vulnerabilities are
11+not transient execution attacks. However, these vulnerabilities may propagate
12+stale data into core fill buffers where the data can subsequently be inferred
13+by an unmitigated transient execution attack. Mitigation for these
14+vulnerabilities includes a combination of microcode update and software
15+changes, depending on the platform and usage model. Some of these mitigations
16+are similar to those used to mitigate Microarchitectural Data Sampling (MDS) or
17+those used to mitigate Special Register Buffer Data Sampling (SRBDS).
18+
19+Data Propagators
20+================
21+Propagators are operations that result in stale data being copied or moved from
22+one microarchitectural buffer or register to another. Processor MMIO Stale Data
23+Vulnerabilities are operations that may result in stale data being directly
24+read into an architectural, software-visible state or sampled from a buffer or
25+register.
26+
27+Fill Buffer Stale Data Propagator (FBSDP)
28+-----------------------------------------
29+Stale data may propagate from fill buffers (FB) into the non-coherent portion
30+of the uncore on some non-coherent writes. Fill buffer propagation by itself
31+does not make stale data architecturally visible. Stale data must be propagated
32+to a location where it is subject to reading or sampling.
33+
34+Sideband Stale Data Propagator (SSDP)
35+-------------------------------------
36+The sideband stale data propagator (SSDP) is limited to the client (including
37+Intel Xeon server E3) uncore implementation. The sideband response buffer is
38+shared by all client cores. For non-coherent reads that go to sideband
39+destinations, the uncore logic returns 64 bytes of data to the core, including
40+both requested data and unrequested stale data, from a transaction buffer and
41+the sideband response buffer. As a result, stale data from the sideband
42+response and transaction buffers may now reside in a core fill buffer.
43+
44+Primary Stale Data Propagator (PSDP)
45+------------------------------------
46+The primary stale data propagator (PSDP) is limited to the client (including
47+Intel Xeon server E3) uncore implementation. Similar to the sideband response
48+buffer, the primary response buffer is shared by all client cores. For some
49+processors, MMIO primary reads will return 64 bytes of data to the core fill
50+buffer including both requested data and unrequested stale data. This is
51+similar to the sideband stale data propagator.
52+
53+Vulnerabilities
54+===============
55+Device Register Partial Write (DRPW) (CVE-2022-21166)
56+-----------------------------------------------------
57+Some endpoint MMIO registers incorrectly handle writes that are smaller than
58+the register size. Instead of aborting the write or only copying the correct
59+subset of bytes (for example, 2 bytes for a 2-byte write), more bytes than
60+specified by the write transaction may be written to the register. On
61+processors affected by FBSDP, this may expose stale data from the fill buffers
62+of the core that created the write transaction.
63+
64+Shared Buffers Data Sampling (SBDS) (CVE-2022-21125)
65+----------------------------------------------------
66+After propagators may have moved data around the uncore and copied stale data
67+into client core fill buffers, processors affected by MFBDS can leak data from
68+the fill buffer. It is limited to the client (including Intel Xeon server E3)
69+uncore implementation.
70+
71+Shared Buffers Data Read (SBDR) (CVE-2022-21123)
72+------------------------------------------------
73+It is similar to Shared Buffer Data Sampling (SBDS) except that the data is
74+directly read into the architectural software-visible state. It is limited to
75+the client (including Intel Xeon server E3) uncore implementation.
76+
77+Affected Processors
78+===================
79+Not all the CPUs are affected by all the variants. For instance, most
80+processors for the server market (excluding Intel Xeon E3 processors) are
81+impacted by only Device Register Partial Write (DRPW).
82+
83+Below is the list of affected Intel processors [#f1]_:
84+
85+ =================== ============ =========
86+ Common name Family_Model Steppings
87+ =================== ============ =========
88+ HASWELL_X 06_3FH 2,4
89+ SKYLAKE_L 06_4EH 3
90+ BROADWELL_X 06_4FH All
91+ SKYLAKE_X 06_55H 3,4,6,7,11
92+ BROADWELL_D 06_56H 3,4,5
93+ SKYLAKE 06_5EH 3
94+ ICELAKE_X 06_6AH 4,5,6
95+ ICELAKE_D 06_6CH 1
96+ ICELAKE_L 06_7EH 5
97+ ATOM_TREMONT_D 06_86H All
98+ LAKEFIELD 06_8AH 1
99+ KABYLAKE_L 06_8EH 9 to 12
100+ ATOM_TREMONT 06_96H 1
101+ ATOM_TREMONT_L 06_9CH 0
102+ KABYLAKE 06_9EH 9 to 13
103+ COMETLAKE 06_A5H 2,3,5
104+ COMETLAKE_L 06_A6H 0,1
105+ ROCKETLAKE 06_A7H 1
106+ =================== ============ =========
107+
108+If a CPU is in the affected processor list, but not affected by a variant, it
109+is indicated by new bits in MSR IA32_ARCH_CAPABILITIES. As described in a later
110+section, mitigation largely remains the same for all the variants, i.e. to
111+clear the CPU fill buffers via VERW instruction.
112+
113+New bits in MSRs
114+================
115+Newer processors and microcode update on existing affected processors added new
116+bits to IA32_ARCH_CAPABILITIES MSR. These bits can be used to enumerate
117+specific variants of Processor MMIO Stale Data vulnerabilities and mitigation
118+capability.
119+
120+MSR IA32_ARCH_CAPABILITIES
121+--------------------------
122+Bit 13 - SBDR_SSDP_NO - When set, processor is not affected by either the
123+ Shared Buffers Data Read (SBDR) vulnerability or the sideband stale
124+ data propagator (SSDP).
125+Bit 14 - FBSDP_NO - When set, processor is not affected by the Fill Buffer
126+ Stale Data Propagator (FBSDP).
127+Bit 15 - PSDP_NO - When set, processor is not affected by Primary Stale Data
128+ Propagator (PSDP).
129+Bit 17 - FB_CLEAR - When set, VERW instruction will overwrite CPU fill buffer
130+ values as part of MD_CLEAR operations. Processors that do not
131+ enumerate MDS_NO (meaning they are affected by MDS) but that do
132+ enumerate support for both L1D_FLUSH and MD_CLEAR implicitly enumerate
133+ FB_CLEAR as part of their MD_CLEAR support.
134+Bit 18 - FB_CLEAR_CTRL - Processor supports read and write to MSR
135+ IA32_MCU_OPT_CTRL[FB_CLEAR_DIS]. On such processors, the FB_CLEAR_DIS
136+ bit can be set to cause the VERW instruction to not perform the
137+ FB_CLEAR action. Not all processors that support FB_CLEAR will support
138+ FB_CLEAR_CTRL.
139+
140+MSR IA32_MCU_OPT_CTRL
141+---------------------
142+Bit 3 - FB_CLEAR_DIS - When set, VERW instruction does not perform the FB_CLEAR
143+action. This may be useful to reduce the performance impact of FB_CLEAR in
144+cases where system software deems it warranted (for example, when performance
145+is more critical, or the untrusted software has no MMIO access). Note that
146+FB_CLEAR_DIS has no impact on enumeration (for example, it does not change
147+FB_CLEAR or MD_CLEAR enumeration) and it may not be supported on all processors
148+that enumerate FB_CLEAR.
149+
150+Mitigation
151+==========
152+Like MDS, all variants of Processor MMIO Stale Data vulnerabilities have the
153+same mitigation strategy to force the CPU to clear the affected buffers before
154+an attacker can extract the secrets.
155+
156+This is achieved by using the otherwise unused and obsolete VERW instruction in
157+combination with a microcode update. The microcode clears the affected CPU
158+buffers when the VERW instruction is executed.
159+
160+Kernel reuses the MDS function to invoke the buffer clearing:
161+
162+ mds_clear_cpu_buffers()
163+
164+On MDS affected CPUs, the kernel already invokes CPU buffer clear on
165+kernel/userspace, hypervisor/guest and C-state (idle) transitions. No
166+additional mitigation is needed on such CPUs.
167+
168+For CPUs not affected by MDS or TAA, mitigation is needed only for the attacker
169+with MMIO capability. Therefore, VERW is not required for kernel/userspace. For
170+virtualization case, VERW is only needed at VMENTER for a guest with MMIO
171+capability.
172+
173+Mitigation points
174+-----------------
175+Return to user space
176+^^^^^^^^^^^^^^^^^^^^
177+Same mitigation as MDS when affected by MDS/TAA, otherwise no mitigation
178+needed.
179+
180+C-State transition
181+^^^^^^^^^^^^^^^^^^
182+Control register writes by CPU during C-state transition can propagate data
183+from fill buffer to uncore buffers. Execute VERW before C-state transition to
184+clear CPU fill buffers.
185+
186+Guest entry point
187+^^^^^^^^^^^^^^^^^
188+Same mitigation as MDS when processor is also affected by MDS/TAA, otherwise
189+execute VERW at VMENTER only for MMIO capable guests. On CPUs not affected by
190+MDS/TAA, guest without MMIO access cannot extract secrets using Processor MMIO
191+Stale Data vulnerabilities, so there is no need to execute VERW for such guests.
192+
193+Mitigation control on the kernel command line
194+---------------------------------------------
195+The kernel command line allows to control the Processor MMIO Stale Data
196+mitigations at boot time with the option "mmio_stale_data=". The valid
197+arguments for this option are:
198+
199+ ========== =================================================================
200+ full If the CPU is vulnerable, enable mitigation; CPU buffer clearing
201+ on exit to userspace and when entering a VM. Idle transitions are
202+ protected as well. It does not automatically disable SMT.
203+ full,nosmt Same as full, with SMT disabled on vulnerable CPUs. This is the
204+ complete mitigation.
205+ off Disables mitigation completely.
206+ ========== =================================================================
207+
208+If the CPU is affected and mmio_stale_data=off is not supplied on the kernel
209+command line, then the kernel selects the appropriate mitigation.
210+
211+Mitigation status information
212+-----------------------------
213+The Linux kernel provides a sysfs interface to enumerate the current
214+vulnerability status of the system: whether the system is vulnerable, and
215+which mitigations are active. The relevant sysfs file is:
216+
217+ /sys/devices/system/cpu/vulnerabilities/mmio_stale_data
218+
219+The possible values in this file are:
220+
221+ .. list-table::
222+
223+ * - 'Not affected'
224+ - The processor is not vulnerable
225+ * - 'Vulnerable'
226+ - The processor is vulnerable, but no mitigation enabled
227+ * - 'Vulnerable: Clear CPU buffers attempted, no microcode'
228+ - The processor is vulnerable, but microcode is not updated. The
229+ mitigation is enabled on a best effort basis.
230+ * - 'Mitigation: Clear CPU buffers'
231+ - The processor is vulnerable and the CPU buffer clearing mitigation is
232+ enabled.
233+
234+If the processor is vulnerable then the following information is appended to
235+the above information:
236+
237+ ======================== ===========================================
238+ 'SMT vulnerable' SMT is enabled
239+ 'SMT disabled' SMT is disabled
240+ 'SMT Host state unknown' Kernel runs in a VM, Host SMT state unknown
241+ ======================== ===========================================
242+
243+References
244+----------
245+.. [#f1] Affected Processors
246+ https://www.intel.com/content/www/us/en/developer/topic-technology/software-security-guidance/processors-affected-consolidated-product-cpu-model.html
Documentation/admin-guide/kernel-parameters.txt+36−1
@@ -2469,7 +2469,6 @@ · 2468 unmodified lines
24692469
24702470 protected: nVHE-based mode with support for guests whose
24712471 state is kept private from the host.
2472− Not valid if the kernel is running in EL2.
24732472
24742473 Defaults to VHE/nVHE based on hardware support. Setting
24752474 mode to "protected" will disable kexec and hibernation
@@ -3176,6 +3175,7 @@ · 700 unmodified lines
31763175 srbds=off [X86,INTEL]
31773176 no_entry_flush [PPC]
31783177 no_uaccess_flush [PPC]
3178+ mmio_stale_data=off [X86]
31793179
31803180 Exceptions:
31813181 This does not have any effect on
@@ -3197,6 +3197,7 @@ · 15 unmodified lines
31973197 Equivalent to: l1tf=flush,nosmt [X86]
31983198 mds=full,nosmt [X86]
31993199 tsx_async_abort=full,nosmt [X86]
3200+ mmio_stale_data=full,nosmt [X86]
32003201
32013202 mminit_loglevel=
32023203 [KNL] When CONFIG_DEBUG_MEMORY_INIT is set, this
@@ -3206,6 +3207,40 @@ · 3 unmodified lines
32063207 log everything. Information is printed at KERN_DEBUG
32073208 so loglevel=8 may also need to be specified.
32083209
3210+ mmio_stale_data=
3211+ [X86,INTEL] Control mitigation for the Processor
3212+ MMIO Stale Data vulnerabilities.
3213+
3214+ Processor MMIO Stale Data is a class of
3215+ vulnerabilities that may expose data after an MMIO
3216+ operation. Exposed data could originate or end in
3217+ the same CPU buffers as affected by MDS and TAA.
3218+ Therefore, similar to MDS and TAA, the mitigation
3219+ is to clear the affected CPU buffers.
3220+
3221+ This parameter controls the mitigation. The
3222+ options are:
3223+
3224+ full - Enable mitigation on vulnerable CPUs
3225+
3226+ full,nosmt - Enable mitigation and disable SMT on
3227+ vulnerable CPUs.
3228+
3229+ off - Unconditionally disable mitigation
3230+
3231+ On MDS or TAA affected machines,
3232+ mmio_stale_data=off can be prevented by an active
3233+ MDS or TAA mitigation as these vulnerabilities are
3234+ mitigated with the same mechanism so in order to
3235+ disable this mitigation, you need to specify
3236+ mds=off and tsx_async_abort=off too.
3237+
3238+ Not specifying this option is equivalent to
3239+ mmio_stale_data=full.
3240+
3241+ For details see:
3242+ Documentation/admin-guide/hw-vuln/processor_mmio_stale_data.rst
3243+
32093244 module.sig_enforce
32103245 [KNL] When CONFIG_MODULE_SIG is set, this means that
32113246 modules without (valid) signatures will fail to load.
Documentation/devicetree/bindings/hwmon/ti,tmp401.yaml+2−3
@@ -40,9 +40,8 @@ properties: · 39 unmodified lines
4040 value to be used for converting remote channel measurements to
4141 temperature.
4242 $ref: /schemas/types.yaml#/definitions/int32
43− items:
44− minimum: -128
45− maximum: 127
43+ minimum: -128
44+ maximum: 127
4645
4746 ti,beta-compensation:
4847 description:
Documentation/devicetree/bindings/interrupt-controller/socionext,uniphier-aidet.yaml+1−0
@@ -30,6 +30,7 @@ properties: · 29 unmodified lines
3030 - socionext,uniphier-ld11-aidet
3131 - socionext,uniphier-ld20-aidet
3232 - socionext,uniphier-pxs3-aidet
33+ - socionext,uniphier-nx1-aidet
3334
3435 reg:
3536 maxItems: 1
Documentation/devicetree/bindings/spi/microchip,mpfs-spi.yaml+0−1
@@ -47,6 +47,5 @@ examples: · 46 unmodified lines
4747 clocks = <&clkcfg CLK_SPI0>;
4848 interrupt-parent = <&plic>;
4949 interrupts = <54>;
50− spi-max-frequency = <25000000>;
5150 };
5251 ...
Documentation/devicetree/bindings/spi/qcom,spi-geni-qcom.yaml+0−1
@@ -110,7 +110,6 @@ examples: · 109 unmodified lines
110110 pinctrl-names = "default";
111111 pinctrl-0 = <&qup_spi1_default>;
112112 interrupts = <GIC_SPI 602 IRQ_TYPE_LEVEL_HIGH>;
113− spi-max-frequency = <50000000>;
114113 #address-cells = <1>;
115114 #size-cells = <0>;
116115 };
Documentation/devicetree/bindings/usb/generic-ehci.yaml+2−1
@@ -136,7 +136,8 @@ properties: · 135 unmodified lines
136136 Phandle of a companion.
137137
138138 phys:
139− maxItems: 1
139+ minItems: 1
140+ maxItems: 3
140141
141142 phy-names:
142143 const: usb
Documentation/devicetree/bindings/usb/generic-ohci.yaml+2−1
@@ -103,7 +103,8 @@ properties: · 102 unmodified lines
103103 Overrides the detected port count
104104
105105 phys:
106− maxItems: 1
106+ minItems: 1
107+ maxItems: 3
107108
108109 phy-names:
109110 const: usb
Documentation/driver-api/gpio/board.rst+1−1
@@ -6,7 +6,7 @@ This document explains how GPIOs can be assigned to given devices and functions. · 5 unmodified lines
66
77 Note that it only applies to the new descriptor-based interface. For a
88 description of the deprecated integer-based GPIO interface please refer to
9−gpio-legacy.txt (actually, there is no real mapping possible with the old
9+legacy.rst (actually, there is no real mapping possible with the old
1010 interface; you just fetch an integer from somewhere and request the
1111 corresponding GPIO).
1212
Documentation/driver-api/gpio/consumer.rst+3−3
@@ -4,7 +4,7 @@ GPIO Descriptor Consumer Interface · 3 unmodified lines
44
55 This document describes the consumer interface of the GPIO framework. Note that
66 it describes the new descriptor-based interface. For a description of the
7−deprecated integer-based GPIO interface please refer to gpio-legacy.txt.
7+deprecated integer-based GPIO interface please refer to legacy.rst.
88
99
1010 Guidelines for GPIOs consumers
@@ -78,7 +78,7 @@ whether the line is configured active high or active low (see · 67 unmodified lines
7878
7979 The two last flags are used for use cases where open drain is mandatory, such
8080 as I2C: if the line is not already configured as open drain in the mappings
81−(see board.txt), then open drain will be enforced anyway and a warning will be
81+(see board.rst), then open drain will be enforced anyway and a warning will be
8282 printed that the board configuration needs to be updated to match the use case.
8383
8484 Both functions return either a valid GPIO descriptor, or an error code checkable
@@ -270,7 +270,7 @@ driven. · 185 unmodified lines
270270 The same is applicable for open drain or open source output lines: those do not
271271 actively drive their output high (open drain) or low (open source), they just
272272 switch their output to a high impedance value. The consumer should not need to
273−care. (For details read about open drain in driver.txt.)
273+care. (For details read about open drain in driver.rst.)
274274
275275 With this, all the gpiod_set_(array)_value_xxx() functions interpret the
276276 parameter "value" as "asserted" ("1") or "de-asserted" ("0"). The physical line
Documentation/driver-api/gpio/intro.rst+3−3
@@ -14,12 +14,12 @@ Due to the history of GPIO interfaces in the kernel, there are two different · 13 unmodified lines
1414 ways to obtain and use GPIOs:
1515
1616 - The descriptor-based interface is the preferred way to manipulate GPIOs,
17− and is described by all the files in this directory excepted gpio-legacy.txt.
17+ and is described by all the files in this directory excepted legacy.rst.
1818 - The legacy integer-based interface which is considered deprecated (but still
19− usable for compatibility reasons) is documented in gpio-legacy.txt.
19+ usable for compatibility reasons) is documented in legacy.rst.
2020
2121 The remainder of this document applies to the new descriptor-based interface.
22−gpio-legacy.txt contains the same information applied to the legacy
22+legacy.rst contains the same information applied to the legacy
2323 integer-based interface.
2424
2525
Documentation/filesystems/btrfs.rst+13−3
@@ -19,13 +19,23 @@ The main Btrfs features include: · 18 unmodified lines
1919 * Subvolumes (separate internal filesystem roots)
2020 * Object level mirroring and striping
2121 * Checksums on data and metadata (multiple algorithms available)
22− * Compression
22+ * Compression (multiple algorithms available)
23+ * Reflink, deduplication
24+ * Scrub (on-line checksum verification)
25+ * Hierarchical quota groups (subvolume and snapshot support)
2326 * Integrated multiple device support, with several raid algorithms
2427 * Offline filesystem check
25− * Efficient incremental backup and FS mirroring
28+ * Efficient incremental backup and FS mirroring (send/receive)
29+ * Trim/discard
2630 * Online filesystem defragmentation
31+ * Swapfile support
32+ * Zoned mode
33+ * Read/write metadata verification
34+ * Online resize (shrink, grow)
2735
28−For more information please refer to the wiki
36+For more information please refer to the documentation site or wiki
37+
38+ https://btrfs.readthedocs.io
2939
3040 https://btrfs.wiki.kernel.org
3141
Documentation/filesystems/ext4/attributes.rst+34−34
@@ -13,8 +13,8 @@ disappeared as of Linux 3.0. · 12 unmodified lines
1313
1414 There are two places where extended attributes can be found. The first
1515 place is between the end of each inode entry and the beginning of the
16−next inode entry. For example, if inode.i\_extra\_isize = 28 and
17−sb.inode\_size = 256, then there are 256 - (128 + 28) = 100 bytes
16+next inode entry. For example, if inode.i_extra_isize = 28 and
17+sb.inode_size = 256, then there are 256 - (128 + 28) = 100 bytes
1818 available for in-inode extended attribute storage. The second place
1919 where extended attributes can be found is in the block pointed to by
2020 ``inode.i_file_acl``. As of Linux 3.11, it is not possible for this
@@ -38,8 +38,8 @@ Extended attributes, when stored after the inode, have a header · 17 unmodified lines
3838 - Name
3939 - Description
4040 * - 0x0
41− - \_\_le32
42− - h\_magic
41+ - __le32
42+ - h_magic
4343 - Magic number for identification, 0xEA020000. This value is set by the
4444 Linux driver, though e2fsprogs doesn't seem to check it(?)
4545
@@ -55,28 +55,28 @@ The beginning of an extended attribute block is in · 9 unmodified lines
5555 - Name
5656 - Description
5757 * - 0x0
58− - \_\_le32
59− - h\_magic
58+ - __le32
59+ - h_magic
6060 - Magic number for identification, 0xEA020000.
6161 * - 0x4
62− - \_\_le32
63− - h\_refcount
62+ - __le32
63+ - h_refcount
6464 - Reference count.
6565 * - 0x8
66− - \_\_le32
67− - h\_blocks
66+ - __le32
67+ - h_blocks
6868 - Number of disk blocks used.
6969 * - 0xC
70− - \_\_le32
71− - h\_hash
70+ - __le32
71+ - h_hash
7272 - Hash value of all attributes.
7373 * - 0x10
74− - \_\_le32
75− - h\_checksum
74+ - __le32
75+ - h_checksum
7676 - Checksum of the extended attribute block.
7777 * - 0x14
78− - \_\_u32
79− - h\_reserved[3]
78+ - __u32
79+ - h_reserved[3]
8080 - Zero.
8181
8282 The checksum is calculated against the FS UUID, the 64-bit block number
@@ -100,46 +100,46 @@ Attributes stored inside an inode do not need be stored in sorted order. · 17 unmodified lines
100100 - Name
101101 - Description
102102 * - 0x0
103− - \_\_u8
104− - e\_name\_len
103+ - __u8
104+ - e_name_len
105105 - Length of name.
106106 * - 0x1
107− - \_\_u8
108− - e\_name\_index
107+ - __u8
108+ - e_name_index
109109 - Attribute name index. There is a discussion of this below.
110110 * - 0x2
111− - \_\_le16
112− - e\_value\_offs
111+ - __le16
112+ - e_value_offs
113113 - Location of this attribute's value on the disk block where it is stored.
114114 Multiple attributes can share the same value. For an inode attribute
115115 this value is relative to the start of the first entry; for a block this
116116 value is relative to the start of the block (i.e. the header).
117117 * - 0x4
118− - \_\_le32
119− - e\_value\_inum
118+ - __le32
119+ - e_value_inum
120120 - The inode where the value is stored. Zero indicates the value is in the
121121 same block as this entry. This field is only used if the
122− INCOMPAT\_EA\_INODE feature is enabled.
122+ INCOMPAT_EA_INODE feature is enabled.
123123 * - 0x8
124− - \_\_le32
125− - e\_value\_size
124+ - __le32
125+ - e_value_size
126126 - Length of attribute value.
127127 * - 0xC
128− - \_\_le32
129− - e\_hash
128+ - __le32
129+ - e_hash
130130 - Hash value of attribute name and attribute value. The kernel doesn't
131131 update the hash for in-inode attributes, so for that case this value
132132 must be zero, because e2fsck validates any non-zero hash regardless of
133133 where the xattr lives.
134134 * - 0x10
135135 - char
136− - e\_name[e\_name\_len]
136+ - e_name[e_name_len]
137137 - Attribute name. Does not include trailing NULL.
138138
139139 Attribute values can follow the end of the entry table. There appears to
140140 be a requirement that they be aligned to 4-byte boundaries. The values
141141 are stored starting at the end of the block and grow towards the
142−xattr\_header/xattr\_entry table. When the two collide, the overflow is
142+xattr_header/xattr_entry table. When the two collide, the overflow is
143143 put into a separate disk block. If the disk block fills up, the
144144 filesystem returns -ENOSPC.
145145
@@ -167,15 +167,15 @@ the key name. Here is a map of name index values to key prefixes: · 21 unmodified lines
167167 * - 1
168168 - “user.”
169169 * - 2
170− - “system.posix\_acl\_access”
170+ - “system.posix_acl_access”
171171 * - 3
172− - “system.posix\_acl\_default”
172+ - “system.posix_acl_default”
173173 * - 4
174174 - “trusted.”
175175 * - 6
176176 - “security.”
177177 * - 7
178− - “system.” (inline\_data only?)
178+ - “system.” (inline_data only?)
179179 * - 8
180180 - “system.richacl” (SuSE kernels only?)
181181
Documentation/filesystems/ext4/bigalloc.rst+1−1
@@ -23,7 +23,7 @@ means that a block group addresses 32 gigabytes instead of 128 megabytes, · 22 unmodified lines
2323 also shrinking the amount of file system overhead for metadata.
2424
2525 The administrator can set a block cluster size at mkfs time (which is
26−stored in the s\_log\_cluster\_size field in the superblock); from then
26+stored in the s_log_cluster_size field in the superblock); from then
2727 on, the block bitmaps track clusters, not individual blocks. This means
2828 that block groups can be several gigabytes in size (instead of just
2929 128MiB); however, the minimum allocation unit becomes a cluster, not a
Documentation/filesystems/ext4/bitmaps.rst+3−3
@@ -9,15 +9,15 @@ group. · 8 unmodified lines
99 The inode bitmap records which entries in the inode table are in use.
1010
1111 As with most bitmaps, one bit represents the usage status of one data
12−block or inode table entry. This implies a block group size of 8 \*
13−number\_of\_bytes\_in\_a\_logical\_block.
12+block or inode table entry. This implies a block group size of 8 *
13+number_of_bytes_in_a_logical_block.
1414
1515 NOTE: If ``BLOCK_UNINIT`` is set for a given block group, various parts
1616 of the kernel and e2fsprogs code pretends that the block bitmap contains
1717 zeros (i.e. all blocks in the group are free). However, it is not
1818 necessarily the case that no blocks are in use -- if ``meta_bg`` is set,
1919 the bitmaps and group descriptor live inside the group. Unfortunately,
20−ext2fs\_test\_block\_bitmap2() will return '0' for those locations,
20+ext2fs_test_block_bitmap2() will return '0' for those locations,
2121 which produces confusing debugfs output.
2222
2323 Inode Table
Documentation/filesystems/ext4/blockgroup.rst+15−15
@@ -56,39 +56,39 @@ established that the super block and the group descriptor table, if · 55 unmodified lines
5656 present, will be at the beginning of the block group. The bitmaps and
5757 the inode table can be anywhere, and it is quite possible for the
5858 bitmaps to come after the inode table, or for both to be in different
59−groups (flex\_bg). Leftover space is used for file data blocks, indirect
59+groups (flex_bg). Leftover space is used for file data blocks, indirect
6060 block maps, extent tree blocks, and extended attributes.
6161
6262 Flexible Block Groups
6363 ---------------------
6464
6565 Starting in ext4, there is a new feature called flexible block groups
66−(flex\_bg). In a flex\_bg, several block groups are tied together as one
66+(flex_bg). In a flex_bg, several block groups are tied together as one
6767 logical block group; the bitmap spaces and the inode table space in the
68−first block group of the flex\_bg are expanded to include the bitmaps
69−and inode tables of all other block groups in the flex\_bg. For example,
70−if the flex\_bg size is 4, then group 0 will contain (in order) the
68+first block group of the flex_bg are expanded to include the bitmaps
69+and inode tables of all other block groups in the flex_bg. For example,
70+if the flex_bg size is 4, then group 0 will contain (in order) the
7171 superblock, group descriptors, data block bitmaps for groups 0-3, inode
7272 bitmaps for groups 0-3, inode tables for groups 0-3, and the remaining
7373 space in group 0 is for file data. The effect of this is to group the
7474 block group metadata close together for faster loading, and to enable
7575 large files to be continuous on disk. Backup copies of the superblock
7676 and group descriptors are always at the beginning of block groups, even
77−if flex\_bg is enabled. The number of block groups that make up a
78−flex\_bg is given by 2 ^ ``sb.s_log_groups_per_flex``.
77+if flex_bg is enabled. The number of block groups that make up a
78+flex_bg is given by 2 ^ ``sb.s_log_groups_per_flex``.
7979
8080 Meta Block Groups
8181 -----------------
8282
83−Without the option META\_BG, for safety concerns, all block group
83+Without the option META_BG, for safety concerns, all block group
8484 descriptors copies are kept in the first block group. Given the default
8585 128MiB(2^27 bytes) block group size and 64-byte group descriptors, ext4
8686 can have at most 2^27/64 = 2^21 block groups. This limits the entire
8787 filesystem size to 2^21 * 2^27 = 2^48bytes or 256TiB.
8888
8989 The solution to this problem is to use the metablock group feature
90−(META\_BG), which is already in ext3 for all 2.6 releases. With the
91−META\_BG feature, ext4 filesystems are partitioned into many metablock
90+(META_BG), which is already in ext3 for all 2.6 releases. With the
91+META_BG feature, ext4 filesystems are partitioned into many metablock
9292 groups. Each metablock group is a cluster of block groups whose group
9393 descriptor structures can be stored in a single disk block. For ext4
9494 filesystems with 4 KB block size, a single metablock group partition
@@ -110,7 +110,7 @@ bytes, a meta-block group contains 32 block groups for filesystems with · 15 unmodified lines
110110 a 1KB block size, and 128 block groups for filesystems with a 4KB
111111 blocksize. Filesystems can either be created using this new block group
112112 descriptor layout, or existing filesystems can be resized on-line, and
113−the field s\_first\_meta\_bg in the superblock will indicate the first
113+the field s_first_meta_bg in the superblock will indicate the first
114114 block group using this new layout.
115115
116116 Please see an important note about ``BLOCK_UNINIT`` in the section about
@@ -121,15 +121,15 @@ Lazy Block Group Initialization · 4 unmodified lines
121121
122122 A new feature for ext4 are three block group descriptor flags that
123123 enable mkfs to skip initializing other parts of the block group
124−metadata. Specifically, the INODE\_UNINIT and BLOCK\_UNINIT flags mean
124+metadata. Specifically, the INODE_UNINIT and BLOCK_UNINIT flags mean
125125 that the inode and block bitmaps for that group can be calculated and
126126 therefore the on-disk bitmap blocks are not initialized. This is
127127 generally the case for an empty block group or a block group containing
128−only fixed-location block group metadata. The INODE\_ZEROED flag means
128+only fixed-location block group metadata. The INODE_ZEROED flag means
129129 that the inode table has been initialized; mkfs will unset this flag and
130130 rely on the kernel to initialize the inode tables in the background.
131131
132132 By not writing zeroes to the bitmaps and inode table, mkfs time is
133−reduced considerably. Note the feature flag is RO\_COMPAT\_GDT\_CSUM,
134−but the dumpe2fs output prints this as “uninit\_bg”. They are the same
133+reduced considerably. Note the feature flag is RO_COMPAT_GDT_CSUM,
134+but the dumpe2fs output prints this as “uninit_bg”. They are the same
135135 thing.
Documentation/filesystems/ext4/blockmap.rst+1−1
@@ -1,7 +1,7 @@
11 .. SPDX-License-Identifier: GPL-2.0
22
33 +---------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
4−| i.i\_block Offset | Where It Points |
4+| i.i_block Offset | Where It Points |
55 +=====================+==============================================================================================================================================================================================================================+
66 | 0 to 11 | Direct map to file blocks 0 to 11. |
77 +---------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Documentation/filesystems/ext4/checksums.rst+13−13
@@ -4,7 +4,7 @@ Checksums · 3 unmodified lines
44 ---------
55
66 Starting in early 2012, metadata checksums were added to all major ext4
7−and jbd2 data structures. The associated feature flag is metadata\_csum.
7+and jbd2 data structures. The associated feature flag is metadata_csum.
88 The desired checksum algorithm is indicated in the superblock, though as
99 of October 2012 the only supported algorithm is crc32c. Some data
1010 structures did not have space to fit a full 32-bit checksum, so only the
@@ -20,7 +20,7 @@ encounters directory blocks that lack sufficient empty space to add a · 9 unmodified lines
2020 checksum, it will request that you run ``e2fsck -D`` to have the
2121 directories rebuilt with checksums. This has the added benefit of
2222 removing slack space from the directory files and rebalancing the htree
23−indexes. If you \_ignore\_ this step, your directories will not be
23+indexes. If you _ignore_ this step, your directories will not be
2424 protected by a checksum!
2525
2626 The following table describes the data elements that go into each type
@@ -35,39 +35,39 @@ of checksum. The checksum function is whatever the superblock describes · 8 unmodified lines
3535 - Length
3636 - Ingredients
3737 * - Superblock
38− - \_\_le32
38+ - __le32
3939 - The entire superblock up to the checksum field. The UUID lives inside
4040 the superblock.
4141 * - MMP
42− - \_\_le32
42+ - __le32
4343 - UUID + the entire MMP block up to the checksum field.
4444 * - Extended Attributes
45− - \_\_le32
45+ - __le32
4646 - UUID + the entire extended attribute block. The checksum field is set to
4747 zero.
4848 * - Directory Entries
49− - \_\_le32
49+ - __le32
5050 - UUID + inode number + inode generation + the directory block up to the
5151 fake entry enclosing the checksum field.
5252 * - HTREE Nodes
53− - \_\_le32
53+ - __le32
5454 - UUID + inode number + inode generation + all valid extents + HTREE tail.
5555 The checksum field is set to zero.
5656 * - Extents
57− - \_\_le32
57+ - __le32
5858 - UUID + inode number + inode generation + the entire extent block up to
5959 the checksum field.
6060 * - Bitmaps
61− - \_\_le32 or \_\_le16
61+ - __le32 or __le16
6262 - UUID + the entire bitmap. Checksums are stored in the group descriptor,
6363 and truncated if the group descriptor size is 32 bytes (i.e. ^64bit)
6464 * - Inodes
65− - \_\_le32
65+ - __le32
6666 - UUID + inode number + inode generation + the entire inode. The checksum
6767 field is set to zero. Each inode has its own checksum.
6868 * - Group Descriptors
69− - \_\_le16
70− - If metadata\_csum, then UUID + group number + the entire descriptor;
71− else if gdt\_csum, then crc16(UUID + group number + the entire
69+ - __le16
70+ - If metadata_csum, then UUID + group number + the entire descriptor;
71+ else if gdt_csum, then crc16(UUID + group number + the entire
7272 descriptor). In all cases, only the lower 16 bits are stored.
7373
Documentation/filesystems/ext4/directory.rst+83−83
@@ -42,24 +42,24 @@ is at most 263 bytes long, though on disk you'll need to reference · 41 unmodified lines
4242 - Name
4343 - Description
4444 * - 0x0
45− - \_\_le32
45+ - __le32
4646 - inode
4747 - Number of the inode that this directory entry points to.
4848 * - 0x4
49− - \_\_le16
50− - rec\_len
49+ - __le16
50+ - rec_len
5151 - Length of this directory entry. Must be a multiple of 4.
5252 * - 0x6
53− - \_\_le16
54− - name\_len
53+ - __le16
54+ - name_len
5555 - Length of the file name.
5656 * - 0x8
5757 - char
58− - name[EXT4\_NAME\_LEN]
58+ - name[EXT4_NAME_LEN]
5959 - File name.
6060
6161 Since file names cannot be longer than 255 bytes, the new directory
62−entry format shortens the name\_len field and uses the space for a file
62+entry format shortens the name_len field and uses the space for a file
6363 type flag, probably to avoid having to load every inode during directory
6464 tree traversal. This format is ``ext4_dir_entry_2``, which is at most
6565 263 bytes long, though on disk you'll need to reference
@@ -74,24 +74,24 @@ tree traversal. This format is ``ext4_dir_entry_2``, which is at most · 8 unmodified lines
7474 - Name
7575 - Description
7676 * - 0x0
77− - \_\_le32
77+ - __le32
7878 - inode
7979 - Number of the inode that this directory entry points to.
8080 * - 0x4
81− - \_\_le16
82− - rec\_len
81+ - __le16
82+ - rec_len
8383 - Length of this directory entry.
8484 * - 0x6
85− - \_\_u8
86− - name\_len
85+ - __u8
86+ - name_len
8787 - Length of the file name.
8888 * - 0x7
89− - \_\_u8
90− - file\_type
89+ - __u8
90+ - file_type
9191 - File type code, see ftype_ table below.
9292 * - 0x8
9393 - char
94− - name[EXT4\_NAME\_LEN]
94+ - name[EXT4_NAME_LEN]
9595 - File name.
9696
9797 .. _ftype:
@@ -137,19 +137,19 @@ entry uses this extension, it may be up to 271 bytes. · 39 unmodified lines
137137 - Name
138138 - Description
139139 * - 0x0
140− - \_\_le32
140+ - __le32
141141 - hash
142142 - The hash of the directory name
143143 * - 0x4
144− - \_\_le32
145− - minor\_hash
144+ - __le32
145+ - minor_hash
146146 - The minor hash of the directory name
147147
148148
149149 In order to add checksums to these classic directory blocks, a phony
150150 ``struct ext4_dir_entry`` is placed at the end of each leaf block to
151151 hold the checksum. The directory entry is 12 bytes long. The inode
152−number and name\_len fields are set to zero to fool old software into
152+number and name_len fields are set to zero to fool old software into
153153 ignoring an apparently empty directory entry, and the checksum is stored
154154 in the place where the name normally goes. The structure is
155155 ``struct ext4_dir_entry_tail``:
@@ -163,24 +163,24 @@ in the place where the name normally goes. The structure is · 7 unmodified lines
163163 - Name
164164 - Description
165165 * - 0x0
166− - \_\_le32
167− - det\_reserved\_zero1
166+ - __le32
167+ - det_reserved_zero1
168168 - Inode number, which must be zero.
169169 * - 0x4
170− - \_\_le16
171− - det\_rec\_len
170+ - __le16
171+ - det_rec_len
172172 - Length of this directory entry, which must be 12.
173173 * - 0x6
174− - \_\_u8
175− - det\_reserved\_zero2
174+ - __u8
175+ - det_reserved_zero2
176176 - Length of the file name, which must be zero.
177177 * - 0x7
178− - \_\_u8
179− - det\_reserved\_ft
178+ - __u8
179+ - det_reserved_ft
180180 - File type, which must be 0xDE.
181181 * - 0x8
182− - \_\_le32
183− - det\_checksum
182+ - __le32
183+ - det_checksum
184184 - Directory leaf block checksum.
185185
186186 The leaf directory block checksum is calculated against the FS UUID, the
@@ -194,7 +194,7 @@ Hash Tree Directories · 7 unmodified lines
194194 A linear array of directory entries isn't great for performance, so a
195195 new feature was added to ext3 to provide a faster (but peculiar)
196196 balanced tree keyed off a hash of the directory entry name. If the
197−EXT4\_INDEX\_FL (0x1000) flag is set in the inode, this directory uses a
197+EXT4_INDEX_FL (0x1000) flag is set in the inode, this directory uses a
198198 hashed btree (htree) to organize and find directory entries. For
199199 backwards read-only compatibility with ext2, this tree is actually
200200 hidden inside the directory file, masquerading as “empty” directory data
@@ -206,14 +206,14 @@ rest of the directory block is empty so that it moves on. · 5 unmodified lines
206206 The root of the tree always lives in the first data block of the
207207 directory. By ext2 custom, the '.' and '..' entries must appear at the
208208 beginning of this first block, so they are put here as two
209−``struct ext4_dir_entry_2``\ s and not stored in the tree. The rest of
209+``struct ext4_dir_entry_2`` s and not stored in the tree. The rest of
210210 the root node contains metadata about the tree and finally a hash->block
211211 map to find nodes that are lower in the htree. If
212212 ``dx_root.info.indirect_levels`` is non-zero then the htree has two
213213 levels; the data block pointed to by the root node's map is an interior
214214 node, which is indexed by a minor hash. Interior nodes in this tree
215215 contains a zeroed out ``struct ext4_dir_entry_2`` followed by a
216−minor\_hash->block map to find leafe nodes. Leaf nodes contain a linear
216+minor_hash->block map to find leafe nodes. Leaf nodes contain a linear
217217 array of all ``struct ext4_dir_entry_2``; all of these entries
218218 (presumably) hash to the same value. If there is an overflow, the
219219 entries simply overflow into the next leaf node, and the
@@ -245,83 +245,83 @@ of a data block: · 25 unmodified lines
245245 - Name
246246 - Description
247247 * - 0x0
248− - \_\_le32
248+ - __le32
249249 - dot.inode
250250 - inode number of this directory.
251251 * - 0x4
252− - \_\_le16
253− - dot.rec\_len
252+ - __le16
253+ - dot.rec_len
254254 - Length of this record, 12.
255255 * - 0x6
256256 - u8
257− - dot.name\_len
257+ - dot.name_len
258258 - Length of the name, 1.
259259 * - 0x7
260260 - u8
261− - dot.file\_type
261+ - dot.file_type
262262 - File type of this entry, 0x2 (directory) (if the feature flag is set).
263263 * - 0x8
264264 - char
265265 - dot.name[4]
266− - “.\\0\\0\\0”
266+ - “.\0\0\0”
267267 * - 0xC
268− - \_\_le32
268+ - __le32
269269 - dotdot.inode
270270 - inode number of parent directory.
271271 * - 0x10
272− - \_\_le16
273− - dotdot.rec\_len
274− - block\_size - 12. The record length is long enough to cover all htree
272+ - __le16
273+ - dotdot.rec_len
274+ - block_size - 12. The record length is long enough to cover all htree
275275 data.
276276 * - 0x12
277277 - u8
278− - dotdot.name\_len
278+ - dotdot.name_len
279279 - Length of the name, 2.
280280 * - 0x13
281281 - u8
282− - dotdot.file\_type
282+ - dotdot.file_type
283283 - File type of this entry, 0x2 (directory) (if the feature flag is set).
284284 * - 0x14
285285 - char
286− - dotdot\_name[4]
287− - “..\\0\\0”
286+ - dotdot_name[4]
287+ - “..\0\0”
288288 * - 0x18
289− - \_\_le32
290− - struct dx\_root\_info.reserved\_zero
289+ - __le32
290+ - struct dx_root_info.reserved_zero
291291 - Zero.
292292 * - 0x1C
293293 - u8
294− - struct dx\_root\_info.hash\_version
294+ - struct dx_root_info.hash_version
295295 - Hash type, see dirhash_ table below.
296296 * - 0x1D
297297 - u8
298− - struct dx\_root\_info.info\_length
298+ - struct dx_root_info.info_length
299299 - Length of the tree information, 0x8.
300300 * - 0x1E
301301 - u8
302− - struct dx\_root\_info.indirect\_levels
303− - Depth of the htree. Cannot be larger than 3 if the INCOMPAT\_LARGEDIR
302+ - struct dx_root_info.indirect_levels
303+ - Depth of the htree. Cannot be larger than 3 if the INCOMPAT_LARGEDIR
304304 feature is set; cannot be larger than 2 otherwise.
305305 * - 0x1F
306306 - u8
307− - struct dx\_root\_info.unused\_flags
307+ - struct dx_root_info.unused_flags
308308 -
309309 * - 0x20
310− - \_\_le16
310+ - __le16
311311 - limit
312− - Maximum number of dx\_entries that can follow this header, plus 1 for
312+ - Maximum number of dx_entries that can follow this header, plus 1 for
313313 the header itself.
314314 * - 0x22
315− - \_\_le16
315+ - __le16
316316 - count
317− - Actual number of dx\_entries that follow this header, plus 1 for the
317+ - Actual number of dx_entries that follow this header, plus 1 for the
318318 header itself.
319319 * - 0x24
320− - \_\_le32
320+ - __le32
321321 - block
322322 - The block number (within the directory file) that goes with hash=0.
323323 * - 0x28
324− - struct dx\_entry
324+ - struct dx_entry
325325 - entries[0]
326326 - As many 8-byte ``struct dx_entry`` as fits in the rest of the data block.
327327
@@ -362,38 +362,38 @@ also the full length of a data block: · 34 unmodified lines
362362 - Name
363363 - Description
364364 * - 0x0
365− - \_\_le32
365+ - __le32
366366 - fake.inode
367367 - Zero, to make it look like this entry is not in use.
368368 * - 0x4
369− - \_\_le16
370− - fake.rec\_len
371− - The size of the block, in order to hide all of the dx\_node data.
369+ - __le16
370+ - fake.rec_len
371+ - The size of the block, in order to hide all of the dx_node data.
372372 * - 0x6
373373 - u8
374− - name\_len
374+ - name_len
375375 - Zero. There is no name for this “unused” directory entry.
376376 * - 0x7
377377 - u8
378− - file\_type
378+ - file_type
379379 - Zero. There is no file type for this “unused” directory entry.
380380 * - 0x8
381− - \_\_le16
381+ - __le16
382382 - limit
383− - Maximum number of dx\_entries that can follow this header, plus 1 for
383+ - Maximum number of dx_entries that can follow this header, plus 1 for
384384 the header itself.
385385 * - 0xA
386− - \_\_le16
386+ - __le16
387387 - count
388− - Actual number of dx\_entries that follow this header, plus 1 for the
388+ - Actual number of dx_entries that follow this header, plus 1 for the
389389 header itself.
390390 * - 0xE
391− - \_\_le32
391+ - __le32
392392 - block
393393 - The block number (within the directory file) that goes with the lowest
394394 hash value of this block. This value is stored in the parent block.
395395 * - 0x12
396− - struct dx\_entry
396+ - struct dx_entry
397397 - entries[0]
398398 - As many 8-byte ``struct dx_entry`` as fits in the rest of the data block.
399399
@@ -410,11 +410,11 @@ long: · 10 unmodified lines
410410 - Name
411411 - Description
412412 * - 0x0
413− - \_\_le32
413+ - __le32
414414 - hash
415415 - Hash code.
416416 * - 0x4
417− - \_\_le32
417+ - __le32
418418 - block
419419 - Block number (within the directory file, not filesystem blocks) of the
420420 next node in the htree.
@@ -423,13 +423,13 @@ long: · 2 unmodified lines
423423 author.)
424424
425425 If metadata checksums are enabled, the last 8 bytes of the directory
426−block (precisely the length of one dx\_entry) are used to store a
426+block (precisely the length of one dx_entry) are used to store a
427427 ``struct dx_tail``, which contains the checksum. The ``limit`` and
428−``count`` entries in the dx\_root/dx\_node structures are adjusted as
429−necessary to fit the dx\_tail into the block. If there is no space for
430−the dx\_tail, the user is notified to run e2fsck -D to rebuild the
428+``count`` entries in the dx_root/dx_node structures are adjusted as
429+necessary to fit the dx_tail into the block. If there is no space for
430+the dx_tail, the user is notified to run e2fsck -D to rebuild the
431431 directory index (which will ensure that there's space for the checksum.
432−The dx\_tail structure is 8 bytes long and looks like this:
432+The dx_tail structure is 8 bytes long and looks like this:
433433
434434 .. list-table::
435435 :widths: 8 8 24 40
@@ -441,13 +441,13 @@ The dx\_tail structure is 8 bytes long and looks like this: · 5 unmodified lines
441441 - Description
442442 * - 0x0
443443 - u32
444− - dt\_reserved
444+ - dt_reserved
445445 - Zero.
446446 * - 0x4
447− - \_\_le32
448− - dt\_checksum
447+ - __le32
448+ - dt_checksum
449449 - Checksum of the htree directory block.
450450
451451 The checksum is calculated against the FS UUID, the htree index header
452−(dx\_root or dx\_node), all of the htree indices (dx\_entry) that are in
453−use, and the tail block (dx\_tail).
452+(dx_root or dx_node), all of the htree indices (dx_entry) that are in
453+use, and the tail block (dx_tail).
Documentation/filesystems/ext4/eainode.rst+5−5
@@ -5,14 +5,14 @@ Large Extended Attribute Values · 4 unmodified lines
55
66 To enable ext4 to store extended attribute values that do not fit in the
77 inode or in the single extended attribute block attached to an inode,
8−the EA\_INODE feature allows us to store the value in the data blocks of
8+the EA_INODE feature allows us to store the value in the data blocks of
99 a regular file inode. This “EA inode” is linked only from the extended
1010 attribute name index and must not appear in a directory entry. The
11−inode's i\_atime field is used to store a checksum of the xattr value;
12−and i\_ctime/i\_version store a 64-bit reference count, which enables
11+inode's i_atime field is used to store a checksum of the xattr value;
12+and i_ctime/i_version store a 64-bit reference count, which enables
1313 sharing of large xattr values between multiple owning inodes. For
1414 backward compatibility with older versions of this feature, the
15−i\_mtime/i\_generation *may* store a back-reference to the inode number
16−and i\_generation of the **one** owning inode (in cases where the EA
15+i_mtime/i_generation *may* store a back-reference to the inode number
16+and i_generation of the **one** owning inode (in cases where the EA
1717 inode is not referenced by multiple inodes) to verify that the EA inode
1818 is the correct one being accessed.
Documentation/filesystems/ext4/group_descr.rst+63−63
@@ -7,34 +7,34 @@ Each block group on the filesystem has one of these descriptors · 6 unmodified lines
77 associated with it. As noted in the Layout section above, the group
88 descriptors (if present) are the second item in the block group. The
99 standard configuration is for each block group to contain a full copy of
10−the block group descriptor table unless the sparse\_super feature flag
10+the block group descriptor table unless the sparse_super feature flag
1111 is set.
1212
1313 Notice how the group descriptor records the location of both bitmaps and
1414 the inode table (i.e. they can float). This means that within a block
1515 group, the only data structures with fixed locations are the superblock
16−and the group descriptor table. The flex\_bg mechanism uses this
16+and the group descriptor table. The flex_bg mechanism uses this
1717 property to group several block groups into a flex group and lay out all
1818 of the groups' bitmaps and inode tables into one long run in the first
1919 group of the flex group.
2020
21−If the meta\_bg feature flag is set, then several block groups are
22−grouped together into a meta group. Note that in the meta\_bg case,
21+If the meta_bg feature flag is set, then several block groups are
22+grouped together into a meta group. Note that in the meta_bg case,
2323 however, the first and last two block groups within the larger meta
2424 group contain only group descriptors for the groups inside the meta
2525 group.
2626
27−flex\_bg and meta\_bg do not appear to be mutually exclusive features.
27+flex_bg and meta_bg do not appear to be mutually exclusive features.
2828
2929 In ext2, ext3, and ext4 (when the 64bit feature is not enabled), the
3030 block group descriptor was only 32 bytes long and therefore ends at
31−bg\_checksum. On an ext4 filesystem with the 64bit feature enabled, the
31+bg_checksum. On an ext4 filesystem with the 64bit feature enabled, the
3232 block group descriptor expands to at least the 64 bytes described below;
3333 the size is stored in the superblock.
3434
35−If gdt\_csum is set and metadata\_csum is not set, the block group
35+If gdt_csum is set and metadata_csum is not set, the block group
3636 checksum is the crc16 of the FS UUID, the group number, and the group
37−descriptor structure. If metadata\_csum is set, then the block group
37+descriptor structure. If metadata_csum is set, then the block group
3838 checksum is the lower 16 bits of the checksum of the FS UUID, the group
3939 number, and the group descriptor structure. Both block and inode bitmap
4040 checksums are calculated against the FS UUID, the group number, and the
@@ -51,59 +51,59 @@ The block group descriptor is laid out in ``struct ext4_group_desc``. · 10 unmodified lines
5151 - Name
5252 - Description
5353 * - 0x0
54− - \_\_le32
55− - bg\_block\_bitmap\_lo
54+ - __le32
55+ - bg_block_bitmap_lo
5656 - Lower 32-bits of location of block bitmap.
5757 * - 0x4
58− - \_\_le32
59− - bg\_inode\_bitmap\_lo
58+ - __le32
59+ - bg_inode_bitmap_lo
6060 - Lower 32-bits of location of inode bitmap.
6161 * - 0x8
62− - \_\_le32
63− - bg\_inode\_table\_lo
62+ - __le32
63+ - bg_inode_table_lo
6464 - Lower 32-bits of location of inode table.
6565 * - 0xC
66− - \_\_le16
67− - bg\_free\_blocks\_count\_lo
66+ - __le16
67+ - bg_free_blocks_count_lo
6868 - Lower 16-bits of free block count.
6969 * - 0xE
70− - \_\_le16
71− - bg\_free\_inodes\_count\_lo
70+ - __le16
71+ - bg_free_inodes_count_lo
7272 - Lower 16-bits of free inode count.
7373 * - 0x10
74− - \_\_le16
75− - bg\_used\_dirs\_count\_lo
74+ - __le16
75+ - bg_used_dirs_count_lo
7676 - Lower 16-bits of directory count.
7777 * - 0x12
78− - \_\_le16
79− - bg\_flags
78+ - __le16
79+ - bg_flags
8080 - Block group flags. See the bgflags_ table below.
8181 * - 0x14
82− - \_\_le32
83− - bg\_exclude\_bitmap\_lo
82+ - __le32
83+ - bg_exclude_bitmap_lo
8484 - Lower 32-bits of location of snapshot exclusion bitmap.
8585 * - 0x18
86− - \_\_le16
87− - bg\_block\_bitmap\_csum\_lo
86+ - __le16
87+ - bg_block_bitmap_csum_lo
8888 - Lower 16-bits of the block bitmap checksum.
8989 * - 0x1A
90− - \_\_le16
91− - bg\_inode\_bitmap\_csum\_lo
90+ - __le16
91+ - bg_inode_bitmap_csum_lo
9292 - Lower 16-bits of the inode bitmap checksum.
9393 * - 0x1C
94− - \_\_le16
95− - bg\_itable\_unused\_lo
94+ - __le16
95+ - bg_itable_unused_lo
9696 - Lower 16-bits of unused inode count. If set, we needn't scan past the
97− ``(sb.s_inodes_per_group - gdt.bg_itable_unused)``\ th entry in the
97+ ``(sb.s_inodes_per_group - gdt.bg_itable_unused)`` th entry in the
9898 inode table for this group.
9999 * - 0x1E
100− - \_\_le16
101− - bg\_checksum
102− - Group descriptor checksum; crc16(sb\_uuid+group\_num+bg\_desc) if the
103− RO\_COMPAT\_GDT\_CSUM feature is set, or
104− crc32c(sb\_uuid+group\_num+bg\_desc) & 0xFFFF if the
105− RO\_COMPAT\_METADATA\_CSUM feature is set. The bg\_checksum
106− field in bg\_desc is skipped when calculating crc16 checksum,
100+ - __le16
101+ - bg_checksum
102+ - Group descriptor checksum; crc16(sb_uuid+group_num+bg_desc) if the
103+ RO_COMPAT_GDT_CSUM feature is set, or
104+ crc32c(sb_uuid+group_num+bg_desc) & 0xFFFF if the
105+ RO_COMPAT_METADATA_CSUM feature is set. The bg_checksum
106+ field in bg_desc is skipped when calculating crc16 checksum,
107107 and set to zero if crc32c checksum is used.
108108 * -
109109 -
@@ -111,48 +111,48 @@ The block group descriptor is laid out in ``struct ext4_group_desc``. · 1 unmodified line
111111 - These fields only exist if the 64bit feature is enabled and s_desc_size
112112 > 32.
113113 * - 0x20
114− - \_\_le32
115− - bg\_block\_bitmap\_hi
114+ - __le32
115+ - bg_block_bitmap_hi
116116 - Upper 32-bits of location of block bitmap.
117117 * - 0x24
118− - \_\_le32
119− - bg\_inode\_bitmap\_hi
118+ - __le32
119+ - bg_inode_bitmap_hi
120120 - Upper 32-bits of location of inodes bitmap.
121121 * - 0x28
122− - \_\_le32
123− - bg\_inode\_table\_hi
122+ - __le32
123+ - bg_inode_table_hi
124124 - Upper 32-bits of location of inodes table.
125125 * - 0x2C
126− - \_\_le16
127− - bg\_free\_blocks\_count\_hi
126+ - __le16
127+ - bg_free_blocks_count_hi
128128 - Upper 16-bits of free block count.
129129 * - 0x2E
130− - \_\_le16
131− - bg\_free\_inodes\_count\_hi
130+ - __le16
131+ - bg_free_inodes_count_hi
132132 - Upper 16-bits of free inode count.
133133 * - 0x30
134− - \_\_le16
135− - bg\_used\_dirs\_count\_hi
134+ - __le16
135+ - bg_used_dirs_count_hi
136136 - Upper 16-bits of directory count.
137137 * - 0x32
138− - \_\_le16
139− - bg\_itable\_unused\_hi
138+ - __le16
139+ - bg_itable_unused_hi
140140 - Upper 16-bits of unused inode count.
141141 * - 0x34
142− - \_\_le32
143− - bg\_exclude\_bitmap\_hi
142+ - __le32
143+ - bg_exclude_bitmap_hi
144144 - Upper 32-bits of location of snapshot exclusion bitmap.
145145 * - 0x38
146− - \_\_le16
147− - bg\_block\_bitmap\_csum\_hi
146+ - __le16
147+ - bg_block_bitmap_csum_hi
148148 - Upper 16-bits of the block bitmap checksum.
149149 * - 0x3A
150− - \_\_le16
151− - bg\_inode\_bitmap\_csum\_hi
150+ - __le16
151+ - bg_inode_bitmap_csum_hi
152152 - Upper 16-bits of the inode bitmap checksum.
153153 * - 0x3C
154− - \_\_u32
155− - bg\_reserved
154+ - __u32
155+ - bg_reserved
156156 - Padding to 64 bytes.
157157
158158 .. _bgflags:
@@ -166,8 +166,8 @@ Block group flags can be any combination of the following: · 7 unmodified lines
166166 * - Value
167167 - Description
168168 * - 0x1
169− - inode table and bitmap are not initialized (EXT4\_BG\_INODE\_UNINIT).
169+ - inode table and bitmap are not initialized (EXT4_BG_INODE_UNINIT).
170170 * - 0x2
171− - block bitmap is not initialized (EXT4\_BG\_BLOCK\_UNINIT).
171+ - block bitmap is not initialized (EXT4_BG_BLOCK_UNINIT).
172172 * - 0x4
173− - inode table is zeroed (EXT4\_BG\_INODE\_ZEROED).
173+ - inode table is zeroed (EXT4_BG_INODE_ZEROED).
Documentation/filesystems/ext4/ifork.rst+30−30
@@ -1,6 +1,6 @@
11 .. SPDX-License-Identifier: GPL-2.0
22
3−The Contents of inode.i\_block
3+The Contents of inode.i_block
44 ------------------------------
55
66 Depending on the type of file an inode describes, the 60 bytes of
@@ -47,7 +47,7 @@ In ext4, the file to logical block map has been replaced with an extent · 40 unmodified lines
4747 tree. Under the old scheme, allocating a contiguous run of 1,000 blocks
4848 requires an indirect block to map all 1,000 entries; with extents, the
4949 mapping is reduced to a single ``struct ext4_extent`` with
50−``ee_len = 1000``. If flex\_bg is enabled, it is possible to allocate
50+``ee_len = 1000``. If flex_bg is enabled, it is possible to allocate
5151 very large files with a single extent, at a considerable reduction in
5252 metadata block use, and some improvement in disk efficiency. The inode
5353 must have the extents flag (0x80000) flag set for this feature to be in
@@ -76,28 +76,28 @@ which is 12 bytes long: · 22 unmodified lines
7676 - Name
7777 - Description
7878 * - 0x0
79− - \_\_le16
80− - eh\_magic
79+ - __le16
80+ - eh_magic
8181 - Magic number, 0xF30A.
8282 * - 0x2
83− - \_\_le16
84− - eh\_entries
83+ - __le16
84+ - eh_entries
8585 - Number of valid entries following the header.
8686 * - 0x4
87− - \_\_le16
88− - eh\_max
87+ - __le16
88+ - eh_max
8989 - Maximum number of entries that could follow the header.
9090 * - 0x6
91− - \_\_le16
92− - eh\_depth
91+ - __le16
92+ - eh_depth
9393 - Depth of this extent node in the extent tree. 0 = this extent node
9494 points to data blocks; otherwise, this extent node points to other
9595 extent nodes. The extent tree can be at most 5 levels deep: a logical
9696 block number can be at most ``2^32``, and the smallest ``n`` that
9797 satisfies ``4*(((blocksize - 12)/12)^n) >= 2^32`` is 5.
9898 * - 0x8
99− - \_\_le32
100− - eh\_generation
99+ - __le32
100+ - eh_generation
101101 - Generation of the tree. (Used by Lustre, but not standard ext4).
102102
103103 Internal nodes of the extent tree, also known as index nodes, are
@@ -112,22 +112,22 @@ recorded as ``struct ext4_extent_idx``, and are 12 bytes long: · 8 unmodified lines
112112 - Name
113113 - Description
114114 * - 0x0
115− - \_\_le32
116− - ei\_block
115+ - __le32
116+ - ei_block
117117 - This index node covers file blocks from 'block' onward.
118118 * - 0x4
119− - \_\_le32
120− - ei\_leaf\_lo
119+ - __le32
120+ - ei_leaf_lo
121121 - Lower 32-bits of the block number of the extent node that is the next
122122 level lower in the tree. The tree node pointed to can be either another
123123 internal node or a leaf node, described below.
124124 * - 0x8
125− - \_\_le16
126− - ei\_leaf\_hi
125+ - __le16
126+ - ei_leaf_hi
127127 - Upper 16-bits of the previous field.
128128 * - 0xA
129− - \_\_u16
130− - ei\_unused
129+ - __u16
130+ - ei_unused
131131 -
132132
133133 Leaf nodes of the extent tree are recorded as ``struct ext4_extent``,
@@ -142,24 +142,24 @@ and are also 12 bytes long: · 8 unmodified lines
142142 - Name
143143 - Description
144144 * - 0x0
145− - \_\_le32
146− - ee\_block
145+ - __le32
146+ - ee_block
147147 - First file block number that this extent covers.
148148 * - 0x4
149− - \_\_le16
150− - ee\_len
149+ - __le16
150+ - ee_len
151151 - Number of blocks covered by extent. If the value of this field is <=
152152 32768, the extent is initialized. If the value of the field is > 32768,
153153 the extent is uninitialized and the actual extent length is ``ee_len`` -
154154 32768. Therefore, the maximum length of a initialized extent is 32768
155155 blocks, and the maximum length of an uninitialized extent is 32767.
156156 * - 0x6
157− - \_\_le16
158− - ee\_start\_hi
157+ - __le16
158+ - ee_start_hi
159159 - Upper 16-bits of the block number to which this extent points.
160160 * - 0x8
161− - \_\_le32
162− - ee\_start\_lo
161+ - __le32
162+ - ee_start_lo
163163 - Lower 32-bits of the block number to which this extent points.
164164
165165 Prior to the introduction of metadata checksums, the extent header +
@@ -182,8 +182,8 @@ including) the checksum itself. · 16 unmodified lines
182182 - Name
183183 - Description
184184 * - 0x0
185− - \_\_le32
186− - eb\_checksum
185+ - __le32
186+ - eb_checksum
187187 - Checksum of the extent block, crc32c(uuid+inum+igeneration+extentblock)
188188
189189 Inline Data
Documentation/filesystems/ext4/inlinedata.rst+4−4
@@ -11,12 +11,12 @@ file is smaller than 60 bytes, then the data are stored inline in · 10 unmodified lines
1111 attribute space, then it might be found as an extended attribute
1212 “system.data” within the inode body (“ibody EA”). This of course
1313 constrains the amount of extended attributes one can attach to an inode.
14−If the data size increases beyond i\_block + ibody EA, a regular block
14+If the data size increases beyond i_block + ibody EA, a regular block
1515 is allocated and the contents moved to that block.
1616
1717 Pending a change to compact the extended attribute key used to store
1818 inline data, one ought to be able to store 160 bytes of data in a
19−256-byte inode (as of June 2015, when i\_extra\_isize is 28). Prior to
19+256-byte inode (as of June 2015, when i_extra_isize is 28). Prior to
2020 that, the limit was 156 bytes due to inefficient use of inode space.
2121
2222 The inline data feature requires the presence of an extended attribute
@@ -25,12 +25,12 @@ for “system.data”, even if the attribute value is zero length. · 2 unmodified lines
2525 Inline Directories
2626 ~~~~~~~~~~~~~~~~~~
2727
28−The first four bytes of i\_block are the inode number of the parent
28+The first four bytes of i_block are the inode number of the parent
2929 directory. Following that is a 56-byte space for an array of directory
3030 entries; see ``struct ext4_dir_entry``. If there is a “system.data”
3131 attribute in the inode body, the EA value is an array of
3232 ``struct ext4_dir_entry`` as well. Note that for inline directories, the
33−i\_block and EA space are treated as separate dirent blocks; directory
33+i_block and EA space are treated as separate dirent blocks; directory
3434 entries cannot span the two.
3535
3636 Inline directory entries are not checksummed, as the inode checksum
Documentation/filesystems/ext4/inodes.rst+153−153
@@ -38,138 +38,138 @@ The inode table entry is laid out in ``struct ext4_inode``. · 37 unmodified lines
3838 - Name
3939 - Description
4040 * - 0x0
41− - \_\_le16
42− - i\_mode
41+ - __le16
42+ - i_mode
4343 - File mode. See the table i_mode_ below.
4444 * - 0x2
45− - \_\_le16
46− - i\_uid
45+ - __le16
46+ - i_uid
4747 - Lower 16-bits of Owner UID.
4848 * - 0x4
49− - \_\_le32
50− - i\_size\_lo
49+ - __le32
50+ - i_size_lo
5151 - Lower 32-bits of size in bytes.
5252 * - 0x8
53− - \_\_le32
54− - i\_atime
55− - Last access time, in seconds since the epoch. However, if the EA\_INODE
53+ - __le32
54+ - i_atime
55+ - Last access time, in seconds since the epoch. However, if the EA_INODE
5656 inode flag is set, this inode stores an extended attribute value and
5757 this field contains the checksum of the value.
5858 * - 0xC
59− - \_\_le32
60− - i\_ctime
59+ - __le32
60+ - i_ctime
6161 - Last inode change time, in seconds since the epoch. However, if the
62− EA\_INODE inode flag is set, this inode stores an extended attribute
62+ EA_INODE inode flag is set, this inode stores an extended attribute
6363 value and this field contains the lower 32 bits of the attribute value's
6464 reference count.
6565 * - 0x10
66− - \_\_le32
67− - i\_mtime
66+ - __le32
67+ - i_mtime
6868 - Last data modification time, in seconds since the epoch. However, if the
69− EA\_INODE inode flag is set, this inode stores an extended attribute
69+ EA_INODE inode flag is set, this inode stores an extended attribute
7070 value and this field contains the number of the inode that owns the
7171 extended attribute.
7272 * - 0x14
73− - \_\_le32
74− - i\_dtime
73+ - __le32
74+ - i_dtime
7575 - Deletion Time, in seconds since the epoch.
7676 * - 0x18
77− - \_\_le16
78− - i\_gid
77+ - __le16
78+ - i_gid
7979 - Lower 16-bits of GID.
8080 * - 0x1A
81− - \_\_le16
82− - i\_links\_count
81+ - __le16
82+ - i_links_count
8383 - Hard link count. Normally, ext4 does not permit an inode to have more
8484 than 65,000 hard links. This applies to files as well as directories,
8585 which means that there cannot be more than 64,998 subdirectories in a
8686 directory (each subdirectory's '..' entry counts as a hard link, as does
87− the '.' entry in the directory itself). With the DIR\_NLINK feature
87+ the '.' entry in the directory itself). With the DIR_NLINK feature
8888 enabled, ext4 supports more than 64,998 subdirectories by setting this
8989 field to 1 to indicate that the number of hard links is not known.
9090 * - 0x1C
91− - \_\_le32
92− - i\_blocks\_lo
93− - Lower 32-bits of “block” count. If the huge\_file feature flag is not
91+ - __le32
92+ - i_blocks_lo
93+ - Lower 32-bits of “block” count. If the huge_file feature flag is not
9494 set on the filesystem, the file consumes ``i_blocks_lo`` 512-byte blocks
95− on disk. If huge\_file is set and EXT4\_HUGE\_FILE\_FL is NOT set in
95+ on disk. If huge_file is set and EXT4_HUGE_FILE_FL is NOT set in
9696 ``inode.i_flags``, then the file consumes ``i_blocks_lo + (i_blocks_hi
97− << 32)`` 512-byte blocks on disk. If huge\_file is set and
98− EXT4\_HUGE\_FILE\_FL IS set in ``inode.i_flags``, then this file
97+ << 32)`` 512-byte blocks on disk. If huge_file is set and
98+ EXT4_HUGE_FILE_FL IS set in ``inode.i_flags``, then this file
9999 consumes (``i_blocks_lo + i_blocks_hi`` << 32) filesystem blocks on
100100 disk.
101101 * - 0x20
102− - \_\_le32
103− - i\_flags
102+ - __le32
103+ - i_flags
104104 - Inode flags. See the table i_flags_ below.
105105 * - 0x24
106106 - 4 bytes
107− - i\_osd1
107+ - i_osd1
108108 - See the table i_osd1_ for more details.
109109 * - 0x28
110110 - 60 bytes
111− - i\_block[EXT4\_N\_BLOCKS=15]
112− - Block map or extent tree. See the section “The Contents of inode.i\_block”.
111+ - i_block[EXT4_N_BLOCKS=15]
112+ - Block map or extent tree. See the section “The Contents of inode.i_block”.
113113 * - 0x64
114− - \_\_le32
115− - i\_generation
114+ - __le32
115+ - i_generation
116116 - File version (for NFS).
117117 * - 0x68
118− - \_\_le32
119− - i\_file\_acl\_lo
118+ - __le32
119+ - i_file_acl_lo
120120 - Lower 32-bits of extended attribute block. ACLs are of course one of
121121 many possible extended attributes; I think the name of this field is a
122122 result of the first use of extended attributes being for ACLs.
123123 * - 0x6C
124− - \_\_le32
125− - i\_size\_high / i\_dir\_acl
124+ - __le32
125+ - i_size_high / i_dir_acl
126126 - Upper 32-bits of file/directory size. In ext2/3 this field was named
127− i\_dir\_acl, though it was usually set to zero and never used.
127+ i_dir_acl, though it was usually set to zero and never used.
128128 * - 0x70
129− - \_\_le32
130− - i\_obso\_faddr
129+ - __le32
130+ - i_obso_faddr
131131 - (Obsolete) fragment address.
132132 * - 0x74
133133 - 12 bytes
134− - i\_osd2
134+ - i_osd2
135135 - See the table i_osd2_ for more details.
136136 * - 0x80
137− - \_\_le16
138− - i\_extra\_isize
137+ - __le16
138+ - i_extra_isize
139139 - Size of this inode - 128. Alternately, the size of the extended inode
140140 fields beyond the original ext2 inode, including this field.
141141 * - 0x82
142− - \_\_le16
143− - i\_checksum\_hi
142+ - __le16
143+ - i_checksum_hi
144144 - Upper 16-bits of the inode checksum.
145145 * - 0x84
146− - \_\_le32
147− - i\_ctime\_extra
146+ - __le32
147+ - i_ctime_extra
148148 - Extra change time bits. This provides sub-second precision. See Inode
149149 Timestamps section.
150150 * - 0x88
151− - \_\_le32
152− - i\_mtime\_extra
151+ - __le32
152+ - i_mtime_extra
153153 - Extra modification time bits. This provides sub-second precision.
154154 * - 0x8C
155− - \_\_le32
156− - i\_atime\_extra
155+ - __le32
156+ - i_atime_extra
157157 - Extra access time bits. This provides sub-second precision.
158158 * - 0x90
159− - \_\_le32
160− - i\_crtime
159+ - __le32
160+ - i_crtime
161161 - File creation time, in seconds since the epoch.
162162 * - 0x94
163− - \_\_le32
164− - i\_crtime\_extra
163+ - __le32
164+ - i_crtime_extra
165165 - Extra file creation time bits. This provides sub-second precision.
166166 * - 0x98
167− - \_\_le32
168− - i\_version\_hi
167+ - __le32
168+ - i_version_hi
169169 - Upper 32-bits for version number.
170170 * - 0x9C
171− - \_\_le32
172− - i\_projid
171+ - __le32
172+ - i_projid
173173 - Project ID.
174174
175175 .. _i_mode:
@@ -183,45 +183,45 @@ The ``i_mode`` value is a combination of the following flags: · 7 unmodified lines
183183 * - Value
184184 - Description
185185 * - 0x1
186− - S\_IXOTH (Others may execute)
186+ - S_IXOTH (Others may execute)
187187 * - 0x2
188− - S\_IWOTH (Others may write)
188+ - S_IWOTH (Others may write)
189189 * - 0x4
190− - S\_IROTH (Others may read)
190+ - S_IROTH (Others may read)
191191 * - 0x8
192− - S\_IXGRP (Group members may execute)
192+ - S_IXGRP (Group members may execute)
193193 * - 0x10
194− - S\_IWGRP (Group members may write)
194+ - S_IWGRP (Group members may write)
195195 * - 0x20
196− - S\_IRGRP (Group members may read)
196+ - S_IRGRP (Group members may read)
197197 * - 0x40
198− - S\_IXUSR (Owner may execute)
198+ - S_IXUSR (Owner may execute)
199199 * - 0x80
200− - S\_IWUSR (Owner may write)
200+ - S_IWUSR (Owner may write)
201201 * - 0x100
202− - S\_IRUSR (Owner may read)
202+ - S_IRUSR (Owner may read)
203203 * - 0x200
204− - S\_ISVTX (Sticky bit)
204+ - S_ISVTX (Sticky bit)
205205 * - 0x400
206− - S\_ISGID (Set GID)
206+ - S_ISGID (Set GID)
207207 * - 0x800
208− - S\_ISUID (Set UID)
208+ - S_ISUID (Set UID)
209209 * -
210210 - These are mutually-exclusive file types:
211211 * - 0x1000
212− - S\_IFIFO (FIFO)
212+ - S_IFIFO (FIFO)
213213 * - 0x2000
214− - S\_IFCHR (Character device)
214+ - S_IFCHR (Character device)
215215 * - 0x4000
216− - S\_IFDIR (Directory)
216+ - S_IFDIR (Directory)
217217 * - 0x6000
218− - S\_IFBLK (Block device)
218+ - S_IFBLK (Block device)
219219 * - 0x8000
220− - S\_IFREG (Regular file)
220+ - S_IFREG (Regular file)
221221 * - 0xA000
222− - S\_IFLNK (Symbolic link)
222+ - S_IFLNK (Symbolic link)
223223 * - 0xC000
224− - S\_IFSOCK (Socket)
224+ - S_IFSOCK (Socket)
225225
226226 .. _i_flags:
227227
@@ -234,56 +234,56 @@ The ``i_flags`` field is a combination of these values: · 6 unmodified lines
234234 * - Value
235235 - Description
236236 * - 0x1
237− - This file requires secure deletion (EXT4\_SECRM\_FL). (not implemented)
237+ - This file requires secure deletion (EXT4_SECRM_FL). (not implemented)
238238 * - 0x2
239239 - This file should be preserved, should undeletion be desired
240− (EXT4\_UNRM\_FL). (not implemented)
240+ (EXT4_UNRM_FL). (not implemented)
241241 * - 0x4
242− - File is compressed (EXT4\_COMPR\_FL). (not really implemented)
242+ - File is compressed (EXT4_COMPR_FL). (not really implemented)
243243 * - 0x8
244− - All writes to the file must be synchronous (EXT4\_SYNC\_FL).
244+ - All writes to the file must be synchronous (EXT4_SYNC_FL).
245245 * - 0x10
246− - File is immutable (EXT4\_IMMUTABLE\_FL).
246+ - File is immutable (EXT4_IMMUTABLE_FL).
247247 * - 0x20
248− - File can only be appended (EXT4\_APPEND\_FL).
248+ - File can only be appended (EXT4_APPEND_FL).
249249 * - 0x40
250− - The dump(1) utility should not dump this file (EXT4\_NODUMP\_FL).
250+ - The dump(1) utility should not dump this file (EXT4_NODUMP_FL).
251251 * - 0x80
252− - Do not update access time (EXT4\_NOATIME\_FL).
252+ - Do not update access time (EXT4_NOATIME_FL).
253253 * - 0x100
254− - Dirty compressed file (EXT4\_DIRTY\_FL). (not used)
254+ - Dirty compressed file (EXT4_DIRTY_FL). (not used)
255255 * - 0x200
256− - File has one or more compressed clusters (EXT4\_COMPRBLK\_FL). (not used)
256+ - File has one or more compressed clusters (EXT4_COMPRBLK_FL). (not used)
257257 * - 0x400
258− - Do not compress file (EXT4\_NOCOMPR\_FL). (not used)
258+ - Do not compress file (EXT4_NOCOMPR_FL). (not used)
259259 * - 0x800
260− - Encrypted inode (EXT4\_ENCRYPT\_FL). This bit value previously was
261− EXT4\_ECOMPR\_FL (compression error), which was never used.
260+ - Encrypted inode (EXT4_ENCRYPT_FL). This bit value previously was
261+ EXT4_ECOMPR_FL (compression error), which was never used.
262262 * - 0x1000
263− - Directory has hashed indexes (EXT4\_INDEX\_FL).
263+ - Directory has hashed indexes (EXT4_INDEX_FL).
264264 * - 0x2000
265− - AFS magic directory (EXT4\_IMAGIC\_FL).
265+ - AFS magic directory (EXT4_IMAGIC_FL).
266266 * - 0x4000
267267 - File data must always be written through the journal
268− (EXT4\_JOURNAL\_DATA\_FL).
268+ (EXT4_JOURNAL_DATA_FL).
269269 * - 0x8000
270− - File tail should not be merged (EXT4\_NOTAIL\_FL). (not used by ext4)
270+ - File tail should not be merged (EXT4_NOTAIL_FL). (not used by ext4)
271271 * - 0x10000
272272 - All directory entry data should be written synchronously (see
273− ``dirsync``) (EXT4\_DIRSYNC\_FL).
273+ ``dirsync``) (EXT4_DIRSYNC_FL).
274274 * - 0x20000
275− - Top of directory hierarchy (EXT4\_TOPDIR\_FL).
275+ - Top of directory hierarchy (EXT4_TOPDIR_FL).
276276 * - 0x40000
277− - This is a huge file (EXT4\_HUGE\_FILE\_FL).
277+ - This is a huge file (EXT4_HUGE_FILE_FL).
278278 * - 0x80000
279− - Inode uses extents (EXT4\_EXTENTS\_FL).
279+ - Inode uses extents (EXT4_EXTENTS_FL).
280280 * - 0x100000
281− - Verity protected file (EXT4\_VERITY\_FL).
281+ - Verity protected file (EXT4_VERITY_FL).
282282 * - 0x200000
283283 - Inode stores a large extended attribute value in its data blocks
284− (EXT4\_EA\_INODE\_FL).
284+ (EXT4_EA_INODE_FL).
285285 * - 0x400000
286− - This file has blocks allocated past EOF (EXT4\_EOFBLOCKS\_FL).
286+ - This file has blocks allocated past EOF (EXT4_EOFBLOCKS_FL).
287287 (deprecated)
288288 * - 0x01000000
289289 - Inode is a snapshot (``EXT4_SNAPFILE_FL``). (not in mainline)
@@ -294,21 +294,21 @@ The ``i_flags`` field is a combination of these values: · 4 unmodified lines
294294 - Snapshot shrink has completed (``EXT4_SNAPFILE_SHRUNK_FL``). (not in
295295 mainline)
296296 * - 0x10000000
297− - Inode has inline data (EXT4\_INLINE\_DATA\_FL).
297+ - Inode has inline data (EXT4_INLINE_DATA_FL).
298298 * - 0x20000000
299− - Create children with the same project ID (EXT4\_PROJINHERIT\_FL).
299+ - Create children with the same project ID (EXT4_PROJINHERIT_FL).
300300 * - 0x80000000
301− - Reserved for ext4 library (EXT4\_RESERVED\_FL).
301+ - Reserved for ext4 library (EXT4_RESERVED_FL).
302302 * -
303303 - Aggregate flags:
304304 * - 0x705BDFFF
305305 - User-visible flags.
306306 * - 0x604BC0FF
307− - User-modifiable flags. Note that while EXT4\_JOURNAL\_DATA\_FL and
308− EXT4\_EXTENTS\_FL can be set with setattr, they are not in the kernel's
309− EXT4\_FL\_USER\_MODIFIABLE mask, since it needs to handle the setting of
307+ - User-modifiable flags. Note that while EXT4_JOURNAL_DATA_FL and
308+ EXT4_EXTENTS_FL can be set with setattr, they are not in the kernel's
309+ EXT4_FL_USER_MODIFIABLE mask, since it needs to handle the setting of
310310 these flags in a special manner and they are masked out of the set of
311− flags that are saved directly to i\_flags.
311+ flags that are saved directly to i_flags.
312312
313313 .. _i_osd1:
314314
@@ -325,9 +325,9 @@ Linux: · 10 unmodified lines
325325 - Name
326326 - Description
327327 * - 0x0
328− - \_\_le32
329− - l\_i\_version
330− - Inode version. However, if the EA\_INODE inode flag is set, this inode
328+ - __le32
329+ - l_i_version
330+ - Inode version. However, if the EA_INODE inode flag is set, this inode
331331 stores an extended attribute value and this field contains the upper 32
332332 bits of the attribute value's reference count.
333333
@@ -342,8 +342,8 @@ Hurd: · 8 unmodified lines
342342 - Name
343343 - Description
344344 * - 0x0
345− - \_\_le32
346− - h\_i\_translator
345+ - __le32
346+ - h_i_translator
347347 - ??
348348
349349 Masix:
@@ -357,8 +357,8 @@ Masix: · 7 unmodified lines
357357 - Name
358358 - Description
359359 * - 0x0
360− - \_\_le32
361− - m\_i\_reserved
360+ - __le32
361+ - m_i_reserved
362362 - ??
363363
364364 .. _i_osd2:
@@ -376,30 +376,30 @@ Linux: · 11 unmodified lines
376376 - Name
377377 - Description
378378 * - 0x0
379− - \_\_le16
380− - l\_i\_blocks\_high
379+ - __le16
380+ - l_i_blocks_high
381381 - Upper 16-bits of the block count. Please see the note attached to
382− i\_blocks\_lo.
382+ i_blocks_lo.
383383 * - 0x2
384− - \_\_le16
385− - l\_i\_file\_acl\_high
384+ - __le16
385+ - l_i_file_acl_high
386386 - Upper 16-bits of the extended attribute block (historically, the file
387387 ACL location). See the Extended Attributes section below.
388388 * - 0x4
389− - \_\_le16
390− - l\_i\_uid\_high
389+ - __le16
390+ - l_i_uid_high
391391 - Upper 16-bits of the Owner UID.
392392 * - 0x6
393− - \_\_le16
394− - l\_i\_gid\_high
393+ - __le16
394+ - l_i_gid_high
395395 - Upper 16-bits of the GID.
396396 * - 0x8
397− - \_\_le16
398− - l\_i\_checksum\_lo
397+ - __le16
398+ - l_i_checksum_lo
399399 - Lower 16-bits of the inode checksum.
400400 * - 0xA
401− - \_\_le16
402− - l\_i\_reserved
401+ - __le16
402+ - l_i_reserved
403403 - Unused.
404404
405405 Hurd:
@@ -413,24 +413,24 @@ Hurd: · 7 unmodified lines
413413 - Name
414414 - Description
415415 * - 0x0
416− - \_\_le16
417− - h\_i\_reserved1
416+ - __le16
417+ - h_i_reserved1
418418 - ??
419419 * - 0x2
420− - \_\_u16
421− - h\_i\_mode\_high
420+ - __u16
421+ - h_i_mode_high
422422 - Upper 16-bits of the file mode.
423423 * - 0x4
424− - \_\_le16
425− - h\_i\_uid\_high
424+ - __le16
425+ - h_i_uid_high
426426 - Upper 16-bits of the Owner UID.
427427 * - 0x6
428− - \_\_le16
429− - h\_i\_gid\_high
428+ - __le16
429+ - h_i_gid_high
430430 - Upper 16-bits of the GID.
431431 * - 0x8
432− - \_\_u32
433− - h\_i\_author
432+ - __u32
433+ - h_i_author
434434 - Author code?
435435
436436 Masix:
@@ -444,17 +444,17 @@ Masix: · 7 unmodified lines
444444 - Name
445445 - Description
446446 * - 0x0
447− - \_\_le16
448− - h\_i\_reserved1
447+ - __le16
448+ - h_i_reserved1
449449 - ??
450450 * - 0x2
451− - \_\_u16
452− - m\_i\_file\_acl\_high
451+ - __u16
452+ - m_i_file_acl_high
453453 - Upper 16-bits of the extended attribute block (historically, the file
454454 ACL location).
455455 * - 0x4
456− - \_\_u32
457− - m\_i\_reserved2[2]
456+ - __u32
457+ - m_i_reserved2[2]
458458 - ??
459459
460460 Inode Size
@@ -466,11 +466,11 @@ In ext2 and ext3, the inode structure size was fixed at 128 bytes · 5 unmodified lines
466466 on-disk inode at format time for all inodes in the filesystem to provide
467467 space beyond the end of the original ext2 inode. The on-disk inode
468468 record size is recorded in the superblock as ``s_inode_size``. The
469−number of bytes actually used by struct ext4\_inode beyond the original
469+number of bytes actually used by struct ext4_inode beyond the original
470470 128-byte ext2 inode is recorded in the ``i_extra_isize`` field for each
471−inode, which allows struct ext4\_inode to grow for a new kernel without
471+inode, which allows struct ext4_inode to grow for a new kernel without
472472 having to upgrade all of the on-disk inodes. Access to fields beyond
473−EXT2\_GOOD\_OLD\_INODE\_SIZE should be verified to be within
473+EXT2_GOOD_OLD_INODE_SIZE should be verified to be within
474474 ``i_extra_isize``. By default, ext4 inode records are 256 bytes, and (as
475475 of August 2019) the inode structure is 160 bytes
476476 (``i_extra_isize = 32``). The extra space between the end of the inode
@@ -516,7 +516,7 @@ creation time (crtime); this field is 64-bits wide and decoded in the · 39 unmodified lines
516516 same manner as 64-bit [cma]time. Neither crtime nor dtime are accessible
517517 through the regular stat() interface, though debugfs will report them.
518518
519−We use the 32-bit signed time value plus (2^32 \* (extra epoch bits)).
519+We use the 32-bit signed time value plus (2^32 * (extra epoch bits)).
520520 In other words:
521521
522522 .. list-table::
@@ -525,8 +525,8 @@ In other words: · 2 unmodified lines
525525
526526 * - Extra epoch bits
527527 - MSB of 32-bit time
528− - Adjustment for signed 32-bit to 64-bit tv\_sec
529− - Decoded 64-bit tv\_sec
528+ - Adjustment for signed 32-bit to 64-bit tv_sec
529+ - Decoded 64-bit tv_sec
530530 - valid time range
531531 * - 0 0
532532 - 1
Documentation/filesystems/ext4/journal.rst+107−107
@@ -63,8 +63,8 @@ Generally speaking, the journal has this format: · 62 unmodified lines
6363 :header-rows: 1
6464
6565 * - Superblock
66− - descriptor\_block (data\_blocks or revocation\_block) [more data or
67− revocations] commmit\_block
66+ - descriptor_block (data_blocks or revocation_block) [more data or
67+ revocations] commmit_block
6868 - [more transactions...]
6969 * -
7070 - One transaction
@@ -93,8 +93,8 @@ superblock. · 22 unmodified lines
9393 * - 1024 bytes of padding
9494 - ext4 Superblock
9595 - Journal Superblock
96− - descriptor\_block (data\_blocks or revocation\_block) [more data or
97− revocations] commmit\_block
96+ - descriptor_block (data_blocks or revocation_block) [more data or
97+ revocations] commmit_block
9898 - [more transactions...]
9999 * -
100100 -
@@ -117,17 +117,17 @@ Every block in the journal starts with a common 12-byte header · 16 unmodified lines
117117 - Name
118118 - Description
119119 * - 0x0
120− - \_\_be32
121− - h\_magic
120+ - __be32
121+ - h_magic
122122 - jbd2 magic number, 0xC03B3998.
123123 * - 0x4
124− - \_\_be32
125− - h\_blocktype
124+ - __be32
125+ - h_blocktype
126126 - Description of what this block contains. See the jbd2_blocktype_ table
127127 below.
128128 * - 0x8
129− - \_\_be32
130− - h\_sequence
129+ - __be32
130+ - h_sequence
131131 - The transaction ID that goes with this block.
132132
133133 .. _jbd2_blocktype:
@@ -177,99 +177,99 @@ which is 1024 bytes long: · 43 unmodified lines
177177 -
178178 - Static information describing the journal.
179179 * - 0x0
180− - journal\_header\_t (12 bytes)
181− - s\_header
180+ - journal_header_t (12 bytes)
181+ - s_header
182182 - Common header identifying this as a superblock.
183183 * - 0xC
184− - \_\_be32
185− - s\_blocksize
184+ - __be32
185+ - s_blocksize
186186 - Journal device block size.
187187 * - 0x10
188− - \_\_be32
189− - s\_maxlen
188+ - __be32
189+ - s_maxlen
190190 - Total number of blocks in this journal.
191191 * - 0x14
192− - \_\_be32
193− - s\_first
192+ - __be32
193+ - s_first
194194 - First block of log information.
195195 * -
196196 -
197197 -
198198 - Dynamic information describing the current state of the log.
199199 * - 0x18
200− - \_\_be32
201− - s\_sequence
200+ - __be32
201+ - s_sequence
202202 - First commit ID expected in log.
203203 * - 0x1C
204− - \_\_be32
205− - s\_start
204+ - __be32
205+ - s_start
206206 - Block number of the start of log. Contrary to the comments, this field
207207 being zero does not imply that the journal is clean!
208208 * - 0x20
209− - \_\_be32
210− - s\_errno
211− - Error value, as set by jbd2\_journal\_abort().
209+ - __be32
210+ - s_errno
211+ - Error value, as set by jbd2_journal_abort().
212212 * -
213213 -
214214 -
215215 - The remaining fields are only valid in a v2 superblock.
216216 * - 0x24
217− - \_\_be32
218− - s\_feature\_compat;
217+ - __be32
218+ - s_feature_compat;
219219 - Compatible feature set. See the table jbd2_compat_ below.
220220 * - 0x28
221− - \_\_be32
222− - s\_feature\_incompat
221+ - __be32
222+ - s_feature_incompat
223223 - Incompatible feature set. See the table jbd2_incompat_ below.
224224 * - 0x2C
225− - \_\_be32
226− - s\_feature\_ro\_compat
225+ - __be32
226+ - s_feature_ro_compat
227227 - Read-only compatible feature set. There aren't any of these currently.
228228 * - 0x30
229− - \_\_u8
230− - s\_uuid[16]
229+ - __u8
230+ - s_uuid[16]
231231 - 128-bit uuid for journal. This is compared against the copy in the ext4
232232 super block at mount time.
233233 * - 0x40
234− - \_\_be32
235− - s\_nr\_users
234+ - __be32
235+ - s_nr_users
236236 - Number of file systems sharing this journal.
237237 * - 0x44
238− - \_\_be32
239− - s\_dynsuper
238+ - __be32
239+ - s_dynsuper
240240 - Location of dynamic super block copy. (Not used?)
241241 * - 0x48
242− - \_\_be32
243− - s\_max\_transaction
242+ - __be32
243+ - s_max_transaction
244244 - Limit of journal blocks per transaction. (Not used?)
245245 * - 0x4C
246− - \_\_be32
247− - s\_max\_trans\_data
246+ - __be32
247+ - s_max_trans_data
248248 - Limit of data blocks per transaction. (Not used?)
249249 * - 0x50
250− - \_\_u8
251− - s\_checksum\_type
250+ - __u8
251+ - s_checksum_type
252252 - Checksum algorithm used for the journal. See jbd2_checksum_type_ for
253253 more info.
254254 * - 0x51
255− - \_\_u8[3]
256− - s\_padding2
255+ - __u8[3]
256+ - s_padding2
257257 -
258258 * - 0x54
259− - \_\_be32
260− - s\_num\_fc\_blocks
259+ - __be32
260+ - s_num_fc_blocks
261261 - Number of fast commit blocks in the journal.
262262 * - 0x58
263− - \_\_u32
264− - s\_padding[42]
263+ - __u32
264+ - s_padding[42]
265265 -
266266 * - 0xFC
267− - \_\_be32
268− - s\_checksum
267+ - __be32
268+ - s_checksum
269269 - Checksum of the entire superblock, with this field set to zero.
270270 * - 0x100
271− - \_\_u8
272− - s\_users[16\*48]
271+ - __u8
272+ - s_users[16*48]
273273 - ids of all file systems sharing the log. e2fsprogs/Linux don't allow
274274 shared external journals, but I imagine Lustre (or ocfs2?), which use
275275 the jbd2 code, might.
@@ -286,7 +286,7 @@ The journal compat features are any combination of the following: · 10 unmodified lines
286286 - Description
287287 * - 0x1
288288 - Journal maintains checksums on the data blocks.
289− (JBD2\_FEATURE\_COMPAT\_CHECKSUM)
289+ (JBD2_FEATURE_COMPAT_CHECKSUM)
290290
291291 .. _jbd2_incompat:
292292
@@ -299,23 +299,23 @@ The journal incompat features are any combination of the following: · 6 unmodified lines
299299 * - Value
300300 - Description
301301 * - 0x1
302− - Journal has block revocation records. (JBD2\_FEATURE\_INCOMPAT\_REVOKE)
302+ - Journal has block revocation records. (JBD2_FEATURE_INCOMPAT_REVOKE)
303303 * - 0x2
304304 - Journal can deal with 64-bit block numbers.
305− (JBD2\_FEATURE\_INCOMPAT\_64BIT)
305+ (JBD2_FEATURE_INCOMPAT_64BIT)
306306 * - 0x4
307− - Journal commits asynchronously. (JBD2\_FEATURE\_INCOMPAT\_ASYNC\_COMMIT)
307+ - Journal commits asynchronously. (JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)
308308 * - 0x8
309309 - This journal uses v2 of the checksum on-disk format. Each journal
310310 metadata block gets its own checksum, and the block tags in the
311311 descriptor table contain checksums for each of the data blocks in the
312− journal. (JBD2\_FEATURE\_INCOMPAT\_CSUM\_V2)
312+ journal. (JBD2_FEATURE_INCOMPAT_CSUM_V2)
313313 * - 0x10
314314 - This journal uses v3 of the checksum on-disk format. This is the same as
315315 v2, but the journal block tag size is fixed regardless of the size of
316− block numbers. (JBD2\_FEATURE\_INCOMPAT\_CSUM\_V3)
316+ block numbers. (JBD2_FEATURE_INCOMPAT_CSUM_V3)
317317 * - 0x20
318− - Journal has fast commit blocks. (JBD2\_FEATURE\_INCOMPAT\_FAST\_COMMIT)
318+ - Journal has fast commit blocks. (JBD2_FEATURE_INCOMPAT_FAST_COMMIT)
319319
320320 .. _jbd2_checksum_type:
321321
@@ -355,11 +355,11 @@ Descriptor blocks consume at least 36 bytes, but use a full block: · 33 unmodified lines
355355 - Name
356356 - Descriptor
357357 * - 0x0
358− - journal\_header\_t
358+ - journal_header_t
359359 - (open coded)
360360 - Common block header.
361361 * - 0xC
362− - struct journal\_block\_tag\_s
362+ - struct journal_block_tag_s
363363 - open coded array[]
364364 - Enough tags either to fill up the block or to describe all the data
365365 blocks that follow this descriptor block.
@@ -367,7 +367,7 @@ Descriptor blocks consume at least 36 bytes, but use a full block: · 1 unmodified line
367367 Journal block tags have any of the following formats, depending on which
368368 journal feature and block tag flags are set.
369369
370−If JBD2\_FEATURE\_INCOMPAT\_CSUM\_V3 is set, the journal block tag is
370+If JBD2_FEATURE_INCOMPAT_CSUM_V3 is set, the journal block tag is
371371 defined as ``struct journal_block_tag3_s``, which looks like the
372372 following. The size is 16 or 32 bytes.
373373
@@ -380,24 +380,24 @@ following. The size is 16 or 32 bytes. · 6 unmodified lines
380380 - Name
381381 - Descriptor
382382 * - 0x0
383− - \_\_be32
384− - t\_blocknr
383+ - __be32
384+ - t_blocknr
385385 - Lower 32-bits of the location of where the corresponding data block
386386 should end up on disk.
387387 * - 0x4
388− - \_\_be32
389− - t\_flags
388+ - __be32
389+ - t_flags
390390 - Flags that go with the descriptor. See the table jbd2_tag_flags_ for
391391 more info.
392392 * - 0x8
393− - \_\_be32
394− - t\_blocknr\_high
393+ - __be32
394+ - t_blocknr_high
395395 - Upper 32-bits of the location of where the corresponding data block
396− should end up on disk. This is zero if JBD2\_FEATURE\_INCOMPAT\_64BIT is
396+ should end up on disk. This is zero if JBD2_FEATURE_INCOMPAT_64BIT is
397397 not enabled.
398398 * - 0xC
399− - \_\_be32
400− - t\_checksum
399+ - __be32
400+ - t_checksum
401401 - Checksum of the journal UUID, the sequence number, and the data block.
402402 * -
403403 -
@@ -433,7 +433,7 @@ The journal tag flags are any combination of the following: · 29 unmodified lines
433433 * - 0x8
434434 - This is the last tag in this descriptor block.
435435
436−If JBD2\_FEATURE\_INCOMPAT\_CSUM\_V3 is NOT set, the journal block tag
436+If JBD2_FEATURE_INCOMPAT_CSUM_V3 is NOT set, the journal block tag
437437 is defined as ``struct journal_block_tag_s``, which looks like the
438438 following. The size is 8, 12, 24, or 28 bytes:
439439
@@ -446,18 +446,18 @@ following. The size is 8, 12, 24, or 28 bytes: · 6 unmodified lines
446446 - Name
447447 - Descriptor
448448 * - 0x0
449− - \_\_be32
450− - t\_blocknr
449+ - __be32
450+ - t_blocknr
451451 - Lower 32-bits of the location of where the corresponding data block
452452 should end up on disk.
453453 * - 0x4
454− - \_\_be16
455− - t\_checksum
454+ - __be16
455+ - t_checksum
456456 - Checksum of the journal UUID, the sequence number, and the data block.
457457 Note that only the lower 16 bits are stored.
458458 * - 0x6
459− - \_\_be16
460− - t\_flags
459+ - __be16
460+ - t_flags
461461 - Flags that go with the descriptor. See the table jbd2_tag_flags_ for
462462 more info.
463463 * -
@@ -466,8 +466,8 @@ following. The size is 8, 12, 24, or 28 bytes: · 2 unmodified lines
466466 - This next field is only present if the super block indicates support for
467467 64-bit block numbers.
468468 * - 0x8
469− - \_\_be32
470− - t\_blocknr\_high
469+ - __be32
470+ - t_blocknr_high
471471 - Upper 32-bits of the location of where the corresponding data block
472472 should end up on disk.
473473 * -
@@ -483,8 +483,8 @@ following. The size is 8, 12, 24, or 28 bytes: · 9 unmodified lines
483483 ``j_uuid`` field in ``struct journal_s``, but only tune2fs touches that
484484 field.
485485
486−If JBD2\_FEATURE\_INCOMPAT\_CSUM\_V2 or
487−JBD2\_FEATURE\_INCOMPAT\_CSUM\_V3 are set, the end of the block is a
486+If JBD2_FEATURE_INCOMPAT_CSUM_V2 or
487+JBD2_FEATURE_INCOMPAT_CSUM_V3 are set, the end of the block is a
488488 ``struct jbd2_journal_block_tail``, which looks like this:
489489
490490 .. list-table::
@@ -496,8 +496,8 @@ JBD2\_FEATURE\_INCOMPAT\_CSUM\_V3 are set, the end of the block is a · 5 unmodified lines
496496 - Name
497497 - Descriptor
498498 * - 0x0
499− - \_\_be32
500− - t\_checksum
499+ - __be32
500+ - t_checksum
501501 - Checksum of the journal UUID + the descriptor block, with this field set
502502 to zero.
503503
@@ -538,25 +538,25 @@ length, but use a full block: · 34 unmodified lines
538538 - Name
539539 - Description
540540 * - 0x0
541− - journal\_header\_t
542− - r\_header
541+ - journal_header_t
542+ - r_header
543543 - Common block header.
544544 * - 0xC
545− - \_\_be32
546− - r\_count
545+ - __be32
546+ - r_count
547547 - Number of bytes used in this block.
548548 * - 0x10
549− - \_\_be32 or \_\_be64
549+ - __be32 or __be64
550550 - blocks[0]
551551 - Blocks to revoke.
552552
553−After r\_count is a linear array of block numbers that are effectively
553+After r_count is a linear array of block numbers that are effectively
554554 revoked by this transaction. The size of each block number is 8 bytes if
555555 the superblock advertises 64-bit block number support, or 4 bytes
556556 otherwise.
557557
558−If JBD2\_FEATURE\_INCOMPAT\_CSUM\_V2 or
559−JBD2\_FEATURE\_INCOMPAT\_CSUM\_V3 are set, the end of the revocation
558+If JBD2_FEATURE_INCOMPAT_CSUM_V2 or
559+JBD2_FEATURE_INCOMPAT_CSUM_V3 are set, the end of the revocation
560560 block is a ``struct jbd2_journal_revoke_tail``, which has this format:
561561
562562 .. list-table::
@@ -568,8 +568,8 @@ block is a ``struct jbd2_journal_revoke_tail``, which has this format: · 5 unmodified lines
568568 - Name
569569 - Description
570570 * - 0x0
571− - \_\_be32
572− - r\_checksum
571+ - __be32
572+ - r_checksum
573573 - Checksum of the journal UUID + revocation block
574574
575575 Commit Block
@@ -592,38 +592,38 @@ bytes long (but uses a full block): · 16 unmodified lines
592592 - Name
593593 - Descriptor
594594 * - 0x0
595− - journal\_header\_s
595+ - journal_header_s
596596 - (open coded)
597597 - Common block header.
598598 * - 0xC
599599 - unsigned char
600− - h\_chksum\_type
600+ - h_chksum_type
601601 - The type of checksum to use to verify the integrity of the data blocks
602602 in the transaction. See jbd2_checksum_type_ for more info.
603603 * - 0xD
604604 - unsigned char
605− - h\_chksum\_size
605+ - h_chksum_size
606606 - The number of bytes used by the checksum. Most likely 4.
607607 * - 0xE
608608 - unsigned char
609− - h\_padding[2]
609+ - h_padding[2]
610610 -
611611 * - 0x10
612− - \_\_be32
613− - h\_chksum[JBD2\_CHECKSUM\_BYTES]
612+ - __be32
613+ - h_chksum[JBD2_CHECKSUM_BYTES]
614614 - 32 bytes of space to store checksums. If
615− JBD2\_FEATURE\_INCOMPAT\_CSUM\_V2 or JBD2\_FEATURE\_INCOMPAT\_CSUM\_V3
615+ JBD2_FEATURE_INCOMPAT_CSUM_V2 or JBD2_FEATURE_INCOMPAT_CSUM_V3
616616 are set, the first ``__be32`` is the checksum of the journal UUID and
617617 the entire commit block, with this field zeroed. If
618− JBD2\_FEATURE\_COMPAT\_CHECKSUM is set, the first ``__be32`` is the
618+ JBD2_FEATURE_COMPAT_CHECKSUM is set, the first ``__be32`` is the
619619 crc32 of all the blocks already written to the transaction.
620620 * - 0x30
621− - \_\_be64
622− - h\_commit\_sec
621+ - __be64
622+ - h_commit_sec
623623 - The time that the transaction was committed, in seconds since the epoch.
624624 * - 0x38
625− - \_\_be32
626− - h\_commit\_nsec
625+ - __be32
626+ - h_commit_nsec
627627 - Nanoseconds component of the above timestamp.
628628
629629 Fast commits
Documentation/filesystems/ext4/mmp.rst+18−18
@@ -7,8 +7,8 @@ Multiple mount protection (MMP) is a feature that protects the · 6 unmodified lines
77 filesystem against multiple hosts trying to use the filesystem
88 simultaneously. When a filesystem is opened (for mounting, or fsck,
99 etc.), the MMP code running on the node (call it node A) checks a
10−sequence number. If the sequence number is EXT4\_MMP\_SEQ\_CLEAN, the
11−open continues. If the sequence number is EXT4\_MMP\_SEQ\_FSCK, then
10+sequence number. If the sequence number is EXT4_MMP_SEQ_CLEAN, the
11+open continues. If the sequence number is EXT4_MMP_SEQ_FSCK, then
1212 fsck is (hopefully) running, and open fails immediately. Otherwise, the
1313 open code will wait for twice the specified MMP check interval and check
1414 the sequence number again. If the sequence number has changed, then the
@@ -40,38 +40,38 @@ The MMP structure (``struct mmp_struct``) is as follows: · 25 unmodified lines
4040 - Name
4141 - Description
4242 * - 0x0
43− - \_\_le32
44− - mmp\_magic
43+ - __le32
44+ - mmp_magic
4545 - Magic number for MMP, 0x004D4D50 (“MMP”).
4646 * - 0x4
47− - \_\_le32
48− - mmp\_seq
47+ - __le32
48+ - mmp_seq
4949 - Sequence number, updated periodically.
5050 * - 0x8
51− - \_\_le64
52− - mmp\_time
51+ - __le64
52+ - mmp_time
5353 - Time that the MMP block was last updated.
5454 * - 0x10
5555 - char[64]
56− - mmp\_nodename
56+ - mmp_nodename
5757 - Hostname of the node that opened the filesystem.
5858 * - 0x50
5959 - char[32]
60− - mmp\_bdevname
60+ - mmp_bdevname
6161 - Block device name of the filesystem.
6262 * - 0x70
63− - \_\_le16
64− - mmp\_check\_interval
63+ - __le16
64+ - mmp_check_interval
6565 - The MMP re-check interval, in seconds.
6666 * - 0x72
67− - \_\_le16
68− - mmp\_pad1
67+ - __le16
68+ - mmp_pad1
6969 - Zero.
7070 * - 0x74
71− - \_\_le32[226]
72− - mmp\_pad2
71+ - __le32[226]
72+ - mmp_pad2
7373 - Zero.
7474 * - 0x3FC
75− - \_\_le32
76− - mmp\_checksum
75+ - __le32
76+ - mmp_checksum
7777 - Checksum of the MMP block.
Documentation/filesystems/ext4/overview.rst+1−1
@@ -7,7 +7,7 @@ An ext4 file system is split into a series of block groups. To reduce · 6 unmodified lines
77 performance difficulties due to fragmentation, the block allocator tries
88 very hard to keep each file's blocks within the same group, thereby
99 reducing seek times. The size of a block group is specified in
10−``sb.s_blocks_per_group`` blocks, though it can also calculated as 8 \*
10+``sb.s_blocks_per_group`` blocks, though it can also calculated as 8 *
1111 ``block_size_in_bytes``. With the default block size of 4KiB, each group
1212 will contain 32,768 blocks, for a length of 128MiB. The number of block
1313 groups is the size of the device divided by the size of a block group.
Documentation/filesystems/ext4/special_inodes.rst+4−4
@@ -34,7 +34,7 @@ ext4 reserves some inode for special features, as follows: · 33 unmodified lines
3434 * - 10
3535 - Replica inode, used for some non-upstream feature?
3636 * - 11
37− - Traditional first non-reserved inode. Usually this is the lost+found directory. See s\_first\_ino in the superblock.
37+ - Traditional first non-reserved inode. Usually this is the lost+found directory. See s_first_ino in the superblock.
3838
3939 Note that there are also some inodes allocated from non-reserved inode numbers
4040 for other filesystem features which are not referenced from standard directory
@@ -47,9 +47,9 @@ hierarchy. These are generally reference from the superblock. They are: · 6 unmodified lines
4747 * - Superblock field
4848 - Description
4949
50− * - s\_lpf\_ino
50+ * - s_lpf_ino
5151 - Inode number of lost+found directory.
52− * - s\_prj\_quota\_inum
52+ * - s_prj_quota_inum
5353 - Inode number of quota file tracking project quotas
54− * - s\_orphan\_file\_inum
54+ * - s_orphan_file_inum
5555 - Inode number of file tracking orphan inodes.
Documentation/filesystems/ext4/super.rst+275−275
@@ -7,7 +7,7 @@ The superblock records various information about the enclosing · 6 unmodified lines
77 filesystem, such as block counts, inode counts, supported features,
88 maintenance information, and more.
99
10−If the sparse\_super feature flag is set, redundant copies of the
10+If the sparse_super feature flag is set, redundant copies of the
1111 superblock and group descriptors are kept only in the groups whose group
1212 number is either 0 or a power of 3, 5, or 7. If the flag is not set,
1313 redundant copies are kept in all groups.
@@ -27,107 +27,107 @@ The ext4 superblock is laid out as follows in · 13 unmodified lines
2727 - Name
2828 - Description
2929 * - 0x0
30− - \_\_le32
31− - s\_inodes\_count
30+ - __le32
31+ - s_inodes_count
3232 - Total inode count.
3333 * - 0x4
34− - \_\_le32
35− - s\_blocks\_count\_lo
34+ - __le32
35+ - s_blocks_count_lo
3636 - Total block count.
3737 * - 0x8
38− - \_\_le32
39− - s\_r\_blocks\_count\_lo
38+ - __le32
39+ - s_r_blocks_count_lo
4040 - This number of blocks can only be allocated by the super-user.
4141 * - 0xC
42− - \_\_le32
43− - s\_free\_blocks\_count\_lo
42+ - __le32
43+ - s_free_blocks_count_lo
4444 - Free block count.
4545 * - 0x10
46− - \_\_le32
47− - s\_free\_inodes\_count
46+ - __le32
47+ - s_free_inodes_count
4848 - Free inode count.
4949 * - 0x14
50− - \_\_le32
51− - s\_first\_data\_block
50+ - __le32
51+ - s_first_data_block
5252 - First data block. This must be at least 1 for 1k-block filesystems and
5353 is typically 0 for all other block sizes.
5454 * - 0x18
55− - \_\_le32
56− - s\_log\_block\_size
57− - Block size is 2 ^ (10 + s\_log\_block\_size).
55+ - __le32
56+ - s_log_block_size
57+ - Block size is 2 ^ (10 + s_log_block_size).
5858 * - 0x1C
59− - \_\_le32
60− - s\_log\_cluster\_size
61− - Cluster size is 2 ^ (10 + s\_log\_cluster\_size) blocks if bigalloc is
62− enabled. Otherwise s\_log\_cluster\_size must equal s\_log\_block\_size.
59+ - __le32
60+ - s_log_cluster_size
61+ - Cluster size is 2 ^ (10 + s_log_cluster_size) blocks if bigalloc is
62+ enabled. Otherwise s_log_cluster_size must equal s_log_block_size.
6363 * - 0x20
64− - \_\_le32
65− - s\_blocks\_per\_group
64+ - __le32
65+ - s_blocks_per_group
6666 - Blocks per group.
6767 * - 0x24
68− - \_\_le32
69− - s\_clusters\_per\_group
68+ - __le32
69+ - s_clusters_per_group
7070 - Clusters per group, if bigalloc is enabled. Otherwise
71− s\_clusters\_per\_group must equal s\_blocks\_per\_group.
71+ s_clusters_per_group must equal s_blocks_per_group.
7272 * - 0x28
73− - \_\_le32
74− - s\_inodes\_per\_group
73+ - __le32
74+ - s_inodes_per_group
7575 - Inodes per group.
7676 * - 0x2C
77− - \_\_le32
78− - s\_mtime
77+ - __le32
78+ - s_mtime
7979 - Mount time, in seconds since the epoch.
8080 * - 0x30
81− - \_\_le32
82− - s\_wtime
81+ - __le32
82+ - s_wtime
8383 - Write time, in seconds since the epoch.
8484 * - 0x34
85− - \_\_le16
86− - s\_mnt\_count
85+ - __le16
86+ - s_mnt_count
8787 - Number of mounts since the last fsck.
8888 * - 0x36
89− - \_\_le16
90− - s\_max\_mnt\_count
89+ - __le16
90+ - s_max_mnt_count
9191 - Number of mounts beyond which a fsck is needed.
9292 * - 0x38
93− - \_\_le16
94− - s\_magic
93+ - __le16
94+ - s_magic
9595 - Magic signature, 0xEF53
9696 * - 0x3A
97− - \_\_le16
98− - s\_state
97+ - __le16
98+ - s_state
9999 - File system state. See super_state_ for more info.
100100 * - 0x3C
101− - \_\_le16
102− - s\_errors
101+ - __le16
102+ - s_errors
103103 - Behaviour when detecting errors. See super_errors_ for more info.
104104 * - 0x3E
105− - \_\_le16
106− - s\_minor\_rev\_level
105+ - __le16
106+ - s_minor_rev_level
107107 - Minor revision level.
108108 * - 0x40
109− - \_\_le32
110− - s\_lastcheck
109+ - __le32
110+ - s_lastcheck
111111 - Time of last check, in seconds since the epoch.
112112 * - 0x44
113− - \_\_le32
114− - s\_checkinterval
113+ - __le32
114+ - s_checkinterval
115115 - Maximum time between checks, in seconds.
116116 * - 0x48
117− - \_\_le32
118− - s\_creator\_os
117+ - __le32
118+ - s_creator_os
119119 - Creator OS. See the table super_creator_ for more info.
120120 * - 0x4C
121− - \_\_le32
122− - s\_rev\_level
121+ - __le32
122+ - s_rev_level
123123 - Revision level. See the table super_revision_ for more info.
124124 * - 0x50
125− - \_\_le16
126− - s\_def\_resuid
125+ - __le16
126+ - s_def_resuid
127127 - Default uid for reserved blocks.
128128 * - 0x52
129− - \_\_le16
130− - s\_def\_resgid
129+ - __le16
130+ - s_def_resgid
131131 - Default gid for reserved blocks.
132132 * -
133133 -
@@ -143,50 +143,50 @@ The ext4 superblock is laid out as follows in · 9 unmodified lines
143143 about a feature in either the compatible or incompatible feature set, it
144144 must abort and not try to meddle with things it doesn't understand...
145145 * - 0x54
146− - \_\_le32
147− - s\_first\_ino
146+ - __le32
147+ - s_first_ino
148148 - First non-reserved inode.
149149 * - 0x58
150− - \_\_le16
151− - s\_inode\_size
150+ - __le16
151+ - s_inode_size
152152 - Size of inode structure, in bytes.
153153 * - 0x5A
154− - \_\_le16
155− - s\_block\_group\_nr
154+ - __le16
155+ - s_block_group_nr
156156 - Block group # of this superblock.
157157 * - 0x5C
158− - \_\_le32
159− - s\_feature\_compat
158+ - __le32
159+ - s_feature_compat
160160 - Compatible feature set flags. Kernel can still read/write this fs even
161161 if it doesn't understand a flag; fsck should not do that. See the
162162 super_compat_ table for more info.
163163 * - 0x60
164− - \_\_le32
165− - s\_feature\_incompat
164+ - __le32
165+ - s_feature_incompat
166166 - Incompatible feature set. If the kernel or fsck doesn't understand one
167167 of these bits, it should stop. See the super_incompat_ table for more
168168 info.
169169 * - 0x64
170− - \_\_le32
171− - s\_feature\_ro\_compat
170+ - __le32
171+ - s_feature_ro_compat
172172 - Readonly-compatible feature set. If the kernel doesn't understand one of
173173 these bits, it can still mount read-only. See the super_rocompat_ table
174174 for more info.
175175 * - 0x68
176− - \_\_u8
177− - s\_uuid[16]
176+ - __u8
177+ - s_uuid[16]
178178 - 128-bit UUID for volume.
179179 * - 0x78
180180 - char
181− - s\_volume\_name[16]
181+ - s_volume_name[16]
182182 - Volume label.
183183 * - 0x88
184184 - char
185− - s\_last\_mounted[64]
185+ - s_last_mounted[64]
186186 - Directory where filesystem was last mounted.
187187 * - 0xC8
188− - \_\_le32
189− - s\_algorithm\_usage\_bitmap
188+ - __le32
189+ - s_algorithm_usage_bitmap
190190 - For compression (Not used in e2fsprogs/Linux)
191191 * -
192192 -
@@ -194,18 +194,18 @@ The ext4 superblock is laid out as follows in · 1 unmodified line
194194 - Performance hints. Directory preallocation should only happen if the
195195 EXT4_FEATURE_COMPAT_DIR_PREALLOC flag is on.
196196 * - 0xCC
197− - \_\_u8
198− - s\_prealloc\_blocks
197+ - __u8
198+ - s_prealloc_blocks
199199 - #. of blocks to try to preallocate for ... files? (Not used in
200200 e2fsprogs/Linux)
201201 * - 0xCD
202− - \_\_u8
203− - s\_prealloc\_dir\_blocks
202+ - __u8
203+ - s_prealloc_dir_blocks
204204 - #. of blocks to preallocate for directories. (Not used in
205205 e2fsprogs/Linux)
206206 * - 0xCE
207− - \_\_le16
208− - s\_reserved\_gdt\_blocks
207+ - __le16
208+ - s_reserved_gdt_blocks
209209 - Number of reserved GDT entries for future filesystem expansion.
210210 * -
211211 -
@@ -213,281 +213,281 @@ The ext4 superblock is laid out as follows in · 1 unmodified line
213213 - Journalling support is valid only if EXT4_FEATURE_COMPAT_HAS_JOURNAL is
214214 set.
215215 * - 0xD0
216− - \_\_u8
217− - s\_journal\_uuid[16]
216+ - __u8
217+ - s_journal_uuid[16]
218218 - UUID of journal superblock
219219 * - 0xE0
220− - \_\_le32
221− - s\_journal\_inum
220+ - __le32
221+ - s_journal_inum
222222 - inode number of journal file.
223223 * - 0xE4
224− - \_\_le32
225− - s\_journal\_dev
224+ - __le32
225+ - s_journal_dev
226226 - Device number of journal file, if the external journal feature flag is
227227 set.
228228 * - 0xE8
229− - \_\_le32
230− - s\_last\_orphan
229+ - __le32
230+ - s_last_orphan
231231 - Start of list of orphaned inodes to delete.
232232 * - 0xEC
233− - \_\_le32
234− - s\_hash\_seed[4]
233+ - __le32
234+ - s_hash_seed[4]
235235 - HTREE hash seed.
236236 * - 0xFC
237− - \_\_u8
238− - s\_def\_hash\_version
237+ - __u8
238+ - s_def_hash_version
239239 - Default hash algorithm to use for directory hashes. See super_def_hash_
240240 for more info.
241241 * - 0xFD
242− - \_\_u8
243− - s\_jnl\_backup\_type
244− - If this value is 0 or EXT3\_JNL\_BACKUP\_BLOCKS (1), then the
242+ - __u8
243+ - s_jnl_backup_type
244+ - If this value is 0 or EXT3_JNL_BACKUP_BLOCKS (1), then the
245245 ``s_jnl_blocks`` field contains a duplicate copy of the inode's
246246 ``i_block[]`` array and ``i_size``.
247247 * - 0xFE
248− - \_\_le16
249− - s\_desc\_size
248+ - __le16
249+ - s_desc_size
250250 - Size of group descriptors, in bytes, if the 64bit incompat feature flag
251251 is set.
252252 * - 0x100
253− - \_\_le32
254− - s\_default\_mount\_opts
253+ - __le32
254+ - s_default_mount_opts
255255 - Default mount options. See the super_mountopts_ table for more info.
256256 * - 0x104
257− - \_\_le32
258− - s\_first\_meta\_bg
259− - First metablock block group, if the meta\_bg feature is enabled.
257+ - __le32
258+ - s_first_meta_bg
259+ - First metablock block group, if the meta_bg feature is enabled.
260260 * - 0x108
261− - \_\_le32
262− - s\_mkfs\_time
261+ - __le32
262+ - s_mkfs_time
263263 - When the filesystem was created, in seconds since the epoch.
264264 * - 0x10C
265− - \_\_le32
266− - s\_jnl\_blocks[17]
265+ - __le32
266+ - s_jnl_blocks[17]
267267 - Backup copy of the journal inode's ``i_block[]`` array in the first 15
268− elements and i\_size\_high and i\_size in the 16th and 17th elements,
268+ elements and i_size_high and i_size in the 16th and 17th elements,
269269 respectively.
270270 * -
271271 -
272272 -
273273 - 64bit support is valid only if EXT4_FEATURE_COMPAT_64BIT is set.
274274 * - 0x150
275− - \_\_le32
276− - s\_blocks\_count\_hi
275+ - __le32
276+ - s_blocks_count_hi
277277 - High 32-bits of the block count.
278278 * - 0x154
279− - \_\_le32
280− - s\_r\_blocks\_count\_hi
279+ - __le32
280+ - s_r_blocks_count_hi
281281 - High 32-bits of the reserved block count.
282282 * - 0x158
283− - \_\_le32
284− - s\_free\_blocks\_count\_hi
283+ - __le32
284+ - s_free_blocks_count_hi
285285 - High 32-bits of the free block count.
286286 * - 0x15C
287− - \_\_le16
288− - s\_min\_extra\_isize
287+ - __le16
288+ - s_min_extra_isize
289289 - All inodes have at least # bytes.
290290 * - 0x15E
291− - \_\_le16
292− - s\_want\_extra\_isize
291+ - __le16
292+ - s_want_extra_isize
293293 - New inodes should reserve # bytes.
294294 * - 0x160
295− - \_\_le32
296− - s\_flags
295+ - __le32
296+ - s_flags
297297 - Miscellaneous flags. See the super_flags_ table for more info.
298298 * - 0x164
299− - \_\_le16
300− - s\_raid\_stride
299+ - __le16
300+ - s_raid_stride
301301 - RAID stride. This is the number of logical blocks read from or written
302302 to the disk before moving to the next disk. This affects the placement
303303 of filesystem metadata, which will hopefully make RAID storage faster.
304304 * - 0x166
305− - \_\_le16
306− - s\_mmp\_interval
305+ - __le16
306+ - s_mmp_interval
307307 - #. seconds to wait in multi-mount prevention (MMP) checking. In theory,
308308 MMP is a mechanism to record in the superblock which host and device
309309 have mounted the filesystem, in order to prevent multiple mounts. This
310310 feature does not seem to be implemented...
311311 * - 0x168
312− - \_\_le64
313− - s\_mmp\_block
312+ - __le64
313+ - s_mmp_block
314314 - Block # for multi-mount protection data.
315315 * - 0x170
316− - \_\_le32
317− - s\_raid\_stripe\_width
316+ - __le32
317+ - s_raid_stripe_width
318318 - RAID stripe width. This is the number of logical blocks read from or
319319 written to the disk before coming back to the current disk. This is used
320320 by the block allocator to try to reduce the number of read-modify-write
321321 operations in a RAID5/6.
322322 * - 0x174
323− - \_\_u8
324− - s\_log\_groups\_per\_flex
323+ - __u8
324+ - s_log_groups_per_flex
325325 - Size of a flexible block group is 2 ^ ``s_log_groups_per_flex``.
326326 * - 0x175
327− - \_\_u8
328− - s\_checksum\_type
327+ - __u8
328+ - s_checksum_type
329329 - Metadata checksum algorithm type. The only valid value is 1 (crc32c).
330330 * - 0x176
331− - \_\_le16
332− - s\_reserved\_pad
331+ - __le16
332+ - s_reserved_pad
333333 -
334334 * - 0x178
335− - \_\_le64
336− - s\_kbytes\_written
335+ - __le64
336+ - s_kbytes_written
337337 - Number of KiB written to this filesystem over its lifetime.
338338 * - 0x180
339− - \_\_le32
340− - s\_snapshot\_inum
339+ - __le32
340+ - s_snapshot_inum
341341 - inode number of active snapshot. (Not used in e2fsprogs/Linux.)
342342 * - 0x184
343− - \_\_le32
344− - s\_snapshot\_id
343+ - __le32
344+ - s_snapshot_id
345345 - Sequential ID of active snapshot. (Not used in e2fsprogs/Linux.)
346346 * - 0x188
347− - \_\_le64
348− - s\_snapshot\_r\_blocks\_count
347+ - __le64
348+ - s_snapshot_r_blocks_count
349349 - Number of blocks reserved for active snapshot's future use. (Not used in
350350 e2fsprogs/Linux.)
351351 * - 0x190
352− - \_\_le32
353− - s\_snapshot\_list
352+ - __le32
353+ - s_snapshot_list
354354 - inode number of the head of the on-disk snapshot list. (Not used in
355355 e2fsprogs/Linux.)
356356 * - 0x194
357− - \_\_le32
358− - s\_error\_count
357+ - __le32
358+ - s_error_count
359359 - Number of errors seen.
360360 * - 0x198
361− - \_\_le32
362− - s\_first\_error\_time
361+ - __le32
362+ - s_first_error_time
363363 - First time an error happened, in seconds since the epoch.
364364 * - 0x19C
365− - \_\_le32
366− - s\_first\_error\_ino
365+ - __le32
366+ - s_first_error_ino
367367 - inode involved in first error.
368368 * - 0x1A0
369− - \_\_le64
370− - s\_first\_error\_block
369+ - __le64
370+ - s_first_error_block
371371 - Number of block involved of first error.
372372 * - 0x1A8
373− - \_\_u8
374− - s\_first\_error\_func[32]
373+ - __u8
374+ - s_first_error_func[32]
375375 - Name of function where the error happened.
376376 * - 0x1C8
377− - \_\_le32
378− - s\_first\_error\_line
377+ - __le32
378+ - s_first_error_line
379379 - Line number where error happened.
380380 * - 0x1CC
381− - \_\_le32
382− - s\_last\_error\_time
381+ - __le32
382+ - s_last_error_time
383383 - Time of most recent error, in seconds since the epoch.
384384 * - 0x1D0
385− - \_\_le32
386− - s\_last\_error\_ino
385+ - __le32
386+ - s_last_error_ino
387387 - inode involved in most recent error.
388388 * - 0x1D4
389− - \_\_le32
390− - s\_last\_error\_line
389+ - __le32
390+ - s_last_error_line
391391 - Line number where most recent error happened.
392392 * - 0x1D8
393− - \_\_le64
394− - s\_last\_error\_block
393+ - __le64
394+ - s_last_error_block
395395 - Number of block involved in most recent error.
396396 * - 0x1E0
397− - \_\_u8
398− - s\_last\_error\_func[32]
397+ - __u8
398+ - s_last_error_func[32]
399399 - Name of function where the most recent error happened.
400400 * - 0x200
401− - \_\_u8
402− - s\_mount\_opts[64]
401+ - __u8
402+ - s_mount_opts[64]
403403 - ASCIIZ string of mount options.
404404 * - 0x240
405− - \_\_le32
406− - s\_usr\_quota\_inum
405+ - __le32
406+ - s_usr_quota_inum
407407 - Inode number of user `quota <quota>`__ file.
408408 * - 0x244
409− - \_\_le32
410− - s\_grp\_quota\_inum
409+ - __le32
410+ - s_grp_quota_inum
411411 - Inode number of group `quota <quota>`__ file.
412412 * - 0x248
413− - \_\_le32
414− - s\_overhead\_blocks
413+ - __le32
414+ - s_overhead_blocks
415415 - Overhead blocks/clusters in fs. (Huh? This field is always zero, which
416416 means that the kernel calculates it dynamically.)
417417 * - 0x24C
418− - \_\_le32
419− - s\_backup\_bgs[2]
420− - Block groups containing superblock backups (if sparse\_super2)
418+ - __le32
419+ - s_backup_bgs[2]
420+ - Block groups containing superblock backups (if sparse_super2)
421421 * - 0x254
422− - \_\_u8
423− - s\_encrypt\_algos[4]
422+ - __u8
423+ - s_encrypt_algos[4]
424424 - Encryption algorithms in use. There can be up to four algorithms in use
425425 at any time; valid algorithm codes are given in the super_encrypt_ table
426426 below.
427427 * - 0x258
428− - \_\_u8
429− - s\_encrypt\_pw\_salt[16]
428+ - __u8
429+ - s_encrypt_pw_salt[16]
430430 - Salt for the string2key algorithm for encryption.
431431 * - 0x268
432− - \_\_le32
433− - s\_lpf\_ino
432+ - __le32
433+ - s_lpf_ino
434434 - Inode number of lost+found
435435 * - 0x26C
436− - \_\_le32
437− - s\_prj\_quota\_inum
436+ - __le32
437+ - s_prj_quota_inum
438438 - Inode that tracks project quotas.
439439 * - 0x270
440− - \_\_le32
441− - s\_checksum\_seed
442− - Checksum seed used for metadata\_csum calculations. This value is
443− crc32c(~0, $orig\_fs\_uuid).
440+ - __le32
441+ - s_checksum_seed
442+ - Checksum seed used for metadata_csum calculations. This value is
443+ crc32c(~0, $orig_fs_uuid).
444444 * - 0x274
445− - \_\_u8
446− - s\_wtime_hi
445+ - __u8
446+ - s_wtime_hi
447447 - Upper 8 bits of the s_wtime field.
448448 * - 0x275
449− - \_\_u8
450− - s\_mtime_hi
449+ - __u8
450+ - s_mtime_hi
451451 - Upper 8 bits of the s_mtime field.
452452 * - 0x276
453− - \_\_u8
454− - s\_mkfs_time_hi
453+ - __u8
454+ - s_mkfs_time_hi
455455 - Upper 8 bits of the s_mkfs_time field.
456456 * - 0x277
457− - \_\_u8
458− - s\_lastcheck_hi
457+ - __u8
458+ - s_lastcheck_hi
459459 - Upper 8 bits of the s_lastcheck_hi field.
460460 * - 0x278
461− - \_\_u8
462− - s\_first_error_time_hi
461+ - __u8
462+ - s_first_error_time_hi
463463 - Upper 8 bits of the s_first_error_time_hi field.
464464 * - 0x279
465− - \_\_u8
466− - s\_last_error_time_hi
465+ - __u8
466+ - s_last_error_time_hi
467467 - Upper 8 bits of the s_last_error_time_hi field.
468468 * - 0x27A
469− - \_\_u8
470− - s\_pad[2]
469+ - __u8
470+ - s_pad[2]
471471 - Zero padding.
472472 * - 0x27C
473− - \_\_le16
474− - s\_encoding
473+ - __le16
474+ - s_encoding
475475 - Filename charset encoding.
476476 * - 0x27E
477− - \_\_le16
478− - s\_encoding_flags
477+ - __le16
478+ - s_encoding_flags
479479 - Filename charset encoding flags.
480480 * - 0x280
481− - \_\_le32
482− - s\_orphan\_file\_inum
481+ - __le32
482+ - s_orphan_file_inum
483483 - Orphan file inode number.
484484 * - 0x284
485− - \_\_le32
486− - s\_reserved[94]
485+ - __le32
486+ - s_reserved[94]
487487 - Padding to the end of the block.
488488 * - 0x3FC
489− - \_\_le32
490− - s\_checksum
489+ - __le32
490+ - s_checksum
491491 - Superblock checksum.
492492
493493 .. _super_state:
@@ -574,44 +574,44 @@ following: · 80 unmodified lines
574574 * - Value
575575 - Description
576576 * - 0x1
577− - Directory preallocation (COMPAT\_DIR\_PREALLOC).
577+ - Directory preallocation (COMPAT_DIR_PREALLOC).
578578 * - 0x2
579579 - “imagic inodes”. Not clear from the code what this does
580− (COMPAT\_IMAGIC\_INODES).
580+ (COMPAT_IMAGIC_INODES).
581581 * - 0x4
582− - Has a journal (COMPAT\_HAS\_JOURNAL).
582+ - Has a journal (COMPAT_HAS_JOURNAL).
583583 * - 0x8
584− - Supports extended attributes (COMPAT\_EXT\_ATTR).
584+ - Supports extended attributes (COMPAT_EXT_ATTR).
585585 * - 0x10
586586 - Has reserved GDT blocks for filesystem expansion
587− (COMPAT\_RESIZE\_INODE). Requires RO\_COMPAT\_SPARSE\_SUPER.
587+ (COMPAT_RESIZE_INODE). Requires RO_COMPAT_SPARSE_SUPER.
588588 * - 0x20
589− - Has directory indices (COMPAT\_DIR\_INDEX).
589+ - Has directory indices (COMPAT_DIR_INDEX).
590590 * - 0x40
591591 - “Lazy BG”. Not in Linux kernel, seems to have been for uninitialized
592− block groups? (COMPAT\_LAZY\_BG)
592+ block groups? (COMPAT_LAZY_BG)
593593 * - 0x80
594− - “Exclude inode”. Not used. (COMPAT\_EXCLUDE\_INODE).
594+ - “Exclude inode”. Not used. (COMPAT_EXCLUDE_INODE).
595595 * - 0x100
596596 - “Exclude bitmap”. Seems to be used to indicate the presence of
597597 snapshot-related exclude bitmaps? Not defined in kernel or used in
598− e2fsprogs (COMPAT\_EXCLUDE\_BITMAP).
598+ e2fsprogs (COMPAT_EXCLUDE_BITMAP).
599599 * - 0x200
600− - Sparse Super Block, v2. If this flag is set, the SB field s\_backup\_bgs
600+ - Sparse Super Block, v2. If this flag is set, the SB field s_backup_bgs
601601 points to the two block groups that contain backup superblocks
602− (COMPAT\_SPARSE\_SUPER2).
602+ (COMPAT_SPARSE_SUPER2).
603603 * - 0x400
604604 - Fast commits supported. Although fast commits blocks are
605605 backward incompatible, fast commit blocks are not always
606606 present in the journal. If fast commit blocks are present in
607607 the journal, JBD2 incompat feature
608− (JBD2\_FEATURE\_INCOMPAT\_FAST\_COMMIT) gets
609− set (COMPAT\_FAST\_COMMIT).
608+ (JBD2_FEATURE_INCOMPAT_FAST_COMMIT) gets
609+ set (COMPAT_FAST_COMMIT).
610610 * - 0x1000
611611 - Orphan file allocated. This is the special file for more efficient
612612 tracking of unlinked but still open inodes. When there may be any
613613 entries in the file, we additionally set proper rocompat feature
614− (RO\_COMPAT\_ORPHAN\_PRESENT).
614+ (RO_COMPAT_ORPHAN_PRESENT).
615615
616616 .. _super_incompat:
617617
@@ -625,45 +625,45 @@ following: · 7 unmodified lines
625625 * - Value
626626 - Description
627627 * - 0x1
628− - Compression (INCOMPAT\_COMPRESSION).
628+ - Compression (INCOMPAT_COMPRESSION).
629629 * - 0x2
630− - Directory entries record the file type. See ext4\_dir\_entry\_2 below
631− (INCOMPAT\_FILETYPE).
630+ - Directory entries record the file type. See ext4_dir_entry_2 below
631+ (INCOMPAT_FILETYPE).
632632 * - 0x4
633− - Filesystem needs recovery (INCOMPAT\_RECOVER).
633+ - Filesystem needs recovery (INCOMPAT_RECOVER).
634634 * - 0x8
635− - Filesystem has a separate journal device (INCOMPAT\_JOURNAL\_DEV).
635+ - Filesystem has a separate journal device (INCOMPAT_JOURNAL_DEV).
636636 * - 0x10
637637 - Meta block groups. See the earlier discussion of this feature
638− (INCOMPAT\_META\_BG).
638+ (INCOMPAT_META_BG).
639639 * - 0x40
640− - Files in this filesystem use extents (INCOMPAT\_EXTENTS).
640+ - Files in this filesystem use extents (INCOMPAT_EXTENTS).
641641 * - 0x80
642− - Enable a filesystem size of 2^64 blocks (INCOMPAT\_64BIT).
642+ - Enable a filesystem size of 2^64 blocks (INCOMPAT_64BIT).
643643 * - 0x100
644− - Multiple mount protection (INCOMPAT\_MMP).
644+ - Multiple mount protection (INCOMPAT_MMP).
645645 * - 0x200
646646 - Flexible block groups. See the earlier discussion of this feature
647− (INCOMPAT\_FLEX\_BG).
647+ (INCOMPAT_FLEX_BG).
648648 * - 0x400
649649 - Inodes can be used to store large extended attribute values
650− (INCOMPAT\_EA\_INODE).
650+ (INCOMPAT_EA_INODE).
651651 * - 0x1000
652− - Data in directory entry (INCOMPAT\_DIRDATA). (Not implemented?)
652+ - Data in directory entry (INCOMPAT_DIRDATA). (Not implemented?)
653653 * - 0x2000
654654 - Metadata checksum seed is stored in the superblock. This feature enables
655− the administrator to change the UUID of a metadata\_csum filesystem
655+ the administrator to change the UUID of a metadata_csum filesystem
656656 while the filesystem is mounted; without it, the checksum definition
657− requires all metadata blocks to be rewritten (INCOMPAT\_CSUM\_SEED).
657+ requires all metadata blocks to be rewritten (INCOMPAT_CSUM_SEED).
658658 * - 0x4000
659− - Large directory >2GB or 3-level htree (INCOMPAT\_LARGEDIR). Prior to
659+ - Large directory >2GB or 3-level htree (INCOMPAT_LARGEDIR). Prior to
660660 this feature, directories could not be larger than 4GiB and could not
661661 have an htree more than 2 levels deep. If this feature is enabled,
662662 directories can be larger than 4GiB and have a maximum htree depth of 3.
663663 * - 0x8000
664− - Data in inode (INCOMPAT\_INLINE\_DATA).
664+ - Data in inode (INCOMPAT_INLINE_DATA).
665665 * - 0x10000
666− - Encrypted inodes are present on the filesystem. (INCOMPAT\_ENCRYPT).
666+ - Encrypted inodes are present on the filesystem. (INCOMPAT_ENCRYPT).
667667
668668 .. _super_rocompat:
669669
@@ -678,54 +678,54 @@ the following: · 8 unmodified lines
678678 - Description
679679 * - 0x1
680680 - Sparse superblocks. See the earlier discussion of this feature
681− (RO\_COMPAT\_SPARSE\_SUPER).
681+ (RO_COMPAT_SPARSE_SUPER).
682682 * - 0x2
683683 - This filesystem has been used to store a file greater than 2GiB
684− (RO\_COMPAT\_LARGE\_FILE).
684+ (RO_COMPAT_LARGE_FILE).
685685 * - 0x4
686− - Not used in kernel or e2fsprogs (RO\_COMPAT\_BTREE\_DIR).
686+ - Not used in kernel or e2fsprogs (RO_COMPAT_BTREE_DIR).
687687 * - 0x8
688688 - This filesystem has files whose sizes are represented in units of
689689 logical blocks, not 512-byte sectors. This implies a very large file
690− indeed! (RO\_COMPAT\_HUGE\_FILE)
690+ indeed! (RO_COMPAT_HUGE_FILE)
691691 * - 0x10
692692 - Group descriptors have checksums. In addition to detecting corruption,
693693 this is useful for lazy formatting with uninitialized groups
694− (RO\_COMPAT\_GDT\_CSUM).
694+ (RO_COMPAT_GDT_CSUM).
695695 * - 0x20
696696 - Indicates that the old ext3 32,000 subdirectory limit no longer applies
697− (RO\_COMPAT\_DIR\_NLINK). A directory's i\_links\_count will be set to 1
697+ (RO_COMPAT_DIR_NLINK). A directory's i_links_count will be set to 1
698698 if it is incremented past 64,999.
699699 * - 0x40
700700 - Indicates that large inodes exist on this filesystem
701− (RO\_COMPAT\_EXTRA\_ISIZE).
701+ (RO_COMPAT_EXTRA_ISIZE).
702702 * - 0x80
703− - This filesystem has a snapshot (RO\_COMPAT\_HAS\_SNAPSHOT).
703+ - This filesystem has a snapshot (RO_COMPAT_HAS_SNAPSHOT).
704704 * - 0x100
705− - `Quota <Quota>`__ (RO\_COMPAT\_QUOTA).
705+ - `Quota <Quota>`__ (RO_COMPAT_QUOTA).
706706 * - 0x200
707707 - This filesystem supports “bigalloc”, which means that file extents are
708708 tracked in units of clusters (of blocks) instead of blocks
709− (RO\_COMPAT\_BIGALLOC).
709+ (RO_COMPAT_BIGALLOC).
710710 * - 0x400
711711 - This filesystem supports metadata checksumming.
712− (RO\_COMPAT\_METADATA\_CSUM; implies RO\_COMPAT\_GDT\_CSUM, though
713− GDT\_CSUM must not be set)
712+ (RO_COMPAT_METADATA_CSUM; implies RO_COMPAT_GDT_CSUM, though
713+ GDT_CSUM must not be set)
714714 * - 0x800
715715 - Filesystem supports replicas. This feature is neither in the kernel nor
716− e2fsprogs. (RO\_COMPAT\_REPLICA)
716+ e2fsprogs. (RO_COMPAT_REPLICA)
717717 * - 0x1000
718718 - Read-only filesystem image; the kernel will not mount this image
719719 read-write and most tools will refuse to write to the image.
720− (RO\_COMPAT\_READONLY)
720+ (RO_COMPAT_READONLY)
721721 * - 0x2000
722− - Filesystem tracks project quotas. (RO\_COMPAT\_PROJECT)
722+ - Filesystem tracks project quotas. (RO_COMPAT_PROJECT)
723723 * - 0x8000
724− - Verity inodes may be present on the filesystem. (RO\_COMPAT\_VERITY)
724+ - Verity inodes may be present on the filesystem. (RO_COMPAT_VERITY)
725725 * - 0x10000
726726 - Indicates orphan file may have valid orphan entries and thus we need
727727 to clean them up when mounting the filesystem
728− (RO\_COMPAT\_ORPHAN\_PRESENT).
728+ (RO_COMPAT_ORPHAN_PRESENT).
729729
730730 .. _super_def_hash:
731731
@@ -761,36 +761,36 @@ The ``s_default_mount_opts`` field is any combination of the following: · 29 unmodified lines
761761 * - Value
762762 - Description
763763 * - 0x0001
764− - Print debugging info upon (re)mount. (EXT4\_DEFM\_DEBUG)
764+ - Print debugging info upon (re)mount. (EXT4_DEFM_DEBUG)
765765 * - 0x0002
766766 - New files take the gid of the containing directory (instead of the fsgid
767− of the current process). (EXT4\_DEFM\_BSDGROUPS)
767+ of the current process). (EXT4_DEFM_BSDGROUPS)
768768 * - 0x0004
769− - Support userspace-provided extended attributes. (EXT4\_DEFM\_XATTR\_USER)
769+ - Support userspace-provided extended attributes. (EXT4_DEFM_XATTR_USER)
770770 * - 0x0008
771− - Support POSIX access control lists (ACLs). (EXT4\_DEFM\_ACL)
771+ - Support POSIX access control lists (ACLs). (EXT4_DEFM_ACL)
772772 * - 0x0010
773− - Do not support 32-bit UIDs. (EXT4\_DEFM\_UID16)
773+ - Do not support 32-bit UIDs. (EXT4_DEFM_UID16)
774774 * - 0x0020
775775 - All data and metadata are commited to the journal.
776− (EXT4\_DEFM\_JMODE\_DATA)
776+ (EXT4_DEFM_JMODE_DATA)
777777 * - 0x0040
778778 - All data are flushed to the disk before metadata are committed to the
779− journal. (EXT4\_DEFM\_JMODE\_ORDERED)
779+ journal. (EXT4_DEFM_JMODE_ORDERED)
780780 * - 0x0060
781781 - Data ordering is not preserved; data may be written after the metadata
782− has been written. (EXT4\_DEFM\_JMODE\_WBACK)
782+ has been written. (EXT4_DEFM_JMODE_WBACK)
783783 * - 0x0100
784− - Disable write flushes. (EXT4\_DEFM\_NOBARRIER)
784+ - Disable write flushes. (EXT4_DEFM_NOBARRIER)
785785 * - 0x0200
786786 - Track which blocks in a filesystem are metadata and therefore should not
787787 be used as data blocks. This option will be enabled by default on 3.18,
788− hopefully. (EXT4\_DEFM\_BLOCK\_VALIDITY)
788+ hopefully. (EXT4_DEFM_BLOCK_VALIDITY)
789789 * - 0x0400
790790 - Enable DISCARD support, where the storage device is told about blocks
791− becoming unused. (EXT4\_DEFM\_DISCARD)
791+ becoming unused. (EXT4_DEFM_DISCARD)
792792 * - 0x0800
793− - Disable delayed allocation. (EXT4\_DEFM\_NODELALLOC)
793+ - Disable delayed allocation. (EXT4_DEFM_NODELALLOC)
794794
795795 .. _super_flags:
796796
@@ -820,12 +820,12 @@ The ``s_encrypt_algos`` list can contain any of the following: · 23 unmodified lines
820820 * - Value
821821 - Description
822822 * - 0
823− - Invalid algorithm (ENCRYPTION\_MODE\_INVALID).
823+ - Invalid algorithm (ENCRYPTION_MODE_INVALID).
824824 * - 1
825− - 256-bit AES in XTS mode (ENCRYPTION\_MODE\_AES\_256\_XTS).
825+ - 256-bit AES in XTS mode (ENCRYPTION_MODE_AES_256_XTS).
826826 * - 2
827− - 256-bit AES in GCM mode (ENCRYPTION\_MODE\_AES\_256\_GCM).
827+ - 256-bit AES in GCM mode (ENCRYPTION_MODE_AES_256_GCM).
828828 * - 3
829− - 256-bit AES in CBC mode (ENCRYPTION\_MODE\_AES\_256\_CBC).
829+ - 256-bit AES in CBC mode (ENCRYPTION_MODE_AES_256_CBC).
830830
831831 Total size of the superblock is 1024 bytes.
Documentation/kbuild/llvm.rst+8−2
@@ -129,18 +129,24 @@ yet. Bug reports are always welcome at the issue tracker below! · 128 unmodified lines
129129 * - arm64
130130 - Supported
131131 - ``LLVM=1``
132+ * - hexagon
133+ - Maintained
134+ - ``LLVM=1``
132135 * - mips
133136 - Maintained
134− - ``CC=clang``
137+ - ``LLVM=1``
135138 * - powerpc
136139 - Maintained
137140 - ``CC=clang``
138141 * - riscv
139142 - Maintained
140− - ``CC=clang``
143+ - ``LLVM=1``
141144 * - s390
142145 - Maintained
143146 - ``CC=clang``
147+ * - um (User Mode)
148+ - Maintained
149+ - ``LLVM=1``
144150 * - x86
145151 - Supported
146152 - ``LLVM=1``
Documentation/loongarch/introduction.rst+9−6
@@ -45,10 +45,12 @@ Name Alias Usage Preserved · 44 unmodified lines
4545 ``$r23``-``$r31`` ``$s0``-``$s8`` Static registers Yes
4646 ================= =============== =================== ============
4747
48−Note: The register ``$r21`` is reserved in the ELF psABI, but used by the Linux
49−kernel for storing the percpu base address. It normally has no ABI name, but is
50−called ``$u0`` in the kernel. You may also see ``$v0`` or ``$v1`` in some old code,
51−however they are deprecated aliases of ``$a0`` and ``$a1`` respectively.
48+.. Note::
49+ The register ``$r21`` is reserved in the ELF psABI, but used by the Linux
50+ kernel for storing the percpu base address. It normally has no ABI name,
51+ but is called ``$u0`` in the kernel. You may also see ``$v0`` or ``$v1``
52+ in some old code,however they are deprecated aliases of ``$a0`` and ``$a1``
53+ respectively.
5254
5355 FPRs
5456 ----
@@ -69,8 +71,9 @@ Name Alias Usage Preserved · 14 unmodified lines
6971 ``$f24``-``$f31`` ``$fs0``-``$fs7`` Static registers Yes
7072 ================= ================== =================== ============
7173
72−Note: You may see ``$fv0`` or ``$fv1`` in some old code, however they are deprecated
73−aliases of ``$fa0`` and ``$fa1`` respectively.
74+.. Note::
75+ You may see ``$fv0`` or ``$fv1`` in some old code, however they are
76+ deprecated aliases of ``$fa0`` and ``$fa1`` respectively.
7477
7578 VRs
7679 ----
Documentation/loongarch/irq-chip-model.rst+13−9
@@ -145,12 +145,16 @@ Documentation of Loongson's LS7A chipset: · 144 unmodified lines
145145
146146 https://github.com/loongson/LoongArch-Documentation/releases/latest/download/Loongson-7A1000-usermanual-2.00-EN.pdf (in English)
147147
148−Note: CPUINTC is CSR.ECFG/CSR.ESTAT and its interrupt controller described
149−in Section 7.4 of "LoongArch Reference Manual, Vol 1"; LIOINTC is "Legacy I/O
150−Interrupts" described in Section 11.1 of "Loongson 3A5000 Processor Reference
151−Manual"; EIOINTC is "Extended I/O Interrupts" described in Section 11.2 of
152−"Loongson 3A5000 Processor Reference Manual"; HTVECINTC is "HyperTransport
153−Interrupts" described in Section 14.3 of "Loongson 3A5000 Processor Reference
154−Manual"; PCH-PIC/PCH-MSI is "Interrupt Controller" described in Section 5 of
155−"Loongson 7A1000 Bridge User Manual"; PCH-LPC is "LPC Interrupts" described in
156−Section 24.3 of "Loongson 7A1000 Bridge User Manual".
148+.. Note::
149+ - CPUINTC is CSR.ECFG/CSR.ESTAT and its interrupt controller described
150+ in Section 7.4 of "LoongArch Reference Manual, Vol 1";
151+ - LIOINTC is "Legacy I/OInterrupts" described in Section 11.1 of
152+ "Loongson 3A5000 Processor Reference Manual";
153+ - EIOINTC is "Extended I/O Interrupts" described in Section 11.2 of
154+ "Loongson 3A5000 Processor Reference Manual";
155+ - HTVECINTC is "HyperTransport Interrupts" described in Section 14.3 of
156+ "Loongson 3A5000 Processor Reference Manual";
157+ - PCH-PIC/PCH-MSI is "Interrupt Controller" described in Section 5 of
158+ "Loongson 7A1000 Bridge User Manual";
159+ - PCH-LPC is "LPC Interrupts" described in Section 24.3 of
160+ "Loongson 7A1000 Bridge User Manual".
Documentation/networking/ip-sysctl.rst+37−0
@@ -2925,6 +2925,43 @@ plpmtud_probe_interval - INTEGER · 2924 unmodified lines
29252925
29262926 Default: 0
29272927
2928+reconf_enable - BOOLEAN
2929+ Enable or disable extension of Stream Reconfiguration functionality
2930+ specified in RFC6525. This extension provides the ability to "reset"
2931+ a stream, and it includes the Parameters of "Outgoing/Incoming SSN
2932+ Reset", "SSN/TSN Reset" and "Add Outgoing/Incoming Streams".
2933+
2934+ - 1: Enable extension.
2935+ - 0: Disable extension.
2936+
2937+ Default: 0
2938+
2939+intl_enable - BOOLEAN
2940+ Enable or disable extension of User Message Interleaving functionality
2941+ specified in RFC8260. This extension allows the interleaving of user
2942+ messages sent on different streams. With this feature enabled, I-DATA
2943+ chunk will replace DATA chunk to carry user messages if also supported
2944+ by the peer. Note that to use this feature, one needs to set this option
2945+ to 1 and also needs to set socket options SCTP_FRAGMENT_INTERLEAVE to 2
2946+ and SCTP_INTERLEAVING_SUPPORTED to 1.
2947+
2948+ - 1: Enable extension.
2949+ - 0: Disable extension.
2950+
2951+ Default: 0
2952+
2953+ecn_enable - BOOLEAN
2954+ Control use of Explicit Congestion Notification (ECN) by SCTP.
2955+ Like in TCP, ECN is used only when both ends of the SCTP connection
2956+ indicate support for it. This feature is useful in avoiding losses
2957+ due to congestion by allowing supporting routers to signal congestion
2958+ before having to drop packets.
2959+
2960+ 1: Enable ecn.
2961+ 0: Disable ecn.
2962+
2963+ Default: 1
2964+
29282965
29292966 ``/proc/sys/net/core/*``
29302967 ========================
Documentation/networking/phy.rst+1−1
@@ -104,7 +104,7 @@ Whenever possible, use the PHY side RGMII delay for these reasons: · 103 unmodified lines
104104
105105 * PHY device drivers in PHYLIB being reusable by nature, being able to
106106 configure correctly a specified delay enables more designs with similar delay
107− requirements to be operate correctly
107+ requirements to be operated correctly
108108
109109 For cases where the PHY is not capable of providing this delay, but the
110110 Ethernet MAC driver is capable of doing so, the correct phy_interface_t value
Documentation/translations/zh_CN/loongarch/introduction.rst+8−6
@@ -46,10 +46,11 @@ LA64中每个寄存器为64位宽。 ``$r0`` 的内容总是固定为0,而其 · 45 unmodified lines
4646 ``$r23``-``$r31`` ``$s0``-``$s8`` 静态寄存器 是
4747 ================= =============== =================== ==========
4848
49−注意:``$r21``寄存器在ELF psABI中保留未使用,但是在Linux内核用于保存每CPU
50−变量基地址。该寄存器没有ABI命名,不过在内核中称为``$u0``。在一些遗留代码
51−中有时可能见到``$v0``和``$v1``,它们是``$a0``和``$a1``的别名,属于已经废弃
52−的用法。
49+.. note::
50+ 注意: ``$r21`` 寄存器在ELF psABI中保留未使用,但是在Linux内核用于保
51+ 存每CPU变量基地址。该寄存器没有ABI命名,不过在内核中称为 ``$u0`` 。在
52+ 一些遗留代码中有时可能见到 ``$v0`` 和 ``$v1`` ,它们是 ``$a0`` 和
53+ ``$a1`` 的别名,属于已经废弃的用法。
5354
5455 浮点寄存器
5556 ----------
@@ -68,8 +69,9 @@ LA64中每个寄存器为64位宽。 ``$r0`` 的内容总是固定为0,而其 · 12 unmodified lines
6869 ``$f24``-``$f31`` ``$fs0``-``$fs7`` 静态寄存器 是
6970 ================= ================== =================== ==========
7071
71−注意:在一些遗留代码中有时可能见到 ``$v0`` 和 ``$v1`` ,它们是 ``$a0``
72−和 ``$a1`` 的别名,属于已经废弃的用法。
72+.. note::
73+ 注意:在一些遗留代码中有时可能见到 ``$v0`` 和 ``$v1`` ,它们是
74+ ``$a0`` 和 ``$a1`` 的别名,属于已经废弃的用法。
7375
7476
7577 向量寄存器
Documentation/translations/zh_CN/loongarch/irq-chip-model.rst+8−6
@@ -147,9 +147,11 @@ PCH-LPC:: · 146 unmodified lines
147147
148148 https://github.com/loongson/LoongArch-Documentation/releases/latest/download/Loongson-7A1000-usermanual-2.00-EN.pdf (英文版)
149149
150−注:CPUINTC即《龙芯架构参考手册卷一》第7.4节所描述的CSR.ECFG/CSR.ESTAT寄存器及其中断
151−控制逻辑;LIOINTC即《龙芯3A5000处理器使用手册》第11.1节所描述的“传统I/O中断”;EIOINTC
152−即《龙芯3A5000处理器使用手册》第11.2节所描述的“扩展I/O中断”;HTVECINTC即《龙芯3A5000
153−处理器使用手册》第14.3节所描述的“HyperTransport中断”;PCH-PIC/PCH-MSI即《龙芯7A1000桥
154−片用户手册》第5章所描述的“中断控制器”;PCH-LPC即《龙芯7A1000桥片用户手册》第24.3节所
155−描述的“LPC中断”。
150+.. note::
151+ - CPUINTC:即《龙芯架构参考手册卷一》第7.4节所描述的CSR.ECFG/CSR.ESTAT寄存器及其
152+ 中断控制逻辑;
153+ - LIOINTC:即《龙芯3A5000处理器使用手册》第11.1节所描述的“传统I/O中断”;
154+ - EIOINTC:即《龙芯3A5000处理器使用手册》第11.2节所描述的“扩展I/O中断”;
155+ - HTVECINTC:即《龙芯3A5000处理器使用手册》第14.3节所描述的“HyperTransport中断”;
156+ - PCH-PIC/PCH-MSI:即《龙芯7A1000桥片用户手册》第5章所描述的“中断控制器”;
157+ - PCH-LPC:即《龙芯7A1000桥片用户手册》第24.3节所描述的“LPC中断”。
Documentation/vm/hwpoison.rst+2−1
@@ -120,7 +120,8 @@ Testing · 119 unmodified lines
120120 unpoison-pfn
121121 Software-unpoison page at PFN echoed into this file. This way
122122 a page can be reused again. This only works for Linux
123− injected failures, not for real memory failures.
123+ injected failures, not for real memory failures. Once any hardware
124+ memory failure happens, this feature is disabled.
124125
125126 Note these injection interfaces are not stable and might change between
126127 kernel versions
MAINTAINERS+93−40
@@ -427,6 +427,7 @@ ACPI VIOT DRIVER · 426 unmodified lines
427427 M: Jean-Philippe Brucker <jean-philippe@linaro.org>
428428 L: linux-acpi@vger.kernel.org
429429 L: iommu@lists.linux-foundation.org
430+L: iommu@lists.linux.dev
430431 S: Maintained
431432 F: drivers/acpi/viot.c
432433 F: include/linux/acpi_viot.h
@@ -960,6 +961,7 @@ AMD IOMMU (AMD-VI) · 527 unmodified lines
960961 M: Joerg Roedel <joro@8bytes.org>
961962 R: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
962963 L: iommu@lists.linux-foundation.org
964+L: iommu@lists.linux.dev
963965 S: Maintained
964966 T: git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git
965967 F: drivers/iommu/amd/
@@ -2467,6 +2469,7 @@ ARM/NXP S32G ARCHITECTURE · 1501 unmodified lines
24672469 M: Chester Lin <clin@suse.com>
24682470 R: Andreas Färber <afaerber@suse.de>
24692471 R: Matthias Brugger <mbrugger@suse.com>
2472+R: NXP S32 Linux Team <s32@nxp.com>
24702473 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
24712474 S: Maintained
24722475 F: arch/arm64/boot/dts/freescale/s32g*.dts*
@@ -3662,7 +3665,7 @@ BPF JIT for ARM · 1189 unmodified lines
36623665 M: Shubham Bansal <illusionist.neo@gmail.com>
36633666 L: netdev@vger.kernel.org
36643667 L: bpf@vger.kernel.org
3665−S: Maintained
3668+S: Odd Fixes
36663669 F: arch/arm/net/
36673670
36683671 BPF JIT for ARM64
@@ -3686,14 +3689,15 @@ BPF JIT for NFP NICs · 17 unmodified lines
36863689 M: Jakub Kicinski <kuba@kernel.org>
36873690 L: netdev@vger.kernel.org
36883691 L: bpf@vger.kernel.org
3689−S: Supported
3692+S: Odd Fixes
36903693 F: drivers/net/ethernet/netronome/nfp/bpf/
36913694
36923695 BPF JIT for POWERPC (32-BIT AND 64-BIT)
36933696 M: Naveen N. Rao <naveen.n.rao@linux.ibm.com>
3697+M: Michael Ellerman <mpe@ellerman.id.au>
36943698 L: netdev@vger.kernel.org
36953699 L: bpf@vger.kernel.org
3696−S: Maintained
3700+S: Supported
36973701 F: arch/powerpc/net/
36983702
36993703 BPF JIT for RISC-V (32-bit)
@@ -3719,7 +3723,7 @@ M: Heiko Carstens <hca@linux.ibm.com> · 19 unmodified lines
37193723 M: Vasily Gorbik <gor@linux.ibm.com>
37203724 L: netdev@vger.kernel.org
37213725 L: bpf@vger.kernel.org
3722−S: Maintained
3726+S: Supported
37233727 F: arch/s390/net/
37243728 X: arch/s390/net/pnet.c
37253729
@@ -3727,14 +3731,14 @@ BPF JIT for SPARC (32-BIT AND 64-BIT) · 1 unmodified line
37273731 M: David S. Miller <davem@davemloft.net>
37283732 L: netdev@vger.kernel.org
37293733 L: bpf@vger.kernel.org
3730−S: Maintained
3734+S: Odd Fixes
37313735 F: arch/sparc/net/
37323736
37333737 BPF JIT for X86 32-BIT
37343738 M: Wang YanQing <udknight@gmail.com>
37353739 L: netdev@vger.kernel.org
37363740 L: bpf@vger.kernel.org
3737−S: Maintained
3741+S: Odd Fixes
37383742 F: arch/x86/net/bpf_jit_comp32.c
37393743
37403744 BPF JIT for X86 64-BIT
@@ -3757,6 +3761,19 @@ F: include/linux/bpf_lsm.h · 16 unmodified lines
37573761 F: kernel/bpf/bpf_lsm.c
37583762 F: security/bpf/
37593763
3764+BPF L7 FRAMEWORK
3765+M: John Fastabend <john.fastabend@gmail.com>
3766+M: Jakub Sitnicki <jakub@cloudflare.com>
3767+L: netdev@vger.kernel.org
3768+L: bpf@vger.kernel.org
3769+S: Maintained
3770+F: include/linux/skmsg.h
3771+F: net/core/skmsg.c
3772+F: net/core/sock_map.c
3773+F: net/ipv4/tcp_bpf.c
3774+F: net/ipv4/udp_bpf.c
3775+F: net/unix/unix_bpf.c
3776+
37603777 BPFTOOL
37613778 M: Quentin Monnet <quentin@isovalent.com>
37623779 L: bpf@vger.kernel.org
@@ -3796,12 +3813,12 @@ N: bcmbca · 33 unmodified lines
37963813 N: bcm[9]?47622
37973814
37983815 BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE
3799−M: Nicolas Saenz Julienne <nsaenz@kernel.org>
3816+M: Florian Fainelli <f.fainelli@gmail.com>
38003817 R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
38013818 L: linux-rpi-kernel@lists.infradead.org (moderated for non-subscribers)
38023819 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
38033820 S: Maintained
3804−T: git git://git.kernel.org/pub/scm/linux/kernel/git/nsaenz/linux-rpi.git
3821+T: git git://github.com/broadcom/stblinux.git
38053822 F: Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml
38063823 F: drivers/pci/controller/pcie-brcmstb.c
38073824 F: drivers/staging/vc04_services
@@ -5962,6 +5979,7 @@ M: Christoph Hellwig <hch@lst.de> · 2154 unmodified lines
59625979 M: Marek Szyprowski <m.szyprowski@samsung.com>
59635980 R: Robin Murphy <robin.murphy@arm.com>
59645981 L: iommu@lists.linux-foundation.org
5982+L: iommu@lists.linux.dev
59655983 S: Supported
59665984 W: http://git.infradead.org/users/hch/dma-mapping.git
59675985 T: git git://git.infradead.org/users/hch/dma-mapping.git
@@ -5974,6 +5992,7 @@ F: kernel/dma/ · 6 unmodified lines
59745992 DMA MAPPING BENCHMARK
59755993 M: Xiang Chen <chenxiang66@hisilicon.com>
59765994 L: iommu@lists.linux-foundation.org
5995+L: iommu@lists.linux.dev
59775996 F: kernel/dma/map_benchmark.c
59785997 F: tools/testing/selftests/dma/
59795998
@@ -7558,6 +7577,7 @@ F: drivers/gpu/drm/exynos/exynos_dp* · 1578 unmodified lines
75587577 EXYNOS SYSMMU (IOMMU) driver
75597578 M: Marek Szyprowski <m.szyprowski@samsung.com>
75607579 L: iommu@lists.linux-foundation.org
7580+L: iommu@lists.linux.dev
75617581 S: Maintained
75627582 F: drivers/iommu/exynos-iommu.c
75637583
@@ -8479,6 +8499,7 @@ F: Documentation/devicetree/bindings/gpio/ · 915 unmodified lines
84798499 F: Documentation/driver-api/gpio/
84808500 F: drivers/gpio/
84818501 F: include/asm-generic/gpio.h
8502+F: include/dt-bindings/gpio/
84828503 F: include/linux/gpio.h
84838504 F: include/linux/gpio/
84848505 F: include/linux/of_gpio.h
@@ -9132,6 +9153,7 @@ F: drivers/media/platform/st/sti/hva · 647 unmodified lines
91329153
91339154 HWPOISON MEMORY FAILURE HANDLING
91349155 M: Naoya Horiguchi <naoya.horiguchi@nec.com>
9156+R: Miaohe Lin <linmiaohe@huawei.com>
91359157 L: linux-mm@kvack.org
91369158 S: Maintained
91379159 F: mm/hwpoison-inject.c
@@ -9276,6 +9298,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git · 138 unmodified lines
92769298 F: Documentation/devicetree/bindings/i2c/i2c.txt
92779299 F: Documentation/i2c/
92789300 F: drivers/i2c/*
9301+F: include/dt-bindings/i2c/i2c.h
92799302 F: include/linux/i2c-dev.h
92809303 F: include/linux/i2c-smbus.h
92819304 F: include/linux/i2c.h
@@ -9291,6 +9314,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git · 9 unmodified lines
92919314 F: Documentation/devicetree/bindings/i2c/
92929315 F: drivers/i2c/algos/
92939316 F: drivers/i2c/busses/
9317+F: include/dt-bindings/i2c/
92949318
92959319 I2C-TAOS-EVM DRIVER
92969320 M: Jean Delvare <jdelvare@suse.com>
@@ -9975,6 +9999,7 @@ INTEL IOMMU (VT-d) · 678 unmodified lines
99759999 M: David Woodhouse <dwmw2@infradead.org>
997610000 M: Lu Baolu <baolu.lu@linux.intel.com>
997710001 L: iommu@lists.linux-foundation.org
10002+L: iommu@lists.linux.dev
997810003 S: Supported
997910004 T: git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git
998010005 F: drivers/iommu/intel/
@@ -10354,6 +10379,7 @@ IOMMU DRIVERS · 373 unmodified lines
1035410379 M: Joerg Roedel <joro@8bytes.org>
1035510380 M: Will Deacon <will@kernel.org>
1035610381 L: iommu@lists.linux-foundation.org
10382+L: iommu@lists.linux.dev
1035710383 S: Maintained
1035810384 T: git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git
1035910385 F: Documentation/devicetree/bindings/iommu/
@@ -10830,6 +10856,7 @@ M: Marc Zyngier <maz@kernel.org> · 470 unmodified lines
1083010856 R: James Morse <james.morse@arm.com>
1083110857 R: Alexandru Elisei <alexandru.elisei@arm.com>
1083210858 R: Suzuki K Poulose <suzuki.poulose@arm.com>
10859+R: Oliver Upton <oliver.upton@linux.dev>
1083310860 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1083410861 L: kvmarm@lists.cs.columbia.edu (moderated for non-subscribers)
1083510862 S: Maintained
@@ -10872,7 +10899,6 @@ F: arch/riscv/include/asm/kvm* · 36 unmodified lines
1087210899 F: arch/riscv/include/uapi/asm/kvm*
1087310900 F: arch/riscv/kvm/
1087410901 F: tools/testing/selftests/kvm/*/riscv/
10875−F: tools/testing/selftests/kvm/riscv/
1087610902
1087710903 KERNEL VIRTUAL MACHINE for s390 (KVM/s390)
1087810904 M: Christian Borntraeger <borntraeger@linux.ibm.com>
@@ -10897,28 +10923,51 @@ F: tools/testing/selftests/kvm/*/s390x/ · 18 unmodified lines
1089710923 F: tools/testing/selftests/kvm/s390x/
1089810924
1089910925 KERNEL VIRTUAL MACHINE FOR X86 (KVM/x86)
10926+M: Sean Christopherson <seanjc@google.com>
1090010927 M: Paolo Bonzini <pbonzini@redhat.com>
10901−R: Sean Christopherson <seanjc@google.com>
10902−R: Vitaly Kuznetsov <vkuznets@redhat.com>
10903−R: Wanpeng Li <wanpengli@tencent.com>
10904−R: Jim Mattson <jmattson@google.com>
10905−R: Joerg Roedel <joro@8bytes.org>
1090610928 L: kvm@vger.kernel.org
1090710929 S: Supported
10908−W: http://www.linux-kvm.org
1090910930 T: git git://git.kernel.org/pub/scm/virt/kvm/kvm.git
1091010931 F: arch/x86/include/asm/kvm*
10911−F: arch/x86/include/asm/pvclock-abi.h
1091210932 F: arch/x86/include/asm/svm.h
1091310933 F: arch/x86/include/asm/vmx*.h
1091410934 F: arch/x86/include/uapi/asm/kvm*
1091510935 F: arch/x86/include/uapi/asm/svm.h
1091610936 F: arch/x86/include/uapi/asm/vmx.h
10917−F: arch/x86/kernel/kvm.c
10918−F: arch/x86/kernel/kvmclock.c
1091910937 F: arch/x86/kvm/
1092010938 F: arch/x86/kvm/*/
1092110939
10940+KVM PARAVIRT (KVM/paravirt)
10941+M: Paolo Bonzini <pbonzini@redhat.com>
10942+R: Wanpeng Li <wanpengli@tencent.com>
10943+R: Vitaly Kuznetsov <vkuznets@redhat.com>
10944+L: kvm@vger.kernel.org
10945+S: Supported
10946+T: git git://git.kernel.org/pub/scm/virt/kvm/kvm.git
10947+F: arch/x86/kernel/kvm.c
10948+F: arch/x86/kernel/kvmclock.c
10949+F: arch/x86/include/asm/pvclock-abi.h
10950+F: include/linux/kvm_para.h
10951+F: include/uapi/linux/kvm_para.h
10952+F: include/uapi/asm-generic/kvm_para.h
10953+F: include/asm-generic/kvm_para.h
10954+F: arch/um/include/asm/kvm_para.h
10955+F: arch/x86/include/asm/kvm_para.h
10956+F: arch/x86/include/uapi/asm/kvm_para.h
10957+
10958+KVM X86 HYPER-V (KVM/hyper-v)
10959+M: Vitaly Kuznetsov <vkuznets@redhat.com>
10960+M: Sean Christopherson <seanjc@google.com>
10961+M: Paolo Bonzini <pbonzini@redhat.com>
10962+L: kvm@vger.kernel.org
10963+S: Supported
10964+T: git git://git.kernel.org/pub/scm/virt/kvm/kvm.git
10965+F: arch/x86/kvm/hyperv.*
10966+F: arch/x86/kvm/kvm_onhyperv.*
10967+F: arch/x86/kvm/svm/hyperv.*
10968+F: arch/x86/kvm/svm/svm_onhyperv.*
10969+F: arch/x86/kvm/vmx/evmcs.*
10970+
1092210971 KERNFS
1092310972 M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1092410973 M: Tejun Heo <tj@kernel.org>
@@ -11097,20 +11146,6 @@ S: Maintained · 172 unmodified lines
1109711146 F: include/net/l3mdev.h
1109811147 F: net/l3mdev
1109911148
11100−L7 BPF FRAMEWORK
11101−M: John Fastabend <john.fastabend@gmail.com>
11102−M: Daniel Borkmann <daniel@iogearbox.net>
11103−M: Jakub Sitnicki <jakub@cloudflare.com>
11104−L: netdev@vger.kernel.org
11105−L: bpf@vger.kernel.org
11106−S: Maintained
11107−F: include/linux/skmsg.h
11108−F: net/core/skmsg.c
11109−F: net/core/sock_map.c
11110−F: net/ipv4/tcp_bpf.c
11111−F: net/ipv4/udp_bpf.c
11112−F: net/unix/unix_bpf.c
11113−
1111411149 LANDLOCK SECURITY MODULE
1111511150 M: Mickaël Salaün <mic@digikod.net>
1111611151 L: linux-security-module@vger.kernel.org
@@ -11590,6 +11625,7 @@ F: drivers/gpu/drm/bridge/lontium-lt8912b.c · 473 unmodified lines
1159011625 LOONGARCH
1159111626 M: Huacai Chen <chenhuacai@kernel.org>
1159211627 R: WANG Xuerui <kernel@xen0n.name>
11628+L: loongarch@lists.linux.dev
1159311629 S: Maintained
1159411630 T: git git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson.git
1159511631 F: arch/loongarch/
@@ -12503,6 +12539,7 @@ F: drivers/i2c/busses/i2c-mt65xx.c · 907 unmodified lines
1250312539 MEDIATEK IOMMU DRIVER
1250412540 M: Yong Wu <yong.wu@mediatek.com>
1250512541 L: iommu@lists.linux-foundation.org
12542+L: iommu@lists.linux.dev
1250612543 L: linux-mediatek@lists.infradead.org (moderated for non-subscribers)
1250712544 S: Supported
1250812545 F: Documentation/devicetree/bindings/iommu/mediatek*
@@ -12845,9 +12882,8 @@ M: Andrew Morton <akpm@linux-foundation.org> · 336 unmodified lines
1284512882 L: linux-mm@kvack.org
1284612883 S: Maintained
1284712884 W: http://www.linux-mm.org
12848−T: quilt https://ozlabs.org/~akpm/mmotm/
12849−T: quilt https://ozlabs.org/~akpm/mmots/
12850−T: git git://github.com/hnaz/linux-mm.git
12885+T: git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
12886+T: quilt git://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new
1285112887 F: include/linux/gfp.h
1285212888 F: include/linux/memory_hotplug.h
1285312889 F: include/linux/mm.h
@@ -12857,6 +12893,18 @@ F: include/linux/vmalloc.h · 3 unmodified lines
1285712893 F: mm/
1285812894 F: tools/testing/selftests/vm/
1285912895
12896+MEMORY HOT(UN)PLUG
12897+M: David Hildenbrand <david@redhat.com>
12898+M: Oscar Salvador <osalvador@suse.de>
12899+L: linux-mm@kvack.org
12900+S: Maintained
12901+F: Documentation/admin-guide/mm/memory-hotplug.rst
12902+F: Documentation/core-api/memory-hotplug.rst
12903+F: drivers/base/memory.c
12904+F: include/linux/memory_hotplug.h
12905+F: mm/memory_hotplug.c
12906+F: tools/testing/selftests/memory-hotplug/
12907+
1286012908 MEMORY TECHNOLOGY DEVICES (MTD)
1286112909 M: Miquel Raynal <miquel.raynal@bootlin.com>
1286212910 M: Richard Weinberger <richard@nod.at>
@@ -13801,6 +13849,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git · 938 unmodified lines
1380113849 F: Documentation/devicetree/bindings/net/
1380213850 F: drivers/connector/
1380313851 F: drivers/net/
13852+F: include/dt-bindings/net/
1380413853 F: include/linux/etherdevice.h
1380513854 F: include/linux/fcdevice.h
1380613855 F: include/linux/fddidevice.h
@@ -13952,7 +14001,6 @@ F: net/ipv6/tcp*.c · 145 unmodified lines
1395214001 NETWORKING [TLS]
1395314002 M: Boris Pismenny <borisp@nvidia.com>
1395414003 M: John Fastabend <john.fastabend@gmail.com>
13955−M: Daniel Borkmann <daniel@iogearbox.net>
1395614004 M: Jakub Kicinski <kuba@kernel.org>
1395714005 L: netdev@vger.kernel.org
1395814006 S: Maintained
@@ -14261,7 +14309,7 @@ F: drivers/iio/gyro/fxas21002c_i2c.c · 302 unmodified lines
1426114309 F: drivers/iio/gyro/fxas21002c_spi.c
1426214310
1426314311 NXP i.MX CLOCK DRIVERS
14264−M: Abel Vesa <abel.vesa@nxp.com>
14312+M: Abel Vesa <abelvesa@kernel.org>
1426514313 L: linux-clk@vger.kernel.org
1426614314 L: linux-imx@nxp.com
1426714315 S: Maintained
@@ -14869,6 +14917,7 @@ F: include/dt-bindings/ · 601 unmodified lines
1486914917
1487014918 OPENCOMPUTE PTP CLOCK DRIVER
1487114919 M: Jonathan Lemon <jonathan.lemon@gmail.com>
14920+M: Vadim Fedorenko <vadfed@fb.com>
1487214921 L: netdev@vger.kernel.org
1487314922 S: Maintained
1487414923 F: drivers/ptp/ptp_ocp.c
@@ -16488,7 +16537,7 @@ F: Documentation/devicetree/bindings/opp/opp-v2-kryo-cpu.yaml · 1613 unmodified lines
1648816537 F: drivers/cpufreq/qcom-cpufreq-nvmem.c
1648916538
1649016539 QUALCOMM CRYPTO DRIVERS
16491−M: Thara Gopinath <thara.gopinath@linaro.org>
16540+M: Thara Gopinath <thara.gopinath@gmail.com>
1649216541 L: linux-crypto@vger.kernel.org
1649316542 L: linux-arm-msm@vger.kernel.org
1649416543 S: Maintained
@@ -16543,6 +16592,7 @@ F: drivers/i2c/busses/i2c-qcom-cci.c · 48 unmodified lines
1654316592 QUALCOMM IOMMU
1654416593 M: Rob Clark <robdclark@gmail.com>
1654516594 L: iommu@lists.linux-foundation.org
16595+L: iommu@lists.linux.dev
1654616596 L: linux-arm-msm@vger.kernel.org
1654716597 S: Maintained
1654816598 F: drivers/iommu/arm/arm-smmu/qcom_iommu.c
@@ -16598,7 +16648,7 @@ F: include/linux/if_rmnet.h · 49 unmodified lines
1659816648
1659916649 QUALCOMM TSENS THERMAL DRIVER
1660016650 M: Amit Kucheria <amitk@kernel.org>
16601−M: Thara Gopinath <thara.gopinath@linaro.org>
16651+M: Thara Gopinath <thara.gopinath@gmail.com>
1660216652 L: linux-pm@vger.kernel.org
1660316653 L: linux-arm-msm@vger.kernel.org
1660416654 S: Maintained
@@ -19168,6 +19218,7 @@ F: arch/x86/boot/video* · 2563 unmodified lines
1916819218 SWIOTLB SUBSYSTEM
1916919219 M: Christoph Hellwig <hch@infradead.org>
1917019220 L: iommu@lists.linux-foundation.org
19221+L: iommu@lists.linux.dev
1917119222 S: Supported
1917219223 W: http://git.infradead.org/users/hch/dma-mapping.git
1917319224 T: git git://git.infradead.org/users/hch/dma-mapping.git
@@ -19305,7 +19356,7 @@ R: Andy Shevchenko <andriy.shevchenko@linux.intel.com> · 131 unmodified lines
1930519356 R: Mika Westerberg <mika.westerberg@linux.intel.com>
1930619357 R: Jan Dabros <jsd@semihalf.com>
1930719358 L: linux-i2c@vger.kernel.org
19308−S: Maintained
19359+S: Supported
1930919360 F: drivers/i2c/busses/i2c-designware-*
1931019361
1931119362 SYNOPSYS DESIGNWARE MMC/SD/SDIO DRIVER
@@ -20712,6 +20763,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git · 1400 unmodified lines
2071220763 F: Documentation/devicetree/bindings/usb/
2071320764 F: Documentation/usb/
2071420765 F: drivers/usb/
20766+F: include/dt-bindings/usb/
2071520767 F: include/linux/usb.h
2071620768 F: include/linux/usb/
2071720769
@@ -21843,6 +21895,7 @@ M: Juergen Gross <jgross@suse.com> · 1125 unmodified lines
2184321895 M: Stefano Stabellini <sstabellini@kernel.org>
2184421896 L: xen-devel@lists.xenproject.org (moderated for non-subscribers)
2184521897 L: iommu@lists.linux-foundation.org
21898+L: iommu@lists.linux.dev
2184621899 S: Supported
2184721900 F: arch/x86/xen/*swiotlb*
2184821901 F: drivers/xen/*swiotlb*
Makefile+2−2
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 19
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc2
5+EXTRAVERSION = -rc4
66 NAME = Superb Owl
77
88 # *DOCUMENTATION*
@@ -1141,7 +1141,7 @@ KBUILD_MODULES := 1 · 1132 unmodified lines
11411141
11421142 autoksyms_recursive: descend modules.order
11431143 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \
1144− "$(MAKE) -f $(srctree)/Makefile vmlinux"
1144+ "$(MAKE) -f $(srctree)/Makefile autoksyms_recursive"
11451145 endif
11461146
11471147 autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h)
arch/arm/boot/dts/Makefile+1−1
@@ -1586,7 +1586,6 @@ dtb-$(CONFIG_ARCH_ASPEED) += \ · 1585 unmodified lines
15861586 aspeed-bmc-lenovo-hr630.dtb \
15871587 aspeed-bmc-lenovo-hr855xg2.dtb \
15881588 aspeed-bmc-microsoft-olympus.dtb \
1589− aspeed-bmc-nuvia-dc-scm.dtb \
15901589 aspeed-bmc-opp-lanyang.dtb \
15911590 aspeed-bmc-opp-mihawk.dtb \
15921591 aspeed-bmc-opp-mowgli.dtb \
@@ -1599,6 +1598,7 @@ dtb-$(CONFIG_ARCH_ASPEED) += \ · 6 unmodified lines
15991598 aspeed-bmc-opp-witherspoon.dtb \
16001599 aspeed-bmc-opp-zaius.dtb \
16011600 aspeed-bmc-portwell-neptune.dtb \
1601+ aspeed-bmc-qcom-dc-scm-v1.dtb \
16021602 aspeed-bmc-quanta-q71l.dtb \
16031603 aspeed-bmc-quanta-s6q.dtb \
16041604 aspeed-bmc-supermicro-x11spi.dtb \
arch/arm/boot/dts/aspeed-bmc-qcom-dc-scm-v1.dtsrenamed from arch/arm/boot/dts/aspeed-bmc-nuvia-dc-scm.dts+2−2
@@ -6,8 +6,8 @@ · 5 unmodified lines
66 #include "aspeed-g6.dtsi"
77
88 / {
9− model = "Nuvia DC-SCM BMC";
10− compatible = "nuvia,dc-scm-bmc", "aspeed,ast2600";
9+ model = "Qualcomm DC-SCM V1 BMC";
10+ compatible = "qcom,dc-scm-v1-bmc", "aspeed,ast2600";
1111
1212 aliases {
1313 serial4 = &uart5;
arch/arm/boot/dts/at91-sama5d3_ksz9477_evb.dts+5−0
@@ -120,26 +120,31 @@ · 119 unmodified lines
120120 port@0 {
121121 reg = <0>;
122122 label = "lan1";
123+ phy-mode = "internal";
123124 };
124125
125126 port@1 {
126127 reg = <1>;
127128 label = "lan2";
129+ phy-mode = "internal";
128130 };
129131
130132 port@2 {
131133 reg = <2>;
132134 label = "lan3";
135+ phy-mode = "internal";
133136 };
134137
135138 port@3 {
136139 reg = <3>;
137140 label = "lan4";
141+ phy-mode = "internal";
138142 };
139143
140144 port@4 {
141145 reg = <4>;
142146 label = "lan5";
147+ phy-mode = "internal";
143148 };
144149
145150 port@5 {
arch/arm/boot/dts/bcm2711-rpi-400.dts+3−3
@@ -28,12 +28,12 @@ · 27 unmodified lines
2828 &expgpio {
2929 gpio-line-names = "BT_ON",
3030 "WL_ON",
31− "",
31+ "PWR_LED_OFF",
3232 "GLOBAL_RESET",
3333 "VDD_SD_IO_SEL",
34− "CAM_GPIO",
34+ "GLOBAL_SHUTDOWN",
3535 "SD_PWR_ON",
36− "SD_OC_N";
36+ "SHUTDOWN_REQUEST";
3737 };
3838
3939 &genet_mdio {
arch/arm/boot/dts/imx6qdl-colibri.dtsi+1−1
@@ -593,7 +593,7 @@ · 592 unmodified lines
593593 pinctrl-names = "default";
594594 pinctrl-0 = <&pinctrl_atmel_conn>;
595595 reg = <0x4a>;
596− reset-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; /* SODIMM 106 */
596+ reset-gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; /* SODIMM 106 */
597597 status = "disabled";
598598 };
599599 };
arch/arm/boot/dts/imx6qdl.dtsi+1−1
@@ -762,7 +762,7 @@ · 761 unmodified lines
762762 regulator-name = "vddpu";
763763 regulator-min-microvolt = <725000>;
764764 regulator-max-microvolt = <1450000>;
765− regulator-enable-ramp-delay = <150>;
765+ regulator-enable-ramp-delay = <380>;
766766 anatop-reg-offset = <0x140>;
767767 anatop-vol-bit-shift = <9>;
768768 anatop-vol-bit-width = <5>;
arch/arm/boot/dts/imx7s.dtsi+1−1
@@ -120,6 +120,7 @@ · 119 unmodified lines
120120 compatible = "usb-nop-xceiv";
121121 clocks = <&clks IMX7D_USB_HSIC_ROOT_CLK>;
122122 clock-names = "main_clk";
123+ power-domains = <&pgc_hsic_phy>;
123124 #phy-cells = <0>;
124125 };
125126
@@ -1153,7 +1154,6 @@ · 1027 unmodified lines
11531154 compatible = "fsl,imx7d-usb", "fsl,imx27-usb";
11541155 reg = <0x30b30000 0x200>;
11551156 interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;
1156− power-domains = <&pgc_hsic_phy>;
11571157 clocks = <&clks IMX7D_USB_CTRL_CLK>;
11581158 fsl,usbphy = <&usbphynop3>;
11591159 fsl,usbmisc = <&usbmisc3 0>;
arch/arm/boot/dts/stm32mp15-scmi.dtsi+47−0
@@ -0,0 +1,47 @@
1+// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
2+/*
3+ * Copyright (C) STMicroelectronics 2022 - All Rights Reserved
4+ * Author: Alexandre Torgue <alexandre.torgue@foss.st.com> for STMicroelectronics.
5+ */
6+
7+/ {
8+ firmware {
9+ optee: optee {
10+ compatible = "linaro,optee-tz";
11+ method = "smc";
12+ };
13+
14+ scmi: scmi {
15+ compatible = "linaro,scmi-optee";
16+ #address-cells = <1>;
17+ #size-cells = <0>;
18+ linaro,optee-channel-id = <0>;
19+ shmem = <&scmi_shm>;
20+
21+ scmi_clk: protocol@14 {
22+ reg = <0x14>;
23+ #clock-cells = <1>;
24+ };
25+
26+ scmi_reset: protocol@16 {
27+ reg = <0x16>;
28+ #reset-cells = <1>;
29+ };
30+ };
31+ };
32+
33+ soc {
34+ scmi_sram: sram@2ffff000 {
35+ compatible = "mmio-sram";
36+ reg = <0x2ffff000 0x1000>;
37+ #address-cells = <1>;
38+ #size-cells = <1>;
39+ ranges = <0 0x2ffff000 0x1000>;
40+
41+ scmi_shm: scmi-sram@0 {
42+ compatible = "arm,scmi-shmem";
43+ reg = <0 0x80>;
44+ };
45+ };
46+ };
47+};
arch/arm/boot/dts/stm32mp151.dtsi+0−41
@@ -115,33 +115,6 @@ · 114 unmodified lines
115115 status = "disabled";
116116 };
117117
118− firmware {
119− optee: optee {
120− compatible = "linaro,optee-tz";
121− method = "smc";
122− status = "disabled";
123− };
124−
125− scmi: scmi {
126− compatible = "linaro,scmi-optee";
127− #address-cells = <1>;
128− #size-cells = <0>;
129− linaro,optee-channel-id = <0>;
130− shmem = <&scmi_shm>;
131− status = "disabled";
132−
133− scmi_clk: protocol@14 {
134− reg = <0x14>;
135− #clock-cells = <1>;
136− };
137−
138− scmi_reset: protocol@16 {
139− reg = <0x16>;
140− #reset-cells = <1>;
141− };
142− };
143− };
144−
145118 soc {
146119 compatible = "simple-bus";
147120 #address-cells = <1>;
@@ -149,20 +122,6 @@ · 1 unmodified line
149122 interrupt-parent = <&intc>;
150123 ranges;
151124
152− scmi_sram: sram@2ffff000 {
153− compatible = "mmio-sram";
154− reg = <0x2ffff000 0x1000>;
155− #address-cells = <1>;
156− #size-cells = <1>;
157− ranges = <0 0x2ffff000 0x1000>;
158−
159− scmi_shm: scmi-sram@0 {
160− compatible = "arm,scmi-shmem";
161− reg = <0 0x80>;
162− status = "disabled";
163− };
164− };
165−
166125 timers2: timer@40000000 {
167126 #address-cells = <1>;
168127 #size-cells = <0>;
arch/arm/boot/dts/stm32mp157a-dk1-scmi.dts+1−12
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 /dts-v1/;
88
99 #include "stm32mp157a-dk1.dts"
10+#include "stm32mp15-scmi.dtsi"
1011
1112 / {
1213 model = "STMicroelectronics STM32MP157A-DK1 SCMI Discovery Board";
@@ -54,10 +55,6 @@ · 41 unmodified lines
5455 resets = <&scmi_reset RST_SCMI_MCU>;
5556 };
5657
57−&optee {
58− status = "okay";
59−};
60−
6158 &rcc {
6259 compatible = "st,stm32mp1-rcc-secure", "syscon";
6360 clock-names = "hse", "hsi", "csi", "lse", "lsi";
@@ -76,11 +73,3 @@ · 12 unmodified lines
7673 &rtc {
7774 clocks = <&scmi_clk CK_SCMI_RTCAPB>, <&scmi_clk CK_SCMI_RTC>;
7875 };
79−
80−&scmi {
81− status = "okay";
82−};
83−
84−&scmi_shm {
85− status = "okay";
86−};
arch/arm/boot/dts/stm32mp157c-dk2-scmi.dts+1−12
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 /dts-v1/;
88
99 #include "stm32mp157c-dk2.dts"
10+#include "stm32mp15-scmi.dtsi"
1011
1112 / {
1213 model = "STMicroelectronics STM32MP157C-DK2 SCMI Discovery Board";
@@ -63,10 +64,6 @@ · 50 unmodified lines
6364 resets = <&scmi_reset RST_SCMI_MCU>;
6465 };
6566
66−&optee {
67− status = "okay";
68−};
69−
7067 &rcc {
7168 compatible = "st,stm32mp1-rcc-secure", "syscon";
7269 clock-names = "hse", "hsi", "csi", "lse", "lsi";
@@ -85,11 +82,3 @@ · 12 unmodified lines
8582 &rtc {
8683 clocks = <&scmi_clk CK_SCMI_RTCAPB>, <&scmi_clk CK_SCMI_RTC>;
8784 };
88−
89−&scmi {
90− status = "okay";
91−};
92−
93−&scmi_shm {
94− status = "okay";
95−};
arch/arm/boot/dts/stm32mp157c-ed1-scmi.dts+1−12
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 /dts-v1/;
88
99 #include "stm32mp157c-ed1.dts"
10+#include "stm32mp15-scmi.dtsi"
1011
1112 / {
1213 model = "STMicroelectronics STM32MP157C-ED1 SCMI eval daughter";
@@ -59,10 +60,6 @@ · 46 unmodified lines
5960 resets = <&scmi_reset RST_SCMI_MCU>;
6061 };
6162
62−&optee {
63− status = "okay";
64−};
65−
6663 &rcc {
6764 compatible = "st,stm32mp1-rcc-secure", "syscon";
6865 clock-names = "hse", "hsi", "csi", "lse", "lsi";
@@ -81,11 +78,3 @@ · 12 unmodified lines
8178 &rtc {
8279 clocks = <&scmi_clk CK_SCMI_RTCAPB>, <&scmi_clk CK_SCMI_RTC>;
8380 };
84−
85−&scmi {
86− status = "okay";
87−};
88−
89−&scmi_shm {
90− status = "okay";
91−};
arch/arm/boot/dts/stm32mp157c-ev1-scmi.dts+1−12
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 /dts-v1/;
88
99 #include "stm32mp157c-ev1.dts"
10+#include "stm32mp15-scmi.dtsi"
1011
1112 / {
1213 model = "STMicroelectronics STM32MP157C-EV1 SCMI eval daughter on eval mother";
@@ -68,10 +69,6 @@ · 55 unmodified lines
6869 resets = <&scmi_reset RST_SCMI_MCU>;
6970 };
7071
71−&optee {
72− status = "okay";
73−};
74−
7572 &rcc {
7673 compatible = "st,stm32mp1-rcc-secure", "syscon";
7774 clock-names = "hse", "hsi", "csi", "lse", "lsi";
@@ -90,11 +87,3 @@ · 12 unmodified lines
9087 &rtc {
9188 clocks = <&scmi_clk CK_SCMI_RTCAPB>, <&scmi_clk CK_SCMI_RTC>;
9289 };
93−
94−&scmi {
95− status = "okay";
96−};
97−
98−&scmi_shm {
99− status = "okay";
100−};
arch/arm/mach-axxia/platsmp.c+1−0
@@ -39,6 +39,7 @@ static int axxia_boot_secondary(unsigned int cpu, struct task_struct *idle) · 38 unmodified lines
3939 return -ENOENT;
4040
4141 syscon = of_iomap(syscon_np, 0);
42+ of_node_put(syscon_np);
4243 if (!syscon)
4344 return -ENOMEM;
4445
arch/arm/mach-cns3xxx/core.c+2−0
@@ -372,6 +372,7 @@ static void __init cns3xxx_init(void) · 371 unmodified lines
372372 /* De-Asscer SATA Reset */
373373 cns3xxx_pwr_soft_rst(CNS3XXX_PWR_SOFTWARE_RST(SATA));
374374 }
375+ of_node_put(dn);
375376
376377 dn = of_find_compatible_node(NULL, NULL, "cavium,cns3420-sdhci");
377378 if (of_device_is_available(dn)) {
@@ -385,6 +386,7 @@ static void __init cns3xxx_init(void) · 7 unmodified lines
385386 cns3xxx_pwr_clk_en(CNS3XXX_PWR_CLK_EN(SDIO));
386387 cns3xxx_pwr_soft_rst(CNS3XXX_PWR_SOFTWARE_RST(SDIO));
387388 }
389+ of_node_put(dn);
388390
389391 pm_power_off = cns3xxx_power_off;
390392
arch/arm/mach-exynos/exynos.c+1−0
@@ -149,6 +149,7 @@ static void exynos_map_pmu(void) · 148 unmodified lines
149149 np = of_find_matching_node(NULL, exynos_dt_pmu_match);
150150 if (np)
151151 pmu_base_addr = of_iomap(np, 0);
152+ of_node_put(np);
152153 }
153154
154155 static void __init exynos_init_irq(void)
arch/arm/mach-spear/time.c+6−2
@@ -218,13 +218,13 @@ void __init spear_setup_of_timer(void) · 217 unmodified lines
218218 irq = irq_of_parse_and_map(np, 0);
219219 if (!irq) {
220220 pr_err("%s: No irq passed for timer via DT\n", __func__);
221− return;
221+ goto err_put_np;
222222 }
223223
224224 gpt_base = of_iomap(np, 0);
225225 if (!gpt_base) {
226226 pr_err("%s: of iomap failed\n", __func__);
227− return;
227+ goto err_put_np;
228228 }
229229
230230 gpt_clk = clk_get_sys("gpt0", NULL);
@@ -239,6 +239,8 @@ void __init spear_setup_of_timer(void) · 8 unmodified lines
239239 goto err_prepare_enable_clk;
240240 }
241241
242+ of_node_put(np);
243+
242244 spear_clockevent_init(irq);
243245 spear_clocksource_init();
244246
@@ -248,4 +250,6 @@ err_prepare_enable_clk: · 3 unmodified lines
248250 clk_put(gpt_clk);
249251 err_iomap:
250252 iounmap(gpt_base);
253+err_put_np:
254+ of_node_put(np);
251255 }
arch/arm64/boot/dts/exynos/exynos7885.dtsi+6−6
@@ -280,8 +280,8 @@ · 279 unmodified lines
280280 interrupts = <GIC_SPI 246 IRQ_TYPE_LEVEL_HIGH>;
281281 pinctrl-names = "default";
282282 pinctrl-0 = <&uart0_bus>;
283− clocks = <&cmu_peri CLK_GOUT_UART0_EXT_UCLK>,
284− <&cmu_peri CLK_GOUT_UART0_PCLK>;
283+ clocks = <&cmu_peri CLK_GOUT_UART0_PCLK>,
284+ <&cmu_peri CLK_GOUT_UART0_EXT_UCLK>;
285285 clock-names = "uart", "clk_uart_baud0";
286286 samsung,uart-fifosize = <64>;
287287 status = "disabled";
@@ -293,8 +293,8 @@ · 5 unmodified lines
293293 interrupts = <GIC_SPI 247 IRQ_TYPE_LEVEL_HIGH>;
294294 pinctrl-names = "default";
295295 pinctrl-0 = <&uart1_bus>;
296− clocks = <&cmu_peri CLK_GOUT_UART1_EXT_UCLK>,
297− <&cmu_peri CLK_GOUT_UART1_PCLK>;
296+ clocks = <&cmu_peri CLK_GOUT_UART1_PCLK>,
297+ <&cmu_peri CLK_GOUT_UART1_EXT_UCLK>;
298298 clock-names = "uart", "clk_uart_baud0";
299299 samsung,uart-fifosize = <256>;
300300 status = "disabled";
@@ -306,8 +306,8 @@ · 5 unmodified lines
306306 interrupts = <GIC_SPI 279 IRQ_TYPE_LEVEL_HIGH>;
307307 pinctrl-names = "default";
308308 pinctrl-0 = <&uart2_bus>;
309− clocks = <&cmu_peri CLK_GOUT_UART2_EXT_UCLK>,
310− <&cmu_peri CLK_GOUT_UART2_PCLK>;
309+ clocks = <&cmu_peri CLK_GOUT_UART2_PCLK>,
310+ <&cmu_peri CLK_GOUT_UART2_EXT_UCLK>;
311311 clock-names = "uart", "clk_uart_baud0";
312312 samsung,uart-fifosize = <256>;
313313 status = "disabled";
arch/arm64/boot/dts/freescale/s32g2.dtsi+1−1
@@ -79,7 +79,7 @@ · 78 unmodified lines
7979 };
8080 };
8181
82− soc {
82+ soc@0 {
8383 compatible = "simple-bus";
8484 #address-cells = <1>;
8585 #size-cells = <1>;
arch/arm64/boot/dts/ti/k3-am64-main.dtsi+0−2
@@ -456,13 +456,11 @@ · 455 unmodified lines
456456 clock-names = "clk_ahb", "clk_xin";
457457 mmc-ddr-1_8v;
458458 mmc-hs200-1_8v;
459− mmc-hs400-1_8v;
460459 ti,trm-icp = <0x2>;
461460 ti,otap-del-sel-legacy = <0x0>;
462461 ti,otap-del-sel-mmc-hs = <0x0>;
463462 ti,otap-del-sel-ddr52 = <0x6>;
464463 ti,otap-del-sel-hs200 = <0x7>;
465− ti,otap-del-sel-hs400 = <0x4>;
466464 };
467465
468466 sdhci1: mmc@fa00000 {
arch/arm64/boot/dts/ti/k3-j721s2-main.dtsi+1−1
@@ -33,7 +33,7 @@ · 32 unmodified lines
3333 ranges;
3434 #interrupt-cells = <3>;
3535 interrupt-controller;
36− reg = <0x00 0x01800000 0x00 0x200000>, /* GICD */
36+ reg = <0x00 0x01800000 0x00 0x100000>, /* GICD */
3737 <0x00 0x01900000 0x00 0x100000>, /* GICR */
3838 <0x00 0x6f000000 0x00 0x2000>, /* GICC */
3939 <0x00 0x6f010000 0x00 0x1000>, /* GICH */
arch/arm64/include/asm/kvm_host.h+0−5
@@ -362,11 +362,6 @@ struct kvm_vcpu_arch { · 361 unmodified lines
362362 struct arch_timer_cpu timer_cpu;
363363 struct kvm_pmu pmu;
364364
365− /*
366− * Anything that is not used directly from assembly code goes
367− * here.
368− */
369−
370365 /*
371366 * Guest registers we preserve during guest debugging.
372367 *
arch/arm64/include/asm/virt.h+3−0
@@ -113,6 +113,9 @@ static __always_inline bool has_vhe(void) · 112 unmodified lines
113113 /*
114114 * Code only run in VHE/NVHE hyp context can assume VHE is present or
115115 * absent. Otherwise fall back to caps.
116+ * This allows the compiler to discard VHE-specific code from the
117+ * nVHE object, reducing the number of external symbol references
118+ * needed to link.
116119 */
117120 if (is_vhe_hyp_code())
118121 return true;
arch/arm64/kernel/cpufeature.c+1−10
@@ -1974,15 +1974,7 @@ static void cpu_enable_mte(struct arm64_cpu_capabilities const *cap) · 1973 unmodified lines
19741974 #ifdef CONFIG_KVM
19751975 static bool is_kvm_protected_mode(const struct arm64_cpu_capabilities *entry, int __unused)
19761976 {
1977− if (kvm_get_mode() != KVM_MODE_PROTECTED)
1978− return false;
1979−
1980− if (is_kernel_in_hyp_mode()) {
1981− pr_warn("Protected KVM not available with VHE\n");
1982− return false;
1983− }
1984−
1985− return true;
1977+ return kvm_get_mode() == KVM_MODE_PROTECTED;
19861978 }
19871979 #endif /* CONFIG_KVM */
19881980
@@ -3109,7 +3101,6 @@ void cpu_set_feature(unsigned int num) · 1120 unmodified lines
31093101 WARN_ON(num >= MAX_CPU_FEATURES);
31103102 elf_hwcap |= BIT(num);
31113103 }
3112−EXPORT_SYMBOL_GPL(cpu_set_feature);
31133104
31143105 bool cpu_have_feature(unsigned int num)
31153106 {
arch/arm64/kernel/entry-ftrace.S+0−1
@@ -102,7 +102,6 @@ SYM_INNER_LABEL(ftrace_call, SYM_L_GLOBAL) · 101 unmodified lines
102102 * x19-x29 per the AAPCS, and we created frame records upon entry, so we need
103103 * to restore x0-x8, x29, and x30.
104104 */
105−ftrace_common_return:
106105 /* Restore function arguments */
107106 ldp x0, x1, [sp]
108107 ldp x2, x3, [sp, #S_X2]
arch/arm64/kernel/ftrace.c+66−71
@@ -78,47 +78,76 @@ static struct plt_entry *get_ftrace_plt(struct module *mod, unsigned long addr) · 77 unmodified lines
7878 }
7979
8080 /*
81− * Turn on the call to ftrace_caller() in instrumented function
81+ * Find the address the callsite must branch to in order to reach '*addr'.
82+ *
83+ * Due to the limited range of 'BL' instructions, modules may be placed too far
84+ * away to branch directly and must use a PLT.
85+ *
86+ * Returns true when '*addr' contains a reachable target address, or has been
87+ * modified to contain a PLT address. Returns false otherwise.
8288 */
83−int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
89+static bool ftrace_find_callable_addr(struct dyn_ftrace *rec,
90+ struct module *mod,
91+ unsigned long *addr)
8492 {
8593 unsigned long pc = rec->ip;
86− u32 old, new;
87− long offset = (long)pc - (long)addr;
94+ long offset = (long)*addr - (long)pc;
95+ struct plt_entry *plt;
8896
89− if (offset < -SZ_128M || offset >= SZ_128M) {
90− struct module *mod;
91− struct plt_entry *plt;
97+ /*
98+ * When the target is within range of the 'BL' instruction, use 'addr'
99+ * as-is and branch to that directly.
100+ */
101+ if (offset >= -SZ_128M && offset < SZ_128M)
102+ return true;
92103
93− if (!IS_ENABLED(CONFIG_ARM64_MODULE_PLTS))
94− return -EINVAL;
104+ /*
105+ * When the target is outside of the range of a 'BL' instruction, we
106+ * must use a PLT to reach it. We can only place PLTs for modules, and
107+ * only when module PLT support is built-in.
108+ */
109+ if (!IS_ENABLED(CONFIG_ARM64_MODULE_PLTS))
110+ return false;
95111
96− /*
97− * On kernels that support module PLTs, the offset between the
98− * branch instruction and its target may legally exceed the
99− * range of an ordinary relative 'bl' opcode. In this case, we
100− * need to branch via a trampoline in the module.
101− *
102− * NOTE: __module_text_address() must be called with preemption
103− * disabled, but we can rely on ftrace_lock to ensure that 'mod'
104− * retains its validity throughout the remainder of this code.
105− */
112+ /*
113+ * 'mod' is only set at module load time, but if we end up
114+ * dealing with an out-of-range condition, we can assume it
115+ * is due to a module being loaded far away from the kernel.
116+ *
117+ * NOTE: __module_text_address() must be called with preemption
118+ * disabled, but we can rely on ftrace_lock to ensure that 'mod'
119+ * retains its validity throughout the remainder of this code.
120+ */
121+ if (!mod) {
106122 preempt_disable();
107123 mod = __module_text_address(pc);
108124 preempt_enable();
125+ }
109126
110− if (WARN_ON(!mod))
111− return -EINVAL;
127+ if (WARN_ON(!mod))
128+ return false;
112129
113− plt = get_ftrace_plt(mod, addr);
114− if (!plt) {
115− pr_err("ftrace: no module PLT for %ps\n", (void *)addr);
116− return -EINVAL;
117− }
118−
119− addr = (unsigned long)plt;
130+ plt = get_ftrace_plt(mod, *addr);
131+ if (!plt) {
132+ pr_err("ftrace: no module PLT for %ps\n", (void *)*addr);
133+ return false;
120134 }
121135
136+ *addr = (unsigned long)plt;
137+ return true;
138+}
139+
140+/*
141+ * Turn on the call to ftrace_caller() in instrumented function
142+ */
143+int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
144+{
145+ unsigned long pc = rec->ip;
146+ u32 old, new;
147+
148+ if (!ftrace_find_callable_addr(rec, NULL, &addr))
149+ return -EINVAL;
150+
122151 old = aarch64_insn_gen_nop();
123152 new = aarch64_insn_gen_branch_imm(pc, addr, AARCH64_INSN_BRANCH_LINK);
124153
@@ -132,6 +161,11 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr, · 7 unmodified lines
132161 unsigned long pc = rec->ip;
133162 u32 old, new;
134163
164+ if (!ftrace_find_callable_addr(rec, NULL, &old_addr))
165+ return -EINVAL;
166+ if (!ftrace_find_callable_addr(rec, NULL, &addr))
167+ return -EINVAL;
168+
135169 old = aarch64_insn_gen_branch_imm(pc, old_addr,
136170 AARCH64_INSN_BRANCH_LINK);
137171 new = aarch64_insn_gen_branch_imm(pc, addr, AARCH64_INSN_BRANCH_LINK);
@@ -181,54 +215,15 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec, · 43 unmodified lines
181215 unsigned long addr)
182216 {
183217 unsigned long pc = rec->ip;
184− bool validate = true;
185218 u32 old = 0, new;
186− long offset = (long)pc - (long)addr;
187219
188− if (offset < -SZ_128M || offset >= SZ_128M) {
189− u32 replaced;
190−
191− if (!IS_ENABLED(CONFIG_ARM64_MODULE_PLTS))
192− return -EINVAL;
193−
194− /*
195− * 'mod' is only set at module load time, but if we end up
196− * dealing with an out-of-range condition, we can assume it
197− * is due to a module being loaded far away from the kernel.
198− */
199− if (!mod) {
200− preempt_disable();
201− mod = __module_text_address(pc);
202− preempt_enable();
203−
204− if (WARN_ON(!mod))
205− return -EINVAL;
206− }
207−
208− /*
209− * The instruction we are about to patch may be a branch and
210− * link instruction that was redirected via a PLT entry. In
211− * this case, the normal validation will fail, but we can at
212− * least check that we are dealing with a branch and link
213− * instruction that points into the right module.
214− */
215− if (aarch64_insn_read((void *)pc, &replaced))
216− return -EFAULT;
217−
218− if (!aarch64_insn_is_bl(replaced) ||
219− !within_module(pc + aarch64_get_branch_offset(replaced),
220− mod))
221− return -EINVAL;
222−
223− validate = false;
224− } else {
225− old = aarch64_insn_gen_branch_imm(pc, addr,
226− AARCH64_INSN_BRANCH_LINK);
227− }
220+ if (!ftrace_find_callable_addr(rec, mod, &addr))
221+ return -EINVAL;
228222
223+ old = aarch64_insn_gen_branch_imm(pc, addr, AARCH64_INSN_BRANCH_LINK);
229224 new = aarch64_insn_gen_nop();
230225
231− return ftrace_modify_code(pc, old, new, validate);
226+ return ftrace_modify_code(pc, old, new, true);
232227 }
233228
234229 void arch_ftrace_update_code(int command)
arch/arm64/kernel/setup.c+3−4
@@ -303,14 +303,13 @@ void __init __no_sanitize_address setup_arch(char **cmdline_p) · 302 unmodified lines
303303 early_fixmap_init();
304304 early_ioremap_init();
305305
306+ setup_machine_fdt(__fdt_pointer);
307+
306308 /*
307309 * Initialise the static keys early as they may be enabled by the
308− * cpufeature code, early parameters, and DT setup.
310+ * cpufeature code and early parameters.
309311 */
310312 jump_label_init();
311−
312− setup_machine_fdt(__fdt_pointer);
313−
314313 parse_early_param();
315314
316315 /*
arch/arm64/kvm/arch_timer.c+3−0
@@ -1230,6 +1230,9 @@ bool kvm_arch_timer_get_input_level(int vintid) · 1229 unmodified lines
12301230 struct kvm_vcpu *vcpu = kvm_get_running_vcpu();
12311231 struct arch_timer_context *timer;
12321232
1233+ if (WARN(!vcpu, "No vcpu context!\n"))
1234+ return false;
1235+
12331236 if (vintid == vcpu_vtimer(vcpu)->irq.irq)
12341237 timer = vcpu_vtimer(vcpu);
12351238 else if (vintid == vcpu_ptimer(vcpu)->irq.irq)
arch/arm64/kvm/arm.c+11−5
@@ -150,8 +150,10 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) · 149 unmodified lines
150150 if (ret)
151151 goto out_free_stage2_pgd;
152152
153− if (!zalloc_cpumask_var(&kvm->arch.supported_cpus, GFP_KERNEL))
153+ if (!zalloc_cpumask_var(&kvm->arch.supported_cpus, GFP_KERNEL)) {
154+ ret = -ENOMEM;
154155 goto out_free_stage2_pgd;
156+ }
155157 cpumask_copy(kvm->arch.supported_cpus, cpu_possible_mask);
156158
157159 kvm_vgic_early_init(kvm);
@@ -2110,11 +2112,11 @@ static int finalize_hyp_mode(void) · 1952 unmodified lines
21102112 return 0;
21112113
21122114 /*
2113− * Exclude HYP BSS from kmemleak so that it doesn't get peeked
2114− * at, which would end badly once the section is inaccessible.
2115− * None of other sections should ever be introspected.
2115+ * Exclude HYP sections from kmemleak so that they don't get peeked
2116+ * at, which would end badly once inaccessible.
21162117 */
21172118 kmemleak_free_part(__hyp_bss_start, __hyp_bss_end - __hyp_bss_start);
2119+ kmemleak_free_part(__va(hyp_mem_base), hyp_mem_size);
21182120 return pkvm_drop_host_privileges();
21192121 }
21202122
@@ -2271,7 +2273,11 @@ static int __init early_kvm_mode_cfg(char *arg) · 150 unmodified lines
22712273 return -EINVAL;
22722274
22732275 if (strcmp(arg, "protected") == 0) {
2274− kvm_mode = KVM_MODE_PROTECTED;
2276+ if (!is_kernel_in_hyp_mode())
2277+ kvm_mode = KVM_MODE_PROTECTED;
2278+ else
2279+ pr_warn_once("Protected KVM not available with VHE\n");
2280+
22752281 return 0;
22762282 }
22772283
arch/arm64/kvm/fpsimd.c+2−0
@@ -80,6 +80,7 @@ void kvm_arch_vcpu_load_fp(struct kvm_vcpu *vcpu) · 79 unmodified lines
8080 vcpu->arch.flags &= ~KVM_ARM64_FP_ENABLED;
8181 vcpu->arch.flags |= KVM_ARM64_FP_HOST;
8282
83+ vcpu->arch.flags &= ~KVM_ARM64_HOST_SVE_ENABLED;
8384 if (read_sysreg(cpacr_el1) & CPACR_EL1_ZEN_EL0EN)
8485 vcpu->arch.flags |= KVM_ARM64_HOST_SVE_ENABLED;
8586
@@ -93,6 +94,7 @@ void kvm_arch_vcpu_load_fp(struct kvm_vcpu *vcpu) · 7 unmodified lines
9394 * operations. Do this for ZA as well for now for simplicity.
9495 */
9596 if (system_supports_sme()) {
97+ vcpu->arch.flags &= ~KVM_ARM64_HOST_SME_ENABLED;
9698 if (read_sysreg(cpacr_el1) & CPACR_EL1_SMEN_EL0EN)
9799 vcpu->arch.flags |= KVM_ARM64_HOST_SME_ENABLED;
98100
arch/arm64/kvm/hyp/nvhe/mem_protect.c+0−4
@@ -314,15 +314,11 @@ static int host_stage2_adjust_range(u64 addr, struct kvm_mem_range *range) · 313 unmodified lines
314314 int host_stage2_idmap_locked(phys_addr_t addr, u64 size,
315315 enum kvm_pgtable_prot prot)
316316 {
317− hyp_assert_lock_held(&host_kvm.lock);
318−
319317 return host_stage2_try(__host_stage2_idmap, addr, addr + size, prot);
320318 }
321319
322320 int host_stage2_set_owner_locked(phys_addr_t addr, u64 size, u8 owner_id)
323321 {
324− hyp_assert_lock_held(&host_kvm.lock);
325−
326322 return host_stage2_try(kvm_pgtable_stage2_set_owner, &host_kvm.pgt,
327323 addr, size, &host_s2_pool, owner_id);
328324 }
arch/arm64/kvm/hyp/nvhe/sys_regs.c+34−8
@@ -243,15 +243,9 @@ u64 pvm_read_id_reg(const struct kvm_vcpu *vcpu, u32 id) · 242 unmodified lines
243243 case SYS_ID_AA64MMFR2_EL1:
244244 return get_pvm_id_aa64mmfr2(vcpu);
245245 default:
246− /*
247− * Should never happen because all cases are covered in
248− * pvm_sys_reg_descs[].
249− */
250− WARN_ON(1);
251− break;
246+ /* Unhandled ID register, RAZ */
247+ return 0;
252248 }
253−
254− return 0;
255249 }
256250
257251 static u64 read_id_reg(const struct kvm_vcpu *vcpu,
@@ -332,6 +326,16 @@ static bool pvm_gic_read_sre(struct kvm_vcpu *vcpu, · 74 unmodified lines
332326 /* Mark the specified system register as an AArch64 feature id register. */
333327 #define AARCH64(REG) { SYS_DESC(REG), .access = pvm_access_id_aarch64 }
334328
329+/*
330+ * sys_reg_desc initialiser for architecturally unallocated cpufeature ID
331+ * register with encoding Op0=3, Op1=0, CRn=0, CRm=crm, Op2=op2
332+ * (1 <= crm < 8, 0 <= Op2 < 8).
333+ */
334+#define ID_UNALLOCATED(crm, op2) { \
335+ Op0(3), Op1(0), CRn(0), CRm(crm), Op2(op2), \
336+ .access = pvm_access_id_aarch64, \
337+}
338+
335339 /* Mark the specified system register as Read-As-Zero/Write-Ignored */
336340 #define RAZ_WI(REG) { SYS_DESC(REG), .access = pvm_access_raz_wi }
337341
@@ -375,24 +379,46 @@ static const struct sys_reg_desc pvm_sys_reg_descs[] = { · 37 unmodified lines
375379 AARCH32(SYS_MVFR0_EL1),
376380 AARCH32(SYS_MVFR1_EL1),
377381 AARCH32(SYS_MVFR2_EL1),
382+ ID_UNALLOCATED(3,3),
378383 AARCH32(SYS_ID_PFR2_EL1),
379384 AARCH32(SYS_ID_DFR1_EL1),
380385 AARCH32(SYS_ID_MMFR5_EL1),
386+ ID_UNALLOCATED(3,7),
381387
382388 /* AArch64 ID registers */
383389 /* CRm=4 */
384390 AARCH64(SYS_ID_AA64PFR0_EL1),
385391 AARCH64(SYS_ID_AA64PFR1_EL1),
392+ ID_UNALLOCATED(4,2),
393+ ID_UNALLOCATED(4,3),
386394 AARCH64(SYS_ID_AA64ZFR0_EL1),
395+ ID_UNALLOCATED(4,5),
396+ ID_UNALLOCATED(4,6),
397+ ID_UNALLOCATED(4,7),
387398 AARCH64(SYS_ID_AA64DFR0_EL1),
388399 AARCH64(SYS_ID_AA64DFR1_EL1),
400+ ID_UNALLOCATED(5,2),
401+ ID_UNALLOCATED(5,3),
389402 AARCH64(SYS_ID_AA64AFR0_EL1),
390403 AARCH64(SYS_ID_AA64AFR1_EL1),
404+ ID_UNALLOCATED(5,6),
405+ ID_UNALLOCATED(5,7),
391406 AARCH64(SYS_ID_AA64ISAR0_EL1),
392407 AARCH64(SYS_ID_AA64ISAR1_EL1),
408+ AARCH64(SYS_ID_AA64ISAR2_EL1),
409+ ID_UNALLOCATED(6,3),
410+ ID_UNALLOCATED(6,4),
411+ ID_UNALLOCATED(6,5),
412+ ID_UNALLOCATED(6,6),
413+ ID_UNALLOCATED(6,7),
393414 AARCH64(SYS_ID_AA64MMFR0_EL1),
394415 AARCH64(SYS_ID_AA64MMFR1_EL1),
395416 AARCH64(SYS_ID_AA64MMFR2_EL1),
417+ ID_UNALLOCATED(7,3),
418+ ID_UNALLOCATED(7,4),
419+ ID_UNALLOCATED(7,5),
420+ ID_UNALLOCATED(7,6),
421+ ID_UNALLOCATED(7,7),
396422
397423 /* Scalable Vector Registers are restricted. */
398424
arch/arm64/kvm/vgic/vgic-mmio-v2.c+2−2
@@ -429,11 +429,11 @@ static const struct vgic_register_region vgic_v2_dist_registers[] = { · 428 unmodified lines
429429 VGIC_ACCESS_32bit),
430430 REGISTER_DESC_WITH_BITS_PER_IRQ(GIC_DIST_PENDING_SET,
431431 vgic_mmio_read_pending, vgic_mmio_write_spending,
432− NULL, vgic_uaccess_write_spending, 1,
432+ vgic_uaccess_read_pending, vgic_uaccess_write_spending, 1,
433433 VGIC_ACCESS_32bit),
434434 REGISTER_DESC_WITH_BITS_PER_IRQ(GIC_DIST_PENDING_CLEAR,
435435 vgic_mmio_read_pending, vgic_mmio_write_cpending,
436− NULL, vgic_uaccess_write_cpending, 1,
436+ vgic_uaccess_read_pending, vgic_uaccess_write_cpending, 1,
437437 VGIC_ACCESS_32bit),
438438 REGISTER_DESC_WITH_BITS_PER_IRQ(GIC_DIST_ACTIVE_SET,
439439 vgic_mmio_read_active, vgic_mmio_write_sactive,
arch/arm64/kvm/vgic/vgic-mmio-v3.c+2−38
@@ -353,42 +353,6 @@ static unsigned long vgic_mmio_read_v3_idregs(struct kvm_vcpu *vcpu, · 352 unmodified lines
353353 return 0;
354354 }
355355
356−static unsigned long vgic_v3_uaccess_read_pending(struct kvm_vcpu *vcpu,
357− gpa_t addr, unsigned int len)
358−{
359− u32 intid = VGIC_ADDR_TO_INTID(addr, 1);
360− u32 value = 0;
361− int i;
362−
363− /*
364− * pending state of interrupt is latched in pending_latch variable.
365− * Userspace will save and restore pending state and line_level
366− * separately.
367− * Refer to Documentation/virt/kvm/devices/arm-vgic-v3.rst
368− * for handling of ISPENDR and ICPENDR.
369− */
370− for (i = 0; i < len * 8; i++) {
371− struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i);
372− bool state = irq->pending_latch;
373−
374− if (irq->hw && vgic_irq_is_sgi(irq->intid)) {
375− int err;
376−
377− err = irq_get_irqchip_state(irq->host_irq,
378− IRQCHIP_STATE_PENDING,
379− &state);
380− WARN_ON(err);
381− }
382−
383− if (state)
384− value |= (1U << i);
385−
386− vgic_put_irq(vcpu->kvm, irq);
387− }
388−
389− return value;
390−}
391−
392356 static int vgic_v3_uaccess_write_pending(struct kvm_vcpu *vcpu,
393357 gpa_t addr, unsigned int len,
394358 unsigned long val)
@@ -666,7 +630,7 @@ static const struct vgic_register_region vgic_v3_dist_registers[] = { · 271 unmodified lines
666630 VGIC_ACCESS_32bit),
667631 REGISTER_DESC_WITH_BITS_PER_IRQ_SHARED(GICD_ISPENDR,
668632 vgic_mmio_read_pending, vgic_mmio_write_spending,
669− vgic_v3_uaccess_read_pending, vgic_v3_uaccess_write_pending, 1,
633+ vgic_uaccess_read_pending, vgic_v3_uaccess_write_pending, 1,
670634 VGIC_ACCESS_32bit),
671635 REGISTER_DESC_WITH_BITS_PER_IRQ_SHARED(GICD_ICPENDR,
672636 vgic_mmio_read_pending, vgic_mmio_write_cpending,
@@ -750,7 +714,7 @@ static const struct vgic_register_region vgic_v3_rd_registers[] = { · 77 unmodified lines
750714 VGIC_ACCESS_32bit),
751715 REGISTER_DESC_WITH_LENGTH_UACCESS(SZ_64K + GICR_ISPENDR0,
752716 vgic_mmio_read_pending, vgic_mmio_write_spending,
753− vgic_v3_uaccess_read_pending, vgic_v3_uaccess_write_pending, 4,
717+ vgic_uaccess_read_pending, vgic_v3_uaccess_write_pending, 4,
754718 VGIC_ACCESS_32bit),
755719 REGISTER_DESC_WITH_LENGTH_UACCESS(SZ_64K + GICR_ICPENDR0,
756720 vgic_mmio_read_pending, vgic_mmio_write_cpending,
arch/arm64/kvm/vgic/vgic-mmio.c+36−4
@@ -226,8 +226,9 @@ int vgic_uaccess_write_cenable(struct kvm_vcpu *vcpu, · 225 unmodified lines
226226 return 0;
227227 }
228228
229−unsigned long vgic_mmio_read_pending(struct kvm_vcpu *vcpu,
230− gpa_t addr, unsigned int len)
229+static unsigned long __read_pending(struct kvm_vcpu *vcpu,
230+ gpa_t addr, unsigned int len,
231+ bool is_user)
231232 {
232233 u32 intid = VGIC_ADDR_TO_INTID(addr, 1);
233234 u32 value = 0;
@@ -239,6 +240,15 @@ unsigned long vgic_mmio_read_pending(struct kvm_vcpu *vcpu, · 5 unmodified lines
239240 unsigned long flags;
240241 bool val;
241242
243+ /*
244+ * When used from userspace with a GICv3 model:
245+ *
246+ * Pending state of interrupt is latched in pending_latch
247+ * variable. Userspace will save and restore pending state
248+ * and line_level separately.
249+ * Refer to Documentation/virt/kvm/devices/arm-vgic-v3.rst
250+ * for handling of ISPENDR and ICPENDR.
251+ */
242252 raw_spin_lock_irqsave(&irq->irq_lock, flags);
243253 if (irq->hw && vgic_irq_is_sgi(irq->intid)) {
244254 int err;
@@ -248,10 +258,20 @@ unsigned long vgic_mmio_read_pending(struct kvm_vcpu *vcpu, · 3 unmodified lines
248258 IRQCHIP_STATE_PENDING,
249259 &val);
250260 WARN_RATELIMIT(err, "IRQ %d", irq->host_irq);
251− } else if (vgic_irq_is_mapped_level(irq)) {
261+ } else if (!is_user && vgic_irq_is_mapped_level(irq)) {
252262 val = vgic_get_phys_line_level(irq);
253263 } else {
254− val = irq_is_pending(irq);
264+ switch (vcpu->kvm->arch.vgic.vgic_model) {
265+ case KVM_DEV_TYPE_ARM_VGIC_V3:
266+ if (is_user) {
267+ val = irq->pending_latch;
268+ break;
269+ }
270+ fallthrough;
271+ default:
272+ val = irq_is_pending(irq);
273+ break;
274+ }
255275 }
256276
257277 value |= ((u32)val << i);
@@ -263,6 +283,18 @@ unsigned long vgic_mmio_read_pending(struct kvm_vcpu *vcpu, · 5 unmodified lines
263283 return value;
264284 }
265285
286+unsigned long vgic_mmio_read_pending(struct kvm_vcpu *vcpu,
287+ gpa_t addr, unsigned int len)
288+{
289+ return __read_pending(vcpu, addr, len, false);
290+}
291+
292+unsigned long vgic_uaccess_read_pending(struct kvm_vcpu *vcpu,
293+ gpa_t addr, unsigned int len)
294+{
295+ return __read_pending(vcpu, addr, len, true);
296+}
297+
266298 static bool is_vgic_v2_sgi(struct kvm_vcpu *vcpu, struct vgic_irq *irq)
267299 {
268300 return (vgic_irq_is_sgi(irq->intid) &&
arch/arm64/kvm/vgic/vgic-mmio.h+3−0
@@ -149,6 +149,9 @@ int vgic_uaccess_write_cenable(struct kvm_vcpu *vcpu, · 148 unmodified lines
149149 unsigned long vgic_mmio_read_pending(struct kvm_vcpu *vcpu,
150150 gpa_t addr, unsigned int len);
151151
152+unsigned long vgic_uaccess_read_pending(struct kvm_vcpu *vcpu,
153+ gpa_t addr, unsigned int len);
154+
152155 void vgic_mmio_write_spending(struct kvm_vcpu *vcpu,
153156 gpa_t addr, unsigned int len,
154157 unsigned long val);
arch/arm64/kvm/vmid.c+1−1
@@ -66,7 +66,7 @@ static void flush_context(void) · 65 unmodified lines
6666 * the next context-switch, we broadcast TLB flush + I-cache
6767 * invalidation over the inner shareable domain on rollover.
6868 */
69− kvm_call_hyp(__kvm_flush_vm_context);
69+ kvm_call_hyp(__kvm_flush_vm_context);
7070 }
7171
7272 static bool check_update_reserved_vmid(u64 vmid, u64 newvmid)
arch/arm64/mm/cache.S+0−2
@@ -218,8 +218,6 @@ SYM_FUNC_ALIAS(__dma_flush_area, __pi___dma_flush_area) · 217 unmodified lines
218218 */
219219 SYM_FUNC_START(__pi___dma_map_area)
220220 add x1, x0, x1
221− cmp w2, #DMA_FROM_DEVICE
222− b.eq __pi_dcache_inval_poc
223221 b __pi_dcache_clean_poc
224222 SYM_FUNC_END(__pi___dma_map_area)
225223 SYM_FUNC_ALIAS(__dma_map_area, __pi___dma_map_area)
arch/loongarch/include/asm/branch.h+1−2
@@ -12,10 +12,9 @@ static inline unsigned long exception_era(struct pt_regs *regs) · 11 unmodified lines
1212 return regs->csr_era;
1313 }
1414
15−static inline int compute_return_era(struct pt_regs *regs)
15+static inline void compute_return_era(struct pt_regs *regs)
1616 {
1717 regs->csr_era += 4;
18− return 0;
1918 }
2019
2120 #endif /* _ASM_BRANCH_H */
arch/loongarch/include/asm/pgtable.h+5−5
@@ -426,6 +426,11 @@ static inline void update_mmu_cache_pmd(struct vm_area_struct *vma, · 425 unmodified lines
426426
427427 #define kern_addr_valid(addr) (1)
428428
429+static inline unsigned long pmd_pfn(pmd_t pmd)
430+{
431+ return (pmd_val(pmd) & _PFN_MASK) >> _PFN_SHIFT;
432+}
433+
429434 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
430435
431436 /* We don't have hardware dirty/accessed bits, generic_pmdp_establish is fine.*/
@@ -497,11 +502,6 @@ static inline pmd_t pmd_mkyoung(pmd_t pmd) · 65 unmodified lines
497502 return pmd;
498503 }
499504
500−static inline unsigned long pmd_pfn(pmd_t pmd)
501−{
502− return (pmd_val(pmd) & _PFN_MASK) >> _PFN_SHIFT;
503−}
504−
505505 static inline struct page *pmd_page(pmd_t pmd)
506506 {
507507 if (pmd_trans_huge(pmd))
arch/loongarch/kernel/cpu-probe.c+1−1
@@ -263,7 +263,7 @@ void cpu_probe(void) · 262 unmodified lines
263263
264264 c->cputype = CPU_UNKNOWN;
265265 c->processor_id = read_cpucfg(LOONGARCH_CPUCFG0);
266− c->fpu_vers = (read_cpucfg(LOONGARCH_CPUCFG2) >> 3) & 0x3;
266+ c->fpu_vers = (read_cpucfg(LOONGARCH_CPUCFG2) & CPUCFG2_FPVERS) >> 3;
267267
268268 c->fpu_csr0 = FPU_CSR_RN;
269269 c->fpu_mask = FPU_CSR_RSVD;
arch/loongarch/kernel/head.S+0−2
@@ -14,8 +14,6 @@ · 13 unmodified lines
1414
1515 __REF
1616
17−SYM_ENTRY(_stext, SYM_L_GLOBAL, SYM_A_NONE)
18−
1917 SYM_CODE_START(kernel_entry) # kernel entry point
2018
2119 /* Config direct window and set PG */
arch/loongarch/kernel/traps.c+1−2
@@ -475,8 +475,7 @@ asmlinkage void noinstr do_ri(struct pt_regs *regs) · 474 unmodified lines
475475
476476 die_if_kernel("Reserved instruction in kernel code", regs);
477477
478− if (unlikely(compute_return_era(regs) < 0))
479− goto out;
478+ compute_return_era(regs);
480479
481480 if (unlikely(get_user(opcode, era) < 0)) {
482481 status = SIGSEGV;
arch/loongarch/kernel/vmlinux.lds.S+2−0
@@ -37,6 +37,7 @@ SECTIONS · 36 unmodified lines
3737 HEAD_TEXT_SECTION
3838
3939 . = ALIGN(PECOFF_SEGMENT_ALIGN);
40+ _stext = .;
4041 .text : {
4142 TEXT_TEXT
4243 SCHED_TEXT
@@ -101,6 +102,7 @@ SECTIONS · 58 unmodified lines
101102
102103 STABS_DEBUG
103104 DWARF_DEBUG
105+ ELF_DETAILS
104106
105107 .gptab.sdata : {
106108 *(.gptab.data)
arch/loongarch/mm/tlb.c+4−3
@@ -281,15 +281,16 @@ void setup_tlb_handler(int cpu) · 280 unmodified lines
281281 if (pcpu_handlers[cpu])
282282 return;
283283
284− page = alloc_pages_node(cpu_to_node(cpu), GFP_KERNEL, get_order(vec_sz));
284+ page = alloc_pages_node(cpu_to_node(cpu), GFP_ATOMIC, get_order(vec_sz));
285285 if (!page)
286286 return;
287287
288288 addr = page_address(page);
289− pcpu_handlers[cpu] = virt_to_phys(addr);
289+ pcpu_handlers[cpu] = (unsigned long)addr;
290290 memcpy((void *)addr, (void *)eentry, vec_sz);
291291 local_flush_icache_range((unsigned long)addr, (unsigned long)addr + vec_sz);
292− csr_write64(pcpu_handlers[cpu], LOONGARCH_CSR_TLBRENTRY);
292+ csr_write64(pcpu_handlers[cpu], LOONGARCH_CSR_EENTRY);
293+ csr_write64(pcpu_handlers[cpu], LOONGARCH_CSR_MERRENTRY);
293294 csr_write64(pcpu_handlers[cpu] + 80*VECSIZE, LOONGARCH_CSR_TLBRENTRY);
294295 }
295296 #endif
arch/mips/boot/dts/ingenic/x1000.dtsi+3−2
@@ -111,8 +111,9 @@ · 110 unmodified lines
111111
112112 clocks = <&cgu X1000_CLK_RTCLK>,
113113 <&cgu X1000_CLK_EXCLK>,
114− <&cgu X1000_CLK_PCLK>;
115− clock-names = "rtc", "ext", "pclk";
114+ <&cgu X1000_CLK_PCLK>,
115+ <&cgu X1000_CLK_TCU>;
116+ clock-names = "rtc", "ext", "pclk", "tcu";
116117
117118 interrupt-controller;
118119 #interrupt-cells = <1>;
arch/mips/boot/dts/ingenic/x1830.dtsi+3−2
@@ -104,8 +104,9 @@ · 103 unmodified lines
104104
105105 clocks = <&cgu X1830_CLK_RTCLK>,
106106 <&cgu X1830_CLK_EXCLK>,
107− <&cgu X1830_CLK_PCLK>;
108− clock-names = "rtc", "ext", "pclk";
107+ <&cgu X1830_CLK_PCLK>,
108+ <&cgu X1830_CLK_TCU>;
109+ clock-names = "rtc", "ext", "pclk", "tcu";
109110
110111 interrupt-controller;
111112 #interrupt-cells = <1>;
arch/mips/generic/board-ranchu.c+1−0
@@ -44,6 +44,7 @@ static __init unsigned int ranchu_measure_hpt_freq(void) · 43 unmodified lines
4444 __func__);
4545
4646 rtc_base = of_iomap(np, 0);
47+ of_node_put(np);
4748 if (!rtc_base)
4849 panic("%s(): Failed to ioremap Goldfish RTC base!", __func__);
4950
arch/mips/lantiq/falcon/sysctrl.c+6−0
@@ -208,6 +208,12 @@ void __init ltq_soc_init(void) · 207 unmodified lines
208208 of_address_to_resource(np_sysgpe, 0, &res_sys[2]))
209209 panic("Failed to get core resources");
210210
211+ of_node_put(np_status);
212+ of_node_put(np_ebu);
213+ of_node_put(np_sys1);
214+ of_node_put(np_syseth);
215+ of_node_put(np_sysgpe);
216+
211217 if ((request_mem_region(res_status.start, resource_size(&res_status),
212218 res_status.name) < 0) ||
213219 (request_mem_region(res_ebu.start, resource_size(&res_ebu),
arch/mips/lantiq/irq.c+1−0
@@ -408,6 +408,7 @@ int __init icu_of_init(struct device_node *node, struct device_node *parent) · 407 unmodified lines
408408 if (!ltq_eiu_membase)
409409 panic("Failed to remap eiu memory");
410410 }
411+ of_node_put(eiu_node);
411412
412413 return 0;
413414 }
arch/mips/lantiq/xway/sysctrl.c+4−0
@@ -441,6 +441,10 @@ void __init ltq_soc_init(void) · 440 unmodified lines
441441 of_address_to_resource(np_ebu, 0, &res_ebu))
442442 panic("Failed to get core resources");
443443
444+ of_node_put(np_pmu);
445+ of_node_put(np_cgu);
446+ of_node_put(np_ebu);
447+
444448 if (!request_mem_region(res_pmu.start, resource_size(&res_pmu),
445449 res_pmu.name) ||
446450 !request_mem_region(res_cgu.start, resource_size(&res_cgu),
arch/mips/mti-malta/malta-time.c+2−0
@@ -214,6 +214,8 @@ static void update_gic_frequency_dt(void) · 213 unmodified lines
214214
215215 if (of_update_property(node, &gic_frequency_prop) < 0)
216216 pr_err("error updating gic frequency property\n");
217+
218+ of_node_put(node);
217219 }
218220
219221 #endif
arch/mips/pic32/pic32mzda/init.c+6−1
@@ -98,13 +98,18 @@ static int __init pic32_of_prepare_platform_data(struct of_dev_auxdata *lookup) · 97 unmodified lines
9898 np = of_find_compatible_node(NULL, NULL, lookup->compatible);
9999 if (np) {
100100 lookup->name = (char *)np->name;
101− if (lookup->phys_addr)
101+ if (lookup->phys_addr) {
102+ of_node_put(np);
102103 continue;
104+ }
103105 if (!of_address_to_resource(np, 0, &res))
104106 lookup->phys_addr = res.start;
107+ of_node_put(np);
105108 }
106109 }
107110
111+ of_node_put(root);
112+
108113 return 0;
109114 }
110115
arch/mips/pic32/pic32mzda/time.c+3−0
@@ -32,6 +32,9 @@ static unsigned int pic32_xlate_core_timer_irq(void) · 31 unmodified lines
3232 goto default_map;
3333
3434 irq = irq_of_parse_and_map(node, 0);
35+
36+ of_node_put(node);
37+
3538 if (!irq)
3639 goto default_map;
3740
arch/mips/ralink/of.c+2−0
@@ -40,6 +40,8 @@ __iomem void *plat_of_remap_node(const char *node) · 39 unmodified lines
4040 if (of_address_to_resource(np, 0, &res))
4141 panic("Failed to get resource for %s", node);
4242
43+ of_node_put(np);
44+
4345 if (!request_mem_region(res.start,
4446 resource_size(&res),
4547 res.name))
arch/mips/vr41xx/common/icu.c+0−2
@@ -640,8 +640,6 @@ static int icu_get_irq(unsigned int irq) · 639 unmodified lines
640640
641641 printk(KERN_ERR "spurious ICU interrupt: %04x,%04x\n", pend1, pend2);
642642
643− atomic_inc(&irq_err_count);
644−
645643 return -1;
646644 }
647645
arch/parisc/Kconfig+1−0
@@ -10,6 +10,7 @@ config PARISC · 9 unmodified lines
1010 select ARCH_WANT_FRAME_POINTERS
1111 select ARCH_HAS_ELF_RANDOMIZE
1212 select ARCH_HAS_STRICT_KERNEL_RWX
13+ select ARCH_HAS_STRICT_MODULE_RWX
1314 select ARCH_HAS_UBSAN_SANITIZE_ALL
1415 select ARCH_HAS_PTE_SPECIAL
1516 select ARCH_NO_SG_CHAIN
arch/parisc/include/asm/fb.h+1−1
@@ -12,7 +12,7 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, · 11 unmodified lines
1212 pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
1313 }
1414
15−#if defined(CONFIG_STI_CONSOLE) || defined(CONFIG_FB_STI)
15+#if defined(CONFIG_FB_STI)
1616 int fb_is_primary_device(struct fb_info *info);
1717 #else
1818 static inline int fb_is_primary_device(struct fb_info *info)
arch/parisc/kernel/cache.c+4−1
@@ -722,7 +722,10 @@ void flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned lon · 721 unmodified lines
722722 return;
723723
724724 if (parisc_requires_coherency()) {
725− flush_user_cache_page(vma, vmaddr);
725+ if (vma->vm_flags & VM_SHARED)
726+ flush_data_cache();
727+ else
728+ flush_user_cache_page(vma, vmaddr);
726729 return;
727730 }
728731
arch/parisc/math-emu/decode_exc.c+1−1
@@ -102,7 +102,7 @@ decode_fpu(unsigned int Fpu_register[], unsigned int trap_counts[]) · 101 unmodified lines
102102 * that happen. Want to keep this overhead low, but still provide
103103 * some information to the customer. All exits from this routine
104104 * need to restore Fpu_register[0]
105− */
105+ */
106106
107107 bflags=(Fpu_register[0] & 0xf8000000);
108108 Fpu_register[0] &= 0x07ffffff;
arch/powerpc/kernel/process.c+1−1
@@ -1855,7 +1855,7 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp) · 1854 unmodified lines
18551855 tm_reclaim_current(0);
18561856 #endif
18571857
1858− memset(regs->gpr, 0, sizeof(regs->gpr));
1858+ memset(&regs->gpr[1], 0, sizeof(regs->gpr) - sizeof(regs->gpr[0]));
18591859 regs->ctr = 0;
18601860 regs->link = 0;
18611861 regs->xer = 0;
arch/powerpc/kernel/prom_init.c+1−1
@@ -2302,7 +2302,7 @@ static void __init prom_init_stdout(void) · 2301 unmodified lines
23022302
23032303 static int __init prom_find_machine_type(void)
23042304 {
2305− char compat[256];
2305+ static char compat[256] __prombss;
23062306 int len, i = 0;
23072307 #ifdef CONFIG_PPC64
23082308 phandle rtas;
arch/powerpc/kernel/rtas.c+10−1
@@ -1071,7 +1071,7 @@ static struct rtas_filter rtas_filters[] __ro_after_init = { · 1070 unmodified lines
10711071 { "get-time-of-day", -1, -1, -1, -1, -1 },
10721072 { "ibm,get-vpd", -1, 0, -1, 1, 2 },
10731073 { "ibm,lpar-perftools", -1, 2, 3, -1, -1 },
1074− { "ibm,platform-dump", -1, 4, 5, -1, -1 },
1074+ { "ibm,platform-dump", -1, 4, 5, -1, -1 }, /* Special cased */
10751075 { "ibm,read-slot-reset-state", -1, -1, -1, -1, -1 },
10761076 { "ibm,scan-log-dump", -1, 0, 1, -1, -1 },
10771077 { "ibm,set-dynamic-indicator", -1, 2, -1, -1, -1 },
@@ -1120,6 +1120,15 @@ static bool block_rtas_call(int token, int nargs, · 42 unmodified lines
11201120 size = 1;
11211121
11221122 end = base + size - 1;
1123+
1124+ /*
1125+ * Special case for ibm,platform-dump - NULL buffer
1126+ * address is used to indicate end of dump processing
1127+ */
1128+ if (!strcmp(f->name, "ibm,platform-dump") &&
1129+ base == 0)
1130+ return false;
1131+
11231132 if (!in_rmo_buf(base, end))
11241133 goto err;
11251134 }
arch/powerpc/kernel/setup-common.c+7−6
@@ -935,12 +935,6 @@ void __init setup_arch(char **cmdline_p) · 934 unmodified lines
935935 /* Print various info about the machine that has been gathered so far. */
936936 print_system_info();
937937
938− /* Reserve large chunks of memory for use by CMA for KVM. */
939− kvm_cma_reserve();
940−
941− /* Reserve large chunks of memory for us by CMA for hugetlb */
942− gigantic_hugetlb_cma_reserve();
943−
944938 klp_init_thread_info(&init_task);
945939
946940 setup_initial_init_mm(_stext, _etext, _edata, _end);
@@ -955,6 +949,13 @@ void __init setup_arch(char **cmdline_p) · 8 unmodified lines
955949
956950 initmem_init();
957951
952+ /*
953+ * Reserve large chunks of memory for use by CMA for KVM and hugetlb. These must
954+ * be called after initmem_init(), so that pageblock_order is initialised.
955+ */
956+ kvm_cma_reserve();
957+ gigantic_hugetlb_cma_reserve();
958+
958959 early_memtest(min_low_pfn << PAGE_SHIFT, max_low_pfn << PAGE_SHIFT);
959960
960961 if (ppc_md.setup_arch)
arch/powerpc/platforms/microwatt/microwatt.h+7−0
@@ -0,0 +1,7 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef _MICROWATT_H
3+#define _MICROWATT_H
4+
5+void microwatt_rng_init(void);
6+
7+#endif /* _MICROWATT_H */
arch/powerpc/platforms/microwatt/rng.c+3−7
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #include <asm/archrandom.h>
1212 #include <asm/cputable.h>
1313 #include <asm/machdep.h>
14+#include "microwatt.h"
1415
1516 #define DARN_ERR 0xFFFFFFFFFFFFFFFFul
1617
@@ -29,7 +30,7 @@ static int microwatt_get_random_darn(unsigned long *v) · 12 unmodified lines
2930 return 1;
3031 }
3132
32−static __init int rng_init(void)
33+void __init microwatt_rng_init(void)
3334 {
3435 unsigned long val;
3536 int i;
@@ -37,12 +38,7 @@ static __init int rng_init(void) · 1 unmodified line
3738 for (i = 0; i < 10; i++) {
3839 if (microwatt_get_random_darn(&val)) {
3940 ppc_md.get_random_seed = microwatt_get_random_darn;
40− return 0;
41+ return;
4142 }
4243 }
43−
44− pr_warn("Unable to use DARN for get_random_seed()\n");
45−
46− return -EIO;
4744 }
48−machine_subsys_initcall(, rng_init);
arch/powerpc/platforms/microwatt/setup.c+8−0
@@ -16,6 +16,8 @@ · 15 unmodified lines
1616 #include <asm/xics.h>
1717 #include <asm/udbg.h>
1818
19+#include "microwatt.h"
20+
1921 static void __init microwatt_init_IRQ(void)
2022 {
2123 xics_init();
@@ -32,10 +34,16 @@ static int __init microwatt_populate(void) · 10 unmodified lines
3234 }
3335 machine_arch_initcall(microwatt, microwatt_populate);
3436
37+static void __init microwatt_setup_arch(void)
38+{
39+ microwatt_rng_init();
40+}
41+
3542 define_machine(microwatt) {
3643 .name = "microwatt",
3744 .probe = microwatt_probe,
3845 .init_IRQ = microwatt_init_IRQ,
46+ .setup_arch = microwatt_setup_arch,
3947 .progress = udbg_progress,
4048 .calibrate_decr = generic_calibrate_decr,
4149 };
arch/powerpc/platforms/powernv/powernv.h+2−0
@@ -42,4 +42,6 @@ ssize_t memcons_copy(struct memcons *mc, char *to, loff_t pos, size_t count); · 41 unmodified lines
4242 u32 __init memcons_get_size(struct memcons *mc);
4343 struct memcons *__init memcons_init(struct device_node *node, const char *mc_prop_name);
4444
45+void pnv_rng_init(void);
46+
4547 #endif /* _POWERNV_H */
arch/powerpc/platforms/powernv/rng.c+36−16
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <asm/prom.h>
1818 #include <asm/machdep.h>
1919 #include <asm/smp.h>
20+#include "powernv.h"
2021
2122 #define DARN_ERR 0xFFFFFFFFFFFFFFFFul
2223
@@ -28,7 +29,6 @@ struct powernv_rng { · 5 unmodified lines
2829
2930 static DEFINE_PER_CPU(struct powernv_rng *, powernv_rng);
3031
31−
3232 int powernv_hwrng_present(void)
3333 {
3434 struct powernv_rng *rng;
@@ -98,9 +98,6 @@ static int __init initialise_darn(void) · 63 unmodified lines
9898 return 0;
9999 }
100100 }
101−
102− pr_warn("Unable to use DARN for get_random_seed()\n");
103−
104101 return -EIO;
105102 }
106103
@@ -163,32 +160,55 @@ static __init int rng_create(struct device_node *dn) · 56 unmodified lines
163160
164161 rng_init_per_cpu(rng, dn);
165162
166− pr_info_once("Registering arch random hook.\n");
167−
168163 ppc_md.get_random_seed = powernv_get_random_long;
169164
170165 return 0;
171166 }
172167
173−static __init int rng_init(void)
168+static int __init pnv_get_random_long_early(unsigned long *v)
174169 {
175170 struct device_node *dn;
176− int rc;
171+
172+ if (!slab_is_available())
173+ return 0;
174+
175+ if (cmpxchg(&ppc_md.get_random_seed, pnv_get_random_long_early,
176+ NULL) != pnv_get_random_long_early)
177+ return 0;
177178
178179 for_each_compatible_node(dn, NULL, "ibm,power-rng") {
179− rc = rng_create(dn);
180− if (rc) {
181− pr_err("Failed creating rng for %pOF (%d).\n",
182− dn, rc);
180+ if (rng_create(dn))
183181 continue;
184− }
185−
186182 /* Create devices for hwrng driver */
187183 of_platform_device_create(dn, NULL, NULL);
188184 }
189185
190− initialise_darn();
186+ if (!ppc_md.get_random_seed)
187+ return 0;
188+ return ppc_md.get_random_seed(v);
189+}
190+
191+void __init pnv_rng_init(void)
192+{
193+ struct device_node *dn;
191194
195+ /* Prefer darn over the rest. */
196+ if (!initialise_darn())
197+ return;
198+
199+ dn = of_find_compatible_node(NULL, NULL, "ibm,power-rng");
200+ if (dn)
201+ ppc_md.get_random_seed = pnv_get_random_long_early;
202+
203+ of_node_put(dn);
204+}
205+
206+static int __init pnv_rng_late_init(void)
207+{
208+ unsigned long v;
209+ /* In case it wasn't called during init for some other reason. */
210+ if (ppc_md.get_random_seed == pnv_get_random_long_early)
211+ pnv_get_random_long_early(&v);
192212 return 0;
193213 }
194−machine_subsys_initcall(powernv, rng_init);
214+machine_subsys_initcall(powernv, pnv_rng_late_init);
arch/powerpc/platforms/powernv/setup.c+2−0
@@ -203,6 +203,8 @@ static void __init pnv_setup_arch(void) · 202 unmodified lines
203203 pnv_check_guarded_cores();
204204
205205 /* XXX PMCS */
206+
207+ pnv_rng_init();
206208 }
207209
208210 static void __init pnv_init(void)
arch/powerpc/platforms/pseries/pseries.h+2−0
@@ -122,4 +122,6 @@ void pseries_lpar_read_hblkrm_characteristics(void); · 121 unmodified lines
122122 static inline void pseries_lpar_read_hblkrm_characteristics(void) { }
123123 #endif
124124
125+void pseries_rng_init(void);
126+
125127 #endif /* _PSERIES_PSERIES_H */
arch/powerpc/platforms/pseries/rng.c+3−8
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 #include <asm/archrandom.h>
1111 #include <asm/machdep.h>
1212 #include <asm/plpar_wrappers.h>
13+#include "pseries.h"
1314
1415
1516 static int pseries_get_random_long(unsigned long *v)
@@ -24,19 +25,13 @@ static int pseries_get_random_long(unsigned long *v) · 8 unmodified lines
2425 return 0;
2526 }
2627
27−static __init int rng_init(void)
28+void __init pseries_rng_init(void)
2829 {
2930 struct device_node *dn;
3031
3132 dn = of_find_compatible_node(NULL, NULL, "ibm,random");
3233 if (!dn)
33− return -ENODEV;
34−
35− pr_info("Registering arch random hook.\n");
36−
34+ return;
3735 ppc_md.get_random_seed = pseries_get_random_long;
38−
3936 of_node_put(dn);
40− return 0;
4137 }
42−machine_subsys_initcall(pseries, rng_init);
arch/powerpc/platforms/pseries/setup.c+1−0
@@ -839,6 +839,7 @@ static void __init pSeries_setup_arch(void) · 838 unmodified lines
839839 }
840840
841841 ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare;
842+ pseries_rng_init();
842843 }
843844
844845 static void pseries_panic(char *str)
arch/riscv/Kconfig+7−2
@@ -364,8 +364,13 @@ config RISCV_ISA_SVPBMT · 363 unmodified lines
364364 select RISCV_ALTERNATIVE
365365 default y
366366 help
367− Adds support to dynamically detect the presence of the SVPBMT extension
368− (Supervisor-mode: page-based memory types) and enable its usage.
367+ Adds support to dynamically detect the presence of the SVPBMT
368+ ISA-extension (Supervisor-mode: page-based memory types) and
369+ enable its usage.
370+
371+ The memory type for a page contains a combination of attributes
372+ that indicate the cacheability, idempotency, and ordering
373+ properties for access to that page.
369374
370375 The SVPBMT extension is only available on 64Bit cpus.
371376
arch/riscv/Kconfig.erratas+1−0
@@ -35,6 +35,7 @@ config ERRATA_SIFIVE_CIP_1200 · 34 unmodified lines
3535
3636 config ERRATA_THEAD
3737 bool "T-HEAD errata"
38+ depends on !XIP_KERNEL
3839 select RISCV_ALTERNATIVE
3940 help
4041 All T-HEAD errata Kconfig depend on this Kconfig. Disabling
arch/riscv/boot/dts/microchip/mpfs.dtsi+9−0
@@ -192,6 +192,15 @@ · 191 unmodified lines
192192 riscv,ndev = <186>;
193193 };
194194
195+ pdma: dma-controller@3000000 {
196+ compatible = "sifive,fu540-c000-pdma", "sifive,pdma0";
197+ reg = <0x0 0x3000000 0x0 0x8000>;
198+ interrupt-parent = <&plic>;
199+ interrupts = <5 6>, <7 8>, <9 10>, <11 12>;
200+ dma-channels = <4>;
201+ #dma-cells = <1>;
202+ };
203+
195204 clkcfg: clkcfg@20002000 {
196205 compatible = "microchip,mpfs-clkcfg";
197206 reg = <0x0 0x20002000 0x0 0x1000>, <0x0 0x3E001000 0x0 0x1000>;
arch/riscv/include/asm/errata_list.h+7−7
@@ -75,20 +75,20 @@ asm volatile(ALTERNATIVE( \ · 74 unmodified lines
7575 "nop\n\t" \
7676 "nop\n\t" \
7777 "nop", \
78− "li t3, %2\n\t" \
79− "slli t3, t3, %4\n\t" \
78+ "li t3, %1\n\t" \
79+ "slli t3, t3, %3\n\t" \
8080 "and t3, %0, t3\n\t" \
8181 "bne t3, zero, 2f\n\t" \
82− "li t3, %3\n\t" \
83− "slli t3, t3, %4\n\t" \
82+ "li t3, %2\n\t" \
83+ "slli t3, t3, %3\n\t" \
8484 "or %0, %0, t3\n\t" \
8585 "2:", THEAD_VENDOR_ID, \
8686 ERRATA_THEAD_PBMT, CONFIG_ERRATA_THEAD_PBMT) \
8787 : "+r"(_val) \
88− : "0"(_val), \
89− "I"(_PAGE_MTMASK_THEAD >> ALT_THEAD_PBMT_SHIFT), \
88+ : "I"(_PAGE_MTMASK_THEAD >> ALT_THEAD_PBMT_SHIFT), \
9089 "I"(_PAGE_PMA_THEAD >> ALT_THEAD_PBMT_SHIFT), \
91− "I"(ALT_THEAD_PBMT_SHIFT))
90+ "I"(ALT_THEAD_PBMT_SHIFT) \
91+ : "t3")
9292 #else
9393 #define ALT_THEAD_PMA(_val)
9494 #endif
arch/riscv/kernel/cpufeature.c+1−4
@@ -293,7 +293,6 @@ void __init_or_module riscv_cpufeature_patch_func(struct alt_entry *begin, · 292 unmodified lines
293293 unsigned int stage)
294294 {
295295 u32 cpu_req_feature = cpufeature_probe(stage);
296− u32 cpu_apply_feature = 0;
297296 struct alt_entry *alt;
298297 u32 tmp;
299298
@@ -307,10 +306,8 @@ void __init_or_module riscv_cpufeature_patch_func(struct alt_entry *begin, · 7 unmodified lines
307306 }
308307
309308 tmp = (1U << alt->errata_id);
310− if (cpu_req_feature & tmp) {
309+ if (cpu_req_feature & tmp)
311310 patch_text_nosync(alt->old_ptr, alt->alt_ptr, alt->alt_len);
312− cpu_apply_feature |= tmp;
313− }
314311 }
315312 }
316313 #endif
arch/riscv/kvm/vmid.c+1−1
@@ -97,7 +97,7 @@ void kvm_riscv_gstage_vmid_update(struct kvm_vcpu *vcpu) · 96 unmodified lines
9797 * We ran out of VMIDs so we increment vmid_version and
9898 * start assigning VMIDs from 1.
9999 *
100− * This also means existing VMIDs assignement to all Guest
100+ * This also means existing VMIDs assignment to all Guest
101101 * instances is invalid and we have force VMID re-assignement
102102 * for all Guest instances. The Guest instances that were not
103103 * running will automatically pick-up new VMIDs because will
arch/s390/kernel/crash_dump.c+9−1
@@ -219,6 +219,11 @@ ssize_t copy_oldmem_page(struct iov_iter *iter, unsigned long pfn, size_t csize, · 218 unmodified lines
219219 unsigned long src;
220220 int rc;
221221
222+ if (!(iter_is_iovec(iter) || iov_iter_is_kvec(iter)))
223+ return -EINVAL;
224+ /* Multi-segment iterators are not supported */
225+ if (iter->nr_segs > 1)
226+ return -EINVAL;
222227 if (!csize)
223228 return 0;
224229 src = pfn_to_phys(pfn) + offset;
@@ -228,7 +233,10 @@ ssize_t copy_oldmem_page(struct iov_iter *iter, unsigned long pfn, size_t csize, · 3 unmodified lines
228233 rc = copy_oldmem_user(iter->iov->iov_base, src, csize);
229234 else
230235 rc = copy_oldmem_kernel(iter->kvec->iov_base, src, csize);
231− return rc;
236+ if (rc < 0)
237+ return rc;
238+ iov_iter_advance(iter, csize);
239+ return csize;
232240 }
233241
234242 /*
arch/s390/kernel/perf_cpum_cf.c+21−1
@@ -516,6 +516,26 @@ static int __hw_perf_event_init(struct perf_event *event, unsigned int type) · 515 unmodified lines
516516 return err;
517517 }
518518
519+/* Events CPU_CYLCES and INSTRUCTIONS can be submitted with two different
520+ * attribute::type values:
521+ * - PERF_TYPE_HARDWARE:
522+ * - pmu->type:
523+ * Handle both type of invocations identical. They address the same hardware.
524+ * The result is different when event modifiers exclude_kernel and/or
525+ * exclude_user are also set.
526+ */
527+static int cpumf_pmu_event_type(struct perf_event *event)
528+{
529+ u64 ev = event->attr.config;
530+
531+ if (cpumf_generic_events_basic[PERF_COUNT_HW_CPU_CYCLES] == ev ||
532+ cpumf_generic_events_basic[PERF_COUNT_HW_INSTRUCTIONS] == ev ||
533+ cpumf_generic_events_user[PERF_COUNT_HW_CPU_CYCLES] == ev ||
534+ cpumf_generic_events_user[PERF_COUNT_HW_INSTRUCTIONS] == ev)
535+ return PERF_TYPE_HARDWARE;
536+ return PERF_TYPE_RAW;
537+}
538+
519539 static int cpumf_pmu_event_init(struct perf_event *event)
520540 {
521541 unsigned int type = event->attr.type;
@@ -525,7 +545,7 @@ static int cpumf_pmu_event_init(struct perf_event *event) · 3 unmodified lines
525545 err = __hw_perf_event_init(event, type);
526546 else if (event->pmu->type == type)
527547 /* Registered as unknown PMU */
528− err = __hw_perf_event_init(event, PERF_TYPE_RAW);
548+ err = __hw_perf_event_init(event, cpumf_pmu_event_type(event));
529549 else
530550 return -ENOENT;
531551
arch/s390/kernel/perf_pai_crypto.c+15−5
@@ -193,8 +193,9 @@ static int paicrypt_event_init(struct perf_event *event) · 192 unmodified lines
193193 /* PAI crypto PMU registered as PERF_TYPE_RAW, check event type */
194194 if (a->type != PERF_TYPE_RAW && event->pmu->type != a->type)
195195 return -ENOENT;
196− /* PAI crypto event must be valid */
197− if (a->config > PAI_CRYPTO_BASE + paicrypt_cnt)
196+ /* PAI crypto event must be in valid range */
197+ if (a->config < PAI_CRYPTO_BASE ||
198+ a->config > PAI_CRYPTO_BASE + paicrypt_cnt)
198199 return -EINVAL;
199200 /* Allow only CPU wide operation, no process context for now. */
200201 if (event->hw.target || event->cpu == -1)
@@ -208,6 +209,12 @@ static int paicrypt_event_init(struct perf_event *event) · 7 unmodified lines
208209 if (rc)
209210 return rc;
210211
212+ /* Event initialization sets last_tag to 0. When later on the events
213+ * are deleted and re-added, do not reset the event count value to zero.
214+ * Events are added, deleted and re-added when 2 or more events
215+ * are active at the same time.
216+ */
217+ event->hw.last_tag = 0;
211218 cpump->event = event;
212219 event->destroy = paicrypt_event_destroy;
213220
@@ -242,9 +249,12 @@ static void paicrypt_start(struct perf_event *event, int flags) · 28 unmodified lines
242249 {
243250 u64 sum;
244251
245− sum = paicrypt_getall(event); /* Get current value */
246− local64_set(&event->hw.prev_count, sum);
247− local64_set(&event->count, 0);
252+ if (!event->hw.last_tag) {
253+ event->hw.last_tag = 1;
254+ sum = paicrypt_getall(event); /* Get current value */
255+ local64_set(&event->count, 0);
256+ local64_set(&event->hw.prev_count, sum);
257+ }
248258 }
249259
250260 static int paicrypt_add(struct perf_event *event, int flags)
arch/x86/coco/tdx/tdx.c+136−51
@@ -124,6 +124,51 @@ static u64 get_cc_mask(void) · 123 unmodified lines
124124 return BIT_ULL(gpa_width - 1);
125125 }
126126
127+/*
128+ * The TDX module spec states that #VE may be injected for a limited set of
129+ * reasons:
130+ *
131+ * - Emulation of the architectural #VE injection on EPT violation;
132+ *
133+ * - As a result of guest TD execution of a disallowed instruction,
134+ * a disallowed MSR access, or CPUID virtualization;
135+ *
136+ * - A notification to the guest TD about anomalous behavior;
137+ *
138+ * The last one is opt-in and is not used by the kernel.
139+ *
140+ * The Intel Software Developer's Manual describes cases when instruction
141+ * length field can be used in section "Information for VM Exits Due to
142+ * Instruction Execution".
143+ *
144+ * For TDX, it ultimately means GET_VEINFO provides reliable instruction length
145+ * information if #VE occurred due to instruction execution, but not for EPT
146+ * violations.
147+ */
148+static int ve_instr_len(struct ve_info *ve)
149+{
150+ switch (ve->exit_reason) {
151+ case EXIT_REASON_HLT:
152+ case EXIT_REASON_MSR_READ:
153+ case EXIT_REASON_MSR_WRITE:
154+ case EXIT_REASON_CPUID:
155+ case EXIT_REASON_IO_INSTRUCTION:
156+ /* It is safe to use ve->instr_len for #VE due instructions */
157+ return ve->instr_len;
158+ case EXIT_REASON_EPT_VIOLATION:
159+ /*
160+ * For EPT violations, ve->insn_len is not defined. For those,
161+ * the kernel must decode instructions manually and should not
162+ * be using this function.
163+ */
164+ WARN_ONCE(1, "ve->instr_len is not defined for EPT violations");
165+ return 0;
166+ default:
167+ WARN_ONCE(1, "Unexpected #VE-type: %lld\n", ve->exit_reason);
168+ return ve->instr_len;
169+ }
170+}
171+
127172 static u64 __cpuidle __halt(const bool irq_disabled, const bool do_sti)
128173 {
129174 struct tdx_hypercall_args args = {
@@ -147,7 +192,7 @@ static u64 __cpuidle __halt(const bool irq_disabled, const bool do_sti) · 17 unmodified lines
147192 return __tdx_hypercall(&args, do_sti ? TDX_HCALL_ISSUE_STI : 0);
148193 }
149194
150−static bool handle_halt(void)
195+static int handle_halt(struct ve_info *ve)
151196 {
152197 /*
153198 * Since non safe halt is mainly used in CPU offlining
@@ -158,9 +203,9 @@ static bool handle_halt(void) · 4 unmodified lines
158203 const bool do_sti = false;
159204
160205 if (__halt(irq_disabled, do_sti))
161− return false;
206+ return -EIO;
162207
163− return true;
208+ return ve_instr_len(ve);
164209 }
165210
166211 void __cpuidle tdx_safe_halt(void)
@@ -180,7 +225,7 @@ void __cpuidle tdx_safe_halt(void) · 13 unmodified lines
180225 WARN_ONCE(1, "HLT instruction emulation failed\n");
181226 }
182227
183−static bool read_msr(struct pt_regs *regs)
228+static int read_msr(struct pt_regs *regs, struct ve_info *ve)
184229 {
185230 struct tdx_hypercall_args args = {
186231 .r10 = TDX_HYPERCALL_STANDARD,
@@ -194,14 +239,14 @@ static bool read_msr(struct pt_regs *regs) · 7 unmodified lines
194239 * (GHCI), section titled "TDG.VP.VMCALL<Instruction.RDMSR>".
195240 */
196241 if (__tdx_hypercall(&args, TDX_HCALL_HAS_OUTPUT))
197− return false;
242+ return -EIO;
198243
199244 regs->ax = lower_32_bits(args.r11);
200245 regs->dx = upper_32_bits(args.r11);
201− return true;
246+ return ve_instr_len(ve);
202247 }
203248
204−static bool write_msr(struct pt_regs *regs)
249+static int write_msr(struct pt_regs *regs, struct ve_info *ve)
205250 {
206251 struct tdx_hypercall_args args = {
207252 .r10 = TDX_HYPERCALL_STANDARD,
@@ -215,10 +260,13 @@ static bool write_msr(struct pt_regs *regs) · 7 unmodified lines
215260 * can be found in TDX Guest-Host-Communication Interface
216261 * (GHCI) section titled "TDG.VP.VMCALL<Instruction.WRMSR>".
217262 */
218− return !__tdx_hypercall(&args, 0);
263+ if (__tdx_hypercall(&args, 0))
264+ return -EIO;
265+
266+ return ve_instr_len(ve);
219267 }
220268
221−static bool handle_cpuid(struct pt_regs *regs)
269+static int handle_cpuid(struct pt_regs *regs, struct ve_info *ve)
222270 {
223271 struct tdx_hypercall_args args = {
224272 .r10 = TDX_HYPERCALL_STANDARD,
@@ -236,7 +284,7 @@ static bool handle_cpuid(struct pt_regs *regs) · 11 unmodified lines
236284 */
237285 if (regs->ax < 0x40000000 || regs->ax > 0x4FFFFFFF) {
238286 regs->ax = regs->bx = regs->cx = regs->dx = 0;
239− return true;
287+ return ve_instr_len(ve);
240288 }
241289
242290 /*
@@ -245,7 +293,7 @@ static bool handle_cpuid(struct pt_regs *regs) · 2 unmodified lines
245293 * (GHCI), section titled "VP.VMCALL<Instruction.CPUID>".
246294 */
247295 if (__tdx_hypercall(&args, TDX_HCALL_HAS_OUTPUT))
248− return false;
296+ return -EIO;
249297
250298 /*
251299 * As per TDX GHCI CPUID ABI, r12-r15 registers contain contents of
@@ -257,7 +305,7 @@ static bool handle_cpuid(struct pt_regs *regs) · 5 unmodified lines
257305 regs->cx = args.r14;
258306 regs->dx = args.r15;
259307
260− return true;
308+ return ve_instr_len(ve);
261309 }
262310
263311 static bool mmio_read(int size, unsigned long addr, unsigned long *val)
@@ -283,10 +331,10 @@ static bool mmio_write(int size, unsigned long addr, unsigned long val) · 19 unmodified lines
283331 EPT_WRITE, addr, val);
284332 }
285333
286−static bool handle_mmio(struct pt_regs *regs, struct ve_info *ve)
334+static int handle_mmio(struct pt_regs *regs, struct ve_info *ve)
287335 {
336+ unsigned long *reg, val, vaddr;
288337 char buffer[MAX_INSN_SIZE];
289− unsigned long *reg, val;
290338 struct insn insn = {};
291339 enum mmio_type mmio;
292340 int size, extend_size;
@@ -294,34 +342,49 @@ static bool handle_mmio(struct pt_regs *regs, struct ve_info *ve) · 1 unmodified line
294342
295343 /* Only in-kernel MMIO is supported */
296344 if (WARN_ON_ONCE(user_mode(regs)))
297− return false;
345+ return -EFAULT;
298346
299347 if (copy_from_kernel_nofault(buffer, (void *)regs->ip, MAX_INSN_SIZE))
300− return false;
348+ return -EFAULT;
301349
302350 if (insn_decode(&insn, buffer, MAX_INSN_SIZE, INSN_MODE_64))
303− return false;
351+ return -EINVAL;
304352
305353 mmio = insn_decode_mmio(&insn, &size);
306354 if (WARN_ON_ONCE(mmio == MMIO_DECODE_FAILED))
307− return false;
355+ return -EINVAL;
308356
309357 if (mmio != MMIO_WRITE_IMM && mmio != MMIO_MOVS) {
310358 reg = insn_get_modrm_reg_ptr(&insn, regs);
311359 if (!reg)
312− return false;
360+ return -EINVAL;
313361 }
314362
315− ve->instr_len = insn.length;
363+ /*
364+ * Reject EPT violation #VEs that split pages.
365+ *
366+ * MMIO accesses are supposed to be naturally aligned and therefore
367+ * never cross page boundaries. Seeing split page accesses indicates
368+ * a bug or a load_unaligned_zeropad() that stepped into an MMIO page.
369+ *
370+ * load_unaligned_zeropad() will recover using exception fixups.
371+ */
372+ vaddr = (unsigned long)insn_get_addr_ref(&insn, regs);
373+ if (vaddr / PAGE_SIZE != (vaddr + size - 1) / PAGE_SIZE)
374+ return -EFAULT;
316375
317376 /* Handle writes first */
318377 switch (mmio) {
319378 case MMIO_WRITE:
320379 memcpy(&val, reg, size);
321− return mmio_write(size, ve->gpa, val);
380+ if (!mmio_write(size, ve->gpa, val))
381+ return -EIO;
382+ return insn.length;
322383 case MMIO_WRITE_IMM:
323384 val = insn.immediate.value;
324− return mmio_write(size, ve->gpa, val);
385+ if (!mmio_write(size, ve->gpa, val))
386+ return -EIO;
387+ return insn.length;
325388 case MMIO_READ:
326389 case MMIO_READ_ZERO_EXTEND:
327390 case MMIO_READ_SIGN_EXTEND:
@@ -334,15 +397,15 @@ static bool handle_mmio(struct pt_regs *regs, struct ve_info *ve) · 6 unmodified lines
334397 * decoded or handled properly. It was likely not using io.h
335398 * helpers or accessed MMIO accidentally.
336399 */
337− return false;
400+ return -EINVAL;
338401 default:
339402 WARN_ONCE(1, "Unknown insn_decode_mmio() decode value?");
340− return false;
403+ return -EINVAL;
341404 }
342405
343406 /* Handle reads */
344407 if (!mmio_read(size, ve->gpa, &val))
345− return false;
408+ return -EIO;
346409
347410 switch (mmio) {
348411 case MMIO_READ:
@@ -364,13 +427,13 @@ static bool handle_mmio(struct pt_regs *regs, struct ve_info *ve) · 15 unmodified lines
364427 default:
365428 /* All other cases has to be covered with the first switch() */
366429 WARN_ON_ONCE(1);
367− return false;
430+ return -EINVAL;
368431 }
369432
370433 if (extend_size)
371434 memset(reg, extend_val, extend_size);
372435 memcpy(reg, &val, size);
373− return true;
436+ return insn.length;
374437 }
375438
376439 static bool handle_in(struct pt_regs *regs, int size, int port)
@@ -421,13 +484,14 @@ static bool handle_out(struct pt_regs *regs, int size, int port) · 44 unmodified lines
421484 *
422485 * Return True on success or False on failure.
423486 */
424−static bool handle_io(struct pt_regs *regs, u32 exit_qual)
487+static int handle_io(struct pt_regs *regs, struct ve_info *ve)
425488 {
489+ u32 exit_qual = ve->exit_qual;
426490 int size, port;
427− bool in;
491+ bool in, ret;
428492
429493 if (VE_IS_IO_STRING(exit_qual))
430− return false;
494+ return -EIO;
431495
432496 in = VE_IS_IO_IN(exit_qual);
433497 size = VE_GET_IO_SIZE(exit_qual);
@@ -435,9 +499,13 @@ static bool handle_io(struct pt_regs *regs, u32 exit_qual) · 1 unmodified line
435499
436500
437501 if (in)
438− return handle_in(regs, size, port);
502+ ret = handle_in(regs, size, port);
439503 else
440− return handle_out(regs, size, port);
504+ ret = handle_out(regs, size, port);
505+ if (!ret)
506+ return -EIO;
507+
508+ return ve_instr_len(ve);
441509 }
442510
443511 /*
@@ -447,13 +515,19 @@ static bool handle_io(struct pt_regs *regs, u32 exit_qual) · 3 unmodified lines
447515 __init bool tdx_early_handle_ve(struct pt_regs *regs)
448516 {
449517 struct ve_info ve;
518+ int insn_len;
450519
451520 tdx_get_ve_info(&ve);
452521
453522 if (ve.exit_reason != EXIT_REASON_IO_INSTRUCTION)
454523 return false;
455524
456− return handle_io(regs, ve.exit_qual);
525+ insn_len = handle_io(regs, &ve);
526+ if (insn_len < 0)
527+ return false;
528+
529+ regs->ip += insn_len;
530+ return true;
457531 }
458532
459533 void tdx_get_ve_info(struct ve_info *ve)
@@ -486,54 +560,65 @@ void tdx_get_ve_info(struct ve_info *ve) · 26 unmodified lines
486560 ve->instr_info = upper_32_bits(out.r10);
487561 }
488562
489−/* Handle the user initiated #VE */
490−static bool virt_exception_user(struct pt_regs *regs, struct ve_info *ve)
563+/*
564+ * Handle the user initiated #VE.
565+ *
566+ * On success, returns the number of bytes RIP should be incremented (>=0)
567+ * or -errno on error.
568+ */
569+static int virt_exception_user(struct pt_regs *regs, struct ve_info *ve)
491570 {
492571 switch (ve->exit_reason) {
493572 case EXIT_REASON_CPUID:
494− return handle_cpuid(regs);
573+ return handle_cpuid(regs, ve);
495574 default:
496575 pr_warn("Unexpected #VE: %lld\n", ve->exit_reason);
497− return false;
576+ return -EIO;
498577 }
499578 }
500579
501−/* Handle the kernel #VE */
502−static bool virt_exception_kernel(struct pt_regs *regs, struct ve_info *ve)
580+/*
581+ * Handle the kernel #VE.
582+ *
583+ * On success, returns the number of bytes RIP should be incremented (>=0)
584+ * or -errno on error.
585+ */
586+static int virt_exception_kernel(struct pt_regs *regs, struct ve_info *ve)
503587 {
504588 switch (ve->exit_reason) {
505589 case EXIT_REASON_HLT:
506− return handle_halt();
590+ return handle_halt(ve);
507591 case EXIT_REASON_MSR_READ:
508− return read_msr(regs);
592+ return read_msr(regs, ve);
509593 case EXIT_REASON_MSR_WRITE:
510− return write_msr(regs);
594+ return write_msr(regs, ve);
511595 case EXIT_REASON_CPUID:
512− return handle_cpuid(regs);
596+ return handle_cpuid(regs, ve);
513597 case EXIT_REASON_EPT_VIOLATION:
514598 return handle_mmio(regs, ve);
515599 case EXIT_REASON_IO_INSTRUCTION:
516− return handle_io(regs, ve->exit_qual);
600+ return handle_io(regs, ve);
517601 default:
518602 pr_warn("Unexpected #VE: %lld\n", ve->exit_reason);
519− return false;
603+ return -EIO;
520604 }
521605 }
522606
523607 bool tdx_handle_virt_exception(struct pt_regs *regs, struct ve_info *ve)
524608 {
525− bool ret;
609+ int insn_len;
526610
527611 if (user_mode(regs))
528− ret = virt_exception_user(regs, ve);
612+ insn_len = virt_exception_user(regs, ve);
529613 else
530− ret = virt_exception_kernel(regs, ve);
614+ insn_len = virt_exception_kernel(regs, ve);
615+ if (insn_len < 0)
616+ return false;
531617
532618 /* After successful #VE handling, move the IP */
533− if (ret)
534− regs->ip += ve->instr_len;
619+ regs->ip += insn_len;
535620
536− return ret;
621+ return true;
537622 }
538623
539624 static bool tdx_tlb_flush_required(bool private)
arch/x86/hyperv/hv_init.c+6−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/io.h>
1414 #include <asm/apic.h>
1515 #include <asm/desc.h>
16+#include <asm/sev.h>
1617 #include <asm/hypervisor.h>
1718 #include <asm/hyperv-tlfs.h>
1819 #include <asm/mshyperv.h>
@@ -405,6 +406,11 @@ void __init hyperv_init(void) · 386 unmodified lines
405406 }
406407
407408 if (hv_isolation_type_snp()) {
409+ /* Negotiate GHCB Version. */
410+ if (!hv_ghcb_negotiate_protocol())
411+ hv_ghcb_terminate(SEV_TERM_SET_GEN,
412+ GHCB_SEV_ES_PROT_UNSUPPORTED);
413+
408414 hv_ghcb_pg = alloc_percpu(union hv_ghcb *);
409415 if (!hv_ghcb_pg)
410416 goto free_vp_assist_page;
arch/x86/hyperv/ivm.c+78−6
@@ -53,6 +53,8 @@ union hv_ghcb { · 52 unmodified lines
5353 } hypercall;
5454 } __packed __aligned(HV_HYP_PAGE_SIZE);
5555
56+static u16 hv_ghcb_version __ro_after_init;
57+
5658 u64 hv_ghcb_hypercall(u64 control, void *input, void *output, u32 input_size)
5759 {
5860 union hv_ghcb *hv_ghcb;
@@ -96,12 +98,85 @@ u64 hv_ghcb_hypercall(u64 control, void *input, void *output, u32 input_size) · 37 unmodified lines
9698 return status;
9799 }
98100
101+static inline u64 rd_ghcb_msr(void)
102+{
103+ return __rdmsr(MSR_AMD64_SEV_ES_GHCB);
104+}
105+
106+static inline void wr_ghcb_msr(u64 val)
107+{
108+ native_wrmsrl(MSR_AMD64_SEV_ES_GHCB, val);
109+}
110+
111+static enum es_result hv_ghcb_hv_call(struct ghcb *ghcb, u64 exit_code,
112+ u64 exit_info_1, u64 exit_info_2)
113+{
114+ /* Fill in protocol and format specifiers */
115+ ghcb->protocol_version = hv_ghcb_version;
116+ ghcb->ghcb_usage = GHCB_DEFAULT_USAGE;
117+
118+ ghcb_set_sw_exit_code(ghcb, exit_code);
119+ ghcb_set_sw_exit_info_1(ghcb, exit_info_1);
120+ ghcb_set_sw_exit_info_2(ghcb, exit_info_2);
121+
122+ VMGEXIT();
123+
124+ if (ghcb->save.sw_exit_info_1 & GENMASK_ULL(31, 0))
125+ return ES_VMM_ERROR;
126+ else
127+ return ES_OK;
128+}
129+
130+void hv_ghcb_terminate(unsigned int set, unsigned int reason)
131+{
132+ u64 val = GHCB_MSR_TERM_REQ;
133+
134+ /* Tell the hypervisor what went wrong. */
135+ val |= GHCB_SEV_TERM_REASON(set, reason);
136+
137+ /* Request Guest Termination from Hypvervisor */
138+ wr_ghcb_msr(val);
139+ VMGEXIT();
140+
141+ while (true)
142+ asm volatile("hlt\n" : : : "memory");
143+}
144+
145+bool hv_ghcb_negotiate_protocol(void)
146+{
147+ u64 ghcb_gpa;
148+ u64 val;
149+
150+ /* Save ghcb page gpa. */
151+ ghcb_gpa = rd_ghcb_msr();
152+
153+ /* Do the GHCB protocol version negotiation */
154+ wr_ghcb_msr(GHCB_MSR_SEV_INFO_REQ);
155+ VMGEXIT();
156+ val = rd_ghcb_msr();
157+
158+ if (GHCB_MSR_INFO(val) != GHCB_MSR_SEV_INFO_RESP)
159+ return false;
160+
161+ if (GHCB_MSR_PROTO_MAX(val) < GHCB_PROTOCOL_MIN ||
162+ GHCB_MSR_PROTO_MIN(val) > GHCB_PROTOCOL_MAX)
163+ return false;
164+
165+ hv_ghcb_version = min_t(size_t, GHCB_MSR_PROTO_MAX(val),
166+ GHCB_PROTOCOL_MAX);
167+
168+ /* Write ghcb page back after negotiating protocol. */
169+ wr_ghcb_msr(ghcb_gpa);
170+ VMGEXIT();
171+
172+ return true;
173+}
174+
99175 void hv_ghcb_msr_write(u64 msr, u64 value)
100176 {
101177 union hv_ghcb *hv_ghcb;
102178 void **ghcb_base;
103179 unsigned long flags;
104− struct es_em_ctxt ctxt;
105180
106181 if (!hv_ghcb_pg)
107182 return;
@@ -120,8 +195,7 @@ void hv_ghcb_msr_write(u64 msr, u64 value) · 12 unmodified lines
120195 ghcb_set_rax(&hv_ghcb->ghcb, lower_32_bits(value));
121196 ghcb_set_rdx(&hv_ghcb->ghcb, upper_32_bits(value));
122197
123− if (sev_es_ghcb_hv_call(&hv_ghcb->ghcb, false, &ctxt,
124− SVM_EXIT_MSR, 1, 0))
198+ if (hv_ghcb_hv_call(&hv_ghcb->ghcb, SVM_EXIT_MSR, 1, 0))
125199 pr_warn("Fail to write msr via ghcb %llx.\n", msr);
126200
127201 local_irq_restore(flags);
@@ -133,7 +207,6 @@ void hv_ghcb_msr_read(u64 msr, u64 *value) · 5 unmodified lines
133207 union hv_ghcb *hv_ghcb;
134208 void **ghcb_base;
135209 unsigned long flags;
136− struct es_em_ctxt ctxt;
137210
138211 /* Check size of union hv_ghcb here. */
139212 BUILD_BUG_ON(sizeof(union hv_ghcb) != HV_HYP_PAGE_SIZE);
@@ -152,8 +225,7 @@ void hv_ghcb_msr_read(u64 msr, u64 *value) · 12 unmodified lines
152225 }
153226
154227 ghcb_set_rcx(&hv_ghcb->ghcb, msr);
155− if (sev_es_ghcb_hv_call(&hv_ghcb->ghcb, false, &ctxt,
156− SVM_EXIT_MSR, 0, 0))
228+ if (hv_ghcb_hv_call(&hv_ghcb->ghcb, SVM_EXIT_MSR, 0, 0))
157229 pr_warn("Fail to read msr via ghcb %llx.\n", msr);
158230 else
159231 *value = (u64)lower_32_bits(hv_ghcb->ghcb.save.rax)
arch/x86/include/asm/cpufeatures.h+1−0
@@ -446,5 +446,6 @@ · 445 unmodified lines
446446 #define X86_BUG_TAA X86_BUG(22) /* CPU is affected by TSX Async Abort(TAA) */
447447 #define X86_BUG_ITLB_MULTIHIT X86_BUG(23) /* CPU may incur MCE during certain page attribute changes */
448448 #define X86_BUG_SRBDS X86_BUG(24) /* CPU may leak RNG bits if not mitigated */
449+#define X86_BUG_MMIO_STALE_DATA X86_BUG(25) /* CPU is affected by Processor MMIO Stale Data vulnerabilities */
449450
450451 #endif /* _ASM_X86_CPUFEATURES_H */
arch/x86/include/asm/e820/api.h+0−5
@@ -4,9 +4,6 @@ · 3 unmodified lines
44
55 #include <asm/e820/types.h>
66
7−struct device;
8−struct resource;
9−
107 extern struct e820_table *e820_table;
118 extern struct e820_table *e820_table_kexec;
129 extern struct e820_table *e820_table_firmware;
@@ -46,8 +43,6 @@ extern void e820__register_nosave_regions(unsigned long limit_pfn); · 33 unmodified lines
4643
4744 extern int e820__get_entry_type(u64 start, u64 end);
4845
49−extern void remove_e820_regions(struct device *dev, struct resource *avail);
50−
5146 /*
5247 * Returns true iff the specified range [start,end) is completely contained inside
5348 * the ISA region.
arch/x86/include/asm/efi.h+1−1
@@ -323,7 +323,7 @@ static inline u32 efi64_convert_status(efi_status_t status) · 322 unmodified lines
323323 #define __efi64_argmap_get_memory_space_descriptor(phys, desc) \
324324 (__efi64_split(phys), (desc))
325325
326−#define __efi64_argmap_set_memory_space_descriptor(phys, size, flags) \
326+#define __efi64_argmap_set_memory_space_attributes(phys, size, flags) \
327327 (__efi64_split(phys), __efi64_split(size), __efi64_split(flags))
328328
329329 /*
arch/x86/include/asm/kvm_host.h+65−2
@@ -1047,14 +1047,77 @@ struct kvm_x86_msr_filter { · 1046 unmodified lines
10471047 };
10481048
10491049 enum kvm_apicv_inhibit {
1050+
1051+ /********************************************************************/
1052+ /* INHIBITs that are relevant to both Intel's APICv and AMD's AVIC. */
1053+ /********************************************************************/
1054+
1055+ /*
1056+ * APIC acceleration is disabled by a module parameter
1057+ * and/or not supported in hardware.
1058+ */
10501059 APICV_INHIBIT_REASON_DISABLE,
1060+
1061+ /*
1062+ * APIC acceleration is inhibited because AutoEOI feature is
1063+ * being used by a HyperV guest.
1064+ */
10511065 APICV_INHIBIT_REASON_HYPERV,
1066+
1067+ /*
1068+ * APIC acceleration is inhibited because the userspace didn't yet
1069+ * enable the kernel/split irqchip.
1070+ */
1071+ APICV_INHIBIT_REASON_ABSENT,
1072+
1073+ /* APIC acceleration is inhibited because KVM_GUESTDBG_BLOCKIRQ
1074+ * (out of band, debug measure of blocking all interrupts on this vCPU)
1075+ * was enabled, to avoid AVIC/APICv bypassing it.
1076+ */
1077+ APICV_INHIBIT_REASON_BLOCKIRQ,
1078+
1079+ /*
1080+ * For simplicity, the APIC acceleration is inhibited
1081+ * first time either APIC ID or APIC base are changed by the guest
1082+ * from their reset values.
1083+ */
1084+ APICV_INHIBIT_REASON_APIC_ID_MODIFIED,
1085+ APICV_INHIBIT_REASON_APIC_BASE_MODIFIED,
1086+
1087+ /******************************************************/
1088+ /* INHIBITs that are relevant only to the AMD's AVIC. */
1089+ /******************************************************/
1090+
1091+ /*
1092+ * AVIC is inhibited on a vCPU because it runs a nested guest.
1093+ *
1094+ * This is needed because unlike APICv, the peers of this vCPU
1095+ * cannot use the doorbell mechanism to signal interrupts via AVIC when
1096+ * a vCPU runs nested.
1097+ */
10521098 APICV_INHIBIT_REASON_NESTED,
1099+
1100+ /*
1101+ * On SVM, the wait for the IRQ window is implemented with pending vIRQ,
1102+ * which cannot be injected when the AVIC is enabled, thus AVIC
1103+ * is inhibited while KVM waits for IRQ window.
1104+ */
10531105 APICV_INHIBIT_REASON_IRQWIN,
1106+
1107+ /*
1108+ * PIT (i8254) 're-inject' mode, relies on EOI intercept,
1109+ * which AVIC doesn't support for edge triggered interrupts.
1110+ */
10541111 APICV_INHIBIT_REASON_PIT_REINJ,
1112+
1113+ /*
1114+ * AVIC is inhibited because the guest has x2apic in its CPUID.
1115+ */
10551116 APICV_INHIBIT_REASON_X2APIC,
1056− APICV_INHIBIT_REASON_BLOCKIRQ,
1057− APICV_INHIBIT_REASON_ABSENT,
1117+
1118+ /*
1119+ * AVIC is disabled because SEV doesn't support it.
1120+ */
10581121 APICV_INHIBIT_REASON_SEV,
10591122 };
10601123
arch/x86/include/asm/mshyperv.h+4−0
@@ -179,9 +179,13 @@ int hv_set_mem_host_visibility(unsigned long addr, int numpages, bool visible); · 178 unmodified lines
179179 #ifdef CONFIG_AMD_MEM_ENCRYPT
180180 void hv_ghcb_msr_write(u64 msr, u64 value);
181181 void hv_ghcb_msr_read(u64 msr, u64 *value);
182+bool hv_ghcb_negotiate_protocol(void);
183+void hv_ghcb_terminate(unsigned int set, unsigned int reason);
182184 #else
183185 static inline void hv_ghcb_msr_write(u64 msr, u64 value) {}
184186 static inline void hv_ghcb_msr_read(u64 msr, u64 *value) {}
187+static inline bool hv_ghcb_negotiate_protocol(void) { return false; }
188+static inline void hv_ghcb_terminate(unsigned int set, unsigned int reason) {}
185189 #endif
186190
187191 extern bool hv_isolation_type_snp(void);
arch/x86/include/asm/msr-index.h+25−0
@@ -116,6 +116,30 @@ · 115 unmodified lines
116116 * Not susceptible to
117117 * TSX Async Abort (TAA) vulnerabilities.
118118 */
119+#define ARCH_CAP_SBDR_SSDP_NO BIT(13) /*
120+ * Not susceptible to SBDR and SSDP
121+ * variants of Processor MMIO stale data
122+ * vulnerabilities.
123+ */
124+#define ARCH_CAP_FBSDP_NO BIT(14) /*
125+ * Not susceptible to FBSDP variant of
126+ * Processor MMIO stale data
127+ * vulnerabilities.
128+ */
129+#define ARCH_CAP_PSDP_NO BIT(15) /*
130+ * Not susceptible to PSDP variant of
131+ * Processor MMIO stale data
132+ * vulnerabilities.
133+ */
134+#define ARCH_CAP_FB_CLEAR BIT(17) /*
135+ * VERW clears CPU fill buffer
136+ * even on MDS_NO CPUs.
137+ */
138+#define ARCH_CAP_FB_CLEAR_CTRL BIT(18) /*
139+ * MSR_IA32_MCU_OPT_CTRL[FB_CLEAR_DIS]
140+ * bit available to control VERW
141+ * behavior.
142+ */
119143
120144 #define MSR_IA32_FLUSH_CMD 0x0000010b
121145 #define L1D_FLUSH BIT(0) /*
@@ -133,6 +157,7 @@ · 11 unmodified lines
133157 #define MSR_IA32_MCU_OPT_CTRL 0x00000123
134158 #define RNGDS_MITG_DIS BIT(0) /* SRBDS support */
135159 #define RTM_ALLOW BIT(1) /* TSX development mode */
160+#define FB_CLEAR_DIS BIT(3) /* CPU Fill buffer clear disable */
136161
137162 #define MSR_IA32_SYSENTER_CS 0x00000174
138163 #define MSR_IA32_SYSENTER_ESP 0x00000175
arch/x86/include/asm/nospec-branch.h+2−0
@@ -269,6 +269,8 @@ DECLARE_STATIC_KEY_FALSE(mds_idle_clear); · 268 unmodified lines
269269
270270 DECLARE_STATIC_KEY_FALSE(switch_mm_cond_l1d_flush);
271271
272+DECLARE_STATIC_KEY_FALSE(mmio_stale_data_clear);
273+
272274 #include <asm/segment.h>
273275
274276 /**
arch/x86/include/asm/pci_x86.h+8−0
@@ -69,6 +69,8 @@ void pcibios_scan_specific_bus(int busn); · 68 unmodified lines
6969
7070 /* pci-irq.c */
7171
72+struct pci_dev;
73+
7274 struct irq_info {
7375 u8 bus, devfn; /* Bus, device and function */
7476 struct {
@@ -246,3 +248,9 @@ static inline void mmio_config_writel(void __iomem *pos, u32 val) · 171 unmodified lines
246248 # define x86_default_pci_init_irq NULL
247249 # define x86_default_pci_fixup_irqs NULL
248250 #endif
251+
252+#if defined(CONFIG_PCI) && defined(CONFIG_ACPI)
253+extern bool pci_use_e820;
254+#else
255+#define pci_use_e820 false
256+#endif
arch/x86/include/asm/setup.h+21−17
@@ -108,19 +108,16 @@ extern unsigned long _brk_end; · 107 unmodified lines
108108 void *extend_brk(size_t size, size_t align);
109109
110110 /*
111− * Reserve space in the brk section. The name must be unique within the file,
112− * and somewhat descriptive. The size is in bytes.
111+ * Reserve space in the .brk section, which is a block of memory from which the
112+ * caller is allowed to allocate very early (before even memblock is available)
113+ * by calling extend_brk(). All allocated memory will be eventually converted
114+ * to memblock. Any leftover unallocated memory will be freed.
113115 *
114− * The allocation is done using inline asm (rather than using a section
115− * attribute on a normal variable) in order to allow the use of @nobits, so
116− * that it doesn't take up any space in the vmlinux file.
116+ * The size is in bytes.
117117 */
118−#define RESERVE_BRK(name, size) \
119− asm(".pushsection .brk_reservation,\"aw\",@nobits\n\t" \
120− ".brk." #name ":\n\t" \
121− ".skip " __stringify(size) "\n\t" \
122− ".size .brk." #name ", " __stringify(size) "\n\t" \
123− ".popsection\n\t")
118+#define RESERVE_BRK(name, size) \
119+ __section(".bss..brk") __aligned(1) __used \
120+ static char __brk_##name[size]
124121
125122 extern void probe_roms(void);
126123 #ifdef __i386__
@@ -133,12 +130,19 @@ asmlinkage void __init x86_64_start_reservations(char *real_mode_data); · 6 unmodified lines
133130
134131 #endif /* __i386__ */
135132 #endif /* _SETUP */
136−#else
137−#define RESERVE_BRK(name,sz) \
138− .pushsection .brk_reservation,"aw",@nobits; \
139−.brk.name: \
140−1: .skip sz; \
141− .size .brk.name,.-1b; \
133+
134+#else /* __ASSEMBLY */
135+
136+.macro __RESERVE_BRK name, size
137+ .pushsection .bss..brk, "aw"
138+SYM_DATA_START(__brk_\name)
139+ .skip \size
140+SYM_DATA_END(__brk_\name)
142141 .popsection
142+.endm
143+
144+#define RESERVE_BRK(name, size) __RESERVE_BRK name, size
145+
143146 #endif /* __ASSEMBLY__ */
147+
144148 #endif /* _ASM_X86_SETUP_H */
arch/x86/kernel/Makefile+0−4
@@ -36,10 +36,6 @@ KCSAN_SANITIZE := n · 35 unmodified lines
3636
3737 OBJECT_FILES_NON_STANDARD_test_nx.o := y
3838
39−ifdef CONFIG_FRAME_POINTER
40−OBJECT_FILES_NON_STANDARD_ftrace_$(BITS).o := y
41−endif
42−
4339 # If instrumentation of this dir is enabled, boot hangs during first second.
4440 # Probably could be more selective here, but note that files related to irqs,
4541 # boot, dumpstack/stacktrace, etc are either non-interesting or can lead to
arch/x86/kernel/cpu/bugs.c+199−36
@@ -41,8 +41,10 @@ static void __init spectre_v2_select_mitigation(void); · 40 unmodified lines
4141 static void __init ssb_select_mitigation(void);
4242 static void __init l1tf_select_mitigation(void);
4343 static void __init mds_select_mitigation(void);
44−static void __init mds_print_mitigation(void);
44+static void __init md_clear_update_mitigation(void);
45+static void __init md_clear_select_mitigation(void);
4546 static void __init taa_select_mitigation(void);
47+static void __init mmio_select_mitigation(void);
4648 static void __init srbds_select_mitigation(void);
4749 static void __init l1d_flush_select_mitigation(void);
4850
@@ -85,6 +87,10 @@ EXPORT_SYMBOL_GPL(mds_idle_clear); · 36 unmodified lines
8587 */
8688 DEFINE_STATIC_KEY_FALSE(switch_mm_cond_l1d_flush);
8789
90+/* Controls CPU Fill buffer clear before KVM guest MMIO accesses */
91+DEFINE_STATIC_KEY_FALSE(mmio_stale_data_clear);
92+EXPORT_SYMBOL_GPL(mmio_stale_data_clear);
93+
8894 void __init check_bugs(void)
8995 {
9096 identify_boot_cpu();
@@ -117,17 +123,10 @@ void __init check_bugs(void) · 26 unmodified lines
117123 spectre_v2_select_mitigation();
118124 ssb_select_mitigation();
119125 l1tf_select_mitigation();
120− mds_select_mitigation();
121− taa_select_mitigation();
126+ md_clear_select_mitigation();
122127 srbds_select_mitigation();
123128 l1d_flush_select_mitigation();
124129
125− /*
126− * As MDS and TAA mitigations are inter-related, print MDS
127− * mitigation until after TAA mitigation selection is done.
128− */
129− mds_print_mitigation();
130−
131130 arch_smt_update();
132131
133132 #ifdef CONFIG_X86_32
@@ -267,14 +266,6 @@ static void __init mds_select_mitigation(void) · 133 unmodified lines
267266 }
268267 }
269268
270−static void __init mds_print_mitigation(void)
271−{
272− if (!boot_cpu_has_bug(X86_BUG_MDS) || cpu_mitigations_off())
273− return;
274−
275− pr_info("%s\n", mds_strings[mds_mitigation]);
276−}
277−
278269 static int __init mds_cmdline(char *str)
279270 {
280271 if (!boot_cpu_has_bug(X86_BUG_MDS))
@@ -329,7 +320,7 @@ static void __init taa_select_mitigation(void) · 48 unmodified lines
329320 /* TSX previously disabled by tsx=off */
330321 if (!boot_cpu_has(X86_FEATURE_RTM)) {
331322 taa_mitigation = TAA_MITIGATION_TSX_DISABLED;
332− goto out;
323+ return;
333324 }
334325
335326 if (cpu_mitigations_off()) {
@@ -343,7 +334,7 @@ static void __init taa_select_mitigation(void) · 7 unmodified lines
343334 */
344335 if (taa_mitigation == TAA_MITIGATION_OFF &&
345336 mds_mitigation == MDS_MITIGATION_OFF)
346− goto out;
337+ return;
347338
348339 if (boot_cpu_has(X86_FEATURE_MD_CLEAR))
349340 taa_mitigation = TAA_MITIGATION_VERW;
@@ -375,18 +366,6 @@ static void __init taa_select_mitigation(void) · 25 unmodified lines
375366
376367 if (taa_nosmt || cpu_mitigations_auto_nosmt())
377368 cpu_smt_disable(false);
378−
379− /*
380− * Update MDS mitigation, if necessary, as the mds_user_clear is
381− * now enabled for TAA mitigation.
382− */
383− if (mds_mitigation == MDS_MITIGATION_OFF &&
384− boot_cpu_has_bug(X86_BUG_MDS)) {
385− mds_mitigation = MDS_MITIGATION_FULL;
386− mds_select_mitigation();
387− }
388−out:
389− pr_info("%s\n", taa_strings[taa_mitigation]);
390369 }
391370
392371 static int __init tsx_async_abort_parse_cmdline(char *str)
@@ -410,6 +389,151 @@ static int __init tsx_async_abort_parse_cmdline(char *str) · 17 unmodified lines
410389 }
411390 early_param("tsx_async_abort", tsx_async_abort_parse_cmdline);
412391
392+#undef pr_fmt
393+#define pr_fmt(fmt) "MMIO Stale Data: " fmt
394+
395+enum mmio_mitigations {
396+ MMIO_MITIGATION_OFF,
397+ MMIO_MITIGATION_UCODE_NEEDED,
398+ MMIO_MITIGATION_VERW,
399+};
400+
401+/* Default mitigation for Processor MMIO Stale Data vulnerabilities */
402+static enum mmio_mitigations mmio_mitigation __ro_after_init = MMIO_MITIGATION_VERW;
403+static bool mmio_nosmt __ro_after_init = false;
404+
405+static const char * const mmio_strings[] = {
406+ [MMIO_MITIGATION_OFF] = "Vulnerable",
407+ [MMIO_MITIGATION_UCODE_NEEDED] = "Vulnerable: Clear CPU buffers attempted, no microcode",
408+ [MMIO_MITIGATION_VERW] = "Mitigation: Clear CPU buffers",
409+};
410+
411+static void __init mmio_select_mitigation(void)
412+{
413+ u64 ia32_cap;
414+
415+ if (!boot_cpu_has_bug(X86_BUG_MMIO_STALE_DATA) ||
416+ cpu_mitigations_off()) {
417+ mmio_mitigation = MMIO_MITIGATION_OFF;
418+ return;
419+ }
420+
421+ if (mmio_mitigation == MMIO_MITIGATION_OFF)
422+ return;
423+
424+ ia32_cap = x86_read_arch_cap_msr();
425+
426+ /*
427+ * Enable CPU buffer clear mitigation for host and VMM, if also affected
428+ * by MDS or TAA. Otherwise, enable mitigation for VMM only.
429+ */
430+ if (boot_cpu_has_bug(X86_BUG_MDS) || (boot_cpu_has_bug(X86_BUG_TAA) &&
431+ boot_cpu_has(X86_FEATURE_RTM)))
432+ static_branch_enable(&mds_user_clear);
433+ else
434+ static_branch_enable(&mmio_stale_data_clear);
435+
436+ /*
437+ * If Processor-MMIO-Stale-Data bug is present and Fill Buffer data can
438+ * be propagated to uncore buffers, clearing the Fill buffers on idle
439+ * is required irrespective of SMT state.
440+ */
441+ if (!(ia32_cap & ARCH_CAP_FBSDP_NO))
442+ static_branch_enable(&mds_idle_clear);
443+
444+ /*
445+ * Check if the system has the right microcode.
446+ *
447+ * CPU Fill buffer clear mitigation is enumerated by either an explicit
448+ * FB_CLEAR or by the presence of both MD_CLEAR and L1D_FLUSH on MDS
449+ * affected systems.
450+ */
451+ if ((ia32_cap & ARCH_CAP_FB_CLEAR) ||
452+ (boot_cpu_has(X86_FEATURE_MD_CLEAR) &&
453+ boot_cpu_has(X86_FEATURE_FLUSH_L1D) &&
454+ !(ia32_cap & ARCH_CAP_MDS_NO)))
455+ mmio_mitigation = MMIO_MITIGATION_VERW;
456+ else
457+ mmio_mitigation = MMIO_MITIGATION_UCODE_NEEDED;
458+
459+ if (mmio_nosmt || cpu_mitigations_auto_nosmt())
460+ cpu_smt_disable(false);
461+}
462+
463+static int __init mmio_stale_data_parse_cmdline(char *str)
464+{
465+ if (!boot_cpu_has_bug(X86_BUG_MMIO_STALE_DATA))
466+ return 0;
467+
468+ if (!str)
469+ return -EINVAL;
470+
471+ if (!strcmp(str, "off")) {
472+ mmio_mitigation = MMIO_MITIGATION_OFF;
473+ } else if (!strcmp(str, "full")) {
474+ mmio_mitigation = MMIO_MITIGATION_VERW;
475+ } else if (!strcmp(str, "full,nosmt")) {
476+ mmio_mitigation = MMIO_MITIGATION_VERW;
477+ mmio_nosmt = true;
478+ }
479+
480+ return 0;
481+}
482+early_param("mmio_stale_data", mmio_stale_data_parse_cmdline);
483+
484+#undef pr_fmt
485+#define pr_fmt(fmt) "" fmt
486+
487+static void __init md_clear_update_mitigation(void)
488+{
489+ if (cpu_mitigations_off())
490+ return;
491+
492+ if (!static_key_enabled(&mds_user_clear))
493+ goto out;
494+
495+ /*
496+ * mds_user_clear is now enabled. Update MDS, TAA and MMIO Stale Data
497+ * mitigation, if necessary.
498+ */
499+ if (mds_mitigation == MDS_MITIGATION_OFF &&
500+ boot_cpu_has_bug(X86_BUG_MDS)) {
501+ mds_mitigation = MDS_MITIGATION_FULL;
502+ mds_select_mitigation();
503+ }
504+ if (taa_mitigation == TAA_MITIGATION_OFF &&
505+ boot_cpu_has_bug(X86_BUG_TAA)) {
506+ taa_mitigation = TAA_MITIGATION_VERW;
507+ taa_select_mitigation();
508+ }
509+ if (mmio_mitigation == MMIO_MITIGATION_OFF &&
510+ boot_cpu_has_bug(X86_BUG_MMIO_STALE_DATA)) {
511+ mmio_mitigation = MMIO_MITIGATION_VERW;
512+ mmio_select_mitigation();
513+ }
514+out:
515+ if (boot_cpu_has_bug(X86_BUG_MDS))
516+ pr_info("MDS: %s\n", mds_strings[mds_mitigation]);
517+ if (boot_cpu_has_bug(X86_BUG_TAA))
518+ pr_info("TAA: %s\n", taa_strings[taa_mitigation]);
519+ if (boot_cpu_has_bug(X86_BUG_MMIO_STALE_DATA))
520+ pr_info("MMIO Stale Data: %s\n", mmio_strings[mmio_mitigation]);
521+}
522+
523+static void __init md_clear_select_mitigation(void)
524+{
525+ mds_select_mitigation();
526+ taa_select_mitigation();
527+ mmio_select_mitigation();
528+
529+ /*
530+ * As MDS, TAA and MMIO Stale Data mitigations are inter-related, update
531+ * and print their mitigation after MDS, TAA and MMIO Stale Data
532+ * mitigation selection is done.
533+ */
534+ md_clear_update_mitigation();
535+}
536+
413537 #undef pr_fmt
414538 #define pr_fmt(fmt) "SRBDS: " fmt
415539
@@ -478,11 +602,13 @@ static void __init srbds_select_mitigation(void) · 62 unmodified lines
478602 return;
479603
480604 /*
481− * Check to see if this is one of the MDS_NO systems supporting
482− * TSX that are only exposed to SRBDS when TSX is enabled.
605+ * Check to see if this is one of the MDS_NO systems supporting TSX that
606+ * are only exposed to SRBDS when TSX is enabled or when CPU is affected
607+ * by Processor MMIO Stale Data vulnerability.
483608 */
484609 ia32_cap = x86_read_arch_cap_msr();
485− if ((ia32_cap & ARCH_CAP_MDS_NO) && !boot_cpu_has(X86_FEATURE_RTM))
610+ if ((ia32_cap & ARCH_CAP_MDS_NO) && !boot_cpu_has(X86_FEATURE_RTM) &&
611+ !boot_cpu_has_bug(X86_BUG_MMIO_STALE_DATA))
486612 srbds_mitigation = SRBDS_MITIGATION_TSX_OFF;
487613 else if (boot_cpu_has(X86_FEATURE_HYPERVISOR))
488614 srbds_mitigation = SRBDS_MITIGATION_HYPERVISOR;
@@ -1116,6 +1242,8 @@ static void update_indir_branch_cond(void) · 627 unmodified lines
11161242 /* Update the static key controlling the MDS CPU buffer clear in idle */
11171243 static void update_mds_branch_idle(void)
11181244 {
1245+ u64 ia32_cap = x86_read_arch_cap_msr();
1246+
11191247 /*
11201248 * Enable the idle clearing if SMT is active on CPUs which are
11211249 * affected only by MSBDS and not any other MDS variant.
@@ -1127,14 +1255,17 @@ static void update_mds_branch_idle(void) · 5 unmodified lines
11271255 if (!boot_cpu_has_bug(X86_BUG_MSBDS_ONLY))
11281256 return;
11291257
1130− if (sched_smt_active())
1258+ if (sched_smt_active()) {
11311259 static_branch_enable(&mds_idle_clear);
1132− else
1260+ } else if (mmio_mitigation == MMIO_MITIGATION_OFF ||
1261+ (ia32_cap & ARCH_CAP_FBSDP_NO)) {
11331262 static_branch_disable(&mds_idle_clear);
1263+ }
11341264 }
11351265
11361266 #define MDS_MSG_SMT "MDS CPU bug present and SMT on, data leak possible. See https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/mds.html for more details.\n"
11371267 #define TAA_MSG_SMT "TAA CPU bug present and SMT on, data leak possible. See https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/tsx_async_abort.html for more details.\n"
1268+#define MMIO_MSG_SMT "MMIO Stale Data CPU bug present and SMT on, data leak possible. See https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/processor_mmio_stale_data.html for more details.\n"
11381269
11391270 void cpu_bugs_smt_update(void)
11401271 {
@@ -1179,6 +1310,16 @@ void cpu_bugs_smt_update(void) · 38 unmodified lines
11791310 break;
11801311 }
11811312
1313+ switch (mmio_mitigation) {
1314+ case MMIO_MITIGATION_VERW:
1315+ case MMIO_MITIGATION_UCODE_NEEDED:
1316+ if (sched_smt_active())
1317+ pr_warn_once(MMIO_MSG_SMT);
1318+ break;
1319+ case MMIO_MITIGATION_OFF:
1320+ break;
1321+ }
1322+
11821323 mutex_unlock(&spec_ctrl_mutex);
11831324 }
11841325
@@ -1781,6 +1922,20 @@ static ssize_t tsx_async_abort_show_state(char *buf) · 596 unmodified lines
17811922 sched_smt_active() ? "vulnerable" : "disabled");
17821923 }
17831924
1925+static ssize_t mmio_stale_data_show_state(char *buf)
1926+{
1927+ if (mmio_mitigation == MMIO_MITIGATION_OFF)
1928+ return sysfs_emit(buf, "%s\n", mmio_strings[mmio_mitigation]);
1929+
1930+ if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) {
1931+ return sysfs_emit(buf, "%s; SMT Host state unknown\n",
1932+ mmio_strings[mmio_mitigation]);
1933+ }
1934+
1935+ return sysfs_emit(buf, "%s; SMT %s\n", mmio_strings[mmio_mitigation],
1936+ sched_smt_active() ? "vulnerable" : "disabled");
1937+}
1938+
17841939 static char *stibp_state(void)
17851940 {
17861941 if (spectre_v2_in_eibrs_mode(spectre_v2_enabled))
@@ -1881,6 +2036,9 @@ static ssize_t cpu_show_common(struct device *dev, struct device_attribute *attr · 94 unmodified lines
18812036 case X86_BUG_SRBDS:
18822037 return srbds_show_state(buf);
18832038
2039+ case X86_BUG_MMIO_STALE_DATA:
2040+ return mmio_stale_data_show_state(buf);
2041+
18842042 default:
18852043 break;
18862044 }
@@ -1932,4 +2090,9 @@ ssize_t cpu_show_srbds(struct device *dev, struct device_attribute *attr, char * · 45 unmodified lines
19322090 {
19332091 return cpu_show_common(dev, attr, buf, X86_BUG_SRBDS);
19342092 }
2093+
2094+ssize_t cpu_show_mmio_stale_data(struct device *dev, struct device_attribute *attr, char *buf)
2095+{
2096+ return cpu_show_common(dev, attr, buf, X86_BUG_MMIO_STALE_DATA);
2097+}
19352098 #endif
arch/x86/kernel/cpu/common.c+49−3
@@ -1211,18 +1211,42 @@ static const __initconst struct x86_cpu_id cpu_vuln_whitelist[] = { · 1210 unmodified lines
12111211 X86_FEATURE_ANY, issues)
12121212
12131213 #define SRBDS BIT(0)
1214+/* CPU is affected by X86_BUG_MMIO_STALE_DATA */
1215+#define MMIO BIT(1)
1216+/* CPU is affected by Shared Buffers Data Sampling (SBDS), a variant of X86_BUG_MMIO_STALE_DATA */
1217+#define MMIO_SBDS BIT(2)
12141218
12151219 static const struct x86_cpu_id cpu_vuln_blacklist[] __initconst = {
12161220 VULNBL_INTEL_STEPPINGS(IVYBRIDGE, X86_STEPPING_ANY, SRBDS),
12171221 VULNBL_INTEL_STEPPINGS(HASWELL, X86_STEPPING_ANY, SRBDS),
12181222 VULNBL_INTEL_STEPPINGS(HASWELL_L, X86_STEPPING_ANY, SRBDS),
12191223 VULNBL_INTEL_STEPPINGS(HASWELL_G, X86_STEPPING_ANY, SRBDS),
1224+ VULNBL_INTEL_STEPPINGS(HASWELL_X, BIT(2) | BIT(4), MMIO),
1225+ VULNBL_INTEL_STEPPINGS(BROADWELL_D, X86_STEPPINGS(0x3, 0x5), MMIO),
12201226 VULNBL_INTEL_STEPPINGS(BROADWELL_G, X86_STEPPING_ANY, SRBDS),
1227+ VULNBL_INTEL_STEPPINGS(BROADWELL_X, X86_STEPPING_ANY, MMIO),
12211228 VULNBL_INTEL_STEPPINGS(BROADWELL, X86_STEPPING_ANY, SRBDS),
1229+ VULNBL_INTEL_STEPPINGS(SKYLAKE_L, X86_STEPPINGS(0x3, 0x3), SRBDS | MMIO),
12221230 VULNBL_INTEL_STEPPINGS(SKYLAKE_L, X86_STEPPING_ANY, SRBDS),
1231+ VULNBL_INTEL_STEPPINGS(SKYLAKE_X, BIT(3) | BIT(4) | BIT(6) |
1232+ BIT(7) | BIT(0xB), MMIO),
1233+ VULNBL_INTEL_STEPPINGS(SKYLAKE, X86_STEPPINGS(0x3, 0x3), SRBDS | MMIO),
12231234 VULNBL_INTEL_STEPPINGS(SKYLAKE, X86_STEPPING_ANY, SRBDS),
1224− VULNBL_INTEL_STEPPINGS(KABYLAKE_L, X86_STEPPINGS(0x0, 0xC), SRBDS),
1225− VULNBL_INTEL_STEPPINGS(KABYLAKE, X86_STEPPINGS(0x0, 0xD), SRBDS),
1235+ VULNBL_INTEL_STEPPINGS(KABYLAKE_L, X86_STEPPINGS(0x9, 0xC), SRBDS | MMIO),
1236+ VULNBL_INTEL_STEPPINGS(KABYLAKE_L, X86_STEPPINGS(0x0, 0x8), SRBDS),
1237+ VULNBL_INTEL_STEPPINGS(KABYLAKE, X86_STEPPINGS(0x9, 0xD), SRBDS | MMIO),
1238+ VULNBL_INTEL_STEPPINGS(KABYLAKE, X86_STEPPINGS(0x0, 0x8), SRBDS),
1239+ VULNBL_INTEL_STEPPINGS(ICELAKE_L, X86_STEPPINGS(0x5, 0x5), MMIO | MMIO_SBDS),
1240+ VULNBL_INTEL_STEPPINGS(ICELAKE_D, X86_STEPPINGS(0x1, 0x1), MMIO),
1241+ VULNBL_INTEL_STEPPINGS(ICELAKE_X, X86_STEPPINGS(0x4, 0x6), MMIO),
1242+ VULNBL_INTEL_STEPPINGS(COMETLAKE, BIT(2) | BIT(3) | BIT(5), MMIO | MMIO_SBDS),
1243+ VULNBL_INTEL_STEPPINGS(COMETLAKE_L, X86_STEPPINGS(0x1, 0x1), MMIO | MMIO_SBDS),
1244+ VULNBL_INTEL_STEPPINGS(COMETLAKE_L, X86_STEPPINGS(0x0, 0x0), MMIO),
1245+ VULNBL_INTEL_STEPPINGS(LAKEFIELD, X86_STEPPINGS(0x1, 0x1), MMIO | MMIO_SBDS),
1246+ VULNBL_INTEL_STEPPINGS(ROCKETLAKE, X86_STEPPINGS(0x1, 0x1), MMIO),
1247+ VULNBL_INTEL_STEPPINGS(ATOM_TREMONT, X86_STEPPINGS(0x1, 0x1), MMIO | MMIO_SBDS),
1248+ VULNBL_INTEL_STEPPINGS(ATOM_TREMONT_D, X86_STEPPING_ANY, MMIO),
1249+ VULNBL_INTEL_STEPPINGS(ATOM_TREMONT_L, X86_STEPPINGS(0x0, 0x0), MMIO | MMIO_SBDS),
12261250 {}
12271251 };
12281252
@@ -1243,6 +1267,13 @@ u64 x86_read_arch_cap_msr(void) · 14 unmodified lines
12431267 return ia32_cap;
12441268 }
12451269
1270+static bool arch_cap_mmio_immune(u64 ia32_cap)
1271+{
1272+ return (ia32_cap & ARCH_CAP_FBSDP_NO &&
1273+ ia32_cap & ARCH_CAP_PSDP_NO &&
1274+ ia32_cap & ARCH_CAP_SBDR_SSDP_NO);
1275+}
1276+
12461277 static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c)
12471278 {
12481279 u64 ia32_cap = x86_read_arch_cap_msr();
@@ -1296,12 +1327,27 @@ static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c) · 47 unmodified lines
12961327 /*
12971328 * SRBDS affects CPUs which support RDRAND or RDSEED and are listed
12981329 * in the vulnerability blacklist.
1330+ *
1331+ * Some of the implications and mitigation of Shared Buffers Data
1332+ * Sampling (SBDS) are similar to SRBDS. Give SBDS same treatment as
1333+ * SRBDS.
12991334 */
13001335 if ((cpu_has(c, X86_FEATURE_RDRAND) ||
13011336 cpu_has(c, X86_FEATURE_RDSEED)) &&
1302− cpu_matches(cpu_vuln_blacklist, SRBDS))
1337+ cpu_matches(cpu_vuln_blacklist, SRBDS | MMIO_SBDS))
13031338 setup_force_cpu_bug(X86_BUG_SRBDS);
13041339
1340+ /*
1341+ * Processor MMIO Stale Data bug enumeration
1342+ *
1343+ * Affected CPU list is generally enough to enumerate the vulnerability,
1344+ * but for virtualization case check for ARCH_CAP MSR bits also, VMM may
1345+ * not want the guest to enumerate the bug.
1346+ */
1347+ if (cpu_matches(cpu_vuln_blacklist, MMIO) &&
1348+ !arch_cap_mmio_immune(ia32_cap))
1349+ setup_force_cpu_bug(X86_BUG_MMIO_STALE_DATA);
1350+
13051351 if (cpu_matches(cpu_vuln_whitelist, NO_MELTDOWN))
13061352 return;
13071353
arch/x86/kernel/ftrace_64.S+8−3
@@ -175,6 +175,7 @@ SYM_INNER_LABEL(ftrace_caller_end, SYM_L_GLOBAL) · 174 unmodified lines
175175
176176 jmp ftrace_epilogue
177177 SYM_FUNC_END(ftrace_caller);
178+STACK_FRAME_NON_STANDARD_FP(ftrace_caller)
178179
179180 SYM_FUNC_START(ftrace_epilogue)
180181 /*
@@ -282,6 +283,7 @@ SYM_INNER_LABEL(ftrace_regs_caller_end, SYM_L_GLOBAL) · 101 unmodified lines
282283 jmp ftrace_epilogue
283284
284285 SYM_FUNC_END(ftrace_regs_caller)
286+STACK_FRAME_NON_STANDARD_FP(ftrace_regs_caller)
285287
286288
287289 #else /* ! CONFIG_DYNAMIC_FTRACE */
@@ -311,10 +313,14 @@ trace: · 23 unmodified lines
311313 jmp ftrace_stub
312314 SYM_FUNC_END(__fentry__)
313315 EXPORT_SYMBOL(__fentry__)
316+STACK_FRAME_NON_STANDARD_FP(__fentry__)
317+
314318 #endif /* CONFIG_DYNAMIC_FTRACE */
315319
316320 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
317−SYM_FUNC_START(return_to_handler)
321+SYM_CODE_START(return_to_handler)
322+ UNWIND_HINT_EMPTY
323+ ANNOTATE_NOENDBR
318324 subq $16, %rsp
319325
320326 /* Save the return values */
@@ -339,7 +345,6 @@ SYM_FUNC_START(return_to_handler) · 18 unmodified lines
339345 int3
340346 .Ldo_rop:
341347 mov %rdi, (%rsp)
342− UNWIND_HINT_FUNC
343348 RET
344−SYM_FUNC_END(return_to_handler)
349+SYM_CODE_END(return_to_handler)
345350 #endif
arch/x86/kernel/resource.c+9−5
@@ -1,7 +1,8 @@
11 // SPDX-License-Identifier: GPL-2.0
2−#include <linux/dev_printk.h>
32 #include <linux/ioport.h>
3+#include <linux/printk.h>
44 #include <asm/e820/api.h>
5+#include <asm/pci_x86.h>
56
67 static void resource_clip(struct resource *res, resource_size_t start,
78 resource_size_t end)
@@ -24,14 +25,14 @@ static void resource_clip(struct resource *res, resource_size_t start, · 16 unmodified lines
2425 res->start = end + 1;
2526 }
2627
27−void remove_e820_regions(struct device *dev, struct resource *avail)
28+static void remove_e820_regions(struct resource *avail)
2829 {
2930 int i;
3031 struct e820_entry *entry;
3132 u64 e820_start, e820_end;
3233 struct resource orig = *avail;
3334
34− if (!(avail->flags & IORESOURCE_MEM))
35+ if (!pci_use_e820)
3536 return;
3637
3738 for (i = 0; i < e820_table->nr_entries; i++) {
@@ -41,7 +42,7 @@ void remove_e820_regions(struct device *dev, struct resource *avail) · 3 unmodified lines
4142
4243 resource_clip(avail, e820_start, e820_end);
4344 if (orig.start != avail->start || orig.end != avail->end) {
44− dev_info(dev, "clipped %pR to %pR for e820 entry [mem %#010Lx-%#010Lx]\n",
45+ pr_info("clipped %pR to %pR for e820 entry [mem %#010Lx-%#010Lx]\n",
4546 &orig, avail, e820_start, e820_end);
4647 orig = *avail;
4748 }
@@ -55,6 +56,9 @@ void arch_remove_reservations(struct resource *avail) · 7 unmodified lines
5556 * the low 1MB unconditionally, as this area is needed for some ISA
5657 * cards requiring a memory range, e.g. the i82365 PCMCIA controller.
5758 */
58− if (avail->flags & IORESOURCE_MEM)
59+ if (avail->flags & IORESOURCE_MEM) {
5960 resource_clip(avail, BIOS_ROM_BASE, BIOS_ROM_END);
61+
62+ remove_e820_regions(avail);
63+ }
6064 }
arch/x86/kernel/setup.c+0−5
@@ -67,11 +67,6 @@ RESERVE_BRK(dmi_alloc, 65536); · 66 unmodified lines
6767 #endif
6868
6969
70−/*
71− * Range of the BSS area. The size of the BSS area is determined
72− * at link time, with RESERVE_BRK() facility reserving additional
73− * chunks.
74− */
7570 unsigned long _brk_start = (unsigned long)__brk_base;
7671 unsigned long _brk_end = (unsigned long)__brk_base;
7772
arch/x86/kernel/vmlinux.lds.S+2−2
@@ -385,10 +385,10 @@ SECTIONS · 384 unmodified lines
385385 __end_of_kernel_reserve = .;
386386
387387 . = ALIGN(PAGE_SIZE);
388− .brk : AT(ADDR(.brk) - LOAD_OFFSET) {
388+ .brk (NOLOAD) : AT(ADDR(.brk) - LOAD_OFFSET) {
389389 __brk_base = .;
390390 . += 64 * 1024; /* 64k alignment slop space */
391− *(.brk_reservation) /* areas brk users have reserved */
391+ *(.bss..brk) /* areas brk users have reserved */
392392 __brk_limit = .;
393393 }
394394
arch/x86/kvm/lapic.c+23−4
@@ -2039,6 +2039,19 @@ static void apic_manage_nmi_watchdog(struct kvm_lapic *apic, u32 lvt0_val) · 2038 unmodified lines
20392039 }
20402040 }
20412041
2042+static void kvm_lapic_xapic_id_updated(struct kvm_lapic *apic)
2043+{
2044+ struct kvm *kvm = apic->vcpu->kvm;
2045+
2046+ if (KVM_BUG_ON(apic_x2apic_mode(apic), kvm))
2047+ return;
2048+
2049+ if (kvm_xapic_id(apic) == apic->vcpu->vcpu_id)
2050+ return;
2051+
2052+ kvm_set_apicv_inhibit(apic->vcpu->kvm, APICV_INHIBIT_REASON_APIC_ID_MODIFIED);
2053+}
2054+
20422055 static int kvm_lapic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val)
20432056 {
20442057 int ret = 0;
@@ -2047,10 +2060,12 @@ static int kvm_lapic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val) · 2 unmodified lines
20472060
20482061 switch (reg) {
20492062 case APIC_ID: /* Local APIC ID */
2050− if (!apic_x2apic_mode(apic))
2063+ if (!apic_x2apic_mode(apic)) {
20512064 kvm_apic_set_xapic_id(apic, val >> 24);
2052− else
2065+ kvm_lapic_xapic_id_updated(apic);
2066+ } else {
20532067 ret = 1;
2068+ }
20542069 break;
20552070
20562071 case APIC_TASKPRI:
@@ -2336,8 +2351,10 @@ void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value) · 279 unmodified lines
23362351 MSR_IA32_APICBASE_BASE;
23372352
23382353 if ((value & MSR_IA32_APICBASE_ENABLE) &&
2339− apic->base_address != APIC_DEFAULT_PHYS_BASE)
2340− pr_warn_once("APIC base relocation is unsupported by KVM");
2354+ apic->base_address != APIC_DEFAULT_PHYS_BASE) {
2355+ kvm_set_apicv_inhibit(apic->vcpu->kvm,
2356+ APICV_INHIBIT_REASON_APIC_BASE_MODIFIED);
2357+ }
23412358 }
23422359
23432360 void kvm_apic_update_apicv(struct kvm_vcpu *vcpu)
@@ -2648,6 +2665,8 @@ static int kvm_apic_state_fixup(struct kvm_vcpu *vcpu, · 304 unmodified lines
26482665 icr = __kvm_lapic_get_reg64(s->regs, APIC_ICR);
26492666 __kvm_lapic_set_reg(s->regs, APIC_ICR2, icr >> 32);
26502667 }
2668+ } else {
2669+ kvm_lapic_xapic_id_updated(vcpu->arch.apic);
26512670 }
26522671
26532672 return 0;
arch/x86/kvm/mmu/mmu.c+1−1
@@ -3411,7 +3411,7 @@ static int mmu_alloc_direct_roots(struct kvm_vcpu *vcpu) · 3410 unmodified lines
34113411 root = mmu_alloc_root(vcpu, i << (30 - PAGE_SHIFT),
34123412 i << 30, PT32_ROOT_LEVEL, true);
34133413 mmu->pae_root[i] = root | PT_PRESENT_MASK |
3414− shadow_me_mask;
3414+ shadow_me_value;
34153415 }
34163416 mmu->root.hpa = __pa(mmu->pae_root);
34173417 } else {
arch/x86/kvm/svm/avic.c+76−95
@@ -291,58 +291,91 @@ void avic_ring_doorbell(struct kvm_vcpu *vcpu) · 290 unmodified lines
291291 static int avic_kick_target_vcpus_fast(struct kvm *kvm, struct kvm_lapic *source,
292292 u32 icrl, u32 icrh, u32 index)
293293 {
294− u32 dest, apic_id;
295− struct kvm_vcpu *vcpu;
294+ u32 l1_physical_id, dest;
295+ struct kvm_vcpu *target_vcpu;
296296 int dest_mode = icrl & APIC_DEST_MASK;
297297 int shorthand = icrl & APIC_SHORT_MASK;
298298 struct kvm_svm *kvm_svm = to_kvm_svm(kvm);
299− u32 *avic_logical_id_table = page_address(kvm_svm->avic_logical_id_table_page);
300299
301300 if (shorthand != APIC_DEST_NOSHORT)
302301 return -EINVAL;
303302
304− /*
305− * The AVIC incomplete IPI #vmexit info provides index into
306− * the physical APIC ID table, which can be used to derive
307− * guest physical APIC ID.
308− */
303+ if (apic_x2apic_mode(source))
304+ dest = icrh;
305+ else
306+ dest = GET_APIC_DEST_FIELD(icrh);
307+
309308 if (dest_mode == APIC_DEST_PHYSICAL) {
310− apic_id = index;
309+ /* broadcast destination, use slow path */
310+ if (apic_x2apic_mode(source) && dest == X2APIC_BROADCAST)
311+ return -EINVAL;
312+ if (!apic_x2apic_mode(source) && dest == APIC_BROADCAST)
313+ return -EINVAL;
314+
315+ l1_physical_id = dest;
316+
317+ if (WARN_ON_ONCE(l1_physical_id != index))
318+ return -EINVAL;
319+
311320 } else {
312− if (!apic_x2apic_mode(source)) {
313− /* For xAPIC logical mode, the index is for logical APIC table. */
314− apic_id = avic_logical_id_table[index] & 0x1ff;
321+ u32 bitmap, cluster;
322+ int logid_index;
323+
324+ if (apic_x2apic_mode(source)) {
325+ /* 16 bit dest mask, 16 bit cluster id */
326+ bitmap = dest & 0xFFFF0000;
327+ cluster = (dest >> 16) << 4;
328+ } else if (kvm_lapic_get_reg(source, APIC_DFR) == APIC_DFR_FLAT) {
329+ /* 8 bit dest mask*/
330+ bitmap = dest;
331+ cluster = 0;
315332 } else {
316− return -EINVAL;
333+ /* 4 bit desk mask, 4 bit cluster id */
334+ bitmap = dest & 0xF;
335+ cluster = (dest >> 4) << 2;
317336 }
318− }
319337
320− /*
321− * Assuming vcpu ID is the same as physical apic ID,
322− * and use it to retrieve the target vCPU.
323− */
324− vcpu = kvm_get_vcpu_by_id(kvm, apic_id);
325− if (!vcpu)
326− return -EINVAL;
338+ if (unlikely(!bitmap))
339+ /* guest bug: nobody to send the logical interrupt to */
340+ return 0;
327341
328− if (apic_x2apic_mode(vcpu->arch.apic))
329− dest = icrh;
330− else
331− dest = GET_APIC_DEST_FIELD(icrh);
342+ if (!is_power_of_2(bitmap))
343+ /* multiple logical destinations, use slow path */
344+ return -EINVAL;
332345
333− /*
334− * Try matching the destination APIC ID with the vCPU.
335− */
336− if (kvm_apic_match_dest(vcpu, source, shorthand, dest, dest_mode)) {
337− vcpu->arch.apic->irr_pending = true;
338− svm_complete_interrupt_delivery(vcpu,
339− icrl & APIC_MODE_MASK,
340− icrl & APIC_INT_LEVELTRIG,
341− icrl & APIC_VECTOR_MASK);
342− return 0;
346+ logid_index = cluster + __ffs(bitmap);
347+
348+ if (apic_x2apic_mode(source)) {
349+ l1_physical_id = logid_index;
350+ } else {
351+ u32 *avic_logical_id_table =
352+ page_address(kvm_svm->avic_logical_id_table_page);
353+
354+ u32 logid_entry = avic_logical_id_table[logid_index];
355+
356+ if (WARN_ON_ONCE(index != logid_index))
357+ return -EINVAL;
358+
359+ /* guest bug: non existing/reserved logical destination */
360+ if (unlikely(!(logid_entry & AVIC_LOGICAL_ID_ENTRY_VALID_MASK)))
361+ return 0;
362+
363+ l1_physical_id = logid_entry &
364+ AVIC_LOGICAL_ID_ENTRY_GUEST_PHYSICAL_ID_MASK;
365+ }
343366 }
344367
345− return -EINVAL;
368+ target_vcpu = kvm_get_vcpu_by_id(kvm, l1_physical_id);
369+ if (unlikely(!target_vcpu))
370+ /* guest bug: non existing vCPU is a target of this IPI*/
371+ return 0;
372+
373+ target_vcpu->arch.apic->irr_pending = true;
374+ svm_complete_interrupt_delivery(target_vcpu,
375+ icrl & APIC_MODE_MASK,
376+ icrl & APIC_INT_LEVELTRIG,
377+ icrl & APIC_VECTOR_MASK);
378+ return 0;
346379 }
347380
348381 static void avic_kick_target_vcpus(struct kvm *kvm, struct kvm_lapic *source,
@@ -508,35 +541,6 @@ static int avic_handle_ldr_update(struct kvm_vcpu *vcpu) · 159 unmodified lines
508541 return ret;
509542 }
510543
511−static int avic_handle_apic_id_update(struct kvm_vcpu *vcpu)
512−{
513− u64 *old, *new;
514− struct vcpu_svm *svm = to_svm(vcpu);
515− u32 id = kvm_xapic_id(vcpu->arch.apic);
516−
517− if (vcpu->vcpu_id == id)
518− return 0;
519−
520− old = avic_get_physical_id_entry(vcpu, vcpu->vcpu_id);
521− new = avic_get_physical_id_entry(vcpu, id);
522− if (!new || !old)
523− return 1;
524−
525− /* We need to move physical_id_entry to new offset */
526− *new = *old;
527− *old = 0ULL;
528− to_svm(vcpu)->avic_physical_id_cache = new;
529−
530− /*
531− * Also update the guest physical APIC ID in the logical
532− * APIC ID table entry if already setup the LDR.
533− */
534− if (svm->ldr_reg)
535− avic_handle_ldr_update(vcpu);
536−
537− return 0;
538−}
539−
540544 static void avic_handle_dfr_update(struct kvm_vcpu *vcpu)
541545 {
542546 struct vcpu_svm *svm = to_svm(vcpu);
@@ -555,10 +559,6 @@ static int avic_unaccel_trap_write(struct kvm_vcpu *vcpu) · 12 unmodified lines
555559 AVIC_UNACCEL_ACCESS_OFFSET_MASK;
556560
557561 switch (offset) {
558− case APIC_ID:
559− if (avic_handle_apic_id_update(vcpu))
560− return 0;
561− break;
562562 case APIC_LDR:
563563 if (avic_handle_ldr_update(vcpu))
564564 return 0;
@@ -650,8 +650,6 @@ int avic_init_vcpu(struct vcpu_svm *svm) · 85 unmodified lines
650650
651651 void avic_apicv_post_state_restore(struct kvm_vcpu *vcpu)
652652 {
653− if (avic_handle_apic_id_update(vcpu) != 0)
654− return;
655653 avic_handle_dfr_update(vcpu);
656654 avic_handle_ldr_update(vcpu);
657655 }
@@ -910,7 +908,9 @@ bool avic_check_apicv_inhibit_reasons(enum kvm_apicv_inhibit reason) · 252 unmodified lines
910908 BIT(APICV_INHIBIT_REASON_PIT_REINJ) |
911909 BIT(APICV_INHIBIT_REASON_X2APIC) |
912910 BIT(APICV_INHIBIT_REASON_BLOCKIRQ) |
913− BIT(APICV_INHIBIT_REASON_SEV);
911+ BIT(APICV_INHIBIT_REASON_SEV) |
912+ BIT(APICV_INHIBIT_REASON_APIC_ID_MODIFIED) |
913+ BIT(APICV_INHIBIT_REASON_APIC_BASE_MODIFIED);
914914
915915 return supported & BIT(reason);
916916 }
@@ -946,7 +946,7 @@ out: · 29 unmodified lines
946946 return ret;
947947 }
948948
949−void __avic_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
949+void avic_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
950950 {
951951 u64 entry;
952952 int h_physical_id = kvm_cpu_get_apicid(cpu);
@@ -978,7 +978,7 @@ void __avic_vcpu_load(struct kvm_vcpu *vcpu, int cpu) · 25 unmodified lines
978978 avic_update_iommu_vcpu_affinity(vcpu, h_physical_id, true);
979979 }
980980
981−void __avic_vcpu_put(struct kvm_vcpu *vcpu)
981+void avic_vcpu_put(struct kvm_vcpu *vcpu)
982982 {
983983 u64 entry;
984984 struct vcpu_svm *svm = to_svm(vcpu);
@@ -997,25 +997,6 @@ void __avic_vcpu_put(struct kvm_vcpu *vcpu) · 12 unmodified lines
997997 WRITE_ONCE(*(svm->avic_physical_id_cache), entry);
998998 }
999999
1000−static void avic_vcpu_load(struct kvm_vcpu *vcpu)
1001−{
1002− int cpu = get_cpu();
1003−
1004− WARN_ON(cpu != vcpu->cpu);
1005−
1006− __avic_vcpu_load(vcpu, cpu);
1007−
1008− put_cpu();
1009−}
1010−
1011−static void avic_vcpu_put(struct kvm_vcpu *vcpu)
1012−{
1013− preempt_disable();
1014−
1015− __avic_vcpu_put(vcpu);
1016−
1017− preempt_enable();
1018−}
10191000
10201001 void avic_refresh_apicv_exec_ctrl(struct kvm_vcpu *vcpu)
10211002 {
@@ -1042,7 +1023,7 @@ void avic_refresh_apicv_exec_ctrl(struct kvm_vcpu *vcpu) · 20 unmodified lines
10421023 vmcb_mark_dirty(vmcb, VMCB_AVIC);
10431024
10441025 if (activated)
1045− avic_vcpu_load(vcpu);
1026+ avic_vcpu_load(vcpu, vcpu->cpu);
10461027 else
10471028 avic_vcpu_put(vcpu);
10481029
@@ -1075,5 +1056,5 @@ void avic_vcpu_unblocking(struct kvm_vcpu *vcpu) · 26 unmodified lines
10751056 if (!kvm_vcpu_apicv_active(vcpu))
10761057 return;
10771058
1078− avic_vcpu_load(vcpu);
1059+ avic_vcpu_load(vcpu, vcpu->cpu);
10791060 }
arch/x86/kvm/svm/nested.c+21−18
@@ -616,6 +616,8 @@ static void nested_vmcb02_prepare_control(struct vcpu_svm *svm) · 615 unmodified lines
616616 struct kvm_vcpu *vcpu = &svm->vcpu;
617617 struct vmcb *vmcb01 = svm->vmcb01.ptr;
618618 struct vmcb *vmcb02 = svm->nested.vmcb02.ptr;
619+ u32 pause_count12;
620+ u32 pause_thresh12;
619621
620622 /*
621623 * Filled at exit: exit_code, exit_code_hi, exit_info_1, exit_info_2,
@@ -671,27 +673,25 @@ static void nested_vmcb02_prepare_control(struct vcpu_svm *svm) · 49 unmodified lines
671673 if (!nested_vmcb_needs_vls_intercept(svm))
672674 vmcb02->control.virt_ext |= VIRTUAL_VMLOAD_VMSAVE_ENABLE_MASK;
673675
676+ pause_count12 = svm->pause_filter_enabled ? svm->nested.ctl.pause_filter_count : 0;
677+ pause_thresh12 = svm->pause_threshold_enabled ? svm->nested.ctl.pause_filter_thresh : 0;
674678 if (kvm_pause_in_guest(svm->vcpu.kvm)) {
675− /* use guest values since host doesn't use them */
676− vmcb02->control.pause_filter_count =
677− svm->pause_filter_enabled ?
678− svm->nested.ctl.pause_filter_count : 0;
679+ /* use guest values since host doesn't intercept PAUSE */
680+ vmcb02->control.pause_filter_count = pause_count12;
681+ vmcb02->control.pause_filter_thresh = pause_thresh12;
679682
680− vmcb02->control.pause_filter_thresh =
681− svm->pause_threshold_enabled ?
682− svm->nested.ctl.pause_filter_thresh : 0;
683−
684− } else if (!vmcb12_is_intercept(&svm->nested.ctl, INTERCEPT_PAUSE)) {
685− /* use host values when guest doesn't use them */
683+ } else {
684+ /* start from host values otherwise */
686685 vmcb02->control.pause_filter_count = vmcb01->control.pause_filter_count;
687686 vmcb02->control.pause_filter_thresh = vmcb01->control.pause_filter_thresh;
688− } else {
689− /*
690− * Intercept every PAUSE otherwise and
691− * ignore both host and guest values
692− */
693− vmcb02->control.pause_filter_count = 0;
694− vmcb02->control.pause_filter_thresh = 0;
687+
688+ /* ... but ensure filtering is disabled if so requested. */
689+ if (vmcb12_is_intercept(&svm->nested.ctl, INTERCEPT_PAUSE)) {
690+ if (!pause_count12)
691+ vmcb02->control.pause_filter_count = 0;
692+ if (!pause_thresh12)
693+ vmcb02->control.pause_filter_thresh = 0;
694+ }
695695 }
696696
697697 nested_svm_transition_tlb_flush(vcpu);
@@ -951,8 +951,11 @@ int nested_svm_vmexit(struct vcpu_svm *svm) · 253 unmodified lines
951951 vmcb12->control.event_inj = svm->nested.ctl.event_inj;
952952 vmcb12->control.event_inj_err = svm->nested.ctl.event_inj_err;
953953
954− if (!kvm_pause_in_guest(vcpu->kvm) && vmcb02->control.pause_filter_count)
954+ if (!kvm_pause_in_guest(vcpu->kvm)) {
955955 vmcb01->control.pause_filter_count = vmcb02->control.pause_filter_count;
956+ vmcb_mark_dirty(vmcb01, VMCB_INTERCEPTS);
957+
958+ }
956959
957960 nested_svm_copy_common_state(svm->nested.vmcb02.ptr, svm->vmcb01.ptr);
958961
arch/x86/kvm/svm/sev.c+47−25
@@ -844,7 +844,7 @@ static int __sev_dbg_encrypt_user(struct kvm *kvm, unsigned long paddr, · 843 unmodified lines
844844
845845 /* If source buffer is not aligned then use an intermediate buffer */
846846 if (!IS_ALIGNED((unsigned long)vaddr, 16)) {
847− src_tpage = alloc_page(GFP_KERNEL);
847+ src_tpage = alloc_page(GFP_KERNEL_ACCOUNT);
848848 if (!src_tpage)
849849 return -ENOMEM;
850850
@@ -865,7 +865,7 @@ static int __sev_dbg_encrypt_user(struct kvm *kvm, unsigned long paddr, · 14 unmodified lines
865865 if (!IS_ALIGNED((unsigned long)dst_vaddr, 16) || !IS_ALIGNED(size, 16)) {
866866 int dst_offset;
867867
868− dst_tpage = alloc_page(GFP_KERNEL);
868+ dst_tpage = alloc_page(GFP_KERNEL_ACCOUNT);
869869 if (!dst_tpage) {
870870 ret = -ENOMEM;
871871 goto e_free;
@@ -1665,19 +1665,24 @@ static void sev_migrate_from(struct kvm *dst_kvm, struct kvm *src_kvm) · 793 unmodified lines
16651665 {
16661666 struct kvm_sev_info *dst = &to_kvm_svm(dst_kvm)->sev_info;
16671667 struct kvm_sev_info *src = &to_kvm_svm(src_kvm)->sev_info;
1668+ struct kvm_vcpu *dst_vcpu, *src_vcpu;
1669+ struct vcpu_svm *dst_svm, *src_svm;
16681670 struct kvm_sev_info *mirror;
1671+ unsigned long i;
16691672
16701673 dst->active = true;
16711674 dst->asid = src->asid;
16721675 dst->handle = src->handle;
16731676 dst->pages_locked = src->pages_locked;
16741677 dst->enc_context_owner = src->enc_context_owner;
1678+ dst->es_active = src->es_active;
16751679
16761680 src->asid = 0;
16771681 src->active = false;
16781682 src->handle = 0;
16791683 src->pages_locked = 0;
16801684 src->enc_context_owner = NULL;
1685+ src->es_active = false;
16811686
16821687 list_cut_before(&dst->regions_list, &src->regions_list, &src->regions_list);
16831688
@@ -1704,26 +1709,21 @@ static void sev_migrate_from(struct kvm *dst_kvm, struct kvm *src_kvm) · 20 unmodified lines
17041709 list_del(&src->mirror_entry);
17051710 list_add_tail(&dst->mirror_entry, &owner_sev_info->mirror_vms);
17061711 }
1707−}
17081712
1709−static int sev_es_migrate_from(struct kvm *dst, struct kvm *src)
1710−{
1711− unsigned long i;
1712− struct kvm_vcpu *dst_vcpu, *src_vcpu;
1713− struct vcpu_svm *dst_svm, *src_svm;
1713+ kvm_for_each_vcpu(i, dst_vcpu, dst_kvm) {
1714+ dst_svm = to_svm(dst_vcpu);
17141715
1715− if (atomic_read(&src->online_vcpus) != atomic_read(&dst->online_vcpus))
1716− return -EINVAL;
1716+ sev_init_vmcb(dst_svm);
17171717
1718− kvm_for_each_vcpu(i, src_vcpu, src) {
1719− if (!src_vcpu->arch.guest_state_protected)
1720− return -EINVAL;
1721− }
1718+ if (!dst->es_active)
1719+ continue;
17221720
1723− kvm_for_each_vcpu(i, src_vcpu, src) {
1721+ /*
1722+ * Note, the source is not required to have the same number of
1723+ * vCPUs as the destination when migrating a vanilla SEV VM.
1724+ */
1725+ src_vcpu = kvm_get_vcpu(dst_kvm, i);
17241726 src_svm = to_svm(src_vcpu);
1725− dst_vcpu = kvm_get_vcpu(dst, i);
1726− dst_svm = to_svm(dst_vcpu);
17271727
17281728 /*
17291729 * Transfer VMSA and GHCB state to the destination. Nullify and
@@ -1740,8 +1740,23 @@ static int sev_es_migrate_from(struct kvm *dst, struct kvm *src) · 10 unmodified lines
17401740 src_svm->vmcb->control.vmsa_pa = INVALID_PAGE;
17411741 src_vcpu->arch.guest_state_protected = false;
17421742 }
1743− to_kvm_svm(src)->sev_info.es_active = false;
1744− to_kvm_svm(dst)->sev_info.es_active = true;
1743+}
1744+
1745+static int sev_check_source_vcpus(struct kvm *dst, struct kvm *src)
1746+{
1747+ struct kvm_vcpu *src_vcpu;
1748+ unsigned long i;
1749+
1750+ if (!sev_es_guest(src))
1751+ return 0;
1752+
1753+ if (atomic_read(&src->online_vcpus) != atomic_read(&dst->online_vcpus))
1754+ return -EINVAL;
1755+
1756+ kvm_for_each_vcpu(i, src_vcpu, src) {
1757+ if (!src_vcpu->arch.guest_state_protected)
1758+ return -EINVAL;
1759+ }
17451760
17461761 return 0;
17471762 }
@@ -1789,11 +1804,9 @@ int sev_vm_move_enc_context_from(struct kvm *kvm, unsigned int source_fd) · 41 unmodified lines
17891804 if (ret)
17901805 goto out_dst_vcpu;
17911806
1792− if (sev_es_guest(source_kvm)) {
1793− ret = sev_es_migrate_from(kvm, source_kvm);
1794− if (ret)
1795− goto out_source_vcpu;
1796− }
1807+ ret = sev_check_source_vcpus(kvm, source_kvm);
1808+ if (ret)
1809+ goto out_source_vcpu;
17971810
17981811 sev_migrate_from(kvm, source_kvm);
17991812 kvm_vm_dead(source_kvm);
@@ -2914,7 +2927,7 @@ int sev_es_string_io(struct vcpu_svm *svm, int size, unsigned int port, int in) · 1114 unmodified lines
29142927 count, in);
29152928 }
29162929
2917−void sev_es_init_vmcb(struct vcpu_svm *svm)
2930+static void sev_es_init_vmcb(struct vcpu_svm *svm)
29182931 {
29192932 struct kvm_vcpu *vcpu = &svm->vcpu;
29202933
@@ -2967,6 +2980,15 @@ void sev_es_init_vmcb(struct vcpu_svm *svm) · 46 unmodified lines
29672980 }
29682981 }
29692982
2983+void sev_init_vmcb(struct vcpu_svm *svm)
2984+{
2985+ svm->vmcb->control.nested_ctl |= SVM_NESTED_CTL_SEV_ENABLE;
2986+ clr_exception_intercept(svm, UD_VECTOR);
2987+
2988+ if (sev_es_guest(svm->vcpu.kvm))
2989+ sev_es_init_vmcb(svm);
2990+}
2991+
29702992 void sev_es_vcpu_reset(struct vcpu_svm *svm)
29712993 {
29722994 /*
arch/x86/kvm/svm/svm.c+6−13
@@ -921,7 +921,7 @@ static void grow_ple_window(struct kvm_vcpu *vcpu) · 920 unmodified lines
921921 struct vmcb_control_area *control = &svm->vmcb->control;
922922 int old = control->pause_filter_count;
923923
924− if (kvm_pause_in_guest(vcpu->kvm) || !old)
924+ if (kvm_pause_in_guest(vcpu->kvm))
925925 return;
926926
927927 control->pause_filter_count = __grow_ple_window(old,
@@ -942,7 +942,7 @@ static void shrink_ple_window(struct kvm_vcpu *vcpu) · 14 unmodified lines
942942 struct vmcb_control_area *control = &svm->vmcb->control;
943943 int old = control->pause_filter_count;
944944
945− if (kvm_pause_in_guest(vcpu->kvm) || !old)
945+ if (kvm_pause_in_guest(vcpu->kvm))
946946 return;
947947
948948 control->pause_filter_count =
@@ -1212,15 +1212,8 @@ static void init_vmcb(struct kvm_vcpu *vcpu) · 263 unmodified lines
12121212 svm->vmcb->control.int_ctl |= V_GIF_ENABLE_MASK;
12131213 }
12141214
1215− if (sev_guest(vcpu->kvm)) {
1216− svm->vmcb->control.nested_ctl |= SVM_NESTED_CTL_SEV_ENABLE;
1217− clr_exception_intercept(svm, UD_VECTOR);
1218−
1219− if (sev_es_guest(vcpu->kvm)) {
1220− /* Perform SEV-ES specific VMCB updates */
1221− sev_es_init_vmcb(svm);
1222− }
1223− }
1215+ if (sev_guest(vcpu->kvm))
1216+ sev_init_vmcb(svm);
12241217
12251218 svm_hv_init_vmcb(vmcb);
12261219 init_vmcb_after_set_cpuid(vcpu);
@@ -1400,13 +1393,13 @@ static void svm_vcpu_load(struct kvm_vcpu *vcpu, int cpu) · 173 unmodified lines
14001393 indirect_branch_prediction_barrier();
14011394 }
14021395 if (kvm_vcpu_apicv_active(vcpu))
1403− __avic_vcpu_load(vcpu, cpu);
1396+ avic_vcpu_load(vcpu, cpu);
14041397 }
14051398
14061399 static void svm_vcpu_put(struct kvm_vcpu *vcpu)
14071400 {
14081401 if (kvm_vcpu_apicv_active(vcpu))
1409− __avic_vcpu_put(vcpu);
1402+ avic_vcpu_put(vcpu);
14101403
14111404 svm_prepare_host_switch(vcpu);
14121405
arch/x86/kvm/svm/svm.h+3−3
@@ -610,8 +610,8 @@ void avic_init_vmcb(struct vcpu_svm *svm, struct vmcb *vmcb); · 609 unmodified lines
610610 int avic_incomplete_ipi_interception(struct kvm_vcpu *vcpu);
611611 int avic_unaccelerated_access_interception(struct kvm_vcpu *vcpu);
612612 int avic_init_vcpu(struct vcpu_svm *svm);
613−void __avic_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
614−void __avic_vcpu_put(struct kvm_vcpu *vcpu);
613+void avic_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
614+void avic_vcpu_put(struct kvm_vcpu *vcpu);
615615 void avic_apicv_post_state_restore(struct kvm_vcpu *vcpu);
616616 void avic_set_virtual_apic_mode(struct kvm_vcpu *vcpu);
617617 void avic_refresh_apicv_exec_ctrl(struct kvm_vcpu *vcpu);
@@ -649,10 +649,10 @@ void __init sev_set_cpu_caps(void); · 31 unmodified lines
649649 void __init sev_hardware_setup(void);
650650 void sev_hardware_unsetup(void);
651651 int sev_cpu_init(struct svm_cpu_data *sd);
652+void sev_init_vmcb(struct vcpu_svm *svm);
652653 void sev_free_vcpu(struct kvm_vcpu *vcpu);
653654 int sev_handle_vmgexit(struct kvm_vcpu *vcpu);
654655 int sev_es_string_io(struct vcpu_svm *svm, int size, unsigned int port, int in);
655−void sev_es_init_vmcb(struct vcpu_svm *svm);
656656 void sev_es_vcpu_reset(struct vcpu_svm *svm);
657657 void sev_vcpu_deliver_sipi_vector(struct kvm_vcpu *vcpu, u8 vector);
658658 void sev_es_prepare_switch_to_guest(struct sev_es_save_area *hostsa);
arch/x86/kvm/vmx/vmx.c+75−1
@@ -229,6 +229,9 @@ static const struct { · 228 unmodified lines
229229 #define L1D_CACHE_ORDER 4
230230 static void *vmx_l1d_flush_pages;
231231
232+/* Control for disabling CPU Fill buffer clear */
233+static bool __read_mostly vmx_fb_clear_ctrl_available;
234+
232235 static int vmx_setup_l1d_flush(enum vmx_l1d_flush_state l1tf)
233236 {
234237 struct page *page;
@@ -360,6 +363,60 @@ static int vmentry_l1d_flush_get(char *s, const struct kernel_param *kp) · 125 unmodified lines
360363 return sprintf(s, "%s\n", vmentry_l1d_param[l1tf_vmx_mitigation].option);
361364 }
362365
366+static void vmx_setup_fb_clear_ctrl(void)
367+{
368+ u64 msr;
369+
370+ if (boot_cpu_has(X86_FEATURE_ARCH_CAPABILITIES) &&
371+ !boot_cpu_has_bug(X86_BUG_MDS) &&
372+ !boot_cpu_has_bug(X86_BUG_TAA)) {
373+ rdmsrl(MSR_IA32_ARCH_CAPABILITIES, msr);
374+ if (msr & ARCH_CAP_FB_CLEAR_CTRL)
375+ vmx_fb_clear_ctrl_available = true;
376+ }
377+}
378+
379+static __always_inline void vmx_disable_fb_clear(struct vcpu_vmx *vmx)
380+{
381+ u64 msr;
382+
383+ if (!vmx->disable_fb_clear)
384+ return;
385+
386+ rdmsrl(MSR_IA32_MCU_OPT_CTRL, msr);
387+ msr |= FB_CLEAR_DIS;
388+ wrmsrl(MSR_IA32_MCU_OPT_CTRL, msr);
389+ /* Cache the MSR value to avoid reading it later */
390+ vmx->msr_ia32_mcu_opt_ctrl = msr;
391+}
392+
393+static __always_inline void vmx_enable_fb_clear(struct vcpu_vmx *vmx)
394+{
395+ if (!vmx->disable_fb_clear)
396+ return;
397+
398+ vmx->msr_ia32_mcu_opt_ctrl &= ~FB_CLEAR_DIS;
399+ wrmsrl(MSR_IA32_MCU_OPT_CTRL, vmx->msr_ia32_mcu_opt_ctrl);
400+}
401+
402+static void vmx_update_fb_clear_dis(struct kvm_vcpu *vcpu, struct vcpu_vmx *vmx)
403+{
404+ vmx->disable_fb_clear = vmx_fb_clear_ctrl_available;
405+
406+ /*
407+ * If guest will not execute VERW, there is no need to set FB_CLEAR_DIS
408+ * at VMEntry. Skip the MSR read/write when a guest has no use case to
409+ * execute VERW.
410+ */
411+ if ((vcpu->arch.arch_capabilities & ARCH_CAP_FB_CLEAR) ||
412+ ((vcpu->arch.arch_capabilities & ARCH_CAP_MDS_NO) &&
413+ (vcpu->arch.arch_capabilities & ARCH_CAP_TAA_NO) &&
414+ (vcpu->arch.arch_capabilities & ARCH_CAP_PSDP_NO) &&
415+ (vcpu->arch.arch_capabilities & ARCH_CAP_FBSDP_NO) &&
416+ (vcpu->arch.arch_capabilities & ARCH_CAP_SBDR_SSDP_NO)))
417+ vmx->disable_fb_clear = false;
418+}
419+
363420 static const struct kernel_param_ops vmentry_l1d_flush_ops = {
364421 .set = vmentry_l1d_flush_set,
365422 .get = vmentry_l1d_flush_get,
@@ -2252,6 +2309,10 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 1886 unmodified lines
22522309 ret = kvm_set_msr_common(vcpu, msr_info);
22532310 }
22542311
2312+ /* FB_CLEAR may have changed, also update the FB_CLEAR_DIS behavior */
2313+ if (msr_index == MSR_IA32_ARCH_CAPABILITIES)
2314+ vmx_update_fb_clear_dis(vcpu, vmx);
2315+
22552316 return ret;
22562317 }
22572318
@@ -4553,6 +4614,8 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) · 2295 unmodified lines
45534614 kvm_make_request(KVM_REQ_APIC_PAGE_RELOAD, vcpu);
45544615
45554616 vpid_sync_context(vmx->vpid);
4617+
4618+ vmx_update_fb_clear_dis(vcpu, vmx);
45564619 }
45574620
45584621 static void vmx_enable_irq_window(struct kvm_vcpu *vcpu)
@@ -6772,6 +6835,11 @@ static noinstr void vmx_vcpu_enter_exit(struct kvm_vcpu *vcpu, · 2213 unmodified lines
67726835 vmx_l1d_flush(vcpu);
67736836 else if (static_branch_unlikely(&mds_user_clear))
67746837 mds_clear_cpu_buffers();
6838+ else if (static_branch_unlikely(&mmio_stale_data_clear) &&
6839+ kvm_arch_has_assigned_device(vcpu->kvm))
6840+ mds_clear_cpu_buffers();
6841+
6842+ vmx_disable_fb_clear(vmx);
67756843
67766844 if (vcpu->arch.cr2 != native_read_cr2())
67776845 native_write_cr2(vcpu->arch.cr2);
@@ -6781,6 +6849,8 @@ static noinstr void vmx_vcpu_enter_exit(struct kvm_vcpu *vcpu, · 3 unmodified lines
67816849
67826850 vcpu->arch.cr2 = native_read_cr2();
67836851
6852+ vmx_enable_fb_clear(vmx);
6853+
67846854 guest_state_exit_irqoff();
67856855 }
67866856
@@ -7709,7 +7779,9 @@ static bool vmx_check_apicv_inhibit_reasons(enum kvm_apicv_inhibit reason) · 922 unmodified lines
77097779 ulong supported = BIT(APICV_INHIBIT_REASON_DISABLE) |
77107780 BIT(APICV_INHIBIT_REASON_ABSENT) |
77117781 BIT(APICV_INHIBIT_REASON_HYPERV) |
7712− BIT(APICV_INHIBIT_REASON_BLOCKIRQ);
7782+ BIT(APICV_INHIBIT_REASON_BLOCKIRQ) |
7783+ BIT(APICV_INHIBIT_REASON_APIC_ID_MODIFIED) |
7784+ BIT(APICV_INHIBIT_REASON_APIC_BASE_MODIFIED);
77137785
77147786 return supported & BIT(reason);
77157787 }
@@ -8212,6 +8284,8 @@ static int __init vmx_init(void) · 496 unmodified lines
82128284 return r;
82138285 }
82148286
8287+ vmx_setup_fb_clear_ctrl();
8288+
82158289 for_each_possible_cpu(cpu) {
82168290 INIT_LIST_HEAD(&per_cpu(loaded_vmcss_on_cpu, cpu));
82178291
arch/x86/kvm/vmx/vmx.h+2−0
@@ -348,6 +348,8 @@ struct vcpu_vmx { · 347 unmodified lines
348348 u64 msr_ia32_feature_control_valid_bits;
349349 /* SGX Launch Control public key hash */
350350 u64 msr_ia32_sgxlepubkeyhash[4];
351+ u64 msr_ia32_mcu_opt_ctrl;
352+ bool disable_fb_clear;
351353
352354 struct pt_desc pt_desc;
353355 struct lbr_desc lbr_desc;
arch/x86/kvm/x86.c+5−0
@@ -1617,6 +1617,9 @@ static u64 kvm_get_arch_capabilities(void) · 1616 unmodified lines
16171617 */
16181618 }
16191619
1620+ /* Guests don't need to know "Fill buffer clear control" exists */
1621+ data &= ~ARCH_CAP_FB_CLEAR_CTRL;
1622+
16201623 return data;
16211624 }
16221625
@@ -9850,6 +9853,7 @@ void kvm_vcpu_update_apicv(struct kvm_vcpu *vcpu) · 8227 unmodified lines
98509853 return;
98519854
98529855 down_read(&vcpu->kvm->arch.apicv_update_lock);
9856+ preempt_disable();
98539857
98549858 activate = kvm_vcpu_apicv_activated(vcpu);
98559859
@@ -9870,6 +9874,7 @@ void kvm_vcpu_update_apicv(struct kvm_vcpu *vcpu) · 14 unmodified lines
98709874 kvm_make_request(KVM_REQ_EVENT, vcpu);
98719875
98729876 out:
9877+ preempt_enable();
98739878 up_read(&vcpu->kvm->arch.apicv_update_lock);
98749879 }
98759880 EXPORT_SYMBOL_GPL(kvm_vcpu_update_apicv);
arch/x86/net/bpf_jit_comp.c+2−1
@@ -1420,8 +1420,9 @@ st: if (is_imm8(insn->off)) · 1419 unmodified lines
14201420 case BPF_JMP | BPF_CALL:
14211421 func = (u8 *) __bpf_call_base + imm32;
14221422 if (tail_call_reachable) {
1423+ /* mov rax, qword ptr [rbp - rounded_stack_depth - 8] */
14231424 EMIT3_off32(0x48, 0x8B, 0x85,
1424− -(bpf_prog->aux->stack_depth + 8));
1425+ -round_up(bpf_prog->aux->stack_depth, 8) - 8);
14251426 if (!imm32 || emit_call(&prog, func, image + addrs[i - 1] + 7))
14261427 return -EINVAL;
14271428 } else {
arch/x86/pci/acpi.c+1−7
@@ -8,7 +8,6 @@ · 7 unmodified lines
88 #include <linux/pci-acpi.h>
99 #include <asm/numa.h>
1010 #include <asm/pci_x86.h>
11−#include <asm/e820/api.h>
1211
1312 struct pci_root_info {
1413 struct acpi_pci_root_info common;
@@ -20,7 +19,7 @@ struct pci_root_info { · 5 unmodified lines
2019 #endif
2120 };
2221
23−static bool pci_use_e820 = true;
22+bool pci_use_e820 = true;
2423 static bool pci_use_crs = true;
2524 static bool pci_ignore_seg;
2625
@@ -387,11 +386,6 @@ static int pci_acpi_root_prepare_resources(struct acpi_pci_root_info *ci) · 360 unmodified lines
387386
388387 status = acpi_pci_probe_root_resources(ci);
389388
390− if (pci_use_e820) {
391− resource_list_for_each_entry(entry, &ci->resources)
392− remove_e820_regions(&device->dev, entry->res);
393− }
394−
395389 if (pci_use_crs) {
396390 resource_list_for_each_entry_safe(entry, tmp, &ci->resources)
397391 if (resource_is_pcicfg_ioport(entry->res))
arch/xtensa/kernel/entry.S+1−1
@@ -2173,7 +2173,7 @@ ENDPROC(ret_from_kernel_thread) · 2172 unmodified lines
21732173
21742174 #ifdef CONFIG_HIBERNATION
21752175
2176− .bss
2176+ .section .bss, "aw"
21772177 .align 4
21782178 .Lsaved_regs:
21792179 #if defined(__XTENSA_WINDOWED_ABI__)
arch/xtensa/kernel/time.c+1−0
@@ -154,6 +154,7 @@ static void __init calibrate_ccount(void) · 153 unmodified lines
154154 cpu = of_find_compatible_node(NULL, NULL, "cdns,xtensa-cpu");
155155 if (cpu) {
156156 clk = of_clk_get(cpu, 0);
157+ of_node_put(cpu);
157158 if (!IS_ERR(clk)) {
158159 ccount_freq = clk_get_rate(clk);
159160 return;
arch/xtensa/platforms/xtfpga/setup.c+1−0
@@ -133,6 +133,7 @@ static int __init machine_setup(void) · 132 unmodified lines
133133
134134 if ((eth = of_find_compatible_node(eth, NULL, "opencores,ethoc")))
135135 update_local_mac(eth);
136+ of_node_put(eth);
136137 return 0;
137138 }
138139 arch_initcall(machine_setup);
block/bfq-iosched.c+6−0
@@ -7046,6 +7046,7 @@ static void bfq_exit_queue(struct elevator_queue *e) · 7045 unmodified lines
70467046 spin_unlock_irq(&bfqd->lock);
70477047 #endif
70487048
7049+ blk_stat_disable_accounting(bfqd->queue);
70497050 wbt_enable_default(bfqd->queue);
70507051
70517052 kfree(bfqd);
@@ -7188,7 +7189,12 @@ static int bfq_init_queue(struct request_queue *q, struct elevator_type *e) · 136 unmodified lines
71887189 bfq_init_root_group(bfqd->root_group, bfqd);
71897190 bfq_init_entity(&bfqd->oom_bfqq.entity, bfqd->root_group);
71907191
7192+ /* We dispatch from request queue wide instead of hw queue */
7193+ blk_queue_flag_set(QUEUE_FLAG_SQ_SCHED, q);
7194+
71917195 wbt_disable_default(q);
7196+ blk_stat_enable_accounting(q);
7197+
71927198 return 0;
71937199
71947200 out_free:
block/blk-core.c+0−13
@@ -322,19 +322,6 @@ void blk_cleanup_queue(struct request_queue *q) · 321 unmodified lines
322322 blk_mq_exit_queue(q);
323323 }
324324
325− /*
326− * In theory, request pool of sched_tags belongs to request queue.
327− * However, the current implementation requires tag_set for freeing
328− * requests, so free the pool now.
329− *
330− * Queue has become frozen, there can't be any in-queue requests, so
331− * it is safe to free requests now.
332− */
333− mutex_lock(&q->sysfs_lock);
334− if (q->elevator)
335− blk_mq_sched_free_rqs(q);
336− mutex_unlock(&q->sysfs_lock);
337−
338325 /* @q is and will stay empty, shutdown and put */
339326 blk_put_queue(q);
340327 }
block/blk-ia-ranges.c+0−1
@@ -144,7 +144,6 @@ int disk_register_independent_access_ranges(struct gendisk *disk, · 143 unmodified lines
144144 }
145145
146146 for (i = 0; i < iars->nr_ia_ranges; i++) {
147− iars->ia_range[i].queue = q;
148147 ret = kobject_init_and_add(&iars->ia_range[i].kobj,
149148 &blk_ia_range_ktype, &iars->kobj,
150149 "%d", i);
block/blk-mq-debugfs.c+18−11
@@ -711,11 +711,6 @@ void blk_mq_debugfs_register(struct request_queue *q) · 710 unmodified lines
711711 }
712712 }
713713
714−void blk_mq_debugfs_unregister(struct request_queue *q)
715−{
716− q->sched_debugfs_dir = NULL;
717−}
718−
719714 static void blk_mq_debugfs_register_ctx(struct blk_mq_hw_ctx *hctx,
720715 struct blk_mq_ctx *ctx)
721716 {
@@ -746,6 +741,8 @@ void blk_mq_debugfs_register_hctx(struct request_queue *q, · 24 unmodified lines
746741
747742 void blk_mq_debugfs_unregister_hctx(struct blk_mq_hw_ctx *hctx)
748743 {
744+ if (!hctx->queue->debugfs_dir)
745+ return;
749746 debugfs_remove_recursive(hctx->debugfs_dir);
750747 hctx->sched_debugfs_dir = NULL;
751748 hctx->debugfs_dir = NULL;
@@ -773,6 +770,8 @@ void blk_mq_debugfs_register_sched(struct request_queue *q) · 21 unmodified lines
773770 {
774771 struct elevator_type *e = q->elevator->type;
775772
773+ lockdep_assert_held(&q->debugfs_mutex);
774+
776775 /*
777776 * If the parent directory has not been created yet, return, we will be
778777 * called again later on and the directory/files will be created then.
@@ -790,6 +789,8 @@ void blk_mq_debugfs_register_sched(struct request_queue *q) · 11 unmodified lines
790789
791790 void blk_mq_debugfs_unregister_sched(struct request_queue *q)
792791 {
792+ lockdep_assert_held(&q->debugfs_mutex);
793+
793794 debugfs_remove_recursive(q->sched_debugfs_dir);
794795 q->sched_debugfs_dir = NULL;
795796 }
@@ -811,6 +812,10 @@ static const char *rq_qos_id_to_name(enum rq_qos_id id) · 15 unmodified lines
811812
812813 void blk_mq_debugfs_unregister_rqos(struct rq_qos *rqos)
813814 {
815+ lockdep_assert_held(&rqos->q->debugfs_mutex);
816+
817+ if (!rqos->q->debugfs_dir)
818+ return;
814819 debugfs_remove_recursive(rqos->debugfs_dir);
815820 rqos->debugfs_dir = NULL;
816821 }
@@ -820,6 +825,8 @@ void blk_mq_debugfs_register_rqos(struct rq_qos *rqos) · 3 unmodified lines
820825 struct request_queue *q = rqos->q;
821826 const char *dir_name = rq_qos_id_to_name(rqos->id);
822827
828+ lockdep_assert_held(&q->debugfs_mutex);
829+
823830 if (rqos->debugfs_dir || !rqos->ops->debugfs_attrs)
824831 return;
825832
@@ -833,17 +840,13 @@ void blk_mq_debugfs_register_rqos(struct rq_qos *rqos) · 7 unmodified lines
833840 debugfs_create_files(rqos->debugfs_dir, rqos, rqos->ops->debugfs_attrs);
834841 }
835842
836−void blk_mq_debugfs_unregister_queue_rqos(struct request_queue *q)
837−{
838− debugfs_remove_recursive(q->rqos_debugfs_dir);
839− q->rqos_debugfs_dir = NULL;
840−}
841−
842843 void blk_mq_debugfs_register_sched_hctx(struct request_queue *q,
843844 struct blk_mq_hw_ctx *hctx)
844845 {
845846 struct elevator_type *e = q->elevator->type;
846847
848+ lockdep_assert_held(&q->debugfs_mutex);
849+
847850 /*
848851 * If the parent debugfs directory has not been created yet, return;
849852 * We will be called again later on with appropriate parent debugfs
@@ -863,6 +866,10 @@ void blk_mq_debugfs_register_sched_hctx(struct request_queue *q, · 13 unmodified lines
863866
864867 void blk_mq_debugfs_unregister_sched_hctx(struct blk_mq_hw_ctx *hctx)
865868 {
869+ lockdep_assert_held(&hctx->queue->debugfs_mutex);
870+
871+ if (!hctx->queue->debugfs_dir)
872+ return;
866873 debugfs_remove_recursive(hctx->sched_debugfs_dir);
867874 hctx->sched_debugfs_dir = NULL;
868875 }
block/blk-mq-debugfs.h+0−10
@@ -21,7 +21,6 @@ int __blk_mq_debugfs_rq_show(struct seq_file *m, struct request *rq); · 20 unmodified lines
2121 int blk_mq_debugfs_rq_show(struct seq_file *m, void *v);
2222
2323 void blk_mq_debugfs_register(struct request_queue *q);
24−void blk_mq_debugfs_unregister(struct request_queue *q);
2524 void blk_mq_debugfs_register_hctx(struct request_queue *q,
2625 struct blk_mq_hw_ctx *hctx);
2726 void blk_mq_debugfs_unregister_hctx(struct blk_mq_hw_ctx *hctx);
@@ -36,16 +35,11 @@ void blk_mq_debugfs_unregister_sched_hctx(struct blk_mq_hw_ctx *hctx); · 8 unmodified lines
3635
3736 void blk_mq_debugfs_register_rqos(struct rq_qos *rqos);
3837 void blk_mq_debugfs_unregister_rqos(struct rq_qos *rqos);
39−void blk_mq_debugfs_unregister_queue_rqos(struct request_queue *q);
4038 #else
4139 static inline void blk_mq_debugfs_register(struct request_queue *q)
4240 {
4341 }
4442
45−static inline void blk_mq_debugfs_unregister(struct request_queue *q)
46−{
47−}
48−
4943 static inline void blk_mq_debugfs_register_hctx(struct request_queue *q,
5044 struct blk_mq_hw_ctx *hctx)
5145 {
@@ -87,10 +81,6 @@ static inline void blk_mq_debugfs_register_rqos(struct rq_qos *rqos) · 35 unmodified lines
8781 static inline void blk_mq_debugfs_unregister_rqos(struct rq_qos *rqos)
8882 {
8983 }
90−
91−static inline void blk_mq_debugfs_unregister_queue_rqos(struct request_queue *q)
92−{
93−}
9484 #endif
9585
9686 #ifdef CONFIG_BLK_DEBUG_FS_ZONED
block/blk-mq-sched.c+12−0
@@ -564,6 +564,7 @@ int blk_mq_init_sched(struct request_queue *q, struct elevator_type *e) · 563 unmodified lines
564564 int ret;
565565
566566 if (!e) {
567+ blk_queue_flag_clear(QUEUE_FLAG_SQ_SCHED, q);
567568 q->elevator = NULL;
568569 q->nr_requests = q->tag_set->queue_depth;
569570 return 0;
@@ -593,7 +594,9 @@ int blk_mq_init_sched(struct request_queue *q, struct elevator_type *e) · 23 unmodified lines
593594 if (ret)
594595 goto err_free_map_and_rqs;
595596
597+ mutex_lock(&q->debugfs_mutex);
596598 blk_mq_debugfs_register_sched(q);
599+ mutex_unlock(&q->debugfs_mutex);
597600
598601 queue_for_each_hw_ctx(q, hctx, i) {
599602 if (e->ops.init_hctx) {
@@ -606,7 +609,9 @@ int blk_mq_init_sched(struct request_queue *q, struct elevator_type *e) · 6 unmodified lines
606609 return ret;
607610 }
608611 }
612+ mutex_lock(&q->debugfs_mutex);
609613 blk_mq_debugfs_register_sched_hctx(q, hctx);
614+ mutex_unlock(&q->debugfs_mutex);
610615 }
611616
612617 return 0;
@@ -647,14 +652,21 @@ void blk_mq_exit_sched(struct request_queue *q, struct elevator_queue *e) · 34 unmodified lines
647652 unsigned int flags = 0;
648653
649654 queue_for_each_hw_ctx(q, hctx, i) {
655+ mutex_lock(&q->debugfs_mutex);
650656 blk_mq_debugfs_unregister_sched_hctx(hctx);
657+ mutex_unlock(&q->debugfs_mutex);
658+
651659 if (e->type->ops.exit_hctx && hctx->sched_data) {
652660 e->type->ops.exit_hctx(hctx, i);
653661 hctx->sched_data = NULL;
654662 }
655663 flags = hctx->flags;
656664 }
665+
666+ mutex_lock(&q->debugfs_mutex);
657667 blk_mq_debugfs_unregister_sched(q);
668+ mutex_unlock(&q->debugfs_mutex);
669+
658670 if (e->type->ops.exit_sched)
659671 e->type->ops.exit_sched(e);
660672 blk_mq_sched_tags_teardown(q, flags);
block/blk-mq.c+18−22
@@ -579,6 +579,8 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q, · 578 unmodified lines
579579 if (!blk_mq_hw_queue_mapped(data.hctx))
580580 goto out_queue_exit;
581581 cpu = cpumask_first_and(data.hctx->cpumask, cpu_online_mask);
582+ if (cpu >= nr_cpu_ids)
583+ goto out_queue_exit;
582584 data.ctx = __blk_mq_get_ctx(q, cpu);
583585
584586 if (!q->elevator)
@@ -2140,20 +2142,6 @@ void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async) · 1555 unmodified lines
21402142 }
21412143 EXPORT_SYMBOL(blk_mq_run_hw_queue);
21422144
2143−/*
2144− * Is the request queue handled by an IO scheduler that does not respect
2145− * hardware queues when dispatching?
2146− */
2147−static bool blk_mq_has_sqsched(struct request_queue *q)
2148−{
2149− struct elevator_queue *e = q->elevator;
2150−
2151− if (e && e->type->ops.dispatch_request &&
2152− !(e->type->elevator_features & ELEVATOR_F_MQ_AWARE))
2153− return true;
2154− return false;
2155−}
2156−
21572145 /*
21582146 * Return prefered queue to dispatch from (if any) for non-mq aware IO
21592147 * scheduler.
@@ -2186,7 +2174,7 @@ void blk_mq_run_hw_queues(struct request_queue *q, bool async) · 26 unmodified lines
21862174 unsigned long i;
21872175
21882176 sq_hctx = NULL;
2189− if (blk_mq_has_sqsched(q))
2177+ if (blk_queue_sq_sched(q))
21902178 sq_hctx = blk_mq_get_sq_hctx(q);
21912179 queue_for_each_hw_ctx(q, hctx, i) {
21922180 if (blk_mq_hctx_stopped(hctx))
@@ -2214,7 +2202,7 @@ void blk_mq_delay_run_hw_queues(struct request_queue *q, unsigned long msecs) · 21 unmodified lines
22142202 unsigned long i;
22152203
22162204 sq_hctx = NULL;
2217− if (blk_mq_has_sqsched(q))
2205+ if (blk_queue_sq_sched(q))
22182206 sq_hctx = blk_mq_get_sq_hctx(q);
22192207 queue_for_each_hw_ctx(q, hctx, i) {
22202208 if (blk_mq_hctx_stopped(hctx))
@@ -2777,15 +2765,20 @@ static inline struct request *blk_mq_get_cached_request(struct request_queue *q, · 556 unmodified lines
27772765 return NULL;
27782766 }
27792767
2780− rq_qos_throttle(q, *bio);
2781−
27822768 if (blk_mq_get_hctx_type((*bio)->bi_opf) != rq->mq_hctx->type)
27832769 return NULL;
27842770 if (op_is_flush(rq->cmd_flags) != op_is_flush((*bio)->bi_opf))
27852771 return NULL;
27862772
2787− rq->cmd_flags = (*bio)->bi_opf;
2773+ /*
2774+ * If any qos ->throttle() end up blocking, we will have flushed the
2775+ * plug and hence killed the cached_rq list as well. Pop this entry
2776+ * before we throttle.
2777+ */
27882778 plug->cached_rq = rq_list_next(rq);
2779+ rq_qos_throttle(q, *bio);
2780+
2781+ rq->cmd_flags = (*bio)->bi_opf;
27892782 INIT_LIST_HEAD(&rq->queuelist);
27902783 return rq;
27912784 }
@@ -3443,8 +3436,9 @@ static void blk_mq_exit_hctx(struct request_queue *q, · 651 unmodified lines
34433436 if (blk_mq_hw_queue_mapped(hctx))
34443437 blk_mq_tag_idle(hctx);
34453438
3446− blk_mq_clear_flush_rq_mapping(set->tags[hctx_idx],
3447− set->queue_depth, flush_rq);
3439+ if (blk_queue_init_done(q))
3440+ blk_mq_clear_flush_rq_mapping(set->tags[hctx_idx],
3441+ set->queue_depth, flush_rq);
34483442 if (set->ops->exit_request)
34493443 set->ops->exit_request(set, flush_rq, hctx_idx);
34503444
@@ -4438,12 +4432,14 @@ static bool blk_mq_elv_switch_none(struct list_head *head, · 987 unmodified lines
44384432 if (!qe)
44394433 return false;
44404434
4435+ /* q->elevator needs protection from ->sysfs_lock */
4436+ mutex_lock(&q->sysfs_lock);
4437+
44414438 INIT_LIST_HEAD(&qe->node);
44424439 qe->q = q;
44434440 qe->type = q->elevator->type;
44444441 list_add(&qe->node, head);
44454442
4446− mutex_lock(&q->sysfs_lock);
44474443 /*
44484444 * After elevator_switch_mq, the previous elevator_queue will be
44494445 * released by elevator_release. The reference of the io scheduler
block/blk-rq-qos.c+0−2
@@ -294,8 +294,6 @@ void rq_qos_wait(struct rq_wait *rqw, void *private_data, · 293 unmodified lines
294294
295295 void rq_qos_exit(struct request_queue *q)
296296 {
297− blk_mq_debugfs_unregister_queue_rqos(q);
298−
299297 while (q->rq_qos) {
300298 struct rq_qos *rqos = q->rq_qos;
301299 q->rq_qos = rqos->next;
block/blk-rq-qos.h+6−1
@@ -104,8 +104,11 @@ static inline void rq_qos_add(struct request_queue *q, struct rq_qos *rqos) · 103 unmodified lines
104104
105105 blk_mq_unfreeze_queue(q);
106106
107− if (rqos->ops->debugfs_attrs)
107+ if (rqos->ops->debugfs_attrs) {
108+ mutex_lock(&q->debugfs_mutex);
108109 blk_mq_debugfs_register_rqos(rqos);
110+ mutex_unlock(&q->debugfs_mutex);
111+ }
109112 }
110113
111114 static inline void rq_qos_del(struct request_queue *q, struct rq_qos *rqos)
@@ -129,7 +132,9 @@ static inline void rq_qos_del(struct request_queue *q, struct rq_qos *rqos) · 17 unmodified lines
129132
130133 blk_mq_unfreeze_queue(q);
131134
135+ mutex_lock(&q->debugfs_mutex);
132136 blk_mq_debugfs_unregister_rqos(rqos);
137+ mutex_unlock(&q->debugfs_mutex);
133138 }
134139
135140 typedef bool (acquire_inflight_cb_t)(struct rq_wait *rqw, void *private_data);
block/blk-sysfs.c+14−16
@@ -779,14 +779,6 @@ static void blk_release_queue(struct kobject *kobj) · 778 unmodified lines
779779 if (queue_is_mq(q))
780780 blk_mq_release(q);
781781
782− blk_trace_shutdown(q);
783− mutex_lock(&q->debugfs_mutex);
784− debugfs_remove_recursive(q->debugfs_dir);
785− mutex_unlock(&q->debugfs_mutex);
786−
787− if (queue_is_mq(q))
788− blk_mq_debugfs_unregister(q);
789−
790782 bioset_exit(&q->bio_split);
791783
792784 if (blk_queue_has_srcu(q))
@@ -836,17 +828,16 @@ int blk_register_queue(struct gendisk *disk) · 43 unmodified lines
836828 goto unlock;
837829 }
838830
831+ if (queue_is_mq(q))
832+ __blk_mq_register_dev(dev, q);
833+ mutex_lock(&q->sysfs_lock);
834+
839835 mutex_lock(&q->debugfs_mutex);
840836 q->debugfs_dir = debugfs_create_dir(kobject_name(q->kobj.parent),
841837 blk_debugfs_root);
842− mutex_unlock(&q->debugfs_mutex);
843−
844− if (queue_is_mq(q)) {
845− __blk_mq_register_dev(dev, q);
838+ if (queue_is_mq(q))
846839 blk_mq_debugfs_register(q);
847− }
848−
849− mutex_lock(&q->sysfs_lock);
840+ mutex_unlock(&q->debugfs_mutex);
850841
851842 ret = disk_register_independent_access_ranges(disk, NULL);
852843 if (ret)
@@ -948,8 +939,15 @@ void blk_unregister_queue(struct gendisk *disk) · 95 unmodified lines
948939 /* Now that we've deleted all child objects, we can delete the queue. */
949940 kobject_uevent(&q->kobj, KOBJ_REMOVE);
950941 kobject_del(&q->kobj);
951−
952942 mutex_unlock(&q->sysfs_dir_lock);
953943
944+ mutex_lock(&q->debugfs_mutex);
945+ blk_trace_shutdown(q);
946+ debugfs_remove_recursive(q->debugfs_dir);
947+ q->debugfs_dir = NULL;
948+ q->sched_debugfs_dir = NULL;
949+ q->rqos_debugfs_dir = NULL;
950+ mutex_unlock(&q->debugfs_mutex);
951+
954952 kobject_put(&disk_to_dev(disk)->kobj);
955953 }
block/genhd.c+12−30
@@ -623,6 +623,7 @@ void del_gendisk(struct gendisk *disk) · 622 unmodified lines
623623 * Prevent new I/O from crossing bio_queue_enter().
624624 */
625625 blk_queue_start_drain(q);
626+ blk_mq_freeze_queue_wait(q);
626627
627628 if (!(disk->flags & GENHD_FL_HIDDEN)) {
628629 sysfs_remove_link(&disk_to_dev(disk)->kobj, "bdi");
@@ -646,12 +647,21 @@ void del_gendisk(struct gendisk *disk) · 17 unmodified lines
646647 pm_runtime_set_memalloc_noio(disk_to_dev(disk), false);
647648 device_del(disk_to_dev(disk));
648649
649− blk_mq_freeze_queue_wait(q);
650−
651650 blk_throtl_cancel_bios(disk->queue);
652651
653652 blk_sync_queue(q);
654653 blk_flush_integrity();
654+ blk_mq_cancel_work_sync(q);
655+
656+ blk_mq_quiesce_queue(q);
657+ if (q->elevator) {
658+ mutex_lock(&q->sysfs_lock);
659+ elevator_exit(q);
660+ mutex_unlock(&q->sysfs_lock);
661+ }
662+ rq_qos_exit(q);
663+ blk_mq_unquiesce_queue(q);
664+
655665 /*
656666 * Allow using passthrough request again after the queue is torn down.
657667 */
@@ -1120,31 +1130,6 @@ static const struct attribute_group *disk_attr_groups[] = { · 462 unmodified lines
11201130 NULL
11211131 };
11221132
1123−static void disk_release_mq(struct request_queue *q)
1124−{
1125− blk_mq_cancel_work_sync(q);
1126−
1127− /*
1128− * There can't be any non non-passthrough bios in flight here, but
1129− * requests stay around longer, including passthrough ones so we
1130− * still need to freeze the queue here.
1131− */
1132− blk_mq_freeze_queue(q);
1133−
1134− /*
1135− * Since the I/O scheduler exit code may access cgroup information,
1136− * perform I/O scheduler exit before disassociating from the block
1137− * cgroup controller.
1138− */
1139− if (q->elevator) {
1140− mutex_lock(&q->sysfs_lock);
1141− elevator_exit(q);
1142− mutex_unlock(&q->sysfs_lock);
1143− }
1144− rq_qos_exit(q);
1145− __blk_mq_unfreeze_queue(q, true);
1146−}
1147−
11481133 /**
11491134 * disk_release - releases all allocated resources of the gendisk
11501135 * @dev: the device representing this disk
@@ -1166,9 +1151,6 @@ static void disk_release(struct device *dev) · 15 unmodified lines
11661151 might_sleep();
11671152 WARN_ON_ONCE(disk_live(disk));
11681153
1169− if (queue_is_mq(disk->queue))
1170− disk_release_mq(disk->queue);
1171−
11721154 blkcg_exit_queue(disk->queue);
11731155
11741156 disk_release_events(disk);
block/holder.c+0−4
@@ -79,10 +79,6 @@ int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk) · 78 unmodified lines
7979
8080 WARN_ON_ONCE(!bdev->bd_holder);
8181
82− /* FIXME: remove the following once add_disk() handles errors */
83− if (WARN_ON(!bdev->bd_holder_dir))
84− goto out_unlock;
85−
8682 holder = bd_find_holder_disk(bdev, disk);
8783 if (holder) {
8884 holder->refcnt++;
block/kyber-iosched.c+2−1
@@ -421,6 +421,8 @@ static int kyber_init_sched(struct request_queue *q, struct elevator_type *e) · 420 unmodified lines
421421
422422 blk_stat_enable_accounting(q);
423423
424+ blk_queue_flag_clear(QUEUE_FLAG_SQ_SCHED, q);
425+
424426 eq->elevator_data = kqd;
425427 q->elevator = eq;
426428
@@ -1033,7 +1035,6 @@ static struct elevator_type kyber_sched = { · 606 unmodified lines
10331035 #endif
10341036 .elevator_attrs = kyber_sched_attrs,
10351037 .elevator_name = "kyber",
1036− .elevator_features = ELEVATOR_F_MQ_AWARE,
10371038 .elevator_owner = THIS_MODULE,
10381039 };
10391040
block/mq-deadline.c+3−0
@@ -642,6 +642,9 @@ static int dd_init_sched(struct request_queue *q, struct elevator_type *e) · 641 unmodified lines
642642 spin_lock_init(&dd->lock);
643643 spin_lock_init(&dd->zone_lock);
644644
645+ /* We dispatch from request queue wide instead of hw queue */
646+ blk_queue_flag_set(QUEUE_FLAG_SQ_SCHED, q);
647+
645648 q->elevator = eq;
646649 return 0;
647650
certs/.gitignore+1−1
@@ -1,5 +1,5 @@
11 # SPDX-License-Identifier: GPL-2.0-only
2−/blacklist_hashes_checked
2+/blacklist_hash_list
33 /extract-cert
44 /x509_certificate_list
55 /x509_revocation_list
certs/Makefile+12−12
@@ -3,26 +3,26 @@ · 2 unmodified lines
33 # Makefile for the linux kernel signature checking certificates.
44 #
55
6−obj-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += system_keyring.o system_certificates.o common.o
7−obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist.o common.o
6+obj-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += system_keyring.o system_certificates.o
7+obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist.o
88 obj-$(CONFIG_SYSTEM_REVOCATION_LIST) += revocation_certificates.o
99 ifneq ($(CONFIG_SYSTEM_BLACKLIST_HASH_LIST),)
10−quiet_cmd_check_blacklist_hashes = CHECK $(patsubst "%",%,$(2))
11− cmd_check_blacklist_hashes = $(AWK) -f $(srctree)/scripts/check-blacklist-hashes.awk $(2); touch $@
1210
13−$(eval $(call config_filename,SYSTEM_BLACKLIST_HASH_LIST))
11+$(obj)/blacklist_hashes.o: $(obj)/blacklist_hash_list
12+CFLAGS_blacklist_hashes.o := -I $(obj)
1413
15−$(obj)/blacklist_hashes.o: $(obj)/blacklist_hashes_checked
14+quiet_cmd_check_and_copy_blacklist_hash_list = GEN $@
15+ cmd_check_and_copy_blacklist_hash_list = \
16+ $(AWK) -f $(srctree)/scripts/check-blacklist-hashes.awk $(CONFIG_SYSTEM_BLACKLIST_HASH_LIST) >&2; \
17+ cat $(CONFIG_SYSTEM_BLACKLIST_HASH_LIST) > $@
1618
17−CFLAGS_blacklist_hashes.o += -I$(srctree)
18−
19−targets += blacklist_hashes_checked
20−$(obj)/blacklist_hashes_checked: $(SYSTEM_BLACKLIST_HASH_LIST_SRCPREFIX)$(SYSTEM_BLACKLIST_HASH_LIST_FILENAME) scripts/check-blacklist-hashes.awk FORCE
21− $(call if_changed,check_blacklist_hashes,$(SYSTEM_BLACKLIST_HASH_LIST_SRCPREFIX)$(CONFIG_SYSTEM_BLACKLIST_HASH_LIST))
19+$(obj)/blacklist_hash_list: $(CONFIG_SYSTEM_BLACKLIST_HASH_LIST) FORCE
20+ $(call if_changed,check_and_copy_blacklist_hash_list)
2221 obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_hashes.o
2322 else
2423 obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_nohashes.o
2524 endif
25+targets += blacklist_hash_list
2626
2727 quiet_cmd_extract_certs = CERT $@
2828 cmd_extract_certs = $(obj)/extract-cert $(extract-cert-in) $@
@@ -33,7 +33,7 @@ $(obj)/system_certificates.o: $(obj)/x509_certificate_list · 4 unmodified lines
3333 $(obj)/x509_certificate_list: $(CONFIG_SYSTEM_TRUSTED_KEYS) $(obj)/extract-cert FORCE
3434 $(call if_changed,extract_certs)
3535
36−targets += x509_certificate_list blacklist_hashes_checked
36+targets += x509_certificate_list
3737
3838 # If module signing is requested, say by allyesconfig, but a key has not been
3939 # supplied, then one will need to be generated to make sure the build does not
certs/blacklist.c+4−4
@@ -15,10 +15,9 @@ · 14 unmodified lines
1515 #include <linux/err.h>
1616 #include <linux/seq_file.h>
1717 #include <linux/uidgid.h>
18−#include <linux/verification.h>
18+#include <keys/asymmetric-type.h>
1919 #include <keys/system_keyring.h>
2020 #include "blacklist.h"
21−#include "common.h"
2221
2322 /*
2423 * According to crypto/asymmetric_keys/x509_cert_parser.c:x509_note_pkey_algo(),
@@ -365,8 +364,9 @@ static __init int load_revocation_certificate_list(void) · 340 unmodified lines
365364 if (revocation_certificate_list_size)
366365 pr_notice("Loading compiled-in revocation X.509 certificates\n");
367366
368− return load_certificate_list(revocation_certificate_list, revocation_certificate_list_size,
369− blacklist_keyring);
367+ return x509_load_certificate_list(revocation_certificate_list,
368+ revocation_certificate_list_size,
369+ blacklist_keyring);
370370 }
371371 late_initcall(load_revocation_certificate_list);
372372 #endif
certs/blacklist_hashes.c+2−2
@@ -1,7 +1,7 @@
11 // SPDX-License-Identifier: GPL-2.0
22 #include "blacklist.h"
33
4−const char __initdata *const blacklist_hashes[] = {
5−#include CONFIG_SYSTEM_BLACKLIST_HASH_LIST
4+const char __initconst *const blacklist_hashes[] = {
5+#include "blacklist_hash_list"
66 , NULL
77 };
certs/common.h+0−9
@@ -1,9 +0,0 @@
1−/* SPDX-License-Identifier: GPL-2.0-or-later */
2−
3−#ifndef _CERT_COMMON_H
4−#define _CERT_COMMON_H
5−
6−int load_certificate_list(const u8 cert_list[], const unsigned long list_size,
7− const struct key *keyring);
8−
9−#endif
certs/system_keyring.c+3−3
@@ -16,7 +16,6 @@ · 15 unmodified lines
1616 #include <keys/asymmetric-type.h>
1717 #include <keys/system_keyring.h>
1818 #include <crypto/pkcs7.h>
19−#include "common.h"
2019
2120 static struct key *builtin_trusted_keys;
2221 #ifdef CONFIG_SECONDARY_TRUSTED_KEYRING
@@ -183,7 +182,8 @@ __init int load_module_cert(struct key *keyring) · 160 unmodified lines
183182
184183 pr_notice("Loading compiled-in module X.509 certificates\n");
185184
186− return load_certificate_list(system_certificate_list, module_cert_size, keyring);
185+ return x509_load_certificate_list(system_certificate_list,
186+ module_cert_size, keyring);
187187 }
188188
189189 /*
@@ -204,7 +204,7 @@ static __init int load_system_certificate_list(void) · 14 unmodified lines
204204 size = system_certificate_list_size - module_cert_size;
205205 #endif
206206
207− return load_certificate_list(p, size, builtin_trusted_keys);
207+ return x509_load_certificate_list(p, size, builtin_trusted_keys);
208208 }
209209 late_initcall(load_system_certificate_list);
210210
crypto/Kconfig+1−0
@@ -15,6 +15,7 @@ source "crypto/async_tx/Kconfig" · 14 unmodified lines
1515 #
1616 menuconfig CRYPTO
1717 tristate "Cryptographic API"
18+ select LIB_MEMNEQ
1819 help
1920 This option provides the core Cryptographic API.
2021
crypto/Makefile+1−1
@@ -4,7 +4,7 @@ · 3 unmodified lines
44 #
55
66 obj-$(CONFIG_CRYPTO) += crypto.o
7−crypto-y := api.o cipher.o compress.o memneq.o
7+crypto-y := api.o cipher.o compress.o
88
99 obj-$(CONFIG_CRYPTO_ENGINE) += crypto_engine.o
1010 obj-$(CONFIG_CRYPTO_FIPS) += fips.o
crypto/asymmetric_keys/Kconfig+10−0
@@ -75,4 +75,14 @@ config SIGNED_PE_FILE_VERIFICATION · 74 unmodified lines
7575 This option provides support for verifying the signature(s) on a
7676 signed PE binary.
7777
78+config FIPS_SIGNATURE_SELFTEST
79+ bool "Run FIPS selftests on the X.509+PKCS7 signature verification"
80+ help
81+ This option causes some selftests to be run on the signature
82+ verification code, using some built in data. This is required
83+ for FIPS.
84+ depends on KEYS
85+ depends on ASYMMETRIC_KEY_TYPE
86+ depends on PKCS7_MESSAGE_PARSER
87+
7888 endif # ASYMMETRIC_KEY_TYPE
crypto/asymmetric_keys/Makefile+2−0
@@ -20,7 +20,9 @@ x509_key_parser-y := \ · 19 unmodified lines
2020 x509.asn1.o \
2121 x509_akid.asn1.o \
2222 x509_cert_parser.o \
23+ x509_loader.o \
2324 x509_public_key.o
25+x509_key_parser-$(CONFIG_FIPS_SIGNATURE_SELFTEST) += selftest.o
2426
2527 $(obj)/x509_cert_parser.o: \
2628 $(obj)/x509.asn1.h \
crypto/asymmetric_keys/selftest.c+224−0
@@ -0,0 +1,224 @@
1+/* Self-testing for signature checking.
2+ *
3+ * Copyright (C) 2022 Red Hat, Inc. All Rights Reserved.
4+ * Written by David Howells (dhowells@redhat.com)
5+ */
6+
7+#include <linux/kernel.h>
8+#include <linux/cred.h>
9+#include <linux/key.h>
10+#include <crypto/pkcs7.h>
11+#include "x509_parser.h"
12+
13+struct certs_test {
14+ const u8 *data;
15+ size_t data_len;
16+ const u8 *pkcs7;
17+ size_t pkcs7_len;
18+};
19+
20+/*
21+ * Set of X.509 certificates to provide public keys for the tests. These will
22+ * be loaded into a temporary keyring for the duration of the testing.
23+ */
24+static const __initconst u8 certs_selftest_keys[] = {
25+ "\x30\x82\x05\x55\x30\x82\x03\x3d\xa0\x03\x02\x01\x02\x02\x14\x73"
26+ "\x98\xea\x98\x2d\xd0\x2e\xa8\xb1\xcf\x57\xc7\xf2\x97\xb3\xe6\x1a"
27+ "\xfc\x8c\x0a\x30\x0d\x06\x09\x2a\x86\x48\x86\xf7\x0d\x01\x01\x0b"
28+ "\x05\x00\x30\x34\x31\x32\x30\x30\x06\x03\x55\x04\x03\x0c\x29\x43"
29+ "\x65\x72\x74\x69\x66\x69\x63\x61\x74\x65\x20\x76\x65\x72\x69\x66"
30+ "\x69\x63\x61\x74\x69\x6f\x6e\x20\x73\x65\x6c\x66\x2d\x74\x65\x73"
31+ "\x74\x69\x6e\x67\x20\x6b\x65\x79\x30\x20\x17\x0d\x32\x32\x30\x35"
32+ "\x31\x38\x32\x32\x33\x32\x34\x31\x5a\x18\x0f\x32\x31\x32\x32\x30"
33+ "\x34\x32\x34\x32\x32\x33\x32\x34\x31\x5a\x30\x34\x31\x32\x30\x30"
34+ "\x06\x03\x55\x04\x03\x0c\x29\x43\x65\x72\x74\x69\x66\x69\x63\x61"
35+ "\x74\x65\x20\x76\x65\x72\x69\x66\x69\x63\x61\x74\x69\x6f\x6e\x20"
36+ "\x73\x65\x6c\x66\x2d\x74\x65\x73\x74\x69\x6e\x67\x20\x6b\x65\x79"
37+ "\x30\x82\x02\x22\x30\x0d\x06\x09\x2a\x86\x48\x86\xf7\x0d\x01\x01"
38+ "\x01\x05\x00\x03\x82\x02\x0f\x00\x30\x82\x02\x0a\x02\x82\x02\x01"
39+ "\x00\xcc\xac\x49\xdd\x3b\xca\xb0\x15\x7e\x84\x6a\xb2\x0a\x69\x5f"
40+ "\x1c\x0a\x61\x82\x3b\x4f\x2c\xa3\x95\x2c\x08\x58\x4b\xb1\x5d\x99"
41+ "\xe0\xc3\xc1\x79\xc2\xb3\xeb\xc0\x1e\x6d\x3e\x54\x1d\xbd\xb7\x92"
42+ "\x7b\x4d\xb5\x95\x58\xb2\x52\x2e\xc6\x24\x4b\x71\x63\x80\x32\x77"
43+ "\xa7\x38\x5e\xdb\x72\xae\x6e\x0d\xec\xfb\xb6\x6d\x01\x7f\xe9\x55"
44+ "\x66\xdf\xbf\x1d\x76\x78\x02\x31\xe8\xe5\x07\xf8\xb7\x82\x5c\x0d"
45+ "\xd4\xbb\xfb\xa2\x59\x0d\x2e\x3a\x78\x95\x3a\x8b\x46\x06\x47\x44"
46+ "\x46\xd7\xcd\x06\x6a\x41\x13\xe3\x19\xf6\xbb\x6e\x38\xf4\x83\x01"
47+ "\xa3\xbf\x4a\x39\x4f\xd7\x0a\xe9\x38\xb3\xf5\x94\x14\x4e\xdd\xf7"
48+ "\x43\xfd\x24\xb2\x49\x3c\xa5\xf7\x7a\x7c\xd4\x45\x3d\x97\x75\x68"
49+ "\xf1\xed\x4c\x42\x0b\x70\xca\x85\xf3\xde\xe5\x88\x2c\xc5\xbe\xb6"
50+ "\x97\x34\xba\x24\x02\xcd\x8b\x86\x9f\xa9\x73\xca\x73\xcf\x92\x81"
51+ "\xee\x75\x55\xbb\x18\x67\x5c\xff\x3f\xb5\xdd\x33\x1b\x0c\xe9\x78"
52+ "\xdb\x5c\xcf\xaa\x5c\x43\x42\xdf\x5e\xa9\x6d\xec\xd7\xd7\xff\xe6"
53+ "\xa1\x3a\x92\x1a\xda\xae\xf6\x8c\x6f\x7b\xd5\xb4\x6e\x06\xe9\x8f"
54+ "\xe8\xde\x09\x31\x89\xed\x0e\x11\xa1\xfa\x8a\xe9\xe9\x64\x59\x62"
55+ "\x53\xda\xd1\x70\xbe\x11\xd4\x99\x97\x11\xcf\x99\xde\x0b\x9d\x94"
56+ "\x7e\xaa\xb8\x52\xea\x37\xdb\x90\x7e\x35\xbd\xd9\xfe\x6d\x0a\x48"
57+ "\x70\x28\xdd\xd5\x0d\x7f\x03\x80\x93\x14\x23\x8f\xb9\x22\xcd\x7c"
58+ "\x29\xfe\xf1\x72\xb5\x5c\x0b\x12\xcf\x9c\x15\xf6\x11\x4c\x7a\x45"
59+ "\x25\x8c\x45\x0a\x34\xac\x2d\x9a\x81\xca\x0b\x13\x22\xcd\xeb\x1a"
60+ "\x38\x88\x18\x97\x96\x08\x81\xaa\xcc\x8f\x0f\x8a\x32\x7b\x76\x68"
61+ "\x03\x68\x43\xbf\x11\xba\x55\x60\xfd\x80\x1c\x0d\x9b\x69\xb6\x09"
62+ "\x72\xbc\x0f\x41\x2f\x07\x82\xc6\xe3\xb2\x13\x91\xc4\x6d\x14\x95"
63+ "\x31\xbe\x19\xbd\xbc\xed\xe1\x4c\x74\xa2\xe0\x78\x0b\xbb\x94\xec"
64+ "\x4c\x53\x3a\xa2\xb5\x84\x1d\x4b\x65\x7e\xdc\xf7\xdb\x36\x7d\xbe"
65+ "\x9e\x3b\x36\x66\x42\x66\x76\x35\xbf\xbe\xf0\xc1\x3c\x7c\xe9\x42"
66+ "\x5c\x24\x53\x03\x05\xa8\x67\x24\x50\x02\x75\xff\x24\x46\x3b\x35"
67+ "\x89\x76\xe6\x70\xda\xc5\x51\x8c\x9a\xe5\x05\xb0\x0b\xd0\x2d\xd4"
68+ "\x7d\x57\x75\x94\x6b\xf9\x0a\xad\x0e\x41\x00\x15\xd0\x4f\xc0\x7f"
69+ "\x90\x2d\x18\x48\x8f\x28\xfe\x5d\xa7\xcd\x99\x9e\xbd\x02\x6c\x8a"
70+ "\x31\xf3\x1c\xc7\x4b\xe6\x93\xcd\x42\xa2\xe4\x68\x10\x47\x9d\xfc"
71+ "\x21\x02\x03\x01\x00\x01\xa3\x5d\x30\x5b\x30\x0c\x06\x03\x55\x1d"
72+ "\x13\x01\x01\xff\x04\x02\x30\x00\x30\x0b\x06\x03\x55\x1d\x0f\x04"
73+ "\x04\x03\x02\x07\x80\x30\x1d\x06\x03\x55\x1d\x0e\x04\x16\x04\x14"
74+ "\xf5\x87\x03\xbb\x33\xce\x1b\x73\xee\x02\xec\xcd\xee\x5b\x88\x17"
75+ "\x51\x8f\xe3\xdb\x30\x1f\x06\x03\x55\x1d\x23\x04\x18\x30\x16\x80"
76+ "\x14\xf5\x87\x03\xbb\x33\xce\x1b\x73\xee\x02\xec\xcd\xee\x5b\x88"
77+ "\x17\x51\x8f\xe3\xdb\x30\x0d\x06\x09\x2a\x86\x48\x86\xf7\x0d\x01"
78+ "\x01\x0b\x05\x00\x03\x82\x02\x01\x00\xc0\x2e\x12\x41\x7b\x73\x85"
79+ "\x16\xc8\xdb\x86\x79\xe8\xf5\xcd\x44\xf4\xc6\xe2\x81\x23\x5e\x47"
80+ "\xcb\xab\x25\xf1\x1e\x58\x3e\x31\x7f\x78\xad\x85\xeb\xfe\x14\x88"
81+ "\x60\xf7\x7f\xd2\x26\xa2\xf4\x98\x2a\xfd\xba\x05\x0c\x20\x33\x12"
82+ "\xcc\x4d\x14\x61\x64\x81\x93\xd3\x33\xed\xc8\xff\xf1\x78\xcc\x5f"
83+ "\x51\x9f\x09\xd7\xbe\x0d\x5c\x74\xfd\x9b\xdf\x52\x4a\xc9\xa8\x71"
84+ "\x25\x33\x04\x10\x67\x36\xd0\xb3\x0b\xc9\xa1\x40\x72\xae\x41\x7b"
85+ "\x68\xe6\xe4\x7b\xd0\x28\xf7\x6d\xe7\x3f\x50\xfc\x91\x7c\x91\x56"
86+ "\xd4\xdf\xa6\xbb\xe8\x4d\x1b\x58\xaa\x28\xfa\xc1\x19\xeb\x11\x2f"
87+ "\x24\x8b\x7c\xc5\xa9\x86\x26\xaa\x6e\xb7\x9b\xd5\xf8\x06\xfb\x02"
88+ "\x52\x7b\x9c\x9e\xa1\xe0\x07\x8b\x5e\xe4\xb8\x55\x29\xf6\x48\x52"
89+ "\x1c\x1b\x54\x2d\x46\xd8\xe5\x71\xb9\x60\xd1\x45\xb5\x92\x89\x8a"
90+ "\x63\x58\x2a\xb3\xc6\xb2\x76\xe2\x3c\x82\x59\x04\xae\x5a\xc4\x99"
91+ "\x7b\x2e\x4b\x46\x57\xb8\x29\x24\xb2\xfd\xee\x2c\x0d\xa4\x83\xfa"
92+ "\x65\x2a\x07\x35\x8b\x97\xcf\xbd\x96\x2e\xd1\x7e\x6c\xc2\x1e\x87"
93+ "\xb6\x6c\x76\x65\xb5\xb2\x62\xda\x8b\xe9\x73\xe3\xdb\x33\xdd\x13"
94+ "\x3a\x17\x63\x6a\x76\xde\x8d\x8f\xe0\x47\x61\x28\x3a\x83\xff\x8f"
95+ "\xe7\xc7\xe0\x4a\xa3\xe5\x07\xcf\xe9\x8c\x35\x35\x2e\xe7\x80\x66"
96+ "\x31\xbf\x91\x58\x0a\xe1\x25\x3d\x38\xd3\xa4\xf0\x59\x34\x47\x07"
97+ "\x62\x0f\xbe\x30\xdd\x81\x88\x58\xf0\x28\xb0\x96\xe5\x82\xf8\x05"
98+ "\xb7\x13\x01\xbc\xfa\xc6\x1f\x86\x72\xcc\xf9\xee\x8e\xd9\xd6\x04"
99+ "\x8c\x24\x6c\xbf\x0f\x5d\x37\x39\xcf\x45\xc1\x93\x3a\xd2\xed\x5c"
100+ "\x58\x79\x74\x86\x62\x30\x7e\x8e\xbb\xdd\x7a\xa9\xed\xca\x40\xcb"
101+ "\x62\x47\xf4\xb4\x9f\x52\x7f\x72\x63\xa8\xf0\x2b\xaf\x45\x2a\x48"
102+ "\x19\x6d\xe3\xfb\xf9\x19\x66\x69\xc8\xcc\x62\x87\x6c\x53\x2b\x2d"
103+ "\x6e\x90\x6c\x54\x3a\x82\x25\x41\xcb\x18\x6a\xa4\x22\xa8\xa1\xc4"
104+ "\x47\xd7\x81\x00\x1c\x15\x51\x0f\x1a\xaf\xef\x9f\xa6\x61\x8c\xbd"
105+ "\x6b\x8b\xed\xe6\xac\x0e\xb6\x3a\x4c\x92\xe6\x0f\x91\x0a\x0f\x71"
106+ "\xc7\xa0\xb9\x0d\x3a\x17\x5a\x6f\x35\xc8\xe7\x50\x4f\x46\xe8\x70"
107+ "\x60\x48\x06\x82\x8b\x66\x58\xe6\x73\x91\x9c\x12\x3d\x35\x8e\x46"
108+ "\xad\x5a\xf5\xb3\xdb\x69\x21\x04\xfd\xd3\x1c\xdf\x94\x9d\x56\xb0"
109+ "\x0a\xd1\x95\x76\x8d\xec\x9e\xdd\x0b\x15\x97\x64\xad\xe5\xf2\x62"
110+ "\x02\xfc\x9e\x5f\x56\x42\x39\x05\xb3"
111+};
112+
113+/*
114+ * Signed data and detached signature blobs that form the verification tests.
115+ */
116+static const __initconst u8 certs_selftest_1_data[] = {
117+ "\x54\x68\x69\x73\x20\x69\x73\x20\x73\x6f\x6d\x65\x20\x74\x65\x73"
118+ "\x74\x20\x64\x61\x74\x61\x20\x75\x73\x65\x64\x20\x66\x6f\x72\x20"
119+ "\x73\x65\x6c\x66\x2d\x74\x65\x73\x74\x69\x6e\x67\x20\x63\x65\x72"
120+ "\x74\x69\x66\x69\x63\x61\x74\x65\x20\x76\x65\x72\x69\x66\x69\x63"
121+ "\x61\x74\x69\x6f\x6e\x2e\x0a"
122+};
123+
124+static const __initconst u8 certs_selftest_1_pkcs7[] = {
125+ "\x30\x82\x02\xab\x06\x09\x2a\x86\x48\x86\xf7\x0d\x01\x07\x02\xa0"
126+ "\x82\x02\x9c\x30\x82\x02\x98\x02\x01\x01\x31\x0d\x30\x0b\x06\x09"
127+ "\x60\x86\x48\x01\x65\x03\x04\x02\x01\x30\x0b\x06\x09\x2a\x86\x48"
128+ "\x86\xf7\x0d\x01\x07\x01\x31\x82\x02\x75\x30\x82\x02\x71\x02\x01"
129+ "\x01\x30\x4c\x30\x34\x31\x32\x30\x30\x06\x03\x55\x04\x03\x0c\x29"
130+ "\x43\x65\x72\x74\x69\x66\x69\x63\x61\x74\x65\x20\x76\x65\x72\x69"
131+ "\x66\x69\x63\x61\x74\x69\x6f\x6e\x20\x73\x65\x6c\x66\x2d\x74\x65"
132+ "\x73\x74\x69\x6e\x67\x20\x6b\x65\x79\x02\x14\x73\x98\xea\x98\x2d"
133+ "\xd0\x2e\xa8\xb1\xcf\x57\xc7\xf2\x97\xb3\xe6\x1a\xfc\x8c\x0a\x30"
134+ "\x0b\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x01\x30\x0d\x06\x09"
135+ "\x2a\x86\x48\x86\xf7\x0d\x01\x01\x01\x05\x00\x04\x82\x02\x00\xac"
136+ "\xb0\xf2\x07\xd6\x99\x6d\xc0\xc0\xd9\x8d\x31\x0d\x7e\x04\xeb\xc3"
137+ "\x88\x90\xc4\x58\x46\xd4\xe2\xa0\xa3\x25\xe3\x04\x50\x37\x85\x8c"
138+ "\x91\xc6\xfc\xc5\xd4\x92\xfd\x05\xd8\xb8\xa3\xb8\xba\x89\x13\x00"
139+ "\x88\x79\x99\x51\x6b\x5b\x28\x31\xc0\xb3\x1b\x7a\x68\x2c\x00\xdb"
140+ "\x4b\x46\x11\xf3\xfa\x50\x8e\x19\x89\xa2\x4c\xda\x4c\x89\x01\x11"
141+ "\x89\xee\xd3\xc8\xc1\xe7\xa7\xf6\xb2\xa2\xf8\x65\xb8\x35\x20\x33"
142+ "\xba\x12\x62\xd5\xbd\xaa\x71\xe5\x5b\xc0\x6a\x32\xff\x6a\x2e\x23"
143+ "\xef\x2b\xb6\x58\xb1\xfb\x5f\x82\x34\x40\x6d\x9f\xbc\x27\xac\x37"
144+ "\x23\x99\xcf\x7d\x20\xb2\x39\x01\xc0\x12\xce\xd7\x5d\x2f\xb6\xab"
145+ "\xb5\x56\x4f\xef\xf4\x72\x07\x58\x65\xa9\xeb\x1f\x75\x1c\x5f\x0c"
146+ "\x88\xe0\xa4\xe2\xcd\x73\x2b\x9e\xb2\x05\x7e\x12\xf8\xd0\x66\x41"
147+ "\xcc\x12\x63\xd4\xd6\xac\x9b\x1d\x14\x77\x8d\x1c\x57\xd5\x27\xc6"
148+ "\x49\xa2\x41\x43\xf3\x59\x29\xe5\xcb\xd1\x75\xbc\x3a\x97\x2a\x72"
149+ "\x22\x66\xc5\x3b\xc1\xba\xfc\x53\x18\x98\xe2\x21\x64\xc6\x52\x87"
150+ "\x13\xd5\x7c\x42\xe8\xfb\x9c\x9a\x45\x32\xd5\xa5\x22\x62\x9d\xd4"
151+ "\xcb\xa4\xfa\x77\xbb\x50\x24\x0b\x8b\x88\x99\x15\x56\xa9\x1e\x92"
152+ "\xbf\x5d\x94\x77\xb6\xf1\x67\x01\x60\x06\x58\x5c\xdf\x18\x52\x79"
153+ "\x37\x30\x93\x7d\x87\x04\xf1\xe0\x55\x59\x52\xf3\xc2\xb1\x1c\x5b"
154+ "\x12\x7c\x49\x87\xfb\xf7\xed\xdd\x95\x71\xec\x4b\x1a\x85\x08\xb0"
155+ "\xa0\x36\xc4\x7b\xab\x40\xe0\xf1\x98\xcc\xaf\x19\x40\x8f\x47\x6f"
156+ "\xf0\x6c\x84\x29\x7f\x7f\x04\x46\xcb\x08\x0f\xe0\xc1\xc9\x70\x6e"
157+ "\x95\x3b\xa4\xbc\x29\x2b\x53\x67\x45\x1b\x0d\xbc\x13\xa5\x76\x31"
158+ "\xaf\xb9\xd0\xe0\x60\x12\xd2\xf4\xb7\x7c\x58\x7e\xf6\x2d\xbb\x24"
159+ "\x14\x5a\x20\x24\xa8\x12\xdf\x25\xbd\x42\xce\x96\x7c\x2e\xba\x14"
160+ "\x1b\x81\x9f\x18\x45\xa4\xc6\x70\x3e\x0e\xf0\xd3\x7b\x9c\x10\xbe"
161+ "\xb8\x7a\x89\xc5\x9e\xd9\x97\xdf\xd7\xe7\xc6\x1d\xc0\x20\x6c\xb8"
162+ "\x1e\x3a\x63\xb8\x39\x8e\x8e\x62\xd5\xd2\xb4\xcd\xff\x46\xfc\x8e"
163+ "\xec\x07\x35\x0c\xff\xb0\x05\xe6\xf4\xe5\xfe\xa2\xe3\x0a\xe6\x36"
164+ "\xa7\x4a\x7e\x62\x1d\xc4\x50\x39\x35\x4e\x28\xcb\x4a\xfb\x9d\xdb"
165+ "\xdd\x23\xd6\x53\xb1\x74\x77\x12\xf7\x9c\xf0\x9a\x6b\xf7\xa9\x64"
166+ "\x2d\x86\x21\x2a\xcf\xc6\x54\xf5\xc9\xad\xfa\xb5\x12\xb4\xf3\x51"
167+ "\x77\x55\x3c\x6f\x0c\x32\xd3\x8c\x44\x39\x71\x25\xfe\x96\xd2"
168+};
169+
170+/*
171+ * List of tests to be run.
172+ */
173+#define TEST(data, pkcs7) { data, sizeof(data) - 1, pkcs7, sizeof(pkcs7) - 1 }
174+static const struct certs_test certs_tests[] __initconst = {
175+ TEST(certs_selftest_1_data, certs_selftest_1_pkcs7),
176+};
177+
178+int __init fips_signature_selftest(void)
179+{
180+ struct key *keyring;
181+ int ret, i;
182+
183+ pr_notice("Running certificate verification selftests\n");
184+
185+ keyring = keyring_alloc(".certs_selftest",
186+ GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, current_cred(),
187+ (KEY_POS_ALL & ~KEY_POS_SETATTR) |
188+ KEY_USR_VIEW | KEY_USR_READ |
189+ KEY_USR_SEARCH,
190+ KEY_ALLOC_NOT_IN_QUOTA,
191+ NULL, NULL);
192+ if (IS_ERR(keyring))
193+ panic("Can't allocate certs selftest keyring: %ld\n",
194+ PTR_ERR(keyring));
195+
196+ ret = x509_load_certificate_list(certs_selftest_keys,
197+ sizeof(certs_selftest_keys) - 1, keyring);
198+ if (ret < 0)
199+ panic("Can't allocate certs selftest keyring: %d\n", ret);
200+
201+ for (i = 0; i < ARRAY_SIZE(certs_tests); i++) {
202+ const struct certs_test *test = &certs_tests[i];
203+ struct pkcs7_message *pkcs7;
204+
205+ pkcs7 = pkcs7_parse_message(test->pkcs7, test->pkcs7_len);
206+ if (IS_ERR(pkcs7))
207+ panic("Certs selftest %d: pkcs7_parse_message() = %d\n", i, ret);
208+
209+ pkcs7_supply_detached_data(pkcs7, test->data, test->data_len);
210+
211+ ret = pkcs7_verify(pkcs7, VERIFYING_MODULE_SIGNATURE);
212+ if (ret < 0)
213+ panic("Certs selftest %d: pkcs7_verify() = %d\n", i, ret);
214+
215+ ret = pkcs7_validate_trust(pkcs7, keyring);
216+ if (ret < 0)
217+ panic("Certs selftest %d: pkcs7_validate_trust() = %d\n", i, ret);
218+
219+ pkcs7_free_message(pkcs7);
220+ }
221+
222+ key_put(keyring);
223+ return 0;
224+}
crypto/asymmetric_keys/x509_loader.crenamed from certs/common.c+4−4
@@ -2,11 +2,11 @@ · 1 unmodified line
22
33 #include <linux/kernel.h>
44 #include <linux/key.h>
5−#include "common.h"
5+#include <keys/asymmetric-type.h>
66
7−int load_certificate_list(const u8 cert_list[],
8− const unsigned long list_size,
9− const struct key *keyring)
7+int x509_load_certificate_list(const u8 cert_list[],
8+ const unsigned long list_size,
9+ const struct key *keyring)
1010 {
1111 key_ref_t key;
1212 const u8 *p, *end;
crypto/asymmetric_keys/x509_parser.h+9−0
@@ -40,6 +40,15 @@ struct x509_certificate { · 39 unmodified lines
4040 bool blacklisted;
4141 };
4242
43+/*
44+ * selftest.c
45+ */
46+#ifdef CONFIG_FIPS_SIGNATURE_SELFTEST
47+extern int __init fips_signature_selftest(void);
48+#else
49+static inline int fips_signature_selftest(void) { return 0; }
50+#endif
51+
4352 /*
4453 * x509_cert_parser.c
4554 */
crypto/asymmetric_keys/x509_public_key.c+7−1
@@ -244,9 +244,15 @@ static struct asymmetric_key_parser x509_key_parser = { · 243 unmodified lines
244244 /*
245245 * Module stuff
246246 */
247+extern int __init certs_selftest(void);
247248 static int __init x509_key_init(void)
248249 {
249− return register_asymmetric_key_parser(&x509_key_parser);
250+ int ret;
251+
252+ ret = register_asymmetric_key_parser(&x509_key_parser);
253+ if (ret < 0)
254+ return ret;
255+ return fips_signature_selftest();
250256 }
251257
252258 static void __exit x509_key_exit(void)
drivers/base/cpu.c+8−0
@@ -564,6 +564,12 @@ ssize_t __weak cpu_show_srbds(struct device *dev, · 563 unmodified lines
564564 return sysfs_emit(buf, "Not affected\n");
565565 }
566566
567+ssize_t __weak cpu_show_mmio_stale_data(struct device *dev,
568+ struct device_attribute *attr, char *buf)
569+{
570+ return sysfs_emit(buf, "Not affected\n");
571+}
572+
567573 static DEVICE_ATTR(meltdown, 0444, cpu_show_meltdown, NULL);
568574 static DEVICE_ATTR(spectre_v1, 0444, cpu_show_spectre_v1, NULL);
569575 static DEVICE_ATTR(spectre_v2, 0444, cpu_show_spectre_v2, NULL);
@@ -573,6 +579,7 @@ static DEVICE_ATTR(mds, 0444, cpu_show_mds, NULL); · 3 unmodified lines
573579 static DEVICE_ATTR(tsx_async_abort, 0444, cpu_show_tsx_async_abort, NULL);
574580 static DEVICE_ATTR(itlb_multihit, 0444, cpu_show_itlb_multihit, NULL);
575581 static DEVICE_ATTR(srbds, 0444, cpu_show_srbds, NULL);
582+static DEVICE_ATTR(mmio_stale_data, 0444, cpu_show_mmio_stale_data, NULL);
576583
577584 static struct attribute *cpu_root_vulnerabilities_attrs[] = {
578585 &dev_attr_meltdown.attr,
@@ -584,6 +591,7 @@ static struct attribute *cpu_root_vulnerabilities_attrs[] = { · 5 unmodified lines
584591 &dev_attr_tsx_async_abort.attr,
585592 &dev_attr_itlb_multihit.attr,
586593 &dev_attr_srbds.attr,
594+ &dev_attr_mmio_stale_data.attr,
587595 NULL
588596 };
589597
drivers/base/init.c+2−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #include <linux/init.h>
99 #include <linux/memory.h>
1010 #include <linux/of.h>
11+#include <linux/backing-dev.h>
1112
1213 #include "base.h"
1314
@@ -20,6 +21,7 @@ · 6 unmodified lines
2021 void __init driver_init(void)
2122 {
2223 /* These are the core pieces */
24+ bdi_init(&noop_backing_dev_info);
2325 devtmpfs_init();
2426 devices_init();
2527 buses_init();
drivers/base/memory.c+1−1
@@ -558,7 +558,7 @@ static ssize_t hard_offline_page_store(struct device *dev, · 557 unmodified lines
558558 if (kstrtoull(buf, 0, &pfn) < 0)
559559 return -EINVAL;
560560 pfn >>= PAGE_SHIFT;
561− ret = memory_failure(pfn, 0);
561+ ret = memory_failure(pfn, MF_SW_SIMULATED);
562562 if (ret == -EOPNOTSUPP)
563563 ret = 0;
564564 return ret ? ret : count;
drivers/base/regmap/regmap-irq.c+5−3
@@ -252,6 +252,7 @@ static void regmap_irq_enable(struct irq_data *data) · 251 unmodified lines
252252 struct regmap_irq_chip_data *d = irq_data_get_irq_chip_data(data);
253253 struct regmap *map = d->map;
254254 const struct regmap_irq *irq_data = irq_to_regmap_irq(d, data->hwirq);
255+ unsigned int reg = irq_data->reg_offset / map->reg_stride;
255256 unsigned int mask, type;
256257
257258 type = irq_data->type.type_falling_val | irq_data->type.type_rising_val;
@@ -268,14 +269,14 @@ static void regmap_irq_enable(struct irq_data *data) · 10 unmodified lines
268269 * at the corresponding offset in regmap_irq_set_type().
269270 */
270271 if (d->chip->type_in_mask && type)
271− mask = d->type_buf[irq_data->reg_offset / map->reg_stride];
272+ mask = d->type_buf[reg] & irq_data->mask;
272273 else
273274 mask = irq_data->mask;
274275
275276 if (d->chip->clear_on_unmask)
276277 d->clear_status = true;
277278
278− d->mask_buf[irq_data->reg_offset / map->reg_stride] &= ~mask;
279+ d->mask_buf[reg] &= ~mask;
279280 }
280281
281282 static void regmap_irq_disable(struct irq_data *data)
@@ -386,6 +387,7 @@ static inline int read_sub_irq_data(struct regmap_irq_chip_data *data, · 104 unmodified lines
386387 subreg = &chip->sub_reg_offsets[b];
387388 for (i = 0; i < subreg->num_regs; i++) {
388389 unsigned int offset = subreg->offset[i];
390+ unsigned int index = offset / map->reg_stride;
389391
390392 if (chip->not_fixed_stride)
391393 ret = regmap_read(map,
@@ -394,7 +396,7 @@ static inline int read_sub_irq_data(struct regmap_irq_chip_data *data, · 2 unmodified lines
394396 else
395397 ret = regmap_read(map,
396398 chip->status_base + offset,
397− &data->status_buf[offset]);
399+ &data->status_buf[index]);
398400
399401 if (ret)
400402 break;
drivers/base/regmap/regmap.c+8−7
@@ -1880,8 +1880,7 @@ static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg, · 1879 unmodified lines
18801880 */
18811881 bool regmap_can_raw_write(struct regmap *map)
18821882 {
1883− return map->bus && map->bus->write && map->format.format_val &&
1884− map->format.format_reg;
1883+ return map->write && map->format.format_val && map->format.format_reg;
18851884 }
18861885 EXPORT_SYMBOL_GPL(regmap_can_raw_write);
18871886
@@ -2155,10 +2154,9 @@ int regmap_noinc_write(struct regmap *map, unsigned int reg, · 267 unmodified lines
21552154 size_t write_len;
21562155 int ret;
21572156
2158− if (!map->bus)
2159− return -EINVAL;
2160− if (!map->bus->write)
2157+ if (!map->write)
21612158 return -ENOTSUPP;
2159+
21622160 if (val_len % map->format.val_bytes)
21632161 return -EINVAL;
21642162 if (!IS_ALIGNED(reg, map->reg_stride))
@@ -2278,7 +2276,7 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, · 113 unmodified lines
22782276 * Some devices don't support bulk write, for them we have a series of
22792277 * single write operations.
22802278 */
2281− if (!map->bus || !map->format.parse_inplace) {
2279+ if (!map->write || !map->format.parse_inplace) {
22822280 map->lock(map->lock_arg);
22832281 for (i = 0; i < val_count; i++) {
22842282 unsigned int ival;
@@ -2904,6 +2902,9 @@ int regmap_noinc_read(struct regmap *map, unsigned int reg, · 619 unmodified lines
29042902 size_t read_len;
29052903 int ret;
29062904
2905+ if (!map->read)
2906+ return -ENOTSUPP;
2907+
29072908 if (val_len % map->format.val_bytes)
29082909 return -EINVAL;
29092910 if (!IS_ALIGNED(reg, map->reg_stride))
@@ -3017,7 +3018,7 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, · 107 unmodified lines
30173018 if (val_count == 0)
30183019 return -EINVAL;
30193020
3020− if (map->format.parse_inplace && (vol || map->cache_type == REGCACHE_NONE)) {
3021+ if (map->read && map->format.parse_inplace && (vol || map->cache_type == REGCACHE_NONE)) {
30213022 ret = regmap_raw_read(map, reg, val, val_bytes * val_count);
30223023 if (ret != 0)
30233024 return ret;
drivers/block/xen-blkfront.c+12−7
@@ -2114,9 +2114,11 @@ static void blkfront_closing(struct blkfront_info *info) · 2113 unmodified lines
21142114 return;
21152115
21162116 /* No more blkif_request(). */
2117− blk_mq_stop_hw_queues(info->rq);
2118− blk_mark_disk_dead(info->gd);
2119− set_capacity(info->gd, 0);
2117+ if (info->rq && info->gd) {
2118+ blk_mq_stop_hw_queues(info->rq);
2119+ blk_mark_disk_dead(info->gd);
2120+ set_capacity(info->gd, 0);
2121+ }
21202122
21212123 for_each_rinfo(info, rinfo, i) {
21222124 /* No more gnttab callback work. */
@@ -2457,16 +2459,19 @@ static int blkfront_remove(struct xenbus_device *xbdev) · 334 unmodified lines
24572459
24582460 dev_dbg(&xbdev->dev, "%s removed", xbdev->nodename);
24592461
2460− del_gendisk(info->gd);
2462+ if (info->gd)
2463+ del_gendisk(info->gd);
24612464
24622465 mutex_lock(&blkfront_mutex);
24632466 list_del(&info->info_list);
24642467 mutex_unlock(&blkfront_mutex);
24652468
24662469 blkif_free(info, 0);
2467− xlbd_release_minors(info->gd->first_minor, info->gd->minors);
2468− blk_cleanup_disk(info->gd);
2469− blk_mq_free_tag_set(&info->tag_set);
2470+ if (info->gd) {
2471+ xlbd_release_minors(info->gd->first_minor, info->gd->minors);
2472+ blk_cleanup_disk(info->gd);
2473+ blk_mq_free_tag_set(&info->tag_set);
2474+ }
24702475
24712476 kfree(info);
24722477 return 0;
drivers/bus/bt1-apb.c+6−8
@@ -175,10 +175,9 @@ static int bt1_apb_request_rst(struct bt1_apb *apb) · 174 unmodified lines
175175 int ret;
176176
177177 apb->prst = devm_reset_control_get_optional_exclusive(apb->dev, "prst");
178− if (IS_ERR(apb->prst)) {
179− dev_warn(apb->dev, "Couldn't get reset control line\n");
180− return PTR_ERR(apb->prst);
181− }
178+ if (IS_ERR(apb->prst))
179+ return dev_err_probe(apb->dev, PTR_ERR(apb->prst),
180+ "Couldn't get reset control line\n");
182181
183182 ret = reset_control_deassert(apb->prst);
184183 if (ret)
@@ -199,10 +198,9 @@ static int bt1_apb_request_clk(struct bt1_apb *apb) · 14 unmodified lines
199198 int ret;
200199
201200 apb->pclk = devm_clk_get(apb->dev, "pclk");
202− if (IS_ERR(apb->pclk)) {
203− dev_err(apb->dev, "Couldn't get APB clock descriptor\n");
204− return PTR_ERR(apb->pclk);
205− }
201+ if (IS_ERR(apb->pclk))
202+ return dev_err_probe(apb->dev, PTR_ERR(apb->pclk),
203+ "Couldn't get APB clock descriptor\n");
206204
207205 ret = clk_prepare_enable(apb->pclk);
208206 if (ret) {
drivers/bus/bt1-axi.c+6−8
@@ -135,10 +135,9 @@ static int bt1_axi_request_rst(struct bt1_axi *axi) · 134 unmodified lines
135135 int ret;
136136
137137 axi->arst = devm_reset_control_get_optional_exclusive(axi->dev, "arst");
138− if (IS_ERR(axi->arst)) {
139− dev_warn(axi->dev, "Couldn't get reset control line\n");
140− return PTR_ERR(axi->arst);
141− }
138+ if (IS_ERR(axi->arst))
139+ return dev_err_probe(axi->dev, PTR_ERR(axi->arst),
140+ "Couldn't get reset control line\n");
142141
143142 ret = reset_control_deassert(axi->arst);
144143 if (ret)
@@ -159,10 +158,9 @@ static int bt1_axi_request_clk(struct bt1_axi *axi) · 14 unmodified lines
159158 int ret;
160159
161160 axi->aclk = devm_clk_get(axi->dev, "aclk");
162− if (IS_ERR(axi->aclk)) {
163− dev_err(axi->dev, "Couldn't get AXI Interconnect clock\n");
164− return PTR_ERR(axi->aclk);
165− }
161+ if (IS_ERR(axi->aclk))
162+ return dev_err_probe(axi->dev, PTR_ERR(axi->aclk),
163+ "Couldn't get AXI Interconnect clock\n");
166164
167165 ret = clk_prepare_enable(axi->aclk);
168166 if (ret) {
drivers/bus/fsl-mc/fsl-mc-bus.c+3−3
@@ -1239,14 +1239,14 @@ error_cleanup_mc_io: · 1238 unmodified lines
12391239 static int fsl_mc_bus_remove(struct platform_device *pdev)
12401240 {
12411241 struct fsl_mc *mc = platform_get_drvdata(pdev);
1242+ struct fsl_mc_io *mc_io;
12421243
12431244 if (!fsl_mc_is_root_dprc(&mc->root_mc_bus_dev->dev))
12441245 return -EINVAL;
12451246
1247+ mc_io = mc->root_mc_bus_dev->mc_io;
12461248 fsl_mc_device_remove(mc->root_mc_bus_dev);
1247−
1248− fsl_destroy_mc_io(mc->root_mc_bus_dev->mc_io);
1249− mc->root_mc_bus_dev->mc_io = NULL;
1249+ fsl_destroy_mc_io(mc_io);
12501250
12511251 bus_unregister_notifier(&fsl_mc_bus_type, &fsl_mc_nb);
12521252
drivers/char/lp.c+1−1
@@ -1019,7 +1019,7 @@ static struct parport_driver lp_driver = { · 1018 unmodified lines
10191019
10201020 static int __init lp_init(void)
10211021 {
1022− int i, err = 0;
1022+ int i, err;
10231023
10241024 if (parport_nr[0] == LP_PARPORT_OFF)
10251025 return 0;
drivers/char/random.c+3−3
@@ -87,7 +87,7 @@ static struct fasync_struct *fasync; · 86 unmodified lines
8787
8888 /* Control how we warn userspace. */
8989 static struct ratelimit_state urandom_warning =
90− RATELIMIT_STATE_INIT("warn_urandom_randomness", HZ, 3);
90+ RATELIMIT_STATE_INIT_FLAGS("urandom_warning", HZ, 3, RATELIMIT_MSG_ON_RELEASE);
9191 static int ratelimit_disable __read_mostly =
9292 IS_ENABLED(CONFIG_WARN_ALL_UNSEEDED_RANDOM);
9393 module_param_named(ratelimit_disable, ratelimit_disable, int, 0644);
@@ -408,7 +408,7 @@ static ssize_t get_random_bytes_user(struct iov_iter *iter) · 314 unmodified lines
408408
409409 /*
410410 * Immediately overwrite the ChaCha key at index 4 with random
411− * bytes, in case userspace causes copy_to_user() below to sleep
411+ * bytes, in case userspace causes copy_to_iter() below to sleep
412412 * forever, so that we still retain forward secrecy in that case.
413413 */
414414 crng_make_state(chacha_state, (u8 *)&chacha_state[4], CHACHA_KEY_SIZE);
@@ -1009,7 +1009,7 @@ void add_interrupt_randomness(int irq) · 594 unmodified lines
10091009 if (new_count & MIX_INFLIGHT)
10101010 return;
10111011
1012− if (new_count < 64 && !time_is_before_jiffies(fast_pool->last + HZ))
1012+ if (new_count < 1024 && !time_is_before_jiffies(fast_pool->last + HZ))
10131013 return;
10141014
10151015 if (unlikely(!fast_pool->mix.func))
drivers/clocksource/hyperv_timer.c+0−1
@@ -565,4 +565,3 @@ void __init hv_init_clocksource(void) · 564 unmodified lines
565565 hv_sched_clock_offset = hv_read_reference_counter();
566566 hv_setup_sched_clock(read_hv_sched_clock_msr);
567567 }
568−EXPORT_SYMBOL_GPL(hv_init_clocksource);
drivers/comedi/drivers/vmk80xx.c+1−1
@@ -684,7 +684,7 @@ static int vmk80xx_alloc_usb_buffers(struct comedi_device *dev) · 683 unmodified lines
684684 if (!devpriv->usb_rx_buf)
685685 return -ENOMEM;
686686
687− size = max(usb_endpoint_maxp(devpriv->ep_rx), MIN_BUF_SIZE);
687+ size = max(usb_endpoint_maxp(devpriv->ep_tx), MIN_BUF_SIZE);
688688 devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL);
689689 if (!devpriv->usb_tx_buf)
690690 return -ENOMEM;
drivers/dma-buf/udmabuf.c+4−1
@@ -32,8 +32,11 @@ static vm_fault_t udmabuf_vm_fault(struct vm_fault *vmf) · 31 unmodified lines
3232 {
3333 struct vm_area_struct *vma = vmf->vma;
3434 struct udmabuf *ubuf = vma->vm_private_data;
35+ pgoff_t pgoff = vmf->pgoff;
3536
36− vmf->page = ubuf->pages[vmf->pgoff];
37+ if (pgoff >= ubuf->pagecount)
38+ return VM_FAULT_SIGBUS;
39+ vmf->page = ubuf->pages[pgoff];
3740 get_page(vmf->page);
3841 return 0;
3942 }
drivers/firewire/core-cdev.c+1−1
@@ -1211,7 +1211,7 @@ static int ioctl_get_cycle_timer2(struct client *client, union ioctl_arg *arg) · 1210 unmodified lines
12111211 struct fw_cdev_get_cycle_timer2 *a = &arg->get_cycle_timer2;
12121212 struct fw_card *card = client->device->card;
12131213 struct timespec64 ts = {0, 0};
1214− u32 cycle_time;
1214+ u32 cycle_time = 0;
12151215 int ret = 0;
12161216
12171217 local_irq_disable();
drivers/firewire/core-device.c+2−4
@@ -372,8 +372,7 @@ static ssize_t rom_index_show(struct device *dev, · 371 unmodified lines
372372 struct fw_device *device = fw_device(dev->parent);
373373 struct fw_unit *unit = fw_unit(dev);
374374
375− return snprintf(buf, PAGE_SIZE, "%d\n",
376− (int)(unit->directory - device->config_rom));
375+ return sysfs_emit(buf, "%td\n", unit->directory - device->config_rom);
377376 }
378377
379378 static struct device_attribute fw_unit_attributes[] = {
@@ -403,8 +402,7 @@ static ssize_t guid_show(struct device *dev, · 23 unmodified lines
403402 int ret;
404403
405404 down_read(&fw_device_rwsem);
406− ret = snprintf(buf, PAGE_SIZE, "0x%08x%08x\n",
407− device->config_rom[3], device->config_rom[4]);
405+ ret = sysfs_emit(buf, "0x%08x%08x\n", device->config_rom[3], device->config_rom[4]);
408406 up_read(&fw_device_rwsem);
409407
410408 return ret;
drivers/firmware/arm_scmi/base.c+15−9
@@ -36,7 +36,7 @@ struct scmi_msg_resp_base_attributes { · 35 unmodified lines
3636
3737 struct scmi_msg_resp_base_discover_agent {
3838 __le32 agent_id;
39− u8 name[SCMI_MAX_STR_SIZE];
39+ u8 name[SCMI_SHORT_NAME_MAX_SIZE];
4040 };
4141
4242
@@ -119,7 +119,7 @@ scmi_base_vendor_id_get(const struct scmi_protocol_handle *ph, bool sub_vendor) · 76 unmodified lines
119119
120120 ret = ph->xops->do_xfer(ph, t);
121121 if (!ret)
122− memcpy(vendor_id, t->rx.buf, size);
122+ strscpy(vendor_id, t->rx.buf, size);
123123
124124 ph->xops->xfer_put(ph, t);
125125
@@ -221,11 +221,17 @@ scmi_base_implementation_list_get(const struct scmi_protocol_handle *ph, · 95 unmodified lines
221221 calc_list_sz = (1 + (loop_num_ret - 1) / sizeof(u32)) *
222222 sizeof(u32);
223223 if (calc_list_sz != real_list_sz) {
224− dev_err(dev,
225− "Malformed reply - real_sz:%zd calc_sz:%u\n",
226− real_list_sz, calc_list_sz);
227− ret = -EPROTO;
228− break;
224+ dev_warn(dev,
225+ "Malformed reply - real_sz:%zd calc_sz:%u (loop_num_ret:%d)\n",
226+ real_list_sz, calc_list_sz, loop_num_ret);
227+ /*
228+ * Bail out if the expected list size is bigger than the
229+ * total payload size of the received reply.
230+ */
231+ if (calc_list_sz > real_list_sz) {
232+ ret = -EPROTO;
233+ break;
234+ }
229235 }
230236
231237 for (loop = 0; loop < loop_num_ret; loop++)
@@ -270,7 +276,7 @@ static int scmi_base_discover_agent_get(const struct scmi_protocol_handle *ph, · 38 unmodified lines
270276 ret = ph->xops->do_xfer(ph, t);
271277 if (!ret) {
272278 agent_info = t->rx.buf;
273− strlcpy(name, agent_info->name, SCMI_MAX_STR_SIZE);
279+ strscpy(name, agent_info->name, SCMI_SHORT_NAME_MAX_SIZE);
274280 }
275281
276282 ph->xops->xfer_put(ph, t);
@@ -369,7 +375,7 @@ static int scmi_base_protocol_init(const struct scmi_protocol_handle *ph) · 92 unmodified lines
369375 int id, ret;
370376 u8 *prot_imp;
371377 u32 version;
372− char name[SCMI_MAX_STR_SIZE];
378+ char name[SCMI_SHORT_NAME_MAX_SIZE];
373379 struct device *dev = ph->dev;
374380 struct scmi_revision_info *rev = scmi_revision_area_get(ph);
375381
drivers/firmware/arm_scmi/clock.c+3−4
@@ -153,7 +153,7 @@ static int scmi_clock_attributes_get(const struct scmi_protocol_handle *ph, · 152 unmodified lines
153153 if (!ret) {
154154 u32 latency = 0;
155155 attributes = le32_to_cpu(attr->attributes);
156− strlcpy(clk->name, attr->name, SCMI_MAX_STR_SIZE);
156+ strscpy(clk->name, attr->name, SCMI_SHORT_NAME_MAX_SIZE);
157157 /* clock_enable_latency field is present only since SCMI v3.1 */
158158 if (PROTOCOL_REV_MAJOR(version) >= 0x2)
159159 latency = le32_to_cpu(attr->clock_enable_latency);
@@ -266,9 +266,7 @@ scmi_clock_describe_rates_get(const struct scmi_protocol_handle *ph, u32 clk_id, · 106 unmodified lines
266266 struct scmi_clock_info *clk)
267267 {
268268 int ret;
269−
270269 void *iter;
271− struct scmi_msg_clock_describe_rates *msg;
272270 struct scmi_iterator_ops ops = {
273271 .prepare_message = iter_clk_describe_prepare_message,
274272 .update_state = iter_clk_describe_update_state,
@@ -281,7 +279,8 @@ scmi_clock_describe_rates_get(const struct scmi_protocol_handle *ph, u32 clk_id, · 6 unmodified lines
281279
282280 iter = ph->hops->iter_response_init(ph, &ops, SCMI_MAX_NUM_RATES,
283281 CLOCK_DESCRIBE_RATES,
284− sizeof(*msg), &cpriv);
282+ sizeof(struct scmi_msg_clock_describe_rates),
283+ &cpriv);
285284 if (IS_ERR(iter))
286285 return PTR_ERR(iter);
287286
drivers/firmware/arm_scmi/perf.c+3−3
@@ -252,7 +252,7 @@ scmi_perf_domain_attributes_get(const struct scmi_protocol_handle *ph, · 251 unmodified lines
252252 dom_info->mult_factor =
253253 (dom_info->sustained_freq_khz * 1000) /
254254 dom_info->sustained_perf_level;
255− strlcpy(dom_info->name, attr->name, SCMI_MAX_STR_SIZE);
255+ strscpy(dom_info->name, attr->name, SCMI_SHORT_NAME_MAX_SIZE);
256256 }
257257
258258 ph->xops->xfer_put(ph, t);
@@ -332,7 +332,6 @@ scmi_perf_describe_levels_get(const struct scmi_protocol_handle *ph, u32 domain, · 73 unmodified lines
332332 {
333333 int ret;
334334 void *iter;
335− struct scmi_msg_perf_describe_levels *msg;
336335 struct scmi_iterator_ops ops = {
337336 .prepare_message = iter_perf_levels_prepare_message,
338337 .update_state = iter_perf_levels_update_state,
@@ -345,7 +344,8 @@ scmi_perf_describe_levels_get(const struct scmi_protocol_handle *ph, u32 domain, · 6 unmodified lines
345344
346345 iter = ph->hops->iter_response_init(ph, &ops, MAX_OPPS,
347346 PERF_DESCRIBE_LEVELS,
348− sizeof(*msg), &ppriv);
347+ sizeof(struct scmi_msg_perf_describe_levels),
348+ &ppriv);
349349 if (IS_ERR(iter))
350350 return PTR_ERR(iter);
351351
drivers/firmware/arm_scmi/power.c+1−1
@@ -122,7 +122,7 @@ scmi_power_domain_attributes_get(const struct scmi_protocol_handle *ph, · 121 unmodified lines
122122 dom_info->state_set_notify = SUPPORTS_STATE_SET_NOTIFY(flags);
123123 dom_info->state_set_async = SUPPORTS_STATE_SET_ASYNC(flags);
124124 dom_info->state_set_sync = SUPPORTS_STATE_SET_SYNC(flags);
125− strlcpy(dom_info->name, attr->name, SCMI_MAX_STR_SIZE);
125+ strscpy(dom_info->name, attr->name, SCMI_SHORT_NAME_MAX_SIZE);
126126 }
127127 ph->xops->xfer_put(ph, t);
128128
drivers/firmware/arm_scmi/protocols.h+0−2
@@ -24,8 +24,6 @@ · 23 unmodified lines
2424
2525 #include <asm/unaligned.h>
2626
27−#define SCMI_SHORT_NAME_MAX_SIZE 16
28−
2927 #define PROTOCOL_REV_MINOR_MASK GENMASK(15, 0)
3028 #define PROTOCOL_REV_MAJOR_MASK GENMASK(31, 16)
3129 #define PROTOCOL_REV_MAJOR(x) ((u16)(FIELD_GET(PROTOCOL_REV_MAJOR_MASK, (x))))
drivers/firmware/arm_scmi/reset.c+1−1
@@ -116,7 +116,7 @@ scmi_reset_domain_attributes_get(const struct scmi_protocol_handle *ph, · 115 unmodified lines
116116 dom_info->latency_us = le32_to_cpu(attr->latency);
117117 if (dom_info->latency_us == U32_MAX)
118118 dom_info->latency_us = 0;
119− strlcpy(dom_info->name, attr->name, SCMI_MAX_STR_SIZE);
119+ strscpy(dom_info->name, attr->name, SCMI_SHORT_NAME_MAX_SIZE);
120120 }
121121
122122 ph->xops->xfer_put(ph, t);
drivers/firmware/arm_scmi/sensors.c+52−16
@@ -338,7 +338,6 @@ static int scmi_sensor_update_intervals(const struct scmi_protocol_handle *ph, · 337 unmodified lines
338338 struct scmi_sensor_info *s)
339339 {
340340 void *iter;
341− struct scmi_msg_sensor_list_update_intervals *msg;
342341 struct scmi_iterator_ops ops = {
343342 .prepare_message = iter_intervals_prepare_message,
344343 .update_state = iter_intervals_update_state,
@@ -351,22 +350,28 @@ static int scmi_sensor_update_intervals(const struct scmi_protocol_handle *ph, · 6 unmodified lines
351350
352351 iter = ph->hops->iter_response_init(ph, &ops, s->intervals.count,
353352 SENSOR_LIST_UPDATE_INTERVALS,
354− sizeof(*msg), &upriv);
353+ sizeof(struct scmi_msg_sensor_list_update_intervals),
354+ &upriv);
355355 if (IS_ERR(iter))
356356 return PTR_ERR(iter);
357357
358358 return ph->hops->iter_response_run(iter);
359359 }
360360
361+struct scmi_apriv {
362+ bool any_axes_support_extended_names;
363+ struct scmi_sensor_info *s;
364+};
365+
361366 static void iter_axes_desc_prepare_message(void *message,
362367 const unsigned int desc_index,
363368 const void *priv)
364369 {
365370 struct scmi_msg_sensor_axis_description_get *msg = message;
366− const struct scmi_sensor_info *s = priv;
371+ const struct scmi_apriv *apriv = priv;
367372
368373 /* Set the number of sensors to be skipped/already read */
369− msg->id = cpu_to_le32(s->id);
374+ msg->id = cpu_to_le32(apriv->s->id);
370375 msg->axis_desc_index = cpu_to_le32(desc_index);
371376 }
372377
@@ -393,19 +398,21 @@ iter_axes_desc_process_response(const struct scmi_protocol_handle *ph, · 20 unmodified lines
393398 u32 attrh, attrl;
394399 struct scmi_sensor_axis_info *a;
395400 size_t dsize = SCMI_MSG_RESP_AXIS_DESCR_BASE_SZ;
396− struct scmi_sensor_info *s = priv;
401+ struct scmi_apriv *apriv = priv;
397402 const struct scmi_axis_descriptor *adesc = st->priv;
398403
399404 attrl = le32_to_cpu(adesc->attributes_low);
405+ if (SUPPORTS_EXTENDED_AXIS_NAMES(attrl))
406+ apriv->any_axes_support_extended_names = true;
400407
401− a = &s->axis[st->desc_index + st->loop_idx];
408+ a = &apriv->s->axis[st->desc_index + st->loop_idx];
402409 a->id = le32_to_cpu(adesc->id);
403410 a->extended_attrs = SUPPORTS_EXTEND_ATTRS(attrl);
404411
405412 attrh = le32_to_cpu(adesc->attributes_high);
406413 a->scale = S32_EXT(SENSOR_SCALE(attrh));
407414 a->type = SENSOR_TYPE(attrh);
408− strscpy(a->name, adesc->name, SCMI_MAX_STR_SIZE);
415+ strscpy(a->name, adesc->name, SCMI_SHORT_NAME_MAX_SIZE);
409416
410417 if (a->extended_attrs) {
411418 unsigned int ares = le32_to_cpu(adesc->resolution);
@@ -444,10 +451,19 @@ iter_axes_extended_name_process_response(const struct scmi_protocol_handle *ph, · 32 unmodified lines
444451 void *priv)
445452 {
446453 struct scmi_sensor_axis_info *a;
447− const struct scmi_sensor_info *s = priv;
454+ const struct scmi_apriv *apriv = priv;
448455 struct scmi_sensor_axis_name_descriptor *adesc = st->priv;
456+ u32 axis_id = le32_to_cpu(adesc->axis_id);
449457
450− a = &s->axis[st->desc_index + st->loop_idx];
458+ if (axis_id >= st->max_resources)
459+ return -EPROTO;
460+
461+ /*
462+ * Pick the corresponding descriptor based on the axis_id embedded
463+ * in the reply since the list of axes supporting extended names
464+ * can be a subset of all the axes.
465+ */
466+ a = &apriv->s->axis[axis_id];
451467 strscpy(a->name, adesc->name, SCMI_MAX_STR_SIZE);
452468 st->priv = ++adesc;
453469
@@ -458,21 +474,36 @@ static int · 4 unmodified lines
458474 scmi_sensor_axis_extended_names_get(const struct scmi_protocol_handle *ph,
459475 struct scmi_sensor_info *s)
460476 {
477+ int ret;
461478 void *iter;
462− struct scmi_msg_sensor_axis_description_get *msg;
463479 struct scmi_iterator_ops ops = {
464480 .prepare_message = iter_axes_desc_prepare_message,
465481 .update_state = iter_axes_extended_name_update_state,
466482 .process_response = iter_axes_extended_name_process_response,
467483 };
484+ struct scmi_apriv apriv = {
485+ .any_axes_support_extended_names = false,
486+ .s = s,
487+ };
468488
469489 iter = ph->hops->iter_response_init(ph, &ops, s->num_axis,
470490 SENSOR_AXIS_NAME_GET,
471− sizeof(*msg), s);
491+ sizeof(struct scmi_msg_sensor_axis_description_get),
492+ &apriv);
472493 if (IS_ERR(iter))
473494 return PTR_ERR(iter);
474495
475− return ph->hops->iter_response_run(iter);
496+ /*
497+ * Do not cause whole protocol initialization failure when failing to
498+ * get extended names for axes.
499+ */
500+ ret = ph->hops->iter_response_run(iter);
501+ if (ret)
502+ dev_warn(ph->dev,
503+ "Failed to get axes extended names for %s (ret:%d).\n",
504+ s->name, ret);
505+
506+ return 0;
476507 }
477508
478509 static int scmi_sensor_axis_description(const struct scmi_protocol_handle *ph,
@@ -481,12 +512,15 @@ static int scmi_sensor_axis_description(const struct scmi_protocol_handle *ph, · 2 unmodified lines
481512 {
482513 int ret;
483514 void *iter;
484− struct scmi_msg_sensor_axis_description_get *msg;
485515 struct scmi_iterator_ops ops = {
486516 .prepare_message = iter_axes_desc_prepare_message,
487517 .update_state = iter_axes_desc_update_state,
488518 .process_response = iter_axes_desc_process_response,
489519 };
520+ struct scmi_apriv apriv = {
521+ .any_axes_support_extended_names = false,
522+ .s = s,
523+ };
490524
491525 s->axis = devm_kcalloc(ph->dev, s->num_axis,
492526 sizeof(*s->axis), GFP_KERNEL);
@@ -495,7 +529,8 @@ static int scmi_sensor_axis_description(const struct scmi_protocol_handle *ph, · 2 unmodified lines
495529
496530 iter = ph->hops->iter_response_init(ph, &ops, s->num_axis,
497531 SENSOR_AXIS_DESCRIPTION_GET,
498− sizeof(*msg), s);
532+ sizeof(struct scmi_msg_sensor_axis_description_get),
533+ &apriv);
499534 if (IS_ERR(iter))
500535 return PTR_ERR(iter);
501536
@@ -503,7 +538,8 @@ static int scmi_sensor_axis_description(const struct scmi_protocol_handle *ph, · 1 unmodified line
503538 if (ret)
504539 return ret;
505540
506− if (PROTOCOL_REV_MAJOR(version) >= 0x3)
541+ if (PROTOCOL_REV_MAJOR(version) >= 0x3 &&
542+ apriv.any_axes_support_extended_names)
507543 ret = scmi_sensor_axis_extended_names_get(ph, s);
508544
509545 return ret;
@@ -598,7 +634,7 @@ iter_sens_descr_process_response(const struct scmi_protocol_handle *ph, · 88 unmodified lines
598634 SUPPORTS_AXIS(attrh) ?
599635 SENSOR_AXIS_NUMBER(attrh) : 0,
600636 SCMI_MAX_NUM_SENSOR_AXIS);
601− strscpy(s->name, sdesc->name, SCMI_MAX_STR_SIZE);
637+ strscpy(s->name, sdesc->name, SCMI_SHORT_NAME_MAX_SIZE);
602638
603639 /*
604640 * If supported overwrite short name with the extended
drivers/firmware/arm_scmi/voltage.c+5−10
@@ -180,7 +180,6 @@ static int scmi_voltage_levels_get(const struct scmi_protocol_handle *ph, · 179 unmodified lines
180180 {
181181 int ret;
182182 void *iter;
183− struct scmi_msg_cmd_describe_levels *msg;
184183 struct scmi_iterator_ops ops = {
185184 .prepare_message = iter_volt_levels_prepare_message,
186185 .update_state = iter_volt_levels_update_state,
@@ -193,7 +192,8 @@ static int scmi_voltage_levels_get(const struct scmi_protocol_handle *ph, · 6 unmodified lines
193192
194193 iter = ph->hops->iter_response_init(ph, &ops, v->num_levels,
195194 VOLTAGE_DESCRIBE_LEVELS,
196− sizeof(*msg), &vpriv);
195+ sizeof(struct scmi_msg_cmd_describe_levels),
196+ &vpriv);
197197 if (IS_ERR(iter))
198198 return PTR_ERR(iter);
199199
@@ -225,15 +225,14 @@ static int scmi_voltage_descriptors_get(const struct scmi_protocol_handle *ph, · 25 unmodified lines
225225
226226 /* Retrieve domain attributes at first ... */
227227 put_unaligned_le32(dom, td->tx.buf);
228− ret = ph->xops->do_xfer(ph, td);
229228 /* Skip domain on comms error */
230− if (ret)
229+ if (ph->xops->do_xfer(ph, td))
231230 continue;
232231
233232 v = vinfo->domains + dom;
234233 v->id = dom;
235234 attributes = le32_to_cpu(resp_dom->attr);
236− strlcpy(v->name, resp_dom->name, SCMI_MAX_STR_SIZE);
235+ strscpy(v->name, resp_dom->name, SCMI_SHORT_NAME_MAX_SIZE);
237236
238237 /*
239238 * If supported overwrite short name with the extended one;
@@ -249,12 +248,8 @@ static int scmi_voltage_descriptors_get(const struct scmi_protocol_handle *ph, · 9 unmodified lines
249248 v->async_level_set = true;
250249 }
251250
252− ret = scmi_voltage_levels_get(ph, v);
253251 /* Skip invalid voltage descriptors */
254− if (ret)
255− continue;
256−
257− ph->xops->reset_rx_to_maxsz(ph, td);
252+ scmi_voltage_levels_get(ph, v);
258253 }
259254
260255 ph->xops->xfer_put(ph, td);
drivers/firmware/efi/sysfb_efi.c+0−2
@@ -26,8 +26,6 @@ · 25 unmodified lines
2626 #include <linux/sysfb.h>
2727 #include <video/vga.h>
2828
29−#include <asm/efi.h>
30−
3129 enum {
3230 OVERRIDE_NONE = 0x0,
3331 OVERRIDE_BASE = 0x1,
drivers/gpio/gpio-grgpio.c+1−13
@@ -434,25 +434,13 @@ static int grgpio_probe(struct platform_device *ofdev) · 433 unmodified lines
434434 static int grgpio_remove(struct platform_device *ofdev)
435435 {
436436 struct grgpio_priv *priv = platform_get_drvdata(ofdev);
437− int i;
438− int ret = 0;
439−
440− if (priv->domain) {
441− for (i = 0; i < GRGPIO_MAX_NGPIO; i++) {
442− if (priv->uirqs[i].refcnt != 0) {
443− ret = -EBUSY;
444− goto out;
445− }
446− }
447− }
448437
449438 gpiochip_remove(&priv->gc);
450439
451440 if (priv->domain)
452441 irq_domain_remove(priv->domain);
453442
454−out:
455− return ret;
443+ return 0;
456444 }
457445
458446 static const struct of_device_id grgpio_match[] = {
drivers/gpio/gpio-mxs.c+1−1
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0+
22 //
3−// MXC GPIO support. (c) 2008 Daniel Mack <daniel@caiaq.de>
3+// MXS GPIO support. (c) 2008 Daniel Mack <daniel@caiaq.de>
44 // Copyright 2008 Juergen Beisert, kernel@pengutronix.de
55 //
66 // Based on code from Freescale,
drivers/gpio/gpio-realtek-otto.c+8−2
@@ -172,6 +172,8 @@ static void realtek_gpio_irq_unmask(struct irq_data *data) · 171 unmodified lines
172172 unsigned long flags;
173173 u16 m;
174174
175+ gpiochip_enable_irq(&ctrl->gc, line);
176+
175177 raw_spin_lock_irqsave(&ctrl->lock, flags);
176178 m = ctrl->intr_mask[port];
177179 m |= realtek_gpio_imr_bits(port_pin, REALTEK_GPIO_IMR_LINE_MASK);
@@ -195,6 +197,8 @@ static void realtek_gpio_irq_mask(struct irq_data *data) · 17 unmodified lines
195197 ctrl->intr_mask[port] = m;
196198 realtek_gpio_write_imr(ctrl, port, ctrl->intr_type[port], m);
197199 raw_spin_unlock_irqrestore(&ctrl->lock, flags);
200+
201+ gpiochip_disable_irq(&ctrl->gc, line);
198202 }
199203
200204 static int realtek_gpio_irq_set_type(struct irq_data *data, unsigned int flow_type)
@@ -315,13 +319,15 @@ static int realtek_gpio_irq_init(struct gpio_chip *gc) · 114 unmodified lines
315319 return 0;
316320 }
317321
318−static struct irq_chip realtek_gpio_irq_chip = {
322+static const struct irq_chip realtek_gpio_irq_chip = {
319323 .name = "realtek-otto-gpio",
320324 .irq_ack = realtek_gpio_irq_ack,
321325 .irq_mask = realtek_gpio_irq_mask,
322326 .irq_unmask = realtek_gpio_irq_unmask,
323327 .irq_set_type = realtek_gpio_irq_set_type,
324328 .irq_set_affinity = realtek_gpio_irq_set_affinity,
329+ .flags = IRQCHIP_IMMUTABLE,
330+ GPIOCHIP_IRQ_RESOURCE_HELPERS,
325331 };
326332
327333 static const struct of_device_id realtek_gpio_of_match[] = {
@@ -404,7 +410,7 @@ static int realtek_gpio_probe(struct platform_device *pdev) · 76 unmodified lines
404410 irq = platform_get_irq_optional(pdev, 0);
405411 if (!(dev_flags & GPIO_INTERRUPTS_DISABLED) && irq > 0) {
406412 girq = &ctrl->gc.irq;
407− girq->chip = &realtek_gpio_irq_chip;
413+ gpio_irq_chip_set_chip(girq, &realtek_gpio_irq_chip);
408414 girq->default_type = IRQ_TYPE_NONE;
409415 girq->handler = handle_bad_irq;
410416 girq->parent_handler = realtek_gpio_irq_handler;
drivers/gpio/gpio-vr41xx.c+0−2
@@ -217,8 +217,6 @@ static int giu_get_irq(unsigned int irq) · 216 unmodified lines
217217 printk(KERN_ERR "spurious GIU interrupt: %04x(%04x),%04x(%04x)\n",
218218 maskl, pendl, maskh, pendh);
219219
220− atomic_inc(&irq_err_count);
221−
222220 return -EINVAL;
223221 }
224222
drivers/gpio/gpio-winbond.c+4−3
@@ -385,12 +385,13 @@ static int winbond_gpio_get(struct gpio_chip *gc, unsigned int offset) · 384 unmodified lines
385385 unsigned long *base = gpiochip_get_data(gc);
386386 const struct winbond_gpio_info *info;
387387 bool val;
388+ int ret;
388389
389390 winbond_gpio_get_info(&offset, &info);
390391
391− val = winbond_sio_enter(*base);
392− if (val)
393− return val;
392+ ret = winbond_sio_enter(*base);
393+ if (ret)
394+ return ret;
394395
395396 winbond_sio_select_logical(*base, info->dev);
396397
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c+0−2
@@ -642,7 +642,6 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 641 unmodified lines
642642 atomic64_read(&adev->visible_pin_size),
643643 vram_gtt.vram_size);
644644 vram_gtt.gtt_size = ttm_manager_type(&adev->mman.bdev, TTM_PL_TT)->size;
645− vram_gtt.gtt_size *= PAGE_SIZE;
646645 vram_gtt.gtt_size -= atomic64_read(&adev->gart_pin_size);
647646 return copy_to_user(out, &vram_gtt,
648647 min((size_t)size, sizeof(vram_gtt))) ? -EFAULT : 0;
@@ -675,7 +674,6 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 26 unmodified lines
675674 mem.cpu_accessible_vram.usable_heap_size * 3 / 4;
676675
677676 mem.gtt.total_heap_size = gtt_man->size;
678− mem.gtt.total_heap_size *= PAGE_SIZE;
679677 mem.gtt.usable_heap_size = mem.gtt.total_heap_size -
680678 atomic64_read(&adev->gart_pin_size);
681679 mem.gtt.heap_usage = ttm_resource_manager_usage(gtt_man);
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c+14−6
@@ -1798,18 +1798,26 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) · 1797 unmodified lines
17981798 DRM_INFO("amdgpu: %uM of VRAM memory ready\n",
17991799 (unsigned) (adev->gmc.real_vram_size / (1024 * 1024)));
18001800
1801− /* Compute GTT size, either bsaed on 3/4th the size of RAM size
1801+ /* Compute GTT size, either based on 1/2 the size of RAM size
18021802 * or whatever the user passed on module init */
18031803 if (amdgpu_gtt_size == -1) {
18041804 struct sysinfo si;
18051805
18061806 si_meminfo(&si);
1807− gtt_size = min(max((AMDGPU_DEFAULT_GTT_SIZE_MB << 20),
1808− adev->gmc.mc_vram_size),
1809− ((uint64_t)si.totalram * si.mem_unit * 3/4));
1810− }
1811− else
1807+ /* Certain GL unit tests for large textures can cause problems
1808+ * with the OOM killer since there is no way to link this memory
1809+ * to a process. This was originally mitigated (but not necessarily
1810+ * eliminated) by limiting the GTT size. The problem is this limit
1811+ * is often too low for many modern games so just make the limit 1/2
1812+ * of system memory which aligns with TTM. The OOM accounting needs
1813+ * to be addressed, but we shouldn't prevent common 3D applications
1814+ * from being usable just to potentially mitigate that corner case.
1815+ */
1816+ gtt_size = max((AMDGPU_DEFAULT_GTT_SIZE_MB << 20),
1817+ (u64)si.totalram * si.mem_unit / 2);
1818+ } else {
18121819 gtt_size = (uint64_t)amdgpu_gtt_size << 20;
1820+ }
18131821
18141822 /* Initialize GTT memory pool */
18151823 r = amdgpu_gtt_mgr_init(adev, gtt_size);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+4−4
@@ -2812,7 +2812,7 @@ static struct drm_mode_config_helper_funcs amdgpu_dm_mode_config_helperfuncs = { · 2811 unmodified lines
28122812
28132813 static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector)
28142814 {
2815− u32 max_cll, min_cll, max, min, q, r;
2815+ u32 max_avg, min_cll, max, min, q, r;
28162816 struct amdgpu_dm_backlight_caps *caps;
28172817 struct amdgpu_display_manager *dm;
28182818 struct drm_connector *conn_base;
@@ -2842,7 +2842,7 @@ static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector) · 23 unmodified lines
28422842 caps = &dm->backlight_caps[i];
28432843 caps->ext_caps = &aconnector->dc_link->dpcd_sink_ext_caps;
28442844 caps->aux_support = false;
2845− max_cll = conn_base->hdr_sink_metadata.hdmi_type1.max_cll;
2845+ max_avg = conn_base->hdr_sink_metadata.hdmi_type1.max_fall;
28462846 min_cll = conn_base->hdr_sink_metadata.hdmi_type1.min_cll;
28472847
28482848 if (caps->ext_caps->bits.oled == 1 /*||
@@ -2870,8 +2870,8 @@ static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector) · 21 unmodified lines
28702870 * The results of the above expressions can be verified at
28712871 * pre_computed_values.
28722872 */
2873− q = max_cll >> 5;
2874− r = max_cll % 32;
2873+ q = max_avg >> 5;
2874+ r = max_avg % 32;
28752875 max = (1 << q) * pre_computed_values[r];
28762876
28772877 // min luminance: maxLum * (CV/255)^2 / 100
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c+1−1
@@ -550,7 +550,7 @@ static void dcn315_clk_mgr_helper_populate_bw_params( · 549 unmodified lines
550550 if (!bw_params->clk_table.entries[i].dtbclk_mhz)
551551 bw_params->clk_table.entries[i].dtbclk_mhz = def_max.dtbclk_mhz;
552552 }
553− ASSERT(bw_params->clk_table.entries[i].dcfclk_mhz);
553+ ASSERT(bw_params->clk_table.entries[i-1].dcfclk_mhz);
554554 bw_params->vram_type = bios_info->memory_type;
555555 bw_params->num_channels = bios_info->ma_channel_number;
556556 if (!bw_params->num_channels)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c+1−1
@@ -944,7 +944,7 @@ static void override_lane_settings(const struct link_training_settings *lt_setti · 943 unmodified lines
944944
945945 return;
946946
947− for (lane = 1; lane < LANE_COUNT_DP_MAX; lane++) {
947+ for (lane = 0; lane < LANE_COUNT_DP_MAX; lane++) {
948948 if (lt_settings->voltage_swing)
949949 lane_settings[lane].VOLTAGE_SWING = *lt_settings->voltage_swing;
950950 if (lt_settings->pre_emphasis)
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c+2−22
@@ -1766,29 +1766,9 @@ void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context) · 1765 unmodified lines
17661766 break;
17671767 }
17681768 }
1769−
1770− /*
1771− * TO-DO: So far the code logic below only addresses single eDP case.
1772− * For dual eDP case, there are a few things that need to be
1773− * implemented first:
1774− *
1775− * 1. Change the fastboot logic above, so eDP link[0 or 1]'s
1776− * stream[0 or 1] will all be checked.
1777− *
1778− * 2. Change keep_edp_vdd_on to an array, and maintain keep_edp_vdd_on
1779− * for each eDP.
1780− *
1781− * Once above 2 things are completed, we can then change the logic below
1782− * correspondingly, so dual eDP case will be fully covered.
1783− */
1784−
1785− // We are trying to enable eDP, don't power down VDD if eDP stream is existing
1786− if ((edp_stream_num == 1 && edp_streams[0] != NULL) || can_apply_edp_fast_boot) {
1769+ // We are trying to enable eDP, don't power down VDD
1770+ if (can_apply_edp_fast_boot)
17871771 keep_edp_vdd_on = true;
1788− DC_LOG_EVENT_LINK_TRAINING("Keep eDP Vdd on\n");
1789− } else {
1790− DC_LOG_EVENT_LINK_TRAINING("No eDP stream enabled, turn eDP Vdd off\n");
1791− }
17921772 }
17931773
17941774 // Check seamless boot support
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dpp.c+3−0
@@ -212,6 +212,9 @@ static void dpp2_cnv_setup ( · 211 unmodified lines
212212 break;
213213 }
214214
215+ /* Set default color space based on format if none is given. */
216+ color_space = input_color_space ? input_color_space : color_space;
217+
215218 if (is_2bit == 1 && alpha_2bit_lut != NULL) {
216219 REG_UPDATE(ALPHA_2BIT_LUT, ALPHA_2BIT_LUT0, alpha_2bit_lut->lut0);
217220 REG_UPDATE(ALPHA_2BIT_LUT, ALPHA_2BIT_LUT1, alpha_2bit_lut->lut1);
drivers/gpu/drm/amd/display/dc/dcn201/dcn201_dpp.c+3−0
@@ -153,6 +153,9 @@ static void dpp201_cnv_setup( · 152 unmodified lines
153153 break;
154154 }
155155
156+ /* Set default color space based on format if none is given. */
157+ color_space = input_color_space ? input_color_space : color_space;
158+
156159 if (is_2bit == 1 && alpha_2bit_lut != NULL) {
157160 REG_UPDATE(ALPHA_2BIT_LUT, ALPHA_2BIT_LUT0, alpha_2bit_lut->lut0);
158161 REG_UPDATE(ALPHA_2BIT_LUT, ALPHA_2BIT_LUT1, alpha_2bit_lut->lut1);
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp.c+3−0
@@ -294,6 +294,9 @@ static void dpp3_cnv_setup ( · 293 unmodified lines
294294 break;
295295 }
296296
297+ /* Set default color space based on format if none is given. */
298+ color_space = input_color_space ? input_color_space : color_space;
299+
297300 if (is_2bit == 1 && alpha_2bit_lut != NULL) {
298301 REG_UPDATE(ALPHA_2BIT_LUT, ALPHA_2BIT_LUT0, alpha_2bit_lut->lut0);
299302 REG_UPDATE(ALPHA_2BIT_LUT, ALPHA_2BIT_LUT1, alpha_2bit_lut->lut1);
drivers/gpu/drm/drm_panel_orientation_quirks.c+6−0
@@ -152,6 +152,12 @@ static const struct dmi_system_id orientation_data[] = { · 151 unmodified lines
152152 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "AYA NEO 2021"),
153153 },
154154 .driver_data = (void *)&lcd800x1280_rightside_up,
155+ }, { /* AYA NEO NEXT */
156+ .matches = {
157+ DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
158+ DMI_MATCH(DMI_BOARD_NAME, "NEXT"),
159+ },
160+ .driver_data = (void *)&lcd800x1280_rightside_up,
155161 }, { /* Chuwi HiBook (CWI514) */
156162 .matches = {
157163 DMI_MATCH(DMI_BOARD_VENDOR, "Hampoo"),
drivers/gpu/drm/exynos/exynos_drm_drv.c+3−3
@@ -176,15 +176,15 @@ static struct exynos_drm_driver_info exynos_drm_drivers[] = { · 175 unmodified lines
176176 }, {
177177 DRV_PTR(mixer_driver, CONFIG_DRM_EXYNOS_MIXER),
178178 DRM_COMPONENT_DRIVER
179− }, {
180− DRV_PTR(mic_driver, CONFIG_DRM_EXYNOS_MIC),
181− DRM_COMPONENT_DRIVER
182179 }, {
183180 DRV_PTR(dp_driver, CONFIG_DRM_EXYNOS_DP),
184181 DRM_COMPONENT_DRIVER
185182 }, {
186183 DRV_PTR(dsi_driver, CONFIG_DRM_EXYNOS_DSI),
187184 DRM_COMPONENT_DRIVER
185+ }, {
186+ DRV_PTR(mic_driver, CONFIG_DRM_EXYNOS_MIC),
187+ DRM_COMPONENT_DRIVER
188188 }, {
189189 DRV_PTR(hdmi_driver, CONFIG_DRM_EXYNOS_HDMI),
190190 DRM_COMPONENT_DRIVER
drivers/gpu/drm/exynos/exynos_drm_mic.c+12−30
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 #include <drm/drm_print.h>
2727
2828 #include "exynos_drm_drv.h"
29+#include "exynos_drm_crtc.h"
2930
3031 /* Sysreg registers for MIC */
3132 #define DSD_CFG_MUX 0x1004
@@ -100,9 +101,7 @@ struct exynos_mic { · 68 unmodified lines
100101
101102 bool i80_mode;
102103 struct videomode vm;
103− struct drm_encoder *encoder;
104104 struct drm_bridge bridge;
105− struct drm_bridge *next_bridge;
106105
107106 bool enabled;
108107 };
@@ -229,8 +228,6 @@ static void mic_set_reg_on(struct exynos_mic *mic, bool enable) · 120 unmodified lines
229228 writel(reg, mic->reg + MIC_OP);
230229 }
231230
232−static void mic_disable(struct drm_bridge *bridge) { }
233−
234231 static void mic_post_disable(struct drm_bridge *bridge)
235232 {
236233 struct exynos_mic *mic = bridge->driver_private;
@@ -297,34 +294,30 @@ unlock: · 60 unmodified lines
297294 mutex_unlock(&mic_mutex);
298295 }
299296
300−static void mic_enable(struct drm_bridge *bridge) { }
301−
302−static int mic_attach(struct drm_bridge *bridge,
303− enum drm_bridge_attach_flags flags)
304−{
305− struct exynos_mic *mic = bridge->driver_private;
306−
307− return drm_bridge_attach(bridge->encoder, mic->next_bridge,
308− &mic->bridge, flags);
309−}
310−
311297 static const struct drm_bridge_funcs mic_bridge_funcs = {
312− .disable = mic_disable,
313298 .post_disable = mic_post_disable,
314299 .mode_set = mic_mode_set,
315300 .pre_enable = mic_pre_enable,
316− .enable = mic_enable,
317− .attach = mic_attach,
318301 };
319302
320303 static int exynos_mic_bind(struct device *dev, struct device *master,
321304 void *data)
322305 {
323306 struct exynos_mic *mic = dev_get_drvdata(dev);
307+ struct drm_device *drm_dev = data;
308+ struct exynos_drm_crtc *crtc = exynos_drm_crtc_get_by_type(drm_dev,
309+ EXYNOS_DISPLAY_TYPE_LCD);
310+ struct drm_encoder *e, *encoder = NULL;
311+
312+ drm_for_each_encoder(e, drm_dev)
313+ if (e->possible_crtcs == drm_crtc_mask(&crtc->base))
314+ encoder = e;
315+ if (!encoder)
316+ return -ENODEV;
324317
325318 mic->bridge.driver_private = mic;
326319
327− return 0;
320+ return drm_bridge_attach(encoder, &mic->bridge, NULL, 0);
328321 }
329322
330323 static void exynos_mic_unbind(struct device *dev, struct device *master,
@@ -388,7 +381,6 @@ static int exynos_mic_probe(struct platform_device *pdev) · 57 unmodified lines
388381 {
389382 struct device *dev = &pdev->dev;
390383 struct exynos_mic *mic;
391− struct device_node *remote;
392384 struct resource res;
393385 int ret, i;
394386
@@ -432,16 +424,6 @@ static int exynos_mic_probe(struct platform_device *pdev) · 37 unmodified lines
432424 }
433425 }
434426
435− remote = of_graph_get_remote_node(dev->of_node, 1, 0);
436− mic->next_bridge = of_drm_find_bridge(remote);
437− if (IS_ERR(mic->next_bridge)) {
438− DRM_DEV_ERROR(dev, "mic: Failed to find next bridge\n");
439− ret = PTR_ERR(mic->next_bridge);
440− goto err;
441− }
442−
443− of_node_put(remote);
444−
445427 platform_set_drvdata(pdev, mic);
446428
447429 mic->bridge.funcs = &mic_bridge_funcs;
drivers/gpu/drm/i915/display/intel_dp.c+29−3
@@ -388,13 +388,23 @@ static int dg2_max_source_rate(struct intel_dp *intel_dp) · 387 unmodified lines
388388 return intel_dp_is_edp(intel_dp) ? 810000 : 1350000;
389389 }
390390
391+static bool is_low_voltage_sku(struct drm_i915_private *i915, enum phy phy)
392+{
393+ u32 voltage;
394+
395+ voltage = intel_de_read(i915, ICL_PORT_COMP_DW3(phy)) & VOLTAGE_INFO_MASK;
396+
397+ return voltage == VOLTAGE_INFO_0_85V;
398+}
399+
391400 static int icl_max_source_rate(struct intel_dp *intel_dp)
392401 {
393402 struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
394403 struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
395404 enum phy phy = intel_port_to_phy(dev_priv, dig_port->base.port);
396405
397− if (intel_phy_is_combo(dev_priv, phy) && !intel_dp_is_edp(intel_dp))
406+ if (intel_phy_is_combo(dev_priv, phy) &&
407+ (is_low_voltage_sku(dev_priv, phy) || !intel_dp_is_edp(intel_dp)))
398408 return 540000;
399409
400410 return 810000;
@@ -402,7 +412,23 @@ static int icl_max_source_rate(struct intel_dp *intel_dp) · 1 unmodified line
402412
403413 static int ehl_max_source_rate(struct intel_dp *intel_dp)
404414 {
405− if (intel_dp_is_edp(intel_dp))
415+ struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
416+ struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
417+ enum phy phy = intel_port_to_phy(dev_priv, dig_port->base.port);
418+
419+ if (intel_dp_is_edp(intel_dp) || is_low_voltage_sku(dev_priv, phy))
420+ return 540000;
421+
422+ return 810000;
423+}
424+
425+static int dg1_max_source_rate(struct intel_dp *intel_dp)
426+{
427+ struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
428+ struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
429+ enum phy phy = intel_port_to_phy(i915, dig_port->base.port);
430+
431+ if (intel_phy_is_combo(i915, phy) && is_low_voltage_sku(i915, phy))
406432 return 540000;
407433
408434 return 810000;
@@ -445,7 +471,7 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp) · 36 unmodified lines
445471 max_rate = dg2_max_source_rate(intel_dp);
446472 else if (IS_ALDERLAKE_P(dev_priv) || IS_ALDERLAKE_S(dev_priv) ||
447473 IS_DG1(dev_priv) || IS_ROCKETLAKE(dev_priv))
448− max_rate = 810000;
474+ max_rate = dg1_max_source_rate(intel_dp);
449475 else if (IS_JSL_EHL(dev_priv))
450476 max_rate = ehl_max_source_rate(intel_dp);
451477 else
drivers/gpu/drm/i915/display/intel_dpll_mgr.c+2−2
@@ -2396,7 +2396,7 @@ static void icl_wrpll_params_populate(struct skl_wrpll_params *params, · 2395 unmodified lines
23962396 }
23972397
23982398 /*
2399− * Display WA #22010492432: ehl, tgl, adl-p
2399+ * Display WA #22010492432: ehl, tgl, adl-s, adl-p
24002400 * Program half of the nominal DCO divider fraction value.
24012401 */
24022402 static bool
@@ -2404,7 +2404,7 @@ ehl_combo_pll_div_frac_wa_needed(struct drm_i915_private *i915) · 1 unmodified line
24042404 {
24052405 return ((IS_PLATFORM(i915, INTEL_ELKHARTLAKE) &&
24062406 IS_JSL_EHL_DISPLAY_STEP(i915, STEP_B0, STEP_FOREVER)) ||
2407− IS_TIGERLAKE(i915) || IS_ALDERLAKE_P(i915)) &&
2407+ IS_TIGERLAKE(i915) || IS_ALDERLAKE_S(i915) || IS_ALDERLAKE_P(i915)) &&
24082408 i915->dpll.ref_clks.nssc == 38400;
24092409 }
24102410
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c+2−1
@@ -999,7 +999,8 @@ static int eb_validate_vmas(struct i915_execbuffer *eb) · 998 unmodified lines
999999 }
10001000 }
10011001
1002− err = dma_resv_reserve_fences(vma->obj->base.resv, 1);
1002+ /* Reserve enough slots to accommodate composite fences */
1003+ err = dma_resv_reserve_fences(vma->obj->base.resv, eb->num_batches);
10031004 if (err)
10041005 return err;
10051006
drivers/gpu/drm/i915/gt/intel_gt.c+1−0
@@ -785,6 +785,7 @@ void intel_gt_driver_unregister(struct intel_gt *gt) · 784 unmodified lines
785785 {
786786 intel_wakeref_t wakeref;
787787
788+ intel_gt_sysfs_unregister(gt);
788789 intel_rps_driver_unregister(&gt->rps);
789790 intel_gsc_fini(&gt->gsc);
790791
drivers/gpu/drm/i915/gt/intel_gt_sysfs.c+12−17
@@ -24,7 +24,7 @@ bool is_object_gt(struct kobject *kobj) · 23 unmodified lines
2424
2525 static struct intel_gt *kobj_to_gt(struct kobject *kobj)
2626 {
27− return container_of(kobj, struct kobj_gt, base)->gt;
27+ return container_of(kobj, struct intel_gt, sysfs_gt);
2828 }
2929
3030 struct intel_gt *intel_gt_sysfs_get_drvdata(struct device *dev,
@@ -72,9 +72,9 @@ static struct attribute *id_attrs[] = { · 41 unmodified lines
7272 };
7373 ATTRIBUTE_GROUPS(id);
7474
75+/* A kobject needs a release() method even if it does nothing */
7576 static void kobj_gt_release(struct kobject *kobj)
7677 {
77− kfree(kobj);
7878 }
7979
8080 static struct kobj_type kobj_gt_type = {
@@ -85,8 +85,6 @@ static struct kobj_type kobj_gt_type = { · 4 unmodified lines
8585
8686 void intel_gt_sysfs_register(struct intel_gt *gt)
8787 {
88− struct kobj_gt *kg;
89−
9088 /*
9189 * We need to make things right with the
9290 * ABI compatibility. The files were originally
@@ -98,25 +96,22 @@ void intel_gt_sysfs_register(struct intel_gt *gt) · 5 unmodified lines
9896 if (gt_is_root(gt))
9997 intel_gt_sysfs_pm_init(gt, gt_get_parent_obj(gt));
10098
101− kg = kzalloc(sizeof(*kg), GFP_KERNEL);
102− if (!kg)
99+ /* init and xfer ownership to sysfs tree */
100+ if (kobject_init_and_add(&gt->sysfs_gt, &kobj_gt_type,
101+ gt->i915->sysfs_gt, "gt%d", gt->info.id))
103102 goto exit_fail;
104103
105− kobject_init(&kg->base, &kobj_gt_type);
106− kg->gt = gt;
107−
108− /* xfer ownership to sysfs tree */
109− if (kobject_add(&kg->base, gt->i915->sysfs_gt, "gt%d", gt->info.id))
110− goto exit_kobj_put;
111−
112− intel_gt_sysfs_pm_init(gt, &kg->base);
104+ intel_gt_sysfs_pm_init(gt, &gt->sysfs_gt);
113105
114106 return;
115107
116−exit_kobj_put:
117− kobject_put(&kg->base);
118−
119108 exit_fail:
109+ kobject_put(&gt->sysfs_gt);
120110 drm_warn(&gt->i915->drm,
121111 "failed to initialize gt%d sysfs root\n", gt->info.id);
122112 }
113+
114+void intel_gt_sysfs_unregister(struct intel_gt *gt)
115+{
116+ kobject_put(&gt->sysfs_gt);
117+}
drivers/gpu/drm/i915/gt/intel_gt_sysfs.h+1−5
@@ -13,11 +13,6 @@ · 12 unmodified lines
1313
1414 struct intel_gt;
1515
16−struct kobj_gt {
17− struct kobject base;
18− struct intel_gt *gt;
19−};
20−
2116 bool is_object_gt(struct kobject *kobj);
2217
2318 struct drm_i915_private *kobj_to_i915(struct kobject *kobj);
@@ -28,6 +23,7 @@ intel_gt_create_kobj(struct intel_gt *gt, · 4 unmodified lines
2823 const char *name);
2924
3025 void intel_gt_sysfs_register(struct intel_gt *gt);
26+void intel_gt_sysfs_unregister(struct intel_gt *gt);
3127 struct intel_gt *intel_gt_sysfs_get_drvdata(struct device *dev,
3228 const char *name);
3329
drivers/gpu/drm/i915/gt/intel_gt_types.h+3−0
@@ -224,6 +224,9 @@ struct intel_gt { · 223 unmodified lines
224224 } mocs;
225225
226226 struct intel_pxp pxp;
227+
228+ /* gt/gtN sysfs */
229+ struct kobject sysfs_gt;
227230 };
228231
229232 enum intel_gt_scratch_field {
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c+1−1
@@ -156,7 +156,7 @@ __uc_fw_auto_select(struct drm_i915_private *i915, struct intel_uc_fw *uc_fw) · 155 unmodified lines
156156 [INTEL_UC_FW_TYPE_GUC] = { blobs_guc, ARRAY_SIZE(blobs_guc) },
157157 [INTEL_UC_FW_TYPE_HUC] = { blobs_huc, ARRAY_SIZE(blobs_huc) },
158158 };
159− static const struct uc_fw_platform_requirement *fw_blobs;
159+ const struct uc_fw_platform_requirement *fw_blobs;
160160 enum intel_platform p = INTEL_INFO(i915)->platform;
161161 u32 fw_count;
162162 u8 rev = INTEL_REVID(i915);
drivers/gpu/drm/i915/i915_drm_client.c+3−2
@@ -116,8 +116,9 @@ show_client_class(struct seq_file *m, · 115 unmodified lines
116116 total += busy_add(ctx, class);
117117 rcu_read_unlock();
118118
119− seq_printf(m, "drm-engine-%s:\t%llu ns\n",
120− uabi_class_names[class], total);
119+ if (capacity)
120+ seq_printf(m, "drm-engine-%s:\t%llu ns\n",
121+ uabi_class_names[class], total);
121122
122123 if (capacity > 1)
123124 seq_printf(m, "drm-engine-capacity-%s:\t%u\n",
drivers/gpu/drm/i915/i915_sysfs.c+14−3
@@ -166,7 +166,14 @@ static ssize_t error_state_read(struct file *filp, struct kobject *kobj, · 165 unmodified lines
166166 struct device *kdev = kobj_to_dev(kobj);
167167 struct drm_i915_private *i915 = kdev_minor_to_i915(kdev);
168168 struct i915_gpu_coredump *gpu;
169− ssize_t ret;
169+ ssize_t ret = 0;
170+
171+ /*
172+ * FIXME: Concurrent clients triggering resets and reading + clearing
173+ * dumps can cause inconsistent sysfs reads when a user calls in with a
174+ * non-zero offset to complete a prior partial read but the
175+ * gpu_coredump has been cleared or replaced.
176+ */
170177
171178 gpu = i915_first_error_state(i915);
172179 if (IS_ERR(gpu)) {
@@ -178,8 +185,10 @@ static ssize_t error_state_read(struct file *filp, struct kobject *kobj, · 5 unmodified lines
178185 const char *str = "No error state collected\n";
179186 size_t len = strlen(str);
180187
181− ret = min_t(size_t, count, len - off);
182− memcpy(buf, str + off, ret);
188+ if (off < len) {
189+ ret = min_t(size_t, count, len - off);
190+ memcpy(buf, str + off, ret);
191+ }
183192 }
184193
185194 return ret;
@@ -259,4 +268,6 @@ void i915_teardown_sysfs(struct drm_i915_private *dev_priv) · 73 unmodified lines
259268
260269 device_remove_bin_file(kdev, &dpf_attrs_1);
261270 device_remove_bin_file(kdev, &dpf_attrs);
271+
272+ kobject_put(dev_priv->sysfs_gt);
262273 }
drivers/gpu/drm/i915/i915_vma.c+28−20
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323 */
2424
2525 #include <linux/sched/mm.h>
26+#include <linux/dma-fence-array.h>
2627 #include <drm/drm_gem.h>
2728
2829 #include "display/intel_frontbuffer.h"
@@ -1823,6 +1824,21 @@ int _i915_vma_move_to_active(struct i915_vma *vma, · 1794 unmodified lines
18231824 if (unlikely(err))
18241825 return err;
18251826
1827+ /*
1828+ * Reserve fences slot early to prevent an allocation after preparing
1829+ * the workload and associating fences with dma_resv.
1830+ */
1831+ if (fence && !(flags & __EXEC_OBJECT_NO_RESERVE)) {
1832+ struct dma_fence *curr;
1833+ int idx;
1834+
1835+ dma_fence_array_for_each(curr, idx, fence)
1836+ ;
1837+ err = dma_resv_reserve_fences(vma->obj->base.resv, idx);
1838+ if (unlikely(err))
1839+ return err;
1840+ }
1841+
18261842 if (flags & EXEC_OBJECT_WRITE) {
18271843 struct intel_frontbuffer *front;
18281844
@@ -1832,31 +1848,23 @@ int _i915_vma_move_to_active(struct i915_vma *vma, · 3 unmodified lines
18321848 i915_active_add_request(&front->write, rq);
18331849 intel_frontbuffer_put(front);
18341850 }
1851+ }
18351852
1836− if (!(flags & __EXEC_OBJECT_NO_RESERVE)) {
1837− err = dma_resv_reserve_fences(vma->obj->base.resv, 1);
1838− if (unlikely(err))
1839− return err;
1840− }
1853+ if (fence) {
1854+ struct dma_fence *curr;
1855+ enum dma_resv_usage usage;
1856+ int idx;
18411857
1842− if (fence) {
1843− dma_resv_add_fence(vma->obj->base.resv, fence,
1844− DMA_RESV_USAGE_WRITE);
1858+ obj->read_domains = 0;
1859+ if (flags & EXEC_OBJECT_WRITE) {
1860+ usage = DMA_RESV_USAGE_WRITE;
18451861 obj->write_domain = I915_GEM_DOMAIN_RENDER;
1846− obj->read_domains = 0;
1847− }
1848− } else {
1849− if (!(flags & __EXEC_OBJECT_NO_RESERVE)) {
1850− err = dma_resv_reserve_fences(vma->obj->base.resv, 1);
1851− if (unlikely(err))
1852− return err;
1862+ } else {
1863+ usage = DMA_RESV_USAGE_READ;
18531864 }
18541865
1855− if (fence) {
1856− dma_resv_add_fence(vma->obj->base.resv, fence,
1857− DMA_RESV_USAGE_READ);
1858− obj->write_domain = 0;
1859− }
1866+ dma_fence_array_for_each(curr, idx, fence)
1867+ dma_resv_add_fence(vma->obj->base.resv, curr, usage);
18601868 }
18611869
18621870 if (flags & EXEC_OBJECT_NEEDS_FENCE && vma->fence)
drivers/gpu/drm/msm/adreno/adreno_gpu.c+10−4
@@ -498,10 +498,15 @@ int adreno_hw_init(struct msm_gpu *gpu) · 497 unmodified lines
498498
499499 ring->cur = ring->start;
500500 ring->next = ring->start;
501−
502− /* reset completed fence seqno: */
503− ring->memptrs->fence = ring->fctx->completed_fence;
504501 ring->memptrs->rptr = 0;
502+
503+ /* Detect and clean up an impossible fence, ie. if GPU managed
504+ * to scribble something invalid, we don't want that to confuse
505+ * us into mistakingly believing that submits have completed.
506+ */
507+ if (fence_before(ring->fctx->last_fence, ring->memptrs->fence)) {
508+ ring->memptrs->fence = ring->fctx->last_fence;
509+ }
505510 }
506511
507512 return 0;
@@ -1057,7 +1062,8 @@ void adreno_gpu_cleanup(struct adreno_gpu *adreno_gpu) · 549 unmodified lines
10571062 for (i = 0; i < ARRAY_SIZE(adreno_gpu->info->fw); i++)
10581063 release_firmware(adreno_gpu->fw[i]);
10591064
1060− pm_runtime_disable(&priv->gpu_pdev->dev);
1065+ if (pm_runtime_enabled(&priv->gpu_pdev->dev))
1066+ pm_runtime_disable(&priv->gpu_pdev->dev);
10611067
10621068 msm_gpu_cleanup(&adreno_gpu->base);
10631069 }
drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c+8−1
@@ -11,7 +11,14 @@ static int dpu_wb_conn_get_modes(struct drm_connector *connector) · 10 unmodified lines
1111 struct msm_drm_private *priv = dev->dev_private;
1212 struct dpu_kms *dpu_kms = to_dpu_kms(priv->kms);
1313
14− return drm_add_modes_noedid(connector, dpu_kms->catalog->caps->max_linewidth,
14+ /*
15+ * We should ideally be limiting the modes only to the maxlinewidth but
16+ * on some chipsets this will allow even 4k modes to be added which will
17+ * fail the per SSPP bandwidth checks. So, till we have dual-SSPP support
18+ * and source split support added lets limit the modes based on max_mixer_width
19+ * as 4K modes can then be supported.
20+ */
21+ return drm_add_modes_noedid(connector, dpu_kms->catalog->caps->max_mixer_width,
1522 dev->mode_config.max_height);
1623 }
1724
drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c+2−0
@@ -216,6 +216,7 @@ static int mdp4_modeset_init_intf(struct mdp4_kms *mdp4_kms, · 215 unmodified lines
216216 encoder = mdp4_lcdc_encoder_init(dev, panel_node);
217217 if (IS_ERR(encoder)) {
218218 DRM_DEV_ERROR(dev->dev, "failed to construct LCDC encoder\n");
219+ of_node_put(panel_node);
219220 return PTR_ERR(encoder);
220221 }
221222
@@ -225,6 +226,7 @@ static int mdp4_modeset_init_intf(struct mdp4_kms *mdp4_kms, · 3 unmodified lines
225226 connector = mdp4_lvds_connector_init(dev, panel_node, encoder);
226227 if (IS_ERR(connector)) {
227228 DRM_DEV_ERROR(dev->dev, "failed to initialize LVDS connector\n");
229+ of_node_put(panel_node);
228230 return PTR_ERR(connector);
229231 }
230232
drivers/gpu/drm/msm/dp/dp_ctrl.c+25−8
@@ -1534,6 +1534,8 @@ end: · 1533 unmodified lines
15341534 return ret;
15351535 }
15361536
1537+static int dp_ctrl_on_stream_phy_test_report(struct dp_ctrl *dp_ctrl);
1538+
15371539 static int dp_ctrl_process_phy_test_request(struct dp_ctrl_private *ctrl)
15381540 {
15391541 int ret = 0;
@@ -1557,7 +1559,7 @@ static int dp_ctrl_process_phy_test_request(struct dp_ctrl_private *ctrl) · 17 unmodified lines
15571559
15581560 ret = dp_ctrl_on_link(&ctrl->dp_ctrl);
15591561 if (!ret)
1560− ret = dp_ctrl_on_stream(&ctrl->dp_ctrl);
1562+ ret = dp_ctrl_on_stream_phy_test_report(&ctrl->dp_ctrl);
15611563 else
15621564 DRM_ERROR("failed to enable DP link controller\n");
15631565
@@ -1813,7 +1815,27 @@ static int dp_ctrl_link_retrain(struct dp_ctrl_private *ctrl) · 249 unmodified lines
18131815 return dp_ctrl_setup_main_link(ctrl, &training_step);
18141816 }
18151817
1816−int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl)
1818+static int dp_ctrl_on_stream_phy_test_report(struct dp_ctrl *dp_ctrl)
1819+{
1820+ int ret;
1821+ struct dp_ctrl_private *ctrl;
1822+
1823+ ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl);
1824+
1825+ ctrl->dp_ctrl.pixel_rate = ctrl->panel->dp_mode.drm_mode.clock;
1826+
1827+ ret = dp_ctrl_enable_stream_clocks(ctrl);
1828+ if (ret) {
1829+ DRM_ERROR("Failed to start pixel clocks. ret=%d\n", ret);
1830+ return ret;
1831+ }
1832+
1833+ dp_ctrl_send_phy_test_pattern(ctrl);
1834+
1835+ return 0;
1836+}
1837+
1838+int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl, bool force_link_train)
18171839 {
18181840 int ret = 0;
18191841 bool mainlink_ready = false;
@@ -1849,12 +1871,7 @@ int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl) · 29 unmodified lines
18491871 goto end;
18501872 }
18511873
1852− if (ctrl->link->sink_request & DP_TEST_LINK_PHY_TEST_PATTERN) {
1853− dp_ctrl_send_phy_test_pattern(ctrl);
1854− return 0;
1855− }
1856−
1857− if (!dp_ctrl_channel_eq_ok(ctrl))
1874+ if (force_link_train || !dp_ctrl_channel_eq_ok(ctrl))
18581875 dp_ctrl_link_retrain(ctrl);
18591876
18601877 /* stop txing train pattern to end link training */
drivers/gpu/drm/msm/dp/dp_ctrl.h+1−1
@@ -21,7 +21,7 @@ struct dp_ctrl { · 20 unmodified lines
2121 };
2222
2323 int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl);
24−int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl);
24+int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl, bool force_link_train);
2525 int dp_ctrl_off_link_stream(struct dp_ctrl *dp_ctrl);
2626 int dp_ctrl_off_link(struct dp_ctrl *dp_ctrl);
2727 int dp_ctrl_off(struct dp_ctrl *dp_ctrl);
drivers/gpu/drm/msm/dp/dp_display.c+8−8
@@ -309,7 +309,8 @@ static void dp_display_unbind(struct device *dev, struct device *master, · 308 unmodified lines
309309 struct msm_drm_private *priv = dev_get_drvdata(master);
310310
311311 /* disable all HPD interrupts */
312− dp_catalog_hpd_config_intr(dp->catalog, DP_DP_HPD_INT_MASK, false);
312+ if (dp->core_initialized)
313+ dp_catalog_hpd_config_intr(dp->catalog, DP_DP_HPD_INT_MASK, false);
313314
314315 kthread_stop(dp->ev_tsk);
315316
@@ -872,7 +873,7 @@ static int dp_display_enable(struct dp_display_private *dp, u32 data) · 556 unmodified lines
872873 return 0;
873874 }
874875
875− rc = dp_ctrl_on_stream(dp->ctrl);
876+ rc = dp_ctrl_on_stream(dp->ctrl, data);
876877 if (!rc)
877878 dp_display->power_on = true;
878879
@@ -1659,6 +1660,7 @@ void dp_bridge_enable(struct drm_bridge *drm_bridge) · 780 unmodified lines
16591660 int rc = 0;
16601661 struct dp_display_private *dp_display;
16611662 u32 state;
1663+ bool force_link_train = false;
16621664
16631665 dp_display = container_of(dp, struct dp_display_private, dp_display);
16641666 if (!dp_display->dp_mode.drm_mode.clock) {
@@ -1693,10 +1695,12 @@ void dp_bridge_enable(struct drm_bridge *drm_bridge) · 28 unmodified lines
16931695
16941696 state = dp_display->hpd_state;
16951697
1696− if (state == ST_DISPLAY_OFF)
1698+ if (state == ST_DISPLAY_OFF) {
16971699 dp_display_host_phy_init(dp_display);
1700+ force_link_train = true;
1701+ }
16981702
1699− dp_display_enable(dp_display, 0);
1703+ dp_display_enable(dp_display, force_link_train);
17001704
17011705 rc = dp_display_post_enable(dp);
17021706 if (rc) {
@@ -1705,10 +1709,6 @@ void dp_bridge_enable(struct drm_bridge *drm_bridge) · 2 unmodified lines
17051709 dp_display_unprepare(dp);
17061710 }
17071711
1708− /* manual kick off plug event to train link */
1709− if (state == ST_DISPLAY_OFF)
1710− dp_add_event(dp_display, EV_IRQ_HPD_INT, 0, 0);
1711−
17121712 /* completed connection */
17131713 dp_display->hpd_state = ST_CONNECTED;
17141714
drivers/gpu/drm/msm/msm_drv.c+1−1
@@ -964,7 +964,7 @@ static const struct drm_driver msm_driver = { · 963 unmodified lines
964964 .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
965965 .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
966966 .gem_prime_import_sg_table = msm_gem_prime_import_sg_table,
967− .gem_prime_mmap = drm_gem_prime_mmap,
967+ .gem_prime_mmap = msm_gem_prime_mmap,
968968 #ifdef CONFIG_DEBUG_FS
969969 .debugfs_init = msm_debugfs_init,
970970 #endif
drivers/gpu/drm/msm/msm_drv.h+1−0
@@ -246,6 +246,7 @@ unsigned long msm_gem_shrinker_shrink(struct drm_device *dev, unsigned long nr_t · 245 unmodified lines
246246 void msm_gem_shrinker_init(struct drm_device *dev);
247247 void msm_gem_shrinker_cleanup(struct drm_device *dev);
248248
249+int msm_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma);
249250 struct sg_table *msm_gem_prime_get_sg_table(struct drm_gem_object *obj);
250251 int msm_gem_prime_vmap(struct drm_gem_object *obj, struct iosys_map *map);
251252 void msm_gem_prime_vunmap(struct drm_gem_object *obj, struct iosys_map *map);
drivers/gpu/drm/msm/msm_fence.c+5−3
@@ -46,12 +46,14 @@ bool msm_fence_completed(struct msm_fence_context *fctx, uint32_t fence) · 45 unmodified lines
4646 (int32_t)(*fctx->fenceptr - fence) >= 0;
4747 }
4848
49−/* called from workqueue */
49+/* called from irq handler and workqueue (in recover path) */
5050 void msm_update_fence(struct msm_fence_context *fctx, uint32_t fence)
5151 {
52− spin_lock(&fctx->spinlock);
52+ unsigned long flags;
53+
54+ spin_lock_irqsave(&fctx->spinlock, flags);
5355 fctx->completed_fence = max(fence, fctx->completed_fence);
54− spin_unlock(&fctx->spinlock);
56+ spin_unlock_irqrestore(&fctx->spinlock, flags);
5557 }
5658
5759 struct msm_fence {
drivers/gpu/drm/msm/msm_gem.c+3−4
@@ -439,14 +439,12 @@ int msm_gem_pin_vma_locked(struct drm_gem_object *obj, struct msm_gem_vma *vma) · 438 unmodified lines
439439 return ret;
440440 }
441441
442−void msm_gem_unpin_vma_locked(struct drm_gem_object *obj, struct msm_gem_vma *vma)
442+void msm_gem_unpin_locked(struct drm_gem_object *obj)
443443 {
444444 struct msm_gem_object *msm_obj = to_msm_bo(obj);
445445
446446 GEM_WARN_ON(!msm_gem_is_locked(obj));
447447
448− msm_gem_unpin_vma(vma);
449−
450448 msm_obj->pin_count--;
451449 GEM_WARN_ON(msm_obj->pin_count < 0);
452450
@@ -586,7 +584,8 @@ void msm_gem_unpin_iova(struct drm_gem_object *obj, · 133 unmodified lines
586584 msm_gem_lock(obj);
587585 vma = lookup_vma(obj, aspace);
588586 if (!GEM_WARN_ON(!vma)) {
589− msm_gem_unpin_vma_locked(obj, vma);
587+ msm_gem_unpin_vma(vma);
588+ msm_gem_unpin_locked(obj);
590589 }
591590 msm_gem_unlock(obj);
592591 }
drivers/gpu/drm/msm/msm_gem.h+6−5
@@ -145,7 +145,7 @@ struct msm_gem_object { · 144 unmodified lines
145145
146146 uint64_t msm_gem_mmap_offset(struct drm_gem_object *obj);
147147 int msm_gem_pin_vma_locked(struct drm_gem_object *obj, struct msm_gem_vma *vma);
148−void msm_gem_unpin_vma_locked(struct drm_gem_object *obj, struct msm_gem_vma *vma);
148+void msm_gem_unpin_locked(struct drm_gem_object *obj);
149149 struct msm_gem_vma *msm_gem_get_vma_locked(struct drm_gem_object *obj,
150150 struct msm_gem_address_space *aspace);
151151 int msm_gem_get_iova(struct drm_gem_object *obj,
@@ -377,10 +377,11 @@ struct msm_gem_submit { · 225 unmodified lines
377377 } *cmd; /* array of size nr_cmds */
378378 struct {
379379 /* make sure these don't conflict w/ MSM_SUBMIT_BO_x */
380−#define BO_VALID 0x8000 /* is current addr in cmdstream correct/valid? */
381−#define BO_LOCKED 0x4000 /* obj lock is held */
382−#define BO_ACTIVE 0x2000 /* active refcnt is held */
383−#define BO_PINNED 0x1000 /* obj is pinned and on active list */
380+#define BO_VALID 0x8000 /* is current addr in cmdstream correct/valid? */
381+#define BO_LOCKED 0x4000 /* obj lock is held */
382+#define BO_ACTIVE 0x2000 /* active refcnt is held */
383+#define BO_OBJ_PINNED 0x1000 /* obj (pages) is pinned and on active list */
384+#define BO_VMA_PINNED 0x0800 /* vma (virtual address) is pinned */
384385 uint32_t flags;
385386 union {
386387 struct msm_gem_object *obj;
drivers/gpu/drm/msm/msm_gem_prime.c+15−0
@@ -11,6 +11,21 @@ · 10 unmodified lines
1111 #include "msm_drv.h"
1212 #include "msm_gem.h"
1313
14+int msm_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma)
15+{
16+ int ret;
17+
18+ /* Ensure the mmap offset is initialized. We lazily initialize it,
19+ * so if it has not been first mmap'd directly as a GEM object, the
20+ * mmap offset will not be already initialized.
21+ */
22+ ret = drm_gem_create_mmap_offset(obj);
23+ if (ret)
24+ return ret;
25+
26+ return drm_gem_prime_mmap(obj, vma);
27+}
28+
1429 struct sg_table *msm_gem_prime_get_sg_table(struct drm_gem_object *obj)
1530 {
1631 struct msm_gem_object *msm_obj = to_msm_bo(obj);
drivers/gpu/drm/msm/msm_gem_submit.c+12−6
@@ -232,8 +232,11 @@ static void submit_cleanup_bo(struct msm_gem_submit *submit, int i, · 231 unmodified lines
232232 */
233233 submit->bos[i].flags &= ~cleanup_flags;
234234
235− if (flags & BO_PINNED)
236− msm_gem_unpin_vma_locked(obj, submit->bos[i].vma);
235+ if (flags & BO_VMA_PINNED)
236+ msm_gem_unpin_vma(submit->bos[i].vma);
237+
238+ if (flags & BO_OBJ_PINNED)
239+ msm_gem_unpin_locked(obj);
237240
238241 if (flags & BO_ACTIVE)
239242 msm_gem_active_put(obj);
@@ -244,7 +247,9 @@ static void submit_cleanup_bo(struct msm_gem_submit *submit, int i, · 4 unmodified lines
244247
245248 static void submit_unlock_unpin_bo(struct msm_gem_submit *submit, int i)
246249 {
247− submit_cleanup_bo(submit, i, BO_PINNED | BO_ACTIVE | BO_LOCKED);
250+ unsigned cleanup_flags = BO_VMA_PINNED | BO_OBJ_PINNED |
251+ BO_ACTIVE | BO_LOCKED;
252+ submit_cleanup_bo(submit, i, cleanup_flags);
248253
249254 if (!(submit->bos[i].flags & BO_VALID))
250255 submit->bos[i].iova = 0;
@@ -375,7 +380,7 @@ static int submit_pin_objects(struct msm_gem_submit *submit) · 124 unmodified lines
375380 if (ret)
376381 break;
377382
378− submit->bos[i].flags |= BO_PINNED;
383+ submit->bos[i].flags |= BO_OBJ_PINNED | BO_VMA_PINNED;
379384 submit->bos[i].vma = vma;
380385
381386 if (vma->iova == submit->bos[i].iova) {
@@ -511,7 +516,7 @@ static void submit_cleanup(struct msm_gem_submit *submit, bool error) · 129 unmodified lines
511516 unsigned i;
512517
513518 if (error)
514− cleanup_flags |= BO_PINNED | BO_ACTIVE;
519+ cleanup_flags |= BO_VMA_PINNED | BO_OBJ_PINNED | BO_ACTIVE;
515520
516521 for (i = 0; i < submit->nr_bos; i++) {
517522 struct msm_gem_object *msm_obj = submit->bos[i].obj;
@@ -529,7 +534,8 @@ void msm_submit_retire(struct msm_gem_submit *submit) · 11 unmodified lines
529534 struct drm_gem_object *obj = &submit->bos[i].obj->base;
530535
531536 msm_gem_lock(obj);
532− submit_cleanup_bo(submit, i, BO_PINNED | BO_ACTIVE);
537+ /* Note, VMA already fence-unpinned before submit: */
538+ submit_cleanup_bo(submit, i, BO_OBJ_PINNED | BO_ACTIVE);
533539 msm_gem_unlock(obj);
534540 drm_gem_object_put(obj);
535541 }
drivers/gpu/drm/msm/msm_gem_vma.c+2−4
@@ -62,8 +62,7 @@ void msm_gem_purge_vma(struct msm_gem_address_space *aspace, · 61 unmodified lines
6262 unsigned size = vma->node.size;
6363
6464 /* Print a message if we try to purge a vma in use */
65− if (GEM_WARN_ON(msm_gem_vma_inuse(vma)))
66− return;
65+ GEM_WARN_ON(msm_gem_vma_inuse(vma));
6766
6867 /* Don't do anything if the memory isn't mapped */
6968 if (!vma->mapped)
@@ -128,8 +127,7 @@ msm_gem_map_vma(struct msm_gem_address_space *aspace, · 58 unmodified lines
128127 void msm_gem_close_vma(struct msm_gem_address_space *aspace,
129128 struct msm_gem_vma *vma)
130129 {
131− if (GEM_WARN_ON(msm_gem_vma_inuse(vma) || vma->mapped))
132− return;
130+ GEM_WARN_ON(msm_gem_vma_inuse(vma) || vma->mapped);
133131
134132 spin_lock(&aspace->lock);
135133 if (vma->iova)
drivers/gpu/drm/msm/msm_gpu.c+5−22
@@ -164,24 +164,6 @@ int msm_gpu_hw_init(struct msm_gpu *gpu) · 163 unmodified lines
164164 return ret;
165165 }
166166
167−static void update_fences(struct msm_gpu *gpu, struct msm_ringbuffer *ring,
168− uint32_t fence)
169−{
170− struct msm_gem_submit *submit;
171− unsigned long flags;
172−
173− spin_lock_irqsave(&ring->submit_lock, flags);
174− list_for_each_entry(submit, &ring->submits, node) {
175− if (fence_after(submit->seqno, fence))
176− break;
177−
178− msm_update_fence(submit->ring->fctx,
179− submit->hw_fence->seqno);
180− dma_fence_signal(submit->hw_fence);
181− }
182− spin_unlock_irqrestore(&ring->submit_lock, flags);
183−}
184−
185167 #ifdef CONFIG_DEV_COREDUMP
186168 static ssize_t msm_gpu_devcoredump_read(char *buffer, loff_t offset,
187169 size_t count, void *data, size_t datalen)
@@ -436,9 +418,9 @@ static void recover_worker(struct kthread_work *work) · 248 unmodified lines
436418 * one more to clear the faulting submit
437419 */
438420 if (ring == cur_ring)
439− fence++;
421+ ring->memptrs->fence = ++fence;
440422
441− update_fences(gpu, ring, fence);
423+ msm_update_fence(ring->fctx, fence);
442424 }
443425
444426 if (msm_gpu_active(gpu)) {
@@ -672,7 +654,6 @@ static void retire_submit(struct msm_gpu *gpu, struct msm_ringbuffer *ring, · 227 unmodified lines
672654 msm_submit_retire(submit);
673655
674656 pm_runtime_mark_last_busy(&gpu->pdev->dev);
675− pm_runtime_put_autosuspend(&gpu->pdev->dev);
676657
677658 spin_lock_irqsave(&ring->submit_lock, flags);
678659 list_del(&submit->node);
@@ -686,6 +667,8 @@ static void retire_submit(struct msm_gpu *gpu, struct msm_ringbuffer *ring, · 7 unmodified lines
686667 msm_devfreq_idle(gpu);
687668 mutex_unlock(&gpu->active_lock);
688669
670+ pm_runtime_put_autosuspend(&gpu->pdev->dev);
671+
689672 msm_gem_submit_put(submit);
690673 }
691674
@@ -735,7 +718,7 @@ void msm_gpu_retire(struct msm_gpu *gpu) · 43 unmodified lines
735718 int i;
736719
737720 for (i = 0; i < gpu->nr_rings; i++)
738− update_fences(gpu, gpu->rb[i], gpu->rb[i]->memptrs->fence);
721+ msm_update_fence(gpu->rb[i]->fctx, gpu->rb[i]->memptrs->fence);
739722
740723 kthread_queue_work(gpu->worker, &gpu->retire_work);
741724 update_sw_cntrs(gpu);
drivers/gpu/drm/msm/msm_iommu.c+1−1
@@ -58,7 +58,7 @@ static int msm_iommu_pagetable_map(struct msm_mmu *mmu, u64 iova, · 57 unmodified lines
5858 u64 addr = iova;
5959 unsigned int i;
6060
61− for_each_sg(sgt->sgl, sg, sgt->nents, i) {
61+ for_each_sgtable_sg(sgt, sg, i) {
6262 size_t size = sg->length;
6363 phys_addr_t phys = sg_phys(sg);
6464
drivers/gpu/drm/msm/msm_ringbuffer.c+1−1
@@ -25,7 +25,7 @@ static struct dma_fence *msm_job_run(struct drm_sched_job *job) · 24 unmodified lines
2525
2626 msm_gem_lock(obj);
2727 msm_gem_unpin_vma_fenced(submit->bos[i].vma, fctx);
28− submit->bos[i].flags &= ~BO_PINNED;
28+ submit->bos[i].flags &= ~BO_VMA_PINNED;
2929 msm_gem_unlock(obj);
3030 }
3131
drivers/gpu/drm/sun4i/sun4i_drv.c+11−1
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 */
88
99 #include <linux/component.h>
10+#include <linux/dma-mapping.h>
1011 #include <linux/kfifo.h>
1112 #include <linux/module.h>
1213 #include <linux/of_graph.h>
@@ -73,7 +74,6 @@ static int sun4i_drv_bind(struct device *dev) · 60 unmodified lines
7374 goto free_drm;
7475 }
7576
76− dev_set_drvdata(dev, drm);
7777 drm->dev_private = drv;
7878 INIT_LIST_HEAD(&drv->frontend_list);
7979 INIT_LIST_HEAD(&drv->engine_list);
@@ -114,6 +114,8 @@ static int sun4i_drv_bind(struct device *dev) · 34 unmodified lines
114114
115115 drm_fbdev_generic_setup(drm, 32);
116116
117+ dev_set_drvdata(dev, drm);
118+
117119 return 0;
118120
119121 finish_poll:
@@ -130,6 +132,7 @@ static void sun4i_drv_unbind(struct device *dev) · 10 unmodified lines
130132 {
131133 struct drm_device *drm = dev_get_drvdata(dev);
132134
135+ dev_set_drvdata(dev, NULL);
133136 drm_dev_unregister(drm);
134137 drm_kms_helper_poll_fini(drm);
135138 drm_atomic_helper_shutdown(drm);
@@ -367,6 +370,13 @@ static int sun4i_drv_probe(struct platform_device *pdev) · 231 unmodified lines
367370
368371 INIT_KFIFO(list.fifo);
369372
373+ /*
374+ * DE2 and DE3 cores actually supports 40-bit addresses, but
375+ * driver does not.
376+ */
377+ dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
378+ dma_set_max_seg_size(&pdev->dev, UINT_MAX);
379+
370380 for (i = 0;; i++) {
371381 struct device_node *pipeline = of_parse_phandle(np,
372382 "allwinner,pipelines",
drivers/gpu/drm/sun4i/sun4i_layer.c+1−1
@@ -117,7 +117,7 @@ static bool sun4i_layer_format_mod_supported(struct drm_plane *plane, · 116 unmodified lines
117117 struct sun4i_layer *layer = plane_to_sun4i_layer(plane);
118118
119119 if (IS_ERR_OR_NULL(layer->backend->frontend))
120− sun4i_backend_format_is_supported(format, modifier);
120+ return sun4i_backend_format_is_supported(format, modifier);
121121
122122 return sun4i_backend_format_is_supported(format, modifier) ||
123123 sun4i_frontend_format_is_supported(format, modifier);
drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c+4−50
@@ -93,34 +93,10 @@ crtcs_exit: · 92 unmodified lines
9393 return crtcs;
9494 }
9595
96−static int sun8i_dw_hdmi_find_connector_pdev(struct device *dev,
97− struct platform_device **pdev_out)
98−{
99− struct platform_device *pdev;
100− struct device_node *remote;
101−
102− remote = of_graph_get_remote_node(dev->of_node, 1, -1);
103− if (!remote)
104− return -ENODEV;
105−
106− if (!of_device_is_compatible(remote, "hdmi-connector")) {
107− of_node_put(remote);
108− return -ENODEV;
109− }
110−
111− pdev = of_find_device_by_node(remote);
112− of_node_put(remote);
113− if (!pdev)
114− return -ENODEV;
115−
116− *pdev_out = pdev;
117− return 0;
118−}
119−
12096 static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master,
12197 void *data)
12298 {
123− struct platform_device *pdev = to_platform_device(dev), *connector_pdev;
99+ struct platform_device *pdev = to_platform_device(dev);
124100 struct dw_hdmi_plat_data *plat_data;
125101 struct drm_device *drm = data;
126102 struct device_node *phy_node;
@@ -167,30 +143,16 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, · 40 unmodified lines
167143 return dev_err_probe(dev, PTR_ERR(hdmi->regulator),
168144 "Couldn't get regulator\n");
169145
170− ret = sun8i_dw_hdmi_find_connector_pdev(dev, &connector_pdev);
171− if (!ret) {
172− hdmi->ddc_en = gpiod_get_optional(&connector_pdev->dev,
173− "ddc-en", GPIOD_OUT_HIGH);
174− platform_device_put(connector_pdev);
175−
176− if (IS_ERR(hdmi->ddc_en)) {
177− dev_err(dev, "Couldn't get ddc-en gpio\n");
178− return PTR_ERR(hdmi->ddc_en);
179− }
180− }
181−
182146 ret = regulator_enable(hdmi->regulator);
183147 if (ret) {
184148 dev_err(dev, "Failed to enable regulator\n");
185− goto err_unref_ddc_en;
149+ return ret;
186150 }
187151
188− gpiod_set_value(hdmi->ddc_en, 1);
189−
190152 ret = reset_control_deassert(hdmi->rst_ctrl);
191153 if (ret) {
192154 dev_err(dev, "Could not deassert ctrl reset control\n");
193− goto err_disable_ddc_en;
155+ goto err_disable_regulator;
194156 }
195157
196158 ret = clk_prepare_enable(hdmi->clk_tmds);
@@ -245,12 +207,8 @@ err_disable_clk_tmds: · 48 unmodified lines
245207 clk_disable_unprepare(hdmi->clk_tmds);
246208 err_assert_ctrl_reset:
247209 reset_control_assert(hdmi->rst_ctrl);
248−err_disable_ddc_en:
249− gpiod_set_value(hdmi->ddc_en, 0);
210+err_disable_regulator:
250211 regulator_disable(hdmi->regulator);
251−err_unref_ddc_en:
252− if (hdmi->ddc_en)
253− gpiod_put(hdmi->ddc_en);
254212
255213 return ret;
256214 }
@@ -264,11 +222,7 @@ static void sun8i_dw_hdmi_unbind(struct device *dev, struct device *master, · 7 unmodified lines
264222 sun8i_hdmi_phy_deinit(hdmi->phy);
265223 clk_disable_unprepare(hdmi->clk_tmds);
266224 reset_control_assert(hdmi->rst_ctrl);
267− gpiod_set_value(hdmi->ddc_en, 0);
268225 regulator_disable(hdmi->regulator);
269−
270− if (hdmi->ddc_en)
271− gpiod_put(hdmi->ddc_en);
272226 }
273227
274228 static const struct component_ops sun8i_dw_hdmi_ops = {
drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h+0−2
@@ -9,7 +9,6 @@ · 8 unmodified lines
99 #include <drm/bridge/dw_hdmi.h>
1010 #include <drm/drm_encoder.h>
1111 #include <linux/clk.h>
12−#include <linux/gpio/consumer.h>
1312 #include <linux/regmap.h>
1413 #include <linux/regulator/consumer.h>
1514 #include <linux/reset.h>
@@ -193,7 +192,6 @@ struct sun8i_dw_hdmi { · 177 unmodified lines
193192 struct regulator *regulator;
194193 const struct sun8i_dw_hdmi_quirks *quirks;
195194 struct reset_control *rst_ctrl;
196− struct gpio_desc *ddc_en;
197195 };
198196
199197 extern struct platform_driver sun8i_hdmi_phy_driver;
drivers/gpu/drm/ttm/ttm_bo.c+14−8
@@ -109,11 +109,11 @@ void ttm_bo_set_bulk_move(struct ttm_buffer_object *bo, · 108 unmodified lines
109109 return;
110110
111111 spin_lock(&bo->bdev->lru_lock);
112− if (bo->bulk_move && bo->resource)
113− ttm_lru_bulk_move_del(bo->bulk_move, bo->resource);
112+ if (bo->resource)
113+ ttm_resource_del_bulk_move(bo->resource, bo);
114114 bo->bulk_move = bulk;
115− if (bo->bulk_move && bo->resource)
116− ttm_lru_bulk_move_add(bo->bulk_move, bo->resource);
115+ if (bo->resource)
116+ ttm_resource_add_bulk_move(bo->resource, bo);
117117 spin_unlock(&bo->bdev->lru_lock);
118118 }
119119 EXPORT_SYMBOL(ttm_bo_set_bulk_move);
@@ -689,8 +689,11 @@ void ttm_bo_pin(struct ttm_buffer_object *bo) · 569 unmodified lines
689689 {
690690 dma_resv_assert_held(bo->base.resv);
691691 WARN_ON_ONCE(!kref_read(&bo->kref));
692− if (!(bo->pin_count++) && bo->bulk_move && bo->resource)
693− ttm_lru_bulk_move_del(bo->bulk_move, bo->resource);
692+ spin_lock(&bo->bdev->lru_lock);
693+ if (bo->resource)
694+ ttm_resource_del_bulk_move(bo->resource, bo);
695+ ++bo->pin_count;
696+ spin_unlock(&bo->bdev->lru_lock);
694697 }
695698 EXPORT_SYMBOL(ttm_bo_pin);
696699
@@ -707,8 +710,11 @@ void ttm_bo_unpin(struct ttm_buffer_object *bo) · 10 unmodified lines
707710 if (WARN_ON_ONCE(!bo->pin_count))
708711 return;
709712
710− if (!(--bo->pin_count) && bo->bulk_move && bo->resource)
711− ttm_lru_bulk_move_add(bo->bulk_move, bo->resource);
713+ spin_lock(&bo->bdev->lru_lock);
714+ --bo->pin_count;
715+ if (bo->resource)
716+ ttm_resource_add_bulk_move(bo->resource, bo);
717+ spin_unlock(&bo->bdev->lru_lock);
712718 }
713719 EXPORT_SYMBOL(ttm_bo_unpin);
714720
drivers/gpu/drm/ttm/ttm_device.c+5−1
@@ -156,8 +156,12 @@ int ttm_device_swapout(struct ttm_device *bdev, struct ttm_operation_ctx *ctx, · 155 unmodified lines
156156
157157 ttm_resource_manager_for_each_res(man, &cursor, res) {
158158 struct ttm_buffer_object *bo = res->bo;
159− uint32_t num_pages = PFN_UP(bo->base.size);
159+ uint32_t num_pages;
160160
161+ if (!bo)
162+ continue;
163+
164+ num_pages = PFN_UP(bo->base.size);
161165 ret = ttm_bo_swapout(bo, ctx, gfp_flags);
162166 /* ttm_bo_swapout has dropped the lru_lock */
163167 if (!ret)
drivers/gpu/drm/ttm/ttm_resource.c+36−16
@@ -91,8 +91,8 @@ static void ttm_lru_bulk_move_pos_tail(struct ttm_lru_bulk_move_pos *pos, · 90 unmodified lines
9191 }
9292
9393 /* Add the resource to a bulk_move cursor */
94−void ttm_lru_bulk_move_add(struct ttm_lru_bulk_move *bulk,
95− struct ttm_resource *res)
94+static void ttm_lru_bulk_move_add(struct ttm_lru_bulk_move *bulk,
95+ struct ttm_resource *res)
9696 {
9797 struct ttm_lru_bulk_move_pos *pos = ttm_lru_bulk_move_pos(bulk, res);
9898
@@ -105,8 +105,8 @@ void ttm_lru_bulk_move_add(struct ttm_lru_bulk_move *bulk, · 6 unmodified lines
105105 }
106106
107107 /* Remove the resource from a bulk_move range */
108−void ttm_lru_bulk_move_del(struct ttm_lru_bulk_move *bulk,
109− struct ttm_resource *res)
108+static void ttm_lru_bulk_move_del(struct ttm_lru_bulk_move *bulk,
109+ struct ttm_resource *res)
110110 {
111111 struct ttm_lru_bulk_move_pos *pos = ttm_lru_bulk_move_pos(bulk, res);
112112
@@ -122,6 +122,22 @@ void ttm_lru_bulk_move_del(struct ttm_lru_bulk_move *bulk, · 9 unmodified lines
122122 }
123123 }
124124
125+/* Add the resource to a bulk move if the BO is configured for it */
126+void ttm_resource_add_bulk_move(struct ttm_resource *res,
127+ struct ttm_buffer_object *bo)
128+{
129+ if (bo->bulk_move && !bo->pin_count)
130+ ttm_lru_bulk_move_add(bo->bulk_move, res);
131+}
132+
133+/* Remove the resource from a bulk move if the BO is configured for it */
134+void ttm_resource_del_bulk_move(struct ttm_resource *res,
135+ struct ttm_buffer_object *bo)
136+{
137+ if (bo->bulk_move && !bo->pin_count)
138+ ttm_lru_bulk_move_del(bo->bulk_move, res);
139+}
140+
125141 /* Move a resource to the LRU or bulk tail */
126142 void ttm_resource_move_to_lru_tail(struct ttm_resource *res)
127143 {
@@ -169,15 +185,14 @@ void ttm_resource_init(struct ttm_buffer_object *bo, · 41 unmodified lines
169185 res->bus.is_iomem = false;
170186 res->bus.caching = ttm_cached;
171187 res->bo = bo;
172− INIT_LIST_HEAD(&res->lru);
173188
174189 man = ttm_manager_type(bo->bdev, place->mem_type);
175190 spin_lock(&bo->bdev->lru_lock);
176− man->usage += res->num_pages << PAGE_SHIFT;
177− if (bo->bulk_move)
178− ttm_lru_bulk_move_add(bo->bulk_move, res);
191+ if (bo->pin_count)
192+ list_add_tail(&res->lru, &bo->bdev->pinned);
179193 else
180− ttm_resource_move_to_lru_tail(res);
194+ list_add_tail(&res->lru, &man->lru[bo->priority]);
195+ man->usage += res->num_pages << PAGE_SHIFT;
181196 spin_unlock(&bo->bdev->lru_lock);
182197 }
183198 EXPORT_SYMBOL(ttm_resource_init);
@@ -210,8 +225,16 @@ int ttm_resource_alloc(struct ttm_buffer_object *bo, · 26 unmodified lines
210225 {
211226 struct ttm_resource_manager *man =
212227 ttm_manager_type(bo->bdev, place->mem_type);
228+ int ret;
229+
230+ ret = man->func->alloc(man, bo, place, res_ptr);
231+ if (ret)
232+ return ret;
213233
214− return man->func->alloc(man, bo, place, res_ptr);
234+ spin_lock(&bo->bdev->lru_lock);
235+ ttm_resource_add_bulk_move(*res_ptr, bo);
236+ spin_unlock(&bo->bdev->lru_lock);
237+ return 0;
215238 }
216239
217240 void ttm_resource_free(struct ttm_buffer_object *bo, struct ttm_resource **res)
@@ -221,12 +244,9 @@ void ttm_resource_free(struct ttm_buffer_object *bo, struct ttm_resource **res) · 3 unmodified lines
221244 if (!*res)
222245 return;
223246
224− if (bo->bulk_move) {
225− spin_lock(&bo->bdev->lru_lock);
226− ttm_lru_bulk_move_del(bo->bulk_move, *res);
227− spin_unlock(&bo->bdev->lru_lock);
228− }
229−
247+ spin_lock(&bo->bdev->lru_lock);
248+ ttm_resource_del_bulk_move(*res, bo);
249+ spin_unlock(&bo->bdev->lru_lock);
230250 man = ttm_manager_type(bo->bdev, (*res)->mem_type);
231251 man->func->free(man, *res);
232252 *res = NULL;
drivers/gpu/drm/vc4/vc4_bo.c+54−8
@@ -248,6 +248,9 @@ void vc4_bo_add_to_purgeable_pool(struct vc4_bo *bo) · 247 unmodified lines
248248 {
249249 struct vc4_dev *vc4 = to_vc4_dev(bo->base.base.dev);
250250
251+ if (WARN_ON_ONCE(vc4->is_vc5))
252+ return;
253+
251254 mutex_lock(&vc4->purgeable.lock);
252255 list_add_tail(&bo->size_head, &vc4->purgeable.list);
253256 vc4->purgeable.num++;
@@ -259,6 +262,9 @@ static void vc4_bo_remove_from_purgeable_pool_locked(struct vc4_bo *bo) · 5 unmodified lines
259262 {
260263 struct vc4_dev *vc4 = to_vc4_dev(bo->base.base.dev);
261264
265+ if (WARN_ON_ONCE(vc4->is_vc5))
266+ return;
267+
262268 /* list_del_init() is used here because the caller might release
263269 * the purgeable lock in order to acquire the madv one and update the
264270 * madv status.
@@ -387,6 +393,9 @@ struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size) · 122 unmodified lines
387393 struct vc4_dev *vc4 = to_vc4_dev(dev);
388394 struct vc4_bo *bo;
389395
396+ if (WARN_ON_ONCE(vc4->is_vc5))
397+ return ERR_PTR(-ENODEV);
398+
390399 bo = kzalloc(sizeof(*bo), GFP_KERNEL);
391400 if (!bo)
392401 return ERR_PTR(-ENOMEM);
@@ -413,6 +422,9 @@ struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size, · 20 unmodified lines
413422 struct drm_gem_cma_object *cma_obj;
414423 struct vc4_bo *bo;
415424
425+ if (WARN_ON_ONCE(vc4->is_vc5))
426+ return ERR_PTR(-ENODEV);
427+
416428 if (size == 0)
417429 return ERR_PTR(-EINVAL);
418430
@@ -471,19 +483,20 @@ struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size, · 52 unmodified lines
471483 return bo;
472484 }
473485
474−int vc4_dumb_create(struct drm_file *file_priv,
475− struct drm_device *dev,
476− struct drm_mode_create_dumb *args)
486+int vc4_bo_dumb_create(struct drm_file *file_priv,
487+ struct drm_device *dev,
488+ struct drm_mode_create_dumb *args)
477489 {
478− int min_pitch = DIV_ROUND_UP(args->width * args->bpp, 8);
490+ struct vc4_dev *vc4 = to_vc4_dev(dev);
479491 struct vc4_bo *bo = NULL;
480492 int ret;
481493
482− if (args->pitch < min_pitch)
483− args->pitch = min_pitch;
494+ if (WARN_ON_ONCE(vc4->is_vc5))
495+ return -ENODEV;
484496
485− if (args->size < args->pitch * args->height)
486− args->size = args->pitch * args->height;
497+ ret = vc4_dumb_fixup_args(args);
498+ if (ret)
499+ return ret;
487500
488501 bo = vc4_bo_create(dev, args->size, false, VC4_BO_TYPE_DUMB);
489502 if (IS_ERR(bo))
@@ -601,8 +614,12 @@ static void vc4_bo_cache_time_work(struct work_struct *work) · 111 unmodified lines
601614
602615 int vc4_bo_inc_usecnt(struct vc4_bo *bo)
603616 {
617+ struct vc4_dev *vc4 = to_vc4_dev(bo->base.base.dev);
604618 int ret;
605619
620+ if (WARN_ON_ONCE(vc4->is_vc5))
621+ return -ENODEV;
622+
606623 /* Fast path: if the BO is already retained by someone, no need to
607624 * check the madv status.
608625 */
@@ -637,6 +654,11 @@ int vc4_bo_inc_usecnt(struct vc4_bo *bo) · 28 unmodified lines
637654
638655 void vc4_bo_dec_usecnt(struct vc4_bo *bo)
639656 {
657+ struct vc4_dev *vc4 = to_vc4_dev(bo->base.base.dev);
658+
659+ if (WARN_ON_ONCE(vc4->is_vc5))
660+ return;
661+
640662 /* Fast path: if the BO is still retained by someone, no need to test
641663 * the madv value.
642664 */
@@ -756,6 +778,9 @@ int vc4_create_bo_ioctl(struct drm_device *dev, void *data, · 113 unmodified lines
756778 struct vc4_bo *bo = NULL;
757779 int ret;
758780
781+ if (WARN_ON_ONCE(vc4->is_vc5))
782+ return -ENODEV;
783+
759784 ret = vc4_grab_bin_bo(vc4, vc4file);
760785 if (ret)
761786 return ret;
@@ -779,9 +804,13 @@ int vc4_create_bo_ioctl(struct drm_device *dev, void *data, · 17 unmodified lines
779804 int vc4_mmap_bo_ioctl(struct drm_device *dev, void *data,
780805 struct drm_file *file_priv)
781806 {
807+ struct vc4_dev *vc4 = to_vc4_dev(dev);
782808 struct drm_vc4_mmap_bo *args = data;
783809 struct drm_gem_object *gem_obj;
784810
811+ if (WARN_ON_ONCE(vc4->is_vc5))
812+ return -ENODEV;
813+
785814 gem_obj = drm_gem_object_lookup(file_priv, args->handle);
786815 if (!gem_obj) {
787816 DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle);
@@ -805,6 +834,9 @@ vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data, · 17 unmodified lines
805834 struct vc4_bo *bo = NULL;
806835 int ret;
807836
837+ if (WARN_ON_ONCE(vc4->is_vc5))
838+ return -ENODEV;
839+
808840 if (args->size == 0)
809841 return -EINVAL;
810842
@@ -875,11 +907,15 @@ fail: · 64 unmodified lines
875907 int vc4_set_tiling_ioctl(struct drm_device *dev, void *data,
876908 struct drm_file *file_priv)
877909 {
910+ struct vc4_dev *vc4 = to_vc4_dev(dev);
878911 struct drm_vc4_set_tiling *args = data;
879912 struct drm_gem_object *gem_obj;
880913 struct vc4_bo *bo;
881914 bool t_format;
882915
916+ if (WARN_ON_ONCE(vc4->is_vc5))
917+ return -ENODEV;
918+
883919 if (args->flags != 0)
884920 return -EINVAL;
885921
@@ -918,10 +954,14 @@ int vc4_set_tiling_ioctl(struct drm_device *dev, void *data, · 32 unmodified lines
918954 int vc4_get_tiling_ioctl(struct drm_device *dev, void *data,
919955 struct drm_file *file_priv)
920956 {
957+ struct vc4_dev *vc4 = to_vc4_dev(dev);
921958 struct drm_vc4_get_tiling *args = data;
922959 struct drm_gem_object *gem_obj;
923960 struct vc4_bo *bo;
924961
962+ if (WARN_ON_ONCE(vc4->is_vc5))
963+ return -ENODEV;
964+
925965 if (args->flags != 0 || args->modifier != 0)
926966 return -EINVAL;
927967
@@ -948,6 +988,9 @@ int vc4_bo_cache_init(struct drm_device *dev) · 20 unmodified lines
948988 struct vc4_dev *vc4 = to_vc4_dev(dev);
949989 int i;
950990
991+ if (WARN_ON_ONCE(vc4->is_vc5))
992+ return -ENODEV;
993+
951994 /* Create the initial set of BO labels that the kernel will
952995 * use. This lets us avoid a bunch of string reallocation in
953996 * the kernel's draw and BO allocation paths.
@@ -1007,6 +1050,9 @@ int vc4_label_bo_ioctl(struct drm_device *dev, void *data, · 53 unmodified lines
10071050 struct drm_gem_object *gem_obj;
10081051 int ret = 0, label;
10091052
1053+ if (WARN_ON_ONCE(vc4->is_vc5))
1054+ return -ENODEV;
1055+
10101056 if (!args->len)
10111057 return -EINVAL;
10121058
drivers/gpu/drm/vc4/vc4_crtc.c+145−51
@@ -256,7 +256,7 @@ static u32 vc4_get_fifo_full_level(struct vc4_crtc *vc4_crtc, u32 format) · 255 unmodified lines
256256 * Removing 1 from the FIFO full level however
257257 * seems to completely remove that issue.
258258 */
259− if (!vc4->hvs->hvs5)
259+ if (!vc4->is_vc5)
260260 return fifo_len_bytes - 3 * HVS_FIFO_LATENCY_PIX - 1;
261261
262262 return fifo_len_bytes - 3 * HVS_FIFO_LATENCY_PIX;
@@ -389,7 +389,7 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc, struct drm_encoder *encode · 126 unmodified lines
389389 if (is_dsi)
390390 CRTC_WRITE(PV_HACT_ACT, mode->hdisplay * pixel_rep);
391391
392− if (vc4->hvs->hvs5)
392+ if (vc4->is_vc5)
393393 CRTC_WRITE(PV_MUX_CFG,
394394 VC4_SET_FIELD(PV_MUX_CFG_RGB_PIXEL_MUX_MODE_NO_SWAP,
395395 PV_MUX_CFG_RGB_PIXEL_MUX_MODE));
@@ -775,17 +775,18 @@ struct vc4_async_flip_state { · 379 unmodified lines
775775 struct drm_framebuffer *old_fb;
776776 struct drm_pending_vblank_event *event;
777777
778− struct vc4_seqno_cb cb;
778+ union {
779+ struct dma_fence_cb fence;
780+ struct vc4_seqno_cb seqno;
781+ } cb;
779782 };
780783
781784 /* Called when the V3D execution for the BO being flipped to is done, so that
782785 * we can actually update the plane's address to point to it.
783786 */
784787 static void
785−vc4_async_page_flip_complete(struct vc4_seqno_cb *cb)
788+vc4_async_page_flip_complete(struct vc4_async_flip_state *flip_state)
786789 {
787− struct vc4_async_flip_state *flip_state =
788− container_of(cb, struct vc4_async_flip_state, cb);
789790 struct drm_crtc *crtc = flip_state->crtc;
790791 struct drm_device *dev = crtc->dev;
791792 struct drm_plane *plane = crtc->primary;
@@ -802,59 +803,96 @@ vc4_async_page_flip_complete(struct vc4_seqno_cb *cb) · 10 unmodified lines
802803 drm_crtc_vblank_put(crtc);
803804 drm_framebuffer_put(flip_state->fb);
804805
805− /* Decrement the BO usecnt in order to keep the inc/dec calls balanced
806− * when the planes are updated through the async update path.
807− * FIXME: we should move to generic async-page-flip when it's
808− * available, so that we can get rid of this hand-made cleanup_fb()
809− * logic.
810− */
811− if (flip_state->old_fb) {
812− struct drm_gem_cma_object *cma_bo;
813− struct vc4_bo *bo;
806+ if (flip_state->old_fb)
807+ drm_framebuffer_put(flip_state->old_fb);
808+
809+ kfree(flip_state);
810+}
811+
812+static void vc4_async_page_flip_seqno_complete(struct vc4_seqno_cb *cb)
813+{
814+ struct vc4_async_flip_state *flip_state =
815+ container_of(cb, struct vc4_async_flip_state, cb.seqno);
816+ struct vc4_bo *bo = NULL;
814817
815− cma_bo = drm_fb_cma_get_gem_obj(flip_state->old_fb, 0);
818+ if (flip_state->old_fb) {
819+ struct drm_gem_cma_object *cma_bo =
820+ drm_fb_cma_get_gem_obj(flip_state->old_fb, 0);
816821 bo = to_vc4_bo(&cma_bo->base);
817− vc4_bo_dec_usecnt(bo);
818− drm_framebuffer_put(flip_state->old_fb);
819822 }
820823
821− kfree(flip_state);
824+ vc4_async_page_flip_complete(flip_state);
825+
826+ /*
827+ * Decrement the BO usecnt in order to keep the inc/dec
828+ * calls balanced when the planes are updated through
829+ * the async update path.
830+ *
831+ * FIXME: we should move to generic async-page-flip when
832+ * it's available, so that we can get rid of this
833+ * hand-made cleanup_fb() logic.
834+ */
835+ if (bo)
836+ vc4_bo_dec_usecnt(bo);
822837 }
823838
824−/* Implements async (non-vblank-synced) page flips.
825− *
826− * The page flip ioctl needs to return immediately, so we grab the
827− * modeset semaphore on the pipe, and queue the address update for
828− * when V3D is done with the BO being flipped to.
829− */
830−static int vc4_async_page_flip(struct drm_crtc *crtc,
831− struct drm_framebuffer *fb,
832− struct drm_pending_vblank_event *event,
833− uint32_t flags)
839+static void vc4_async_page_flip_fence_complete(struct dma_fence *fence,
840+ struct dma_fence_cb *cb)
834841 {
835− struct drm_device *dev = crtc->dev;
836− struct drm_plane *plane = crtc->primary;
837− int ret = 0;
838− struct vc4_async_flip_state *flip_state;
842+ struct vc4_async_flip_state *flip_state =
843+ container_of(cb, struct vc4_async_flip_state, cb.fence);
844+
845+ vc4_async_page_flip_complete(flip_state);
846+ dma_fence_put(fence);
847+}
848+
849+static int vc4_async_set_fence_cb(struct drm_device *dev,
850+ struct vc4_async_flip_state *flip_state)
851+{
852+ struct drm_framebuffer *fb = flip_state->fb;
839853 struct drm_gem_cma_object *cma_bo = drm_fb_cma_get_gem_obj(fb, 0);
840− struct vc4_bo *bo = to_vc4_bo(&cma_bo->base);
854+ struct vc4_dev *vc4 = to_vc4_dev(dev);
855+ struct dma_fence *fence;
856+ int ret;
841857
842− /* Increment the BO usecnt here, so that we never end up with an
843− * unbalanced number of vc4_bo_{dec,inc}_usecnt() calls when the
844− * plane is later updated through the non-async path.
845− * FIXME: we should move to generic async-page-flip when it's
846− * available, so that we can get rid of this hand-made prepare_fb()
847− * logic.
848− */
849− ret = vc4_bo_inc_usecnt(bo);
858+ if (!vc4->is_vc5) {
859+ struct vc4_bo *bo = to_vc4_bo(&cma_bo->base);
860+
861+ return vc4_queue_seqno_cb(dev, &flip_state->cb.seqno, bo->seqno,
862+ vc4_async_page_flip_seqno_complete);
863+ }
864+
865+ ret = dma_resv_get_singleton(cma_bo->base.resv, DMA_RESV_USAGE_READ, &fence);
850866 if (ret)
851867 return ret;
852868
869+ /* If there's no fence, complete the page flip immediately */
870+ if (!fence) {
871+ vc4_async_page_flip_fence_complete(fence, &flip_state->cb.fence);
872+ return 0;
873+ }
874+
875+ /* If the fence has already been completed, complete the page flip */
876+ if (dma_fence_add_callback(fence, &flip_state->cb.fence,
877+ vc4_async_page_flip_fence_complete))
878+ vc4_async_page_flip_fence_complete(fence, &flip_state->cb.fence);
879+
880+ return 0;
881+}
882+
883+static int
884+vc4_async_page_flip_common(struct drm_crtc *crtc,
885+ struct drm_framebuffer *fb,
886+ struct drm_pending_vblank_event *event,
887+ uint32_t flags)
888+{
889+ struct drm_device *dev = crtc->dev;
890+ struct drm_plane *plane = crtc->primary;
891+ struct vc4_async_flip_state *flip_state;
892+
853893 flip_state = kzalloc(sizeof(*flip_state), GFP_KERNEL);
854− if (!flip_state) {
855− vc4_bo_dec_usecnt(bo);
894+ if (!flip_state)
856895 return -ENOMEM;
857− }
858896
859897 drm_framebuffer_get(fb);
860898 flip_state->fb = fb;
@@ -881,23 +919,79 @@ static int vc4_async_page_flip(struct drm_crtc *crtc, · 20 unmodified lines
881919 */
882920 drm_atomic_set_fb_for_plane(plane->state, fb);
883921
884− vc4_queue_seqno_cb(dev, &flip_state->cb, bo->seqno,
885− vc4_async_page_flip_complete);
922+ vc4_async_set_fence_cb(dev, flip_state);
886923
887924 /* Driver takes ownership of state on successful async commit. */
888925 return 0;
889926 }
890927
928+/* Implements async (non-vblank-synced) page flips.
929+ *
930+ * The page flip ioctl needs to return immediately, so we grab the
931+ * modeset semaphore on the pipe, and queue the address update for
932+ * when V3D is done with the BO being flipped to.
933+ */
934+static int vc4_async_page_flip(struct drm_crtc *crtc,
935+ struct drm_framebuffer *fb,
936+ struct drm_pending_vblank_event *event,
937+ uint32_t flags)
938+{
939+ struct drm_device *dev = crtc->dev;
940+ struct vc4_dev *vc4 = to_vc4_dev(dev);
941+ struct drm_gem_cma_object *cma_bo = drm_fb_cma_get_gem_obj(fb, 0);
942+ struct vc4_bo *bo = to_vc4_bo(&cma_bo->base);
943+ int ret;
944+
945+ if (WARN_ON_ONCE(vc4->is_vc5))
946+ return -ENODEV;
947+
948+ /*
949+ * Increment the BO usecnt here, so that we never end up with an
950+ * unbalanced number of vc4_bo_{dec,inc}_usecnt() calls when the
951+ * plane is later updated through the non-async path.
952+ *
953+ * FIXME: we should move to generic async-page-flip when
954+ * it's available, so that we can get rid of this
955+ * hand-made prepare_fb() logic.
956+ */
957+ ret = vc4_bo_inc_usecnt(bo);
958+ if (ret)
959+ return ret;
960+
961+ ret = vc4_async_page_flip_common(crtc, fb, event, flags);
962+ if (ret) {
963+ vc4_bo_dec_usecnt(bo);
964+ return ret;
965+ }
966+
967+ return 0;
968+}
969+
970+static int vc5_async_page_flip(struct drm_crtc *crtc,
971+ struct drm_framebuffer *fb,
972+ struct drm_pending_vblank_event *event,
973+ uint32_t flags)
974+{
975+ return vc4_async_page_flip_common(crtc, fb, event, flags);
976+}
977+
891978 int vc4_page_flip(struct drm_crtc *crtc,
892979 struct drm_framebuffer *fb,
893980 struct drm_pending_vblank_event *event,
894981 uint32_t flags,
895982 struct drm_modeset_acquire_ctx *ctx)
896983 {
897− if (flags & DRM_MODE_PAGE_FLIP_ASYNC)
898− return vc4_async_page_flip(crtc, fb, event, flags);
899− else
984+ if (flags & DRM_MODE_PAGE_FLIP_ASYNC) {
985+ struct drm_device *dev = crtc->dev;
986+ struct vc4_dev *vc4 = to_vc4_dev(dev);
987+
988+ if (vc4->is_vc5)
989+ return vc5_async_page_flip(crtc, fb, event, flags);
990+ else
991+ return vc4_async_page_flip(crtc, fb, event, flags);
992+ } else {
900993 return drm_atomic_helper_page_flip(crtc, fb, event, flags, ctx);
994+ }
901995 }
902996
903997 struct drm_crtc_state *vc4_crtc_duplicate_state(struct drm_crtc *crtc)
@@ -1149,7 +1243,7 @@ int vc4_crtc_init(struct drm_device *drm, struct vc4_crtc *vc4_crtc, · 245 unmodified lines
11491243 crtc_funcs, NULL);
11501244 drm_crtc_helper_add(crtc, crtc_helper_funcs);
11511245
1152− if (!vc4->hvs->hvs5) {
1246+ if (!vc4->is_vc5) {
11531247 drm_mode_crtc_set_gamma_size(crtc, ARRAY_SIZE(vc4_crtc->lut_r));
11541248
11551249 drm_crtc_enable_color_mgmt(crtc, 0, false, crtc->gamma_size);
drivers/gpu/drm/vc4/vc4_drv.c+81−16
@@ -63,6 +63,32 @@ void __iomem *vc4_ioremap_regs(struct platform_device *pdev, int index) · 62 unmodified lines
6363 return map;
6464 }
6565
66+int vc4_dumb_fixup_args(struct drm_mode_create_dumb *args)
67+{
68+ int min_pitch = DIV_ROUND_UP(args->width * args->bpp, 8);
69+
70+ if (args->pitch < min_pitch)
71+ args->pitch = min_pitch;
72+
73+ if (args->size < args->pitch * args->height)
74+ args->size = args->pitch * args->height;
75+
76+ return 0;
77+}
78+
79+static int vc5_dumb_create(struct drm_file *file_priv,
80+ struct drm_device *dev,
81+ struct drm_mode_create_dumb *args)
82+{
83+ int ret;
84+
85+ ret = vc4_dumb_fixup_args(args);
86+ if (ret)
87+ return ret;
88+
89+ return drm_gem_cma_dumb_create_internal(file_priv, dev, args);
90+}
91+
6692 static int vc4_get_param_ioctl(struct drm_device *dev, void *data,
6793 struct drm_file *file_priv)
6894 {
@@ -73,6 +99,9 @@ static int vc4_get_param_ioctl(struct drm_device *dev, void *data, · 4 unmodified lines
7399 if (args->pad != 0)
74100 return -EINVAL;
75101
102+ if (WARN_ON_ONCE(vc4->is_vc5))
103+ return -ENODEV;
104+
76105 if (!vc4->v3d)
77106 return -ENODEV;
78107
@@ -116,11 +145,16 @@ static int vc4_get_param_ioctl(struct drm_device *dev, void *data, · 37 unmodified lines
116145
117146 static int vc4_open(struct drm_device *dev, struct drm_file *file)
118147 {
148+ struct vc4_dev *vc4 = to_vc4_dev(dev);
119149 struct vc4_file *vc4file;
120150
151+ if (WARN_ON_ONCE(vc4->is_vc5))
152+ return -ENODEV;
153+
121154 vc4file = kzalloc(sizeof(*vc4file), GFP_KERNEL);
122155 if (!vc4file)
123156 return -ENOMEM;
157+ vc4file->dev = vc4;
124158
125159 vc4_perfmon_open_file(vc4file);
126160 file->driver_priv = vc4file;
@@ -132,6 +166,9 @@ static void vc4_close(struct drm_device *dev, struct drm_file *file) · 5 unmodified lines
132166 struct vc4_dev *vc4 = to_vc4_dev(dev);
133167 struct vc4_file *vc4file = file->driver_priv;
134168
169+ if (WARN_ON_ONCE(vc4->is_vc5))
170+ return;
171+
135172 if (vc4file->bin_bo_used)
136173 vc4_v3d_bin_bo_put(vc4);
137174
@@ -160,7 +197,7 @@ static const struct drm_ioctl_desc vc4_drm_ioctls[] = { · 22 unmodified lines
160197 DRM_IOCTL_DEF_DRV(VC4_PERFMON_GET_VALUES, vc4_perfmon_get_values_ioctl, DRM_RENDER_ALLOW),
161198 };
162199
163−static struct drm_driver vc4_drm_driver = {
200+static const struct drm_driver vc4_drm_driver = {
164201 .driver_features = (DRIVER_MODESET |
165202 DRIVER_ATOMIC |
166203 DRIVER_GEM |
@@ -175,7 +212,7 @@ static struct drm_driver vc4_drm_driver = { · 8 unmodified lines
175212
176213 .gem_create_object = vc4_create_object,
177214
178− DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(vc4_dumb_create),
215+ DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(vc4_bo_dumb_create),
179216
180217 .ioctls = vc4_drm_ioctls,
181218 .num_ioctls = ARRAY_SIZE(vc4_drm_ioctls),
@@ -189,6 +226,27 @@ static struct drm_driver vc4_drm_driver = { · 7 unmodified lines
189226 .patchlevel = DRIVER_PATCHLEVEL,
190227 };
191228
229+static const struct drm_driver vc5_drm_driver = {
230+ .driver_features = (DRIVER_MODESET |
231+ DRIVER_ATOMIC |
232+ DRIVER_GEM),
233+
234+#if defined(CONFIG_DEBUG_FS)
235+ .debugfs_init = vc4_debugfs_init,
236+#endif
237+
238+ DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(vc5_dumb_create),
239+
240+ .fops = &vc4_drm_fops,
241+
242+ .name = DRIVER_NAME,
243+ .desc = DRIVER_DESC,
244+ .date = DRIVER_DATE,
245+ .major = DRIVER_MAJOR,
246+ .minor = DRIVER_MINOR,
247+ .patchlevel = DRIVER_PATCHLEVEL,
248+};
249+
192250 static void vc4_match_add_drivers(struct device *dev,
193251 struct component_match **match,
194252 struct platform_driver *const *drivers,
@@ -212,42 +270,49 @@ static void vc4_match_add_drivers(struct device *dev, · 17 unmodified lines
212270 static int vc4_drm_bind(struct device *dev)
213271 {
214272 struct platform_device *pdev = to_platform_device(dev);
273+ const struct drm_driver *driver;
215274 struct rpi_firmware *firmware = NULL;
216275 struct drm_device *drm;
217276 struct vc4_dev *vc4;
218277 struct device_node *node;
219278 struct drm_crtc *crtc;
279+ bool is_vc5;
220280 int ret = 0;
221281
222282 dev->coherent_dma_mask = DMA_BIT_MASK(32);
223283
224− /* If VC4 V3D is missing, don't advertise render nodes. */
225− node = of_find_matching_node_and_match(NULL, vc4_v3d_dt_match, NULL);
226− if (!node || !of_device_is_available(node))
227− vc4_drm_driver.driver_features &= ~DRIVER_RENDER;
228− of_node_put(node);
284+ is_vc5 = of_device_is_compatible(dev->of_node, "brcm,bcm2711-vc5");
285+ if (is_vc5)
286+ driver = &vc5_drm_driver;
287+ else
288+ driver = &vc4_drm_driver;
229289
230− vc4 = devm_drm_dev_alloc(dev, &vc4_drm_driver, struct vc4_dev, base);
290+ vc4 = devm_drm_dev_alloc(dev, driver, struct vc4_dev, base);
231291 if (IS_ERR(vc4))
232292 return PTR_ERR(vc4);
293+ vc4->is_vc5 = is_vc5;
233294
234295 drm = &vc4->base;
235296 platform_set_drvdata(pdev, drm);
236297 INIT_LIST_HEAD(&vc4->debugfs_list);
237298
238− mutex_init(&vc4->bin_bo_lock);
299+ if (!is_vc5) {
300+ mutex_init(&vc4->bin_bo_lock);
239301
240− ret = vc4_bo_cache_init(drm);
241− if (ret)
242− return ret;
302+ ret = vc4_bo_cache_init(drm);
303+ if (ret)
304+ return ret;
305+ }
243306
244307 ret = drmm_mode_config_init(drm);
245308 if (ret)
246309 return ret;
247310
248− ret = vc4_gem_init(drm);
249− if (ret)
250− return ret;
311+ if (!is_vc5) {
312+ ret = vc4_gem_init(drm);
313+ if (ret)
314+ return ret;
315+ }
251316
252317 node = of_find_compatible_node(NULL, NULL, "raspberrypi,bcm2835-firmware");
253318 if (node) {
@@ -258,7 +323,7 @@ static int vc4_drm_bind(struct device *dev) · 4 unmodified lines
258323 return -EPROBE_DEFER;
259324 }
260325
261− ret = drm_aperture_remove_framebuffers(false, &vc4_drm_driver);
326+ ret = drm_aperture_remove_framebuffers(false, driver);
262327 if (ret)
263328 return ret;
264329
drivers/gpu/drm/vc4/vc4_drv.h+13−6
@@ -48,6 +48,8 @@ enum vc4_kernel_bo_type { · 47 unmodified lines
4848 * done. This way, only events related to a specific job will be counted.
4949 */
5050 struct vc4_perfmon {
51+ struct vc4_dev *dev;
52+
5153 /* Tracks the number of users of the perfmon, when this counter reaches
5254 * zero the perfmon is destroyed.
5355 */
@@ -74,6 +76,8 @@ struct vc4_perfmon { · 20 unmodified lines
7476 struct vc4_dev {
7577 struct drm_device base;
7678
79+ bool is_vc5;
80+
7781 unsigned int irq;
7882
7983 struct vc4_hvs *hvs;
@@ -316,6 +320,7 @@ struct vc4_v3d { · 236 unmodified lines
316320 };
317321
318322 struct vc4_hvs {
323+ struct vc4_dev *vc4;
319324 struct platform_device *pdev;
320325 void __iomem *regs;
321326 u32 __iomem *dlist;
@@ -333,9 +338,6 @@ struct vc4_hvs { · 11 unmodified lines
333338 struct drm_mm_node mitchell_netravali_filter;
334339
335340 struct debugfs_regset32 regset;
336−
337− /* HVS version 5 flag, therefore requires updated dlist structures */
338− bool hvs5;
339341 };
340342
341343 struct vc4_plane {
@@ -580,6 +582,8 @@ to_vc4_crtc_state(struct drm_crtc_state *crtc_state) · 238 unmodified lines
580582 #define VC4_REG32(reg) { .name = #reg, .offset = reg }
581583
582584 struct vc4_exec_info {
585+ struct vc4_dev *dev;
586+
583587 /* Sequence number for this bin/render job. */
584588 uint64_t seqno;
585589
@@ -701,6 +705,8 @@ struct vc4_exec_info { · 115 unmodified lines
701705 * released when the DRM file is closed should be placed here.
702706 */
703707 struct vc4_file {
708+ struct vc4_dev *dev;
709+
704710 struct {
705711 struct idr idr;
706712 struct mutex lock;
@@ -814,9 +820,9 @@ struct vc4_validated_shader_info { · 107 unmodified lines
814820 struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size);
815821 struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t size,
816822 bool from_cache, enum vc4_kernel_bo_type type);
817−int vc4_dumb_create(struct drm_file *file_priv,
818− struct drm_device *dev,
819− struct drm_mode_create_dumb *args);
823+int vc4_bo_dumb_create(struct drm_file *file_priv,
824+ struct drm_device *dev,
825+ struct drm_mode_create_dumb *args);
820826 int vc4_create_bo_ioctl(struct drm_device *dev, void *data,
821827 struct drm_file *file_priv);
822828 int vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data,
@@ -885,6 +891,7 @@ static inline void vc4_debugfs_add_regset32(struct drm_device *drm, · 62 unmodified lines
885891
886892 /* vc4_drv.c */
887893 void __iomem *vc4_ioremap_regs(struct platform_device *dev, int index);
894+int vc4_dumb_fixup_args(struct drm_mode_create_dumb *args);
888895
889896 /* vc4_dpi.c */
890897 extern struct platform_driver vc4_dpi_driver;
drivers/gpu/drm/vc4/vc4_gem.c+40−0
@@ -76,6 +76,9 @@ vc4_get_hang_state_ioctl(struct drm_device *dev, void *data, · 75 unmodified lines
7676 u32 i;
7777 int ret = 0;
7878
79+ if (WARN_ON_ONCE(vc4->is_vc5))
80+ return -ENODEV;
81+
7982 if (!vc4->v3d) {
8083 DRM_DEBUG("VC4_GET_HANG_STATE with no VC4 V3D probed\n");
8184 return -ENODEV;
@@ -386,6 +389,9 @@ vc4_wait_for_seqno(struct drm_device *dev, uint64_t seqno, uint64_t timeout_ns, · 304 unmodified lines
386389 unsigned long timeout_expire;
387390 DEFINE_WAIT(wait);
388391
392+ if (WARN_ON_ONCE(vc4->is_vc5))
393+ return -ENODEV;
394+
389395 if (vc4->finished_seqno >= seqno)
390396 return 0;
391397
@@ -468,6 +474,9 @@ vc4_submit_next_bin_job(struct drm_device *dev) · 76 unmodified lines
468474 struct vc4_dev *vc4 = to_vc4_dev(dev);
469475 struct vc4_exec_info *exec;
470476
477+ if (WARN_ON_ONCE(vc4->is_vc5))
478+ return;
479+
471480 again:
472481 exec = vc4_first_bin_job(vc4);
473482 if (!exec)
@@ -513,6 +522,9 @@ vc4_submit_next_render_job(struct drm_device *dev) · 39 unmodified lines
513522 if (!exec)
514523 return;
515524
525+ if (WARN_ON_ONCE(vc4->is_vc5))
526+ return;
527+
516528 /* A previous RCL may have written to one of our textures, and
517529 * our full cache flush at bin time may have occurred before
518530 * that RCL completed. Flush the texture cache now, but not
@@ -531,6 +543,9 @@ vc4_move_job_to_render(struct drm_device *dev, struct vc4_exec_info *exec) · 12 unmodified lines
531543 struct vc4_dev *vc4 = to_vc4_dev(dev);
532544 bool was_empty = list_empty(&vc4->render_job_list);
533545
546+ if (WARN_ON_ONCE(vc4->is_vc5))
547+ return;
548+
534549 list_move_tail(&exec->head, &vc4->render_job_list);
535550 if (was_empty)
536551 vc4_submit_next_render_job(dev);
@@ -997,6 +1012,9 @@ vc4_job_handle_completed(struct vc4_dev *vc4) · 460 unmodified lines
9971012 unsigned long irqflags;
9981013 struct vc4_seqno_cb *cb, *cb_temp;
9991014
1015+ if (WARN_ON_ONCE(vc4->is_vc5))
1016+ return;
1017+
10001018 spin_lock_irqsave(&vc4->job_lock, irqflags);
10011019 while (!list_empty(&vc4->job_done_list)) {
10021020 struct vc4_exec_info *exec =
@@ -1033,6 +1051,9 @@ int vc4_queue_seqno_cb(struct drm_device *dev, · 30 unmodified lines
10331051 struct vc4_dev *vc4 = to_vc4_dev(dev);
10341052 unsigned long irqflags;
10351053
1054+ if (WARN_ON_ONCE(vc4->is_vc5))
1055+ return -ENODEV;
1056+
10361057 cb->func = func;
10371058 INIT_WORK(&cb->work, vc4_seqno_cb_work);
10381059
@@ -1083,8 +1104,12 @@ int · 44 unmodified lines
10831104 vc4_wait_seqno_ioctl(struct drm_device *dev, void *data,
10841105 struct drm_file *file_priv)
10851106 {
1107+ struct vc4_dev *vc4 = to_vc4_dev(dev);
10861108 struct drm_vc4_wait_seqno *args = data;
10871109
1110+ if (WARN_ON_ONCE(vc4->is_vc5))
1111+ return -ENODEV;
1112+
10881113 return vc4_wait_for_seqno_ioctl_helper(dev, args->seqno,
10891114 &args->timeout_ns);
10901115 }
@@ -1093,11 +1118,15 @@ int · 2 unmodified lines
10931118 vc4_wait_bo_ioctl(struct drm_device *dev, void *data,
10941119 struct drm_file *file_priv)
10951120 {
1121+ struct vc4_dev *vc4 = to_vc4_dev(dev);
10961122 int ret;
10971123 struct drm_vc4_wait_bo *args = data;
10981124 struct drm_gem_object *gem_obj;
10991125 struct vc4_bo *bo;
11001126
1127+ if (WARN_ON_ONCE(vc4->is_vc5))
1128+ return -ENODEV;
1129+
11011130 if (args->pad != 0)
11021131 return -EINVAL;
11031132
@@ -1144,6 +1173,9 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, · 40 unmodified lines
11441173 args->shader_rec_size,
11451174 args->bo_handle_count);
11461175
1176+ if (WARN_ON_ONCE(vc4->is_vc5))
1177+ return -ENODEV;
1178+
11471179 if (!vc4->v3d) {
11481180 DRM_DEBUG("VC4_SUBMIT_CL with no VC4 V3D probed\n");
11491181 return -ENODEV;
@@ -1167,6 +1199,7 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, · 17 unmodified lines
11671199 DRM_ERROR("malloc failure on exec struct\n");
11681200 return -ENOMEM;
11691201 }
1202+ exec->dev = vc4;
11701203
11711204 ret = vc4_v3d_pm_get(vc4);
11721205 if (ret) {
@@ -1276,6 +1309,9 @@ int vc4_gem_init(struct drm_device *dev) · 103 unmodified lines
12761309 {
12771310 struct vc4_dev *vc4 = to_vc4_dev(dev);
12781311
1312+ if (WARN_ON_ONCE(vc4->is_vc5))
1313+ return -ENODEV;
1314+
12791315 vc4->dma_fence_context = dma_fence_context_alloc(1);
12801316
12811317 INIT_LIST_HEAD(&vc4->bin_job_list);
@@ -1321,11 +1357,15 @@ static void vc4_gem_destroy(struct drm_device *dev, void *unused) · 39 unmodified lines
13211357 int vc4_gem_madvise_ioctl(struct drm_device *dev, void *data,
13221358 struct drm_file *file_priv)
13231359 {
1360+ struct vc4_dev *vc4 = to_vc4_dev(dev);
13241361 struct drm_vc4_gem_madvise *args = data;
13251362 struct drm_gem_object *gem_obj;
13261363 struct vc4_bo *bo;
13271364 int ret;
13281365
1366+ if (WARN_ON_ONCE(vc4->is_vc5))
1367+ return -ENODEV;
1368+
13291369 switch (args->madv) {
13301370 case VC4_MADV_DONTNEED:
13311371 case VC4_MADV_WILLNEED:
drivers/gpu/drm/vc4/vc4_hdmi.c+1−1
@@ -1481,7 +1481,7 @@ vc4_hdmi_encoder_compute_mode_clock(const struct drm_display_mode *mode, · 1480 unmodified lines
14811481 unsigned int bpc,
14821482 enum vc4_hdmi_output_format fmt)
14831483 {
1484− unsigned long long clock = mode->clock * 1000;
1484+ unsigned long long clock = mode->clock * 1000ULL;
14851485
14861486 if (mode->flags & DRM_MODE_FLAG_DBLCLK)
14871487 clock = clock * 2;
drivers/gpu/drm/vc4/vc4_hvs.c+9−9
@@ -220,10 +220,11 @@ u8 vc4_hvs_get_fifo_frame_count(struct vc4_hvs *hvs, unsigned int fifo) · 219 unmodified lines
220220
221221 int vc4_hvs_get_fifo_from_output(struct vc4_hvs *hvs, unsigned int output)
222222 {
223+ struct vc4_dev *vc4 = hvs->vc4;
223224 u32 reg;
224225 int ret;
225226
226− if (!hvs->hvs5)
227+ if (!vc4->is_vc5)
227228 return output;
228229
229230 switch (output) {
@@ -273,6 +274,7 @@ int vc4_hvs_get_fifo_from_output(struct vc4_hvs *hvs, unsigned int output) · 43 unmodified lines
273274 static int vc4_hvs_init_channel(struct vc4_hvs *hvs, struct drm_crtc *crtc,
274275 struct drm_display_mode *mode, bool oneshot)
275276 {
277+ struct vc4_dev *vc4 = hvs->vc4;
276278 struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
277279 struct vc4_crtc_state *vc4_crtc_state = to_vc4_crtc_state(crtc->state);
278280 unsigned int chan = vc4_crtc_state->assigned_channel;
@@ -291,7 +293,7 @@ static int vc4_hvs_init_channel(struct vc4_hvs *hvs, struct drm_crtc *crtc, · 12 unmodified lines
291293 */
292294 dispctrl = SCALER_DISPCTRLX_ENABLE;
293295
294− if (!hvs->hvs5)
296+ if (!vc4->is_vc5)
295297 dispctrl |= VC4_SET_FIELD(mode->hdisplay,
296298 SCALER_DISPCTRLX_WIDTH) |
297299 VC4_SET_FIELD(mode->vdisplay,
@@ -312,7 +314,7 @@ static int vc4_hvs_init_channel(struct vc4_hvs *hvs, struct drm_crtc *crtc, · 14 unmodified lines
312314
313315 HVS_WRITE(SCALER_DISPBKGNDX(chan), dispbkgndx |
314316 SCALER_DISPBKGND_AUTOHS |
315− ((!hvs->hvs5) ? SCALER_DISPBKGND_GAMMA : 0) |
317+ ((!vc4->is_vc5) ? SCALER_DISPBKGND_GAMMA : 0) |
316318 (interlace ? SCALER_DISPBKGND_INTERLACE : 0));
317319
318320 /* Reload the LUT, since the SRAMs would have been disabled if
@@ -617,11 +619,9 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data) · 298 unmodified lines
617619 if (!hvs)
618620 return -ENOMEM;
619621
622+ hvs->vc4 = vc4;
620623 hvs->pdev = pdev;
621624
622− if (of_device_is_compatible(pdev->dev.of_node, "brcm,bcm2711-hvs"))
623− hvs->hvs5 = true;
624−
625625 hvs->regs = vc4_ioremap_regs(pdev, 0);
626626 if (IS_ERR(hvs->regs))
627627 return PTR_ERR(hvs->regs);
@@ -630,7 +630,7 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data) · 2 unmodified lines
630630 hvs->regset.regs = hvs_regs;
631631 hvs->regset.nregs = ARRAY_SIZE(hvs_regs);
632632
633− if (hvs->hvs5) {
633+ if (vc4->is_vc5) {
634634 hvs->core_clk = devm_clk_get(&pdev->dev, NULL);
635635 if (IS_ERR(hvs->core_clk)) {
636636 dev_err(&pdev->dev, "Couldn't get core clock\n");
@@ -644,7 +644,7 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data) · 7 unmodified lines
644644 }
645645 }
646646
647− if (!hvs->hvs5)
647+ if (!vc4->is_vc5)
648648 hvs->dlist = hvs->regs + SCALER_DLIST_START;
649649 else
650650 hvs->dlist = hvs->regs + SCALER5_DLIST_START;
@@ -665,7 +665,7 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data) · 14 unmodified lines
665665 * between planes when they don't overlap on the screen, but
666666 * for now we just allocate globally.
667667 */
668− if (!hvs->hvs5)
668+ if (!vc4->is_vc5)
669669 /* 48k words of 2x12-bit pixels */
670670 drm_mm_init(&hvs->lbm_mm, 0, 48 * 1024);
671671 else
drivers/gpu/drm/vc4/vc4_irq.c+16−0
@@ -265,6 +265,9 @@ vc4_irq_enable(struct drm_device *dev) · 264 unmodified lines
265265 {
266266 struct vc4_dev *vc4 = to_vc4_dev(dev);
267267
268+ if (WARN_ON_ONCE(vc4->is_vc5))
269+ return;
270+
268271 if (!vc4->v3d)
269272 return;
270273
@@ -279,6 +282,9 @@ vc4_irq_disable(struct drm_device *dev) · 8 unmodified lines
279282 {
280283 struct vc4_dev *vc4 = to_vc4_dev(dev);
281284
285+ if (WARN_ON_ONCE(vc4->is_vc5))
286+ return;
287+
282288 if (!vc4->v3d)
283289 return;
284290
@@ -296,8 +302,12 @@ vc4_irq_disable(struct drm_device *dev) · 11 unmodified lines
296302
297303 int vc4_irq_install(struct drm_device *dev, int irq)
298304 {
305+ struct vc4_dev *vc4 = to_vc4_dev(dev);
299306 int ret;
300307
308+ if (WARN_ON_ONCE(vc4->is_vc5))
309+ return -ENODEV;
310+
301311 if (irq == IRQ_NOTCONNECTED)
302312 return -ENOTCONN;
303313
@@ -316,6 +326,9 @@ void vc4_irq_uninstall(struct drm_device *dev) · 12 unmodified lines
316326 {
317327 struct vc4_dev *vc4 = to_vc4_dev(dev);
318328
329+ if (WARN_ON_ONCE(vc4->is_vc5))
330+ return;
331+
319332 vc4_irq_disable(dev);
320333 free_irq(vc4->irq, dev);
321334 }
@@ -326,6 +339,9 @@ void vc4_irq_reset(struct drm_device *dev) · 4 unmodified lines
326339 struct vc4_dev *vc4 = to_vc4_dev(dev);
327340 unsigned long irqflags;
328341
342+ if (WARN_ON_ONCE(vc4->is_vc5))
343+ return;
344+
329345 /* Acknowledge any stale IRQs. */
330346 V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS);
331347
drivers/gpu/drm/vc4/vc4_kms.c+16−8
@@ -393,7 +393,7 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state) · 392 unmodified lines
393393 old_hvs_state->fifo_state[channel].pending_commit = NULL;
394394 }
395395
396− if (vc4->hvs->hvs5) {
396+ if (vc4->is_vc5) {
397397 unsigned long state_rate = max(old_hvs_state->core_clock_rate,
398398 new_hvs_state->core_clock_rate);
399399 unsigned long core_rate = max_t(unsigned long,
@@ -412,7 +412,7 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state) · 12 unmodified lines
412412
413413 vc4_ctm_commit(vc4, state);
414414
415− if (vc4->hvs->hvs5)
415+ if (vc4->is_vc5)
416416 vc5_hvs_pv_muxing_commit(vc4, state);
417417 else
418418 vc4_hvs_pv_muxing_commit(vc4, state);
@@ -430,7 +430,7 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state) · 11 unmodified lines
430430
431431 drm_atomic_helper_cleanup_planes(dev, state);
432432
433− if (vc4->hvs->hvs5) {
433+ if (vc4->is_vc5) {
434434 drm_dbg(dev, "Running the core clock at %lu Hz\n",
435435 new_hvs_state->core_clock_rate);
436436
@@ -479,8 +479,12 @@ static struct drm_framebuffer *vc4_fb_create(struct drm_device *dev, · 42 unmodified lines
479479 struct drm_file *file_priv,
480480 const struct drm_mode_fb_cmd2 *mode_cmd)
481481 {
482+ struct vc4_dev *vc4 = to_vc4_dev(dev);
482483 struct drm_mode_fb_cmd2 mode_cmd_local;
483484
485+ if (WARN_ON_ONCE(vc4->is_vc5))
486+ return ERR_PTR(-ENODEV);
487+
484488 /* If the user didn't specify a modifier, use the
485489 * vc4_set_tiling_ioctl() state for the BO.
486490 */
@@ -997,11 +1001,15 @@ static const struct drm_mode_config_funcs vc4_mode_funcs = { · 510 unmodified lines
9971001 .fb_create = vc4_fb_create,
9981002 };
9991003
1004+static const struct drm_mode_config_funcs vc5_mode_funcs = {
1005+ .atomic_check = vc4_atomic_check,
1006+ .atomic_commit = drm_atomic_helper_commit,
1007+ .fb_create = drm_gem_fb_create,
1008+};
1009+
10001010 int vc4_kms_load(struct drm_device *dev)
10011011 {
10021012 struct vc4_dev *vc4 = to_vc4_dev(dev);
1003− bool is_vc5 = of_device_is_compatible(dev->dev->of_node,
1004− "brcm,bcm2711-vc5");
10051013 int ret;
10061014
10071015 /*
@@ -1009,7 +1017,7 @@ int vc4_kms_load(struct drm_device *dev) · 1 unmodified line
10091017 * the BCM2711, but the load tracker computations are used for
10101018 * the core clock rate calculation.
10111019 */
1012− if (!is_vc5) {
1020+ if (!vc4->is_vc5) {
10131021 /* Start with the load tracker enabled. Can be
10141022 * disabled through the debugfs load_tracker file.
10151023 */
@@ -1025,7 +1033,7 @@ int vc4_kms_load(struct drm_device *dev) · 9 unmodified lines
10251033 return ret;
10261034 }
10271035
1028− if (is_vc5) {
1036+ if (vc4->is_vc5) {
10291037 dev->mode_config.max_width = 7680;
10301038 dev->mode_config.max_height = 7680;
10311039 } else {
@@ -1033,7 +1041,7 @@ int vc4_kms_load(struct drm_device *dev) · 1 unmodified line
10331041 dev->mode_config.max_height = 2048;
10341042 }
10351043
1036− dev->mode_config.funcs = &vc4_mode_funcs;
1044+ dev->mode_config.funcs = vc4->is_vc5 ? &vc5_mode_funcs : &vc4_mode_funcs;
10371045 dev->mode_config.helper_private = &vc4_mode_config_helpers;
10381046 dev->mode_config.preferred_depth = 24;
10391047 dev->mode_config.async_page_flip = true;
drivers/gpu/drm/vc4/vc4_perfmon.c+46−1
@@ -17,13 +17,27 @@ · 16 unmodified lines
1717
1818 void vc4_perfmon_get(struct vc4_perfmon *perfmon)
1919 {
20+ struct vc4_dev *vc4 = perfmon->dev;
21+
22+ if (WARN_ON_ONCE(vc4->is_vc5))
23+ return;
24+
2025 if (perfmon)
2126 refcount_inc(&perfmon->refcnt);
2227 }
2328
2429 void vc4_perfmon_put(struct vc4_perfmon *perfmon)
2530 {
26− if (perfmon && refcount_dec_and_test(&perfmon->refcnt))
31+ struct vc4_dev *vc4;
32+
33+ if (!perfmon)
34+ return;
35+
36+ vc4 = perfmon->dev;
37+ if (WARN_ON_ONCE(vc4->is_vc5))
38+ return;
39+
40+ if (refcount_dec_and_test(&perfmon->refcnt))
2741 kfree(perfmon);
2842 }
2943
@@ -32,6 +46,9 @@ void vc4_perfmon_start(struct vc4_dev *vc4, struct vc4_perfmon *perfmon) · 2 unmodified lines
3246 unsigned int i;
3347 u32 mask;
3448
49+ if (WARN_ON_ONCE(vc4->is_vc5))
50+ return;
51+
3552 if (WARN_ON_ONCE(!perfmon || vc4->active_perfmon))
3653 return;
3754
@@ -49,6 +66,9 @@ void vc4_perfmon_stop(struct vc4_dev *vc4, struct vc4_perfmon *perfmon, · 11 unmodified lines
4966 {
5067 unsigned int i;
5168
69+ if (WARN_ON_ONCE(vc4->is_vc5))
70+ return;
71+
5272 if (WARN_ON_ONCE(!vc4->active_perfmon ||
5373 perfmon != vc4->active_perfmon))
5474 return;
@@ -64,8 +84,12 @@ void vc4_perfmon_stop(struct vc4_dev *vc4, struct vc4_perfmon *perfmon, · 9 unmodified lines
6484
6585 struct vc4_perfmon *vc4_perfmon_find(struct vc4_file *vc4file, int id)
6686 {
87+ struct vc4_dev *vc4 = vc4file->dev;
6788 struct vc4_perfmon *perfmon;
6889
90+ if (WARN_ON_ONCE(vc4->is_vc5))
91+ return NULL;
92+
6993 mutex_lock(&vc4file->perfmon.lock);
7094 perfmon = idr_find(&vc4file->perfmon.idr, id);
7195 vc4_perfmon_get(perfmon);
@@ -76,8 +100,14 @@ struct vc4_perfmon *vc4_perfmon_find(struct vc4_file *vc4file, int id) · 4 unmodified lines
76100
77101 void vc4_perfmon_open_file(struct vc4_file *vc4file)
78102 {
103+ struct vc4_dev *vc4 = vc4file->dev;
104+
105+ if (WARN_ON_ONCE(vc4->is_vc5))
106+ return;
107+
79108 mutex_init(&vc4file->perfmon.lock);
80109 idr_init_base(&vc4file->perfmon.idr, VC4_PERFMONID_MIN);
110+ vc4file->dev = vc4;
81111 }
82112
83113 static int vc4_perfmon_idr_del(int id, void *elem, void *data)
@@ -91,6 +121,11 @@ static int vc4_perfmon_idr_del(int id, void *elem, void *data) · 7 unmodified lines
91121
92122 void vc4_perfmon_close_file(struct vc4_file *vc4file)
93123 {
124+ struct vc4_dev *vc4 = vc4file->dev;
125+
126+ if (WARN_ON_ONCE(vc4->is_vc5))
127+ return;
128+
94129 mutex_lock(&vc4file->perfmon.lock);
95130 idr_for_each(&vc4file->perfmon.idr, vc4_perfmon_idr_del, NULL);
96131 idr_destroy(&vc4file->perfmon.idr);
@@ -107,6 +142,9 @@ int vc4_perfmon_create_ioctl(struct drm_device *dev, void *data, · 10 unmodified lines
107142 unsigned int i;
108143 int ret;
109144
145+ if (WARN_ON_ONCE(vc4->is_vc5))
146+ return -ENODEV;
147+
110148 if (!vc4->v3d) {
111149 DRM_DEBUG("Creating perfmon no VC4 V3D probed\n");
112150 return -ENODEV;
@@ -127,6 +165,7 @@ int vc4_perfmon_create_ioctl(struct drm_device *dev, void *data, · 14 unmodified lines
127165 GFP_KERNEL);
128166 if (!perfmon)
129167 return -ENOMEM;
168+ perfmon->dev = vc4;
130169
131170 for (i = 0; i < req->ncounters; i++)
132171 perfmon->events[i] = req->events[i];
@@ -157,6 +196,9 @@ int vc4_perfmon_destroy_ioctl(struct drm_device *dev, void *data, · 24 unmodified lines
157196 struct drm_vc4_perfmon_destroy *req = data;
158197 struct vc4_perfmon *perfmon;
159198
199+ if (WARN_ON_ONCE(vc4->is_vc5))
200+ return -ENODEV;
201+
160202 if (!vc4->v3d) {
161203 DRM_DEBUG("Destroying perfmon no VC4 V3D probed\n");
162204 return -ENODEV;
@@ -182,6 +224,9 @@ int vc4_perfmon_get_values_ioctl(struct drm_device *dev, void *data, · 19 unmodified lines
182224 struct vc4_perfmon *perfmon;
183225 int ret;
184226
227+ if (WARN_ON_ONCE(vc4->is_vc5))
228+ return -ENODEV;
229+
185230 if (!vc4->v3d) {
186231 DRM_DEBUG("Getting perfmon no VC4 V3D probed\n");
187232 return -ENODEV;
drivers/gpu/drm/vc4/vc4_plane.c+21−8
@@ -489,10 +489,10 @@ static u32 vc4_lbm_size(struct drm_plane_state *state) · 488 unmodified lines
489489 }
490490
491491 /* Align it to 64 or 128 (hvs5) bytes */
492− lbm = roundup(lbm, vc4->hvs->hvs5 ? 128 : 64);
492+ lbm = roundup(lbm, vc4->is_vc5 ? 128 : 64);
493493
494494 /* Each "word" of the LBM memory contains 2 or 4 (hvs5) pixels */
495− lbm /= vc4->hvs->hvs5 ? 4 : 2;
495+ lbm /= vc4->is_vc5 ? 4 : 2;
496496
497497 return lbm;
498498 }
@@ -608,7 +608,7 @@ static int vc4_plane_allocate_lbm(struct drm_plane_state *state) · 109 unmodified lines
608608 ret = drm_mm_insert_node_generic(&vc4->hvs->lbm_mm,
609609 &vc4_state->lbm,
610610 lbm_size,
611− vc4->hvs->hvs5 ? 64 : 32,
611+ vc4->is_vc5 ? 64 : 32,
612612 0, 0);
613613 spin_unlock_irqrestore(&vc4->hvs->mm_lock, irqflags);
614614
@@ -917,7 +917,7 @@ static int vc4_plane_mode_set(struct drm_plane *plane, · 302 unmodified lines
917917 mix_plane_alpha = state->alpha != DRM_BLEND_ALPHA_OPAQUE &&
918918 fb->format->has_alpha;
919919
920− if (!vc4->hvs->hvs5) {
920+ if (!vc4->is_vc5) {
921921 /* Control word */
922922 vc4_dlist_write(vc4_state,
923923 SCALER_CTL0_VALID |
@@ -1321,6 +1321,10 @@ static int vc4_plane_atomic_async_check(struct drm_plane *plane, · 397 unmodified lines
13211321
13221322 old_vc4_state = to_vc4_plane_state(plane->state);
13231323 new_vc4_state = to_vc4_plane_state(new_plane_state);
1324+
1325+ if (!new_vc4_state->hw_dlist)
1326+ return -EINVAL;
1327+
13241328 if (old_vc4_state->dlist_count != new_vc4_state->dlist_count ||
13251329 old_vc4_state->pos0_offset != new_vc4_state->pos0_offset ||
13261330 old_vc4_state->pos2_offset != new_vc4_state->pos2_offset ||
@@ -1385,6 +1389,13 @@ static const struct drm_plane_helper_funcs vc4_plane_helper_funcs = { · 58 unmodified lines
13851389 .atomic_async_update = vc4_plane_atomic_async_update,
13861390 };
13871391
1392+static const struct drm_plane_helper_funcs vc5_plane_helper_funcs = {
1393+ .atomic_check = vc4_plane_atomic_check,
1394+ .atomic_update = vc4_plane_atomic_update,
1395+ .atomic_async_check = vc4_plane_atomic_async_check,
1396+ .atomic_async_update = vc4_plane_atomic_async_update,
1397+};
1398+
13881399 static bool vc4_format_mod_supported(struct drm_plane *plane,
13891400 uint32_t format,
13901401 uint64_t modifier)
@@ -1453,14 +1464,13 @@ static const struct drm_plane_funcs vc4_plane_funcs = { · 62 unmodified lines
14531464 struct drm_plane *vc4_plane_init(struct drm_device *dev,
14541465 enum drm_plane_type type)
14551466 {
1467+ struct vc4_dev *vc4 = to_vc4_dev(dev);
14561468 struct drm_plane *plane = NULL;
14571469 struct vc4_plane *vc4_plane;
14581470 u32 formats[ARRAY_SIZE(hvs_formats)];
14591471 int num_formats = 0;
14601472 int ret = 0;
14611473 unsigned i;
1462− bool hvs5 = of_device_is_compatible(dev->dev->of_node,
1463− "brcm,bcm2711-vc5");
14641474 static const uint64_t modifiers[] = {
14651475 DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED,
14661476 DRM_FORMAT_MOD_BROADCOM_SAND128,
@@ -1476,7 +1486,7 @@ struct drm_plane *vc4_plane_init(struct drm_device *dev, · 9 unmodified lines
14761486 return ERR_PTR(-ENOMEM);
14771487
14781488 for (i = 0; i < ARRAY_SIZE(hvs_formats); i++) {
1479− if (!hvs_formats[i].hvs5_only || hvs5) {
1489+ if (!hvs_formats[i].hvs5_only || vc4->is_vc5) {
14801490 formats[num_formats] = hvs_formats[i].drm;
14811491 num_formats++;
14821492 }
@@ -1490,7 +1500,10 @@ struct drm_plane *vc4_plane_init(struct drm_device *dev, · 7 unmodified lines
14901500 if (ret)
14911501 return ERR_PTR(ret);
14921502
1493− drm_plane_helper_add(plane, &vc4_plane_helper_funcs);
1503+ if (vc4->is_vc5)
1504+ drm_plane_helper_add(plane, &vc5_plane_helper_funcs);
1505+ else
1506+ drm_plane_helper_add(plane, &vc4_plane_helper_funcs);
14941507
14951508 drm_plane_create_alpha_property(plane);
14961509 drm_plane_create_rotation_property(plane, DRM_MODE_ROTATE_0,
drivers/gpu/drm/vc4/vc4_render_cl.c+4−0
@@ -593,11 +593,15 @@ vc4_rcl_render_config_surface_setup(struct vc4_exec_info *exec, · 592 unmodified lines
593593
594594 int vc4_get_rcl(struct drm_device *dev, struct vc4_exec_info *exec)
595595 {
596+ struct vc4_dev *vc4 = to_vc4_dev(dev);
596597 struct vc4_rcl_setup setup = {0};
597598 struct drm_vc4_submit_cl *args = exec->args;
598599 bool has_bin = args->bin_cl_size != 0;
599600 int ret;
600601
602+ if (WARN_ON_ONCE(vc4->is_vc5))
603+ return -ENODEV;
604+
601605 if (args->min_x_tile > args->max_x_tile ||
602606 args->min_y_tile > args->max_y_tile) {
603607 DRM_DEBUG("Bad render tile set (%d,%d)-(%d,%d)\n",
drivers/gpu/drm/vc4/vc4_v3d.c+15−0
@@ -127,6 +127,9 @@ static int vc4_v3d_debugfs_ident(struct seq_file *m, void *unused) · 126 unmodified lines
127127 int
128128 vc4_v3d_pm_get(struct vc4_dev *vc4)
129129 {
130+ if (WARN_ON_ONCE(vc4->is_vc5))
131+ return -ENODEV;
132+
130133 mutex_lock(&vc4->power_lock);
131134 if (vc4->power_refcount++ == 0) {
132135 int ret = pm_runtime_get_sync(&vc4->v3d->pdev->dev);
@@ -145,6 +148,9 @@ vc4_v3d_pm_get(struct vc4_dev *vc4) · 12 unmodified lines
145148 void
146149 vc4_v3d_pm_put(struct vc4_dev *vc4)
147150 {
151+ if (WARN_ON_ONCE(vc4->is_vc5))
152+ return;
153+
148154 mutex_lock(&vc4->power_lock);
149155 if (--vc4->power_refcount == 0) {
150156 pm_runtime_mark_last_busy(&vc4->v3d->pdev->dev);
@@ -172,6 +178,9 @@ int vc4_v3d_get_bin_slot(struct vc4_dev *vc4) · 21 unmodified lines
172178 uint64_t seqno = 0;
173179 struct vc4_exec_info *exec;
174180
181+ if (WARN_ON_ONCE(vc4->is_vc5))
182+ return -ENODEV;
183+
175184 try_again:
176185 spin_lock_irqsave(&vc4->job_lock, irqflags);
177186 slot = ffs(~vc4->bin_alloc_used);
@@ -316,6 +325,9 @@ int vc4_v3d_bin_bo_get(struct vc4_dev *vc4, bool *used) · 138 unmodified lines
316325 {
317326 int ret = 0;
318327
328+ if (WARN_ON_ONCE(vc4->is_vc5))
329+ return -ENODEV;
330+
319331 mutex_lock(&vc4->bin_bo_lock);
320332
321333 if (used && *used)
@@ -348,6 +360,9 @@ static void bin_bo_release(struct kref *ref) · 26 unmodified lines
348360
349361 void vc4_v3d_bin_bo_put(struct vc4_dev *vc4)
350362 {
363+ if (WARN_ON_ONCE(vc4->is_vc5))
364+ return;
365+
351366 mutex_lock(&vc4->bin_bo_lock);
352367 kref_put(&vc4->bin_bo_kref, bin_bo_release);
353368 mutex_unlock(&vc4->bin_bo_lock);
drivers/gpu/drm/vc4/vc4_validate.c+16−0
@@ -105,9 +105,13 @@ size_is_lt(uint32_t width, uint32_t height, int cpp) · 104 unmodified lines
105105 struct drm_gem_cma_object *
106106 vc4_use_bo(struct vc4_exec_info *exec, uint32_t hindex)
107107 {
108+ struct vc4_dev *vc4 = exec->dev;
108109 struct drm_gem_cma_object *obj;
109110 struct vc4_bo *bo;
110111
112+ if (WARN_ON_ONCE(vc4->is_vc5))
113+ return NULL;
114+
111115 if (hindex >= exec->bo_count) {
112116 DRM_DEBUG("BO index %d greater than BO count %d\n",
113117 hindex, exec->bo_count);
@@ -160,10 +164,14 @@ vc4_check_tex_size(struct vc4_exec_info *exec, struct drm_gem_cma_object *fbo, · 46 unmodified lines
160164 uint32_t offset, uint8_t tiling_format,
161165 uint32_t width, uint32_t height, uint8_t cpp)
162166 {
167+ struct vc4_dev *vc4 = exec->dev;
163168 uint32_t aligned_width, aligned_height, stride, size;
164169 uint32_t utile_w = utile_width(cpp);
165170 uint32_t utile_h = utile_height(cpp);
166171
172+ if (WARN_ON_ONCE(vc4->is_vc5))
173+ return false;
174+
167175 /* The shaded vertex format stores signed 12.4 fixed point
168176 * (-2048,2047) offsets from the viewport center, so we should
169177 * never have a render target larger than 4096. The texture
@@ -482,10 +490,14 @@ vc4_validate_bin_cl(struct drm_device *dev, · 312 unmodified lines
482490 void *unvalidated,
483491 struct vc4_exec_info *exec)
484492 {
493+ struct vc4_dev *vc4 = to_vc4_dev(dev);
485494 uint32_t len = exec->args->bin_cl_size;
486495 uint32_t dst_offset = 0;
487496 uint32_t src_offset = 0;
488497
498+ if (WARN_ON_ONCE(vc4->is_vc5))
499+ return -ENODEV;
500+
489501 while (src_offset < len) {
490502 void *dst_pkt = validated + dst_offset;
491503 void *src_pkt = unvalidated + src_offset;
@@ -926,9 +938,13 @@ int · 434 unmodified lines
926938 vc4_validate_shader_recs(struct drm_device *dev,
927939 struct vc4_exec_info *exec)
928940 {
941+ struct vc4_dev *vc4 = to_vc4_dev(dev);
929942 uint32_t i;
930943 int ret = 0;
931944
945+ if (WARN_ON_ONCE(vc4->is_vc5))
946+ return -ENODEV;
947+
932948 for (i = 0; i < exec->shader_state_count; i++) {
933949 ret = validate_gl_shader_rec(dev, exec, &exec->shader_state[i]);
934950 if (ret)
drivers/gpu/drm/vc4/vc4_validate_shaders.c+4−0
@@ -778,6 +778,7 @@ vc4_handle_branch_target(struct vc4_shader_validation_state *validation_state) · 777 unmodified lines
778778 struct vc4_validated_shader_info *
779779 vc4_validate_shader(struct drm_gem_cma_object *shader_obj)
780780 {
781+ struct vc4_dev *vc4 = to_vc4_dev(shader_obj->base.dev);
781782 bool found_shader_end = false;
782783 int shader_end_ip = 0;
783784 uint32_t last_thread_switch_ip = -3;
@@ -785,6 +786,9 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj) · 1 unmodified line
785786 struct vc4_validated_shader_info *validated_shader = NULL;
786787 struct vc4_shader_validation_state validation_state;
787788
789+ if (WARN_ON_ONCE(vc4->is_vc5))
790+ return NULL;
791+
788792 memset(&validation_state, 0, sizeof(validation_state));
789793 validation_state.shader = shader_obj->vaddr;
790794 validation_state.max_ip = shader_obj->base.size / sizeof(uint64_t);
drivers/gpu/drm/xen/xen_drm_front_gem.c+1−1
@@ -71,7 +71,7 @@ static int xen_drm_front_gem_object_mmap(struct drm_gem_object *gem_obj, · 70 unmodified lines
7171 * the whole buffer.
7272 */
7373 vma->vm_flags &= ~VM_PFNMAP;
74− vma->vm_flags |= VM_MIXEDMAP;
74+ vma->vm_flags |= VM_MIXEDMAP | VM_DONTEXPAND;
7575 vma->vm_pgoff = 0;
7676
7777 /*
drivers/hid/hid-hyperv.c+3−2
@@ -199,7 +199,8 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device, · 198 unmodified lines
199199 if (!input_device->hid_desc)
200200 goto cleanup;
201201
202− input_device->report_desc_size = desc->desc[0].wDescriptorLength;
202+ input_device->report_desc_size = le16_to_cpu(
203+ desc->desc[0].wDescriptorLength);
203204 if (input_device->report_desc_size == 0) {
204205 input_device->dev_info_status = -EINVAL;
205206 goto cleanup;
@@ -217,7 +218,7 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device, · 11 unmodified lines
217218
218219 memcpy(input_device->report_desc,
219220 ((unsigned char *)desc) + desc->bLength,
220− desc->desc[0].wDescriptorLength);
221+ le16_to_cpu(desc->desc[0].wDescriptorLength));
221222
222223 /* Send the ack */
223224 memset(&ack, 0, sizeof(struct mousevsc_prt_msg));
drivers/hv/channel_mgmt.c+13−5
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #include <linux/cpu.h>
2222 #include <linux/hyperv.h>
2323 #include <asm/mshyperv.h>
24+#include <linux/sched/isolation.h>
2425
2526 #include "hyperv_vmbus.h"
2627
@@ -638,6 +639,7 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel) · 611 unmodified lines
638639 */
639640 if (newchannel->offermsg.offer.sub_channel_index == 0) {
640641 mutex_unlock(&vmbus_connection.channel_mutex);
642+ cpus_read_unlock();
641643 /*
642644 * Don't call free_channel(), because newchannel->kobj
643645 * is not initialized yet.
@@ -728,16 +730,20 @@ static void init_vp_index(struct vmbus_channel *channel) · 84 unmodified lines
728730 u32 i, ncpu = num_online_cpus();
729731 cpumask_var_t available_mask;
730732 struct cpumask *allocated_mask;
733+ const struct cpumask *hk_mask = housekeeping_cpumask(HK_TYPE_MANAGED_IRQ);
731734 u32 target_cpu;
732735 int numa_node;
733736
734737 if (!perf_chn ||
735− !alloc_cpumask_var(&available_mask, GFP_KERNEL)) {
738+ !alloc_cpumask_var(&available_mask, GFP_KERNEL) ||
739+ cpumask_empty(hk_mask)) {
736740 /*
737741 * If the channel is not a performance critical
738742 * channel, bind it to VMBUS_CONNECT_CPU.
739743 * In case alloc_cpumask_var() fails, bind it to
740744 * VMBUS_CONNECT_CPU.
745+ * If all the cpus are isolated, bind it to
746+ * VMBUS_CONNECT_CPU.
741747 */
742748 channel->target_cpu = VMBUS_CONNECT_CPU;
743749 if (perf_chn)
@@ -758,17 +764,19 @@ static void init_vp_index(struct vmbus_channel *channel) · 14 unmodified lines
758764 }
759765 allocated_mask = &hv_context.hv_numa_map[numa_node];
760766
761− if (cpumask_equal(allocated_mask, cpumask_of_node(numa_node))) {
767+retry:
768+ cpumask_xor(available_mask, allocated_mask, cpumask_of_node(numa_node));
769+ cpumask_and(available_mask, available_mask, hk_mask);
770+
771+ if (cpumask_empty(available_mask)) {
762772 /*
763773 * We have cycled through all the CPUs in the node;
764774 * reset the allocated map.
765775 */
766776 cpumask_clear(allocated_mask);
777+ goto retry;
767778 }
768779
769− cpumask_xor(available_mask, allocated_mask,
770− cpumask_of_node(numa_node));
771−
772780 target_cpu = cpumask_first(available_mask);
773781 cpumask_set_cpu(target_cpu, allocated_mask);
774782
drivers/hv/hv_kvp.c+1−1
@@ -394,7 +394,7 @@ kvp_send_key(struct work_struct *dummy) · 393 unmodified lines
394394 in_msg = kvp_transaction.kvp_msg;
395395
396396 /*
397− * The key/value strings sent from the host are encoded in
397+ * The key/value strings sent from the host are encoded
398398 * in utf16; convert it to utf8 strings.
399399 * The host assures us that the utf16 strings will not exceed
400400 * the max lengths specified. We will however, reserve room
drivers/hv/vmbus_drv.c+4−0
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #include <linux/kernel_stat.h>
2222 #include <linux/clockchips.h>
2323 #include <linux/cpu.h>
24+#include <linux/sched/isolation.h>
2425 #include <linux/sched/task_stack.h>
2526
2627 #include <linux/delay.h>
@@ -1770,6 +1771,9 @@ static ssize_t target_cpu_store(struct vmbus_channel *channel, · 1743 unmodified lines
17701771 if (target_cpu >= nr_cpumask_bits)
17711772 return -EINVAL;
17721773
1774+ if (!cpumask_test_cpu(target_cpu, housekeeping_cpumask(HK_TYPE_MANAGED_IRQ)))
1775+ return -EINVAL;
1776+
17731777 /* No CPUs should come up or down during this. */
17741778 cpus_read_lock();
17751779
drivers/hwmon/asus-ec-sensors.c+1−1
@@ -259,7 +259,7 @@ static const struct ec_board_info board_info[] = { · 258 unmodified lines
259259 },
260260 {
261261 .board_names = {
262− "ROG CROSSHAIR VIII FORMULA"
262+ "ROG CROSSHAIR VIII FORMULA",
263263 "ROG CROSSHAIR VIII HERO",
264264 "ROG CROSSHAIR VIII HERO (WI-FI)",
265265 },
drivers/hwmon/occ/common.c+5−0
@@ -1228,10 +1228,15 @@ EXPORT_SYMBOL_GPL(occ_setup); · 1227 unmodified lines
12281228
12291229 void occ_shutdown(struct occ *occ)
12301230 {
1231+ mutex_lock(&occ->lock);
1232+
12311233 occ_shutdown_sysfs(occ);
12321234
12331235 if (occ->hwmon)
12341236 hwmon_device_unregister(occ->hwmon);
1237+ occ->hwmon = NULL;
1238+
1239+ mutex_unlock(&occ->lock);
12351240 }
12361241 EXPORT_SYMBOL_GPL(occ_shutdown);
12371242
drivers/i2c/busses/i2c-designware-common.c+0−3
@@ -477,9 +477,6 @@ int i2c_dw_prepare_clk(struct dw_i2c_dev *dev, bool prepare) · 476 unmodified lines
477477 {
478478 int ret;
479479
480− if (IS_ERR(dev->clk))
481− return PTR_ERR(dev->clk);
482−
483480 if (prepare) {
484481 /* Optional interface clock */
485482 ret = clk_prepare_enable(dev->pclk);
drivers/i2c/busses/i2c-designware-platdrv.c+11−2
@@ -320,8 +320,17 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) · 319 unmodified lines
320320 goto exit_reset;
321321 }
322322
323− dev->clk = devm_clk_get(&pdev->dev, NULL);
324− if (!i2c_dw_prepare_clk(dev, true)) {
323+ dev->clk = devm_clk_get_optional(&pdev->dev, NULL);
324+ if (IS_ERR(dev->clk)) {
325+ ret = PTR_ERR(dev->clk);
326+ goto exit_reset;
327+ }
328+
329+ ret = i2c_dw_prepare_clk(dev, true);
330+ if (ret)
331+ goto exit_reset;
332+
333+ if (dev->clk) {
325334 u64 clk_khz;
326335
327336 dev->get_clk_rate_khz = i2c_dw_get_clk_rate_khz;
drivers/i2c/busses/i2c-mt65xx.c+7−2
@@ -1420,17 +1420,22 @@ static int mtk_i2c_probe(struct platform_device *pdev) · 1419 unmodified lines
14201420 if (ret < 0) {
14211421 dev_err(&pdev->dev,
14221422 "Request I2C IRQ %d fail\n", irq);
1423− return ret;
1423+ goto err_bulk_unprepare;
14241424 }
14251425
14261426 i2c_set_adapdata(&i2c->adap, i2c);
14271427 ret = i2c_add_adapter(&i2c->adap);
14281428 if (ret)
1429− return ret;
1429+ goto err_bulk_unprepare;
14301430
14311431 platform_set_drvdata(pdev, i2c);
14321432
14331433 return 0;
1434+
1435+err_bulk_unprepare:
1436+ clk_bulk_unprepare(I2C_MT65XX_CLK_MAX, i2c->clocks);
1437+
1438+ return ret;
14341439 }
14351440
14361441 static int mtk_i2c_remove(struct platform_device *pdev)
drivers/i2c/busses/i2c-npcm7xx.c+1−2
@@ -2372,8 +2372,7 @@ static struct platform_driver npcm_i2c_bus_driver = { · 2371 unmodified lines
23722372 static int __init npcm_i2c_init(void)
23732373 {
23742374 npcm_i2c_debugfs_dir = debugfs_create_dir("npcm_i2c", NULL);
2375− platform_driver_register(&npcm_i2c_bus_driver);
2376− return 0;
2375+ return platform_driver_register(&npcm_i2c_bus_driver);
23772376 }
23782377 module_init(npcm_i2c_init);
23792378
drivers/iio/accel/bma180.c+2−1
@@ -1006,11 +1006,12 @@ static int bma180_probe(struct i2c_client *client, · 1005 unmodified lines
10061006
10071007 data->trig->ops = &bma180_trigger_ops;
10081008 iio_trigger_set_drvdata(data->trig, indio_dev);
1009− indio_dev->trig = iio_trigger_get(data->trig);
10101009
10111010 ret = iio_trigger_register(data->trig);
10121011 if (ret)
10131012 goto err_trigger_free;
1013+
1014+ indio_dev->trig = iio_trigger_get(data->trig);
10141015 }
10151016
10161017 ret = iio_triggered_buffer_setup(indio_dev, NULL,
drivers/iio/accel/kxcjk-1013.c+2−2
@@ -1554,12 +1554,12 @@ static int kxcjk1013_probe(struct i2c_client *client, · 1553 unmodified lines
15541554
15551555 data->dready_trig->ops = &kxcjk1013_trigger_ops;
15561556 iio_trigger_set_drvdata(data->dready_trig, indio_dev);
1557− indio_dev->trig = data->dready_trig;
1558− iio_trigger_get(indio_dev->trig);
15591557 ret = iio_trigger_register(data->dready_trig);
15601558 if (ret)
15611559 goto err_poweroff;
15621560
1561+ indio_dev->trig = iio_trigger_get(data->dready_trig);
1562+
15631563 data->motion_trig->ops = &kxcjk1013_trigger_ops;
15641564 iio_trigger_set_drvdata(data->motion_trig, indio_dev);
15651565 ret = iio_trigger_register(data->motion_trig);
drivers/iio/accel/mma8452.c+14−8
@@ -1511,10 +1511,14 @@ static int mma8452_reset(struct i2c_client *client) · 1510 unmodified lines
15111511 int i;
15121512 int ret;
15131513
1514− ret = i2c_smbus_write_byte_data(client, MMA8452_CTRL_REG2,
1514+ /*
1515+ * Find on fxls8471, after config reset bit, it reset immediately,
1516+ * and will not give ACK, so here do not check the return value.
1517+ * The following code will read the reset register, and check whether
1518+ * this reset works.
1519+ */
1520+ i2c_smbus_write_byte_data(client, MMA8452_CTRL_REG2,
15151521 MMA8452_CTRL_REG2_RST);
1516− if (ret < 0)
1517− return ret;
15181522
15191523 for (i = 0; i < 10; i++) {
15201524 usleep_range(100, 200);
@@ -1557,11 +1561,13 @@ static int mma8452_probe(struct i2c_client *client, · 36 unmodified lines
15571561 mutex_init(&data->lock);
15581562
15591563 data->chip_info = device_get_match_data(&client->dev);
1560− if (!data->chip_info && id) {
1561− data->chip_info = &mma_chip_info_table[id->driver_data];
1562− } else {
1563− dev_err(&client->dev, "unknown device model\n");
1564− return -ENODEV;
1564+ if (!data->chip_info) {
1565+ if (id) {
1566+ data->chip_info = &mma_chip_info_table[id->driver_data];
1567+ } else {
1568+ dev_err(&client->dev, "unknown device model\n");
1569+ return -ENODEV;
1570+ }
15651571 }
15661572
15671573 ret = iio_read_mount_matrix(&client->dev, &data->orientation);
drivers/iio/accel/mxc4005.c+2−2
@@ -456,8 +456,6 @@ static int mxc4005_probe(struct i2c_client *client, · 455 unmodified lines
456456
457457 data->dready_trig->ops = &mxc4005_trigger_ops;
458458 iio_trigger_set_drvdata(data->dready_trig, indio_dev);
459− indio_dev->trig = data->dready_trig;
460− iio_trigger_get(indio_dev->trig);
461459 ret = devm_iio_trigger_register(&client->dev,
462460 data->dready_trig);
463461 if (ret) {
@@ -465,6 +463,8 @@ static int mxc4005_probe(struct i2c_client *client, · 1 unmodified line
465463 "failed to register trigger\n");
466464 return ret;
467465 }
466+
467+ indio_dev->trig = iio_trigger_get(data->dready_trig);
468468 }
469469
470470 return devm_iio_device_register(&client->dev, indio_dev);
drivers/iio/adc/adi-axi-adc.c+3−0
@@ -322,16 +322,19 @@ static struct adi_axi_adc_client *adi_axi_adc_attach_client(struct device *dev) · 321 unmodified lines
322322
323323 if (!try_module_get(cl->dev->driver->owner)) {
324324 mutex_unlock(&registered_clients_lock);
325+ of_node_put(cln);
325326 return ERR_PTR(-ENODEV);
326327 }
327328
328329 get_device(cl->dev);
329330 cl->info = info;
330331 mutex_unlock(&registered_clients_lock);
332+ of_node_put(cln);
331333 return cl;
332334 }
333335
334336 mutex_unlock(&registered_clients_lock);
337+ of_node_put(cln);
335338
336339 return ERR_PTR(-EPROBE_DEFER);
337340 }
drivers/iio/adc/aspeed_adc.c+1−0
@@ -186,6 +186,7 @@ static int aspeed_adc_set_trim_data(struct iio_dev *indio_dev) · 185 unmodified lines
186186 return -EOPNOTSUPP;
187187 }
188188 scu = syscon_node_to_regmap(syscon);
189+ of_node_put(syscon);
189190 if (IS_ERR(scu)) {
190191 dev_warn(data->dev, "Failed to get syscon regmap\n");
191192 return -EOPNOTSUPP;
drivers/iio/adc/axp288_adc.c+8−0
@@ -196,6 +196,14 @@ static const struct dmi_system_id axp288_adc_ts_bias_override[] = { · 195 unmodified lines
196196 },
197197 .driver_data = (void *)(uintptr_t)AXP288_ADC_TS_BIAS_80UA,
198198 },
199+ {
200+ /* Nuvision Solo 10 Draw */
201+ .matches = {
202+ DMI_MATCH(DMI_SYS_VENDOR, "TMAX"),
203+ DMI_MATCH(DMI_PRODUCT_NAME, "TM101W610L"),
204+ },
205+ .driver_data = (void *)(uintptr_t)AXP288_ADC_TS_BIAS_80UA,
206+ },
199207 {}
200208 };
201209
drivers/iio/adc/rzg2l_adc.c+6−2
@@ -334,11 +334,15 @@ static int rzg2l_adc_parse_properties(struct platform_device *pdev, struct rzg2l · 333 unmodified lines
334334 i = 0;
335335 device_for_each_child_node(&pdev->dev, fwnode) {
336336 ret = fwnode_property_read_u32(fwnode, "reg", &channel);
337− if (ret)
337+ if (ret) {
338+ fwnode_handle_put(fwnode);
338339 return ret;
340+ }
339341
340− if (channel >= RZG2L_ADC_MAX_CHANNELS)
342+ if (channel >= RZG2L_ADC_MAX_CHANNELS) {
343+ fwnode_handle_put(fwnode);
341344 return -EINVAL;
345+ }
342346
343347 chan_array[i].type = IIO_VOLTAGE;
344348 chan_array[i].indexed = 1;
drivers/iio/adc/stm32-adc-core.c+7−2
@@ -64,6 +64,7 @@ struct stm32_adc_priv; · 63 unmodified lines
6464 * @max_clk_rate_hz: maximum analog clock rate (Hz, from datasheet)
6565 * @has_syscfg: SYSCFG capability flags
6666 * @num_irqs: number of interrupt lines
67+ * @num_adcs: maximum number of ADC instances in the common registers
6768 */
6869 struct stm32_adc_priv_cfg {
6970 const struct stm32_adc_common_regs *regs;
@@ -71,6 +72,7 @@ struct stm32_adc_priv_cfg { · 1 unmodified line
7172 u32 max_clk_rate_hz;
7273 unsigned int has_syscfg;
7374 unsigned int num_irqs;
75+ unsigned int num_adcs;
7476 };
7577
7678 /**
@@ -352,7 +354,7 @@ static void stm32_adc_irq_handler(struct irq_desc *desc) · 275 unmodified lines
352354 * before invoking the interrupt handler (e.g. call ISR only for
353355 * IRQ-enabled ADCs).
354356 */
355− for (i = 0; i < priv->cfg->num_irqs; i++) {
357+ for (i = 0; i < priv->cfg->num_adcs; i++) {
356358 if ((status & priv->cfg->regs->eoc_msk[i] &&
357359 stm32_adc_eoc_enabled(priv, i)) ||
358360 (status & priv->cfg->regs->ovr_msk[i]))
@@ -792,6 +794,7 @@ static const struct stm32_adc_priv_cfg stm32f4_adc_priv_cfg = { · 433 unmodified lines
792794 .clk_sel = stm32f4_adc_clk_sel,
793795 .max_clk_rate_hz = 36000000,
794796 .num_irqs = 1,
797+ .num_adcs = 3,
795798 };
796799
797800 static const struct stm32_adc_priv_cfg stm32h7_adc_priv_cfg = {
@@ -800,14 +803,16 @@ static const struct stm32_adc_priv_cfg stm32h7_adc_priv_cfg = { · 2 unmodified lines
800803 .max_clk_rate_hz = 36000000,
801804 .has_syscfg = HAS_VBOOSTER,
802805 .num_irqs = 1,
806+ .num_adcs = 2,
803807 };
804808
805809 static const struct stm32_adc_priv_cfg stm32mp1_adc_priv_cfg = {
806810 .regs = &stm32h7_adc_common_regs,
807811 .clk_sel = stm32h7_adc_clk_sel,
808− .max_clk_rate_hz = 40000000,
812+ .max_clk_rate_hz = 36000000,
809813 .has_syscfg = HAS_VBOOSTER | HAS_ANASWVDD,
810814 .num_irqs = 2,
815+ .num_adcs = 2,
811816 };
812817
813818 static const struct of_device_id stm32_adc_of_match[] = {
drivers/iio/adc/stm32-adc.c+17−20
@@ -1365,7 +1365,7 @@ static int stm32_adc_read_raw(struct iio_dev *indio_dev, · 1364 unmodified lines
13651365 else
13661366 ret = -EINVAL;
13671367
1368− if (mask == IIO_CHAN_INFO_PROCESSED && adc->vrefint.vrefint_cal)
1368+ if (mask == IIO_CHAN_INFO_PROCESSED)
13691369 *val = STM32_ADC_VREFINT_VOLTAGE * adc->vrefint.vrefint_cal / *val;
13701370
13711371 iio_device_release_direct_mode(indio_dev);
@@ -1407,7 +1407,6 @@ static irqreturn_t stm32_adc_threaded_isr(int irq, void *data) · 35 unmodified lines
14071407 struct stm32_adc *adc = iio_priv(indio_dev);
14081408 const struct stm32_adc_regspec *regs = adc->cfg->regs;
14091409 u32 status = stm32_adc_readl(adc, regs->isr_eoc.reg);
1410− u32 mask = stm32_adc_readl(adc, regs->ier_eoc.reg);
14111410
14121411 /* Check ovr status right now, as ovr mask should be already disabled */
14131412 if (status & regs->isr_ovr.mask) {
@@ -1422,11 +1421,6 @@ static irqreturn_t stm32_adc_threaded_isr(int irq, void *data) · 8 unmodified lines
14221421 return IRQ_HANDLED;
14231422 }
14241423
1425− if (!(status & mask))
1426− dev_err_ratelimited(&indio_dev->dev,
1427− "Unexpected IRQ: IER=0x%08x, ISR=0x%08x\n",
1428− mask, status);
1429−
14301424 return IRQ_NONE;
14311425 }
14321426
@@ -1436,10 +1430,6 @@ static irqreturn_t stm32_adc_isr(int irq, void *data) · 3 unmodified lines
14361430 struct stm32_adc *adc = iio_priv(indio_dev);
14371431 const struct stm32_adc_regspec *regs = adc->cfg->regs;
14381432 u32 status = stm32_adc_readl(adc, regs->isr_eoc.reg);
1439− u32 mask = stm32_adc_readl(adc, regs->ier_eoc.reg);
1440−
1441− if (!(status & mask))
1442− return IRQ_WAKE_THREAD;
14431433
14441434 if (status & regs->isr_ovr.mask) {
14451435 /*
@@ -1979,10 +1969,10 @@ static int stm32_adc_populate_int_ch(struct iio_dev *indio_dev, const char *ch_n · 533 unmodified lines
19791969
19801970 for (i = 0; i < STM32_ADC_INT_CH_NB; i++) {
19811971 if (!strncmp(stm32_adc_ic[i].name, ch_name, STM32_ADC_CH_SZ)) {
1982− adc->int_ch[i] = chan;
1983−
1984− if (stm32_adc_ic[i].idx != STM32_ADC_INT_CH_VREFINT)
1985− continue;
1972+ if (stm32_adc_ic[i].idx != STM32_ADC_INT_CH_VREFINT) {
1973+ adc->int_ch[i] = chan;
1974+ break;
1975+ }
19861976
19871977 /* Get calibration data for vrefint channel */
19881978 ret = nvmem_cell_read_u16(&indio_dev->dev, "vrefint", &vrefint);
@@ -1990,10 +1980,15 @@ static int stm32_adc_populate_int_ch(struct iio_dev *indio_dev, const char *ch_n · 1 unmodified line
19901980 return dev_err_probe(indio_dev->dev.parent, ret,
19911981 "nvmem access error\n");
19921982 }
1993− if (ret == -ENOENT)
1994− dev_dbg(&indio_dev->dev, "vrefint calibration not found\n");
1995− else
1996− adc->vrefint.vrefint_cal = vrefint;
1983+ if (ret == -ENOENT) {
1984+ dev_dbg(&indio_dev->dev, "vrefint calibration not found. Skip vrefint channel\n");
1985+ return ret;
1986+ } else if (!vrefint) {
1987+ dev_dbg(&indio_dev->dev, "Null vrefint calibration value. Skip vrefint channel\n");
1988+ return -ENOENT;
1989+ }
1990+ adc->int_ch[i] = chan;
1991+ adc->vrefint.vrefint_cal = vrefint;
19971992 }
19981993 }
19991994
@@ -2030,7 +2025,9 @@ static int stm32_adc_generic_chan_init(struct iio_dev *indio_dev, · 30 unmodified lines
20302025 }
20312026 strncpy(adc->chan_name[val], name, STM32_ADC_CH_SZ);
20322027 ret = stm32_adc_populate_int_ch(indio_dev, name, val);
2033− if (ret)
2028+ if (ret == -ENOENT)
2029+ continue;
2030+ else if (ret)
20342031 goto err;
20352032 } else if (ret != -EINVAL) {
20362033 dev_err(&indio_dev->dev, "Invalid label %d\n", ret);
drivers/iio/adc/ti-ads131e08.c+7−3
@@ -739,7 +739,7 @@ static int ads131e08_alloc_channels(struct iio_dev *indio_dev) · 738 unmodified lines
739739 device_for_each_child_node(dev, node) {
740740 ret = fwnode_property_read_u32(node, "reg", &channel);
741741 if (ret)
742− return ret;
742+ goto err_child_out;
743743
744744 ret = fwnode_property_read_u32(node, "ti,gain", &tmp);
745745 if (ret) {
@@ -747,7 +747,7 @@ static int ads131e08_alloc_channels(struct iio_dev *indio_dev) · 1 unmodified line
747747 } else {
748748 ret = ads131e08_pga_gain_to_field_value(st, tmp);
749749 if (ret < 0)
750− return ret;
750+ goto err_child_out;
751751
752752 channel_config[i].pga_gain = tmp;
753753 }
@@ -758,7 +758,7 @@ static int ads131e08_alloc_channels(struct iio_dev *indio_dev) · 4 unmodified lines
758758 } else {
759759 ret = ads131e08_validate_channel_mux(st, tmp);
760760 if (ret)
761− return ret;
761+ goto err_child_out;
762762
763763 channel_config[i].mux = tmp;
764764 }
@@ -784,6 +784,10 @@ static int ads131e08_alloc_channels(struct iio_dev *indio_dev) · 19 unmodified lines
784784 st->channel_config = channel_config;
785785
786786 return 0;
787+
788+err_child_out:
789+ fwnode_handle_put(node);
790+ return ret;
787791 }
788792
789793 static void ads131e08_regulator_disable(void *data)
drivers/iio/adc/xilinx-ams.c+1−1
@@ -1409,7 +1409,7 @@ static int ams_probe(struct platform_device *pdev) · 1408 unmodified lines
14091409
14101410 irq = platform_get_irq(pdev, 0);
14111411 if (irq < 0)
1412− return ret;
1412+ return irq;
14131413
14141414 ret = devm_request_irq(&pdev->dev, irq, &ams_irq, 0, "ams-irq",
14151415 indio_dev);
drivers/iio/afe/iio-rescale.c+1−1
@@ -277,7 +277,7 @@ static int rescale_configure_channel(struct device *dev, · 276 unmodified lines
277277 chan->ext_info = rescale->ext_info;
278278 chan->type = rescale->cfg->type;
279279
280− if (iio_channel_has_info(schan, IIO_CHAN_INFO_RAW) ||
280+ if (iio_channel_has_info(schan, IIO_CHAN_INFO_RAW) &&
281281 iio_channel_has_info(schan, IIO_CHAN_INFO_SCALE)) {
282282 dev_info(dev, "using raw+scale source channel\n");
283283 } else if (iio_channel_has_info(schan, IIO_CHAN_INFO_PROCESSED)) {
drivers/iio/chemical/ccs811.c+2−2
@@ -499,11 +499,11 @@ static int ccs811_probe(struct i2c_client *client, · 498 unmodified lines
499499
500500 data->drdy_trig->ops = &ccs811_trigger_ops;
501501 iio_trigger_set_drvdata(data->drdy_trig, indio_dev);
502− indio_dev->trig = data->drdy_trig;
503− iio_trigger_get(indio_dev->trig);
504502 ret = iio_trigger_register(data->drdy_trig);
505503 if (ret)
506504 goto err_poweroff;
505+
506+ indio_dev->trig = iio_trigger_get(data->drdy_trig);
507507 }
508508
509509 ret = iio_triggered_buffer_setup(indio_dev, NULL,
drivers/iio/frequency/admv1014.c+4−2
@@ -700,8 +700,10 @@ static int admv1014_init(struct admv1014_state *st) · 699 unmodified lines
700700 ADMV1014_DET_EN_MSK;
701701
702702 enable_reg = FIELD_PREP(ADMV1014_P1DB_COMPENSATION_MSK, st->p1db_comp ? 3 : 0) |
703− FIELD_PREP(ADMV1014_IF_AMP_PD_MSK, !(st->input_mode)) |
704− FIELD_PREP(ADMV1014_BB_AMP_PD_MSK, st->input_mode) |
703+ FIELD_PREP(ADMV1014_IF_AMP_PD_MSK,
704+ (st->input_mode == ADMV1014_IF_MODE) ? 0 : 1) |
705+ FIELD_PREP(ADMV1014_BB_AMP_PD_MSK,
706+ (st->input_mode == ADMV1014_IF_MODE) ? 1 : 0) |
705707 FIELD_PREP(ADMV1014_DET_EN_MSK, st->det_en);
706708
707709 return __admv1014_spi_update_bits(st, ADMV1014_REG_ENABLE, enable_reg_msk, enable_reg);
drivers/iio/gyro/mpu3050-core.c+1−0
@@ -875,6 +875,7 @@ static int mpu3050_power_up(struct mpu3050 *mpu3050) · 874 unmodified lines
875875 ret = regmap_update_bits(mpu3050->map, MPU3050_PWR_MGM,
876876 MPU3050_PWR_MGM_SLEEP, 0);
877877 if (ret) {
878+ regulator_bulk_disable(ARRAY_SIZE(mpu3050->regs), mpu3050->regs);
878879 dev_err(mpu3050->dev, "error setting power mode\n");
879880 return ret;
880881 }
drivers/iio/humidity/hts221_buffer.c+4−1
@@ -135,9 +135,12 @@ int hts221_allocate_trigger(struct iio_dev *iio_dev) · 134 unmodified lines
135135
136136 iio_trigger_set_drvdata(hw->trig, iio_dev);
137137 hw->trig->ops = &hts221_trigger_ops;
138+
139+ err = devm_iio_trigger_register(hw->dev, hw->trig);
140+
138141 iio_dev->trig = iio_trigger_get(hw->trig);
139142
140− return devm_iio_trigger_register(hw->dev, hw->trig);
143+ return err;
141144 }
142145
143146 static int hts221_buffer_preenable(struct iio_dev *iio_dev)
drivers/iio/imu/inv_icm42600/inv_icm42600.h+1−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include "inv_icm42600_buffer.h"
1818
1919 enum inv_icm42600_chip {
20+ INV_CHIP_INVALID,
2021 INV_CHIP_ICM42600,
2122 INV_CHIP_ICM42602,
2223 INV_CHIP_ICM42605,
drivers/iio/imu/inv_icm42600/inv_icm42600_core.c+1−1
@@ -565,7 +565,7 @@ int inv_icm42600_core_probe(struct regmap *regmap, int chip, int irq, · 564 unmodified lines
565565 bool open_drain;
566566 int ret;
567567
568− if (chip < 0 || chip >= INV_CHIP_NB) {
568+ if (chip <= INV_CHIP_INVALID || chip >= INV_CHIP_NB) {
569569 dev_err(dev, "invalid chip = %d\n", chip);
570570 return -ENODEV;
571571 }
drivers/iio/magnetometer/yamaha-yas530.c+1−1
@@ -639,7 +639,7 @@ static int yas532_get_calibration_data(struct yas5xx *yas5xx) · 638 unmodified lines
639639 dev_dbg(yas5xx->dev, "calibration data: %*ph\n", 14, data);
640640
641641 /* Sanity check, is this all zeroes? */
642− if (memchr_inv(data, 0x00, 13)) {
642+ if (memchr_inv(data, 0x00, 13) == NULL) {
643643 if (!(data[13] & BIT(7)))
644644 dev_warn(yas5xx->dev, "calibration is blank!\n");
645645 }
drivers/iio/proximity/sx9324.c+3−0
@@ -885,6 +885,9 @@ sx9324_get_default_reg(struct device *dev, int idx, · 884 unmodified lines
885885 break;
886886 ret = device_property_read_u32_array(dev, prop, pin_defs,
887887 ARRAY_SIZE(pin_defs));
888+ if (ret)
889+ break;
890+
888891 for (pin = 0; pin < SX9324_NUM_PINS; pin++)
889892 raw |= (pin_defs[pin] << (2 * pin)) &
890893 SX9324_REG_AFE_PH0_PIN_MASK(pin);
drivers/iio/test/Kconfig+1−1
@@ -6,7 +6,7 @@ · 5 unmodified lines
66 # Keep in alphabetical order
77 config IIO_RESCALE_KUNIT_TEST
88 bool "Test IIO rescale conversion functions"
9− depends on KUNIT=y && !IIO_RESCALE
9+ depends on KUNIT=y && IIO_RESCALE=y
1010 default KUNIT_ALL_TESTS
1111 help
1212 If you want to run tests on the iio-rescale code say Y here.
drivers/iio/test/Makefile+1−1
@@ -4,6 +4,6 @@ · 3 unmodified lines
44 #
55
66 # Keep in alphabetical order
7−obj-$(CONFIG_IIO_RESCALE_KUNIT_TEST) += iio-test-rescale.o ../afe/iio-rescale.o
7+obj-$(CONFIG_IIO_RESCALE_KUNIT_TEST) += iio-test-rescale.o
88 obj-$(CONFIG_IIO_TEST_FORMAT) += iio-test-format.o
99 CFLAGS_iio-test-format.o += $(DISABLE_STRUCTLEAK_PLUGIN)
drivers/iio/trigger/iio-trig-sysfs.c+1−0
@@ -190,6 +190,7 @@ static int iio_sysfs_trigger_remove(int id) · 189 unmodified lines
190190 }
191191
192192 iio_trigger_unregister(t->trig);
193+ irq_work_sync(&t->work);
193194 iio_trigger_free(t->trig);
194195
195196 list_del(&t->l);
drivers/iommu/ipmmu-vmsa.c+1−1
@@ -987,7 +987,7 @@ static const struct of_device_id ipmmu_of_ids[] = { · 986 unmodified lines
987987 .compatible = "renesas,ipmmu-r8a779a0",
988988 .data = &ipmmu_features_rcar_gen4,
989989 }, {
990− .compatible = "renesas,rcar-gen4-ipmmu",
990+ .compatible = "renesas,rcar-gen4-ipmmu-vmsa",
991991 .data = &ipmmu_features_rcar_gen4,
992992 }, {
993993 /* Terminator */
drivers/irqchip/Kconfig+1−1
@@ -298,7 +298,7 @@ config XTENSA_MX · 297 unmodified lines
298298
299299 config XILINX_INTC
300300 bool "Xilinx Interrupt Controller IP"
301− depends on MICROBLAZE || ARCH_ZYNQ || ARCH_ZYNQMP
301+ depends on OF
302302 select IRQ_DOMAIN
303303 help
304304 Support for the Xilinx Interrupt Controller IP core.
drivers/irqchip/irq-apple-aic.c+2−0
@@ -1035,6 +1035,7 @@ static void build_fiq_affinity(struct aic_irq_chip *ic, struct device_node *aff) · 1034 unmodified lines
10351035 continue;
10361036
10371037 cpu = of_cpu_node_to_id(cpu_node);
1038+ of_node_put(cpu_node);
10381039 if (WARN_ON(cpu < 0))
10391040 continue;
10401041
@@ -1143,6 +1144,7 @@ static int __init aic_of_ic_init(struct device_node *node, struct device_node *p · 102 unmodified lines
11431144 for_each_child_of_node(affs, chld)
11441145 build_fiq_affinity(irqc, chld);
11451146 }
1147+ of_node_put(affs);
11461148
11471149 set_handle_irq(aic_handle_irq);
11481150 set_handle_fiq(aic_handle_fiq);
drivers/irqchip/irq-gic-realview.c+1−0
@@ -57,6 +57,7 @@ realview_gic_of_init(struct device_node *node, struct device_node *parent) · 56 unmodified lines
5757
5858 /* The PB11MPCore GIC needs to be configured in the syscon */
5959 map = syscon_node_to_regmap(np);
60+ of_node_put(np);
6061 if (!IS_ERR(map)) {
6162 /* new irq mode with no DCC */
6263 regmap_write(map, REALVIEW_SYS_LOCK_OFFSET,
drivers/irqchip/irq-gic-v3.c+5−2
@@ -1932,7 +1932,7 @@ static void __init gic_populate_ppi_partitions(struct device_node *gic_node) · 1931 unmodified lines
19321932
19331933 gic_data.ppi_descs = kcalloc(gic_data.ppi_nr, sizeof(*gic_data.ppi_descs), GFP_KERNEL);
19341934 if (!gic_data.ppi_descs)
1935− return;
1935+ goto out_put_node;
19361936
19371937 nr_parts = of_get_child_count(parts_node);
19381938
@@ -1973,12 +1973,15 @@ static void __init gic_populate_ppi_partitions(struct device_node *gic_node) · 34 unmodified lines
19731973 continue;
19741974
19751975 cpu = of_cpu_node_to_id(cpu_node);
1976− if (WARN_ON(cpu < 0))
1976+ if (WARN_ON(cpu < 0)) {
1977+ of_node_put(cpu_node);
19771978 continue;
1979+ }
19781980
19791981 pr_cont("%pOF[%d] ", cpu_node, cpu);
19801982
19811983 cpumask_set_cpu(cpu, &part->mask);
1984+ of_node_put(cpu_node);
19821985 }
19831986
19841987 pr_cont("}\n");
drivers/irqchip/irq-loongson-liointc.c+7−1
@@ -39,6 +39,12 @@ · 38 unmodified lines
3939
4040 #define LIOINTC_ERRATA_IRQ 10
4141
42+#if defined(CONFIG_MIPS)
43+#define liointc_core_id get_ebase_cpunum()
44+#else
45+#define liointc_core_id get_csr_cpuid()
46+#endif
47+
4248 struct liointc_handler_data {
4349 struct liointc_priv *priv;
4450 u32 parent_int_map;
@@ -57,7 +63,7 @@ static void liointc_chained_handle_irq(struct irq_desc *desc) · 12 unmodified lines
5763 struct liointc_handler_data *handler = irq_desc_get_handler_data(desc);
5864 struct irq_chip *chip = irq_desc_get_chip(desc);
5965 struct irq_chip_generic *gc = handler->priv->gc;
60− int core = cpu_logical_map(smp_processor_id()) % LIOINTC_NUM_CORES;
66+ int core = liointc_core_id % LIOINTC_NUM_CORES;
6167 u32 pending;
6268
6369 chained_irq_enter(chip, desc);
drivers/irqchip/irq-realtek-rtl.c+1−1
@@ -134,9 +134,9 @@ static int __init map_interrupts(struct device_node *node, struct irq_domain *do · 133 unmodified lines
134134 if (!cpu_ictl)
135135 return -EINVAL;
136136 ret = of_property_read_u32(cpu_ictl, "#interrupt-cells", &tmp);
137+ of_node_put(cpu_ictl);
137138 if (ret || tmp != 1)
138139 return -EINVAL;
139− of_node_put(cpu_ictl);
140140
141141 cpu_int = be32_to_cpup(imap + 2);
142142 if (cpu_int > 7 || cpu_int < 2)
drivers/irqchip/irq-uniphier-aidet.c+1−0
@@ -237,6 +237,7 @@ static const struct of_device_id uniphier_aidet_match[] = { · 236 unmodified lines
237237 { .compatible = "socionext,uniphier-ld11-aidet" },
238238 { .compatible = "socionext,uniphier-ld20-aidet" },
239239 { .compatible = "socionext,uniphier-pxs3-aidet" },
240+ { .compatible = "socionext,uniphier-nx1-aidet" },
240241 { /* sentinel */ }
241242 };
242243
drivers/md/dm-core.h+1−0
@@ -272,6 +272,7 @@ struct dm_io { · 271 unmodified lines
272272 atomic_t io_count;
273273 struct mapped_device *md;
274274
275+ struct bio *split_bio;
275276 /* The three fields represent mapped part of original bio */
276277 struct bio *orig_bio;
277278 unsigned int sector_offset; /* offset to end of orig_bio */
drivers/md/dm-era-target.c+7−1
@@ -1400,7 +1400,7 @@ static void start_worker(struct era *era) · 1399 unmodified lines
14001400 static void stop_worker(struct era *era)
14011401 {
14021402 atomic_set(&era->suspended, 1);
1403− flush_workqueue(era->wq);
1403+ drain_workqueue(era->wq);
14041404 }
14051405
14061406 /*----------------------------------------------------------------
@@ -1570,6 +1570,12 @@ static void era_postsuspend(struct dm_target *ti) · 163 unmodified lines
15701570 }
15711571
15721572 stop_worker(era);
1573+
1574+ r = metadata_commit(era->md);
1575+ if (r) {
1576+ DMERR("%s: metadata_commit failed", __func__);
1577+ /* FIXME: fail mode */
1578+ }
15731579 }
15741580
15751581 static int era_preresume(struct dm_target *ti)
drivers/md/dm-log.c+2−3
@@ -415,8 +415,7 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti, · 414 unmodified lines
415415 /*
416416 * Work out how many "unsigned long"s we need to hold the bitset.
417417 */
418− bitset_size = dm_round_up(region_count,
419− sizeof(*lc->clean_bits) << BYTE_SHIFT);
418+ bitset_size = dm_round_up(region_count, BITS_PER_LONG);
420419 bitset_size >>= BYTE_SHIFT;
421420
422421 lc->bitset_uint32_count = bitset_size / sizeof(*lc->clean_bits);
@@ -616,7 +615,7 @@ static int disk_resume(struct dm_dirty_log *log) · 193 unmodified lines
616615 log_clear_bit(lc, lc->clean_bits, i);
617616
618617 /* clear any old bits -- device has shrunk */
619− for (i = lc->region_count; i % (sizeof(*lc->clean_bits) << BYTE_SHIFT); i++)
618+ for (i = lc->region_count; i % BITS_PER_LONG; i++)
620619 log_clear_bit(lc, lc->clean_bits, i);
621620
622621 /* copy clean across to sync */
drivers/md/dm-raid.c+1−1
@@ -3725,7 +3725,7 @@ static int raid_message(struct dm_target *ti, unsigned int argc, char **argv, · 3724 unmodified lines
37253725 if (!strcasecmp(argv[0], "idle") || !strcasecmp(argv[0], "frozen")) {
37263726 if (mddev->sync_thread) {
37273727 set_bit(MD_RECOVERY_INTR, &mddev->recovery);
3728− md_reap_sync_thread(mddev, false);
3728+ md_reap_sync_thread(mddev);
37293729 }
37303730 } else if (decipher_sync_action(mddev, mddev->recovery) != st_idle)
37313731 return -EBUSY;
drivers/md/dm.c+27−12
@@ -555,6 +555,10 @@ static void dm_start_io_acct(struct dm_io *io, struct bio *clone) · 554 unmodified lines
555555 unsigned long flags;
556556 /* Can afford locking given DM_TIO_IS_DUPLICATE_BIO */
557557 spin_lock_irqsave(&io->lock, flags);
558+ if (dm_io_flagged(io, DM_IO_ACCOUNTED)) {
559+ spin_unlock_irqrestore(&io->lock, flags);
560+ return;
561+ }
558562 dm_io_set_flag(io, DM_IO_ACCOUNTED);
559563 spin_unlock_irqrestore(&io->lock, flags);
560564 }
@@ -590,6 +594,7 @@ static struct dm_io *alloc_io(struct mapped_device *md, struct bio *bio) · 29 unmodified lines
590594 atomic_set(&io->io_count, 2);
591595 this_cpu_inc(*md->pending_io);
592596 io->orig_bio = bio;
597+ io->split_bio = NULL;
593598 io->md = md;
594599 spin_lock_init(&io->lock);
595600 io->start_time = jiffies;
@@ -711,18 +716,18 @@ static void dm_put_live_table_fast(struct mapped_device *md) __releases(RCU) · 115 unmodified lines
711716 }
712717
713718 static inline struct dm_table *dm_get_live_table_bio(struct mapped_device *md,
714− int *srcu_idx, struct bio *bio)
719+ int *srcu_idx, unsigned bio_opf)
715720 {
716− if (bio->bi_opf & REQ_NOWAIT)
721+ if (bio_opf & REQ_NOWAIT)
717722 return dm_get_live_table_fast(md);
718723 else
719724 return dm_get_live_table(md, srcu_idx);
720725 }
721726
722727 static inline void dm_put_live_table_bio(struct mapped_device *md, int srcu_idx,
723− struct bio *bio)
728+ unsigned bio_opf)
724729 {
725− if (bio->bi_opf & REQ_NOWAIT)
730+ if (bio_opf & REQ_NOWAIT)
726731 dm_put_live_table_fast(md);
727732 else
728733 dm_put_live_table(md, srcu_idx);
@@ -883,7 +888,7 @@ static void dm_io_complete(struct dm_io *io) · 154 unmodified lines
883888 {
884889 blk_status_t io_error;
885890 struct mapped_device *md = io->md;
886− struct bio *bio = io->orig_bio;
891+ struct bio *bio = io->split_bio ? io->split_bio : io->orig_bio;
887892
888893 if (io->status == BLK_STS_DM_REQUEUE) {
889894 unsigned long flags;
@@ -935,9 +940,11 @@ static void dm_io_complete(struct dm_io *io) · 45 unmodified lines
935940 if (io_error == BLK_STS_AGAIN) {
936941 /* io_uring doesn't handle BLK_STS_AGAIN (yet) */
937942 queue_io(md, bio);
943+ return;
938944 }
939945 }
940− return;
946+ if (io_error == BLK_STS_DM_REQUEUE)
947+ return;
941948 }
942949
943950 if (bio_is_flush_with_data(bio)) {
@@ -1609,7 +1616,12 @@ static blk_status_t __split_and_process_bio(struct clone_info *ci) · 665 unmodified lines
16091616 ti = dm_table_find_target(ci->map, ci->sector);
16101617 if (unlikely(!ti))
16111618 return BLK_STS_IOERR;
1612− else if (unlikely(ci->is_abnormal_io))
1619+
1620+ if (unlikely((ci->bio->bi_opf & REQ_NOWAIT) != 0) &&
1621+ unlikely(!dm_target_supports_nowait(ti->type)))
1622+ return BLK_STS_NOTSUPP;
1623+
1624+ if (unlikely(ci->is_abnormal_io))
16131625 return __process_abnormal_io(ci, ti);
16141626
16151627 /*
@@ -1682,9 +1694,11 @@ static void dm_split_and_process_bio(struct mapped_device *md, · 66 unmodified lines
16821694 * Remainder must be passed to submit_bio_noacct() so it gets handled
16831695 * *after* bios already submitted have been completely processed.
16841696 */
1685− bio_trim(bio, io->sectors, ci.sector_count);
1686− trace_block_split(bio, bio->bi_iter.bi_sector);
1687− bio_inc_remaining(bio);
1697+ WARN_ON_ONCE(!dm_io_flagged(io, DM_IO_WAS_SPLIT));
1698+ io->split_bio = bio_split(bio, io->sectors, GFP_NOIO,
1699+ &md->queue->bio_split);
1700+ bio_chain(io->split_bio, bio);
1701+ trace_block_split(io->split_bio, bio->bi_iter.bi_sector);
16881702 submit_bio_noacct(bio);
16891703 out:
16901704 /*
@@ -1711,8 +1725,9 @@ static void dm_submit_bio(struct bio *bio) · 20 unmodified lines
17111725 struct mapped_device *md = bio->bi_bdev->bd_disk->private_data;
17121726 int srcu_idx;
17131727 struct dm_table *map;
1728+ unsigned bio_opf = bio->bi_opf;
17141729
1715− map = dm_get_live_table_bio(md, &srcu_idx, bio);
1730+ map = dm_get_live_table_bio(md, &srcu_idx, bio_opf);
17161731
17171732 /* If suspended, or map not yet available, queue this IO for later */
17181733 if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags)) ||
@@ -1728,7 +1743,7 @@ static void dm_submit_bio(struct bio *bio) · 9 unmodified lines
17281743
17291744 dm_split_and_process_bio(md, map, bio);
17301745 out:
1731− dm_put_live_table_bio(md, srcu_idx, bio);
1746+ dm_put_live_table_bio(md, srcu_idx, bio_opf);
17321747 }
17331748
17341749 static bool dm_poll_dm_io(struct dm_io *io, struct io_comp_batch *iob,
drivers/md/md.c+5−9
@@ -4831,7 +4831,7 @@ action_store(struct mddev *mddev, const char *page, size_t len) · 4830 unmodified lines
48314831 flush_workqueue(md_misc_wq);
48324832 if (mddev->sync_thread) {
48334833 set_bit(MD_RECOVERY_INTR, &mddev->recovery);
4834− md_reap_sync_thread(mddev, true);
4834+ md_reap_sync_thread(mddev);
48354835 }
48364836 mddev_unlock(mddev);
48374837 }
@@ -6197,7 +6197,7 @@ static void __md_stop_writes(struct mddev *mddev) · 1359 unmodified lines
61976197 flush_workqueue(md_misc_wq);
61986198 if (mddev->sync_thread) {
61996199 set_bit(MD_RECOVERY_INTR, &mddev->recovery);
6200− md_reap_sync_thread(mddev, true);
6200+ md_reap_sync_thread(mddev);
62016201 }
62026202
62036203 del_timer_sync(&mddev->safemode_timer);
@@ -9303,7 +9303,7 @@ void md_check_recovery(struct mddev *mddev) · 3099 unmodified lines
93039303 * ->spare_active and clear saved_raid_disk
93049304 */
93059305 set_bit(MD_RECOVERY_INTR, &mddev->recovery);
9306− md_reap_sync_thread(mddev, true);
9306+ md_reap_sync_thread(mddev);
93079307 clear_bit(MD_RECOVERY_RECOVER, &mddev->recovery);
93089308 clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
93099309 clear_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags);
@@ -9338,7 +9338,7 @@ void md_check_recovery(struct mddev *mddev) · 28 unmodified lines
93389338 goto unlock;
93399339 }
93409340 if (mddev->sync_thread) {
9341− md_reap_sync_thread(mddev, true);
9341+ md_reap_sync_thread(mddev);
93429342 goto unlock;
93439343 }
93449344 /* Set RUNNING before clearing NEEDED to avoid
@@ -9411,18 +9411,14 @@ void md_check_recovery(struct mddev *mddev) · 66 unmodified lines
94119411 }
94129412 EXPORT_SYMBOL(md_check_recovery);
94139413
9414−void md_reap_sync_thread(struct mddev *mddev, bool reconfig_mutex_held)
9414+void md_reap_sync_thread(struct mddev *mddev)
94159415 {
94169416 struct md_rdev *rdev;
94179417 sector_t old_dev_sectors = mddev->dev_sectors;
94189418 bool is_reshaped = false;
94199419
9420− if (reconfig_mutex_held)
9421− mddev_unlock(mddev);
94229420 /* resync has finished, collect result */
94239421 md_unregister_thread(&mddev->sync_thread);
9424− if (reconfig_mutex_held)
9425− mddev_lock_nointr(mddev);
94269422 if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery) &&
94279423 !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery) &&
94289424 mddev->degraded != mddev->raid_disks) {
drivers/md/md.h+1−1
@@ -719,7 +719,7 @@ extern struct md_thread *md_register_thread( · 718 unmodified lines
719719 extern void md_unregister_thread(struct md_thread **threadp);
720720 extern void md_wakeup_thread(struct md_thread *thread);
721721 extern void md_check_recovery(struct mddev *mddev);
722−extern void md_reap_sync_thread(struct mddev *mddev, bool reconfig_mutex_held);
722+extern void md_reap_sync_thread(struct mddev *mddev);
723723 extern int mddev_init_writes_pending(struct mddev *mddev);
724724 extern bool md_write_start(struct mddev *mddev, struct bio *bi);
725725 extern void md_write_inc(struct mddev *mddev, struct bio *bi);
drivers/md/raid5-ppl.c+2−2
@@ -629,9 +629,9 @@ static void ppl_do_flush(struct ppl_io_unit *io) · 628 unmodified lines
629629 if (bdev) {
630630 struct bio *bio;
631631
632− bio = bio_alloc_bioset(bdev, 0, GFP_NOIO,
632+ bio = bio_alloc_bioset(bdev, 0,
633633 REQ_OP_WRITE | REQ_PREFLUSH,
634− &ppl_conf->flush_bs);
634+ GFP_NOIO, &ppl_conf->flush_bs);
635635 bio->bi_private = io;
636636 bio->bi_end_io = ppl_flush_endio;
637637
drivers/memory/Kconfig+1−0
@@ -105,6 +105,7 @@ config TI_EMIF · 104 unmodified lines
105105 config OMAP_GPMC
106106 tristate "Texas Instruments OMAP SoC GPMC driver"
107107 depends on OF_ADDRESS
108+ depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
108109 select GPIOLIB
109110 help
110111 This driver is for the General Purpose Memory Controller (GPMC)
drivers/memory/mtk-smi.c+4−1
@@ -404,13 +404,16 @@ static int mtk_smi_device_link_common(struct device *dev, struct device **com_de · 403 unmodified lines
404404 of_node_put(smi_com_node);
405405 if (smi_com_pdev) {
406406 /* smi common is the supplier, Make sure it is ready before */
407− if (!platform_get_drvdata(smi_com_pdev))
407+ if (!platform_get_drvdata(smi_com_pdev)) {
408+ put_device(&smi_com_pdev->dev);
408409 return -EPROBE_DEFER;
410+ }
409411 smi_com_dev = &smi_com_pdev->dev;
410412 link = device_link_add(dev, smi_com_dev,
411413 DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS);
412414 if (!link) {
413415 dev_err(dev, "Unable to link smi-common dev\n");
416+ put_device(&smi_com_pdev->dev);
414417 return -ENODEV;
415418 }
416419 *com_dev = smi_com_dev;
drivers/memory/samsung/exynos5422-dmc.c+18−11
@@ -1187,33 +1187,39 @@ static int of_get_dram_timings(struct exynos5_dmc *dmc) · 1186 unmodified lines
11871187
11881188 dmc->timing_row = devm_kmalloc_array(dmc->dev, TIMING_COUNT,
11891189 sizeof(u32), GFP_KERNEL);
1190− if (!dmc->timing_row)
1191− return -ENOMEM;
1190+ if (!dmc->timing_row) {
1191+ ret = -ENOMEM;
1192+ goto put_node;
1193+ }
11921194
11931195 dmc->timing_data = devm_kmalloc_array(dmc->dev, TIMING_COUNT,
11941196 sizeof(u32), GFP_KERNEL);
1195− if (!dmc->timing_data)
1196− return -ENOMEM;
1197+ if (!dmc->timing_data) {
1198+ ret = -ENOMEM;
1199+ goto put_node;
1200+ }
11971201
11981202 dmc->timing_power = devm_kmalloc_array(dmc->dev, TIMING_COUNT,
11991203 sizeof(u32), GFP_KERNEL);
1200− if (!dmc->timing_power)
1201− return -ENOMEM;
1204+ if (!dmc->timing_power) {
1205+ ret = -ENOMEM;
1206+ goto put_node;
1207+ }
12021208
12031209 dmc->timings = of_lpddr3_get_ddr_timings(np_ddr, dmc->dev,
12041210 DDR_TYPE_LPDDR3,
12051211 &dmc->timings_arr_size);
12061212 if (!dmc->timings) {
1207− of_node_put(np_ddr);
12081213 dev_warn(dmc->dev, "could not get timings from DT\n");
1209− return -EINVAL;
1214+ ret = -EINVAL;
1215+ goto put_node;
12101216 }
12111217
12121218 dmc->min_tck = of_lpddr3_get_min_tck(np_ddr, dmc->dev);
12131219 if (!dmc->min_tck) {
1214− of_node_put(np_ddr);
12151220 dev_warn(dmc->dev, "could not get tck from DT\n");
1216− return -EINVAL;
1221+ ret = -EINVAL;
1222+ goto put_node;
12171223 }
12181224
12191225 /* Sorted array of OPPs with frequency ascending */
@@ -1227,13 +1233,14 @@ static int of_get_dram_timings(struct exynos5_dmc *dmc) · 7 unmodified lines
12271233 clk_period_ps);
12281234 }
12291235
1230− of_node_put(np_ddr);
12311236
12321237 /* Take the highest frequency's timings as 'bypass' */
12331238 dmc->bypass_timing_row = dmc->timing_row[idx - 1];
12341239 dmc->bypass_timing_data = dmc->timing_data[idx - 1];
12351240 dmc->bypass_timing_power = dmc->timing_power[idx - 1];
12361241
1242+put_node:
1243+ of_node_put(np_ddr);
12371244 return ret;
12381245 }
12391246
drivers/misc/atmel-ssc.c+2−2
@@ -232,9 +232,9 @@ static int ssc_probe(struct platform_device *pdev) · 231 unmodified lines
232232 clk_disable_unprepare(ssc->clk);
233233
234234 ssc->irq = platform_get_irq(pdev, 0);
235− if (!ssc->irq) {
235+ if (ssc->irq < 0) {
236236 dev_dbg(&pdev->dev, "could not get irq\n");
237− return -ENXIO;
237+ return ssc->irq;
238238 }
239239
240240 mutex_lock(&user_lock);
drivers/misc/cardreader/rts5261.c+2−0
@@ -407,6 +407,8 @@ static void rts5261_init_from_hw(struct rtsx_pcr *pcr) · 406 unmodified lines
407407 // default
408408 setting_reg1 = PCR_SETTING_REG1;
409409 setting_reg2 = PCR_SETTING_REG2;
410+ } else {
411+ return;
410412 }
411413
412414 pci_read_config_dword(pdev, setting_reg2, &lval2);
drivers/misc/eeprom/at25.c+53−40
@@ -79,6 +79,11 @@ static int at25_ee_read(void *priv, unsigned int offset, · 78 unmodified lines
7979 {
8080 struct at25_data *at25 = priv;
8181 char *buf = val;
82+ size_t max_chunk = spi_max_transfer_size(at25->spi);
83+ size_t num_msgs = DIV_ROUND_UP(count, max_chunk);
84+ size_t nr_bytes = 0;
85+ unsigned int msg_offset;
86+ size_t msg_count;
8287 u8 *cp;
8388 ssize_t status;
8489 struct spi_transfer t[2];
@@ -92,54 +97,59 @@ static int at25_ee_read(void *priv, unsigned int offset, · 7 unmodified lines
9297 if (unlikely(!count))
9398 return -EINVAL;
9499
95− cp = at25->command;
100+ msg_offset = (unsigned int)offset;
101+ msg_count = min(count, max_chunk);
102+ while (num_msgs) {
103+ cp = at25->command;
96104
97− instr = AT25_READ;
98− if (at25->chip.flags & EE_INSTR_BIT3_IS_ADDR)
99− if (offset >= BIT(at25->addrlen * 8))
100− instr |= AT25_INSTR_BIT3;
105+ instr = AT25_READ;
106+ if (at25->chip.flags & EE_INSTR_BIT3_IS_ADDR)
107+ if (msg_offset >= BIT(at25->addrlen * 8))
108+ instr |= AT25_INSTR_BIT3;
101109
102− mutex_lock(&at25->lock);
110+ mutex_lock(&at25->lock);
103111
104− *cp++ = instr;
105−
106− /* 8/16/24-bit address is written MSB first */
107− switch (at25->addrlen) {
108− default: /* case 3 */
109− *cp++ = offset >> 16;
110− fallthrough;
111− case 2:
112− *cp++ = offset >> 8;
113− fallthrough;
114− case 1:
115− case 0: /* can't happen: for better code generation */
116− *cp++ = offset >> 0;
117− }
112+ *cp++ = instr;
118113
119− spi_message_init(&m);
120− memset(t, 0, sizeof(t));
114+ /* 8/16/24-bit address is written MSB first */
115+ switch (at25->addrlen) {
116+ default: /* case 3 */
117+ *cp++ = msg_offset >> 16;
118+ fallthrough;
119+ case 2:
120+ *cp++ = msg_offset >> 8;
121+ fallthrough;
122+ case 1:
123+ case 0: /* can't happen: for better code generation */
124+ *cp++ = msg_offset >> 0;
125+ }
121126
122− t[0].tx_buf = at25->command;
123− t[0].len = at25->addrlen + 1;
124− spi_message_add_tail(&t[0], &m);
127+ spi_message_init(&m);
128+ memset(t, 0, sizeof(t));
125129
126− t[1].rx_buf = buf;
127− t[1].len = count;
128− spi_message_add_tail(&t[1], &m);
130+ t[0].tx_buf = at25->command;
131+ t[0].len = at25->addrlen + 1;
132+ spi_message_add_tail(&t[0], &m);
129133
130− /*
131− * Read it all at once.
132− *
133− * REVISIT that's potentially a problem with large chips, if
134− * other devices on the bus need to be accessed regularly or
135− * this chip is clocked very slowly.
136− */
137− status = spi_sync(at25->spi, &m);
138− dev_dbg(&at25->spi->dev, "read %zu bytes at %d --> %zd\n",
139− count, offset, status);
134+ t[1].rx_buf = buf + nr_bytes;
135+ t[1].len = msg_count;
136+ spi_message_add_tail(&t[1], &m);
140137
141− mutex_unlock(&at25->lock);
142− return status;
138+ status = spi_sync(at25->spi, &m);
139+
140+ mutex_unlock(&at25->lock);
141+
142+ if (status)
143+ return status;
144+
145+ --num_msgs;
146+ msg_offset += msg_count;
147+ nr_bytes += msg_count;
148+ }
149+
150+ dev_dbg(&at25->spi->dev, "read %zu bytes at %d\n",
151+ count, offset);
152+ return 0;
143153 }
144154
145155 /* Read extra registers as ID or serial number */
@@ -190,6 +200,7 @@ ATTRIBUTE_GROUPS(sernum); · 44 unmodified lines
190200 static int at25_ee_write(void *priv, unsigned int off, void *val, size_t count)
191201 {
192202 struct at25_data *at25 = priv;
203+ size_t maxsz = spi_max_transfer_size(at25->spi);
193204 const char *buf = val;
194205 int status = 0;
195206 unsigned buf_size;
@@ -253,6 +264,8 @@ static int at25_ee_write(void *priv, unsigned int off, void *val, size_t count) · 57 unmodified lines
253264 segment = buf_size - (offset % buf_size);
254265 if (segment > count)
255266 segment = count;
267+ if (segment > maxsz)
268+ segment = maxsz;
256269 memcpy(cp, buf, segment);
257270 status = spi_write(at25->spi, bounce,
258271 segment + at25->addrlen + 1);
drivers/misc/mei/hbm.c+2−1
@@ -1351,7 +1351,8 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) · 1350 unmodified lines
13511351
13521352 if (dev->dev_state != MEI_DEV_INIT_CLIENTS ||
13531353 dev->hbm_state != MEI_HBM_CAP_SETUP) {
1354− if (dev->dev_state == MEI_DEV_POWER_DOWN) {
1354+ if (dev->dev_state == MEI_DEV_POWER_DOWN ||
1355+ dev->dev_state == MEI_DEV_POWERING_DOWN) {
13551356 dev_dbg(dev->dev, "hbm: capabilities response: on shutdown, ignoring\n");
13561357 return 0;
13571358 }
drivers/misc/mei/hw-me-regs.h+2−0
@@ -109,6 +109,8 @@ · 108 unmodified lines
109109 #define MEI_DEV_ID_ADP_P 0x51E0 /* Alder Lake Point P */
110110 #define MEI_DEV_ID_ADP_N 0x54E0 /* Alder Lake Point N */
111111
112+#define MEI_DEV_ID_RPL_S 0x7A68 /* Raptor Lake Point S */
113+
112114 /*
113115 * MEI HW Section
114116 */
drivers/misc/mei/hw-me.c+2−0
@@ -1154,6 +1154,8 @@ static int mei_me_hw_reset(struct mei_device *dev, bool intr_enable) · 1153 unmodified lines
11541154 ret = mei_me_d0i3_exit_sync(dev);
11551155 if (ret)
11561156 return ret;
1157+ } else {
1158+ hw->pg_state = MEI_PG_OFF;
11571159 }
11581160 }
11591161
drivers/misc/mei/pci-me.c+2−0
@@ -116,6 +116,8 @@ static const struct pci_device_id mei_me_pci_tbl[] = { · 115 unmodified lines
116116 {MEI_PCI_DEVICE(MEI_DEV_ID_ADP_P, MEI_ME_PCH15_CFG)},
117117 {MEI_PCI_DEVICE(MEI_DEV_ID_ADP_N, MEI_ME_PCH15_CFG)},
118118
119+ {MEI_PCI_DEVICE(MEI_DEV_ID_RPL_S, MEI_ME_PCH15_CFG)},
120+
119121 /* required last entry */
120122 {0, }
121123 };
drivers/mmc/host/mtk-sd.c+12−8
@@ -1356,7 +1356,7 @@ static void msdc_data_xfer_next(struct msdc_host *host, struct mmc_request *mrq) · 1355 unmodified lines
13561356 msdc_request_done(host, mrq);
13571357 }
13581358
1359−static bool msdc_data_xfer_done(struct msdc_host *host, u32 events,
1359+static void msdc_data_xfer_done(struct msdc_host *host, u32 events,
13601360 struct mmc_request *mrq, struct mmc_data *data)
13611361 {
13621362 struct mmc_command *stop;
@@ -1376,7 +1376,7 @@ static bool msdc_data_xfer_done(struct msdc_host *host, u32 events, · 13 unmodified lines
13761376 spin_unlock_irqrestore(&host->lock, flags);
13771377
13781378 if (done)
1379− return true;
1379+ return;
13801380 stop = data->stop;
13811381
13821382 if (check_data || (stop && stop->error)) {
@@ -1385,12 +1385,15 @@ static bool msdc_data_xfer_done(struct msdc_host *host, u32 events, · 2 unmodified lines
13851385 sdr_set_field(host->base + MSDC_DMA_CTRL, MSDC_DMA_CTRL_STOP,
13861386 1);
13871387
1388+ ret = readl_poll_timeout_atomic(host->base + MSDC_DMA_CTRL, val,
1389+ !(val & MSDC_DMA_CTRL_STOP), 1, 20000);
1390+ if (ret)
1391+ dev_dbg(host->dev, "DMA stop timed out\n");
1392+
13881393 ret = readl_poll_timeout_atomic(host->base + MSDC_DMA_CFG, val,
13891394 !(val & MSDC_DMA_CFG_STS), 1, 20000);
1390− if (ret) {
1391− dev_dbg(host->dev, "DMA stop timed out\n");
1392− return false;
1393− }
1395+ if (ret)
1396+ dev_dbg(host->dev, "DMA inactive timed out\n");
13941397
13951398 sdr_clr_bits(host->base + MSDC_INTEN, data_ints_mask);
13961399 dev_dbg(host->dev, "DMA stop\n");
@@ -1415,9 +1418,7 @@ static bool msdc_data_xfer_done(struct msdc_host *host, u32 events, · 18 unmodified lines
14151418 }
14161419
14171420 msdc_data_xfer_next(host, mrq);
1418− done = true;
14191421 }
1420− return done;
14211422 }
14221423
14231424 static void msdc_set_buswidth(struct msdc_host *host, u32 width)
@@ -2416,6 +2417,9 @@ static void msdc_cqe_disable(struct mmc_host *mmc, bool recovery) · 992 unmodified lines
24162417 if (recovery) {
24172418 sdr_set_field(host->base + MSDC_DMA_CTRL,
24182419 MSDC_DMA_CTRL_STOP, 1);
2420+ if (WARN_ON(readl_poll_timeout(host->base + MSDC_DMA_CTRL, val,
2421+ !(val & MSDC_DMA_CTRL_STOP), 1, 3000)))
2422+ return;
24192423 if (WARN_ON(readl_poll_timeout(host->base + MSDC_DMA_CFG, val,
24202424 !(val & MSDC_DMA_CFG_STS), 1, 3000)))
24212425 return;
drivers/mmc/host/sdhci-pci-o2micro.c+2−0
@@ -152,6 +152,8 @@ static int sdhci_o2_get_cd(struct mmc_host *mmc) · 151 unmodified lines
152152
153153 if (!(sdhci_readw(host, O2_PLL_DLL_WDT_CONTROL1) & O2_PLL_LOCK_STATUS))
154154 sdhci_o2_enable_internal_clock(host);
155+ else
156+ sdhci_o2_wait_card_detect_stable(host);
155157
156158 return !!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT);
157159 }
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c+1−1
@@ -890,7 +890,7 @@ static int gpmi_nfc_compute_timings(struct gpmi_nand_data *this, · 889 unmodified lines
890890 hw->timing0 = BF_GPMI_TIMING0_ADDRESS_SETUP(addr_setup_cycles) |
891891 BF_GPMI_TIMING0_DATA_HOLD(data_hold_cycles) |
892892 BF_GPMI_TIMING0_DATA_SETUP(data_setup_cycles);
893− hw->timing1 = BF_GPMI_TIMING1_BUSY_TIMEOUT(busy_timeout_cycles * 4096);
893+ hw->timing1 = BF_GPMI_TIMING1_BUSY_TIMEOUT(DIV_ROUND_UP(busy_timeout_cycles, 4096));
894894
895895 /*
896896 * Derive NFC ideal delay from {3}:
drivers/mtd/nand/raw/nand_ids.c+0−3
@@ -29,9 +29,6 @@ struct nand_flash_dev nand_flash_ids[] = { · 28 unmodified lines
2929 {"TC58NVG0S3E 1G 3.3V 8-bit",
3030 { .id = {0x98, 0xd1, 0x90, 0x15, 0x76, 0x14, 0x01, 0x00} },
3131 SZ_2K, SZ_128, SZ_128K, 0, 8, 64, NAND_ECC_INFO(1, SZ_512), },
32− {"TC58NVG0S3HTA00 1G 3.3V 8-bit",
33− { .id = {0x98, 0xf1, 0x80, 0x15} },
34− SZ_2K, SZ_128, SZ_128K, 0, 4, 128, NAND_ECC_INFO(8, SZ_512), },
3532 {"TC58NVG2S0F 4G 3.3V 8-bit",
3633 { .id = {0x98, 0xdc, 0x90, 0x26, 0x76, 0x15, 0x01, 0x08} },
3734 SZ_4K, SZ_512, SZ_256K, 0, 8, 224, NAND_ECC_INFO(4, SZ_512) },
drivers/net/bonding/bond_main.c+3−1
@@ -3684,9 +3684,11 @@ re_arm: · 3683 unmodified lines
36843684 if (!rtnl_trylock())
36853685 return;
36863686
3687− if (should_notify_peers)
3687+ if (should_notify_peers) {
3688+ bond->send_peer_notif--;
36883689 call_netdevice_notifiers(NETDEV_NOTIFY_PEERS,
36893690 bond->dev);
3691+ }
36903692 if (should_notify_rtnl) {
36913693 bond_slave_state_notify(bond);
36923694 bond_slave_link_notify(bond);
drivers/net/dsa/qca8k.c+21−1
@@ -2334,6 +2334,7 @@ static int · 2333 unmodified lines
23342334 qca8k_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
23352335 {
23362336 struct qca8k_priv *priv = ds->priv;
2337+ int ret;
23372338
23382339 /* We have only have a general MTU setting.
23392340 * DSA always set the CPU port's MTU to the largest MTU of the slave
@@ -2344,8 +2345,27 @@ qca8k_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu) · 4 unmodified lines
23442345 if (!dsa_is_cpu_port(ds, port))
23452346 return 0;
23462347
2348+ /* To change the MAX_FRAME_SIZE the cpu ports must be off or
2349+ * the switch panics.
2350+ * Turn off both cpu ports before applying the new value to prevent
2351+ * this.
2352+ */
2353+ if (priv->port_enabled_map & BIT(0))
2354+ qca8k_port_set_status(priv, 0, 0);
2355+
2356+ if (priv->port_enabled_map & BIT(6))
2357+ qca8k_port_set_status(priv, 6, 0);
2358+
23472359 /* Include L2 header / FCS length */
2348− return qca8k_write(priv, QCA8K_MAX_FRAME_SIZE, new_mtu + ETH_HLEN + ETH_FCS_LEN);
2360+ ret = qca8k_write(priv, QCA8K_MAX_FRAME_SIZE, new_mtu + ETH_HLEN + ETH_FCS_LEN);
2361+
2362+ if (priv->port_enabled_map & BIT(0))
2363+ qca8k_port_set_status(priv, 0, 1);
2364+
2365+ if (priv->port_enabled_map & BIT(6))
2366+ qca8k_port_set_status(priv, 6, 1);
2367+
2368+ return ret;
23492369 }
23502370
23512371 static int
drivers/net/dsa/qca8k.h+1−1
@@ -15,7 +15,7 @@ · 14 unmodified lines
1515
1616 #define QCA8K_ETHERNET_MDIO_PRIORITY 7
1717 #define QCA8K_ETHERNET_PHY_PRIORITY 6
18−#define QCA8K_ETHERNET_TIMEOUT 100
18+#define QCA8K_ETHERNET_TIMEOUT 5
1919
2020 #define QCA8K_NUM_PORTS 7
2121 #define QCA8K_NUM_CPU_PORTS 2
drivers/net/ethernet/amd/xgbe/xgbe-platform.c+2−2
@@ -338,7 +338,7 @@ static int xgbe_platform_probe(struct platform_device *pdev) · 337 unmodified lines
338338 * the PHY resources listed last
339339 */
340340 phy_memnum = xgbe_resource_count(pdev, IORESOURCE_MEM) - 3;
341− phy_irqnum = xgbe_resource_count(pdev, IORESOURCE_IRQ) - 1;
341+ phy_irqnum = platform_irq_count(pdev) - 1;
342342 dma_irqnum = 1;
343343 dma_irqend = phy_irqnum;
344344 } else {
@@ -348,7 +348,7 @@ static int xgbe_platform_probe(struct platform_device *pdev) · 3 unmodified lines
348348 phy_memnum = 0;
349349 phy_irqnum = 0;
350350 dma_irqnum = 1;
351− dma_irqend = xgbe_resource_count(pdev, IORESOURCE_IRQ);
351+ dma_irqend = platform_irq_count(pdev);
352352 }
353353
354354 /* Obtain the mmio areas for the device */
drivers/net/ethernet/broadcom/bgmac-bcma.c+0−1
@@ -332,7 +332,6 @@ static void bgmac_remove(struct bcma_device *core) · 331 unmodified lines
332332 bcma_mdio_mii_unregister(bgmac->mii_bus);
333333 bgmac_enet_remove(bgmac);
334334 bcma_set_drvdata(core, NULL);
335− kfree(bgmac);
336335 }
337336
338337 static struct bcma_driver bgmac_bcma_driver = {
drivers/net/ethernet/hisilicon/hns3/hnae3.h+1−0
@@ -769,6 +769,7 @@ struct hnae3_tc_info { · 768 unmodified lines
769769 u8 prio_tc[HNAE3_MAX_USER_PRIO]; /* TC indexed by prio */
770770 u16 tqp_count[HNAE3_MAX_TC];
771771 u16 tqp_offset[HNAE3_MAX_TC];
772+ u8 max_tc; /* Total number of TCs */
772773 u8 num_tc; /* Total number of enabled TCs */
773774 bool mqprio_active;
774775 };
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c+1−1
@@ -1129,7 +1129,7 @@ hns3_is_ringparam_changed(struct net_device *ndev, · 1128 unmodified lines
11291129 if (old_ringparam->tx_desc_num == new_ringparam->tx_desc_num &&
11301130 old_ringparam->rx_desc_num == new_ringparam->rx_desc_num &&
11311131 old_ringparam->rx_buf_len == new_ringparam->rx_buf_len) {
1132− netdev_info(ndev, "ringparam not changed\n");
1132+ netdev_info(ndev, "descriptor number and rx buffer length not changed\n");
11331133 return false;
11341134 }
11351135
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c+15−3
@@ -3268,7 +3268,7 @@ static int hclge_tp_port_init(struct hclge_dev *hdev) · 3267 unmodified lines
32683268 static int hclge_update_port_info(struct hclge_dev *hdev)
32693269 {
32703270 struct hclge_mac *mac = &hdev->hw.mac;
3271− int speed = HCLGE_MAC_SPEED_UNKNOWN;
3271+ int speed;
32723272 int ret;
32733273
32743274 /* get the port info from SFP cmd if not copper port */
@@ -3279,10 +3279,13 @@ static int hclge_update_port_info(struct hclge_dev *hdev) · 4 unmodified lines
32793279 if (!hdev->support_sfp_query)
32803280 return 0;
32813281
3282− if (hdev->ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2)
3282+ if (hdev->ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2) {
3283+ speed = mac->speed;
32833284 ret = hclge_get_sfp_info(hdev, mac);
3284− else
3285+ } else {
3286+ speed = HCLGE_MAC_SPEED_UNKNOWN;
32853287 ret = hclge_get_sfp_speed(hdev, &speed);
3288+ }
32863289
32873290 if (ret == -EOPNOTSUPP) {
32883291 hdev->support_sfp_query = false;
@@ -3294,6 +3297,8 @@ static int hclge_update_port_info(struct hclge_dev *hdev) · 5 unmodified lines
32943297 if (hdev->ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2) {
32953298 if (mac->speed_type == QUERY_ACTIVE_SPEED) {
32963299 hclge_update_port_capability(hdev, mac);
3300+ if (mac->speed != speed)
3301+ (void)hclge_tm_port_shaper_cfg(hdev);
32973302 return 0;
32983303 }
32993304 return hclge_cfg_mac_speed_dup(hdev, mac->speed,
@@ -3376,6 +3381,12 @@ static int hclge_set_vf_link_state(struct hnae3_handle *handle, int vf, · 76 unmodified lines
33763381 link_state_old = vport->vf_info.link_state;
33773382 vport->vf_info.link_state = link_state;
33783383
3384+ /* return success directly if the VF is unalive, VF will
3385+ * query link state itself when it starts work.
3386+ */
3387+ if (!test_bit(HCLGE_VPORT_STATE_ALIVE, &vport->state))
3388+ return 0;
3389+
33793390 ret = hclge_push_vf_link_status(vport);
33803391 if (ret) {
33813392 vport->vf_info.link_state = link_state_old;
@@ -10117,6 +10128,7 @@ static int hclge_modify_port_base_vlan_tag(struct hclge_vport *vport, · 6735 unmodified lines
1011710128 if (ret)
1011810129 return ret;
1011910130
10131+ vport->port_base_vlan_cfg.tbl_sta = false;
1012010132 /* remove old VLAN tag */
1012110133 if (old_info->vlan_tag == 0)
1012210134 ret = hclge_set_vf_vlan_common(hdev, vport->vport_id,
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c+68−33
@@ -282,8 +282,8 @@ static int hclge_tm_pg_to_pri_map_cfg(struct hclge_dev *hdev, · 281 unmodified lines
282282 return hclge_cmd_send(&hdev->hw, &desc, 1);
283283 }
284284
285−static int hclge_tm_qs_to_pri_map_cfg(struct hclge_dev *hdev,
286− u16 qs_id, u8 pri)
285+static int hclge_tm_qs_to_pri_map_cfg(struct hclge_dev *hdev, u16 qs_id, u8 pri,
286+ bool link_vld)
287287 {
288288 struct hclge_qs_to_pri_link_cmd *map;
289289 struct hclge_desc desc;
@@ -294,7 +294,7 @@ static int hclge_tm_qs_to_pri_map_cfg(struct hclge_dev *hdev, · 4 unmodified lines
294294
295295 map->qs_id = cpu_to_le16(qs_id);
296296 map->priority = pri;
297− map->link_vld = HCLGE_TM_QS_PRI_LINK_VLD_MSK;
297+ map->link_vld = link_vld ? HCLGE_TM_QS_PRI_LINK_VLD_MSK : 0;
298298
299299 return hclge_cmd_send(&hdev->hw, &desc, 1);
300300 }
@@ -420,7 +420,7 @@ static int hclge_tm_pg_shapping_cfg(struct hclge_dev *hdev, · 119 unmodified lines
420420 return hclge_cmd_send(&hdev->hw, &desc, 1);
421421 }
422422
423−static int hclge_tm_port_shaper_cfg(struct hclge_dev *hdev)
423+int hclge_tm_port_shaper_cfg(struct hclge_dev *hdev)
424424 {
425425 struct hclge_port_shapping_cmd *shap_cfg_cmd;
426426 struct hclge_shaper_ir_para ir_para;
@@ -642,11 +642,13 @@ static void hclge_tm_update_kinfo_rss_size(struct hclge_vport *vport) · 215 unmodified lines
642642 * one tc for VF for simplicity. VF's vport_id is non zero.
643643 */
644644 if (vport->vport_id) {
645+ kinfo->tc_info.max_tc = 1;
645646 kinfo->tc_info.num_tc = 1;
646647 vport->qs_offset = HNAE3_MAX_TC +
647648 vport->vport_id - HCLGE_VF_VPORT_START_NUM;
648649 vport_max_rss_size = hdev->vf_rss_size_max;
649650 } else {
651+ kinfo->tc_info.max_tc = hdev->tc_max;
650652 kinfo->tc_info.num_tc =
651653 min_t(u16, vport->alloc_tqps, hdev->tm_info.num_tc);
652654 vport->qs_offset = 0;
@@ -679,7 +681,9 @@ static void hclge_tm_vport_tc_info_update(struct hclge_vport *vport) · 26 unmodified lines
679681 kinfo->num_tqps = hclge_vport_get_tqp_num(vport);
680682 vport->dwrr = 100; /* 100 percent as init */
681683 vport->bw_limit = hdev->tm_info.pg_info[0].bw_limit;
682− hdev->rss_cfg.rss_size = kinfo->rss_size;
684+
685+ if (vport->vport_id == PF_VPORT_ID)
686+ hdev->rss_cfg.rss_size = kinfo->rss_size;
683687
684688 /* when enable mqprio, the tc_info has been updated. */
685689 if (kinfo->tc_info.mqprio_active)
@@ -714,14 +718,22 @@ static void hclge_tm_vport_info_update(struct hclge_dev *hdev) · 28 unmodified lines
714718
715719 static void hclge_tm_tc_info_init(struct hclge_dev *hdev)
716720 {
717− u8 i;
721+ u8 i, tc_sch_mode;
722+ u32 bw_limit;
723+
724+ for (i = 0; i < hdev->tc_max; i++) {
725+ if (i < hdev->tm_info.num_tc) {
726+ tc_sch_mode = HCLGE_SCH_MODE_DWRR;
727+ bw_limit = hdev->tm_info.pg_info[0].bw_limit;
728+ } else {
729+ tc_sch_mode = HCLGE_SCH_MODE_SP;
730+ bw_limit = 0;
731+ }
718732
719− for (i = 0; i < hdev->tm_info.num_tc; i++) {
720733 hdev->tm_info.tc_info[i].tc_id = i;
721− hdev->tm_info.tc_info[i].tc_sch_mode = HCLGE_SCH_MODE_DWRR;
734+ hdev->tm_info.tc_info[i].tc_sch_mode = tc_sch_mode;
722735 hdev->tm_info.tc_info[i].pgid = 0;
723− hdev->tm_info.tc_info[i].bw_limit =
724− hdev->tm_info.pg_info[0].bw_limit;
736+ hdev->tm_info.tc_info[i].bw_limit = bw_limit;
725737 }
726738
727739 for (i = 0; i < HNAE3_MAX_USER_PRIO; i++)
@@ -926,10 +938,13 @@ static int hclge_tm_pri_q_qs_cfg_tc_base(struct hclge_dev *hdev) · 198 unmodified lines
926938 for (k = 0; k < hdev->num_alloc_vport; k++) {
927939 struct hnae3_knic_private_info *kinfo = &vport[k].nic.kinfo;
928940
929− for (i = 0; i < kinfo->tc_info.num_tc; i++) {
941+ for (i = 0; i < kinfo->tc_info.max_tc; i++) {
942+ u8 pri = i < kinfo->tc_info.num_tc ? i : 0;
943+ bool link_vld = i < kinfo->tc_info.num_tc;
944+
930945 ret = hclge_tm_qs_to_pri_map_cfg(hdev,
931946 vport[k].qs_offset + i,
932− i);
947+ pri, link_vld);
933948 if (ret)
934949 return ret;
935950 }
@@ -949,7 +964,7 @@ static int hclge_tm_pri_q_qs_cfg_vnet_base(struct hclge_dev *hdev) · 13 unmodified lines
949964 for (i = 0; i < HNAE3_MAX_TC; i++) {
950965 ret = hclge_tm_qs_to_pri_map_cfg(hdev,
951966 vport[k].qs_offset + i,
952− k);
967+ k, true);
953968 if (ret)
954969 return ret;
955970 }
@@ -989,33 +1004,39 @@ static int hclge_tm_pri_tc_base_shaper_cfg(struct hclge_dev *hdev) · 33 unmodified lines
9891004 {
9901005 u32 max_tm_rate = hdev->ae_dev->dev_specs.max_tm_rate;
9911006 struct hclge_shaper_ir_para ir_para;
992− u32 shaper_para;
1007+ u32 shaper_para_c, shaper_para_p;
9931008 int ret;
9941009 u32 i;
9951010
996− for (i = 0; i < hdev->tm_info.num_tc; i++) {
1011+ for (i = 0; i < hdev->tc_max; i++) {
9971012 u32 rate = hdev->tm_info.tc_info[i].bw_limit;
9981013
999− ret = hclge_shaper_para_calc(rate, HCLGE_SHAPER_LVL_PRI,
1000− &ir_para, max_tm_rate);
1001− if (ret)
1002− return ret;
1014+ if (rate) {
1015+ ret = hclge_shaper_para_calc(rate, HCLGE_SHAPER_LVL_PRI,
1016+ &ir_para, max_tm_rate);
1017+ if (ret)
1018+ return ret;
1019+
1020+ shaper_para_c = hclge_tm_get_shapping_para(0, 0, 0,
1021+ HCLGE_SHAPER_BS_U_DEF,
1022+ HCLGE_SHAPER_BS_S_DEF);
1023+ shaper_para_p = hclge_tm_get_shapping_para(ir_para.ir_b,
1024+ ir_para.ir_u,
1025+ ir_para.ir_s,
1026+ HCLGE_SHAPER_BS_U_DEF,
1027+ HCLGE_SHAPER_BS_S_DEF);
1028+ } else {
1029+ shaper_para_c = 0;
1030+ shaper_para_p = 0;
1031+ }
10031032
1004− shaper_para = hclge_tm_get_shapping_para(0, 0, 0,
1005− HCLGE_SHAPER_BS_U_DEF,
1006− HCLGE_SHAPER_BS_S_DEF);
10071033 ret = hclge_tm_pri_shapping_cfg(hdev, HCLGE_TM_SHAP_C_BUCKET, i,
1008− shaper_para, rate);
1034+ shaper_para_c, rate);
10091035 if (ret)
10101036 return ret;
10111037
1012− shaper_para = hclge_tm_get_shapping_para(ir_para.ir_b,
1013− ir_para.ir_u,
1014− ir_para.ir_s,
1015− HCLGE_SHAPER_BS_U_DEF,
1016− HCLGE_SHAPER_BS_S_DEF);
10171038 ret = hclge_tm_pri_shapping_cfg(hdev, HCLGE_TM_SHAP_P_BUCKET, i,
1018− shaper_para, rate);
1039+ shaper_para_p, rate);
10191040 if (ret)
10201041 return ret;
10211042 }
@@ -1125,7 +1146,7 @@ static int hclge_tm_pri_tc_base_dwrr_cfg(struct hclge_dev *hdev) · 103 unmodified lines
11251146 int ret;
11261147 u32 i, k;
11271148
1128− for (i = 0; i < hdev->tm_info.num_tc; i++) {
1149+ for (i = 0; i < hdev->tc_max; i++) {
11291150 pg_info =
11301151 &hdev->tm_info.pg_info[hdev->tm_info.tc_info[i].pgid];
11311152 dwrr = pg_info->tc_dwrr[i];
@@ -1135,9 +1156,15 @@ static int hclge_tm_pri_tc_base_dwrr_cfg(struct hclge_dev *hdev) · 3 unmodified lines
11351156 return ret;
11361157
11371158 for (k = 0; k < hdev->num_alloc_vport; k++) {
1159+ struct hnae3_knic_private_info *kinfo = &vport[k].nic.kinfo;
1160+
1161+ if (i >= kinfo->tc_info.max_tc)
1162+ continue;
1163+
1164+ dwrr = i < kinfo->tc_info.num_tc ? vport[k].dwrr : 0;
11381165 ret = hclge_tm_qs_weight_cfg(
11391166 hdev, vport[k].qs_offset + i,
1140− vport[k].dwrr);
1167+ dwrr);
11411168 if (ret)
11421169 return ret;
11431170 }
@@ -1303,6 +1330,7 @@ static int hclge_tm_schd_mode_tc_base_cfg(struct hclge_dev *hdev, u8 pri_id) · 159 unmodified lines
13031330 {
13041331 struct hclge_vport *vport = hdev->vport;
13051332 int ret;
1333+ u8 mode;
13061334 u16 i;
13071335
13081336 ret = hclge_tm_pri_schd_mode_cfg(hdev, pri_id);
@@ -1310,9 +1338,16 @@ static int hclge_tm_schd_mode_tc_base_cfg(struct hclge_dev *hdev, u8 pri_id) · 1 unmodified line
13101338 return ret;
13111339
13121340 for (i = 0; i < hdev->num_alloc_vport; i++) {
1341+ struct hnae3_knic_private_info *kinfo = &vport[i].nic.kinfo;
1342+
1343+ if (pri_id >= kinfo->tc_info.max_tc)
1344+ continue;
1345+
1346+ mode = pri_id < kinfo->tc_info.num_tc ? HCLGE_SCH_MODE_DWRR :
1347+ HCLGE_SCH_MODE_SP;
13131348 ret = hclge_tm_qs_schd_mode_cfg(hdev,
13141349 vport[i].qs_offset + pri_id,
1315− HCLGE_SCH_MODE_DWRR);
1350+ mode);
13161351 if (ret)
13171352 return ret;
13181353 }
@@ -1353,7 +1388,7 @@ static int hclge_tm_lvl34_schd_mode_cfg(struct hclge_dev *hdev) · 34 unmodified lines
13531388 u8 i;
13541389
13551390 if (hdev->tx_sch_mode == HCLGE_FLAG_TC_BASE_SCH_MODE) {
1356− for (i = 0; i < hdev->tm_info.num_tc; i++) {
1391+ for (i = 0; i < hdev->tc_max; i++) {
13571392 ret = hclge_tm_schd_mode_tc_base_cfg(hdev, i);
13581393 if (ret)
13591394 return ret;
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h+1−0
@@ -237,6 +237,7 @@ int hclge_pause_addr_cfg(struct hclge_dev *hdev, const u8 *mac_addr); · 236 unmodified lines
237237 void hclge_pfc_rx_stats_get(struct hclge_dev *hdev, u64 *stats);
238238 void hclge_pfc_tx_stats_get(struct hclge_dev *hdev, u64 *stats);
239239 int hclge_tm_qs_shaper_cfg(struct hclge_vport *vport, int max_tx_rate);
240+int hclge_tm_port_shaper_cfg(struct hclge_dev *hdev);
240241 int hclge_tm_get_qset_num(struct hclge_dev *hdev, u16 *qset_num);
241242 int hclge_tm_get_pri_num(struct hclge_dev *hdev, u8 *pri_num);
242243 int hclge_tm_get_qset_map_pri(struct hclge_dev *hdev, u16 qset_id, u8 *priority,
drivers/net/ethernet/huawei/hinic/hinic_devlink.c+1−3
@@ -43,9 +43,7 @@ static bool check_image_valid(struct hinic_devlink_priv *priv, const u8 *buf, · 42 unmodified lines
4343
4444 for (i = 0; i < fw_image->fw_info.fw_section_cnt; i++) {
4545 len += fw_image->fw_section_info[i].fw_section_len;
46− memcpy(&host_image->image_section_info[i],
47− &fw_image->fw_section_info[i],
48− sizeof(struct fw_section_info_st));
46+ host_image->image_section_info[i] = fw_image->fw_section_info[i];
4947 }
5048
5149 if (len != fw_image->fw_len ||
drivers/net/ethernet/intel/i40e/i40e_ethtool.c+17−8
@@ -2586,15 +2586,16 @@ static void i40e_diag_test(struct net_device *netdev, · 2585 unmodified lines
25862586
25872587 set_bit(__I40E_TESTING, pf->state);
25882588
2589+ if (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state) ||
2590+ test_bit(__I40E_RESET_INTR_RECEIVED, pf->state)) {
2591+ dev_warn(&pf->pdev->dev,
2592+ "Cannot start offline testing when PF is in reset state.\n");
2593+ goto skip_ol_tests;
2594+ }
2595+
25892596 if (i40e_active_vfs(pf) || i40e_active_vmdqs(pf)) {
25902597 dev_warn(&pf->pdev->dev,
25912598 "Please take active VFs and Netqueues offline and restart the adapter before running NIC diagnostics\n");
2592− data[I40E_ETH_TEST_REG] = 1;
2593− data[I40E_ETH_TEST_EEPROM] = 1;
2594− data[I40E_ETH_TEST_INTR] = 1;
2595− data[I40E_ETH_TEST_LINK] = 1;
2596− eth_test->flags |= ETH_TEST_FL_FAILED;
2597− clear_bit(__I40E_TESTING, pf->state);
25982599 goto skip_ol_tests;
25992600 }
26002601
@@ -2641,9 +2642,17 @@ static void i40e_diag_test(struct net_device *netdev, · 40 unmodified lines
26412642 data[I40E_ETH_TEST_INTR] = 0;
26422643 }
26432644
2644−skip_ol_tests:
2645−
26462645 netif_info(pf, drv, netdev, "testing finished\n");
2646+ return;
2647+
2648+skip_ol_tests:
2649+ data[I40E_ETH_TEST_REG] = 1;
2650+ data[I40E_ETH_TEST_EEPROM] = 1;
2651+ data[I40E_ETH_TEST_INTR] = 1;
2652+ data[I40E_ETH_TEST_LINK] = 1;
2653+ eth_test->flags |= ETH_TEST_FL_FAILED;
2654+ clear_bit(__I40E_TESTING, pf->state);
2655+ netif_info(pf, drv, netdev, "testing failed\n");
26472656 }
26482657
26492658 static void i40e_get_wol(struct net_device *netdev,
drivers/net/ethernet/intel/i40e/i40e_main.c+5−0
@@ -8542,6 +8542,11 @@ static int i40e_configure_clsflower(struct i40e_vsi *vsi, · 8541 unmodified lines
85428542 return -EOPNOTSUPP;
85438543 }
85448544
8545+ if (!tc) {
8546+ dev_err(&pf->pdev->dev, "Unable to add filter because of invalid destination");
8547+ return -EINVAL;
8548+ }
8549+
85458550 if (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state) ||
85468551 test_bit(__I40E_RESET_INTR_RECEIVED, pf->state))
85478552 return -EBUSY;
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c+1−1
@@ -2282,7 +2282,7 @@ static int i40e_vc_config_queues_msg(struct i40e_vf *vf, u8 *msg) · 2281 unmodified lines
22822282 }
22832283
22842284 if (vf->adq_enabled) {
2285− for (i = 0; i < I40E_MAX_VF_VSI; i++)
2285+ for (i = 0; i < vf->num_tc; i++)
22862286 num_qps_all += vf->ch[i].num_qps;
22872287 if (num_qps_all != qci->num_queue_pairs) {
22882288 aq_ret = I40E_ERR_PARAM;
drivers/net/ethernet/intel/iavf/iavf_main.c+1−1
@@ -984,7 +984,7 @@ struct iavf_mac_filter *iavf_add_filter(struct iavf_adapter *adapter, · 983 unmodified lines
984984 list_add_tail(&f->list, &adapter->mac_filter_list);
985985 f->add = true;
986986 f->is_new_mac = true;
987− f->is_primary = false;
987+ f->is_primary = ether_addr_equal(macaddr, adapter->hw.mac.addr);
988988 adapter->aq_required |= IAVF_FLAG_AQ_ADD_MAC_FILTER;
989989 } else {
990990 f->remove = false;
drivers/net/ethernet/intel/ice/ice_ethtool.c+48−1
@@ -2189,6 +2189,42 @@ ice_setup_autoneg(struct ice_port_info *p, struct ethtool_link_ksettings *ks, · 2188 unmodified lines
21892189 return err;
21902190 }
21912191
2192+/**
2193+ * ice_set_phy_type_from_speed - set phy_types based on speeds
2194+ * and advertised modes
2195+ * @ks: ethtool link ksettings struct
2196+ * @phy_type_low: pointer to the lower part of phy_type
2197+ * @phy_type_high: pointer to the higher part of phy_type
2198+ * @adv_link_speed: targeted link speeds bitmap
2199+ */
2200+static void
2201+ice_set_phy_type_from_speed(const struct ethtool_link_ksettings *ks,
2202+ u64 *phy_type_low, u64 *phy_type_high,
2203+ u16 adv_link_speed)
2204+{
2205+ /* Handle 1000M speed in a special way because ice_update_phy_type
2206+ * enables all link modes, but having mixed copper and optical
2207+ * standards is not supported.
2208+ */
2209+ adv_link_speed &= ~ICE_AQ_LINK_SPEED_1000MB;
2210+
2211+ if (ethtool_link_ksettings_test_link_mode(ks, advertising,
2212+ 1000baseT_Full))
2213+ *phy_type_low |= ICE_PHY_TYPE_LOW_1000BASE_T |
2214+ ICE_PHY_TYPE_LOW_1G_SGMII;
2215+
2216+ if (ethtool_link_ksettings_test_link_mode(ks, advertising,
2217+ 1000baseKX_Full))
2218+ *phy_type_low |= ICE_PHY_TYPE_LOW_1000BASE_KX;
2219+
2220+ if (ethtool_link_ksettings_test_link_mode(ks, advertising,
2221+ 1000baseX_Full))
2222+ *phy_type_low |= ICE_PHY_TYPE_LOW_1000BASE_SX |
2223+ ICE_PHY_TYPE_LOW_1000BASE_LX;
2224+
2225+ ice_update_phy_type(phy_type_low, phy_type_high, adv_link_speed);
2226+}
2227+
21922228 /**
21932229 * ice_set_link_ksettings - Set Speed and Duplex
21942230 * @netdev: network interface device structure
@@ -2320,7 +2356,8 @@ ice_set_link_ksettings(struct net_device *netdev, · 125 unmodified lines
23202356 adv_link_speed = curr_link_speed;
23212357
23222358 /* Convert the advertise link speeds to their corresponded PHY_TYPE */
2323− ice_update_phy_type(&phy_type_low, &phy_type_high, adv_link_speed);
2359+ ice_set_phy_type_from_speed(ks, &phy_type_low, &phy_type_high,
2360+ adv_link_speed);
23242361
23252362 if (!autoneg_changed && adv_link_speed == curr_link_speed) {
23262363 netdev_info(netdev, "Nothing changed, exiting without setting anything.\n");
@@ -3470,6 +3507,16 @@ static int ice_set_channels(struct net_device *dev, struct ethtool_channels *ch) · 1143 unmodified lines
34703507 new_rx = ch->combined_count + ch->rx_count;
34713508 new_tx = ch->combined_count + ch->tx_count;
34723509
3510+ if (new_rx < vsi->tc_cfg.numtc) {
3511+ netdev_err(dev, "Cannot set less Rx channels, than Traffic Classes you have (%u)\n",
3512+ vsi->tc_cfg.numtc);
3513+ return -EINVAL;
3514+ }
3515+ if (new_tx < vsi->tc_cfg.numtc) {
3516+ netdev_err(dev, "Cannot set less Tx channels, than Traffic Classes you have (%u)\n",
3517+ vsi->tc_cfg.numtc);
3518+ return -EINVAL;
3519+ }
34733520 if (new_rx > ice_get_max_rxq(pf)) {
34743521 netdev_err(dev, "Maximum allowed Rx channels is %d\n",
34753522 ice_get_max_rxq(pf));
drivers/net/ethernet/intel/ice/ice_lib.c+37−5
@@ -909,7 +909,7 @@ static void ice_set_dflt_vsi_ctx(struct ice_hw *hw, struct ice_vsi_ctx *ctxt) · 908 unmodified lines
909909 * @vsi: the VSI being configured
910910 * @ctxt: VSI context structure
911911 */
912−static void ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt)
912+static int ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt)
913913 {
914914 u16 offset = 0, qmap = 0, tx_count = 0, pow = 0;
915915 u16 num_txq_per_tc, num_rxq_per_tc;
@@ -982,7 +982,18 @@ static void ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt) · 66 unmodified lines
982982 else
983983 vsi->num_rxq = num_rxq_per_tc;
984984
985+ if (vsi->num_rxq > vsi->alloc_rxq) {
986+ dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Rx queues (%u), than were allocated (%u)!\n",
987+ vsi->num_rxq, vsi->alloc_rxq);
988+ return -EINVAL;
989+ }
990+
985991 vsi->num_txq = tx_count;
992+ if (vsi->num_txq > vsi->alloc_txq) {
993+ dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Tx queues (%u), than were allocated (%u)!\n",
994+ vsi->num_txq, vsi->alloc_txq);
995+ return -EINVAL;
996+ }
986997
987998 if (vsi->type == ICE_VSI_VF && vsi->num_txq != vsi->num_rxq) {
988999 dev_dbg(ice_pf_to_dev(vsi->back), "VF VSI should have same number of Tx and Rx queues. Hence making them equal\n");
@@ -1000,6 +1011,8 @@ static void ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt) · 11 unmodified lines
10001011 */
10011012 ctxt->info.q_mapping[0] = cpu_to_le16(vsi->rxq_map[0]);
10021013 ctxt->info.q_mapping[1] = cpu_to_le16(vsi->num_rxq);
1014+
1015+ return 0;
10031016 }
10041017
10051018 /**
@@ -1187,7 +1200,10 @@ static int ice_vsi_init(struct ice_vsi *vsi, bool init_vsi) · 181 unmodified lines
11871200 if (vsi->type == ICE_VSI_CHNL) {
11881201 ice_chnl_vsi_setup_q_map(vsi, ctxt);
11891202 } else {
1190− ice_vsi_setup_q_map(vsi, ctxt);
1203+ ret = ice_vsi_setup_q_map(vsi, ctxt);
1204+ if (ret)
1205+ goto out;
1206+
11911207 if (!init_vsi) /* means VSI being updated */
11921208 /* must to indicate which section of VSI context are
11931209 * being modified
@@ -3464,7 +3480,7 @@ void ice_vsi_cfg_netdev_tc(struct ice_vsi *vsi, u8 ena_tc) · 2270 unmodified lines
34643480 *
34653481 * Prepares VSI tc_config to have queue configurations based on MQPRIO options.
34663482 */
3467−static void
3483+static int
34683484 ice_vsi_setup_q_map_mqprio(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt,
34693485 u8 ena_tc)
34703486 {
@@ -3513,7 +3529,18 @@ ice_vsi_setup_q_map_mqprio(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt, · 42 unmodified lines
35133529
35143530 /* Set actual Tx/Rx queue pairs */
35153531 vsi->num_txq = offset + qcount_tx;
3532+ if (vsi->num_txq > vsi->alloc_txq) {
3533+ dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Tx queues (%u), than were allocated (%u)!\n",
3534+ vsi->num_txq, vsi->alloc_txq);
3535+ return -EINVAL;
3536+ }
3537+
35163538 vsi->num_rxq = offset + qcount_rx;
3539+ if (vsi->num_rxq > vsi->alloc_rxq) {
3540+ dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Rx queues (%u), than were allocated (%u)!\n",
3541+ vsi->num_rxq, vsi->alloc_rxq);
3542+ return -EINVAL;
3543+ }
35173544
35183545 /* Setup queue TC[0].qmap for given VSI context */
35193546 ctxt->info.tc_mapping[0] = cpu_to_le16(qmap);
@@ -3531,6 +3558,8 @@ ice_vsi_setup_q_map_mqprio(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt, · 11 unmodified lines
35313558 dev_dbg(ice_pf_to_dev(vsi->back), "vsi->num_rxq = %d\n", vsi->num_rxq);
35323559 dev_dbg(ice_pf_to_dev(vsi->back), "all_numtc %u, all_enatc: 0x%04x, tc_cfg.numtc %u\n",
35333560 vsi->all_numtc, vsi->all_enatc, vsi->tc_cfg.numtc);
3561+
3562+ return 0;
35343563 }
35353564
35363565 /**
@@ -3580,9 +3609,12 @@ int ice_vsi_cfg_tc(struct ice_vsi *vsi, u8 ena_tc) · 43 unmodified lines
35803609
35813610 if (vsi->type == ICE_VSI_PF &&
35823611 test_bit(ICE_FLAG_TC_MQPRIO, pf->flags))
3583− ice_vsi_setup_q_map_mqprio(vsi, ctx, ena_tc);
3612+ ret = ice_vsi_setup_q_map_mqprio(vsi, ctx, ena_tc);
35843613 else
3585− ice_vsi_setup_q_map(vsi, ctx);
3614+ ret = ice_vsi_setup_q_map(vsi, ctx);
3615+
3616+ if (ret)
3617+ goto out;
35863618
35873619 /* must to indicate which section of VSI context are being modified */
35883620 ctx->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_RXQ_MAP_VALID);
drivers/net/ethernet/intel/ice/ice_main.c+31−18
@@ -5763,25 +5763,38 @@ static netdev_features_t · 5762 unmodified lines
57635763 ice_fix_features(struct net_device *netdev, netdev_features_t features)
57645764 {
57655765 struct ice_netdev_priv *np = netdev_priv(netdev);
5766− netdev_features_t supported_vlan_filtering;
5767− netdev_features_t requested_vlan_filtering;
5768− struct ice_vsi *vsi = np->vsi;
5769−
5770− requested_vlan_filtering = features & NETIF_VLAN_FILTERING_FEATURES;
5771−
5772− /* make sure supported_vlan_filtering works for both SVM and DVM */
5773− supported_vlan_filtering = NETIF_F_HW_VLAN_CTAG_FILTER;
5774− if (ice_is_dvm_ena(&vsi->back->hw))
5775− supported_vlan_filtering |= NETIF_F_HW_VLAN_STAG_FILTER;
5776−
5777− if (requested_vlan_filtering &&
5778− requested_vlan_filtering != supported_vlan_filtering) {
5779− if (requested_vlan_filtering & NETIF_F_HW_VLAN_CTAG_FILTER) {
5780− netdev_warn(netdev, "cannot support requested VLAN filtering settings, enabling all supported VLAN filtering settings\n");
5781− features |= supported_vlan_filtering;
5766+ netdev_features_t req_vlan_fltr, cur_vlan_fltr;
5767+ bool cur_ctag, cur_stag, req_ctag, req_stag;
5768+
5769+ cur_vlan_fltr = netdev->features & NETIF_VLAN_FILTERING_FEATURES;
5770+ cur_ctag = cur_vlan_fltr & NETIF_F_HW_VLAN_CTAG_FILTER;
5771+ cur_stag = cur_vlan_fltr & NETIF_F_HW_VLAN_STAG_FILTER;
5772+
5773+ req_vlan_fltr = features & NETIF_VLAN_FILTERING_FEATURES;
5774+ req_ctag = req_vlan_fltr & NETIF_F_HW_VLAN_CTAG_FILTER;
5775+ req_stag = req_vlan_fltr & NETIF_F_HW_VLAN_STAG_FILTER;
5776+
5777+ if (req_vlan_fltr != cur_vlan_fltr) {
5778+ if (ice_is_dvm_ena(&np->vsi->back->hw)) {
5779+ if (req_ctag && req_stag) {
5780+ features |= NETIF_VLAN_FILTERING_FEATURES;
5781+ } else if (!req_ctag && !req_stag) {
5782+ features &= ~NETIF_VLAN_FILTERING_FEATURES;
5783+ } else if ((!cur_ctag && req_ctag && !cur_stag) ||
5784+ (!cur_stag && req_stag && !cur_ctag)) {
5785+ features |= NETIF_VLAN_FILTERING_FEATURES;
5786+ netdev_warn(netdev, "802.1Q and 802.1ad VLAN filtering must be either both on or both off. VLAN filtering has been enabled for both types.\n");
5787+ } else if ((cur_ctag && !req_ctag && cur_stag) ||
5788+ (cur_stag && !req_stag && cur_ctag)) {
5789+ features &= ~NETIF_VLAN_FILTERING_FEATURES;
5790+ netdev_warn(netdev, "802.1Q and 802.1ad VLAN filtering must be either both on or both off. VLAN filtering has been disabled for both types.\n");
5791+ }
57825792 } else {
5783− netdev_warn(netdev, "cannot support requested VLAN filtering settings, clearing all supported VLAN filtering settings\n");
5784− features &= ~supported_vlan_filtering;
5793+ if (req_vlan_fltr & NETIF_F_HW_VLAN_STAG_FILTER)
5794+ netdev_warn(netdev, "cannot support requested 802.1ad filtering setting in SVM mode\n");
5795+
5796+ if (req_vlan_fltr & NETIF_F_HW_VLAN_CTAG_FILTER)
5797+ features |= NETIF_F_HW_VLAN_CTAG_FILTER;
57855798 }
57865799 }
57875800
drivers/net/ethernet/intel/ice/ice_ptp.c+1−1
@@ -2271,7 +2271,7 @@ static int · 2270 unmodified lines
22712271 ice_ptp_init_tx_e822(struct ice_pf *pf, struct ice_ptp_tx *tx, u8 port)
22722272 {
22732273 tx->quad = port / ICE_PORTS_PER_QUAD;
2274− tx->quad_offset = tx->quad * INDEX_PER_PORT;
2274+ tx->quad_offset = (port % ICE_PORTS_PER_QUAD) * INDEX_PER_PORT;
22752275 tx->len = INDEX_PER_PORT;
22762276
22772277 return ice_ptp_alloc_tx_tracker(tx);
drivers/net/ethernet/intel/ice/ice_ptp.h+31−0
@@ -49,6 +49,37 @@ struct ice_perout_channel { · 48 unmodified lines
4949 * To allow multiple ports to access the shared register block independently,
5050 * the blocks are split up so that indexes are assigned to each port based on
5151 * hardware logical port number.
52+ *
53+ * The timestamp blocks are handled differently for E810- and E822-based
54+ * devices. In E810 devices, each port has its own block of timestamps, while in
55+ * E822 there is a need to logically break the block of registers into smaller
56+ * chunks based on the port number to avoid collisions.
57+ *
58+ * Example for port 5 in E810:
59+ * +--------+--------+--------+--------+--------+--------+--------+--------+
60+ * |register|register|register|register|register|register|register|register|
61+ * | block | block | block | block | block | block | block | block |
62+ * | for | for | for | for | for | for | for | for |
63+ * | port 0 | port 1 | port 2 | port 3 | port 4 | port 5 | port 6 | port 7 |
64+ * +--------+--------+--------+--------+--------+--------+--------+--------+
65+ * ^^
66+ * ||
67+ * |--- quad offset is always 0
68+ * ---- quad number
69+ *
70+ * Example for port 5 in E822:
71+ * +-----------------------------+-----------------------------+
72+ * | register block for quad 0 | register block for quad 1 |
73+ * |+------+------+------+------+|+------+------+------+------+|
74+ * ||port 0|port 1|port 2|port 3|||port 0|port 1|port 2|port 3||
75+ * |+------+------+------+------+|+------+------+------+------+|
76+ * +-----------------------------+-------^---------------------+
77+ * ^ |
78+ * | --- quad offset*
79+ * ---- quad number
80+ *
81+ * * PHY port 5 is port 1 in quad 1
82+ *
5283 */
5384
5485 /**
drivers/net/ethernet/intel/ice/ice_tc_lib.c+4−1
@@ -524,6 +524,7 @@ ice_eswitch_add_tc_fltr(struct ice_vsi *vsi, struct ice_tc_flower_fltr *fltr) · 523 unmodified lines
524524 */
525525 fltr->rid = rule_added.rid;
526526 fltr->rule_id = rule_added.rule_id;
527+ fltr->dest_id = rule_added.vsi_handle;
527528
528529 exit:
529530 kfree(list);
@@ -993,7 +994,9 @@ ice_parse_cls_flower(struct net_device *filter_dev, struct ice_vsi *vsi, · 463 unmodified lines
993994 n_proto_key = ntohs(match.key->n_proto);
994995 n_proto_mask = ntohs(match.mask->n_proto);
995996
996− if (n_proto_key == ETH_P_ALL || n_proto_key == 0) {
997+ if (n_proto_key == ETH_P_ALL || n_proto_key == 0 ||
998+ fltr->tunnel_type == TNL_GTPU ||
999+ fltr->tunnel_type == TNL_GTPC) {
9971000 n_proto_key = 0;
9981001 n_proto_mask = 0;
9991002 } else {
drivers/net/ethernet/intel/ice/ice_vf_lib.c+5−0
@@ -504,6 +504,11 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags) · 503 unmodified lines
504504 }
505505
506506 if (ice_is_vf_disabled(vf)) {
507+ vsi = ice_get_vf_vsi(vf);
508+ if (WARN_ON(!vsi))
509+ return -EINVAL;
510+ ice_vsi_stop_lan_tx_rings(vsi, ICE_NO_RESET, vf->vf_id);
511+ ice_vsi_stop_all_rx_rings(vsi);
507512 dev_dbg(dev, "VF is already disabled, there is no need for resetting it, telling VM, all is fine %d\n",
508513 vf->vf_id);
509514 return 0;
drivers/net/ethernet/intel/ice/ice_virtchnl.c+26−27
@@ -1569,35 +1569,27 @@ error_param: · 1568 unmodified lines
15691569 */
15701570 static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)
15711571 {
1572− enum virtchnl_status_code v_ret = VIRTCHNL_STATUS_SUCCESS;
15731572 struct virtchnl_vsi_queue_config_info *qci =
15741573 (struct virtchnl_vsi_queue_config_info *)msg;
15751574 struct virtchnl_queue_pair_info *qpi;
15761575 struct ice_pf *pf = vf->pf;
15771576 struct ice_vsi *vsi;
1578− int i, q_idx;
1577+ int i = -1, q_idx;
15791578
1580− if (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states)) {
1581− v_ret = VIRTCHNL_STATUS_ERR_PARAM;
1579+ if (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states))
15821580 goto error_param;
1583− }
15841581
1585− if (!ice_vc_isvalid_vsi_id(vf, qci->vsi_id)) {
1586− v_ret = VIRTCHNL_STATUS_ERR_PARAM;
1582+ if (!ice_vc_isvalid_vsi_id(vf, qci->vsi_id))
15871583 goto error_param;
1588− }
15891584
15901585 vsi = ice_get_vf_vsi(vf);
1591− if (!vsi) {
1592− v_ret = VIRTCHNL_STATUS_ERR_PARAM;
1586+ if (!vsi)
15931587 goto error_param;
1594− }
15951588
15961589 if (qci->num_queue_pairs > ICE_MAX_RSS_QS_PER_VF ||
15971590 qci->num_queue_pairs > min_t(u16, vsi->alloc_txq, vsi->alloc_rxq)) {
15981591 dev_err(ice_pf_to_dev(pf), "VF-%d requesting more than supported number of queues: %d\n",
15991592 vf->vf_id, min_t(u16, vsi->alloc_txq, vsi->alloc_rxq));
1600− v_ret = VIRTCHNL_STATUS_ERR_PARAM;
16011593 goto error_param;
16021594 }
16031595
@@ -1610,7 +1602,6 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg) · 6 unmodified lines
16101602 !ice_vc_isvalid_ring_len(qpi->txq.ring_len) ||
16111603 !ice_vc_isvalid_ring_len(qpi->rxq.ring_len) ||
16121604 !ice_vc_isvalid_q_id(vf, qci->vsi_id, qpi->txq.queue_id)) {
1613− v_ret = VIRTCHNL_STATUS_ERR_PARAM;
16141605 goto error_param;
16151606 }
16161607
@@ -1620,7 +1611,6 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg) · 3 unmodified lines
16201611 * for selected "vsi"
16211612 */
16221613 if (q_idx >= vsi->alloc_txq || q_idx >= vsi->alloc_rxq) {
1623− v_ret = VIRTCHNL_STATUS_ERR_PARAM;
16241614 goto error_param;
16251615 }
16261616
@@ -1630,14 +1620,13 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg) · 3 unmodified lines
16301620 vsi->tx_rings[i]->count = qpi->txq.ring_len;
16311621
16321622 /* Disable any existing queue first */
1633− if (ice_vf_vsi_dis_single_txq(vf, vsi, q_idx)) {
1634− v_ret = VIRTCHNL_STATUS_ERR_PARAM;
1623+ if (ice_vf_vsi_dis_single_txq(vf, vsi, q_idx))
16351624 goto error_param;
1636− }
16371625
16381626 /* Configure a queue with the requested settings */
16391627 if (ice_vsi_cfg_single_txq(vsi, vsi->tx_rings, q_idx)) {
1640− v_ret = VIRTCHNL_STATUS_ERR_PARAM;
1628+ dev_warn(ice_pf_to_dev(pf), "VF-%d failed to configure TX queue %d\n",
1629+ vf->vf_id, i);
16411630 goto error_param;
16421631 }
16431632 }
@@ -1651,17 +1640,13 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg) · 7 unmodified lines
16511640
16521641 if (qpi->rxq.databuffer_size != 0 &&
16531642 (qpi->rxq.databuffer_size > ((16 * 1024) - 128) ||
1654− qpi->rxq.databuffer_size < 1024)) {
1655− v_ret = VIRTCHNL_STATUS_ERR_PARAM;
1643+ qpi->rxq.databuffer_size < 1024))
16561644 goto error_param;
1657− }
16581645 vsi->rx_buf_len = qpi->rxq.databuffer_size;
16591646 vsi->rx_rings[i]->rx_buf_len = vsi->rx_buf_len;
16601647 if (qpi->rxq.max_pkt_size > max_frame_size ||
1661− qpi->rxq.max_pkt_size < 64) {
1662− v_ret = VIRTCHNL_STATUS_ERR_PARAM;
1648+ qpi->rxq.max_pkt_size < 64)
16631649 goto error_param;
1664− }
16651650
16661651 vsi->max_frame = qpi->rxq.max_pkt_size;
16671652 /* add space for the port VLAN since the VF driver is
@@ -1672,16 +1657,30 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg) · 4 unmodified lines
16721657 vsi->max_frame += VLAN_HLEN;
16731658
16741659 if (ice_vsi_cfg_single_rxq(vsi, q_idx)) {
1675− v_ret = VIRTCHNL_STATUS_ERR_PARAM;
1660+ dev_warn(ice_pf_to_dev(pf), "VF-%d failed to configure RX queue %d\n",
1661+ vf->vf_id, i);
16761662 goto error_param;
16771663 }
16781664 }
16791665 }
16801666
1667+ /* send the response to the VF */
1668+ return ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_CONFIG_VSI_QUEUES,
1669+ VIRTCHNL_STATUS_SUCCESS, NULL, 0);
16811670 error_param:
1671+ /* disable whatever we can */
1672+ for (; i >= 0; i--) {
1673+ if (ice_vsi_ctrl_one_rx_ring(vsi, false, i, true))
1674+ dev_err(ice_pf_to_dev(pf), "VF-%d could not disable RX queue %d\n",
1675+ vf->vf_id, i);
1676+ if (ice_vf_vsi_dis_single_txq(vf, vsi, i))
1677+ dev_err(ice_pf_to_dev(pf), "VF-%d could not disable TX queue %d\n",
1678+ vf->vf_id, i);
1679+ }
1680+
16821681 /* send the response to the VF */
1683− return ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_CONFIG_VSI_QUEUES, v_ret,
1684− NULL, 0);
1682+ return ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_CONFIG_VSI_QUEUES,
1683+ VIRTCHNL_STATUS_ERR_PARAM, NULL, 0);
16851684 }
16861685
16871686 /**
drivers/net/ethernet/intel/igb/igb_main.c+10−9
@@ -4819,8 +4819,11 @@ static void igb_clean_tx_ring(struct igb_ring *tx_ring) · 4818 unmodified lines
48194819 while (i != tx_ring->next_to_use) {
48204820 union e1000_adv_tx_desc *eop_desc, *tx_desc;
48214821
4822− /* Free all the Tx ring sk_buffs */
4823− dev_kfree_skb_any(tx_buffer->skb);
4822+ /* Free all the Tx ring sk_buffs or xdp frames */
4823+ if (tx_buffer->type == IGB_TYPE_SKB)
4824+ dev_kfree_skb_any(tx_buffer->skb);
4825+ else
4826+ xdp_return_frame(tx_buffer->xdpf);
48244827
48254828 /* unmap skb header data */
48264829 dma_unmap_single(tx_ring->dev,
@@ -9898,11 +9901,10 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba) · 5071 unmodified lines
98989901 struct e1000_hw *hw = &adapter->hw;
98999902 u32 dmac_thr;
99009903 u16 hwm;
9904+ u32 reg;
99019905
99029906 if (hw->mac.type > e1000_82580) {
99039907 if (adapter->flags & IGB_FLAG_DMAC) {
9904− u32 reg;
9905−
99069908 /* force threshold to 0. */
99079909 wr32(E1000_DMCTXTH, 0);
99089910
@@ -9935,7 +9937,6 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba) · 26 unmodified lines
99359937 /* Disable BMC-to-OS Watchdog Enable */
99369938 if (hw->mac.type != e1000_i354)
99379939 reg &= ~E1000_DMACR_DC_BMC2OSW_EN;
9938−
99399940 wr32(E1000_DMACR, reg);
99409941
99419942 /* no lower threshold to disable
@@ -9952,12 +9953,12 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba) · 10 unmodified lines
99529953 */
99539954 wr32(E1000_DMCTXTH, (IGB_MIN_TXPBSIZE -
99549955 (IGB_TX_BUF_4096 + adapter->max_frame_size)) >> 6);
9956+ }
99559957
9956− /* make low power state decision controlled
9957− * by DMA coal
9958− */
9958+ if (hw->mac.type >= e1000_i210 ||
9959+ (adapter->flags & IGB_FLAG_DMAC)) {
99599960 reg = rd32(E1000_PCIEMISC);
9960− reg &= ~E1000_PCIEMISC_LX_DECISION;
9961+ reg |= E1000_PCIEMISC_LX_DECISION;
99619962 wr32(E1000_PCIEMISC, reg);
99629963 } /* endif adapter->dmac is not disabled */
99639964 } else if (hw->mac.type == e1000_82580) {
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c+2−1
@@ -1390,7 +1390,8 @@ static int otx2vf_get_link_ksettings(struct net_device *netdev, · 1389 unmodified lines
13901390
13911391 static const struct ethtool_ops otx2vf_ethtool_ops = {
13921392 .supported_coalesce_params = ETHTOOL_COALESCE_USECS |
1393− ETHTOOL_COALESCE_MAX_FRAMES,
1393+ ETHTOOL_COALESCE_MAX_FRAMES |
1394+ ETHTOOL_COALESCE_USE_ADAPTIVE,
13941395 .supported_ring_params = ETHTOOL_RING_USE_RX_BUF_LEN |
13951396 ETHTOOL_RING_USE_CQE_SIZE,
13961397 .get_link = otx2_get_link,
drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.h+1−1
@@ -8,8 +8,8 @@ · 7 unmodified lines
88 #include "spectrum.h"
99
1010 enum mlxsw_sp_counter_sub_pool_id {
11− MLXSW_SP_COUNTER_SUB_POOL_FLOW,
1211 MLXSW_SP_COUNTER_SUB_POOL_RIF,
12+ MLXSW_SP_COUNTER_SUB_POOL_FLOW,
1313 };
1414
1515 int mlxsw_sp_counter_alloc(struct mlxsw_sp *mlxsw_sp,
drivers/net/ethernet/xilinx/xilinx_axienet.h+51−0
@@ -547,6 +547,57 @@ static inline void axienet_iow(struct axienet_local *lp, off_t offset, · 546 unmodified lines
547547 iowrite32(value, lp->regs + offset);
548548 }
549549
550+/**
551+ * axienet_dma_out32 - Memory mapped Axi DMA register write.
552+ * @lp: Pointer to axienet local structure
553+ * @reg: Address offset from the base address of the Axi DMA core
554+ * @value: Value to be written into the Axi DMA register
555+ *
556+ * This function writes the desired value into the corresponding Axi DMA
557+ * register.
558+ */
559+
560+static inline void axienet_dma_out32(struct axienet_local *lp,
561+ off_t reg, u32 value)
562+{
563+ iowrite32(value, lp->dma_regs + reg);
564+}
565+
566+#if defined(CONFIG_64BIT) && defined(iowrite64)
567+/**
568+ * axienet_dma_out64 - Memory mapped Axi DMA register write.
569+ * @lp: Pointer to axienet local structure
570+ * @reg: Address offset from the base address of the Axi DMA core
571+ * @value: Value to be written into the Axi DMA register
572+ *
573+ * This function writes the desired value into the corresponding Axi DMA
574+ * register.
575+ */
576+static inline void axienet_dma_out64(struct axienet_local *lp,
577+ off_t reg, u64 value)
578+{
579+ iowrite64(value, lp->dma_regs + reg);
580+}
581+
582+static inline void axienet_dma_out_addr(struct axienet_local *lp, off_t reg,
583+ dma_addr_t addr)
584+{
585+ if (lp->features & XAE_FEATURE_DMA_64BIT)
586+ axienet_dma_out64(lp, reg, addr);
587+ else
588+ axienet_dma_out32(lp, reg, lower_32_bits(addr));
589+}
590+
591+#else /* CONFIG_64BIT */
592+
593+static inline void axienet_dma_out_addr(struct axienet_local *lp, off_t reg,
594+ dma_addr_t addr)
595+{
596+ axienet_dma_out32(lp, reg, lower_32_bits(addr));
597+}
598+
599+#endif /* CONFIG_64BIT */
600+
550601 /* Function prototypes visible in xilinx_axienet_mdio.c for other files */
551602 int axienet_mdio_enable(struct axienet_local *lp);
552603 void axienet_mdio_disable(struct axienet_local *lp);
drivers/net/ethernet/xilinx/xilinx_axienet_main.c+5−24
@@ -133,30 +133,6 @@ static inline u32 axienet_dma_in32(struct axienet_local *lp, off_t reg) · 132 unmodified lines
133133 return ioread32(lp->dma_regs + reg);
134134 }
135135
136−/**
137− * axienet_dma_out32 - Memory mapped Axi DMA register write.
138− * @lp: Pointer to axienet local structure
139− * @reg: Address offset from the base address of the Axi DMA core
140− * @value: Value to be written into the Axi DMA register
141− *
142− * This function writes the desired value into the corresponding Axi DMA
143− * register.
144− */
145−static inline void axienet_dma_out32(struct axienet_local *lp,
146− off_t reg, u32 value)
147−{
148− iowrite32(value, lp->dma_regs + reg);
149−}
150−
151−static void axienet_dma_out_addr(struct axienet_local *lp, off_t reg,
152− dma_addr_t addr)
153−{
154− axienet_dma_out32(lp, reg, lower_32_bits(addr));
155−
156− if (lp->features & XAE_FEATURE_DMA_64BIT)
157− axienet_dma_out32(lp, reg + 4, upper_32_bits(addr));
158−}
159−
160136 static void desc_set_phys_addr(struct axienet_local *lp, dma_addr_t addr,
161137 struct axidma_bd *desc)
162138 {
@@ -2061,6 +2037,11 @@ static int axienet_probe(struct platform_device *pdev) · 1898 unmodified lines
20612037 iowrite32(0x0, desc);
20622038 }
20632039 }
2040+ if (!IS_ENABLED(CONFIG_64BIT) && lp->features & XAE_FEATURE_DMA_64BIT) {
2041+ dev_err(&pdev->dev, "64-bit addressable DMA is not compatible with 32-bit archecture\n");
2042+ ret = -EINVAL;
2043+ goto cleanup_clk;
2044+ }
20642045
20652046 ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(addr_width));
20662047 if (ret) {
drivers/net/hamradio/6pack.c+8−1
@@ -99,6 +99,7 @@ struct sixpack { · 98 unmodified lines
9999
100100 unsigned int rx_count;
101101 unsigned int rx_count_cooked;
102+ spinlock_t rxlock;
102103
103104 int mtu; /* Our mtu (to spot changes!) */
104105 int buffsize; /* Max buffers sizes */
@@ -565,6 +566,7 @@ static int sixpack_open(struct tty_struct *tty) · 460 unmodified lines
565566 sp->dev = dev;
566567
567568 spin_lock_init(&sp->lock);
569+ spin_lock_init(&sp->rxlock);
568570 refcount_set(&sp->refcnt, 1);
569571 init_completion(&sp->dead);
570572
@@ -913,6 +915,7 @@ static void decode_std_command(struct sixpack *sp, unsigned char cmd) · 342 unmodified lines
913915 sp->led_state = 0x60;
914916 /* fill trailing bytes with zeroes */
915917 sp->tty->ops->write(sp->tty, &sp->led_state, 1);
918+ spin_lock_bh(&sp->rxlock);
916919 rest = sp->rx_count;
917920 if (rest != 0)
918921 for (i = rest; i <= 3; i++)
@@ -930,6 +933,7 @@ static void decode_std_command(struct sixpack *sp, unsigned char cmd) · 11 unmodified lines
930933 sp_bump(sp, 0);
931934 }
932935 sp->rx_count_cooked = 0;
936+ spin_unlock_bh(&sp->rxlock);
933937 }
934938 break;
935939 case SIXP_TX_URUN: printk(KERN_DEBUG "6pack: TX underrun\n");
@@ -959,8 +963,11 @@ sixpack_decode(struct sixpack *sp, const unsigned char *pre_rbuff, int count) · 23 unmodified lines
959963 decode_prio_command(sp, inbyte);
960964 else if ((inbyte & SIXP_STD_CMD_MASK) != 0)
961965 decode_std_command(sp, inbyte);
962− else if ((sp->status & SIXP_RX_DCD_MASK) == SIXP_RX_DCD_MASK)
966+ else if ((sp->status & SIXP_RX_DCD_MASK) == SIXP_RX_DCD_MASK) {
967+ spin_lock_bh(&sp->rxlock);
963968 decode_data(sp, inbyte);
969+ spin_unlock_bh(&sp->rxlock);
970+ }
964971 }
965972 }
966973
drivers/net/phy/aquantia_main.c+14−1
@@ -34,6 +34,8 @@ · 33 unmodified lines
3434 #define MDIO_AN_VEND_PROV 0xc400
3535 #define MDIO_AN_VEND_PROV_1000BASET_FULL BIT(15)
3636 #define MDIO_AN_VEND_PROV_1000BASET_HALF BIT(14)
37+#define MDIO_AN_VEND_PROV_5000BASET_FULL BIT(11)
38+#define MDIO_AN_VEND_PROV_2500BASET_FULL BIT(10)
3739 #define MDIO_AN_VEND_PROV_DOWNSHIFT_EN BIT(4)
3840 #define MDIO_AN_VEND_PROV_DOWNSHIFT_MASK GENMASK(3, 0)
3941 #define MDIO_AN_VEND_PROV_DOWNSHIFT_DFLT 4
@@ -231,9 +233,20 @@ static int aqr_config_aneg(struct phy_device *phydev) · 191 unmodified lines
231233 phydev->advertising))
232234 reg |= MDIO_AN_VEND_PROV_1000BASET_HALF;
233235
236+ /* Handle the case when the 2.5G and 5G speeds are not advertised */
237+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT,
238+ phydev->advertising))
239+ reg |= MDIO_AN_VEND_PROV_2500BASET_FULL;
240+
241+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT,
242+ phydev->advertising))
243+ reg |= MDIO_AN_VEND_PROV_5000BASET_FULL;
244+
234245 ret = phy_modify_mmd_changed(phydev, MDIO_MMD_AN, MDIO_AN_VEND_PROV,
235246 MDIO_AN_VEND_PROV_1000BASET_HALF |
236− MDIO_AN_VEND_PROV_1000BASET_FULL, reg);
247+ MDIO_AN_VEND_PROV_1000BASET_FULL |
248+ MDIO_AN_VEND_PROV_2500BASET_FULL |
249+ MDIO_AN_VEND_PROV_5000BASET_FULL, reg);
237250 if (ret < 0)
238251 return ret;
239252 if (ret > 0)
drivers/net/phy/at803x.c+6−0
@@ -2072,6 +2072,8 @@ static struct phy_driver at803x_driver[] = { · 2071 unmodified lines
20722072 /* ATHEROS AR9331 */
20732073 PHY_ID_MATCH_EXACT(ATH9331_PHY_ID),
20742074 .name = "Qualcomm Atheros AR9331 built-in PHY",
2075+ .probe = at803x_probe,
2076+ .remove = at803x_remove,
20752077 .suspend = at803x_suspend,
20762078 .resume = at803x_resume,
20772079 .flags = PHY_POLL_CABLE_TEST,
@@ -2087,6 +2089,8 @@ static struct phy_driver at803x_driver[] = { · 9 unmodified lines
20872089 /* Qualcomm Atheros QCA9561 */
20882090 PHY_ID_MATCH_EXACT(QCA9561_PHY_ID),
20892091 .name = "Qualcomm Atheros QCA9561 built-in PHY",
2092+ .probe = at803x_probe,
2093+ .remove = at803x_remove,
20902094 .suspend = at803x_suspend,
20912095 .resume = at803x_resume,
20922096 .flags = PHY_POLL_CABLE_TEST,
@@ -2151,6 +2155,8 @@ static struct phy_driver at803x_driver[] = { · 58 unmodified lines
21512155 PHY_ID_MATCH_EXACT(QCA8081_PHY_ID),
21522156 .name = "Qualcomm QCA8081",
21532157 .flags = PHY_POLL_CABLE_TEST,
2158+ .probe = at803x_probe,
2159+ .remove = at803x_remove,
21542160 .config_intr = at803x_config_intr,
21552161 .handle_interrupt = at803x_handle_interrupt,
21562162 .get_tunable = at803x_get_tunable,
drivers/net/phy/smsc.c+4−2
@@ -110,7 +110,7 @@ static int smsc_phy_config_init(struct phy_device *phydev) · 109 unmodified lines
110110 struct smsc_phy_priv *priv = phydev->priv;
111111 int rc;
112112
113− if (!priv->energy_enable)
113+ if (!priv->energy_enable || phydev->irq != PHY_POLL)
114114 return 0;
115115
116116 rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS);
@@ -210,6 +210,8 @@ static int lan95xx_config_aneg_ext(struct phy_device *phydev) · 93 unmodified lines
210210 * response on link pulses to detect presence of plugged Ethernet cable.
211211 * The Energy Detect Power-Down mode is enabled again in the end of procedure to
212212 * save approximately 220 mW of power if cable is unplugged.
213+ * The workaround is only applicable to poll mode. Energy Detect Power-Down may
214+ * not be used in interrupt mode lest link change detection becomes unreliable.
213215 */
214216 static int lan87xx_read_status(struct phy_device *phydev)
215217 {
@@ -217,7 +219,7 @@ static int lan87xx_read_status(struct phy_device *phydev) · 1 unmodified line
217219
218220 int err = genphy_read_status(phydev);
219221
220− if (!phydev->link && priv->energy_enable) {
222+ if (!phydev->link && priv->energy_enable && phydev->irq == PHY_POLL) {
221223 /* Disable EDPD to wake up PHY */
222224 int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS);
223225 if (rc < 0)
drivers/net/usb/ax88179_178a.c+13−13
@@ -1750,7 +1750,7 @@ static const struct driver_info ax88179_info = { · 1749 unmodified lines
17501750 .link_reset = ax88179_link_reset,
17511751 .reset = ax88179_reset,
17521752 .stop = ax88179_stop,
1753− .flags = FLAG_ETHER | FLAG_FRAMING_AX,
1753+ .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
17541754 .rx_fixup = ax88179_rx_fixup,
17551755 .tx_fixup = ax88179_tx_fixup,
17561756 };
@@ -1763,7 +1763,7 @@ static const struct driver_info ax88178a_info = { · 6 unmodified lines
17631763 .link_reset = ax88179_link_reset,
17641764 .reset = ax88179_reset,
17651765 .stop = ax88179_stop,
1766− .flags = FLAG_ETHER | FLAG_FRAMING_AX,
1766+ .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
17671767 .rx_fixup = ax88179_rx_fixup,
17681768 .tx_fixup = ax88179_tx_fixup,
17691769 };
@@ -1776,7 +1776,7 @@ static const struct driver_info cypress_GX3_info = { · 6 unmodified lines
17761776 .link_reset = ax88179_link_reset,
17771777 .reset = ax88179_reset,
17781778 .stop = ax88179_stop,
1779− .flags = FLAG_ETHER | FLAG_FRAMING_AX,
1779+ .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
17801780 .rx_fixup = ax88179_rx_fixup,
17811781 .tx_fixup = ax88179_tx_fixup,
17821782 };
@@ -1789,7 +1789,7 @@ static const struct driver_info dlink_dub1312_info = { · 6 unmodified lines
17891789 .link_reset = ax88179_link_reset,
17901790 .reset = ax88179_reset,
17911791 .stop = ax88179_stop,
1792− .flags = FLAG_ETHER | FLAG_FRAMING_AX,
1792+ .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
17931793 .rx_fixup = ax88179_rx_fixup,
17941794 .tx_fixup = ax88179_tx_fixup,
17951795 };
@@ -1802,7 +1802,7 @@ static const struct driver_info sitecom_info = { · 6 unmodified lines
18021802 .link_reset = ax88179_link_reset,
18031803 .reset = ax88179_reset,
18041804 .stop = ax88179_stop,
1805− .flags = FLAG_ETHER | FLAG_FRAMING_AX,
1805+ .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
18061806 .rx_fixup = ax88179_rx_fixup,
18071807 .tx_fixup = ax88179_tx_fixup,
18081808 };
@@ -1815,7 +1815,7 @@ static const struct driver_info samsung_info = { · 6 unmodified lines
18151815 .link_reset = ax88179_link_reset,
18161816 .reset = ax88179_reset,
18171817 .stop = ax88179_stop,
1818− .flags = FLAG_ETHER | FLAG_FRAMING_AX,
1818+ .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
18191819 .rx_fixup = ax88179_rx_fixup,
18201820 .tx_fixup = ax88179_tx_fixup,
18211821 };
@@ -1828,7 +1828,7 @@ static const struct driver_info lenovo_info = { · 6 unmodified lines
18281828 .link_reset = ax88179_link_reset,
18291829 .reset = ax88179_reset,
18301830 .stop = ax88179_stop,
1831− .flags = FLAG_ETHER | FLAG_FRAMING_AX,
1831+ .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
18321832 .rx_fixup = ax88179_rx_fixup,
18331833 .tx_fixup = ax88179_tx_fixup,
18341834 };
@@ -1841,7 +1841,7 @@ static const struct driver_info belkin_info = { · 6 unmodified lines
18411841 .link_reset = ax88179_link_reset,
18421842 .reset = ax88179_reset,
18431843 .stop = ax88179_stop,
1844− .flags = FLAG_ETHER | FLAG_FRAMING_AX,
1844+ .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
18451845 .rx_fixup = ax88179_rx_fixup,
18461846 .tx_fixup = ax88179_tx_fixup,
18471847 };
@@ -1854,7 +1854,7 @@ static const struct driver_info toshiba_info = { · 6 unmodified lines
18541854 .link_reset = ax88179_link_reset,
18551855 .reset = ax88179_reset,
18561856 .stop = ax88179_stop,
1857− .flags = FLAG_ETHER | FLAG_FRAMING_AX,
1857+ .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
18581858 .rx_fixup = ax88179_rx_fixup,
18591859 .tx_fixup = ax88179_tx_fixup,
18601860 };
@@ -1867,7 +1867,7 @@ static const struct driver_info mct_info = { · 6 unmodified lines
18671867 .link_reset = ax88179_link_reset,
18681868 .reset = ax88179_reset,
18691869 .stop = ax88179_stop,
1870− .flags = FLAG_ETHER | FLAG_FRAMING_AX,
1870+ .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
18711871 .rx_fixup = ax88179_rx_fixup,
18721872 .tx_fixup = ax88179_tx_fixup,
18731873 };
@@ -1880,7 +1880,7 @@ static const struct driver_info at_umc2000_info = { · 6 unmodified lines
18801880 .link_reset = ax88179_link_reset,
18811881 .reset = ax88179_reset,
18821882 .stop = ax88179_stop,
1883− .flags = FLAG_ETHER | FLAG_FRAMING_AX,
1883+ .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
18841884 .rx_fixup = ax88179_rx_fixup,
18851885 .tx_fixup = ax88179_tx_fixup,
18861886 };
@@ -1893,7 +1893,7 @@ static const struct driver_info at_umc200_info = { · 6 unmodified lines
18931893 .link_reset = ax88179_link_reset,
18941894 .reset = ax88179_reset,
18951895 .stop = ax88179_stop,
1896− .flags = FLAG_ETHER | FLAG_FRAMING_AX,
1896+ .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
18971897 .rx_fixup = ax88179_rx_fixup,
18981898 .tx_fixup = ax88179_tx_fixup,
18991899 };
@@ -1906,7 +1906,7 @@ static const struct driver_info at_umc2000sp_info = { · 6 unmodified lines
19061906 .link_reset = ax88179_link_reset,
19071907 .reset = ax88179_reset,
19081908 .stop = ax88179_stop,
1909− .flags = FLAG_ETHER | FLAG_FRAMING_AX,
1909+ .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
19101910 .rx_fixup = ax88179_rx_fixup,
19111911 .tx_fixup = ax88179_tx_fixup,
19121912 };
drivers/net/veth.c+4−0
@@ -312,6 +312,7 @@ static bool veth_skb_is_eligible_for_gro(const struct net_device *dev, · 311 unmodified lines
312312 static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
313313 {
314314 struct veth_priv *rcv_priv, *priv = netdev_priv(dev);
315+ struct netdev_queue *queue = NULL;
315316 struct veth_rq *rq = NULL;
316317 struct net_device *rcv;
317318 int length = skb->len;
@@ -329,6 +330,7 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev) · 11 unmodified lines
329330 rxq = skb_get_queue_mapping(skb);
330331 if (rxq < rcv->real_num_rx_queues) {
331332 rq = &rcv_priv->rq[rxq];
333+ queue = netdev_get_tx_queue(dev, rxq);
332334
333335 /* The napi pointer is available when an XDP program is
334336 * attached or when GRO is enabled
@@ -340,6 +342,8 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev) · 5 unmodified lines
340342
341343 skb_tx_timestamp(skb);
342344 if (likely(veth_forward_skb(rcv, skb, rq, use_napi) == NET_RX_SUCCESS)) {
345+ if (queue)
346+ txq_trans_cond_update(queue);
343347 if (!use_napi)
344348 dev_lstats_add(dev, length);
345349 } else {
drivers/net/virtio_net.c+6−19
@@ -2768,7 +2768,6 @@ static const struct ethtool_ops virtnet_ethtool_ops = { · 2767 unmodified lines
27682768 static void virtnet_freeze_down(struct virtio_device *vdev)
27692769 {
27702770 struct virtnet_info *vi = vdev->priv;
2771− int i;
27722771
27732772 /* Make sure no work handler is accessing the device */
27742773 flush_work(&vi->config_work);
@@ -2776,14 +2775,8 @@ static void virtnet_freeze_down(struct virtio_device *vdev) · 1 unmodified line
27762775 netif_tx_lock_bh(vi->dev);
27772776 netif_device_detach(vi->dev);
27782777 netif_tx_unlock_bh(vi->dev);
2779− cancel_delayed_work_sync(&vi->refill);
2780−
2781− if (netif_running(vi->dev)) {
2782− for (i = 0; i < vi->max_queue_pairs; i++) {
2783− napi_disable(&vi->rq[i].napi);
2784− virtnet_napi_tx_disable(&vi->sq[i].napi);
2785− }
2786− }
2778+ if (netif_running(vi->dev))
2779+ virtnet_close(vi->dev);
27872780 }
27882781
27892782 static int init_vqs(struct virtnet_info *vi);
@@ -2791,7 +2784,7 @@ static int init_vqs(struct virtnet_info *vi); · 1 unmodified line
27912784 static int virtnet_restore_up(struct virtio_device *vdev)
27922785 {
27932786 struct virtnet_info *vi = vdev->priv;
2794− int err, i;
2787+ int err;
27952788
27962789 err = init_vqs(vi);
27972790 if (err)
@@ -2800,15 +2793,9 @@ static int virtnet_restore_up(struct virtio_device *vdev) · 2 unmodified lines
28002793 virtio_device_ready(vdev);
28012794
28022795 if (netif_running(vi->dev)) {
2803− for (i = 0; i < vi->curr_queue_pairs; i++)
2804− if (!try_fill_recv(vi, &vi->rq[i], GFP_KERNEL))
2805− schedule_delayed_work(&vi->refill, 0);
2806−
2807− for (i = 0; i < vi->max_queue_pairs; i++) {
2808− virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi);
2809− virtnet_napi_tx_enable(vi, vi->sq[i].vq,
2810− &vi->sq[i].napi);
2811− }
2796+ err = virtnet_open(vi->dev);
2797+ if (err)
2798+ return err;
28122799 }
28132800
28142801 netif_tx_lock_bh(vi->dev);
drivers/nvme/host/core.c+17−2
@@ -2546,6 +2546,20 @@ static const struct nvme_core_quirk_entry core_quirks[] = { · 2545 unmodified lines
25462546 .vid = 0x1e0f,
25472547 .mn = "KCD6XVUL6T40",
25482548 .quirks = NVME_QUIRK_NO_APST,
2549+ },
2550+ {
2551+ /*
2552+ * The external Samsung X5 SSD fails initialization without a
2553+ * delay before checking if it is ready and has a whole set of
2554+ * other problems. To make this even more interesting, it
2555+ * shares the PCI ID with internal Samsung 970 Evo Plus that
2556+ * does not need or want these quirks.
2557+ */
2558+ .vid = 0x144d,
2559+ .mn = "Samsung Portable SSD X5",
2560+ .quirks = NVME_QUIRK_DELAY_BEFORE_CHK_RDY |
2561+ NVME_QUIRK_NO_DEEPEST_PS |
2562+ NVME_QUIRK_IGNORE_DEV_SUBNQN,
25492563 }
25502564 };
25512565
@@ -3285,8 +3299,8 @@ static ssize_t uuid_show(struct device *dev, struct device_attribute *attr, · 733 unmodified lines
32853299 * we have no UUID set
32863300 */
32873301 if (uuid_is_null(&ids->uuid)) {
3288− printk_ratelimited(KERN_WARNING
3289− "No UUID available providing old NGUID\n");
3302+ dev_warn_ratelimited(dev,
3303+ "No UUID available providing old NGUID\n");
32903304 return sysfs_emit(buf, "%pU\n", ids->nguid);
32913305 }
32923306 return sysfs_emit(buf, "%pU\n", &ids->uuid);
@@ -3863,6 +3877,7 @@ static int nvme_init_ns_head(struct nvme_ns *ns, unsigned nsid, · 570 unmodified lines
38633877 if (ret) {
38643878 dev_err(ctrl->device,
38653879 "globally duplicate IDs for nsid %d\n", nsid);
3880+ nvme_print_device_info(ctrl);
38663881 return ret;
38673882 }
38683883
drivers/nvme/host/nvme.h+28−0
@@ -503,6 +503,7 @@ struct nvme_ctrl_ops { · 502 unmodified lines
503503 void (*submit_async_event)(struct nvme_ctrl *ctrl);
504504 void (*delete_ctrl)(struct nvme_ctrl *ctrl);
505505 int (*get_address)(struct nvme_ctrl *ctrl, char *buf, int size);
506+ void (*print_device_info)(struct nvme_ctrl *ctrl);
506507 };
507508
508509 /*
@@ -548,6 +549,33 @@ static inline struct request *nvme_cid_to_rq(struct blk_mq_tags *tags, · 39 unmodified lines
548549 return blk_mq_tag_to_rq(tags, nvme_tag_from_cid(command_id));
549550 }
550551
552+/*
553+ * Return the length of the string without the space padding
554+ */
555+static inline int nvme_strlen(char *s, int len)
556+{
557+ while (s[len - 1] == ' ')
558+ len--;
559+ return len;
560+}
561+
562+static inline void nvme_print_device_info(struct nvme_ctrl *ctrl)
563+{
564+ struct nvme_subsystem *subsys = ctrl->subsys;
565+
566+ if (ctrl->ops->print_device_info) {
567+ ctrl->ops->print_device_info(ctrl);
568+ return;
569+ }
570+
571+ dev_err(ctrl->device,
572+ "VID:%04x model:%.*s firmware:%.*s\n", subsys->vendor_id,
573+ nvme_strlen(subsys->model, sizeof(subsys->model)),
574+ subsys->model, nvme_strlen(subsys->firmware_rev,
575+ sizeof(subsys->firmware_rev)),
576+ subsys->firmware_rev);
577+}
578+
551579 #ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
552580 void nvme_fault_inject_init(struct nvme_fault_inject *fault_inj,
553581 const char *dev_name);
drivers/nvme/host/pci.c+44−5
@@ -1334,6 +1334,14 @@ static void nvme_warn_reset(struct nvme_dev *dev, u32 csts) · 1333 unmodified lines
13341334 dev_warn(dev->ctrl.device,
13351335 "controller is down; will reset: CSTS=0x%x, PCI_STATUS read failed (%d)\n",
13361336 csts, result);
1337+
1338+ if (csts != ~0)
1339+ return;
1340+
1341+ dev_warn(dev->ctrl.device,
1342+ "Does your device have a faulty power saving mode enabled?\n");
1343+ dev_warn(dev->ctrl.device,
1344+ "Try \"nvme_core.default_ps_max_latency_us=0 pcie_aspm=off\" and report a bug\n");
13371345 }
13381346
13391347 static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
@@ -2976,6 +2984,21 @@ static int nvme_pci_get_address(struct nvme_ctrl *ctrl, char *buf, int size) · 1636 unmodified lines
29762984 return snprintf(buf, size, "%s\n", dev_name(&pdev->dev));
29772985 }
29782986
2987+
2988+static void nvme_pci_print_device_info(struct nvme_ctrl *ctrl)
2989+{
2990+ struct pci_dev *pdev = to_pci_dev(to_nvme_dev(ctrl)->dev);
2991+ struct nvme_subsystem *subsys = ctrl->subsys;
2992+
2993+ dev_err(ctrl->device,
2994+ "VID:DID %04x:%04x model:%.*s firmware:%.*s\n",
2995+ pdev->vendor, pdev->device,
2996+ nvme_strlen(subsys->model, sizeof(subsys->model)),
2997+ subsys->model, nvme_strlen(subsys->firmware_rev,
2998+ sizeof(subsys->firmware_rev)),
2999+ subsys->firmware_rev);
3000+}
3001+
29793002 static const struct nvme_ctrl_ops nvme_pci_ctrl_ops = {
29803003 .name = "pcie",
29813004 .module = THIS_MODULE,
@@ -2987,6 +3010,7 @@ static const struct nvme_ctrl_ops nvme_pci_ctrl_ops = { · 5 unmodified lines
29873010 .free_ctrl = nvme_pci_free_ctrl,
29883011 .submit_async_event = nvme_pci_submit_async_event,
29893012 .get_address = nvme_pci_get_address,
3013+ .print_device_info = nvme_pci_print_device_info,
29903014 };
29913015
29923016 static int nvme_dev_map(struct nvme_dev *dev)
@@ -3421,7 +3445,8 @@ static const struct pci_device_id nvme_id_table[] = { · 428 unmodified lines
34213445 { PCI_VDEVICE(REDHAT, 0x0010), /* Qemu emulated controller */
34223446 .driver_data = NVME_QUIRK_BOGUS_NID, },
34233447 { PCI_DEVICE(0x126f, 0x2263), /* Silicon Motion unidentified */
3424− .driver_data = NVME_QUIRK_NO_NS_DESC_LIST, },
3448+ .driver_data = NVME_QUIRK_NO_NS_DESC_LIST |
3449+ NVME_QUIRK_BOGUS_NID, },
34253450 { PCI_DEVICE(0x1bb1, 0x0100), /* Seagate Nytro Flash Storage */
34263451 .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY |
34273452 NVME_QUIRK_NO_NS_DESC_LIST, },
@@ -3437,6 +3462,8 @@ static const struct pci_device_id nvme_id_table[] = { · 9 unmodified lines
34373462 .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY |
34383463 NVME_QUIRK_DISABLE_WRITE_ZEROES|
34393464 NVME_QUIRK_IGNORE_DEV_SUBNQN, },
3465+ { PCI_DEVICE(0x1987, 0x5012), /* Phison E12 */
3466+ .driver_data = NVME_QUIRK_BOGUS_NID, },
34403467 { PCI_DEVICE(0x1987, 0x5016), /* Phison E16 */
34413468 .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, },
34423469 { PCI_DEVICE(0x1b4b, 0x1092), /* Lexar 256 GB SSD */
@@ -3447,12 +3474,24 @@ static const struct pci_device_id nvme_id_table[] = { · 4 unmodified lines
34473474 { PCI_DEVICE(0x1cc1, 0x8201), /* ADATA SX8200PNP 512GB */
34483475 .driver_data = NVME_QUIRK_NO_DEEPEST_PS |
34493476 NVME_QUIRK_IGNORE_DEV_SUBNQN, },
3477+ { PCI_DEVICE(0x1344, 0x5407), /* Micron Technology Inc NVMe SSD */
3478+ .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN },
34503479 { PCI_DEVICE(0x1c5c, 0x1504), /* SK Hynix PC400 */
34513480 .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
3481+ { PCI_DEVICE(0x1c5c, 0x174a), /* SK Hynix P31 SSD */
3482+ .driver_data = NVME_QUIRK_BOGUS_NID, },
34523483 { PCI_DEVICE(0x15b7, 0x2001), /* Sandisk Skyhawk */
34533484 .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
34543485 { PCI_DEVICE(0x1d97, 0x2263), /* SPCC */
34553486 .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
3487+ { PCI_DEVICE(0x144d, 0xa80b), /* Samsung PM9B1 256G and 512G */
3488+ .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
3489+ { PCI_DEVICE(0x144d, 0xa809), /* Samsung MZALQ256HBJD 256G */
3490+ .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
3491+ { PCI_DEVICE(0x1cc4, 0x6303), /* UMIS RPJTJ512MGE1QDY 512G */
3492+ .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
3493+ { PCI_DEVICE(0x1cc4, 0x6302), /* UMIS RPJTJ256MGE1QDY 256G */
3494+ .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
34563495 { PCI_DEVICE(0x2646, 0x2262), /* KINGSTON SKC2000 NVMe SSD */
34573496 .driver_data = NVME_QUIRK_NO_DEEPEST_PS, },
34583497 { PCI_DEVICE(0x2646, 0x2263), /* KINGSTON A2000 NVMe SSD */
@@ -3463,6 +3502,10 @@ static const struct pci_device_id nvme_id_table[] = { · 4 unmodified lines
34633502 .driver_data = NVME_QUIRK_BOGUS_NID, },
34643503 { PCI_DEVICE(0x1e4B, 0x1202), /* MAXIO MAP1202 */
34653504 .driver_data = NVME_QUIRK_BOGUS_NID, },
3505+ { PCI_DEVICE(0x1cc1, 0x5350), /* ADATA XPG GAMMIX S50 */
3506+ .driver_data = NVME_QUIRK_BOGUS_NID, },
3507+ { PCI_DEVICE(0x1e49, 0x0041), /* ZHITAI TiPro7000 NVMe SSD */
3508+ .driver_data = NVME_QUIRK_NO_DEEPEST_PS, },
34663509 { PCI_DEVICE(PCI_VENDOR_ID_AMAZON, 0x0061),
34673510 .driver_data = NVME_QUIRK_DMA_ADDRESS_BITS_48, },
34683511 { PCI_DEVICE(PCI_VENDOR_ID_AMAZON, 0x0065),
@@ -3483,10 +3526,6 @@ static const struct pci_device_id nvme_id_table[] = { · 14 unmodified lines
34833526 NVME_QUIRK_128_BYTES_SQES |
34843527 NVME_QUIRK_SHARED_TAGS |
34853528 NVME_QUIRK_SKIP_CID_GEN },
3486− { PCI_DEVICE(0x144d, 0xa808), /* Samsung X5 */
3487− .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY|
3488− NVME_QUIRK_NO_DEEPEST_PS |
3489− NVME_QUIRK_IGNORE_DEV_SUBNQN, },
34903529 { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) },
34913530 { 0, }
34923531 };
drivers/regulator/qcom_smd-regulator.c+4−4
@@ -723,19 +723,19 @@ static const struct regulator_desc pms405_pldo600 = { · 722 unmodified lines
723723
724724 static const struct regulator_desc mp5496_smpa2 = {
725725 .linear_ranges = (struct linear_range[]) {
726− REGULATOR_LINEAR_RANGE(725000, 0, 27, 12500),
726+ REGULATOR_LINEAR_RANGE(600000, 0, 127, 12500),
727727 },
728728 .n_linear_ranges = 1,
729− .n_voltages = 28,
729+ .n_voltages = 128,
730730 .ops = &rpm_mp5496_ops,
731731 };
732732
733733 static const struct regulator_desc mp5496_ldoa2 = {
734734 .linear_ranges = (struct linear_range[]) {
735− REGULATOR_LINEAR_RANGE(1800000, 0, 60, 25000),
735+ REGULATOR_LINEAR_RANGE(800000, 0, 127, 25000),
736736 },
737737 .n_linear_ranges = 1,
738− .n_voltages = 61,
738+ .n_voltages = 128,
739739 .ops = &rpm_mp5496_ops,
740740 };
741741
drivers/scsi/ibmvscsi/ibmvfc.c+64−18
@@ -160,8 +160,8 @@ static void ibmvfc_npiv_logout(struct ibmvfc_host *); · 159 unmodified lines
160160 static void ibmvfc_tgt_implicit_logout_and_del(struct ibmvfc_target *);
161161 static void ibmvfc_tgt_move_login(struct ibmvfc_target *);
162162
163−static void ibmvfc_release_sub_crqs(struct ibmvfc_host *);
164−static void ibmvfc_init_sub_crqs(struct ibmvfc_host *);
163+static void ibmvfc_dereg_sub_crqs(struct ibmvfc_host *);
164+static void ibmvfc_reg_sub_crqs(struct ibmvfc_host *);
165165
166166 static const char *unknown_error = "unknown error";
167167
@@ -917,7 +917,7 @@ static int ibmvfc_reenable_crq_queue(struct ibmvfc_host *vhost) · 749 unmodified lines
917917 struct vio_dev *vdev = to_vio_dev(vhost->dev);
918918 unsigned long flags;
919919
920− ibmvfc_release_sub_crqs(vhost);
920+ ibmvfc_dereg_sub_crqs(vhost);
921921
922922 /* Re-enable the CRQ */
923923 do {
@@ -936,7 +936,7 @@ static int ibmvfc_reenable_crq_queue(struct ibmvfc_host *vhost) · 12 unmodified lines
936936 spin_unlock(vhost->crq.q_lock);
937937 spin_unlock_irqrestore(vhost->host->host_lock, flags);
938938
939− ibmvfc_init_sub_crqs(vhost);
939+ ibmvfc_reg_sub_crqs(vhost);
940940
941941 return rc;
942942 }
@@ -955,7 +955,7 @@ static int ibmvfc_reset_crq(struct ibmvfc_host *vhost) · 12 unmodified lines
955955 struct vio_dev *vdev = to_vio_dev(vhost->dev);
956956 struct ibmvfc_queue *crq = &vhost->crq;
957957
958− ibmvfc_release_sub_crqs(vhost);
958+ ibmvfc_dereg_sub_crqs(vhost);
959959
960960 /* Close the CRQ */
961961 do {
@@ -988,7 +988,7 @@ static int ibmvfc_reset_crq(struct ibmvfc_host *vhost) · 26 unmodified lines
988988 spin_unlock(vhost->crq.q_lock);
989989 spin_unlock_irqrestore(vhost->host->host_lock, flags);
990990
991− ibmvfc_init_sub_crqs(vhost);
991+ ibmvfc_reg_sub_crqs(vhost);
992992
993993 return rc;
994994 }
@@ -5682,6 +5682,8 @@ static int ibmvfc_alloc_queue(struct ibmvfc_host *vhost, · 4687 unmodified lines
56825682 queue->cur = 0;
56835683 queue->fmt = fmt;
56845684 queue->size = PAGE_SIZE / fmt_size;
5685+
5686+ queue->vhost = vhost;
56855687 return 0;
56865688 }
56875689
@@ -5757,9 +5759,6 @@ static int ibmvfc_register_scsi_channel(struct ibmvfc_host *vhost, · 69 unmodified lines
57575759
57585760 ENTER;
57595761
5760− if (ibmvfc_alloc_queue(vhost, scrq, IBMVFC_SUB_CRQ_FMT))
5761− return -ENOMEM;
5762−
57635762 rc = h_reg_sub_crq(vdev->unit_address, scrq->msg_token, PAGE_SIZE,
57645763 &scrq->cookie, &scrq->hw_irq);
57655764
@@ -5790,7 +5789,6 @@ static int ibmvfc_register_scsi_channel(struct ibmvfc_host *vhost, · 24 unmodified lines
57905789 }
57915790
57925791 scrq->hwq_id = index;
5793− scrq->vhost = vhost;
57945792
57955793 LEAVE;
57965794 return 0;
@@ -5800,7 +5798,6 @@ irq_failed: · 3 unmodified lines
58005798 rc = plpar_hcall_norets(H_FREE_SUB_CRQ, vdev->unit_address, scrq->cookie);
58015799 } while (rtas_busy_delay(rc));
58025800 reg_failed:
5803− ibmvfc_free_queue(vhost, scrq);
58045801 LEAVE;
58055802 return rc;
58065803 }
@@ -5826,12 +5823,50 @@ static void ibmvfc_deregister_scsi_channel(struct ibmvfc_host *vhost, int index) · 19 unmodified lines
58265823 if (rc)
58275824 dev_err(dev, "Failed to free sub-crq[%d]: rc=%ld\n", index, rc);
58285825
5829− ibmvfc_free_queue(vhost, scrq);
5826+ /* Clean out the queue */
5827+ memset(scrq->msgs.crq, 0, PAGE_SIZE);
5828+ scrq->cur = 0;
5829+
5830+ LEAVE;
5831+}
5832+
5833+static void ibmvfc_reg_sub_crqs(struct ibmvfc_host *vhost)
5834+{
5835+ int i, j;
5836+
5837+ ENTER;
5838+ if (!vhost->mq_enabled || !vhost->scsi_scrqs.scrqs)
5839+ return;
5840+
5841+ for (i = 0; i < nr_scsi_hw_queues; i++) {
5842+ if (ibmvfc_register_scsi_channel(vhost, i)) {
5843+ for (j = i; j > 0; j--)
5844+ ibmvfc_deregister_scsi_channel(vhost, j - 1);
5845+ vhost->do_enquiry = 0;
5846+ return;
5847+ }
5848+ }
5849+
5850+ LEAVE;
5851+}
5852+
5853+static void ibmvfc_dereg_sub_crqs(struct ibmvfc_host *vhost)
5854+{
5855+ int i;
5856+
5857+ ENTER;
5858+ if (!vhost->mq_enabled || !vhost->scsi_scrqs.scrqs)
5859+ return;
5860+
5861+ for (i = 0; i < nr_scsi_hw_queues; i++)
5862+ ibmvfc_deregister_scsi_channel(vhost, i);
5863+
58305864 LEAVE;
58315865 }
58325866
58335867 static void ibmvfc_init_sub_crqs(struct ibmvfc_host *vhost)
58345868 {
5869+ struct ibmvfc_queue *scrq;
58355870 int i, j;
58365871
58375872 ENTER;
@@ -5847,30 +5882,41 @@ static void ibmvfc_init_sub_crqs(struct ibmvfc_host *vhost) · 9 unmodified lines
58475882 }
58485883
58495884 for (i = 0; i < nr_scsi_hw_queues; i++) {
5850− if (ibmvfc_register_scsi_channel(vhost, i)) {
5851− for (j = i; j > 0; j--)
5852− ibmvfc_deregister_scsi_channel(vhost, j - 1);
5885+ scrq = &vhost->scsi_scrqs.scrqs[i];
5886+ if (ibmvfc_alloc_queue(vhost, scrq, IBMVFC_SUB_CRQ_FMT)) {
5887+ for (j = i; j > 0; j--) {
5888+ scrq = &vhost->scsi_scrqs.scrqs[j - 1];
5889+ ibmvfc_free_queue(vhost, scrq);
5890+ }
58535891 kfree(vhost->scsi_scrqs.scrqs);
58545892 vhost->scsi_scrqs.scrqs = NULL;
58555893 vhost->scsi_scrqs.active_queues = 0;
58565894 vhost->do_enquiry = 0;
5857− break;
5895+ vhost->mq_enabled = 0;
5896+ return;
58585897 }
58595898 }
58605899
5900+ ibmvfc_reg_sub_crqs(vhost);
5901+
58615902 LEAVE;
58625903 }
58635904
58645905 static void ibmvfc_release_sub_crqs(struct ibmvfc_host *vhost)
58655906 {
5907+ struct ibmvfc_queue *scrq;
58665908 int i;
58675909
58685910 ENTER;
58695911 if (!vhost->scsi_scrqs.scrqs)
58705912 return;
58715913
5872− for (i = 0; i < nr_scsi_hw_queues; i++)
5873− ibmvfc_deregister_scsi_channel(vhost, i);
5914+ ibmvfc_dereg_sub_crqs(vhost);
5915+
5916+ for (i = 0; i < nr_scsi_hw_queues; i++) {
5917+ scrq = &vhost->scsi_scrqs.scrqs[i];
5918+ ibmvfc_free_queue(vhost, scrq);
5919+ }
58745920
58755921 kfree(vhost->scsi_scrqs.scrqs);
58765922 vhost->scsi_scrqs.scrqs = NULL;
drivers/scsi/ibmvscsi/ibmvfc.h+1−1
@@ -789,6 +789,7 @@ struct ibmvfc_queue { · 788 unmodified lines
789789 spinlock_t _lock;
790790 spinlock_t *q_lock;
791791
792+ struct ibmvfc_host *vhost;
792793 struct ibmvfc_event_pool evt_pool;
793794 struct list_head sent;
794795 struct list_head free;
@@ -797,7 +798,6 @@ struct ibmvfc_queue { · 2 unmodified lines
797798 union ibmvfc_iu cancel_rsp;
798799
799800 /* Sub-CRQ fields */
800− struct ibmvfc_host *vhost;
801801 unsigned long cookie;
802802 unsigned long vios_cookie;
803803 unsigned long hw_irq;
drivers/scsi/scsi_debug.c+20−2
@@ -2826,6 +2826,24 @@ static void zbc_open_zone(struct sdebug_dev_info *devip, · 2825 unmodified lines
28262826 }
28272827 }
28282828
2829+static inline void zbc_set_zone_full(struct sdebug_dev_info *devip,
2830+ struct sdeb_zone_state *zsp)
2831+{
2832+ switch (zsp->z_cond) {
2833+ case ZC2_IMPLICIT_OPEN:
2834+ devip->nr_imp_open--;
2835+ break;
2836+ case ZC3_EXPLICIT_OPEN:
2837+ devip->nr_exp_open--;
2838+ break;
2839+ default:
2840+ WARN_ONCE(true, "Invalid zone %llu condition %x\n",
2841+ zsp->z_start, zsp->z_cond);
2842+ break;
2843+ }
2844+ zsp->z_cond = ZC5_FULL;
2845+}
2846+
28292847 static void zbc_inc_wp(struct sdebug_dev_info *devip,
28302848 unsigned long long lba, unsigned int num)
28312849 {
@@ -2838,7 +2856,7 @@ static void zbc_inc_wp(struct sdebug_dev_info *devip, · 6 unmodified lines
28382856 if (zsp->z_type == ZBC_ZTYPE_SWR) {
28392857 zsp->z_wp += num;
28402858 if (zsp->z_wp >= zend)
2841− zsp->z_cond = ZC5_FULL;
2859+ zbc_set_zone_full(devip, zsp);
28422860 return;
28432861 }
28442862
@@ -2857,7 +2875,7 @@ static void zbc_inc_wp(struct sdebug_dev_info *devip, · 12 unmodified lines
28572875 n = num;
28582876 }
28592877 if (zsp->z_wp >= zend)
2860− zsp->z_cond = ZC5_FULL;
2878+ zbc_set_zone_full(devip, zsp);
28612879
28622880 num -= n;
28632881 lba += n;
drivers/scsi/scsi_transport_iscsi.c+6−1
@@ -212,7 +212,12 @@ iscsi_create_endpoint(int dd_size) · 211 unmodified lines
212212 return NULL;
213213
214214 mutex_lock(&iscsi_ep_idr_mutex);
215− id = idr_alloc(&iscsi_ep_idr, ep, 0, -1, GFP_NOIO);
215+
216+ /*
217+ * First endpoint id should be 1 to comply with user space
218+ * applications (iscsid).
219+ */
220+ id = idr_alloc(&iscsi_ep_idr, ep, 1, -1, GFP_NOIO);
216221 if (id < 0) {
217222 mutex_unlock(&iscsi_ep_idr_mutex);
218223 printk(KERN_ERR "Could not allocate endpoint ID. Error %d.\n",
drivers/scsi/storvsc_drv.c+22−5
@@ -1844,7 +1844,7 @@ static struct scsi_host_template scsi_driver = { · 1843 unmodified lines
18441844 .cmd_per_lun = 2048,
18451845 .this_id = -1,
18461846 /* Ensure there are no gaps in presented sgls */
1847− .virt_boundary_mask = PAGE_SIZE-1,
1847+ .virt_boundary_mask = HV_HYP_PAGE_SIZE - 1,
18481848 .no_write_same = 1,
18491849 .track_queue_depth = 1,
18501850 .change_queue_depth = storvsc_change_queue_depth,
@@ -1895,6 +1895,7 @@ static int storvsc_probe(struct hv_device *device, · 44 unmodified lines
18951895 int target = 0;
18961896 struct storvsc_device *stor_device;
18971897 int max_sub_channels = 0;
1898+ u32 max_xfer_bytes;
18981899
18991900 /*
19001901 * We support sub-channels for storage on SCSI and FC controllers.
@@ -1968,12 +1969,28 @@ static int storvsc_probe(struct hv_device *device, · 67 unmodified lines
19681969 }
19691970 /* max cmd length */
19701971 host->max_cmd_len = STORVSC_MAX_CMD_LEN;
1971−
19721972 /*
1973− * set the table size based on the info we got
1974− * from the host.
1973+ * Any reasonable Hyper-V configuration should provide
1974+ * max_transfer_bytes value aligning to HV_HYP_PAGE_SIZE,
1975+ * protecting it from any weird value.
1976+ */
1977+ max_xfer_bytes = round_down(stor_device->max_transfer_bytes, HV_HYP_PAGE_SIZE);
1978+ /* max_hw_sectors_kb */
1979+ host->max_sectors = max_xfer_bytes >> 9;
1980+ /*
1981+ * There are 2 requirements for Hyper-V storvsc sgl segments,
1982+ * based on which the below calculation for max segments is
1983+ * done:
1984+ *
1985+ * 1. Except for the first and last sgl segment, all sgl segments
1986+ * should be align to HV_HYP_PAGE_SIZE, that also means the
1987+ * maximum number of segments in a sgl can be calculated by
1988+ * dividing the total max transfer length by HV_HYP_PAGE_SIZE.
1989+ *
1990+ * 2. Except for the first and last, each entry in the SGL must
1991+ * have an offset that is a multiple of HV_HYP_PAGE_SIZE.
19751992 */
1976− host->sg_tablesize = (stor_device->max_transfer_bytes >> PAGE_SHIFT);
1993+ host->sg_tablesize = (max_xfer_bytes >> HV_HYP_PAGE_SHIFT) + 1;
19771994 /*
19781995 * For non-IDE disks, the host supports multiple channels.
19791996 * Set the number of HW queues we are supporting.
drivers/soc/bcm/brcmstb/pm/pm-arm.c+1−0
@@ -783,6 +783,7 @@ static int brcmstb_pm_probe(struct platform_device *pdev) · 782 unmodified lines
783783 }
784784
785785 ret = brcmstb_init_sram(dn);
786+ of_node_put(dn);
786787 if (ret) {
787788 pr_err("error setting up SRAM for PM\n");
788789 return ret;
drivers/soc/imx/imx8m-blk-ctrl.c+1−1
@@ -667,7 +667,7 @@ static const struct imx8m_blk_ctrl_domain_data imx8mp_media_blk_ctl_domain_data[ · 666 unmodified lines
667667 },
668668 [IMX8MP_MEDIABLK_PD_LCDIF_2] = {
669669 .name = "mediablk-lcdif-2",
670− .clk_names = (const char *[]){ "disp1", "apb", "axi", },
670+ .clk_names = (const char *[]){ "disp2", "apb", "axi", },
671671 .num_clks = 3,
672672 .gpc_name = "lcdif2",
673673 .rst_mask = BIT(11) | BIT(12) | BIT(24),
drivers/spi/spi-cadence.c+31−6
@@ -69,6 +69,7 @@ · 68 unmodified lines
6969 #define CDNS_SPI_BAUD_DIV_SHIFT 3 /* Baud rate divisor shift in CR */
7070 #define CDNS_SPI_SS_SHIFT 10 /* Slave Select field shift in CR */
7171 #define CDNS_SPI_SS0 0x1 /* Slave Select zero */
72+#define CDNS_SPI_NOSS 0x3C /* No Slave select */
7273
7374 /*
7475 * SPI Interrupt Registers bit Masks
@@ -92,9 +93,6 @@ · 17 unmodified lines
9293 #define CDNS_SPI_ER_ENABLE 0x00000001 /* SPI Enable Bit Mask */
9394 #define CDNS_SPI_ER_DISABLE 0x0 /* SPI Disable Bit Mask */
9495
95−/* SPI FIFO depth in bytes */
96−#define CDNS_SPI_FIFO_DEPTH 128
97−
9896 /* Default number of chip select lines */
9997 #define CDNS_SPI_DEFAULT_NUM_CS 4
10098
@@ -110,6 +108,7 @@ · 9 unmodified lines
110108 * @rx_bytes: Number of bytes requested
111109 * @dev_busy: Device busy flag
112110 * @is_decoded_cs: Flag for decoder property set or not
111+ * @tx_fifo_depth: Depth of the TX FIFO
113112 */
114113 struct cdns_spi {
115114 void __iomem *regs;
@@ -123,6 +122,7 @@ struct cdns_spi { · 7 unmodified lines
123122 int rx_bytes;
124123 u8 dev_busy;
125124 u32 is_decoded_cs;
125+ unsigned int tx_fifo_depth;
126126 };
127127
128128 /* Macros for the SPI controller read/write */
@@ -304,7 +304,7 @@ static void cdns_spi_fill_tx_fifo(struct cdns_spi *xspi) · 175 unmodified lines
304304 {
305305 unsigned long trans_cnt = 0;
306306
307− while ((trans_cnt < CDNS_SPI_FIFO_DEPTH) &&
307+ while ((trans_cnt < xspi->tx_fifo_depth) &&
308308 (xspi->tx_bytes > 0)) {
309309
310310 /* When xspi in busy condition, bytes may send failed,
@@ -450,19 +450,42 @@ static int cdns_prepare_transfer_hardware(struct spi_master *master) · 139 unmodified lines
450450 * @master: Pointer to the spi_master structure which provides
451451 * information about the controller.
452452 *
453− * This function disables the SPI master controller.
453+ * This function disables the SPI master controller when no slave selected.
454454 *
455455 * Return: 0 always
456456 */
457457 static int cdns_unprepare_transfer_hardware(struct spi_master *master)
458458 {
459459 struct cdns_spi *xspi = spi_master_get_devdata(master);
460+ u32 ctrl_reg;
460461
461− cdns_spi_write(xspi, CDNS_SPI_ER, CDNS_SPI_ER_DISABLE);
462+ /* Disable the SPI if slave is deselected */
463+ ctrl_reg = cdns_spi_read(xspi, CDNS_SPI_CR);
464+ ctrl_reg = (ctrl_reg & CDNS_SPI_CR_SSCTRL) >> CDNS_SPI_SS_SHIFT;
465+ if (ctrl_reg == CDNS_SPI_NOSS)
466+ cdns_spi_write(xspi, CDNS_SPI_ER, CDNS_SPI_ER_DISABLE);
462467
463468 return 0;
464469 }
465470
471+/**
472+ * cdns_spi_detect_fifo_depth - Detect the FIFO depth of the hardware
473+ * @xspi: Pointer to the cdns_spi structure
474+ *
475+ * The depth of the TX FIFO is a synthesis configuration parameter of the SPI
476+ * IP. The FIFO threshold register is sized so that its maximum value can be the
477+ * FIFO size - 1. This is used to detect the size of the FIFO.
478+ */
479+static void cdns_spi_detect_fifo_depth(struct cdns_spi *xspi)
480+{
481+ /* The MSBs will get truncated giving us the size of the FIFO */
482+ cdns_spi_write(xspi, CDNS_SPI_THLD, 0xffff);
483+ xspi->tx_fifo_depth = cdns_spi_read(xspi, CDNS_SPI_THLD) + 1;
484+
485+ /* Reset to default */
486+ cdns_spi_write(xspi, CDNS_SPI_THLD, 0x1);
487+}
488+
466489 /**
467490 * cdns_spi_probe - Probe method for the SPI driver
468491 * @pdev: Pointer to the platform_device structure
@@ -535,6 +558,8 @@ static int cdns_spi_probe(struct platform_device *pdev) · 66 unmodified lines
535558 if (ret < 0)
536559 xspi->is_decoded_cs = 0;
537560
561+ cdns_spi_detect_fifo_depth(xspi);
562+
538563 /* SPI controller initializations */
539564 cdns_spi_init_hw(xspi);
540565
drivers/spi/spi-mem.c+1−1
@@ -808,7 +808,7 @@ int spi_mem_poll_status(struct spi_mem *mem, · 807 unmodified lines
808808 op->data.dir != SPI_MEM_DATA_IN)
809809 return -EINVAL;
810810
811− if (ctlr->mem_ops && ctlr->mem_ops->poll_status) {
811+ if (ctlr->mem_ops && ctlr->mem_ops->poll_status && !mem->spi->cs_gpiod) {
812812 ret = spi_mem_access_start(mem);
813813 if (ret)
814814 return ret;
drivers/spi/spi-rockchip.c+7−4
@@ -381,15 +381,18 @@ static int rockchip_spi_prepare_irq(struct rockchip_spi *rs, · 380 unmodified lines
381381 rs->tx_left = rs->tx ? xfer->len / rs->n_bytes : 0;
382382 rs->rx_left = xfer->len / rs->n_bytes;
383383
384− if (rs->cs_inactive)
385− writel_relaxed(INT_RF_FULL | INT_CS_INACTIVE, rs->regs + ROCKCHIP_SPI_IMR);
386− else
387− writel_relaxed(INT_RF_FULL, rs->regs + ROCKCHIP_SPI_IMR);
384+ writel_relaxed(0xffffffff, rs->regs + ROCKCHIP_SPI_ICR);
385+
388386 spi_enable_chip(rs, true);
389387
390388 if (rs->tx_left)
391389 rockchip_spi_pio_writer(rs);
392390
391+ if (rs->cs_inactive)
392+ writel_relaxed(INT_RF_FULL | INT_CS_INACTIVE, rs->regs + ROCKCHIP_SPI_IMR);
393+ else
394+ writel_relaxed(INT_RF_FULL, rs->regs + ROCKCHIP_SPI_IMR);
395+
393396 /* 1 means the transfer is in progress */
394397 return 1;
395398 }
drivers/staging/olpc_dcon/Kconfig+1−1
@@ -1,7 +1,7 @@
11 # SPDX-License-Identifier: GPL-2.0
22 config FB_OLPC_DCON
33 tristate "One Laptop Per Child Display CONtroller support"
4− depends on OLPC && FB
4+ depends on OLPC && FB && BROKEN
55 depends on I2C
66 depends on GPIO_CS5535 && ACPI
77 select BACKLIGHT_CLASS_DEVICE
drivers/staging/r8188eu/core/rtw_xmit.c+5−15
@@ -178,8 +178,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter) · 177 unmodified lines
178178
179179 pxmitpriv->free_xmit_extbuf_cnt = num_xmit_extbuf;
180180
181− res = rtw_alloc_hwxmits(padapter);
182− if (res) {
181+ if (rtw_alloc_hwxmits(padapter)) {
183182 res = _FAIL;
184183 goto exit;
185184 }
@@ -1483,19 +1482,10 @@ int rtw_alloc_hwxmits(struct adapter *padapter) · 1297 unmodified lines
14831482
14841483 hwxmits = pxmitpriv->hwxmits;
14851484
1486− if (pxmitpriv->hwxmit_entry == 5) {
1487− hwxmits[0] .sta_queue = &pxmitpriv->bm_pending;
1488− hwxmits[1] .sta_queue = &pxmitpriv->vo_pending;
1489− hwxmits[2] .sta_queue = &pxmitpriv->vi_pending;
1490− hwxmits[3] .sta_queue = &pxmitpriv->bk_pending;
1491− hwxmits[4] .sta_queue = &pxmitpriv->be_pending;
1492− } else if (pxmitpriv->hwxmit_entry == 4) {
1493− hwxmits[0] .sta_queue = &pxmitpriv->vo_pending;
1494− hwxmits[1] .sta_queue = &pxmitpriv->vi_pending;
1495− hwxmits[2] .sta_queue = &pxmitpriv->be_pending;
1496− hwxmits[3] .sta_queue = &pxmitpriv->bk_pending;
1497− } else {
1498− }
1485+ hwxmits[0].sta_queue = &pxmitpriv->vo_pending;
1486+ hwxmits[1].sta_queue = &pxmitpriv->vi_pending;
1487+ hwxmits[2].sta_queue = &pxmitpriv->be_pending;
1488+ hwxmits[3].sta_queue = &pxmitpriv->bk_pending;
14991489
15001490 return 0;
15011491 }
drivers/staging/r8188eu/os_dep/ioctl_linux.c+1−1
@@ -403,7 +403,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, · 402 unmodified lines
403403
404404 if (wep_key_len > 0) {
405405 wep_key_len = wep_key_len <= 5 ? 5 : 13;
406− wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial);
406+ wep_total_len = wep_key_len + sizeof(*pwep);
407407 pwep = kzalloc(wep_total_len, GFP_KERNEL);
408408 if (!pwep)
409409 goto exit;
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c+4−2
@@ -90,7 +90,8 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, · 89 unmodified lines
9090 if (wep_key_len > 0) {
9191 wep_key_len = wep_key_len <= 5 ? 5 : 13;
9292 wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, key_material);
93− pwep = kzalloc(wep_total_len, GFP_KERNEL);
93+ /* Allocate a full structure to avoid potentially running off the end. */
94+ pwep = kzalloc(sizeof(*pwep), GFP_KERNEL);
9495 if (!pwep) {
9596 ret = -ENOMEM;
9697 goto exit;
@@ -582,7 +583,8 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, · 485 unmodified lines
582583 if (wep_key_len > 0) {
583584 wep_key_len = wep_key_len <= 5 ? 5 : 13;
584585 wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, key_material);
585− pwep = kzalloc(wep_total_len, GFP_KERNEL);
586+ /* Allocate a full structure to avoid potentially running off the end. */
587+ pwep = kzalloc(sizeof(*pwep), GFP_KERNEL);
586588 if (!pwep)
587589 goto exit;
588590
drivers/tty/goldfish.c+1−1
@@ -426,7 +426,7 @@ static int goldfish_tty_remove(struct platform_device *pdev) · 425 unmodified lines
426426 tty_unregister_device(goldfish_tty_driver, qtty->console.index);
427427 iounmap(qtty->base);
428428 qtty->base = NULL;
429− free_irq(qtty->irq, pdev);
429+ free_irq(qtty->irq, qtty);
430430 tty_port_destroy(&qtty->port);
431431 goldfish_tty_current_line_count--;
432432 if (goldfish_tty_current_line_count == 0)
drivers/tty/n_gsm.c+1−1
@@ -455,7 +455,7 @@ static void gsm_hex_dump_bytes(const char *fname, const u8 *data, · 454 unmodified lines
455455 return;
456456 }
457457
458− prefix = kasprintf(GFP_KERNEL, "%s: ", fname);
458+ prefix = kasprintf(GFP_ATOMIC, "%s: ", fname);
459459 if (!prefix)
460460 return;
461461 print_hex_dump(KERN_INFO, prefix, DUMP_PREFIX_OFFSET, 16, 1, data, len,
drivers/tty/serial/8250/8250_port.c+2−0
@@ -1517,6 +1517,8 @@ static inline void __stop_tx(struct uart_8250_port *p) · 1516 unmodified lines
15171517 unsigned char lsr = serial_in(p, UART_LSR);
15181518 u64 stop_delay = 0;
15191519
1520+ p->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS;
1521+
15201522 if (!(lsr & UART_LSR_THRE))
15211523 return;
15221524 /*
drivers/tty/serial/qcom_geni_serial.c+1−0
@@ -1306,6 +1306,7 @@ static const struct uart_ops qcom_geni_console_pops = { · 1305 unmodified lines
13061306 .stop_tx = qcom_geni_serial_stop_tx,
13071307 .start_tx = qcom_geni_serial_start_tx,
13081308 .stop_rx = qcom_geni_serial_stop_rx,
1309+ .start_rx = qcom_geni_serial_start_rx,
13091310 .set_termios = qcom_geni_serial_set_termios,
13101311 .startup = qcom_geni_serial_startup,
13111312 .request_port = qcom_geni_serial_request_port,
drivers/tty/serial/serial_core.c+6−3
@@ -2214,11 +2214,12 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport) · 2213 unmodified lines
22142214 /*
22152215 * Nothing to do if the console is not suspending
22162216 * except stop_rx to prevent any asynchronous data
2217− * over RX line. Re-start_rx, when required, is
2218− * done by set_termios in resume sequence
2217+ * over RX line. However ensure that we will be
2218+ * able to Re-start_rx later.
22192219 */
22202220 if (!console_suspend_enabled && uart_console(uport)) {
2221− uport->ops->stop_rx(uport);
2221+ if (uport->ops->start_rx)
2222+ uport->ops->stop_rx(uport);
22222223 goto unlock;
22232224 }
22242225
@@ -2310,6 +2311,8 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport) · 85 unmodified lines
23102311 if (console_suspend_enabled)
23112312 uart_change_pm(state, UART_PM_STATE_ON);
23122313 uport->ops->set_termios(uport, &termios, NULL);
2314+ if (!console_suspend_enabled && uport->ops->start_rx)
2315+ uport->ops->start_rx(uport);
23132316 if (console_suspend_enabled)
23142317 console_start(uport->cons);
23152318 }
drivers/tty/sysrq.c+0−2
@@ -581,7 +581,6 @@ void __handle_sysrq(int key, bool check_mask) · 580 unmodified lines
581581
582582 rcu_sysrq_start();
583583 rcu_read_lock();
584− printk_prefer_direct_enter();
585584 /*
586585 * Raise the apparent loglevel to maximum so that the sysrq header
587586 * is shown to provide the user with positive feedback. We do not
@@ -623,7 +622,6 @@ void __handle_sysrq(int key, bool check_mask) · 35 unmodified lines
623622 pr_cont("\n");
624623 console_loglevel = orig_log_level;
625624 }
626− printk_prefer_direct_exit();
627625 rcu_read_unlock();
628626 rcu_sysrq_end();
629627
drivers/ufs/core/ufshcd.c+48−28
@@ -748,17 +748,28 @@ static enum utp_ocs ufshcd_get_tr_ocs(struct ufshcd_lrb *lrbp) · 747 unmodified lines
748748 }
749749
750750 /**
751− * ufshcd_utrl_clear - Clear a bit in UTRLCLR register
751+ * ufshcd_utrl_clear() - Clear requests from the controller request list.
752752 * @hba: per adapter instance
753− * @pos: position of the bit to be cleared
753+ * @mask: mask with one bit set for each request to be cleared
754754 */
755−static inline void ufshcd_utrl_clear(struct ufs_hba *hba, u32 pos)
755+static inline void ufshcd_utrl_clear(struct ufs_hba *hba, u32 mask)
756756 {
757757 if (hba->quirks & UFSHCI_QUIRK_BROKEN_REQ_LIST_CLR)
758− ufshcd_writel(hba, (1 << pos), REG_UTP_TRANSFER_REQ_LIST_CLEAR);
759− else
760− ufshcd_writel(hba, ~(1 << pos),
761− REG_UTP_TRANSFER_REQ_LIST_CLEAR);
758+ mask = ~mask;
759+ /*
760+ * From the UFSHCI specification: "UTP Transfer Request List CLear
761+ * Register (UTRLCLR): This field is bit significant. Each bit
762+ * corresponds to a slot in the UTP Transfer Request List, where bit 0
763+ * corresponds to request slot 0. A bit in this field is set to ‘0’
764+ * by host software to indicate to the host controller that a transfer
765+ * request slot is cleared. The host controller
766+ * shall free up any resources associated to the request slot
767+ * immediately, and shall set the associated bit in UTRLDBR to ‘0’. The
768+ * host software indicates no change to request slots by setting the
769+ * associated bits in this field to ‘1’. Bits in this field shall only
770+ * be set ‘1’ or ‘0’ by host software when UTRLRSR is set to ‘1’."
771+ */
772+ ufshcd_writel(hba, ~mask, REG_UTP_TRANSFER_REQ_LIST_CLEAR);
762773 }
763774
764775 /**
@@ -2863,27 +2874,26 @@ static int ufshcd_compose_dev_cmd(struct ufs_hba *hba, · 2098 unmodified lines
28632874 return ufshcd_compose_devman_upiu(hba, lrbp);
28642875 }
28652876
2866−static int
2867−ufshcd_clear_cmd(struct ufs_hba *hba, int tag)
2877+/*
2878+ * Clear all the requests from the controller for which a bit has been set in
2879+ * @mask and wait until the controller confirms that these requests have been
2880+ * cleared.
2881+ */
2882+static int ufshcd_clear_cmds(struct ufs_hba *hba, u32 mask)
28682883 {
2869− int err = 0;
28702884 unsigned long flags;
2871− u32 mask = 1 << tag;
28722885
28732886 /* clear outstanding transaction before retry */
28742887 spin_lock_irqsave(hba->host->host_lock, flags);
2875− ufshcd_utrl_clear(hba, tag);
2888+ ufshcd_utrl_clear(hba, mask);
28762889 spin_unlock_irqrestore(hba->host->host_lock, flags);
28772890
28782891 /*
28792892 * wait for h/w to clear corresponding bit in door-bell.
28802893 * max. wait is 1 sec.
28812894 */
2882− err = ufshcd_wait_for_register(hba,
2883− REG_UTP_TRANSFER_REQ_DOOR_BELL,
2884− mask, ~mask, 1000, 1000);
2885−
2886− return err;
2895+ return ufshcd_wait_for_register(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL,
2896+ mask, ~mask, 1000, 1000);
28872897 }
28882898
28892899 static int
@@ -2963,7 +2973,7 @@ static int ufshcd_wait_for_dev_cmd(struct ufs_hba *hba, · 73 unmodified lines
29632973 err = -ETIMEDOUT;
29642974 dev_dbg(hba->dev, "%s: dev_cmd request timedout, tag %d\n",
29652975 __func__, lrbp->task_tag);
2966− if (!ufshcd_clear_cmd(hba, lrbp->task_tag))
2976+ if (!ufshcd_clear_cmds(hba, 1U << lrbp->task_tag))
29672977 /* successfully cleared the command, retry if needed */
29682978 err = -EAGAIN;
29692979 /*
@@ -6958,14 +6968,14 @@ int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba, · 3988 unmodified lines
69586968 }
69596969
69606970 /**
6961− * ufshcd_eh_device_reset_handler - device reset handler registered to
6962− * scsi layer.
6971+ * ufshcd_eh_device_reset_handler() - Reset a single logical unit.
69636972 * @cmd: SCSI command pointer
69646973 *
69656974 * Returns SUCCESS/FAILED
69666975 */
69676976 static int ufshcd_eh_device_reset_handler(struct scsi_cmnd *cmd)
69686977 {
6978+ unsigned long flags, pending_reqs = 0, not_cleared = 0;
69696979 struct Scsi_Host *host;
69706980 struct ufs_hba *hba;
69716981 u32 pos;
@@ -6984,14 +6994,24 @@ static int ufshcd_eh_device_reset_handler(struct scsi_cmnd *cmd) · 12 unmodified lines
69846994 }
69856995
69866996 /* clear the commands that were pending for corresponding LUN */
6987− for_each_set_bit(pos, &hba->outstanding_reqs, hba->nutrs) {
6988− if (hba->lrb[pos].lun == lun) {
6989− err = ufshcd_clear_cmd(hba, pos);
6990− if (err)
6991− break;
6992− __ufshcd_transfer_req_compl(hba, 1U << pos);
6993− }
6997+ spin_lock_irqsave(&hba->outstanding_lock, flags);
6998+ for_each_set_bit(pos, &hba->outstanding_reqs, hba->nutrs)
6999+ if (hba->lrb[pos].lun == lun)
7000+ __set_bit(pos, &pending_reqs);
7001+ hba->outstanding_reqs &= ~pending_reqs;
7002+ spin_unlock_irqrestore(&hba->outstanding_lock, flags);
7003+
7004+ if (ufshcd_clear_cmds(hba, pending_reqs) < 0) {
7005+ spin_lock_irqsave(&hba->outstanding_lock, flags);
7006+ not_cleared = pending_reqs &
7007+ ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL);
7008+ hba->outstanding_reqs |= not_cleared;
7009+ spin_unlock_irqrestore(&hba->outstanding_lock, flags);
7010+
7011+ dev_err(hba->dev, "%s: failed to clear requests %#lx\n",
7012+ __func__, not_cleared);
69947013 }
7014+ __ufshcd_transfer_req_compl(hba, pending_reqs & ~not_cleared);
69957015
69967016 out:
69977017 hba->req_abort_count = 0;
@@ -7088,7 +7108,7 @@ static int ufshcd_try_to_abort_task(struct ufs_hba *hba, int tag) · 90 unmodified lines
70887108 goto out;
70897109 }
70907110
7091− err = ufshcd_clear_cmd(hba, tag);
7111+ err = ufshcd_clear_cmds(hba, 1U << tag);
70927112 if (err)
70937113 dev_err(hba->dev, "%s: Failed clearing cmd at tag %d, err %d\n",
70947114 __func__, tag, err);
drivers/usb/cdns3/cdnsp-ring.c+11−8
@@ -1941,13 +1941,16 @@ int cdnsp_queue_bulk_tx(struct cdnsp_device *pdev, struct cdnsp_request *preq) · 1940 unmodified lines
19411941 }
19421942
19431943 if (enqd_len + trb_buff_len >= full_len) {
1944− if (need_zero_pkt)
1945− zero_len_trb = !zero_len_trb;
1946−
1947− field &= ~TRB_CHAIN;
1948− field |= TRB_IOC;
1949− more_trbs_coming = false;
1950− preq->td.last_trb = ring->enqueue;
1944+ if (need_zero_pkt && !zero_len_trb) {
1945+ zero_len_trb = true;
1946+ } else {
1947+ zero_len_trb = false;
1948+ field &= ~TRB_CHAIN;
1949+ field |= TRB_IOC;
1950+ more_trbs_coming = false;
1951+ need_zero_pkt = false;
1952+ preq->td.last_trb = ring->enqueue;
1953+ }
19511954 }
19521955
19531956 /* Only set interrupt on short packet for OUT endpoints. */
@@ -1962,7 +1965,7 @@ int cdnsp_queue_bulk_tx(struct cdnsp_device *pdev, struct cdnsp_request *preq) · 8 unmodified lines
19621965 length_field = TRB_LEN(trb_buff_len) | TRB_TD_SIZE(remainder) |
19631966 TRB_INTR_TARGET(0);
19641967
1965− cdnsp_queue_trb(pdev, ring, more_trbs_coming | zero_len_trb,
1968+ cdnsp_queue_trb(pdev, ring, more_trbs_coming,
19661969 lower_32_bits(send_addr),
19671970 upper_32_bits(send_addr),
19681971 length_field,
drivers/usb/chipidea/udc.c+3−0
@@ -1048,6 +1048,9 @@ isr_setup_status_complete(struct usb_ep *ep, struct usb_request *req) · 1047 unmodified lines
10481048 struct ci_hdrc *ci = req->context;
10491049 unsigned long flags;
10501050
1051+ if (req->status < 0)
1052+ return;
1053+
10511054 if (ci->setaddr) {
10521055 hw_usb_set_address(ci, ci->address);
10531056 ci->setaddr = false;
drivers/usb/dwc2/hcd.c+1−1
@@ -5190,7 +5190,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg) · 5189 unmodified lines
51905190 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
51915191 if (!res) {
51925192 retval = -EINVAL;
5193− goto error1;
5193+ goto error2;
51945194 }
51955195 hcd->rsrc_start = res->start;
51965196 hcd->rsrc_len = resource_size(res);
drivers/usb/dwc3/core.c+2−7
@@ -1644,13 +1644,8 @@ static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc) · 1643 unmodified lines
16441644 * This device property is for kernel internal use only and
16451645 * is expected to be set by the glue code.
16461646 */
1647− if (device_property_read_string(dev, "linux,extcon-name", &name) == 0) {
1648− edev = extcon_get_extcon_dev(name);
1649− if (!edev)
1650− return ERR_PTR(-EPROBE_DEFER);
1651−
1652− return edev;
1653− }
1647+ if (device_property_read_string(dev, "linux,extcon-name", &name) == 0)
1648+ return extcon_get_extcon_dev(name);
16541649
16551650 /*
16561651 * Try to get an extcon device from the USB PHY controller's "port"
drivers/usb/dwc3/dwc3-pci.c+1−0
@@ -127,6 +127,7 @@ static const struct property_entry dwc3_pci_intel_phy_charger_detect_properties[ · 126 unmodified lines
127127 PROPERTY_ENTRY_STRING("dr_mode", "peripheral"),
128128 PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"),
129129 PROPERTY_ENTRY_BOOL("linux,phy_charger_detect"),
130+ PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
130131 {}
131132 };
132133
drivers/usb/dwc3/gadget.c+15−11
@@ -2976,6 +2976,7 @@ static int dwc3_gadget_init_in_endpoint(struct dwc3_ep *dep) · 2975 unmodified lines
29762976 struct dwc3 *dwc = dep->dwc;
29772977 u32 mdwidth;
29782978 int size;
2979+ int maxpacket;
29792980
29802981 mdwidth = dwc3_mdwidth(dwc);
29812982
@@ -2988,21 +2989,24 @@ static int dwc3_gadget_init_in_endpoint(struct dwc3_ep *dep) · 6 unmodified lines
29882989 else
29892990 size = DWC31_GTXFIFOSIZ_TXFDEP(size);
29902991
2991− /* FIFO Depth is in MDWDITH bytes. Multiply */
2992− size *= mdwidth;
2993−
29942992 /*
2995− * To meet performance requirement, a minimum TxFIFO size of 3x
2996− * MaxPacketSize is recommended for endpoints that support burst and a
2997− * minimum TxFIFO size of 2x MaxPacketSize for endpoints that don't
2998− * support burst. Use those numbers and we can calculate the max packet
2999− * limit as below.
2993+ * maxpacket size is determined as part of the following, after assuming
2994+ * a mult value of one maxpacket:
2995+ * DWC3 revision 280A and prior:
2996+ * fifo_size = mult * (max_packet / mdwidth) + 1;
2997+ * maxpacket = mdwidth * (fifo_size - 1);
2998+ *
2999+ * DWC3 revision 290A and onwards:
3000+ * fifo_size = mult * ((max_packet + mdwidth)/mdwidth + 1) + 1
3001+ * maxpacket = mdwidth * ((fifo_size - 1) - 1) - mdwidth;
30003002 */
3001− if (dwc->maximum_speed >= USB_SPEED_SUPER)
3002− size /= 3;
3003+ if (DWC3_VER_IS_PRIOR(DWC3, 290A))
3004+ maxpacket = mdwidth * (size - 1);
30033005 else
3004− size /= 2;
3006+ maxpacket = mdwidth * ((size - 1) - 1) - mdwidth;
30053007
3008+ /* Functionally, space for one max packet is sufficient */
3009+ size = min_t(int, maxpacket, 1024);
30063010 usb_ep_set_maxpacket_limit(&dep->endpoint, size);
30073011
30083012 dep->endpoint.max_streams = 16;
drivers/usb/gadget/function/f_fs.c+25−15
@@ -122,8 +122,6 @@ struct ffs_ep { · 121 unmodified lines
122122 struct usb_endpoint_descriptor *descs[3];
123123
124124 u8 num;
125−
126− int status; /* P: epfile->mutex */
127125 };
128126
129127 struct ffs_epfile {
@@ -227,6 +225,9 @@ struct ffs_io_data { · 97 unmodified lines
227225 bool use_sg;
228226
229227 struct ffs_data *ffs;
228+
229+ int status;
230+ struct completion done;
230231 };
231232
232233 struct ffs_desc_helper {
@@ -707,12 +708,15 @@ static const struct file_operations ffs_ep0_operations = { · 474 unmodified lines
707708
708709 static void ffs_epfile_io_complete(struct usb_ep *_ep, struct usb_request *req)
709710 {
711+ struct ffs_io_data *io_data = req->context;
712+
710713 ENTER();
711− if (req->context) {
712− struct ffs_ep *ep = _ep->driver_data;
713− ep->status = req->status ? req->status : req->actual;
714− complete(req->context);
715− }
714+ if (req->status)
715+ io_data->status = req->status;
716+ else
717+ io_data->status = req->actual;
718+
719+ complete(&io_data->done);
716720 }
717721
718722 static ssize_t ffs_copy_to_iter(void *data, int data_len, struct iov_iter *iter)
@@ -1050,7 +1054,6 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) · 331 unmodified lines
10501054 WARN(1, "%s: data_len == -EINVAL\n", __func__);
10511055 ret = -EINVAL;
10521056 } else if (!io_data->aio) {
1053− DECLARE_COMPLETION_ONSTACK(done);
10541057 bool interrupted = false;
10551058
10561059 req = ep->req;
@@ -1066,7 +1069,8 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) · 9 unmodified lines
10661069
10671070 io_data->buf = data;
10681071
1069− req->context = &done;
1072+ init_completion(&io_data->done);
1073+ req->context = io_data;
10701074 req->complete = ffs_epfile_io_complete;
10711075
10721076 ret = usb_ep_queue(ep->ep, req, GFP_ATOMIC);
@@ -1075,7 +1079,12 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) · 2 unmodified lines
10751079
10761080 spin_unlock_irq(&epfile->ffs->eps_lock);
10771081
1078− if (wait_for_completion_interruptible(&done)) {
1082+ if (wait_for_completion_interruptible(&io_data->done)) {
1083+ spin_lock_irq(&epfile->ffs->eps_lock);
1084+ if (epfile->ep != ep) {
1085+ ret = -ESHUTDOWN;
1086+ goto error_lock;
1087+ }
10791088 /*
10801089 * To avoid race condition with ffs_epfile_io_complete,
10811090 * dequeue the request first then check
@@ -1083,17 +1092,18 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) · 1 unmodified line
10831092 * condition with req->complete callback.
10841093 */
10851094 usb_ep_dequeue(ep->ep, req);
1086− wait_for_completion(&done);
1087− interrupted = ep->status < 0;
1095+ spin_unlock_irq(&epfile->ffs->eps_lock);
1096+ wait_for_completion(&io_data->done);
1097+ interrupted = io_data->status < 0;
10881098 }
10891099
10901100 if (interrupted)
10911101 ret = -EINTR;
1092− else if (io_data->read && ep->status > 0)
1093− ret = __ffs_epfile_read_data(epfile, data, ep->status,
1102+ else if (io_data->read && io_data->status > 0)
1103+ ret = __ffs_epfile_read_data(epfile, data, io_data->status,
10941104 &io_data->data);
10951105 else
1096− ret = ep->status;
1106+ ret = io_data->status;
10971107 goto error_mutex;
10981108 } else if (!(req = usb_ep_alloc_request(ep->ep, GFP_ATOMIC))) {
10991109 ret = -ENOMEM;
drivers/usb/gadget/function/u_ether.c+10−2
@@ -775,9 +775,13 @@ struct eth_dev *gether_setup_name(struct usb_gadget *g, · 774 unmodified lines
775775 dev->qmult = qmult;
776776 snprintf(net->name, sizeof(net->name), "%s%%d", netname);
777777
778− if (get_ether_addr(dev_addr, addr))
778+ if (get_ether_addr(dev_addr, addr)) {
779+ net->addr_assign_type = NET_ADDR_RANDOM;
779780 dev_warn(&g->dev,
780781 "using random %s ethernet address\n", "self");
782+ } else {
783+ net->addr_assign_type = NET_ADDR_SET;
784+ }
781785 eth_hw_addr_set(net, addr);
782786 if (get_ether_addr(host_addr, dev->host_mac))
783787 dev_warn(&g->dev,
@@ -844,6 +848,10 @@ struct net_device *gether_setup_name_default(const char *netname) · 60 unmodified lines
844848
845849 eth_random_addr(dev->dev_mac);
846850 pr_warn("using random %s ethernet address\n", "self");
851+
852+ /* by default we always have a random MAC address */
853+ net->addr_assign_type = NET_ADDR_RANDOM;
854+
847855 eth_random_addr(dev->host_mac);
848856 pr_warn("using random %s ethernet address\n", "host");
849857
@@ -871,7 +879,6 @@ int gether_register_netdev(struct net_device *net) · 21 unmodified lines
871879 dev = netdev_priv(net);
872880 g = dev->gadget;
873881
874− net->addr_assign_type = NET_ADDR_RANDOM;
875882 eth_hw_addr_set(net, dev->dev_mac);
876883
877884 status = register_netdev(net);
@@ -912,6 +919,7 @@ int gether_set_dev_addr(struct net_device *net, const char *dev_addr) · 34 unmodified lines
912919 if (get_ether_addr(dev_addr, new_addr))
913920 return -EINVAL;
914921 memcpy(dev->dev_mac, new_addr, ETH_ALEN);
922+ net->addr_assign_type = NET_ADDR_SET;
915923 return 0;
916924 }
917925 EXPORT_SYMBOL_GPL(gether_set_dev_addr);
drivers/usb/gadget/function/uvc_video.c+3−0
@@ -424,6 +424,9 @@ static void uvcg_video_pump(struct work_struct *work) · 423 unmodified lines
424424 uvcg_queue_cancel(queue, 0);
425425 break;
426426 }
427+
428+ /* Endpoint now owns the request */
429+ req = NULL;
427430 video->req_int_count++;
428431 }
429432
drivers/usb/gadget/legacy/raw_gadget.c+47−16
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #include <linux/ctype.h>
1212 #include <linux/debugfs.h>
1313 #include <linux/delay.h>
14+#include <linux/idr.h>
1415 #include <linux/kref.h>
1516 #include <linux/miscdevice.h>
1617 #include <linux/module.h>
@@ -36,6 +37,9 @@ MODULE_LICENSE("GPL"); · 19 unmodified lines
3637
3738 /*----------------------------------------------------------------------*/
3839
40+static DEFINE_IDA(driver_id_numbers);
41+#define DRIVER_DRIVER_NAME_LENGTH_MAX 32
42+
3943 #define RAW_EVENT_QUEUE_SIZE 16
4044
4145 struct raw_event_queue {
@@ -161,6 +165,9 @@ struct raw_dev { · 119 unmodified lines
161165 /* Reference to misc device: */
162166 struct device *dev;
163167
168+ /* Make driver names unique */
169+ int driver_id_number;
170+
164171 /* Protected by lock: */
165172 enum dev_state state;
166173 bool gadget_registered;
@@ -189,6 +196,7 @@ static struct raw_dev *dev_new(void) · 22 unmodified lines
189196 spin_lock_init(&dev->lock);
190197 init_completion(&dev->ep0_done);
191198 raw_event_queue_init(&dev->queue);
199+ dev->driver_id_number = -1;
192200 return dev;
193201 }
194202
@@ -199,6 +207,9 @@ static void dev_free(struct kref *kref) · 4 unmodified lines
199207
200208 kfree(dev->udc_name);
201209 kfree(dev->driver.udc_name);
210+ kfree(dev->driver.driver.name);
211+ if (dev->driver_id_number >= 0)
212+ ida_free(&driver_id_numbers, dev->driver_id_number);
202213 if (dev->req) {
203214 if (dev->ep0_urb_queued)
204215 usb_ep_dequeue(dev->gadget->ep0, dev->req);
@@ -419,9 +430,11 @@ out_put: · 214 unmodified lines
419430 static int raw_ioctl_init(struct raw_dev *dev, unsigned long value)
420431 {
421432 int ret = 0;
433+ int driver_id_number;
422434 struct usb_raw_init arg;
423435 char *udc_driver_name;
424436 char *udc_device_name;
437+ char *driver_driver_name;
425438 unsigned long flags;
426439
427440 if (copy_from_user(&arg, (void __user *)value, sizeof(arg)))
@@ -440,36 +453,43 @@ static int raw_ioctl_init(struct raw_dev *dev, unsigned long value) · 12 unmodified lines
440453 return -EINVAL;
441454 }
442455
456+ driver_id_number = ida_alloc(&driver_id_numbers, GFP_KERNEL);
457+ if (driver_id_number < 0)
458+ return driver_id_number;
459+
460+ driver_driver_name = kmalloc(DRIVER_DRIVER_NAME_LENGTH_MAX, GFP_KERNEL);
461+ if (!driver_driver_name) {
462+ ret = -ENOMEM;
463+ goto out_free_driver_id_number;
464+ }
465+ snprintf(driver_driver_name, DRIVER_DRIVER_NAME_LENGTH_MAX,
466+ DRIVER_NAME ".%d", driver_id_number);
467+
443468 udc_driver_name = kmalloc(UDC_NAME_LENGTH_MAX, GFP_KERNEL);
444− if (!udc_driver_name)
445− return -ENOMEM;
469+ if (!udc_driver_name) {
470+ ret = -ENOMEM;
471+ goto out_free_driver_driver_name;
472+ }
446473 ret = strscpy(udc_driver_name, &arg.driver_name[0],
447474 UDC_NAME_LENGTH_MAX);
448− if (ret < 0) {
449− kfree(udc_driver_name);
450− return ret;
451− }
475+ if (ret < 0)
476+ goto out_free_udc_driver_name;
452477 ret = 0;
453478
454479 udc_device_name = kmalloc(UDC_NAME_LENGTH_MAX, GFP_KERNEL);
455480 if (!udc_device_name) {
456− kfree(udc_driver_name);
457− return -ENOMEM;
481+ ret = -ENOMEM;
482+ goto out_free_udc_driver_name;
458483 }
459484 ret = strscpy(udc_device_name, &arg.device_name[0],
460485 UDC_NAME_LENGTH_MAX);
461− if (ret < 0) {
462− kfree(udc_driver_name);
463− kfree(udc_device_name);
464− return ret;
465− }
486+ if (ret < 0)
487+ goto out_free_udc_device_name;
466488 ret = 0;
467489
468490 spin_lock_irqsave(&dev->lock, flags);
469491 if (dev->state != STATE_DEV_OPENED) {
470492 dev_dbg(dev->dev, "fail, device is not opened\n");
471− kfree(udc_driver_name);
472− kfree(udc_device_name);
473493 ret = -EINVAL;
474494 goto out_unlock;
475495 }
@@ -484,14 +504,25 @@ static int raw_ioctl_init(struct raw_dev *dev, unsigned long value) · 8 unmodified lines
484504 dev->driver.suspend = gadget_suspend;
485505 dev->driver.resume = gadget_resume;
486506 dev->driver.reset = gadget_reset;
487− dev->driver.driver.name = DRIVER_NAME;
507+ dev->driver.driver.name = driver_driver_name;
488508 dev->driver.udc_name = udc_device_name;
489509 dev->driver.match_existing_only = 1;
510+ dev->driver_id_number = driver_id_number;
490511
491512 dev->state = STATE_DEV_INITIALIZED;
513+ spin_unlock_irqrestore(&dev->lock, flags);
514+ return ret;
492515
493516 out_unlock:
494517 spin_unlock_irqrestore(&dev->lock, flags);
518+out_free_udc_device_name:
519+ kfree(udc_device_name);
520+out_free_udc_driver_name:
521+ kfree(udc_driver_name);
522+out_free_driver_driver_name:
523+ kfree(driver_driver_name);
524+out_free_driver_id_number:
525+ ida_free(&driver_id_numbers, driver_id_number);
495526 return ret;
496527 }
497528
drivers/usb/gadget/udc/lpc32xx_udc.c+1−0
@@ -3016,6 +3016,7 @@ static int lpc32xx_udc_probe(struct platform_device *pdev) · 3015 unmodified lines
30163016 }
30173017
30183018 udc->isp1301_i2c_client = isp1301_get_client(isp1301_node);
3019+ of_node_put(isp1301_node);
30193020 if (!udc->isp1301_i2c_client) {
30203021 return -EPROBE_DEFER;
30213022 }
drivers/usb/host/xhci-hub.c+1−1
@@ -652,7 +652,7 @@ struct xhci_hub *xhci_get_rhub(struct usb_hcd *hcd) · 651 unmodified lines
652652 * It will release and re-aquire the lock while calling ACPI
653653 * method.
654654 */
655−static void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd,
655+void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd,
656656 u16 index, bool on, unsigned long *flags)
657657 __must_hold(&xhci->lock)
658658 {
drivers/usb/host/xhci-pci.c+5−1
@@ -61,6 +61,8 @@ · 60 unmodified lines
6161 #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI 0x461e
6262 #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_XHCI 0x464e
6363 #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI 0x51ed
64+#define PCI_DEVICE_ID_INTEL_RAPTOR_LAKE_XHCI 0xa71e
65+#define PCI_DEVICE_ID_INTEL_METEOR_LAKE_XHCI 0x7ec0
6466
6567 #define PCI_DEVICE_ID_AMD_RENOIR_XHCI 0x1639
6668 #define PCI_DEVICE_ID_AMD_PROMONTORYA_4 0x43b9
@@ -269,7 +271,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · 202 unmodified lines
269271 pdev->device == PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI ||
270272 pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI ||
271273 pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_XHCI ||
272− pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI))
274+ pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI ||
275+ pdev->device == PCI_DEVICE_ID_INTEL_RAPTOR_LAKE_XHCI ||
276+ pdev->device == PCI_DEVICE_ID_INTEL_METEOR_LAKE_XHCI))
273277 xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW;
274278
275279 if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
drivers/usb/host/xhci.c+40−25
@@ -611,15 +611,37 @@ static int xhci_init(struct usb_hcd *hcd) · 610 unmodified lines
611611
612612 static int xhci_run_finished(struct xhci_hcd *xhci)
613613 {
614+ unsigned long flags;
615+ u32 temp;
616+
617+ /*
618+ * Enable interrupts before starting the host (xhci 4.2 and 5.5.2).
619+ * Protect the short window before host is running with a lock
620+ */
621+ spin_lock_irqsave(&xhci->lock, flags);
622+
623+ xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Enable interrupts");
624+ temp = readl(&xhci->op_regs->command);
625+ temp |= (CMD_EIE);
626+ writel(temp, &xhci->op_regs->command);
627+
628+ xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Enable primary interrupter");
629+ temp = readl(&xhci->ir_set->irq_pending);
630+ writel(ER_IRQ_ENABLE(temp), &xhci->ir_set->irq_pending);
631+
614632 if (xhci_start(xhci)) {
615633 xhci_halt(xhci);
634+ spin_unlock_irqrestore(&xhci->lock, flags);
616635 return -ENODEV;
617636 }
637+
618638 xhci->cmd_ring_state = CMD_RING_STATE_RUNNING;
619639
620640 if (xhci->quirks & XHCI_NEC_HOST)
621641 xhci_ring_cmd_db(xhci);
622642
643+ spin_unlock_irqrestore(&xhci->lock, flags);
644+
623645 return 0;
624646 }
625647
@@ -668,19 +690,6 @@ int xhci_run(struct usb_hcd *hcd) · 42 unmodified lines
668690 temp |= (xhci->imod_interval / 250) & ER_IRQ_INTERVAL_MASK;
669691 writel(temp, &xhci->ir_set->irq_control);
670692
671− /* Set the HCD state before we enable the irqs */
672− temp = readl(&xhci->op_regs->command);
673− temp |= (CMD_EIE);
674− xhci_dbg_trace(xhci, trace_xhci_dbg_init,
675− "// Enable interrupts, cmd = 0x%x.", temp);
676− writel(temp, &xhci->op_regs->command);
677−
678− temp = readl(&xhci->ir_set->irq_pending);
679− xhci_dbg_trace(xhci, trace_xhci_dbg_init,
680− "// Enabling event ring interrupter %p by writing 0x%x to irq_pending",
681− xhci->ir_set, (unsigned int) ER_IRQ_ENABLE(temp));
682− writel(ER_IRQ_ENABLE(temp), &xhci->ir_set->irq_pending);
683−
684693 if (xhci->quirks & XHCI_NEC_HOST) {
685694 struct xhci_command *command;
686695
@@ -782,6 +791,8 @@ static void xhci_stop(struct usb_hcd *hcd) · 95 unmodified lines
782791 void xhci_shutdown(struct usb_hcd *hcd)
783792 {
784793 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
794+ unsigned long flags;
795+ int i;
785796
786797 if (xhci->quirks & XHCI_SPURIOUS_REBOOT)
787798 usb_disable_xhci_ports(to_pci_dev(hcd->self.sysdev));
@@ -797,12 +808,21 @@ void xhci_shutdown(struct usb_hcd *hcd) · 9 unmodified lines
797808 del_timer_sync(&xhci->shared_hcd->rh_timer);
798809 }
799810
800− spin_lock_irq(&xhci->lock);
811+ spin_lock_irqsave(&xhci->lock, flags);
801812 xhci_halt(xhci);
813+
814+ /* Power off USB2 ports*/
815+ for (i = 0; i < xhci->usb2_rhub.num_ports; i++)
816+ xhci_set_port_power(xhci, xhci->main_hcd, i, false, &flags);
817+
818+ /* Power off USB3 ports*/
819+ for (i = 0; i < xhci->usb3_rhub.num_ports; i++)
820+ xhci_set_port_power(xhci, xhci->shared_hcd, i, false, &flags);
821+
802822 /* Workaround for spurious wakeups at shutdown with HSW */
803823 if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
804824 xhci_reset(xhci, XHCI_RESET_SHORT_USEC);
805− spin_unlock_irq(&xhci->lock);
825+ spin_unlock_irqrestore(&xhci->lock, flags);
806826
807827 xhci_cleanup_msix(xhci);
808828
@@ -1107,7 +1127,6 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) · 298 unmodified lines
11071127 {
11081128 u32 command, temp = 0;
11091129 struct usb_hcd *hcd = xhci_to_hcd(xhci);
1110− struct usb_hcd *secondary_hcd;
11111130 int retval = 0;
11121131 bool comp_timer_running = false;
11131132 bool pending_portevent = false;
@@ -1214,23 +1233,19 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) · 100 unmodified lines
12141233 * first with the primary HCD, and then with the secondary HCD.
12151234 * If we don't do the same, the host will never be started.
12161235 */
1217− if (!usb_hcd_is_primary_hcd(hcd))
1218− secondary_hcd = hcd;
1219− else
1220− secondary_hcd = xhci->shared_hcd;
1221−
12221236 xhci_dbg(xhci, "Initialize the xhci_hcd\n");
1223− retval = xhci_init(hcd->primary_hcd);
1237+ retval = xhci_init(hcd);
12241238 if (retval)
12251239 return retval;
12261240 comp_timer_running = true;
12271241
12281242 xhci_dbg(xhci, "Start the primary HCD\n");
1229− retval = xhci_run(hcd->primary_hcd);
1230− if (!retval && secondary_hcd) {
1243+ retval = xhci_run(hcd);
1244+ if (!retval && xhci->shared_hcd) {
12311245 xhci_dbg(xhci, "Start the secondary HCD\n");
1232− retval = xhci_run(secondary_hcd);
1246+ retval = xhci_run(xhci->shared_hcd);
12331247 }
1248+
12341249 hcd->state = HC_STATE_SUSPENDED;
12351250 if (xhci->shared_hcd)
12361251 xhci->shared_hcd->state = HC_STATE_SUSPENDED;
drivers/usb/host/xhci.h+2−0
@@ -2196,6 +2196,8 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex, · 2195 unmodified lines
21962196 int xhci_hub_status_data(struct usb_hcd *hcd, char *buf);
21972197 int xhci_find_raw_port_number(struct usb_hcd *hcd, int port1);
21982198 struct xhci_hub *xhci_get_rhub(struct usb_hcd *hcd);
2199+void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd, u16 index,
2200+ bool on, unsigned long *flags);
21992201
22002202 void xhci_hc_died(struct xhci_hcd *xhci);
22012203
drivers/usb/serial/io_ti.c+2−0
@@ -166,6 +166,7 @@ static const struct usb_device_id edgeport_2port_id_table[] = { · 165 unmodified lines
166166 { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_8S) },
167167 { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_416) },
168168 { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_416B) },
169+ { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_E5805A) },
169170 { }
170171 };
171172
@@ -204,6 +205,7 @@ static const struct usb_device_id id_table_combined[] = { · 32 unmodified lines
204205 { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_8S) },
205206 { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_416) },
206207 { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_416B) },
208+ { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_E5805A) },
207209 { }
208210 };
209211
drivers/usb/serial/io_usbvend.h+1−0
@@ -212,6 +212,7 @@ · 211 unmodified lines
212212 //
213213 // Definitions for other product IDs
214214 #define ION_DEVICE_ID_MT4X56USB 0x1403 // OEM device
215+#define ION_DEVICE_ID_E5805A 0x1A01 // OEM device (rebranded Edgeport/4)
215216
216217
217218 #define GENERATION_ID_FROM_USB_PRODUCT_ID(ProductId) \
drivers/usb/serial/option.c+12−0
@@ -252,10 +252,12 @@ static void option_instat_callback(struct urb *urb); · 251 unmodified lines
252252 #define QUECTEL_PRODUCT_EG95 0x0195
253253 #define QUECTEL_PRODUCT_BG96 0x0296
254254 #define QUECTEL_PRODUCT_EP06 0x0306
255+#define QUECTEL_PRODUCT_EM05G 0x030a
255256 #define QUECTEL_PRODUCT_EM12 0x0512
256257 #define QUECTEL_PRODUCT_RM500Q 0x0800
257258 #define QUECTEL_PRODUCT_EC200S_CN 0x6002
258259 #define QUECTEL_PRODUCT_EC200T 0x6026
260+#define QUECTEL_PRODUCT_RM500K 0x7001
259261
260262 #define CMOTECH_VENDOR_ID 0x16d8
261263 #define CMOTECH_PRODUCT_6001 0x6001
@@ -432,6 +434,8 @@ static void option_instat_callback(struct urb *urb); · 170 unmodified lines
432434 #define CINTERION_PRODUCT_CLS8 0x00b0
433435 #define CINTERION_PRODUCT_MV31_MBIM 0x00b3
434436 #define CINTERION_PRODUCT_MV31_RMNET 0x00b7
437+#define CINTERION_PRODUCT_MV31_2_MBIM 0x00b8
438+#define CINTERION_PRODUCT_MV31_2_RMNET 0x00b9
435439 #define CINTERION_PRODUCT_MV32_WA 0x00f1
436440 #define CINTERION_PRODUCT_MV32_WB 0x00f2
437441
@@ -1132,6 +1136,8 @@ static const struct usb_device_id option_ids[] = { · 694 unmodified lines
11321136 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff),
11331137 .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 },
11341138 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) },
1139+ { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G, 0xff),
1140+ .driver_info = RSVD(6) | ZLP },
11351141 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0xff, 0xff),
11361142 .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 },
11371143 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0, 0) },
@@ -1145,6 +1151,7 @@ static const struct usb_device_id option_ids[] = { · 7 unmodified lines
11451151 .driver_info = ZLP },
11461152 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200S_CN, 0xff, 0, 0) },
11471153 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200T, 0xff, 0, 0) },
1154+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500K, 0xff, 0x00, 0x00) },
11481155
11491156 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
11501157 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
@@ -1277,6 +1284,7 @@ static const struct usb_device_id option_ids[] = { · 126 unmodified lines
12771284 .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
12781285 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1231, 0xff), /* Telit LE910Cx (RNDIS) */
12791286 .driver_info = NCTRL(2) | RSVD(3) },
1287+ { USB_DEVICE_AND_INTERFACE_INFO(TELIT_VENDOR_ID, 0x1250, 0xff, 0x00, 0x00) }, /* Telit LE910Cx (rmnet) */
12801288 { USB_DEVICE(TELIT_VENDOR_ID, 0x1260),
12811289 .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
12821290 { USB_DEVICE(TELIT_VENDOR_ID, 0x1261),
@@ -1979,6 +1987,10 @@ static const struct usb_device_id option_ids[] = { · 696 unmodified lines
19791987 .driver_info = RSVD(3)},
19801988 { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV31_RMNET, 0xff),
19811989 .driver_info = RSVD(0)},
1990+ { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV31_2_MBIM, 0xff),
1991+ .driver_info = RSVD(3)},
1992+ { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV31_2_RMNET, 0xff),
1993+ .driver_info = RSVD(0)},
19821994 { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WA, 0xff),
19831995 .driver_info = RSVD(3)},
19841996 { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WB, 0xff),
drivers/usb/serial/pl2303.c+17−12
@@ -436,22 +436,27 @@ static int pl2303_detect_type(struct usb_serial *serial) · 435 unmodified lines
436436 break;
437437 case 0x200:
438438 switch (bcdDevice) {
439− case 0x100:
439+ case 0x100: /* GC */
440440 case 0x105:
441+ return TYPE_HXN;
442+ case 0x300: /* GT / TA */
443+ if (pl2303_supports_hx_status(serial))
444+ return TYPE_TA;
445+ fallthrough;
441446 case 0x305:
447+ case 0x400: /* GL */
442448 case 0x405:
449+ return TYPE_HXN;
450+ case 0x500: /* GE / TB */
451+ if (pl2303_supports_hx_status(serial))
452+ return TYPE_TB;
453+ fallthrough;
454+ case 0x505:
455+ case 0x600: /* GS */
443456 case 0x605:
444− /*
445− * Assume it's an HXN-type if the device doesn't
446− * support the old read request value.
447− */
448− if (!pl2303_supports_hx_status(serial))
449− return TYPE_HXN;
450− break;
451− case 0x300:
452− return TYPE_TA;
453− case 0x500:
454− return TYPE_TB;
457+ case 0x700: /* GR */
458+ case 0x705:
459+ return TYPE_HXN;
455460 }
456461 break;
457462 }
drivers/usb/typec/tcpm/Kconfig+0−1
@@ -56,7 +56,6 @@ config TYPEC_WCOVE · 55 unmodified lines
5656 tristate "Intel WhiskeyCove PMIC USB Type-C PHY driver"
5757 depends on ACPI
5858 depends on MFD_INTEL_PMC_BXT
59− depends on INTEL_SOC_PMIC
6059 depends on BXT_WC_PMIC_OPREGION
6160 help
6261 This driver adds support for USB Type-C on Intel Broxton platforms
drivers/video/console/sticore.c+2−0
@@ -1148,6 +1148,7 @@ int sti_call(const struct sti_struct *sti, unsigned long func, · 1147 unmodified lines
11481148 return ret;
11491149 }
11501150
1151+#if defined(CONFIG_FB_STI)
11511152 /* check if given fb_info is the primary device */
11521153 int fb_is_primary_device(struct fb_info *info)
11531154 {
@@ -1163,6 +1164,7 @@ int fb_is_primary_device(struct fb_info *info) · 9 unmodified lines
11631164 return (sti->info == info);
11641165 }
11651166 EXPORT_SYMBOL(fb_is_primary_device);
1167+#endif
11661168
11671169 MODULE_AUTHOR("Philipp Rumpf, Helge Deller, Thomas Bogendoerfer");
11681170 MODULE_DESCRIPTION("Core STI driver for HP's NGLE series graphics cards in HP PARISC machines");
drivers/video/fbdev/au1100fb.c+2−4
@@ -560,8 +560,7 @@ int au1100fb_drv_suspend(struct platform_device *dev, pm_message_t state) · 559 unmodified lines
560560 /* Blank the LCD */
561561 au1100fb_fb_blank(VESA_POWERDOWN, &fbdev->info);
562562
563− if (fbdev->lcdclk)
564− clk_disable(fbdev->lcdclk);
563+ clk_disable(fbdev->lcdclk);
565564
566565 memcpy(&fbregs, fbdev->regs, sizeof(struct au1100fb_regs));
567566
@@ -577,8 +576,7 @@ int au1100fb_drv_resume(struct platform_device *dev) · 9 unmodified lines
577576
578577 memcpy(fbdev->regs, &fbregs, sizeof(struct au1100fb_regs));
579578
580− if (fbdev->lcdclk)
581− clk_enable(fbdev->lcdclk);
579+ clk_enable(fbdev->lcdclk);
582580
583581 /* Unblank the LCD */
584582 au1100fb_fb_blank(VESA_NO_BLANKING, &fbdev->info);
drivers/video/fbdev/cirrusfb.c+0−6
@@ -2184,12 +2184,6 @@ static struct pci_driver cirrusfb_pci_driver = { · 2183 unmodified lines
21842184 .id_table = cirrusfb_pci_table,
21852185 .probe = cirrusfb_pci_register,
21862186 .remove = cirrusfb_pci_unregister,
2187−#ifdef CONFIG_PM
2188−#if 0
2189− .suspend = cirrusfb_pci_suspend,
2190− .resume = cirrusfb_pci_resume,
2191−#endif
2192−#endif
21932187 };
21942188 #endif /* CONFIG_PCI */
21952189
drivers/video/fbdev/intelfb/intelfbdrv.c+2−2
@@ -472,7 +472,7 @@ static int intelfb_pci_register(struct pci_dev *pdev, · 471 unmodified lines
472472 struct fb_info *info;
473473 struct intelfb_info *dinfo;
474474 int i, err, dvo;
475− int aperture_size, stolen_size;
475+ int aperture_size, stolen_size = 0;
476476 struct agp_kern_info gtt_info;
477477 int agp_memtype;
478478 const char *s;
@@ -571,7 +571,7 @@ static int intelfb_pci_register(struct pci_dev *pdev, · 92 unmodified lines
571571 return -ENODEV;
572572 }
573573
574− if (intelfbhw_get_memory(pdev, &aperture_size,&stolen_size)) {
574+ if (intelfbhw_get_memory(pdev, &aperture_size, &stolen_size)) {
575575 cleanup(dinfo);
576576 return -ENODEV;
577577 }
drivers/video/fbdev/intelfb/intelfbhw.c+5−7
@@ -201,13 +201,11 @@ int intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size, · 200 unmodified lines
201201 case PCI_DEVICE_ID_INTEL_945GME:
202202 case PCI_DEVICE_ID_INTEL_965G:
203203 case PCI_DEVICE_ID_INTEL_965GM:
204− /* 915, 945 and 965 chipsets support a 256MB aperture.
205− Aperture size is determined by inspected the
206− base address of the aperture. */
207− if (pci_resource_start(pdev, 2) & 0x08000000)
208− *aperture_size = MB(128);
209− else
210− *aperture_size = MB(256);
204+ /*
205+ * 915, 945 and 965 chipsets support 64MB, 128MB or 256MB
206+ * aperture. Determine size from PCI resource length.
207+ */
208+ *aperture_size = pci_resource_len(pdev, 2);
211209 break;
212210 default:
213211 if ((tmp & INTEL_GMCH_MEM_MASK) == INTEL_GMCH_MEM_64M)
drivers/video/fbdev/omap/sossi.c+1−1
@@ -359,7 +359,7 @@ static void sossi_set_bits_per_cycle(int bpc) · 358 unmodified lines
359359 int bus_pick_count, bus_pick_width;
360360
361361 /*
362− * We set explicitly the the bus_pick_count as well, although
362+ * We set explicitly the bus_pick_count as well, although
363363 * with remapping/reordering disabled it will be calculated by HW
364364 * as (32 / bus_pick_width).
365365 */
drivers/video/fbdev/omap2/omapfb/dss/hdmi_phy.c+1−1
@@ -143,7 +143,7 @@ int hdmi_phy_configure(struct hdmi_phy_data *phy, unsigned long hfbitclk, · 142 unmodified lines
143143 /*
144144 * In OMAP5+, the HFBITCLK must be divided by 2 before issuing the
145145 * HDMI_PHYPWRCMD_LDOON command.
146− */
146+ */
147147 if (phy_feat->bist_ctrl)
148148 REG_FLD_MOD(phy->base, HDMI_TXPHY_BIST_CONTROL, 1, 11, 11);
149149
drivers/video/fbdev/pxa3xx-gcu.c+1−1
@@ -381,7 +381,7 @@ pxa3xx_gcu_write(struct file *file, const char *buff, · 380 unmodified lines
381381 struct pxa3xx_gcu_batch *buffer;
382382 struct pxa3xx_gcu_priv *priv = to_pxa3xx_gcu_priv(file);
383383
384− int words = count / 4;
384+ size_t words = count / 4;
385385
386386 /* Does not need to be atomic. There's a lock in user space,
387387 * but anyhow, this is just for statistics. */
drivers/video/fbdev/simplefb.c+1−2
@@ -237,8 +237,7 @@ static int simplefb_clocks_get(struct simplefb_par *par, · 236 unmodified lines
237237 if (IS_ERR(clock)) {
238238 if (PTR_ERR(clock) == -EPROBE_DEFER) {
239239 while (--i >= 0) {
240− if (par->clks[i])
241− clk_put(par->clks[i]);
240+ clk_put(par->clks[i]);
242241 }
243242 kfree(par->clks);
244243 return -EPROBE_DEFER;
drivers/video/fbdev/skeletonfb.c+8−7
@@ -96,7 +96,7 @@ static const struct fb_fix_screeninfo xxxfb_fix = { · 95 unmodified lines
9696
9797 /*
9898 * Modern graphical hardware not only supports pipelines but some
99− * also support multiple monitors where each display can have its
99+ * also support multiple monitors where each display can have
100100 * its own unique data. In this case each display could be
101101 * represented by a separate framebuffer device thus a separate
102102 * struct fb_info. Now the struct xxx_par represents the graphics
@@ -838,9 +838,9 @@ static void xxxfb_remove(struct pci_dev *dev) · 735 unmodified lines
838838 *
839839 * See Documentation/driver-api/pm/devices.rst for more information
840840 */
841−static int xxxfb_suspend(struct pci_dev *dev, pm_message_t msg)
841+static int xxxfb_suspend(struct device *dev)
842842 {
843− struct fb_info *info = pci_get_drvdata(dev);
843+ struct fb_info *info = dev_get_drvdata(dev);
844844 struct xxxfb_par *par = info->par;
845845
846846 /* suspend here */
@@ -853,9 +853,9 @@ static int xxxfb_suspend(struct pci_dev *dev, pm_message_t msg) · 6 unmodified lines
853853 *
854854 * See Documentation/driver-api/pm/devices.rst for more information
855855 */
856−static int xxxfb_resume(struct pci_dev *dev)
856+static int xxxfb_resume(struct device *dev)
857857 {
858− struct fb_info *info = pci_get_drvdata(dev);
858+ struct fb_info *info = dev_get_drvdata(dev);
859859 struct xxxfb_par *par = info->par;
860860
861861 /* resume here */
@@ -873,14 +873,15 @@ static const struct pci_device_id xxxfb_id_table[] = { · 11 unmodified lines
873873 { 0, }
874874 };
875875
876+static SIMPLE_DEV_PM_OPS(xxxfb_pm_ops, xxxfb_suspend, xxxfb_resume);
877+
876878 /* For PCI drivers */
877879 static struct pci_driver xxxfb_driver = {
878880 .name = "xxxfb",
879881 .id_table = xxxfb_id_table,
880882 .probe = xxxfb_probe,
881883 .remove = xxxfb_remove,
882− .suspend = xxxfb_suspend, /* optional but recommended */
883− .resume = xxxfb_resume, /* optional but recommended */
884+ .driver.pm = xxxfb_pm_ops, /* optional but recommended */
884885 };
885886
886887 MODULE_DEVICE_TABLE(pci, xxxfb_id_table);
drivers/watchdog/gxp-wdt.c+1−0
@@ -172,3 +172,4 @@ module_platform_driver(gxp_wdt_driver); · 171 unmodified lines
172172 MODULE_AUTHOR("Nick Hawkins <nick.hawkins@hpe.com>");
173173 MODULE_AUTHOR("Jean-Marie Verdun <verdun@hpe.com>");
174174 MODULE_DESCRIPTION("Driver for GXP watchdog timer");
175+MODULE_LICENSE("GPL");
drivers/xen/features.c+1−1
@@ -42,7 +42,7 @@ void xen_setup_features(void) · 41 unmodified lines
4242 if (HYPERVISOR_xen_version(XENVER_get_features, &fi) < 0)
4343 break;
4444 for (j = 0; j < 32; j++)
45− xen_features[i * 32 + j] = !!(fi.submap & 1<<j);
45+ xen_features[i * 32 + j] = !!(fi.submap & 1U << j);
4646 }
4747
4848 if (xen_pv_domain()) {
drivers/xen/gntdev-common.h+7−0
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #include <linux/mmu_notifier.h>
1717 #include <linux/types.h>
1818 #include <xen/interface/event_channel.h>
19+#include <xen/grant_table.h>
1920
2021 struct gntdev_dmabuf_priv;
2122
@@ -56,6 +57,7 @@ struct gntdev_grant_map { · 34 unmodified lines
5657 struct gnttab_unmap_grant_ref *unmap_ops;
5758 struct gnttab_map_grant_ref *kmap_ops;
5859 struct gnttab_unmap_grant_ref *kunmap_ops;
60+ bool *being_removed;
5961 struct page **pages;
6062 unsigned long pages_vm_start;
6163
@@ -73,6 +75,11 @@ struct gntdev_grant_map { · 11 unmodified lines
7375 /* Needed to avoid allocation in gnttab_dma_free_pages(). */
7476 xen_pfn_t *frames;
7577 #endif
78+
79+ /* Number of live grants */
80+ atomic_t live_grants;
81+ /* Needed to avoid allocation in __unmap_grant_pages */
82+ struct gntab_unmap_queue_data unmap_data;
7683 };
7784
7885 struct gntdev_grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count,
drivers/xen/gntdev.c+106−51
@@ -35,6 +35,7 @@ · 34 unmodified lines
3535 #include <linux/slab.h>
3636 #include <linux/highmem.h>
3737 #include <linux/refcount.h>
38+#include <linux/workqueue.h>
3839
3940 #include <xen/xen.h>
4041 #include <xen/grant_table.h>
@@ -60,10 +61,11 @@ module_param(limit, uint, 0644); · 19 unmodified lines
6061 MODULE_PARM_DESC(limit,
6162 "Maximum number of grants that may be mapped by one mapping request");
6263
64+/* True in PV mode, false otherwise */
6365 static int use_ptemod;
6466
65−static int unmap_grant_pages(struct gntdev_grant_map *map,
66− int offset, int pages);
67+static void unmap_grant_pages(struct gntdev_grant_map *map,
68+ int offset, int pages);
6769
6870 static struct miscdevice gntdev_miscdev;
6971
@@ -120,6 +122,7 @@ static void gntdev_free_map(struct gntdev_grant_map *map) · 50 unmodified lines
120122 kvfree(map->unmap_ops);
121123 kvfree(map->kmap_ops);
122124 kvfree(map->kunmap_ops);
125+ kvfree(map->being_removed);
123126 kfree(map);
124127 }
125128
@@ -140,10 +143,13 @@ struct gntdev_grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count, · 14 unmodified lines
140143 add->unmap_ops = kvmalloc_array(count, sizeof(add->unmap_ops[0]),
141144 GFP_KERNEL);
142145 add->pages = kvcalloc(count, sizeof(add->pages[0]), GFP_KERNEL);
146+ add->being_removed =
147+ kvcalloc(count, sizeof(add->being_removed[0]), GFP_KERNEL);
143148 if (NULL == add->grants ||
144149 NULL == add->map_ops ||
145150 NULL == add->unmap_ops ||
146− NULL == add->pages)
151+ NULL == add->pages ||
152+ NULL == add->being_removed)
147153 goto err;
148154 if (use_ptemod) {
149155 add->kmap_ops = kvmalloc_array(count, sizeof(add->kmap_ops[0]),
@@ -250,9 +256,36 @@ void gntdev_put_map(struct gntdev_priv *priv, struct gntdev_grant_map *map) · 100 unmodified lines
250256 if (!refcount_dec_and_test(&map->users))
251257 return;
252258
253− if (map->pages && !use_ptemod)
259+ if (map->pages && !use_ptemod) {
260+ /*
261+ * Increment the reference count. This ensures that the
262+ * subsequent call to unmap_grant_pages() will not wind up
263+ * re-entering itself. It *can* wind up calling
264+ * gntdev_put_map() recursively, but such calls will be with a
265+ * reference count greater than 1, so they will return before
266+ * this code is reached. The recursion depth is thus limited to
267+ * 1. Do NOT use refcount_inc() here, as it will detect that
268+ * the reference count is zero and WARN().
269+ */
270+ refcount_set(&map->users, 1);
271+
272+ /*
273+ * Unmap the grants. This may or may not be asynchronous, so it
274+ * is possible that the reference count is 1 on return, but it
275+ * could also be greater than 1.
276+ */
254277 unmap_grant_pages(map, 0, map->count);
255278
279+ /* Check if the memory now needs to be freed */
280+ if (!refcount_dec_and_test(&map->users))
281+ return;
282+
283+ /*
284+ * All pages have been returned to the hypervisor, so free the
285+ * map.
286+ */
287+ }
288+
256289 if (map->notify.flags & UNMAP_NOTIFY_SEND_EVENT) {
257290 notify_remote_via_evtchn(map->notify.event);
258291 evtchn_put(map->notify.event);
@@ -283,6 +316,7 @@ static int find_grant_ptes(pte_t *pte, unsigned long addr, void *data) · 24 unmodified lines
283316
284317 int gntdev_map_grant_pages(struct gntdev_grant_map *map)
285318 {
319+ size_t alloced = 0;
286320 int i, err = 0;
287321
288322 if (!use_ptemod) {
@@ -331,97 +365,116 @@ int gntdev_map_grant_pages(struct gntdev_grant_map *map) · 42 unmodified lines
331365 map->count);
332366
333367 for (i = 0; i < map->count; i++) {
334− if (map->map_ops[i].status == GNTST_okay)
368+ if (map->map_ops[i].status == GNTST_okay) {
335369 map->unmap_ops[i].handle = map->map_ops[i].handle;
336− else if (!err)
370+ if (!use_ptemod)
371+ alloced++;
372+ } else if (!err)
337373 err = -EINVAL;
338374
339375 if (map->flags & GNTMAP_device_map)
340376 map->unmap_ops[i].dev_bus_addr = map->map_ops[i].dev_bus_addr;
341377
342378 if (use_ptemod) {
343− if (map->kmap_ops[i].status == GNTST_okay)
379+ if (map->kmap_ops[i].status == GNTST_okay) {
380+ if (map->map_ops[i].status == GNTST_okay)
381+ alloced++;
344382 map->kunmap_ops[i].handle = map->kmap_ops[i].handle;
345− else if (!err)
383+ } else if (!err)
346384 err = -EINVAL;
347385 }
348386 }
387+ atomic_add(alloced, &map->live_grants);
349388 return err;
350389 }
351390
352−static int __unmap_grant_pages(struct gntdev_grant_map *map, int offset,
353− int pages)
391+static void __unmap_grant_pages_done(int result,
392+ struct gntab_unmap_queue_data *data)
354393 {
355− int i, err = 0;
356− struct gntab_unmap_queue_data unmap_data;
357−
358− if (map->notify.flags & UNMAP_NOTIFY_CLEAR_BYTE) {
359− int pgno = (map->notify.addr >> PAGE_SHIFT);
360− if (pgno >= offset && pgno < offset + pages) {
361− /* No need for kmap, pages are in lowmem */
362− uint8_t *tmp = pfn_to_kaddr(page_to_pfn(map->pages[pgno]));
363− tmp[map->notify.addr & (PAGE_SIZE-1)] = 0;
364− map->notify.flags &= ~UNMAP_NOTIFY_CLEAR_BYTE;
365− }
366− }
367−
368− unmap_data.unmap_ops = map->unmap_ops + offset;
369− unmap_data.kunmap_ops = use_ptemod ? map->kunmap_ops + offset : NULL;
370− unmap_data.pages = map->pages + offset;
371− unmap_data.count = pages;
372−
373− err = gnttab_unmap_refs_sync(&unmap_data);
374− if (err)
375− return err;
394+ unsigned int i;
395+ struct gntdev_grant_map *map = data->data;
396+ unsigned int offset = data->unmap_ops - map->unmap_ops;
376397
377− for (i = 0; i < pages; i++) {
378− if (map->unmap_ops[offset+i].status)
379− err = -EINVAL;
398+ for (i = 0; i < data->count; i++) {
399+ WARN_ON(map->unmap_ops[offset+i].status);
380400 pr_debug("unmap handle=%d st=%d\n",
381401 map->unmap_ops[offset+i].handle,
382402 map->unmap_ops[offset+i].status);
383403 map->unmap_ops[offset+i].handle = INVALID_GRANT_HANDLE;
384404 if (use_ptemod) {
385− if (map->kunmap_ops[offset+i].status)
386− err = -EINVAL;
405+ WARN_ON(map->kunmap_ops[offset+i].status);
387406 pr_debug("kunmap handle=%u st=%d\n",
388407 map->kunmap_ops[offset+i].handle,
389408 map->kunmap_ops[offset+i].status);
390409 map->kunmap_ops[offset+i].handle = INVALID_GRANT_HANDLE;
391410 }
392411 }
393− return err;
412+ /*
413+ * Decrease the live-grant counter. This must happen after the loop to
414+ * prevent premature reuse of the grants by gnttab_mmap().
415+ */
416+ atomic_sub(data->count, &map->live_grants);
417+
418+ /* Release reference taken by __unmap_grant_pages */
419+ gntdev_put_map(NULL, map);
420+}
421+
422+static void __unmap_grant_pages(struct gntdev_grant_map *map, int offset,
423+ int pages)
424+{
425+ if (map->notify.flags & UNMAP_NOTIFY_CLEAR_BYTE) {
426+ int pgno = (map->notify.addr >> PAGE_SHIFT);
427+
428+ if (pgno >= offset && pgno < offset + pages) {
429+ /* No need for kmap, pages are in lowmem */
430+ uint8_t *tmp = pfn_to_kaddr(page_to_pfn(map->pages[pgno]));
431+
432+ tmp[map->notify.addr & (PAGE_SIZE-1)] = 0;
433+ map->notify.flags &= ~UNMAP_NOTIFY_CLEAR_BYTE;
434+ }
435+ }
436+
437+ map->unmap_data.unmap_ops = map->unmap_ops + offset;
438+ map->unmap_data.kunmap_ops = use_ptemod ? map->kunmap_ops + offset : NULL;
439+ map->unmap_data.pages = map->pages + offset;
440+ map->unmap_data.count = pages;
441+ map->unmap_data.done = __unmap_grant_pages_done;
442+ map->unmap_data.data = map;
443+ refcount_inc(&map->users); /* to keep map alive during async call below */
444+
445+ gnttab_unmap_refs_async(&map->unmap_data);
394446 }
395447
396−static int unmap_grant_pages(struct gntdev_grant_map *map, int offset,
397− int pages)
448+static void unmap_grant_pages(struct gntdev_grant_map *map, int offset,
449+ int pages)
398450 {
399− int range, err = 0;
451+ int range;
452+
453+ if (atomic_read(&map->live_grants) == 0)
454+ return; /* Nothing to do */
400455
401456 pr_debug("unmap %d+%d [%d+%d]\n", map->index, map->count, offset, pages);
402457
403458 /* It is possible the requested range will have a "hole" where we
404459 * already unmapped some of the grants. Only unmap valid ranges.
405460 */
406− while (pages && !err) {
407− while (pages &&
408− map->unmap_ops[offset].handle == INVALID_GRANT_HANDLE) {
461+ while (pages) {
462+ while (pages && map->being_removed[offset]) {
409463 offset++;
410464 pages--;
411465 }
412466 range = 0;
413467 while (range < pages) {
414− if (map->unmap_ops[offset + range].handle ==
415− INVALID_GRANT_HANDLE)
468+ if (map->being_removed[offset + range])
416469 break;
470+ map->being_removed[offset + range] = true;
417471 range++;
418472 }
419− err = __unmap_grant_pages(map, offset, range);
473+ if (range)
474+ __unmap_grant_pages(map, offset, range);
420475 offset += range;
421476 pages -= range;
422477 }
423−
424− return err;
425478 }
426479
427480 /* ------------------------------------------------------------------ */
@@ -473,7 +526,6 @@ static bool gntdev_invalidate(struct mmu_interval_notifier *mn, · 45 unmodified lines
473526 struct gntdev_grant_map *map =
474527 container_of(mn, struct gntdev_grant_map, notifier);
475528 unsigned long mstart, mend;
476− int err;
477529
478530 if (!mmu_notifier_range_blockable(range))
479531 return false;
@@ -494,10 +546,9 @@ static bool gntdev_invalidate(struct mmu_interval_notifier *mn, · 14 unmodified lines
494546 map->index, map->count,
495547 map->vma->vm_start, map->vma->vm_end,
496548 range->start, range->end, mstart, mend);
497− err = unmap_grant_pages(map,
549+ unmap_grant_pages(map,
498550 (mstart - map->vma->vm_start) >> PAGE_SHIFT,
499551 (mend - mstart) >> PAGE_SHIFT);
500− WARN_ON(err);
501552
502553 return true;
503554 }
@@ -985,6 +1036,10 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma) · 481 unmodified lines
9851036 goto unlock_out;
9861037 if (use_ptemod && map->vma)
9871038 goto unlock_out;
1039+ if (atomic_read(&map->live_grants)) {
1040+ err = -EAGAIN;
1041+ goto unlock_out;
1042+ }
9881043 refcount_inc(&map->users);
9891044
9901045 vma->vm_ops = &gntdev_vmops;
fs/9p/fid.c+9−13
@@ -152,7 +152,7 @@ static struct p9_fid *v9fs_fid_lookup_with_uid(struct dentry *dentry, · 151 unmodified lines
152152 const unsigned char **wnames, *uname;
153153 int i, n, l, clone, access;
154154 struct v9fs_session_info *v9ses;
155− struct p9_fid *fid, *old_fid = NULL;
155+ struct p9_fid *fid, *old_fid;
156156
157157 v9ses = v9fs_dentry2v9ses(dentry);
158158 access = v9ses->flags & V9FS_ACCESS_MASK;
@@ -194,13 +194,12 @@ static struct p9_fid *v9fs_fid_lookup_with_uid(struct dentry *dentry, · 35 unmodified lines
194194 if (IS_ERR(fid))
195195 return fid;
196196
197+ refcount_inc(&fid->count);
197198 v9fs_fid_add(dentry->d_sb->s_root, fid);
198199 }
199200 /* If we are root ourself just return that */
200− if (dentry->d_sb->s_root == dentry) {
201− refcount_inc(&fid->count);
201+ if (dentry->d_sb->s_root == dentry)
202202 return fid;
203− }
204203 /*
205204 * Do a multipath walk with attached root.
206205 * When walking parent we need to make sure we
@@ -212,6 +211,7 @@ static struct p9_fid *v9fs_fid_lookup_with_uid(struct dentry *dentry, · 5 unmodified lines
212211 fid = ERR_PTR(n);
213212 goto err_out;
214213 }
214+ old_fid = fid;
215215 clone = 1;
216216 i = 0;
217217 while (i < n) {
@@ -221,19 +221,15 @@ static struct p9_fid *v9fs_fid_lookup_with_uid(struct dentry *dentry, · 3 unmodified lines
221221 * walk to ensure none of the patch component change
222222 */
223223 fid = p9_client_walk(fid, l, &wnames[i], clone);
224+ /* non-cloning walk will return the same fid */
225+ if (fid != old_fid) {
226+ p9_client_clunk(old_fid);
227+ old_fid = fid;
228+ }
224229 if (IS_ERR(fid)) {
225− if (old_fid) {
226− /*
227− * If we fail, clunk fid which are mapping
228− * to path component and not the last component
229− * of the path.
230− */
231− p9_client_clunk(old_fid);
232− }
233230 kfree(wnames);
234231 goto err_out;
235232 }
236− old_fid = fid;
237233 i += l;
238234 clone = 0;
239235 }
fs/9p/vfs_addr.c+13−0
@@ -58,8 +58,21 @@ static void v9fs_issue_read(struct netfs_io_subrequest *subreq) · 57 unmodified lines
5858 */
5959 static int v9fs_init_request(struct netfs_io_request *rreq, struct file *file)
6060 {
61+ struct inode *inode = file_inode(file);
62+ struct v9fs_inode *v9inode = V9FS_I(inode);
6163 struct p9_fid *fid = file->private_data;
6264
65+ BUG_ON(!fid);
66+
67+ /* we might need to read from a fid that was opened write-only
68+ * for read-modify-write of page cache, use the writeback fid
69+ * for that */
70+ if (rreq->origin == NETFS_READ_FOR_WRITE &&
71+ (fid->mode & O_ACCMODE) == O_WRONLY) {
72+ fid = v9inode->writeback_fid;
73+ BUG_ON(!fid);
74+ }
75+
6376 refcount_inc(&fid->count);
6477 rreq->netfs_priv = fid;
6578 return 0;
fs/9p/vfs_inode.c+4−4
@@ -1251,15 +1251,15 @@ static const char *v9fs_vfs_get_link(struct dentry *dentry, · 1250 unmodified lines
12511251 return ERR_PTR(-ECHILD);
12521252
12531253 v9ses = v9fs_dentry2v9ses(dentry);
1254− fid = v9fs_fid_lookup(dentry);
1254+ if (!v9fs_proto_dotu(v9ses))
1255+ return ERR_PTR(-EBADF);
1256+
12551257 p9_debug(P9_DEBUG_VFS, "%pd\n", dentry);
1258+ fid = v9fs_fid_lookup(dentry);
12561259
12571260 if (IS_ERR(fid))
12581261 return ERR_CAST(fid);
12591262
1260− if (!v9fs_proto_dotu(v9ses))
1261− return ERR_PTR(-EBADF);
1262−
12631263 st = p9_client_stat(fid);
12641264 p9_client_clunk(fid);
12651265 if (IS_ERR(st))
fs/9p/vfs_inode_dotl.c+3−0
@@ -274,6 +274,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry, · 273 unmodified lines
274274 if (IS_ERR(ofid)) {
275275 err = PTR_ERR(ofid);
276276 p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
277+ p9_client_clunk(dfid);
277278 goto out;
278279 }
279280
@@ -285,6 +286,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry, · 5 unmodified lines
285286 if (err) {
286287 p9_debug(P9_DEBUG_VFS, "Failed to get acl values in creat %d\n",
287288 err);
289+ p9_client_clunk(dfid);
288290 goto error;
289291 }
290292 err = p9_client_create_dotl(ofid, name, v9fs_open_to_dotl_flags(flags),
@@ -292,6 +294,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry, · 1 unmodified line
292294 if (err < 0) {
293295 p9_debug(P9_DEBUG_VFS, "p9_client_open_dotl failed in creat %d\n",
294296 err);
297+ p9_client_clunk(dfid);
295298 goto error;
296299 }
297300 v9fs_invalidate_inode_attr(dir);
fs/afs/inode.c+2−1
@@ -745,7 +745,8 @@ int afs_getattr(struct user_namespace *mnt_userns, const struct path *path, · 744 unmodified lines
745745
746746 _enter("{ ino=%lu v=%u }", inode->i_ino, inode->i_generation);
747747
748− if (!(query_flags & AT_STATX_DONT_SYNC) &&
748+ if (vnode->volume &&
749+ !(query_flags & AT_STATX_DONT_SYNC) &&
749750 !test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) {
750751 key = afs_request_key(vnode->volume->cell);
751752 if (IS_ERR(key))
fs/attr.c+20−6
@@ -61,9 +61,15 @@ static bool chgrp_ok(struct user_namespace *mnt_userns, · 60 unmodified lines
6161 const struct inode *inode, kgid_t gid)
6262 {
6363 kgid_t kgid = i_gid_into_mnt(mnt_userns, inode);
64− if (uid_eq(current_fsuid(), i_uid_into_mnt(mnt_userns, inode)) &&
65− (in_group_p(gid) || gid_eq(gid, inode->i_gid)))
66− return true;
64+ if (uid_eq(current_fsuid(), i_uid_into_mnt(mnt_userns, inode))) {
65+ kgid_t mapped_gid;
66+
67+ if (gid_eq(gid, inode->i_gid))
68+ return true;
69+ mapped_gid = mapped_kgid_fs(mnt_userns, i_user_ns(inode), gid);
70+ if (in_group_p(mapped_gid))
71+ return true;
72+ }
6773 if (capable_wrt_inode_uidgid(mnt_userns, inode, CAP_CHOWN))
6874 return true;
6975 if (gid_eq(kgid, INVALID_GID) &&
@@ -123,12 +129,20 @@ int setattr_prepare(struct user_namespace *mnt_userns, struct dentry *dentry, · 53 unmodified lines
123129
124130 /* Make sure a caller can chmod. */
125131 if (ia_valid & ATTR_MODE) {
132+ kgid_t mapped_gid;
133+
126134 if (!inode_owner_or_capable(mnt_userns, inode))
127135 return -EPERM;
136+
137+ if (ia_valid & ATTR_GID)
138+ mapped_gid = mapped_kgid_fs(mnt_userns,
139+ i_user_ns(inode), attr->ia_gid);
140+ else
141+ mapped_gid = i_gid_into_mnt(mnt_userns, inode);
142+
128143 /* Also check the setgid bit! */
129− if (!in_group_p((ia_valid & ATTR_GID) ? attr->ia_gid :
130− i_gid_into_mnt(mnt_userns, inode)) &&
131− !capable_wrt_inode_uidgid(mnt_userns, inode, CAP_FSETID))
144+ if (!in_group_p(mapped_gid) &&
145+ !capable_wrt_inode_uidgid(mnt_userns, inode, CAP_FSETID))
132146 attr->ia_mode &= ~S_ISGID;
133147 }
134148
fs/btrfs/block-group.h+1−0
@@ -104,6 +104,7 @@ struct btrfs_block_group { · 103 unmodified lines
104104 unsigned int relocating_repair:1;
105105 unsigned int chunk_item_inserted:1;
106106 unsigned int zone_is_active:1;
107+ unsigned int zoned_data_reloc_ongoing:1;
107108
108109 int disk_cache_state;
109110
fs/btrfs/ctree.h+2−0
@@ -1330,6 +1330,8 @@ struct btrfs_replace_extent_info { · 1329 unmodified lines
13301330 * existing extent into a file range.
13311331 */
13321332 bool is_new_extent;
1333+ /* Indicate if we should update the inode's mtime and ctime. */
1334+ bool update_times;
13331335 /* Meaningful only if is_new_extent is true. */
13341336 int qgroup_reserved;
13351337 /*
fs/btrfs/disk-io.c+11−2
@@ -4632,6 +4632,17 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info) · 4631 unmodified lines
46324632 int ret;
46334633
46344634 set_bit(BTRFS_FS_CLOSING_START, &fs_info->flags);
4635+
4636+ /*
4637+ * We may have the reclaim task running and relocating a data block group,
4638+ * in which case it may create delayed iputs. So stop it before we park
4639+ * the cleaner kthread otherwise we can get new delayed iputs after
4640+ * parking the cleaner, and that can make the async reclaim task to hang
4641+ * if it's waiting for delayed iputs to complete, since the cleaner is
4642+ * parked and can not run delayed iputs - this will make us hang when
4643+ * trying to stop the async reclaim task.
4644+ */
4645+ cancel_work_sync(&fs_info->reclaim_bgs_work);
46354646 /*
46364647 * We don't want the cleaner to start new transactions, add more delayed
46374648 * iputs, etc. while we're closing. We can't use kthread_stop() yet
@@ -4672,8 +4683,6 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info) · 34 unmodified lines
46724683 cancel_work_sync(&fs_info->async_data_reclaim_work);
46734684 cancel_work_sync(&fs_info->preempt_reclaim_work);
46744685
4675− cancel_work_sync(&fs_info->reclaim_bgs_work);
4676−
46774686 /* Cancel or finish ongoing discard work */
46784687 btrfs_discard_cleanup(fs_info);
46794688
fs/btrfs/extent-tree.c+18−2
@@ -3832,7 +3832,7 @@ static int do_allocation_zoned(struct btrfs_block_group *block_group, · 3831 unmodified lines
38323832 block_group->start == fs_info->data_reloc_bg ||
38333833 fs_info->data_reloc_bg == 0);
38343834
3835− if (block_group->ro) {
3835+ if (block_group->ro || block_group->zoned_data_reloc_ongoing) {
38363836 ret = 1;
38373837 goto out;
38383838 }
@@ -3894,8 +3894,24 @@ static int do_allocation_zoned(struct btrfs_block_group *block_group, · 55 unmodified lines
38943894 out:
38953895 if (ret && ffe_ctl->for_treelog)
38963896 fs_info->treelog_bg = 0;
3897− if (ret && ffe_ctl->for_data_reloc)
3897+ if (ret && ffe_ctl->for_data_reloc &&
3898+ fs_info->data_reloc_bg == block_group->start) {
3899+ /*
3900+ * Do not allow further allocations from this block group.
3901+ * Compared to increasing the ->ro, setting the
3902+ * ->zoned_data_reloc_ongoing flag still allows nocow
3903+ * writers to come in. See btrfs_inc_nocow_writers().
3904+ *
3905+ * We need to disable an allocation to avoid an allocation of
3906+ * regular (non-relocation data) extent. With mix of relocation
3907+ * extents and regular extents, we can dispatch WRITE commands
3908+ * (for relocation extents) and ZONE APPEND commands (for
3909+ * regular extents) at the same time to the same zone, which
3910+ * easily break the write pointer.
3911+ */
3912+ block_group->zoned_data_reloc_ongoing = 1;
38983913 fs_info->data_reloc_bg = 0;
3914+ }
38993915 spin_unlock(&fs_info->relocation_bg_lock);
39003916 spin_unlock(&fs_info->treelog_bg_lock);
39013917 spin_unlock(&block_group->lock);
fs/btrfs/extent_io.c+2−1
@@ -5241,13 +5241,14 @@ int extent_writepages(struct address_space *mapping, · 5240 unmodified lines
52415241 */
52425242 btrfs_zoned_data_reloc_lock(BTRFS_I(inode));
52435243 ret = extent_write_cache_pages(mapping, wbc, &epd);
5244− btrfs_zoned_data_reloc_unlock(BTRFS_I(inode));
52455244 ASSERT(ret <= 0);
52465245 if (ret < 0) {
5246+ btrfs_zoned_data_reloc_unlock(BTRFS_I(inode));
52475247 end_write_bio(&epd, ret);
52485248 return ret;
52495249 }
52505250 flush_write_bio(&epd);
5251+ btrfs_zoned_data_reloc_unlock(BTRFS_I(inode));
52515252 return ret;
52525253 }
52535254
fs/btrfs/file.c+75−17
@@ -2323,25 +2323,62 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) · 2322 unmodified lines
23232323 */
23242324 btrfs_inode_unlock(inode, BTRFS_ILOCK_MMAP);
23252325
2326− if (ret != BTRFS_NO_LOG_SYNC) {
2326+ if (ret == BTRFS_NO_LOG_SYNC) {
2327+ ret = btrfs_end_transaction(trans);
2328+ goto out;
2329+ }
2330+
2331+ /* We successfully logged the inode, attempt to sync the log. */
2332+ if (!ret) {
2333+ ret = btrfs_sync_log(trans, root, &ctx);
23272334 if (!ret) {
2328− ret = btrfs_sync_log(trans, root, &ctx);
2329− if (!ret) {
2330− ret = btrfs_end_transaction(trans);
2331− goto out;
2332− }
2333− }
2334− if (!full_sync) {
2335− ret = btrfs_wait_ordered_range(inode, start, len);
2336− if (ret) {
2337− btrfs_end_transaction(trans);
2338− goto out;
2339− }
2335+ ret = btrfs_end_transaction(trans);
2336+ goto out;
23402337 }
2341− ret = btrfs_commit_transaction(trans);
2342− } else {
2338+ }
2339+
2340+ /*
2341+ * At this point we need to commit the transaction because we had
2342+ * btrfs_need_log_full_commit() or some other error.
2343+ *
2344+ * If we didn't do a full sync we have to stop the trans handle, wait on
2345+ * the ordered extents, start it again and commit the transaction. If
2346+ * we attempt to wait on the ordered extents here we could deadlock with
2347+ * something like fallocate() that is holding the extent lock trying to
2348+ * start a transaction while some other thread is trying to commit the
2349+ * transaction while we (fsync) are currently holding the transaction
2350+ * open.
2351+ */
2352+ if (!full_sync) {
23432353 ret = btrfs_end_transaction(trans);
2354+ if (ret)
2355+ goto out;
2356+ ret = btrfs_wait_ordered_range(inode, start, len);
2357+ if (ret)
2358+ goto out;
2359+
2360+ /*
2361+ * This is safe to use here because we're only interested in
2362+ * making sure the transaction that had the ordered extents is
2363+ * committed. We aren't waiting on anything past this point,
2364+ * we're purely getting the transaction and committing it.
2365+ */
2366+ trans = btrfs_attach_transaction_barrier(root);
2367+ if (IS_ERR(trans)) {
2368+ ret = PTR_ERR(trans);
2369+
2370+ /*
2371+ * We committed the transaction and there's no currently
2372+ * running transaction, this means everything we care
2373+ * about made it to disk and we are done.
2374+ */
2375+ if (ret == -ENOENT)
2376+ ret = 0;
2377+ goto out;
2378+ }
23442379 }
2380+
2381+ ret = btrfs_commit_transaction(trans);
23452382 out:
23462383 ASSERT(list_empty(&ctx.list));
23472384 err = file_check_and_advance_wb_err(file);
@@ -2719,7 +2756,8 @@ int btrfs_replace_file_extents(struct btrfs_inode *inode, · 371 unmodified lines
27192756
27202757 ret = btrfs_block_rsv_migrate(&fs_info->trans_block_rsv, rsv,
27212758 min_size, false);
2722− BUG_ON(ret);
2759+ if (WARN_ON(ret))
2760+ goto out_trans;
27232761 trans->block_rsv = rsv;
27242762
27252763 cur_offset = start;
@@ -2803,6 +2841,25 @@ int btrfs_replace_file_extents(struct btrfs_inode *inode, · 77 unmodified lines
28032841 extent_info->file_offset += replace_len;
28042842 }
28052843
2844+ /*
2845+ * We are releasing our handle on the transaction, balance the
2846+ * dirty pages of the btree inode and flush delayed items, and
2847+ * then get a new transaction handle, which may now point to a
2848+ * new transaction in case someone else may have committed the
2849+ * transaction we used to replace/drop file extent items. So
2850+ * bump the inode's iversion and update mtime and ctime except
2851+ * if we are called from a dedupe context. This is because a
2852+ * power failure/crash may happen after the transaction is
2853+ * committed and before we finish replacing/dropping all the
2854+ * file extent items we need.
2855+ */
2856+ inode_inc_iversion(&inode->vfs_inode);
2857+
2858+ if (!extent_info || extent_info->update_times) {
2859+ inode->vfs_inode.i_mtime = current_time(&inode->vfs_inode);
2860+ inode->vfs_inode.i_ctime = inode->vfs_inode.i_mtime;
2861+ }
2862+
28062863 ret = btrfs_update_inode(trans, root, inode);
28072864 if (ret)
28082865 break;
@@ -2819,7 +2876,8 @@ int btrfs_replace_file_extents(struct btrfs_inode *inode, · 10 unmodified lines
28192876
28202877 ret = btrfs_block_rsv_migrate(&fs_info->trans_block_rsv,
28212878 rsv, min_size, false);
2822− BUG_ON(ret); /* shouldn't happen */
2879+ if (WARN_ON(ret))
2880+ break;
28232881 trans->block_rsv = rsv;
28242882
28252883 cur_offset = drop_args.drop_end;
fs/btrfs/inode.c+3−0
@@ -3195,6 +3195,8 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent) · 3194 unmodified lines
31953195 ordered_extent->file_offset,
31963196 ordered_extent->file_offset +
31973197 logical_len);
3198+ btrfs_zoned_release_data_reloc_bg(fs_info, ordered_extent->disk_bytenr,
3199+ ordered_extent->disk_num_bytes);
31983200 } else {
31993201 BUG_ON(root == fs_info->tree_root);
32003202 ret = insert_ordered_extent_file_extent(trans, ordered_extent);
@@ -9897,6 +9899,7 @@ static struct btrfs_trans_handle *insert_prealloc_file_extent( · 6696 unmodified lines
98979899 extent_info.file_offset = file_offset;
98989900 extent_info.extent_buf = (char *)&stack_fi;
98999901 extent_info.is_new_extent = true;
9902+ extent_info.update_times = true;
99009903 extent_info.qgroup_reserved = qgroup_released;
99019904 extent_info.insertions = 0;
99029905
fs/btrfs/locking.c+0−3
@@ -45,7 +45,6 @@ void __btrfs_tree_read_lock(struct extent_buffer *eb, enum btrfs_lock_nesting ne · 44 unmodified lines
4545 start_ns = ktime_get_ns();
4646
4747 down_read_nested(&eb->lock, nest);
48− eb->lock_owner = current->pid;
4948 trace_btrfs_tree_read_lock(eb, start_ns);
5049 }
5150
@@ -62,7 +61,6 @@ void btrfs_tree_read_lock(struct extent_buffer *eb) · 10 unmodified lines
6261 int btrfs_try_tree_read_lock(struct extent_buffer *eb)
6362 {
6463 if (down_read_trylock(&eb->lock)) {
65− eb->lock_owner = current->pid;
6664 trace_btrfs_try_tree_read_lock(eb);
6765 return 1;
6866 }
@@ -90,7 +88,6 @@ int btrfs_try_tree_write_lock(struct extent_buffer *eb) · 21 unmodified lines
9088 void btrfs_tree_read_unlock(struct extent_buffer *eb)
9189 {
9290 trace_btrfs_tree_read_unlock(eb);
93− eb->lock_owner = 0;
9491 up_read(&eb->lock);
9592 }
9693
fs/btrfs/reflink.c+12−4
@@ -344,6 +344,7 @@ static int btrfs_clone(struct inode *src, struct inode *inode, · 343 unmodified lines
344344 int ret;
345345 const u64 len = olen_aligned;
346346 u64 last_dest_end = destoff;
347+ u64 prev_extent_end = off;
347348
348349 ret = -ENOMEM;
349350 buf = kvmalloc(fs_info->nodesize, GFP_KERNEL);
@@ -363,7 +364,6 @@ static int btrfs_clone(struct inode *src, struct inode *inode, · 13 unmodified lines
363364 key.offset = off;
364365
365366 while (1) {
366− u64 next_key_min_offset = key.offset + 1;
367367 struct btrfs_file_extent_item *extent;
368368 u64 extent_gen;
369369 int type;
@@ -431,14 +431,21 @@ process_slot: · 61 unmodified lines
431431 * The first search might have left us at an extent item that
432432 * ends before our target range's start, can happen if we have
433433 * holes and NO_HOLES feature enabled.
434+ *
435+ * Subsequent searches may leave us on a file range we have
436+ * processed before - this happens due to a race with ordered
437+ * extent completion for a file range that is outside our source
438+ * range, but that range was part of a file extent item that
439+ * also covered a leading part of our source range.
434440 */
435− if (key.offset + datal <= off) {
441+ if (key.offset + datal <= prev_extent_end) {
436442 path->slots[0]++;
437443 goto process_slot;
438444 } else if (key.offset >= off + len) {
439445 break;
440446 }
441− next_key_min_offset = key.offset + datal;
447+
448+ prev_extent_end = key.offset + datal;
442449 size = btrfs_item_size(leaf, slot);
443450 read_extent_buffer(leaf, buf, btrfs_item_ptr_offset(leaf, slot),
444451 size);
@@ -489,6 +496,7 @@ process_slot: · 44 unmodified lines
489496 clone_info.file_offset = new_key.offset;
490497 clone_info.extent_buf = buf;
491498 clone_info.is_new_extent = false;
499+ clone_info.update_times = !no_time_update;
492500 ret = btrfs_replace_file_extents(BTRFS_I(inode), path,
493501 drop_start, new_key.offset + datal - 1,
494502 &clone_info, &trans);
@@ -550,7 +558,7 @@ process_slot: · 55 unmodified lines
550558 break;
551559
552560 btrfs_release_path(path);
553− key.offset = next_key_min_offset;
561+ key.offset = prev_extent_end;
554562
555563 if (fatal_signal_pending(current)) {
556564 ret = -EINTR;
fs/btrfs/super.c+40−7
@@ -763,6 +763,8 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, · 762 unmodified lines
763763 compress_force = false;
764764 no_compress++;
765765 } else {
766+ btrfs_err(info, "unrecognized compression value %s",
767+ args[0].from);
766768 ret = -EINVAL;
767769 goto out;
768770 }
@@ -821,8 +823,11 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, · 52 unmodified lines
821823 case Opt_thread_pool:
822824 ret = match_int(&args[0], &intarg);
823825 if (ret) {
826+ btrfs_err(info, "unrecognized thread_pool value %s",
827+ args[0].from);
824828 goto out;
825829 } else if (intarg == 0) {
830+ btrfs_err(info, "invalid value 0 for thread_pool");
826831 ret = -EINVAL;
827832 goto out;
828833 }
@@ -883,8 +888,11 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, · 54 unmodified lines
883888 break;
884889 case Opt_ratio:
885890 ret = match_int(&args[0], &intarg);
886− if (ret)
891+ if (ret) {
892+ btrfs_err(info, "unrecognized metadata_ratio value %s",
893+ args[0].from);
887894 goto out;
895+ }
888896 info->metadata_ratio = intarg;
889897 btrfs_info(info, "metadata ratio %u",
890898 info->metadata_ratio);
@@ -901,6 +909,8 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, · 10 unmodified lines
901909 btrfs_set_and_info(info, DISCARD_ASYNC,
902910 "turning on async discard");
903911 } else {
912+ btrfs_err(info, "unrecognized discard mode value %s",
913+ args[0].from);
904914 ret = -EINVAL;
905915 goto out;
906916 }
@@ -933,6 +943,8 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, · 26 unmodified lines
933943 btrfs_set_and_info(info, FREE_SPACE_TREE,
934944 "enabling free space tree");
935945 } else {
946+ btrfs_err(info, "unrecognized space_cache value %s",
947+ args[0].from);
936948 ret = -EINVAL;
937949 goto out;
938950 }
@@ -1014,8 +1026,12 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, · 75 unmodified lines
10141026 break;
10151027 case Opt_check_integrity_print_mask:
10161028 ret = match_int(&args[0], &intarg);
1017− if (ret)
1029+ if (ret) {
1030+ btrfs_err(info,
1031+ "unrecognized check_integrity_print_mask value %s",
1032+ args[0].from);
10181033 goto out;
1034+ }
10191035 info->check_integrity_print_mask = intarg;
10201036 btrfs_info(info, "check_integrity_print_mask 0x%x",
10211037 info->check_integrity_print_mask);
@@ -1030,13 +1046,15 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, · 8 unmodified lines
10301046 goto out;
10311047 #endif
10321048 case Opt_fatal_errors:
1033− if (strcmp(args[0].from, "panic") == 0)
1049+ if (strcmp(args[0].from, "panic") == 0) {
10341050 btrfs_set_opt(info->mount_opt,
10351051 PANIC_ON_FATAL_ERROR);
1036− else if (strcmp(args[0].from, "bug") == 0)
1052+ } else if (strcmp(args[0].from, "bug") == 0) {
10371053 btrfs_clear_opt(info->mount_opt,
10381054 PANIC_ON_FATAL_ERROR);
1039− else {
1055+ } else {
1056+ btrfs_err(info, "unrecognized fatal_errors value %s",
1057+ args[0].from);
10401058 ret = -EINVAL;
10411059 goto out;
10421060 }
@@ -1044,8 +1062,12 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, · 1 unmodified line
10441062 case Opt_commit_interval:
10451063 intarg = 0;
10461064 ret = match_int(&args[0], &intarg);
1047− if (ret)
1065+ if (ret) {
1066+ btrfs_err(info, "unrecognized commit_interval value %s",
1067+ args[0].from);
1068+ ret = -EINVAL;
10481069 goto out;
1070+ }
10491071 if (intarg == 0) {
10501072 btrfs_info(info,
10511073 "using default commit interval %us",
@@ -1059,8 +1081,11 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, · 7 unmodified lines
10591081 break;
10601082 case Opt_rescue:
10611083 ret = parse_rescue_options(info, args[0].from);
1062− if (ret < 0)
1084+ if (ret < 0) {
1085+ btrfs_err(info, "unrecognized rescue value %s",
1086+ args[0].from);
10631087 goto out;
1088+ }
10641089 break;
10651090 #ifdef CONFIG_BTRFS_DEBUG
10661091 case Opt_fragment_all:
@@ -1985,6 +2010,14 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) · 918 unmodified lines
19852010 if (ret)
19862011 goto restore;
19872012
2013+ /* V1 cache is not supported for subpage mount. */
2014+ if (fs_info->sectorsize < PAGE_SIZE && btrfs_test_opt(fs_info, SPACE_CACHE)) {
2015+ btrfs_warn(fs_info,
2016+ "v1 space cache is not supported for page size %lu with sectorsize %u",
2017+ PAGE_SIZE, fs_info->sectorsize);
2018+ ret = -EINVAL;
2019+ goto restore;
2020+ }
19882021 btrfs_remount_begin(fs_info, old_opts, *flags);
19892022 btrfs_resize_thread_pool(fs_info,
19902023 fs_info->thread_pool_size, old_thread_pool_size);
fs/btrfs/zoned.c+27−0
@@ -2139,3 +2139,30 @@ bool btrfs_zoned_should_reclaim(struct btrfs_fs_info *fs_info) · 2138 unmodified lines
21392139 factor = div64_u64(used * 100, total);
21402140 return factor >= fs_info->bg_reclaim_threshold;
21412141 }
2142+
2143+void btrfs_zoned_release_data_reloc_bg(struct btrfs_fs_info *fs_info, u64 logical,
2144+ u64 length)
2145+{
2146+ struct btrfs_block_group *block_group;
2147+
2148+ if (!btrfs_is_zoned(fs_info))
2149+ return;
2150+
2151+ block_group = btrfs_lookup_block_group(fs_info, logical);
2152+ /* It should be called on a previous data relocation block group. */
2153+ ASSERT(block_group && (block_group->flags & BTRFS_BLOCK_GROUP_DATA));
2154+
2155+ spin_lock(&block_group->lock);
2156+ if (!block_group->zoned_data_reloc_ongoing)
2157+ goto out;
2158+
2159+ /* All relocation extents are written. */
2160+ if (block_group->start + block_group->alloc_offset == logical + length) {
2161+ /* Now, release this block group for further allocations. */
2162+ block_group->zoned_data_reloc_ongoing = 0;
2163+ }
2164+
2165+out:
2166+ spin_unlock(&block_group->lock);
2167+ btrfs_put_block_group(block_group);
2168+}
fs/btrfs/zoned.h+5−0
@@ -77,6 +77,8 @@ void btrfs_schedule_zone_finish_bg(struct btrfs_block_group *bg, · 76 unmodified lines
7777 void btrfs_clear_data_reloc_bg(struct btrfs_block_group *bg);
7878 void btrfs_free_zone_cache(struct btrfs_fs_info *fs_info);
7979 bool btrfs_zoned_should_reclaim(struct btrfs_fs_info *fs_info);
80+void btrfs_zoned_release_data_reloc_bg(struct btrfs_fs_info *fs_info, u64 logical,
81+ u64 length);
8082 #else /* CONFIG_BLK_DEV_ZONED */
8183 static inline int btrfs_get_dev_zone(struct btrfs_device *device, u64 pos,
8284 struct blk_zone *zone)
@@ -243,6 +245,9 @@ static inline bool btrfs_zoned_should_reclaim(struct btrfs_fs_info *fs_info) · 160 unmodified lines
243245 {
244246 return false;
245247 }
248+
249+static inline void btrfs_zoned_release_data_reloc_bg(struct btrfs_fs_info *fs_info,
250+ u64 logical, u64 length) { }
246251 #endif
247252
248253 static inline bool btrfs_dev_is_sequential(struct btrfs_device *device, u64 pos)
fs/cifs/cifs_debug.c+7−5
@@ -162,6 +162,8 @@ cifs_dump_iface(struct seq_file *m, struct cifs_server_iface *iface) · 161 unmodified lines
162162 seq_printf(m, "\t\tIPv4: %pI4\n", &ipv4->sin_addr);
163163 else if (iface->sockaddr.ss_family == AF_INET6)
164164 seq_printf(m, "\t\tIPv6: %pI6\n", &ipv6->sin6_addr);
165+ if (!iface->is_active)
166+ seq_puts(m, "\t\t[for-cleanup]\n");
165167 }
166168
167169 static int cifs_debug_files_proc_show(struct seq_file *m, void *v)
@@ -221,6 +223,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) · 53 unmodified lines
221223 struct TCP_Server_Info *server;
222224 struct cifs_ses *ses;
223225 struct cifs_tcon *tcon;
226+ struct cifs_server_iface *iface;
224227 int c, i, j;
225228
226229 seq_puts(m,
@@ -456,11 +459,10 @@ skip_rdma: · 229 unmodified lines
456459 if (ses->iface_count)
457460 seq_printf(m, "\n\n\tServer interfaces: %zu",
458461 ses->iface_count);
459− for (j = 0; j < ses->iface_count; j++) {
460− struct cifs_server_iface *iface;
461−
462− iface = &ses->iface_list[j];
463− seq_printf(m, "\n\t%d)", j+1);
462+ j = 0;
463+ list_for_each_entry(iface, &ses->iface_list,
464+ iface_head) {
465+ seq_printf(m, "\n\t%d)", ++j);
464466 cifs_dump_iface(m, iface);
465467 if (is_ses_using_iface(ses, iface))
466468 seq_puts(m, "\t\t[CONNECTED]\n");
fs/cifs/cifsglob.h+57−1
@@ -80,6 +80,9 @@ · 79 unmodified lines
8080 #define SMB_DNS_RESOLVE_INTERVAL_MIN 120
8181 #define SMB_DNS_RESOLVE_INTERVAL_DEFAULT 600
8282
83+/* smb multichannel query server interfaces interval in seconds */
84+#define SMB_INTERFACE_POLL_INTERVAL 600
85+
8386 /* maximum number of PDUs in one compound */
8487 #define MAX_COMPOUND 5
8588
@@ -933,15 +936,67 @@ static inline void cifs_set_net_ns(struct TCP_Server_Info *srv, struct net *net) · 847 unmodified lines
933936 #endif
934937
935938 struct cifs_server_iface {
939+ struct list_head iface_head;
940+ struct kref refcount;
936941 size_t speed;
937942 unsigned int rdma_capable : 1;
938943 unsigned int rss_capable : 1;
944+ unsigned int is_active : 1; /* unset if non existent */
939945 struct sockaddr_storage sockaddr;
940946 };
941947
948+/* release iface when last ref is dropped */
949+static inline void
950+release_iface(struct kref *ref)
951+{
952+ struct cifs_server_iface *iface = container_of(ref,
953+ struct cifs_server_iface,
954+ refcount);
955+ list_del_init(&iface->iface_head);
956+ kfree(iface);
957+}
958+
959+/*
960+ * compare two interfaces a and b
961+ * return 0 if everything matches.
962+ * return 1 if a has higher link speed, or rdma capable, or rss capable
963+ * return -1 otherwise.
964+ */
965+static inline int
966+iface_cmp(struct cifs_server_iface *a, struct cifs_server_iface *b)
967+{
968+ int cmp_ret = 0;
969+
970+ WARN_ON(!a || !b);
971+ if (a->speed == b->speed) {
972+ if (a->rdma_capable == b->rdma_capable) {
973+ if (a->rss_capable == b->rss_capable) {
974+ cmp_ret = memcmp(&a->sockaddr, &b->sockaddr,
975+ sizeof(a->sockaddr));
976+ if (!cmp_ret)
977+ return 0;
978+ else if (cmp_ret > 0)
979+ return 1;
980+ else
981+ return -1;
982+ } else if (a->rss_capable > b->rss_capable)
983+ return 1;
984+ else
985+ return -1;
986+ } else if (a->rdma_capable > b->rdma_capable)
987+ return 1;
988+ else
989+ return -1;
990+ } else if (a->speed > b->speed)
991+ return 1;
992+ else
993+ return -1;
994+}
995+
942996 struct cifs_chan {
943997 unsigned int in_reconnect : 1; /* if session setup in progress for this channel */
944998 struct TCP_Server_Info *server;
999+ struct cifs_server_iface *iface; /* interface in use */
9451000 __u8 signkey[SMB3_SIGN_KEY_SIZE];
9461001 };
9471002
@@ -993,7 +1048,7 @@ struct cifs_ses { · 45 unmodified lines
9931048 */
9941049 spinlock_t iface_lock;
9951050 /* ========= begin: protected by iface_lock ======== */
996− struct cifs_server_iface *iface_list;
1051+ struct list_head iface_list;
9971052 size_t iface_count;
9981053 unsigned long iface_last_update; /* jiffies */
9991054 /* ========= end: protected by iface_lock ======== */
@@ -1203,6 +1258,7 @@ struct cifs_tcon { · 203 unmodified lines
12031258 #ifdef CONFIG_CIFS_DFS_UPCALL
12041259 struct list_head ulist; /* cache update list */
12051260 #endif
1261+ struct delayed_work query_interfaces; /* query interfaces workqueue job */
12061262 };
12071263
12081264 /*
fs/cifs/cifsproto.h+7−0
@@ -636,6 +636,13 @@ cifs_chan_clear_need_reconnect(struct cifs_ses *ses, · 635 unmodified lines
636636 bool
637637 cifs_chan_needs_reconnect(struct cifs_ses *ses,
638638 struct TCP_Server_Info *server);
639+bool
640+cifs_chan_is_iface_active(struct cifs_ses *ses,
641+ struct TCP_Server_Info *server);
642+int
643+cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server);
644+int
645+SMB3_request_interfaces(const unsigned int xid, struct cifs_tcon *tcon);
639646
640647 void extract_unc_hostname(const char *unc, const char **h, size_t *len);
641648 int copy_path_name(char *dst, const char *src);
fs/cifs/connect.c+54−5
@@ -145,6 +145,25 @@ requeue_resolve: · 144 unmodified lines
145145 return rc;
146146 }
147147
148+static void smb2_query_server_interfaces(struct work_struct *work)
149+{
150+ int rc;
151+ struct cifs_tcon *tcon = container_of(work,
152+ struct cifs_tcon,
153+ query_interfaces.work);
154+
155+ /*
156+ * query server network interfaces, in case they change
157+ */
158+ rc = SMB3_request_interfaces(0, tcon);
159+ if (rc) {
160+ cifs_dbg(FYI, "%s: failed to query server interfaces: %d\n",
161+ __func__, rc);
162+ }
163+
164+ queue_delayed_work(cifsiod_wq, &tcon->query_interfaces,
165+ (SMB_INTERFACE_POLL_INTERVAL * HZ));
166+}
148167
149168 static void cifs_resolve_server(struct work_struct *work)
150169 {
@@ -217,7 +236,7 @@ cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server, · 66 unmodified lines
217236 bool mark_smb_session)
218237 {
219238 struct TCP_Server_Info *pserver;
220− struct cifs_ses *ses;
239+ struct cifs_ses *ses, *nses;
221240 struct cifs_tcon *tcon;
222241
223242 /*
@@ -231,7 +250,20 @@ cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server, · 7 unmodified lines
231250
232251
233252 spin_lock(&cifs_tcp_ses_lock);
234− list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) {
253+ list_for_each_entry_safe(ses, nses, &pserver->smb_ses_list, smb_ses_list) {
254+ /* check if iface is still active */
255+ if (!cifs_chan_is_iface_active(ses, server)) {
256+ /*
257+ * HACK: drop the lock before calling
258+ * cifs_chan_update_iface to avoid deadlock
259+ */
260+ ses->ses_count++;
261+ spin_unlock(&cifs_tcp_ses_lock);
262+ cifs_chan_update_iface(ses, server);
263+ spin_lock(&cifs_tcp_ses_lock);
264+ ses->ses_count--;
265+ }
266+
235267 spin_lock(&ses->chan_lock);
236268 if (!mark_smb_session && cifs_chan_needs_reconnect(ses, server))
237269 goto next_session;
@@ -1894,9 +1926,11 @@ void cifs_put_smb_ses(struct cifs_ses *ses) · 1656 unmodified lines
18941926 int i;
18951927
18961928 for (i = 1; i < chan_count; i++) {
1897− spin_unlock(&ses->chan_lock);
1929+ if (ses->chans[i].iface) {
1930+ kref_put(&ses->chans[i].iface->refcount, release_iface);
1931+ ses->chans[i].iface = NULL;
1932+ }
18981933 cifs_put_tcp_session(ses->chans[i].server, 0);
1899− spin_lock(&ses->chan_lock);
19001934 ses->chans[i].server = NULL;
19011935 }
19021936 }
@@ -2270,6 +2304,9 @@ cifs_put_tcon(struct cifs_tcon *tcon) · 367 unmodified lines
22702304 list_del_init(&tcon->tcon_list);
22712305 spin_unlock(&cifs_tcp_ses_lock);
22722306
2307+ /* cancel polling of interfaces */
2308+ cancel_delayed_work_sync(&tcon->query_interfaces);
2309+
22732310 if (tcon->use_witness) {
22742311 int rc;
22752312
@@ -2507,6 +2544,12 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) · 231 unmodified lines
25072544 tcon->local_lease = ctx->local_lease;
25082545 INIT_LIST_HEAD(&tcon->pending_opens);
25092546
2547+ /* schedule query interfaces poll */
2548+ INIT_DELAYED_WORK(&tcon->query_interfaces,
2549+ smb2_query_server_interfaces);
2550+ queue_delayed_work(cifsiod_wq, &tcon->query_interfaces,
2551+ (SMB_INTERFACE_POLL_INTERVAL * HZ));
2552+
25102553 spin_lock(&cifs_tcp_ses_lock);
25112554 list_add(&tcon->tcon_list, &ses->tcon_list);
25122555 spin_unlock(&cifs_tcp_ses_lock);
@@ -3982,10 +4025,16 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses, · 1469 unmodified lines
39824025 struct nls_table *nls_info)
39834026 {
39844027 int rc = -ENOSYS;
4028+ struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)&server->dstaddr;
4029+ struct sockaddr_in *addr = (struct sockaddr_in *)&server->dstaddr;
39854030 bool is_binding = false;
39864031
3987−
39884032 spin_lock(&cifs_tcp_ses_lock);
4033+ if (server->dstaddr.ss_family == AF_INET6)
4034+ scnprintf(ses->ip_addr, sizeof(ses->ip_addr), "%pI6", &addr6->sin6_addr);
4035+ else
4036+ scnprintf(ses->ip_addr, sizeof(ses->ip_addr), "%pI4", &addr->sin_addr);
4037+
39894038 if (ses->ses_status != SES_GOOD &&
39904039 ses->ses_status != SES_NEW &&
39914040 ses->ses_status != SES_NEED_RECON) {
fs/cifs/misc.c+8−1
@@ -75,6 +75,7 @@ sesInfoAlloc(void) · 74 unmodified lines
7575 INIT_LIST_HEAD(&ret_buf->tcon_list);
7676 mutex_init(&ret_buf->session_mutex);
7777 spin_lock_init(&ret_buf->iface_lock);
78+ INIT_LIST_HEAD(&ret_buf->iface_list);
7879 spin_lock_init(&ret_buf->chan_lock);
7980 }
8081 return ret_buf;
@@ -83,6 +84,8 @@ sesInfoAlloc(void) · 2 unmodified lines
8384 void
8485 sesInfoFree(struct cifs_ses *buf_to_free)
8586 {
87+ struct cifs_server_iface *iface = NULL, *niface = NULL;
88+
8689 if (buf_to_free == NULL) {
8790 cifs_dbg(FYI, "Null buffer passed to sesInfoFree\n");
8891 return;
@@ -96,7 +99,11 @@ sesInfoFree(struct cifs_ses *buf_to_free) · 7 unmodified lines
9699 kfree(buf_to_free->user_name);
97100 kfree(buf_to_free->domainName);
98101 kfree_sensitive(buf_to_free->auth_key.response);
99− kfree(buf_to_free->iface_list);
102+ spin_lock(&buf_to_free->iface_lock);
103+ list_for_each_entry_safe(iface, niface, &buf_to_free->iface_list,
104+ iface_head)
105+ kref_put(&iface->refcount, release_iface);
106+ spin_unlock(&buf_to_free->iface_lock);
100107 kfree_sensitive(buf_to_free);
101108 }
102109
fs/cifs/sess.c+131−38
@@ -58,7 +58,7 @@ bool is_ses_using_iface(struct cifs_ses *ses, struct cifs_server_iface *iface) · 57 unmodified lines
5858
5959 spin_lock(&ses->chan_lock);
6060 for (i = 0; i < ses->chan_count; i++) {
61− if (is_server_using_iface(ses->chans[i].server, iface)) {
61+ if (ses->chans[i].iface == iface) {
6262 spin_unlock(&ses->chan_lock);
6363 return true;
6464 }
@@ -81,6 +81,9 @@ cifs_ses_get_chan_index(struct cifs_ses *ses, · 16 unmodified lines
8181 }
8282
8383 /* If we didn't find the channel, it is likely a bug */
84+ if (server)
85+ cifs_dbg(VFS, "unable to get chan index for server: 0x%llx",
86+ server->conn_id);
8487 WARN_ON(1);
8588 return 0;
8689 }
@@ -143,16 +146,24 @@ cifs_chan_needs_reconnect(struct cifs_ses *ses, · 56 unmodified lines
143146 return CIFS_CHAN_NEEDS_RECONNECT(ses, chan_index);
144147 }
145148
149+bool
150+cifs_chan_is_iface_active(struct cifs_ses *ses,
151+ struct TCP_Server_Info *server)
152+{
153+ unsigned int chan_index = cifs_ses_get_chan_index(ses, server);
154+
155+ return ses->chans[chan_index].iface &&
156+ ses->chans[chan_index].iface->is_active;
157+}
158+
146159 /* returns number of channels added */
147160 int cifs_try_adding_channels(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses)
148161 {
149162 int old_chan_count, new_chan_count;
150163 int left;
151− int i = 0;
152164 int rc = 0;
153165 int tries = 0;
154− struct cifs_server_iface *ifaces = NULL;
155− size_t iface_count;
166+ struct cifs_server_iface *iface = NULL, *niface = NULL;
156167
157168 spin_lock(&ses->chan_lock);
158169
@@ -181,33 +192,17 @@ int cifs_try_adding_channels(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses) · 22 unmodified lines
181192 }
182193 spin_unlock(&ses->chan_lock);
183194
184− /*
185− * Make a copy of the iface list at the time and use that
186− * instead so as to not hold the iface spinlock for opening
187− * channels
188− */
189− spin_lock(&ses->iface_lock);
190− iface_count = ses->iface_count;
191− if (iface_count <= 0) {
192− spin_unlock(&ses->iface_lock);
193− cifs_dbg(VFS, "no iface list available to open channels\n");
194− return 0;
195− }
196− ifaces = kmemdup(ses->iface_list, iface_count*sizeof(*ifaces),
197− GFP_ATOMIC);
198− if (!ifaces) {
199− spin_unlock(&ses->iface_lock);
200− return 0;
201− }
202− spin_unlock(&ses->iface_lock);
203−
204195 /*
205196 * Keep connecting to same, fastest, iface for all channels as
206197 * long as its RSS. Try next fastest one if not RSS or channel
207198 * creation fails.
208199 */
200+ spin_lock(&ses->iface_lock);
201+ iface = list_first_entry(&ses->iface_list, struct cifs_server_iface,
202+ iface_head);
203+ spin_unlock(&ses->iface_lock);
204+
209205 while (left > 0) {
210− struct cifs_server_iface *iface;
211206
212207 tries++;
213208 if (tries > 3*ses->chan_max) {
@@ -216,30 +211,127 @@ int cifs_try_adding_channels(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses) · 2 unmodified lines
216211 break;
217212 }
218213
219− iface = &ifaces[i];
220− if (is_ses_using_iface(ses, iface) && !iface->rss_capable) {
221− i = (i+1) % iface_count;
222− continue;
214+ spin_lock(&ses->iface_lock);
215+ if (!ses->iface_count) {
216+ spin_unlock(&ses->iface_lock);
217+ break;
223218 }
224219
225− rc = cifs_ses_add_channel(cifs_sb, ses, iface);
226− if (rc) {
227− cifs_dbg(FYI, "failed to open extra channel on iface#%d rc=%d\n",
228− i, rc);
229− i = (i+1) % iface_count;
230− continue;
220+ list_for_each_entry_safe_from(iface, niface, &ses->iface_list,
221+ iface_head) {
222+ /* skip ifaces that are unusable */
223+ if (!iface->is_active ||
224+ (is_ses_using_iface(ses, iface) &&
225+ !iface->rss_capable)) {
226+ continue;
227+ }
228+
229+ /* take ref before unlock */
230+ kref_get(&iface->refcount);
231+
232+ spin_unlock(&ses->iface_lock);
233+ rc = cifs_ses_add_channel(cifs_sb, ses, iface);
234+ spin_lock(&ses->iface_lock);
235+
236+ if (rc) {
237+ cifs_dbg(VFS, "failed to open extra channel on iface:%pIS rc=%d\n",
238+ &iface->sockaddr,
239+ rc);
240+ kref_put(&iface->refcount, release_iface);
241+ continue;
242+ }
243+
244+ cifs_dbg(FYI, "successfully opened new channel on iface:%pIS\n",
245+ &iface->sockaddr);
246+ break;
231247 }
248+ spin_unlock(&ses->iface_lock);
232249
233− cifs_dbg(FYI, "successfully opened new channel on iface#%d\n",
234− i);
235250 left--;
236251 new_chan_count++;
237252 }
238253
239− kfree(ifaces);
240254 return new_chan_count - old_chan_count;
241255 }
242256
257+/*
258+ * update the iface for the channel if necessary.
259+ * will return 0 when iface is updated, 1 if removed, 2 otherwise
260+ * Must be called with chan_lock held.
261+ */
262+int
263+cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
264+{
265+ unsigned int chan_index;
266+ struct cifs_server_iface *iface = NULL;
267+ struct cifs_server_iface *old_iface = NULL;
268+ int rc = 0;
269+
270+ spin_lock(&ses->chan_lock);
271+ chan_index = cifs_ses_get_chan_index(ses, server);
272+ if (!chan_index) {
273+ spin_unlock(&ses->chan_lock);
274+ return 0;
275+ }
276+
277+ if (ses->chans[chan_index].iface) {
278+ old_iface = ses->chans[chan_index].iface;
279+ if (old_iface->is_active) {
280+ spin_unlock(&ses->chan_lock);
281+ return 1;
282+ }
283+ }
284+ spin_unlock(&ses->chan_lock);
285+
286+ spin_lock(&ses->iface_lock);
287+ /* then look for a new one */
288+ list_for_each_entry(iface, &ses->iface_list, iface_head) {
289+ if (!iface->is_active ||
290+ (is_ses_using_iface(ses, iface) &&
291+ !iface->rss_capable)) {
292+ continue;
293+ }
294+ kref_get(&iface->refcount);
295+ }
296+
297+ if (!list_entry_is_head(iface, &ses->iface_list, iface_head)) {
298+ rc = 1;
299+ iface = NULL;
300+ cifs_dbg(FYI, "unable to find a suitable iface\n");
301+ }
302+
303+ /* now drop the ref to the current iface */
304+ if (old_iface && iface) {
305+ kref_put(&old_iface->refcount, release_iface);
306+ cifs_dbg(FYI, "replacing iface: %pIS with %pIS\n",
307+ &old_iface->sockaddr,
308+ &iface->sockaddr);
309+ } else if (old_iface) {
310+ kref_put(&old_iface->refcount, release_iface);
311+ cifs_dbg(FYI, "releasing ref to iface: %pIS\n",
312+ &old_iface->sockaddr);
313+ } else {
314+ WARN_ON(!iface);
315+ cifs_dbg(FYI, "adding new iface: %pIS\n", &iface->sockaddr);
316+ }
317+ spin_unlock(&ses->iface_lock);
318+
319+ spin_lock(&ses->chan_lock);
320+ chan_index = cifs_ses_get_chan_index(ses, server);
321+ ses->chans[chan_index].iface = iface;
322+
323+ /* No iface is found. if secondary chan, drop connection */
324+ if (!iface && CIFS_SERVER_IS_CHAN(server))
325+ ses->chans[chan_index].server = NULL;
326+
327+ spin_unlock(&ses->chan_lock);
328+
329+ if (!iface && CIFS_SERVER_IS_CHAN(server))
330+ cifs_put_tcp_session(server, false);
331+
332+ return rc;
333+}
334+
243335 /*
244336 * If server is a channel of ses, return the corresponding enclosing
245337 * cifs_chan otherwise return NULL.
@@ -352,6 +444,7 @@ cifs_ses_add_channel(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses, · 106 unmodified lines
352444 spin_unlock(&ses->chan_lock);
353445 goto out;
354446 }
447+ chan->iface = iface;
355448 ses->chan_count++;
356449 atomic_set(&ses->chan_seq, 0);
357450
fs/cifs/smb2ops.c+90−83
@@ -512,73 +512,41 @@ smb3_negotiate_rsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx) · 511 unmodified lines
512512 static int
513513 parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf,
514514 size_t buf_len,
515− struct cifs_server_iface **iface_list,
516− size_t *iface_count)
515+ struct cifs_ses *ses)
517516 {
518517 struct network_interface_info_ioctl_rsp *p;
519518 struct sockaddr_in *addr4;
520519 struct sockaddr_in6 *addr6;
521520 struct iface_info_ipv4 *p4;
522521 struct iface_info_ipv6 *p6;
523− struct cifs_server_iface *info;
522+ struct cifs_server_iface *info = NULL, *iface = NULL, *niface = NULL;
523+ struct cifs_server_iface tmp_iface;
524524 ssize_t bytes_left;
525525 size_t next = 0;
526526 int nb_iface = 0;
527− int rc = 0;
528−
529− *iface_list = NULL;
530− *iface_count = 0;
531−
532− /*
533− * Fist pass: count and sanity check
534− */
527+ int rc = 0, ret = 0;
535528
536529 bytes_left = buf_len;
537530 p = buf;
538− while (bytes_left >= sizeof(*p)) {
539− nb_iface++;
540− next = le32_to_cpu(p->Next);
541− if (!next) {
542− bytes_left -= sizeof(*p);
543− break;
544− }
545− p = (struct network_interface_info_ioctl_rsp *)((u8 *)p+next);
546− bytes_left -= next;
547− }
548−
549− if (!nb_iface) {
550− cifs_dbg(VFS, "%s: malformed interface info\n", __func__);
551− rc = -EINVAL;
552− goto out;
553− }
554−
555− /* Azure rounds the buffer size up 8, to a 16 byte boundary */
556− if ((bytes_left > 8) || p->Next)
557− cifs_dbg(VFS, "%s: incomplete interface info\n", __func__);
558−
559531
532+ spin_lock(&ses->iface_lock);
560533 /*
561− * Second pass: extract info to internal structure
534+ * Go through iface_list and do kref_put to remove
535+ * any unused ifaces. ifaces in use will be removed
536+ * when the last user calls a kref_put on it
562537 */
563−
564− *iface_list = kcalloc(nb_iface, sizeof(**iface_list), GFP_KERNEL);
565− if (!*iface_list) {
566− rc = -ENOMEM;
567− goto out;
538+ list_for_each_entry_safe(iface, niface, &ses->iface_list,
539+ iface_head) {
540+ iface->is_active = 0;
541+ kref_put(&iface->refcount, release_iface);
568542 }
543+ spin_unlock(&ses->iface_lock);
569544
570− info = *iface_list;
571− bytes_left = buf_len;
572− p = buf;
573545 while (bytes_left >= sizeof(*p)) {
574− info->speed = le64_to_cpu(p->LinkSpeed);
575− info->rdma_capable = le32_to_cpu(p->Capability & RDMA_CAPABLE) ? 1 : 0;
576− info->rss_capable = le32_to_cpu(p->Capability & RSS_CAPABLE) ? 1 : 0;
577−
578− cifs_dbg(FYI, "%s: adding iface %zu\n", __func__, *iface_count);
579− cifs_dbg(FYI, "%s: speed %zu bps\n", __func__, info->speed);
580− cifs_dbg(FYI, "%s: capabilities 0x%08x\n", __func__,
581− le32_to_cpu(p->Capability));
546+ memset(&tmp_iface, 0, sizeof(tmp_iface));
547+ tmp_iface.speed = le64_to_cpu(p->LinkSpeed);
548+ tmp_iface.rdma_capable = le32_to_cpu(p->Capability & RDMA_CAPABLE) ? 1 : 0;
549+ tmp_iface.rss_capable = le32_to_cpu(p->Capability & RSS_CAPABLE) ? 1 : 0;
582550
583551 switch (p->Family) {
584552 /*
@@ -587,7 +555,7 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf, · 2 unmodified lines
587555 * conversion explicit in case either one changes.
588556 */
589557 case INTERNETWORK:
590− addr4 = (struct sockaddr_in *)&info->sockaddr;
558+ addr4 = (struct sockaddr_in *)&tmp_iface.sockaddr;
591559 p4 = (struct iface_info_ipv4 *)p->Buffer;
592560 addr4->sin_family = AF_INET;
593561 memcpy(&addr4->sin_addr, &p4->IPv4Address, 4);
@@ -599,7 +567,7 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf, · 5 unmodified lines
599567 &addr4->sin_addr);
600568 break;
601569 case INTERNETWORKV6:
602− addr6 = (struct sockaddr_in6 *)&info->sockaddr;
570+ addr6 = (struct sockaddr_in6 *)&tmp_iface.sockaddr;
603571 p6 = (struct iface_info_ipv6 *)p->Buffer;
604572 addr6->sin6_family = AF_INET6;
605573 memcpy(&addr6->sin6_addr, &p6->IPv6Address, 16);
@@ -619,46 +587,96 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf, · 13 unmodified lines
619587 goto next_iface;
620588 }
621589
622− (*iface_count)++;
623− info++;
590+ /*
591+ * The iface_list is assumed to be sorted by speed.
592+ * Check if the new interface exists in that list.
593+ * NEVER change iface. it could be in use.
594+ * Add a new one instead
595+ */
596+ spin_lock(&ses->iface_lock);
597+ iface = niface = NULL;
598+ list_for_each_entry_safe(iface, niface, &ses->iface_list,
599+ iface_head) {
600+ ret = iface_cmp(iface, &tmp_iface);
601+ if (!ret) {
602+ /* just get a ref so that it doesn't get picked/freed */
603+ iface->is_active = 1;
604+ kref_get(&iface->refcount);
605+ spin_unlock(&ses->iface_lock);
606+ goto next_iface;
607+ } else if (ret < 0) {
608+ /* all remaining ifaces are slower */
609+ kref_get(&iface->refcount);
610+ break;
611+ }
612+ }
613+ spin_unlock(&ses->iface_lock);
614+
615+ /* no match. insert the entry in the list */
616+ info = kmalloc(sizeof(struct cifs_server_iface),
617+ GFP_KERNEL);
618+ if (!info) {
619+ rc = -ENOMEM;
620+ goto out;
621+ }
622+ memcpy(info, &tmp_iface, sizeof(tmp_iface));
623+
624+ /* add this new entry to the list */
625+ kref_init(&info->refcount);
626+ info->is_active = 1;
627+
628+ cifs_dbg(FYI, "%s: adding iface %zu\n", __func__, ses->iface_count);
629+ cifs_dbg(FYI, "%s: speed %zu bps\n", __func__, info->speed);
630+ cifs_dbg(FYI, "%s: capabilities 0x%08x\n", __func__,
631+ le32_to_cpu(p->Capability));
632+
633+ spin_lock(&ses->iface_lock);
634+ if (!list_entry_is_head(iface, &ses->iface_list, iface_head)) {
635+ list_add_tail(&info->iface_head, &iface->iface_head);
636+ kref_put(&iface->refcount, release_iface);
637+ } else
638+ list_add_tail(&info->iface_head, &ses->iface_list);
639+ spin_unlock(&ses->iface_lock);
640+
641+ ses->iface_count++;
642+ ses->iface_last_update = jiffies;
624643 next_iface:
644+ nb_iface++;
625645 next = le32_to_cpu(p->Next);
626− if (!next)
646+ if (!next) {
647+ bytes_left -= sizeof(*p);
627648 break;
649+ }
628650 p = (struct network_interface_info_ioctl_rsp *)((u8 *)p+next);
629651 bytes_left -= next;
630652 }
631653
632− if (!*iface_count) {
654+ if (!nb_iface) {
655+ cifs_dbg(VFS, "%s: malformed interface info\n", __func__);
633656 rc = -EINVAL;
634657 goto out;
635658 }
636659
637−out:
638− if (rc) {
639− kfree(*iface_list);
640− *iface_count = 0;
641− *iface_list = NULL;
642− }
643− return rc;
644−}
660+ /* Azure rounds the buffer size up 8, to a 16 byte boundary */
661+ if ((bytes_left > 8) || p->Next)
662+ cifs_dbg(VFS, "%s: incomplete interface info\n", __func__);
645663
646−static int compare_iface(const void *ia, const void *ib)
647−{
648− const struct cifs_server_iface *a = (struct cifs_server_iface *)ia;
649− const struct cifs_server_iface *b = (struct cifs_server_iface *)ib;
650664
651− return a->speed == b->speed ? 0 : (a->speed > b->speed ? -1 : 1);
665+ if (!ses->iface_count) {
666+ rc = -EINVAL;
667+ goto out;
668+ }
669+
670+out:
671+ return rc;
652672 }
653673
654−static int
674+int
655675 SMB3_request_interfaces(const unsigned int xid, struct cifs_tcon *tcon)
656676 {
657677 int rc;
658678 unsigned int ret_data_len = 0;
659679 struct network_interface_info_ioctl_rsp *out_buf = NULL;
660− struct cifs_server_iface *iface_list;
661− size_t iface_count;
662680 struct cifs_ses *ses = tcon->ses;
663681
664682 rc = SMB2_ioctl(xid, tcon, NO_FILE_ID, NO_FILE_ID,
@@ -674,21 +692,10 @@ SMB3_request_interfaces(const unsigned int xid, struct cifs_tcon *tcon) · 9 unmodified lines
674692 goto out;
675693 }
676694
677− rc = parse_server_interfaces(out_buf, ret_data_len,
678− &iface_list, &iface_count);
695+ rc = parse_server_interfaces(out_buf, ret_data_len, ses);
679696 if (rc)
680697 goto out;
681698
682− /* sort interfaces from fastest to slowest */
683− sort(iface_list, iface_count, sizeof(*iface_list), compare_iface, NULL);
684−
685− spin_lock(&ses->iface_lock);
686− kfree(ses->iface_list);
687− ses->iface_list = iface_list;
688− ses->iface_count = iface_count;
689− ses->iface_last_update = jiffies;
690− spin_unlock(&ses->iface_lock);
691−
692699 out:
693700 kfree(out_buf);
694701 return rc;
fs/cifs/smb2pdu.c+17−6
@@ -543,6 +543,7 @@ assemble_neg_contexts(struct smb2_negotiate_req *req, · 542 unmodified lines
543543 struct TCP_Server_Info *server, unsigned int *total_len)
544544 {
545545 char *pneg_ctxt;
546+ char *hostname = NULL;
546547 unsigned int ctxt_len, neg_context_count;
547548
548549 if (*total_len > 200) {
@@ -570,16 +571,24 @@ assemble_neg_contexts(struct smb2_negotiate_req *req, · 21 unmodified lines
570571 *total_len += ctxt_len;
571572 pneg_ctxt += ctxt_len;
572573
573− ctxt_len = build_netname_ctxt((struct smb2_netname_neg_context *)pneg_ctxt,
574− server->hostname);
575− *total_len += ctxt_len;
576− pneg_ctxt += ctxt_len;
577−
578574 build_posix_ctxt((struct smb2_posix_neg_context *)pneg_ctxt);
579575 *total_len += sizeof(struct smb2_posix_neg_context);
580576 pneg_ctxt += sizeof(struct smb2_posix_neg_context);
581577
582− neg_context_count = 4;
578+ /*
579+ * secondary channels don't have the hostname field populated
580+ * use the hostname field in the primary channel instead
581+ */
582+ hostname = CIFS_SERVER_IS_CHAN(server) ?
583+ server->primary_server->hostname : server->hostname;
584+ if (hostname && (hostname[0] != 0)) {
585+ ctxt_len = build_netname_ctxt((struct smb2_netname_neg_context *)pneg_ctxt,
586+ hostname);
587+ *total_len += ctxt_len;
588+ pneg_ctxt += ctxt_len;
589+ neg_context_count = 4;
590+ } else /* second channels do not have a hostname */
591+ neg_context_count = 3;
583592
584593 if (server->compress_algorithm) {
585594 build_compression_ctxt((struct smb2_compression_capabilities_context *)
@@ -5154,6 +5163,8 @@ SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, · 4568 unmodified lines
51545163 data = &info;
51555164 size = sizeof(struct smb2_file_eof_info);
51565165
5166+ trace_smb3_set_eof(xid, persistent_fid, tcon->tid, tcon->ses->Suid, le64_to_cpu(*eof));
5167+
51575168 return send_set_info(xid, tcon, persistent_fid, volatile_fid,
51585169 pid, FILE_END_OF_FILE_INFORMATION, SMB2_O_INFO_FILE,
51595170 0, 1, &data, &size);
fs/cifs/trace.h+38−0
@@ -121,6 +121,44 @@ DEFINE_SMB3_RW_DONE_EVENT(query_dir_done); · 120 unmodified lines
121121 DEFINE_SMB3_RW_DONE_EVENT(zero_done);
122122 DEFINE_SMB3_RW_DONE_EVENT(falloc_done);
123123
124+/* For logging successful set EOF (truncate) */
125+DECLARE_EVENT_CLASS(smb3_eof_class,
126+ TP_PROTO(unsigned int xid,
127+ __u64 fid,
128+ __u32 tid,
129+ __u64 sesid,
130+ __u64 offset),
131+ TP_ARGS(xid, fid, tid, sesid, offset),
132+ TP_STRUCT__entry(
133+ __field(unsigned int, xid)
134+ __field(__u64, fid)
135+ __field(__u32, tid)
136+ __field(__u64, sesid)
137+ __field(__u64, offset)
138+ ),
139+ TP_fast_assign(
140+ __entry->xid = xid;
141+ __entry->fid = fid;
142+ __entry->tid = tid;
143+ __entry->sesid = sesid;
144+ __entry->offset = offset;
145+ ),
146+ TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx",
147+ __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
148+ __entry->offset)
149+)
150+
151+#define DEFINE_SMB3_EOF_EVENT(name) \
152+DEFINE_EVENT(smb3_eof_class, smb3_##name, \
153+ TP_PROTO(unsigned int xid, \
154+ __u64 fid, \
155+ __u32 tid, \
156+ __u64 sesid, \
157+ __u64 offset), \
158+ TP_ARGS(xid, fid, tid, sesid, offset))
159+
160+DEFINE_SMB3_EOF_EVENT(set_eof);
161+
124162 /*
125163 * For handle based calls other than read and write, and get/set info
126164 */
fs/exfat/namei.c+3−1
@@ -1198,7 +1198,9 @@ static int __exfat_rename(struct inode *old_parent_inode, · 1197 unmodified lines
11981198 return -ENOENT;
11991199 }
12001200
1201− exfat_chain_dup(&olddir, &ei->dir);
1201+ exfat_chain_set(&olddir, EXFAT_I(old_parent_inode)->start_clu,
1202+ EXFAT_B_TO_CLU_ROUND_UP(i_size_read(old_parent_inode), sbi),
1203+ EXFAT_I(old_parent_inode)->flags);
12021204 dentry = ei->entry;
12031205
12041206 ep = exfat_get_dentry(sb, &olddir, dentry, &old_bh);
fs/ext2/dir.c+3−6
@@ -672,17 +672,14 @@ int ext2_empty_dir (struct inode * inode) · 671 unmodified lines
672672 void *page_addr = NULL;
673673 struct page *page = NULL;
674674 unsigned long i, npages = dir_pages(inode);
675− int dir_has_error = 0;
676675
677676 for (i = 0; i < npages; i++) {
678677 char *kaddr;
679678 ext2_dirent * de;
680− page = ext2_get_page(inode, i, dir_has_error, &page_addr);
679+ page = ext2_get_page(inode, i, 0, &page_addr);
681680
682− if (IS_ERR(page)) {
683− dir_has_error = 1;
684− continue;
685− }
681+ if (IS_ERR(page))
682+ goto not_empty;
686683
687684 kaddr = page_addr;
688685 de = (ext2_dirent *)kaddr;
fs/ext4/inode.c+1−1
@@ -829,7 +829,7 @@ int ext4_get_block_unwritten(struct inode *inode, sector_t iblock, · 828 unmodified lines
829829 ext4_debug("ext4_get_block_unwritten: inode %lu, create flag %d\n",
830830 inode->i_ino, create);
831831 return _ext4_get_block(inode, iblock, bh_result,
832− EXT4_GET_BLOCKS_IO_CREATE_EXT);
832+ EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT);
833833 }
834834
835835 /* Maximum number of blocks we map for direct IO at once. */
fs/ext4/mballoc.c+25−1
@@ -4104,6 +4104,15 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac, · 4103 unmodified lines
41044104 size = size >> bsbits;
41054105 start = start_off >> bsbits;
41064106
4107+ /*
4108+ * For tiny groups (smaller than 8MB) the chosen allocation
4109+ * alignment may be larger than group size. Make sure the
4110+ * alignment does not move allocation to a different group which
4111+ * makes mballoc fail assertions later.
4112+ */
4113+ start = max(start, rounddown(ac->ac_o_ex.fe_logical,
4114+ (ext4_lblk_t)EXT4_BLOCKS_PER_GROUP(ac->ac_sb)));
4115+
41074116 /* don't cover already allocated blocks in selected range */
41084117 if (ar->pleft && start <= ar->lleft) {
41094118 size -= ar->lleft + 1 - start;
@@ -4176,7 +4185,22 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac, · 66 unmodified lines
41764185 }
41774186 rcu_read_unlock();
41784187
4179− if (start + size <= ac->ac_o_ex.fe_logical &&
4188+ /*
4189+ * In this function "start" and "size" are normalized for better
4190+ * alignment and length such that we could preallocate more blocks.
4191+ * This normalization is done such that original request of
4192+ * ac->ac_o_ex.fe_logical & fe_len should always lie within "start" and
4193+ * "size" boundaries.
4194+ * (Note fe_len can be relaxed since FS block allocation API does not
4195+ * provide gurantee on number of contiguous blocks allocation since that
4196+ * depends upon free space left, etc).
4197+ * In case of inode pa, later we use the allocated blocks
4198+ * [pa_start + fe_logical - pa_lstart, fe_len/size] from the preallocated
4199+ * range of goal/best blocks [start, size] to put it at the
4200+ * ac_o_ex.fe_logical extent of this inode.
4201+ * (See ext4_mb_use_inode_pa() for more details)
4202+ */
4203+ if (start + size <= ac->ac_o_ex.fe_logical ||
41804204 start > ac->ac_o_ex.fe_logical) {
41814205 ext4_msg(ac->ac_sb, KERN_ERR,
41824206 "start %lu, size %lu, fe_logical %lu",
fs/ext4/migrate.c+1−1
@@ -438,7 +438,7 @@ int ext4_ext_migrate(struct inode *inode) · 437 unmodified lines
438438
439439 /*
440440 * Worst case we can touch the allocation bitmaps and a block
441− * group descriptor block. We do need need to worry about
441+ * group descriptor block. We do need to worry about
442442 * credits for modifying the quota inode.
443443 */
444444 handle = ext4_journal_start(inode, EXT4_HT_MIGRATE,
fs/ext4/namei.c+2−1
@@ -1929,7 +1929,8 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir, · 1928 unmodified lines
19291929 struct dx_hash_info *hinfo)
19301930 {
19311931 unsigned blocksize = dir->i_sb->s_blocksize;
1932− unsigned count, continued;
1932+ unsigned continued;
1933+ int count;
19331934 struct buffer_head *bh2;
19341935 ext4_lblk_t newblock;
19351936 u32 hash2;
fs/ext4/page-io.c+1−1
@@ -465,7 +465,7 @@ int ext4_bio_write_page(struct ext4_io_submit *io, · 464 unmodified lines
465465 /*
466466 * In the first loop we prepare and mark buffers to submit. We have to
467467 * mark all buffers in the page before submitting so that
468− * end_page_writeback() cannot be called from ext4_bio_end_io() when IO
468+ * end_page_writeback() cannot be called from ext4_end_bio() when IO
469469 * on the first buffer finishes and we are still working on submitting
470470 * the second buffer.
471471 */
fs/ext4/resize.c+10−0
@@ -53,6 +53,16 @@ int ext4_resize_begin(struct super_block *sb) · 52 unmodified lines
5353 if (!capable(CAP_SYS_RESOURCE))
5454 return -EPERM;
5555
56+ /*
57+ * If the reserved GDT blocks is non-zero, the resize_inode feature
58+ * should always be set.
59+ */
60+ if (EXT4_SB(sb)->s_es->s_reserved_gdt_blocks &&
61+ !ext4_has_feature_resize_inode(sb)) {
62+ ext4_error(sb, "resize_inode disabled but reserved GDT blocks non-zero");
63+ return -EFSCORRUPTED;
64+ }
65+
5666 /*
5767 * If we are not using the primary superblock/GDT copy don't resize,
5868 * because the user tools have no way of handling this. Probably a
fs/ext4/super.c+95−77
@@ -87,7 +87,7 @@ static struct inode *ext4_get_journal_inode(struct super_block *sb, · 86 unmodified lines
8787 static int ext4_validate_options(struct fs_context *fc);
8888 static int ext4_check_opt_consistency(struct fs_context *fc,
8989 struct super_block *sb);
90−static int ext4_apply_options(struct fs_context *fc, struct super_block *sb);
90+static void ext4_apply_options(struct fs_context *fc, struct super_block *sb);
9191 static int ext4_parse_param(struct fs_context *fc, struct fs_parameter *param);
9292 static int ext4_get_tree(struct fs_context *fc);
9393 static int ext4_reconfigure(struct fs_context *fc);
@@ -1870,31 +1870,12 @@ ext4_sb_read_encoding(const struct ext4_super_block *es) · 1776 unmodified lines
18701870 }
18711871 #endif
18721872
1873−static int ext4_set_test_dummy_encryption(struct super_block *sb, char *arg)
1874−{
1875−#ifdef CONFIG_FS_ENCRYPTION
1876− struct ext4_sb_info *sbi = EXT4_SB(sb);
1877− int err;
1878−
1879− err = fscrypt_set_test_dummy_encryption(sb, arg,
1880− &sbi->s_dummy_enc_policy);
1881− if (err) {
1882− ext4_msg(sb, KERN_WARNING,
1883− "Error while setting test dummy encryption [%d]", err);
1884− return err;
1885− }
1886− ext4_msg(sb, KERN_WARNING, "Test dummy encryption mode enabled");
1887−#endif
1888− return 0;
1889−}
1890−
18911873 #define EXT4_SPEC_JQUOTA (1 << 0)
18921874 #define EXT4_SPEC_JQFMT (1 << 1)
18931875 #define EXT4_SPEC_DATAJ (1 << 2)
18941876 #define EXT4_SPEC_SB_BLOCK (1 << 3)
18951877 #define EXT4_SPEC_JOURNAL_DEV (1 << 4)
18961878 #define EXT4_SPEC_JOURNAL_IOPRIO (1 << 5)
1897−#define EXT4_SPEC_DUMMY_ENCRYPTION (1 << 6)
18981879 #define EXT4_SPEC_s_want_extra_isize (1 << 7)
18991880 #define EXT4_SPEC_s_max_batch_time (1 << 8)
19001881 #define EXT4_SPEC_s_min_batch_time (1 << 9)
@@ -1911,7 +1892,7 @@ static int ext4_set_test_dummy_encryption(struct super_block *sb, char *arg) · 10 unmodified lines
19111892
19121893 struct ext4_fs_context {
19131894 char *s_qf_names[EXT4_MAXQUOTAS];
1914− char *test_dummy_enc_arg;
1895+ struct fscrypt_dummy_policy dummy_enc_policy;
19151896 int s_jquota_fmt; /* Format of quota to use */
19161897 #ifdef CONFIG_EXT4_DEBUG
19171898 int s_fc_debug_max_replay;
@@ -1953,7 +1934,7 @@ static void ext4_fc_free(struct fs_context *fc) · 35 unmodified lines
19531934 for (i = 0; i < EXT4_MAXQUOTAS; i++)
19541935 kfree(ctx->s_qf_names[i]);
19551936
1956− kfree(ctx->test_dummy_enc_arg);
1937+ fscrypt_free_dummy_policy(&ctx->dummy_enc_policy);
19571938 kfree(ctx);
19581939 }
19591940
@@ -2029,6 +2010,29 @@ static int unnote_qf_name(struct fs_context *fc, int qtype) · 69 unmodified lines
20292010 }
20302011 #endif
20312012
2013+static int ext4_parse_test_dummy_encryption(const struct fs_parameter *param,
2014+ struct ext4_fs_context *ctx)
2015+{
2016+ int err;
2017+
2018+ if (!IS_ENABLED(CONFIG_FS_ENCRYPTION)) {
2019+ ext4_msg(NULL, KERN_WARNING,
2020+ "test_dummy_encryption option not supported");
2021+ return -EINVAL;
2022+ }
2023+ err = fscrypt_parse_test_dummy_encryption(param,
2024+ &ctx->dummy_enc_policy);
2025+ if (err == -EINVAL) {
2026+ ext4_msg(NULL, KERN_WARNING,
2027+ "Value of option \"%s\" is unrecognized", param->key);
2028+ } else if (err == -EEXIST) {
2029+ ext4_msg(NULL, KERN_WARNING,
2030+ "Conflicting test_dummy_encryption options");
2031+ return -EINVAL;
2032+ }
2033+ return err;
2034+}
2035+
20322036 #define EXT4_SET_CTX(name) \
20332037 static inline void ctx_set_##name(struct ext4_fs_context *ctx, \
20342038 unsigned long flag) \
@@ -2291,29 +2295,7 @@ static int ext4_parse_param(struct fs_context *fc, struct fs_parameter *param) · 256 unmodified lines
22912295 ctx->spec |= EXT4_SPEC_JOURNAL_IOPRIO;
22922296 return 0;
22932297 case Opt_test_dummy_encryption:
2294−#ifdef CONFIG_FS_ENCRYPTION
2295− if (param->type == fs_value_is_flag) {
2296− ctx->spec |= EXT4_SPEC_DUMMY_ENCRYPTION;
2297− ctx->test_dummy_enc_arg = NULL;
2298− return 0;
2299− }
2300− if (*param->string &&
2301− !(!strcmp(param->string, "v1") ||
2302− !strcmp(param->string, "v2"))) {
2303− ext4_msg(NULL, KERN_WARNING,
2304− "Value of option \"%s\" is unrecognized",
2305− param->key);
2306− return -EINVAL;
2307− }
2308− ctx->spec |= EXT4_SPEC_DUMMY_ENCRYPTION;
2309− ctx->test_dummy_enc_arg = kmemdup_nul(param->string, param->size,
2310− GFP_KERNEL);
2311− return 0;
2312−#else
2313− ext4_msg(NULL, KERN_WARNING,
2314− "test_dummy_encryption option not supported");
2315− return -EINVAL;
2316−#endif
2298+ return ext4_parse_test_dummy_encryption(param, ctx);
23172299 case Opt_dax:
23182300 case Opt_dax_type:
23192301 #ifdef CONFIG_FS_DAX
@@ -2504,7 +2486,8 @@ parse_failed: · 184 unmodified lines
25042486 if (s_ctx->spec & EXT4_SPEC_JOURNAL_IOPRIO)
25052487 m_ctx->journal_ioprio = s_ctx->journal_ioprio;
25062488
2507− ret = ext4_apply_options(fc, sb);
2489+ ext4_apply_options(fc, sb);
2490+ ret = 0;
25082491
25092492 out_free:
25102493 if (fc) {
@@ -2673,11 +2656,11 @@ err_jquota_specified: · 162 unmodified lines
26732656 static int ext4_check_test_dummy_encryption(const struct fs_context *fc,
26742657 struct super_block *sb)
26752658 {
2676−#ifdef CONFIG_FS_ENCRYPTION
26772659 const struct ext4_fs_context *ctx = fc->fs_private;
26782660 const struct ext4_sb_info *sbi = EXT4_SB(sb);
2661+ int err;
26792662
2680− if (!(ctx->spec & EXT4_SPEC_DUMMY_ENCRYPTION))
2663+ if (!fscrypt_is_dummy_policy_set(&ctx->dummy_enc_policy))
26812664 return 0;
26822665
26832666 if (!ext4_has_feature_encrypt(sb)) {
@@ -2691,14 +2674,46 @@ static int ext4_check_test_dummy_encryption(const struct fs_context *fc, · 7 unmodified lines
26912674 * needed to allow it to be set or changed during remount. We do allow
26922675 * it to be specified during remount, but only if there is no change.
26932676 */
2694− if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE &&
2695− !sbi->s_dummy_enc_policy.policy) {
2677+ if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE) {
2678+ if (fscrypt_dummy_policies_equal(&sbi->s_dummy_enc_policy,
2679+ &ctx->dummy_enc_policy))
2680+ return 0;
26962681 ext4_msg(NULL, KERN_WARNING,
2697− "Can't set test_dummy_encryption on remount");
2682+ "Can't set or change test_dummy_encryption on remount");
26982683 return -EINVAL;
26992684 }
2700−#endif /* CONFIG_FS_ENCRYPTION */
2701− return 0;
2685+ /* Also make sure s_mount_opts didn't contain a conflicting value. */
2686+ if (fscrypt_is_dummy_policy_set(&sbi->s_dummy_enc_policy)) {
2687+ if (fscrypt_dummy_policies_equal(&sbi->s_dummy_enc_policy,
2688+ &ctx->dummy_enc_policy))
2689+ return 0;
2690+ ext4_msg(NULL, KERN_WARNING,
2691+ "Conflicting test_dummy_encryption options");
2692+ return -EINVAL;
2693+ }
2694+ /*
2695+ * fscrypt_add_test_dummy_key() technically changes the super_block, so
2696+ * technically it should be delayed until ext4_apply_options() like the
2697+ * other changes. But since we never get here for remounts (see above),
2698+ * and this is the last chance to report errors, we do it here.
2699+ */
2700+ err = fscrypt_add_test_dummy_key(sb, &ctx->dummy_enc_policy);
2701+ if (err)
2702+ ext4_msg(NULL, KERN_WARNING,
2703+ "Error adding test dummy encryption key [%d]", err);
2704+ return err;
2705+}
2706+
2707+static void ext4_apply_test_dummy_encryption(struct ext4_fs_context *ctx,
2708+ struct super_block *sb)
2709+{
2710+ if (!fscrypt_is_dummy_policy_set(&ctx->dummy_enc_policy) ||
2711+ /* if already set, it was already verified to be the same */
2712+ fscrypt_is_dummy_policy_set(&EXT4_SB(sb)->s_dummy_enc_policy))
2713+ return;
2714+ EXT4_SB(sb)->s_dummy_enc_policy = ctx->dummy_enc_policy;
2715+ memset(&ctx->dummy_enc_policy, 0, sizeof(ctx->dummy_enc_policy));
2716+ ext4_msg(sb, KERN_WARNING, "Test dummy encryption mode enabled");
27022717 }
27032718
27042719 static int ext4_check_opt_consistency(struct fs_context *fc,
@@ -2785,11 +2800,10 @@ fail_dax_change_remount: · 80 unmodified lines
27852800 return ext4_check_quota_consistency(fc, sb);
27862801 }
27872802
2788−static int ext4_apply_options(struct fs_context *fc, struct super_block *sb)
2803+static void ext4_apply_options(struct fs_context *fc, struct super_block *sb)
27892804 {
27902805 struct ext4_fs_context *ctx = fc->fs_private;
27912806 struct ext4_sb_info *sbi = fc->s_fs_info;
2792− int ret = 0;
27932807
27942808 sbi->s_mount_opt &= ~ctx->mask_s_mount_opt;
27952809 sbi->s_mount_opt |= ctx->vals_s_mount_opt;
@@ -2825,11 +2839,7 @@ static int ext4_apply_options(struct fs_context *fc, struct super_block *sb) · 29 unmodified lines
28252839 #endif
28262840
28272841 ext4_apply_quota_options(fc, sb);
2828−
2829− if (ctx->spec & EXT4_SPEC_DUMMY_ENCRYPTION)
2830− ret = ext4_set_test_dummy_encryption(sb, ctx->test_dummy_enc_arg);
2831−
2832− return ret;
2842+ ext4_apply_test_dummy_encryption(ctx, sb);
28332843 }
28342844
28352845
@@ -4552,9 +4562,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb) · 1716 unmodified lines
45524562 if (err < 0)
45534563 goto failed_mount;
45544564
4555− err = ext4_apply_options(fc, sb);
4556− if (err < 0)
4557− goto failed_mount;
4565+ ext4_apply_options(fc, sb);
45584566
45594567 #if IS_ENABLED(CONFIG_UNICODE)
45604568 if (ext4_has_feature_casefold(sb) && !sb->s_encoding) {
@@ -5302,14 +5310,6 @@ no_journal: · 741 unmodified lines
53025310 err = percpu_counter_init(&sbi->s_freeinodes_counter, freei,
53035311 GFP_KERNEL);
53045312 }
5305− /*
5306− * Update the checksum after updating free space/inode
5307− * counters. Otherwise the superblock can have an incorrect
5308− * checksum in the buffer cache until it is written out and
5309− * e2fsprogs programs trying to open a file system immediately
5310− * after it is mounted can fail.
5311− */
5312− ext4_superblock_csum_set(sb);
53135313 if (!err)
53145314 err = percpu_counter_init(&sbi->s_dirs_counter,
53155315 ext4_count_dirs(sb), GFP_KERNEL);
@@ -5367,6 +5367,14 @@ no_journal: · 51 unmodified lines
53675367 EXT4_SB(sb)->s_mount_state |= EXT4_ORPHAN_FS;
53685368 ext4_orphan_cleanup(sb, es);
53695369 EXT4_SB(sb)->s_mount_state &= ~EXT4_ORPHAN_FS;
5370+ /*
5371+ * Update the checksum after updating free space/inode counters and
5372+ * ext4_orphan_cleanup. Otherwise the superblock can have an incorrect
5373+ * checksum in the buffer cache until it is written out and
5374+ * e2fsprogs programs trying to open a file system immediately
5375+ * after it is mounted can fail.
5376+ */
5377+ ext4_superblock_csum_set(sb);
53705378 if (needs_recovery) {
53715379 ext4_msg(sb, KERN_INFO, "recovery complete");
53725380 err = ext4_mark_recovery_complete(sb, es);
@@ -5898,7 +5906,6 @@ static void ext4_update_super(struct super_block *sb) · 525 unmodified lines
58985906 static int ext4_commit_super(struct super_block *sb)
58995907 {
59005908 struct buffer_head *sbh = EXT4_SB(sb)->s_sbh;
5901− int error = 0;
59025909
59035910 if (!sbh)
59045911 return -EINVAL;
@@ -5907,6 +5914,13 @@ static int ext4_commit_super(struct super_block *sb) · 2 unmodified lines
59075914
59085915 ext4_update_super(sb);
59095916
5917+ lock_buffer(sbh);
5918+ /* Buffer got discarded which means block device got invalidated */
5919+ if (!buffer_mapped(sbh)) {
5920+ unlock_buffer(sbh);
5921+ return -EIO;
5922+ }
5923+
59105924 if (buffer_write_io_error(sbh) || !buffer_uptodate(sbh)) {
59115925 /*
59125926 * Oh, dear. A previous attempt to write the
@@ -5921,17 +5935,21 @@ static int ext4_commit_super(struct super_block *sb) · 8 unmodified lines
59215935 clear_buffer_write_io_error(sbh);
59225936 set_buffer_uptodate(sbh);
59235937 }
5924− BUFFER_TRACE(sbh, "marking dirty");
5925− mark_buffer_dirty(sbh);
5926− error = __sync_dirty_buffer(sbh,
5927− REQ_SYNC | (test_opt(sb, BARRIER) ? REQ_FUA : 0));
5938+ get_bh(sbh);
5939+ /* Clear potential dirty bit if it was journalled update */
5940+ clear_buffer_dirty(sbh);
5941+ sbh->b_end_io = end_buffer_write_sync;
5942+ submit_bh(REQ_OP_WRITE,
5943+ REQ_SYNC | (test_opt(sb, BARRIER) ? REQ_FUA : 0), sbh);
5944+ wait_on_buffer(sbh);
59285945 if (buffer_write_io_error(sbh)) {
59295946 ext4_msg(sb, KERN_ERR, "I/O error while writing "
59305947 "superblock");
59315948 clear_buffer_write_io_error(sbh);
59325949 set_buffer_uptodate(sbh);
5950+ return -EIO;
59335951 }
5934− return error;
5952+ return 0;
59355953 }
59365954
59375955 /*
fs/ext4/xattr.c+1−2
@@ -1895,11 +1895,10 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, · 1894 unmodified lines
18951895
18961896 unlock_buffer(bs->bh);
18971897 ea_bdebug(bs->bh, "cloning");
1898− s->base = kmalloc(bs->bh->b_size, GFP_NOFS);
1898+ s->base = kmemdup(BHDR(bs->bh), bs->bh->b_size, GFP_NOFS);
18991899 error = -ENOMEM;
19001900 if (s->base == NULL)
19011901 goto cleanup;
1902− memcpy(s->base, BHDR(bs->bh), bs->bh->b_size);
19031902 s->first = ENTRY(header(s->base)+1);
19041903 header(s->base)->h_refcount = cpu_to_le32(1);
19051904 s->here = ENTRY(s->base + offset);
fs/f2fs/iostat.c+18−13
@@ -91,8 +91,9 @@ static inline void __record_iostat_latency(struct f2fs_sb_info *sbi) · 90 unmodified lines
9191 unsigned int cnt;
9292 struct f2fs_iostat_latency iostat_lat[MAX_IO_TYPE][NR_PAGE_TYPE];
9393 struct iostat_lat_info *io_lat = sbi->iostat_io_lat;
94+ unsigned long flags;
9495
95− spin_lock_bh(&sbi->iostat_lat_lock);
96+ spin_lock_irqsave(&sbi->iostat_lat_lock, flags);
9697 for (idx = 0; idx < MAX_IO_TYPE; idx++) {
9798 for (io = 0; io < NR_PAGE_TYPE; io++) {
9899 cnt = io_lat->bio_cnt[idx][io];
@@ -106,7 +107,7 @@ static inline void __record_iostat_latency(struct f2fs_sb_info *sbi) · 7 unmodified lines
106107 io_lat->bio_cnt[idx][io] = 0;
107108 }
108109 }
109− spin_unlock_bh(&sbi->iostat_lat_lock);
110+ spin_unlock_irqrestore(&sbi->iostat_lat_lock, flags);
110111
111112 trace_f2fs_iostat_latency(sbi, iostat_lat);
112113 }
@@ -115,14 +116,15 @@ static inline void f2fs_record_iostat(struct f2fs_sb_info *sbi) · 2 unmodified lines
115116 {
116117 unsigned long long iostat_diff[NR_IO_TYPE];
117118 int i;
119+ unsigned long flags;
118120
119121 if (time_is_after_jiffies(sbi->iostat_next_period))
120122 return;
121123
122124 /* Need double check under the lock */
123− spin_lock_bh(&sbi->iostat_lock);
125+ spin_lock_irqsave(&sbi->iostat_lock, flags);
124126 if (time_is_after_jiffies(sbi->iostat_next_period)) {
125− spin_unlock_bh(&sbi->iostat_lock);
127+ spin_unlock_irqrestore(&sbi->iostat_lock, flags);
126128 return;
127129 }
128130 sbi->iostat_next_period = jiffies +
@@ -133,7 +135,7 @@ static inline void f2fs_record_iostat(struct f2fs_sb_info *sbi) · 4 unmodified lines
133135 sbi->prev_rw_iostat[i];
134136 sbi->prev_rw_iostat[i] = sbi->rw_iostat[i];
135137 }
136− spin_unlock_bh(&sbi->iostat_lock);
138+ spin_unlock_irqrestore(&sbi->iostat_lock, flags);
137139
138140 trace_f2fs_iostat(sbi, iostat_diff);
139141
@@ -145,25 +147,27 @@ void f2fs_reset_iostat(struct f2fs_sb_info *sbi) · 5 unmodified lines
145147 struct iostat_lat_info *io_lat = sbi->iostat_io_lat;
146148 int i;
147149
148− spin_lock_bh(&sbi->iostat_lock);
150+ spin_lock_irq(&sbi->iostat_lock);
149151 for (i = 0; i < NR_IO_TYPE; i++) {
150152 sbi->rw_iostat[i] = 0;
151153 sbi->prev_rw_iostat[i] = 0;
152154 }
153− spin_unlock_bh(&sbi->iostat_lock);
155+ spin_unlock_irq(&sbi->iostat_lock);
154156
155− spin_lock_bh(&sbi->iostat_lat_lock);
157+ spin_lock_irq(&sbi->iostat_lat_lock);
156158 memset(io_lat, 0, sizeof(struct iostat_lat_info));
157− spin_unlock_bh(&sbi->iostat_lat_lock);
159+ spin_unlock_irq(&sbi->iostat_lat_lock);
158160 }
159161
160162 void f2fs_update_iostat(struct f2fs_sb_info *sbi,
161163 enum iostat_type type, unsigned long long io_bytes)
162164 {
165+ unsigned long flags;
166+
163167 if (!sbi->iostat_enable)
164168 return;
165169
166− spin_lock_bh(&sbi->iostat_lock);
170+ spin_lock_irqsave(&sbi->iostat_lock, flags);
167171 sbi->rw_iostat[type] += io_bytes;
168172
169173 if (type == APP_BUFFERED_IO || type == APP_DIRECT_IO)
@@ -172,7 +176,7 @@ void f2fs_update_iostat(struct f2fs_sb_info *sbi, · 2 unmodified lines
172176 if (type == APP_BUFFERED_READ_IO || type == APP_DIRECT_READ_IO)
173177 sbi->rw_iostat[APP_READ_IO] += io_bytes;
174178
175− spin_unlock_bh(&sbi->iostat_lock);
179+ spin_unlock_irqrestore(&sbi->iostat_lock, flags);
176180
177181 f2fs_record_iostat(sbi);
178182 }
@@ -185,6 +189,7 @@ static inline void __update_iostat_latency(struct bio_iostat_ctx *iostat_ctx, · 6 unmodified lines
185189 struct f2fs_sb_info *sbi = iostat_ctx->sbi;
186190 struct iostat_lat_info *io_lat = sbi->iostat_io_lat;
187191 int idx;
192+ unsigned long flags;
188193
189194 if (!sbi->iostat_enable)
190195 return;
@@ -202,12 +207,12 @@ static inline void __update_iostat_latency(struct bio_iostat_ctx *iostat_ctx, · 11 unmodified lines
202207 idx = WRITE_ASYNC_IO;
203208 }
204209
205− spin_lock_bh(&sbi->iostat_lat_lock);
210+ spin_lock_irqsave(&sbi->iostat_lat_lock, flags);
206211 io_lat->sum_lat[idx][iotype] += ts_diff;
207212 io_lat->bio_cnt[idx][iotype]++;
208213 if (ts_diff > io_lat->peak_lat[idx][iotype])
209214 io_lat->peak_lat[idx][iotype] = ts_diff;
210− spin_unlock_bh(&sbi->iostat_lat_lock);
215+ spin_unlock_irqrestore(&sbi->iostat_lat_lock, flags);
211216 }
212217
213218 void iostat_update_and_unbind_ctx(struct bio *bio, int rw)
fs/f2fs/namei.c+11−6
@@ -89,8 +89,6 @@ static struct inode *f2fs_new_inode(struct user_namespace *mnt_userns, · 88 unmodified lines
8989 if (test_opt(sbi, INLINE_XATTR))
9090 set_inode_flag(inode, FI_INLINE_XATTR);
9191
92− if (test_opt(sbi, INLINE_DATA) && f2fs_may_inline_data(inode))
93− set_inode_flag(inode, FI_INLINE_DATA);
9492 if (f2fs_may_inline_dentry(inode))
9593 set_inode_flag(inode, FI_INLINE_DENTRY);
9694
@@ -107,10 +105,6 @@ static struct inode *f2fs_new_inode(struct user_namespace *mnt_userns, · 10 unmodified lines
107105
108106 f2fs_init_extent_tree(inode, NULL);
109107
110− stat_inc_inline_xattr(inode);
111− stat_inc_inline_inode(inode);
112− stat_inc_inline_dir(inode);
113−
114108 F2FS_I(inode)->i_flags =
115109 f2fs_mask_flags(mode, F2FS_I(dir)->i_flags & F2FS_FL_INHERITED);
116110
@@ -127,6 +121,14 @@ static struct inode *f2fs_new_inode(struct user_namespace *mnt_userns, · 10 unmodified lines
127121 set_compress_context(inode);
128122 }
129123
124+ /* Should enable inline_data after compression set */
125+ if (test_opt(sbi, INLINE_DATA) && f2fs_may_inline_data(inode))
126+ set_inode_flag(inode, FI_INLINE_DATA);
127+
128+ stat_inc_inline_xattr(inode);
129+ stat_inc_inline_inode(inode);
130+ stat_inc_inline_dir(inode);
131+
130132 f2fs_set_inode_flags(inode);
131133
132134 trace_f2fs_new_inode(inode, 0);
@@ -325,6 +327,9 @@ static void set_compress_inode(struct f2fs_sb_info *sbi, struct inode *inode, · 192 unmodified lines
325327 if (!is_extension_exist(name, ext[i], false))
326328 continue;
327329
330+ /* Do not use inline_data with compression */
331+ stat_dec_inline_inode(inode);
332+ clear_inode_flag(inode, FI_INLINE_DATA);
328333 set_compress_context(inode);
329334 return;
330335 }
fs/f2fs/node.c+3−1
@@ -1450,7 +1450,9 @@ page_hit: · 1449 unmodified lines
14501450 out_err:
14511451 ClearPageUptodate(page);
14521452 out_put_err:
1453− f2fs_handle_page_eio(sbi, page->index, NODE);
1453+ /* ENOENT comes from read_node_page which is not an error. */
1454+ if (err != -ENOENT)
1455+ f2fs_handle_page_eio(sbi, page->index, NODE);
14541456 f2fs_put_page(page, 1);
14551457 return ERR_PTR(err);
14561458 }
fs/hugetlbfs/inode.c+53−15
@@ -600,41 +600,79 @@ static void hugetlb_vmtruncate(struct inode *inode, loff_t offset) · 599 unmodified lines
600600 remove_inode_hugepages(inode, offset, LLONG_MAX);
601601 }
602602
603+static void hugetlbfs_zero_partial_page(struct hstate *h,
604+ struct address_space *mapping,
605+ loff_t start,
606+ loff_t end)
607+{
608+ pgoff_t idx = start >> huge_page_shift(h);
609+ struct folio *folio;
610+
611+ folio = filemap_lock_folio(mapping, idx);
612+ if (!folio)
613+ return;
614+
615+ start = start & ~huge_page_mask(h);
616+ end = end & ~huge_page_mask(h);
617+ if (!end)
618+ end = huge_page_size(h);
619+
620+ folio_zero_segment(folio, (size_t)start, (size_t)end);
621+
622+ folio_unlock(folio);
623+ folio_put(folio);
624+}
625+
603626 static long hugetlbfs_punch_hole(struct inode *inode, loff_t offset, loff_t len)
604627 {
628+ struct hugetlbfs_inode_info *info = HUGETLBFS_I(inode);
629+ struct address_space *mapping = inode->i_mapping;
605630 struct hstate *h = hstate_inode(inode);
606631 loff_t hpage_size = huge_page_size(h);
607632 loff_t hole_start, hole_end;
608633
609634 /*
610− * For hole punch round up the beginning offset of the hole and
611− * round down the end.
635+ * hole_start and hole_end indicate the full pages within the hole.
612636 */
613637 hole_start = round_up(offset, hpage_size);
614638 hole_end = round_down(offset + len, hpage_size);
615639
616− if (hole_end > hole_start) {
617− struct address_space *mapping = inode->i_mapping;
618− struct hugetlbfs_inode_info *info = HUGETLBFS_I(inode);
640+ inode_lock(inode);
619641
620− inode_lock(inode);
642+ /* protected by i_rwsem */
643+ if (info->seals & (F_SEAL_WRITE | F_SEAL_FUTURE_WRITE)) {
644+ inode_unlock(inode);
645+ return -EPERM;

42 more lines aren’t shown here.

fs/io_uring.c+157−216

This diff is large: its 734 lines aren’t shown here.

fs/jbd2/transaction.c+1−1

This diff is large: its 9 lines aren’t shown here.

fs/nfs/callback_proc.c+1−0

This diff is large: its 8 lines aren’t shown here.

fs/nfs/dir.c+1−0

This diff is large: its 8 lines aren’t shown here.

fs/nfs/nfs4file.c+1−0

This diff is large: its 8 lines aren’t shown here.

fs/nfs/pnfs.c+15−6

This diff is large: its 58 lines aren’t shown here.

fs/nfs/pnfs.h+1−0

This diff is large: its 8 lines aren’t shown here.

fs/tracefs/inode.c+1−1

This diff is large: its 9 lines aren’t shown here.

fs/xfs/libxfs/xfs_attr.c+5−4

This diff is large: its 28 lines aren’t shown here.

fs/xfs/libxfs/xfs_attr.h+1−11

This diff is large: its 26 lines aren’t shown here.

fs/xfs/libxfs/xfs_attr_leaf.c+1−1

This diff is large: its 9 lines aren’t shown here.

fs/xfs/libxfs/xfs_da_btree.h+3−1

This diff is large: its 18 lines aren’t shown here.

fs/xfs/xfs_attr_item.c+9−6

This diff is large: its 45 lines aren’t shown here.

fs/xfs/xfs_ioctl.c+2−1

This diff is large: its 10 lines aren’t shown here.

fs/xfs/xfs_xattr.c+16−1

This diff is large: its 35 lines aren’t shown here.

include/drm/drm_atomic.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/drm/ttm/ttm_resource.h+4−4

This diff is large: its 17 lines aren’t shown here.

include/keys/asymmetric-type.h+3−0

This diff is large: its 10 lines aren’t shown here.

include/linux/backing-dev.h+2−0

This diff is large: its 9 lines aren’t shown here.

include/linux/blkdev.h+6−7

This diff is large: its 57 lines aren’t shown here.

include/linux/console.h+0−17

This diff is large: its 31 lines aren’t shown here.

include/linux/cpu.h+3−0

This diff is large: its 10 lines aren’t shown here.

include/linux/gpio/driver.h+16−13

This diff is large: its 38 lines aren’t shown here.

include/linux/mm.h+2−1

This diff is large: its 17 lines aren’t shown here.

include/linux/netfs.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/linux/nvme.h+2−2

This diff is large: its 11 lines aren’t shown here.

include/linux/objtool.h+6−0

This diff is large: its 13 lines aren’t shown here.

include/linux/printk.h+0−11

This diff is large: its 25 lines aren’t shown here.

include/linux/ratelimit_types.h+8−4

This diff is large: its 21 lines aren’t shown here.

include/linux/scmi_protocol.h+5−4

This diff is large: its 23 lines aren’t shown here.

include/linux/serial_core.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/linux/visorbus.h+0−344

This diff is large: its 345 lines aren’t shown here.

include/linux/vmalloc.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/net/inet_connection_sock.h+0−3

This diff is large: its 24 lines aren’t shown here.

include/net/inet_hashtables.h+1−67

This diff is large: its 108 lines aren’t shown here.

include/net/inet_sock.h+5−0

This diff is large: its 12 lines aren’t shown here.

include/net/sock.h+0−14

This diff is large: its 42 lines aren’t shown here.

include/trace/events/io_uring.h+35−7

This diff is large: its 171 lines aren’t shown here.

include/trace/events/libata.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/uapi/linux/io_uring.h+0−6

This diff is large: its 20 lines aren’t shown here.

kernel/auditsc.c+1−1

This diff is large: its 12 lines aren’t shown here.

kernel/bpf/btf.c+5−0

This diff is large: its 19 lines aren’t shown here.

kernel/cfi.c+16−6

This diff is large: its 37 lines aren’t shown here.

kernel/dma/direct.c+2−3

This diff is large: its 26 lines aren’t shown here.

kernel/hung_task.c+1−10

This diff is large: its 37 lines aren’t shown here.

kernel/irq/chip.c+4−1

This diff is large: its 20 lines aren’t shown here.

kernel/kthread.c+7−7

This diff is large: its 49 lines aren’t shown here.

kernel/locking/lockdep.c+1−1

This diff is large: its 9 lines aren’t shown here.

kernel/panic.c+0−4

This diff is large: its 18 lines aren’t shown here.

kernel/power/hibernate.c+1−1

This diff is large: its 9 lines aren’t shown here.

kernel/printk/printk.c+63−524

This diff is large: its 830 lines aren’t shown here.

kernel/rcu/tree_stall.h+0−2

This diff is large: its 16 lines aren’t shown here.

kernel/reboot.c+1−13

This diff is large: its 70 lines aren’t shown here.

kernel/sched/core.c+33−3

This diff is large: its 59 lines aren’t shown here.

kernel/sched/sched.h+5−0

This diff is large: its 12 lines aren’t shown here.

kernel/trace/blktrace.c+0−3

This diff is large: its 15 lines aren’t shown here.

kernel/trace/bpf_trace.c+45−15

This diff is large: its 99 lines aren’t shown here.

kernel/trace/ftrace.c+11−2

This diff is large: its 34 lines aren’t shown here.

kernel/trace/rethook.c+9−0

This diff is large: its 16 lines aren’t shown here.

kernel/trace/trace.c+0−2

This diff is large: its 10 lines aren’t shown here.

kernel/trace/trace_kprobe.c+10−1

This diff is large: its 19 lines aren’t shown here.

kernel/trace/trace_uprobe.c+0−1

This diff is large: its 8 lines aren’t shown here.

kernel/watchdog.c+0−4

This diff is large: its 18 lines aren’t shown here.

kernel/watchdog_hld.c+0−4

This diff is large: its 18 lines aren’t shown here.

lib/Kconfig+3−0

This diff is large: its 10 lines aren’t shown here.

lib/Kconfig.ubsan+1−1

This diff is large: its 9 lines aren’t shown here.

lib/Makefile+1−0

This diff is large: its 8 lines aren’t shown here.

lib/crypto/Kconfig+1−0

This diff is large: its 8 lines aren’t shown here.

lib/memneq.crenamed from crypto/memneq.c+0−0

File renamed without changes.

mm/backing-dev.c+2−9

This diff is large: its 31 lines aren’t shown here.

mm/damon/reclaim.c+8−0

This diff is large: its 29 lines aren’t shown here.

mm/filemap.c+12−3

This diff is large: its 38 lines aren’t shown here.

mm/huge_memory.c+1−0

This diff is large: its 8 lines aren’t shown here.

mm/hwpoison-inject.c+1−1

This diff is large: its 9 lines aren’t shown here.

mm/kfence/core.c+5−2

This diff is large: its 28 lines aren’t shown here.

mm/madvise.c+1−1

This diff is large: its 9 lines aren’t shown here.

mm/memcontrol.c+1−1

This diff is large: its 9 lines aren’t shown here.

mm/memory-failure.c+12−0

This diff is large: its 33 lines aren’t shown here.

mm/migrate.c+1−0

This diff is large: its 8 lines aren’t shown here.

mm/page_isolation.c+2−0

This diff is large: its 9 lines aren’t shown here.

mm/readahead.c+2−0

This diff is large: its 16 lines aren’t shown here.

mm/slub.c+36−7

This diff is large: its 91 lines aren’t shown here.

mm/swap.c+1−1

This diff is large: its 9 lines aren’t shown here.

mm/usercopy.c+12−14

This diff is large: its 51 lines aren’t shown here.

mm/vmalloc.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/ax25/af_ax25.c+28−5

This diff is large: its 56 lines aren’t shown here.

net/core/dev.c+15−10

This diff is large: its 70 lines aren’t shown here.

net/core/filter.c+28−6

This diff is large: its 50 lines aren’t shown here.

net/core/net-sysfs.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/core/skmsg.c+5−0

This diff is large: its 12 lines aren’t shown here.

net/dccp/proto.c+5−28

This diff is large: its 89 lines aren’t shown here.

net/ethtool/eeprom.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/ipv4/inet_connection_sock.c+64−183

This diff is large: its 345 lines aren’t shown here.

net/ipv4/inet_hashtables.c+11−182

This diff is large: its 313 lines aren’t shown here.

net/ipv4/ip_gre.c+10−5

This diff is large: its 29 lines aren’t shown here.

net/ipv4/ping.c+7−3

This diff is large: its 20 lines aren’t shown here.

net/ipv4/tcp.c+2−12

This diff is large: its 38 lines aren’t shown here.

net/ipv4/tcp_bpf.c+0−3

This diff is large: its 10 lines aren’t shown here.

net/ipv6/ip6_gre.c+10−5

This diff is large: its 29 lines aren’t shown here.

net/netfilter/nf_dup_netdev.c+21−4

This diff is large: its 52 lines aren’t shown here.

net/netfilter/nfnetlink_cttimeout.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/netfilter/nft_meta.c+2−11

This diff is large: its 48 lines aren’t shown here.

net/netfilter/nft_numgen.c+3−9

This diff is large: its 38 lines aren’t shown here.

net/openvswitch/flow.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/sched/sch_netem.c+2−2

This diff is large: its 12 lines aren’t shown here.

net/sunrpc/clnt.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/tipc/core.c+1−2

This diff is large: its 12 lines aren’t shown here.

net/tls/tls_main.c+2−0

This diff is large: its 9 lines aren’t shown here.

net/xdp/xsk.c+9−7

This diff is large: its 34 lines aren’t shown here.

samples/fprobe/fprobe_example.c+25−4

This diff is large: its 64 lines aren’t shown here.

scripts/faddr2line+34−11

This diff is large: its 102 lines aren’t shown here.

scripts/gen_autoksyms.sh+3−0

This diff is large: its 8 lines aren’t shown here.

scripts/mod/modpost.c+1−1

This diff is large: its 9 lines aren’t shown here.

security/selinux/hooks.c+4−7

This diff is large: its 31 lines aren’t shown here.

sound/core/memalloc.c+1−22

This diff is large: its 54 lines aren’t shown here.

sound/hda/hdac_i915.c+6−9

This diff is large: its 28 lines aren’t shown here.

sound/hda/intel-dsp-config.c+12−0

This diff is large: its 26 lines aren’t shown here.

sound/hda/intel-nhlt.c+8−9

This diff is large: its 45 lines aren’t shown here.

sound/pci/hda/hda_auto_parser.c+4−3

This diff is large: its 35 lines aren’t shown here.

sound/pci/hda/hda_local.h+1−0

This diff is large: its 8 lines aren’t shown here.

sound/pci/hda/patch_conexant.c+2−2

This diff is large: its 14 lines aren’t shown here.

sound/pci/hda/patch_realtek.c+35−1

This diff is large: its 106 lines aren’t shown here.

sound/pci/hda/patch_via.c+2−2

This diff is large: its 14 lines aren’t shown here.

sound/usb/mixer_us16x08.c+3−3

This diff is large: its 14 lines aren’t shown here.

sound/x86/intel_hdmi_audio.c+13−2

This diff is large: its 46 lines aren’t shown here.

tools/arch/arm64/include/asm/cputype.h+10−2

This diff is large: its 40 lines aren’t shown here.

tools/arch/x86/include/asm/cpufeatures.h+6−2

This diff is large: its 49 lines aren’t shown here.

tools/arch/x86/include/asm/disabled-features.h+7−1

This diff is large: its 22 lines aren’t shown here.

tools/arch/x86/include/asm/msr-index.h+25−0

This diff is large: its 39 lines aren’t shown here.

tools/arch/x86/include/uapi/asm/kvm.h+6−5

This diff is large: its 18 lines aren’t shown here.

tools/arch/x86/include/uapi/asm/svm.h+13−0

This diff is large: its 27 lines aren’t shown here.

tools/include/linux/objtool.h+6−0

This diff is large: its 13 lines aren’t shown here.

tools/include/uapi/drm/i915_drm.h+272−81

This diff is large: its 489 lines aren’t shown here.

tools/include/uapi/linux/prctl.h+9−0

This diff is large: its 16 lines aren’t shown here.

tools/include/uapi/linux/vhost.h+20−6

This diff is large: its 44 lines aren’t shown here.

tools/kvm/kvm_stat/kvm_stat+2−1

This diff is large: its 10 lines aren’t shown here.

tools/lib/perf/evsel.c+12−5

This diff is large: its 36 lines aren’t shown here.

tools/perf/builtin-inject.c+4−2

This diff is large: its 20 lines aren’t shown here.

tools/perf/builtin-stat.c+2−0

This diff is large: its 9 lines aren’t shown here.

tools/perf/tests/bp_account.c+14−2

This diff is large: its 36 lines aren’t shown here.

tools/perf/tests/expr.c+2−0

This diff is large: its 9 lines aren’t shown here.

tools/perf/tests/shell/lib/perf_csv_output_lint.py+0−48

This diff is large: its 49 lines aren’t shown here.

tools/perf/tests/shell/stat+csv_output.sh+45−24

This diff is large: its 145 lines aren’t shown here.

tools/perf/tests/shell/test_arm_callgraph_fp.sh+1−1

This diff is large: its 9 lines aren’t shown here.

tools/perf/tests/topology.c+1−1

This diff is large: its 9 lines aren’t shown here.

tools/perf/trace/beauty/arch_errno_names.sh+2−12

This diff is large: its 26 lines aren’t shown here.

tools/perf/trace/beauty/include/linux/socket.h+6−1

This diff is large: its 29 lines aren’t shown here.

tools/perf/util/arm-spe.c+8−14

This diff is large: its 43 lines aren’t shown here.

tools/perf/util/build-id.c+28−0

This diff is large: its 42 lines aren’t shown here.

tools/perf/util/expr.l+1−1

This diff is large: its 9 lines aren’t shown here.

tools/perf/util/header.c+14−0

This diff is large: its 21 lines aren’t shown here.

tools/perf/util/header.h+2−0

This diff is large: its 9 lines aren’t shown here.

tools/perf/util/metricgroup.c+9−0

This diff is large: its 25 lines aren’t shown here.

tools/perf/util/unwind-libunwind-local.c+1−1

This diff is large: its 9 lines aren’t shown here.

tools/testing/selftests/bpf/prog_tests/bpf_cookie.c+39−39

This diff is large: its 122 lines aren’t shown here.

tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c+3−0

This diff is large: its 10 lines aren’t shown here.

tools/testing/selftests/bpf/prog_tests/tailcalls.c+55−0

This diff is large: its 67 lines aren’t shown here.

tools/testing/selftests/bpf/progs/kprobe_multi.c+12−12

This diff is large: its 34 lines aren’t shown here.

tools/testing/selftests/bpf/progs/tailcall_bpf2bpf6.c+42−0

This diff is large: its 43 lines aren’t shown here.

tools/testing/selftests/dma/Makefile+1−0

This diff is large: its 7 lines aren’t shown here.

tools/testing/selftests/dma/dma_map_benchmark.c+1−1

This diff is large: its 10 lines aren’t shown here.

tools/testing/selftests/kvm/Makefile+36−13

This diff is large: its 75 lines aren’t shown here.

tools/testing/selftests/kvm/dirty_log_perf_test.c+7−3

This diff is large: its 38 lines aren’t shown here.

tools/testing/selftests/kvm/include/perf_test_util.h+9−0

This diff is large: its 26 lines aren’t shown here.

tools/testing/selftests/kvm/include/x86_64/processor.h+16−9

This diff is large: its 40 lines aren’t shown here.

tools/testing/selftests/kvm/include/x86_64/vmx.h+6−0

This diff is large: its 27 lines aren’t shown here.

tools/testing/selftests/kvm/lib/aarch64/ucall.c+4−5

This diff is large: its 25 lines aren’t shown here.

tools/testing/selftests/kvm/lib/perf_test_util.c+45−8

This diff is large: its 111 lines aren’t shown here.

tools/testing/selftests/kvm/lib/x86_64/perf_test_util.c+112−0

This diff is large: its 113 lines aren’t shown here.

tools/testing/selftests/kvm/lib/x86_64/processor.c+15−16

This diff is large: its 88 lines aren’t shown here.

tools/testing/selftests/kvm/lib/x86_64/vmx.c+93−56

This diff is large: its 227 lines aren’t shown here.

tools/testing/selftests/kvm/max_guest_memory_test.c+1−1

This diff is large: its 9 lines aren’t shown here.

tools/testing/selftests/kvm/x86_64/mmu_role_test.c+1−1

This diff is large: its 9 lines aren’t shown here.

tools/testing/selftests/lib.mk+23−2

This diff is large: its 34 lines aren’t shown here.

tools/testing/selftests/net/.gitignore+0−1

This diff is large: its 5 lines aren’t shown here.

tools/testing/selftests/net/Makefile+0−2

This diff is large: its 14 lines aren’t shown here.

tools/testing/selftests/net/bind_bhash_test.c+0−119

This diff is large: its 120 lines aren’t shown here.

tools/testing/selftests/net/fcnal-test.sh+56−5

This diff is large: its 108 lines aren’t shown here.

tools/testing/selftests/netfilter/nft_concat_range.sh+1−1

This diff is large: its 9 lines aren’t shown here.

tools/testing/selftests/vm/gup_test.c+2−2

This diff is large: its 18 lines aren’t shown here.

tools/testing/selftests/vm/ksm_tests.c+2−0

This diff is large: its 16 lines aren’t shown here.

virt/kvm/kvm_main.c+6−2

This diff is large: its 26 lines aren’t shown here.

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