History

Merge branch 'linus' into perf/core, to pick up fixes

Ingo Molnar committed 9 years ago

Commit 2b95bd72 parents ffa86c2 69eea5a586 files · +7737 −3452Browse files

Unified · Split

586 files
  1. Documentation/admin-guide/kernel-parameters.txt +9 −0
  2. Documentation/arm64/silicon-errata.txt +1 −0
  3. Documentation/cgroup-v2.txt +6 −5
  4. Documentation/dev-tools/kcov.rst +1 −1
  5. Documentation/devicetree/bindings/powerpc/4xx/emac.txt +60 −2
  6. Documentation/devicetree/bindings/regulator/ti-abb-regulator.txt +1 −1
  7. Documentation/devicetree/bindings/usb/usb251xb.txt +18 −35
  8. Documentation/networking/ip-sysctl.txt +2 −1
  9. Documentation/virtual/kvm/api.txt +4 −0
  10. Documentation/vm/userfaultfd.txt +0 −4
  11. MAINTAINERS +0 −1
  12. Makefile +1 −1
  13. arch/arc/include/asm/hugepage.h +1 −0
  14. arch/arc/include/asm/pgtable.h +1 −0
  15. arch/arm/include/asm/kvm_arm.h +1 −0
  16. arch/arm/include/asm/kvm_host.h +0 −1
  17. arch/arm/include/asm/pgtable.h +1 −0
  18. arch/arm/kvm/arm.c +3 −0
  19. arch/arm/kvm/handle_exit.c +12 −7
  20. arch/arm/xen/mm.c +2 −0
  21. arch/arm64/Kconfig +10 −0
  22. arch/arm64/include/asm/kvm_host.h +1 −2
  23. arch/arm64/include/asm/pgtable-types.h +4 −0
  24. arch/arm64/kvm/handle_exit.c +12 −7
  25. arch/arm64/kvm/hyp/tlb.c +55 −9
  26. arch/avr32/include/asm/pgtable-2level.h +1 −0
  27. arch/avr32/oprofile/backtrace.c +1 −1
  28. arch/cris/arch-v32/drivers/cryptocop.c +1 −1
  29. arch/cris/include/asm/pgtable.h +1 −0
  30. arch/frv/include/asm/pgtable.h +1 −0
  31. arch/h8300/include/asm/pgtable.h +1 −0
  32. arch/h8300/kernel/ptrace_h.c +1 −1
  33. arch/hexagon/include/asm/pgtable.h +1 −0
  34. arch/ia64/include/asm/pgtable.h +2 −0
  35. arch/metag/include/asm/pgtable.h +1 −0
  36. arch/microblaze/include/asm/page.h +2 −1
  37. arch/mips/cavium-octeon/cpu.c +2 −0
  38. arch/mips/cavium-octeon/crypto/octeon-crypto.c +1 −0
  39. arch/mips/cavium-octeon/smp.c +1 −0
  40. arch/mips/include/asm/fpu.h +1 −0
  41. arch/mips/include/asm/pgtable-32.h +1 −0
  42. arch/mips/include/asm/pgtable-64.h +1 −0
  43. arch/mips/kernel/smp-bmips.c +1 −0
  44. arch/mips/kernel/smp-mt.c +1 −0
  45. arch/mips/loongson64/loongson-3/cop2-ex.c +1 −0
  46. arch/mips/netlogic/common/smp.c +1 −0
  47. arch/mips/netlogic/xlp/cop2-ex.c +3 −0
  48. arch/mips/sgi-ip22/ip28-berr.c +1 −0
  49. arch/mips/sgi-ip27/ip27-berr.c +2 −0
  50. arch/mips/sgi-ip27/ip27-smp.c +3 −0
  51. arch/mips/sgi-ip32/ip32-berr.c +1 −0
  52. arch/mips/sgi-ip32/ip32-reset.c +1 −0
  53. arch/mn10300/include/asm/page.h +1 −0
  54. arch/nios2/include/asm/pgtable.h +1 −0
  55. arch/openrisc/include/asm/pgtable.h +1 −0
  56. arch/powerpc/Kconfig +72 −66
  57. arch/powerpc/Makefile +10 −1
  58. arch/powerpc/boot/zImage.lds.S +1 −0
  59. arch/powerpc/crypto/crc32c-vpmsum_glue.c +1 −1
  60. arch/powerpc/include/asm/bitops.h +4 −0
  61. arch/powerpc/include/asm/book3s/32/pgtable.h +1 −0
  62. arch/powerpc/include/asm/book3s/64/pgtable.h +58 −30
  63. arch/powerpc/include/asm/checksum.h +1 −1
  64. arch/powerpc/include/asm/cpuidle.h +2 −2
  65. arch/powerpc/include/asm/elf.h +2 −2
  66. arch/powerpc/include/asm/mce.h +107 −1
  67. arch/powerpc/include/asm/nohash/32/pgtable.h +1 −0
  68. arch/powerpc/include/asm/nohash/64/pgtable-4k.h +3 −0
  69. arch/powerpc/include/asm/nohash/64/pgtable-64k.h +1 −0
  70. arch/powerpc/include/asm/nohash/pgtable.h +1 −1
  71. arch/powerpc/include/asm/ppc-opcode.h +7 −0
  72. arch/powerpc/include/asm/prom.h +12 −6
  73. arch/powerpc/kernel/cputable.c +3 −0
  74. arch/powerpc/kernel/idle_book3s.S +6 −4
  75. arch/powerpc/kernel/mce.c +86 −2
  76. arch/powerpc/kernel/mce_power.c +237 −0
  77. arch/powerpc/kernel/prom_init.c +113 −7
  78. arch/powerpc/kernel/setup_64.c +4 −1
  79. arch/powerpc/kvm/book3s_64_mmu_hv.c +1 −1
  80. arch/powerpc/kvm/book3s_hv_rm_mmu.c +1 −1
  81. arch/powerpc/lib/Makefile +1 −0
  82. arch/powerpc/lib/sstep.c +0 −20
  83. arch/powerpc/lib/test_emulate_step.c +434 −0
  84. arch/powerpc/mm/init_64.c +30 −6
  85. arch/powerpc/mm/pgtable-radix.c +4 −0
  86. arch/powerpc/perf/core-book3s.c +2 −0
  87. arch/powerpc/perf/isa207-common.c +36 −7
  88. arch/powerpc/perf/isa207-common.h +1 −0
  89. arch/powerpc/platforms/powernv/opal-wrappers.S +2 −2
  90. arch/powerpc/platforms/powernv/opal.c +6 −15
  91. arch/powerpc/platforms/powernv/pci-ioda.c +15 −5
  92. arch/powerpc/purgatory/trampoline.S +6 −6
  93. arch/powerpc/sysdev/axonram.c +4 −1
  94. arch/powerpc/sysdev/xics/icp-opal.c +10 −0
  95. arch/powerpc/sysdev/xics/xics-common.c +14 −3
  96. arch/s390/crypto/paes_s390.c +4 −1
  97. arch/s390/include/asm/cputime.h +8 −12
  98. arch/s390/include/asm/pgtable.h +1 −0
  99. arch/s390/include/asm/timex.h +4 −8
  100. arch/s390/include/uapi/asm/unistd.h +3 −1
  101. arch/s390/kernel/compat_wrapper.c +1 −0
  102. arch/s390/kernel/entry.S +5 −5
  103. arch/s390/kernel/ipl.c +2 −0
  104. arch/s390/kernel/process.c +3 −0
  105. arch/s390/kernel/syscalls.S +2 −0
  106. arch/s390/kernel/vtime.c +1 −1
  107. arch/s390/mm/pgtable.c +18 −1
  108. arch/score/include/asm/pgtable.h +1 −0
  109. arch/score/kernel/traps.c +1 −0
  110. arch/score/mm/extable.c +2 −0
  111. arch/sh/boards/mach-cayman/setup.c +0 −2
  112. arch/sh/include/asm/pgtable-2level.h +1 −0
  113. arch/sh/include/asm/pgtable-3level.h +1 −0
  114. arch/sparc/include/asm/pgtable_64.h +1 −0
  115. arch/tile/include/asm/pgtable_32.h +1 −0
  116. arch/tile/include/asm/pgtable_64.h +1 −0
  117. arch/um/include/asm/pgtable-2level.h +1 −0
  118. arch/um/include/asm/pgtable-3level.h +1 −0
  119. arch/unicore32/include/asm/pgtable.h +1 −0
  120. arch/x86/configs/x86_64_defconfig +1 −0
  121. arch/x86/events/amd/core.c +1 −1
  122. arch/x86/events/intel/cstate.c +1 −1
  123. arch/x86/events/intel/rapl.c +1 −1
  124. arch/x86/events/intel/uncore.h +3 −3
  125. arch/x86/hyperv/hv_init.c +1 −1
  126. arch/x86/include/asm/cpufeatures.h +2 −1
  127. arch/x86/include/asm/pgtable_types.h +4 −0
  128. arch/x86/include/asm/pkeys.h +9 −6
  129. arch/x86/include/asm/purgatory.h +20 −0
  130. arch/x86/include/asm/tlbflush.h +1 −1
  131. arch/x86/include/uapi/asm/bootparam.h +1 −1
  132. arch/x86/kernel/apic/apic.c +7 −16
  133. arch/x86/kernel/cpu/amd.c +0 −4
  134. arch/x86/kernel/cpu/centaur.c +0 −2
  135. arch/x86/kernel/cpu/common.c +0 −3
  136. arch/x86/kernel/cpu/cyrix.c +0 −1
  137. arch/x86/kernel/cpu/intel.c +0 −4
  138. arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +0 −1
  139. arch/x86/kernel/cpu/transmeta.c +0 −2
  140. arch/x86/kernel/cpu/vmware.c +0 −1
  141. arch/x86/kernel/ftrace.c +1 −1
  142. arch/x86/kernel/hpet.c +1 −1
  143. arch/x86/kernel/kdebugfs.c +1 −1
  144. arch/x86/kernel/machine_kexec_64.c +6 −3
  145. arch/x86/kernel/reboot.c +16 −0
  146. arch/x86/kernel/tsc.c +23 −12
  147. arch/x86/kvm/vmx.c +8 −22
  148. arch/x86/mm/gup.c +21 −16
  149. arch/x86/pci/common.c +9 −0
  150. arch/x86/pci/xen.c +7 −16
  151. arch/x86/platform/uv/tlb_uv.c +0 −1
  152. arch/x86/purgatory/purgatory.c +18 −18
  153. arch/x86/purgatory/setup-x86_64.S +1 −0
  154. arch/x86/purgatory/sha256.h +0 −1
  155. arch/xtensa/include/asm/pgtable.h +1 −0
  156. block/bio.c +9 −3
  157. block/blk-core.c +31 −10
  158. block/blk-mq-sysfs.c +25 −15
  159. block/blk-mq-tag.c +3 −0
  160. block/blk-mq.c +15 −22
  161. block/blk-mq.h +2 −0
  162. block/genhd.c +10 −27
  163. block/sed-opal.c +2 −8
  164. crypto/af_alg.c +5 −4
  165. crypto/algif_hash.c +5 −4
  166. drivers/acpi/internal.h +2 −0
  167. drivers/acpi/ioapic.c +16 −6
  168. drivers/acpi/pci_root.c +2 −2
  169. drivers/ata/ahci_qoriq.c +4 −2
  170. drivers/ata/libata-sff.c +0 −1
  171. drivers/ata/libata-transport.c +3 −6
  172. drivers/block/paride/pcd.c +1 −1
  173. drivers/block/paride/pd.c +1 −1
  174. drivers/block/paride/pf.c +1 −1
  175. drivers/block/paride/pg.c +1 −1
  176. drivers/block/paride/pt.c +1 −1
  177. drivers/block/rbd.c +12 −4
  178. drivers/block/zram/zram_drv.c +2 −0
  179. drivers/char/hw_random/omap-rng.c +14 −2
  180. drivers/char/nwbutton.c +1 −1
  181. drivers/char/random.c +50 −79
  182. drivers/cpufreq/cpufreq.c +1 −0
  183. drivers/cpufreq/intel_pstate.c +31 −36
  184. drivers/crypto/s5p-sss.c +85 −47
  185. drivers/crypto/ux500/cryp/cryp.c +1 −1
  186. drivers/firmware/efi/arm-runtime.c +1 −0
  187. drivers/firmware/efi/libstub/secureboot.c +2 −2
  188. drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 −1
  189. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 −1
  190. drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +21 −0
  191. drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1 −1
  192. drivers/gpu/drm/drm_edid.c +3 −0
  193. drivers/gpu/drm/i915/gvt/cfg_space.c +54 −3
  194. drivers/gpu/drm/i915/gvt/cmd_parser.c +5 −5
  195. drivers/gpu/drm/i915/gvt/display.c +94 −45
  196. drivers/gpu/drm/i915/gvt/display.h +19 −1
  197. drivers/gpu/drm/i915/gvt/firmware.c +1 −1
  198. drivers/gpu/drm/i915/gvt/gtt.c +26 −14
  199. drivers/gpu/drm/i915/gvt/gvt.h +10 −2
  200. drivers/gpu/drm/i915/gvt/handlers.c +307 −132
  201. drivers/gpu/drm/i915/gvt/kvmgt.c +6 −6
  202. drivers/gpu/drm/i915/gvt/mmio.c +65 −1
  203. drivers/gpu/drm/i915/gvt/opregion.c +2 −3
  204. drivers/gpu/drm/i915/gvt/render.c +16 −0
  205. drivers/gpu/drm/i915/gvt/scheduler.c +36 −16
  206. drivers/gpu/drm/i915/gvt/vgpu.c +45 −27
  207. drivers/gpu/drm/mxsfb/mxsfb_crtc.c +43 −6
  208. drivers/gpu/drm/mxsfb/mxsfb_drv.c +4 −0
  209. drivers/gpu/drm/mxsfb/mxsfb_out.c +4 −0
  210. drivers/gpu/drm/mxsfb/mxsfb_regs.h +1 −0
  211. drivers/gpu/drm/rcar-du/rcar_du_vsp.c +6 −2
  212. drivers/hv/channel.c +1 −1
  213. drivers/i2c/busses/i2c-brcmstb.c +21 −6
  214. drivers/i2c/busses/i2c-designware-core.h +1 −0
  215. drivers/i2c/busses/i2c-designware-platdrv.c +24 −4
  216. drivers/i2c/busses/i2c-exynos5.c +2 −1
  217. drivers/i2c/busses/i2c-meson.c +1 −1
  218. drivers/i2c/busses/i2c-mt65xx.c +0 −9
  219. drivers/i2c/busses/i2c-riic.c +5 −1
  220. drivers/i2c/i2c-mux.c +2 −0
  221. drivers/irqchip/irq-crossbar.c +5 −4
  222. drivers/irqchip/irq-gic-v3-its.c +16 −0
  223. drivers/isdn/gigaset/bas-gigaset.c +3 −0
  224. drivers/isdn/hisax/st5481_b.c +1 −1
  225. drivers/macintosh/macio_asic.c +1 −0
  226. drivers/md/bcache/util.h +0 −1
  227. drivers/md/dm.c +16 −13
  228. drivers/md/raid10.c +2 −1
  229. drivers/media/dvb-frontends/drx39xyj/drx_driver.h +3 −5
  230. drivers/media/platform/vsp1/vsp1_drm.c +16 −17
  231. drivers/media/rc/lirc_dev.c +2 −2
  232. drivers/media/rc/nuvoton-cir.c +3 −2
  233. drivers/media/rc/rc-main.c +15 −11
  234. drivers/media/rc/serial_ir.c +62 −61
  235. drivers/media/usb/dvb-usb/dw2102.c +145 −99
  236. drivers/misc/sgi-gru/grufault.c +7 −2
  237. drivers/mtd/spi-nor/spi-nor.c +1 −1
  238. drivers/net/ethernet/amd/xgbe/xgbe-drv.c +2 −8
  239. drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c +1 −1
  240. drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +30 −6
  241. drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +16 −8
  242. drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h +1 −0
  243. drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c +28 −12
  244. drivers/net/ethernet/broadcom/bnxt/bnxt.c +18 −7
  245. drivers/net/ethernet/broadcom/bnxt/bnxt.h +1 −0
  246. drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c +1 −1
  247. drivers/net/ethernet/broadcom/genet/bcmgenet.c +147 −59
  248. drivers/net/ethernet/broadcom/genet/bcmgenet.h +11 −5
  249. drivers/net/ethernet/cavium/liquidio/lio_main.c +55 −55
  250. drivers/net/ethernet/cavium/liquidio/lio_vf_main.c +55 −49
  251. drivers/net/ethernet/cavium/liquidio/octeon_config.h +3 −3
  252. drivers/net/ethernet/cavium/liquidio/octeon_droq.c +2 −15
  253. drivers/net/ethernet/cavium/liquidio/octeon_droq.h +2 −2
  254. drivers/net/ethernet/cavium/liquidio/octeon_main.h +0 −42
  255. drivers/net/ethernet/cavium/liquidio/octeon_network.h +27 −16
  256. drivers/net/ethernet/cavium/thunder/nic.h +1 −0
  257. drivers/net/ethernet/cavium/thunder/nicvf_main.c +11 −1
  258. drivers/net/ethernet/cavium/thunder/nicvf_queues.c +145 −39
  259. drivers/net/ethernet/cavium/thunder/nicvf_queues.h +3 −1
  260. drivers/net/ethernet/cavium/thunder/thunder_bgx.c +45 −19
  261. drivers/net/ethernet/cavium/thunder/thunder_bgx.h +0 −1
  262. drivers/net/ethernet/ibm/emac/core.c +17 −8
  263. drivers/net/ethernet/ibm/ibmvnic.c +34 −9
  264. drivers/net/ethernet/ibm/ibmvnic.h +1 −0
  265. drivers/net/ethernet/mellanox/mlx5/core/Kconfig +1 −0
  266. drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c +5 −5
  267. drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c +1 −4
  268. drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +18 −15
  269. drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +1 −1
  270. drivers/net/ethernet/mellanox/mlx5/core/main.c +3 −2
  271. drivers/net/ethernet/mellanox/mlxsw/reg.h +2 −2
  272. drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c +2 −2
  273. drivers/net/ethernet/qlogic/qed/qed_cxt.c +2 −1
  274. drivers/net/ethernet/qlogic/qed/qed_dev.c +2 −3
  275. drivers/net/ethernet/qlogic/qed/qed_iscsi.c +31 −0
  276. drivers/net/ethernet/qlogic/qed/qed_ll2.c +8 −5
  277. drivers/net/ethernet/qlogic/qed/qed_ooo.c +2 −0
  278. drivers/net/ethernet/qlogic/qlge/qlge.h +2 −2
  279. drivers/net/ethernet/smsc/smc91x.c +25 −22
  280. drivers/net/hyperv/hyperv_net.h +2 −1
  281. drivers/net/hyperv/netvsc.c +2 −6
  282. drivers/net/hyperv/netvsc_drv.c +3 −8
  283. drivers/net/phy/marvell.c +0 −15
  284. drivers/net/phy/phy_device.c +1 −1
  285. drivers/net/phy/spi_ks8995.c +2 −1
  286. drivers/net/team/team.c +1 −0
  287. drivers/net/tun.c +15 −4
  288. drivers/net/vrf.c +2 −1
  289. drivers/net/vxlan.c +40 −33
  290. drivers/net/wan/fsl_ucc_hdlc.c +2 −2
  291. drivers/net/wimax/i2400m/usb.c +3 −0
  292. drivers/net/xen-netback/interface.c +17 −9
  293. drivers/net/xen-netback/netback.c +1 −1
  294. drivers/net/xen-netback/xenbus.c +10 −10
  295. drivers/pci/dwc/pci-exynos.c +4 −4
  296. drivers/pci/pcie/aspm.c +2 −3
  297. drivers/pci/quirks.c +1 −0
  298. drivers/pinctrl/qcom/pinctrl-msm.c +15 −0
  299. drivers/pinctrl/uniphier/pinctrl-uniphier-ld11.c +6 −6
  300. drivers/platform/x86/asus-nb-wmi.c +2 −47
  301. drivers/platform/x86/asus-wmi.c +17 −5
  302. drivers/platform/x86/asus-wmi.h +0 −1
  303. drivers/platform/x86/fujitsu-laptop.c +222 −229
  304. drivers/scsi/Kconfig +16 −3
  305. drivers/scsi/aacraid/src.c +1 −1
  306. drivers/scsi/aic7xxx/aic79xx_core.c +1 −1
  307. drivers/scsi/libiscsi.c +25 −1
  308. drivers/scsi/lpfc/lpfc.h +3 −1
  309. drivers/scsi/lpfc/lpfc_attr.c +8 −1
  310. drivers/scsi/lpfc/lpfc_crtn.h +3 −1
  311. drivers/scsi/lpfc/lpfc_ct.c +1 −1
  312. drivers/scsi/lpfc/lpfc_debugfs.c +0 −22
  313. drivers/scsi/lpfc/lpfc_els.c +14 −8
  314. drivers/scsi/lpfc/lpfc_hbadisc.c +13 −11
  315. drivers/scsi/lpfc/lpfc_hw4.h +2 −2
  316. drivers/scsi/lpfc/lpfc_init.c +85 −43
  317. drivers/scsi/lpfc/lpfc_mem.c +1 −1
  318. drivers/scsi/lpfc/lpfc_nvme.c +82 −25
  319. drivers/scsi/lpfc/lpfc_nvme.h +1 −0
  320. drivers/scsi/lpfc/lpfc_nvmet.c +35 −8
  321. drivers/scsi/lpfc/lpfc_scsi.c +2 −2
  322. drivers/scsi/lpfc/lpfc_sli.c +59 −9
  323. drivers/scsi/lpfc/lpfc_sli4.h +6 −0
  324. drivers/scsi/lpfc/lpfc_version.h +1 −1
  325. drivers/scsi/mpt3sas/mpt3sas_base.h +0 −3
  326. drivers/scsi/mpt3sas/mpt3sas_scsih.c +2 −17
  327. drivers/scsi/qedf/qedf_dbg.h +8 −5
  328. drivers/scsi/qedf/qedf_fip.c +1 −1
  329. drivers/scsi/qedf/qedf_io.c +2 −2
  330. drivers/scsi/qedf/qedf_main.c +2 −2
  331. drivers/scsi/qedi/qedi_debugfs.c +8 −8
  332. drivers/scsi/qedi/qedi_fw.c +2 −2
  333. drivers/scsi/qedi/qedi_gbl.h +7 −1
  334. drivers/scsi/qedi/qedi_iscsi.c +4 −4
  335. drivers/scsi/qedi/qedi_main.c +1 −1
  336. drivers/scsi/qla2xxx/qla_dbg.c +4 −8
  337. drivers/scsi/scsi_lib.c +10 −4
  338. drivers/scsi/scsi_priv.h +0 −3
  339. drivers/scsi/sd.c +25 −33
  340. drivers/scsi/storvsc_drv.c +17 −10
  341. drivers/scsi/ufs/ufs.h +8 −14
  342. drivers/scsi/ufs/ufshcd.c +173 −58
  343. drivers/scsi/ufs/ufshcd.h +15 −0
  344. drivers/scsi/vmw_pvscsi.c +1 −1
  345. drivers/staging/lustre/lnet/lnet/lib-socket.c +2 −2
  346. drivers/staging/octeon/ethernet-rx.c +0 −1
  347. drivers/staging/vc04_services/Kconfig +1 −0
  348. drivers/tty/n_hdlc.c +69 −63
  349. drivers/tty/serial/samsung.c +4 −2
  350. drivers/usb/dwc3/dwc3-omap.c +2 −1
  351. drivers/usb/dwc3/gadget.c +67 −9
  352. drivers/usb/dwc3/gadget.h +7 −7
  353. drivers/usb/gadget/configfs.c +1 −0
  354. drivers/usb/gadget/function/f_fs.c +14 −3
  355. drivers/usb/gadget/function/f_uvc.c +0 −7
  356. drivers/usb/gadget/legacy/inode.c +4 −3
  357. drivers/usb/gadget/udc/atmel_usba_udc.c +2 −2
  358. drivers/usb/gadget/udc/dummy_hcd.c +2 −0
  359. drivers/usb/gadget/udc/net2280.c +13 −12
  360. drivers/usb/gadget/udc/pxa27x_udc.c +3 −2
  361. drivers/usb/host/ohci-at91.c +2 −2
  362. drivers/usb/host/xhci-dbg.c +1 −1
  363. drivers/usb/host/xhci-mtk.c +3 −4
  364. drivers/usb/host/xhci-plat.c +2 −0
  365. drivers/usb/host/xhci-tegra.c +0 −1
  366. drivers/usb/host/xhci.c +2 −2
  367. drivers/usb/misc/iowarrior.c +15 −6
  368. drivers/usb/misc/usb251xb.c +24 −35
  369. drivers/usb/phy/phy-isp1301.c +7 −0
  370. drivers/usb/serial/digi_acceleport.c +1 −1
  371. drivers/usb/serial/io_ti.c +7 −1
  372. drivers/usb/serial/omninet.c +0 −13
  373. drivers/usb/serial/safe_serial.c +5 −0
  374. drivers/usb/storage/unusual_devs.h +14 −0
  375. drivers/xen/swiotlb-xen.c +47 −0
  376. drivers/xen/xenbus/xenbus_dev_frontend.c +0 −1
  377. fs/dlm/lowcomms.c +1 −1
  378. fs/fat/inode.c +12 −1
  379. fs/fs-writeback.c +21 −14
  380. fs/gfs2/incore.h +1 −1
  381. fs/iomap.c +10 −7
  382. fs/ocfs2/cluster/tcp.c +1 −1
  383. fs/overlayfs/util.c +0 −1
  384. fs/timerfd.c +4 −4
  385. fs/userfaultfd.c +26 −49
  386. fs/xfs/kmem.c +0 −18
  387. fs/xfs/kmem.h +0 −2
  388. fs/xfs/libxfs/xfs_bmap.c +21 −13
  389. fs/xfs/libxfs/xfs_bmap_btree.c +3 −3
  390. fs/xfs/xfs_aops.c +27 −32
  391. fs/xfs/xfs_icache.c +1 −1
  392. fs/xfs/xfs_inode.c +1 −1
  393. fs/xfs/xfs_iomap.c +18 −7
  394. fs/xfs/xfs_itable.c +2 −4
  395. fs/xfs/xfs_mount.c +1 −2
  396. fs/xfs/xfs_reflink.c +16 −7
  397. fs/xfs/xfs_reflink.h +2 −2
  398. fs/xfs/xfs_super.c +1 −1
  399. include/asm-generic/4level-fixup.h +2 −1
  400. include/asm-generic/5level-fixup.h +41 −0
  401. include/asm-generic/pgtable-nop4d-hack.h +62 −0
  402. include/asm-generic/pgtable-nop4d.h +56 −0
  403. include/asm-generic/pgtable-nopud.h +27 −21
  404. include/asm-generic/pgtable.h +45 −3
  405. include/asm-generic/tlb.h +11 −3
  406. include/crypto/if_alg.h +1 −1
  407. include/dt-bindings/sound/cs42l42.h +1 −1
  408. include/linux/blkdev.h +0 −1
  409. include/linux/ceph/libceph.h +2 −0
  410. include/linux/ceph/osd_client.h +1 −0
  411. include/linux/dccp.h +1 −0
  412. include/linux/filter.h +12 −4
  413. include/linux/fs.h +1 −1
  414. include/linux/genhd.h +0 −8
  415. include/linux/hugetlb.h +4 −1
  416. include/linux/irqchip/arm-gic-v3.h +2 −0
  417. include/linux/irqdomain.h +4 −0
  418. include/linux/jump_label.h +9 −2
  419. include/linux/kasan.h +1 −0
  420. include/linux/list_nulls.h +5 −0
  421. include/linux/mm.h +28 −6
  422. include/linux/net.h +1 −1
  423. include/linux/phy.h +4 −0
  424. include/linux/purgatory.h +23 −0
  425. include/linux/random.h +15 −3
  426. include/linux/rculist_nulls.h +14 −0
  427. include/linux/regulator/machine.h +1 −1
  428. include/linux/user_namespace.h +1 −1
  429. include/linux/userfaultfd_k.h +3 −10
  430. include/linux/vm_event_item.h +3 −0
  431. include/linux/wait.h +10 −21
  432. include/media/vsp1.h +11 −2
  433. include/net/inet_common.h +2 −1
  434. include/net/inet_connection_sock.h +1 −1
  435. include/net/irda/timer.h +1 −1
  436. include/net/sctp/structs.h +2 −1
  437. include/net/sock.h +6 −3
  438. include/scsi/libiscsi.h +1 −0
  439. include/scsi/scsi_device.h +4 −0
  440. include/trace/events/syscalls.h +1 −0
  441. include/uapi/linux/packet_diag.h +1 −1
  442. include/uapi/linux/userfaultfd.h +1 −4
  443. include/xen/swiotlb-xen.h +11 −0
  444. init/main.c +0 −1
  445. kernel/bpf/hashtab.c +80 −39
  446. kernel/bpf/lpm_trie.c +6 −0
  447. kernel/cgroup/cgroup-v1.c +1 −1
  448. kernel/cgroup/cgroup.c +1 −1
  449. kernel/cgroup/pids.c +1 −1
  450. kernel/events/core.c +1 −1
  451. kernel/exit.c +0 −1
  452. kernel/kexec_file.c +4 −4
  453. kernel/kexec_internal.h +1 −5
  454. kernel/locking/lockdep.c +9 −2
  455. kernel/locking/test-ww_mutex.c +3 −3
  456. kernel/sched/core.c +8 −3
  457. kernel/sched/cpufreq_schedutil.c +9 −10
  458. kernel/sched/fair.c +1 −1
  459. kernel/sched/features.h +5 −0
  460. kernel/sched/wait.c +39 −0
  461. kernel/time/jiffies.c +1 −1
  462. kernel/trace/ftrace.c +18 −5
  463. kernel/trace/trace_stack.c +1 −1
  464. kernel/ucount.c +11 −7
  465. kernel/workqueue.c +1 −0
  466. lib/ioremap.c +36 −3
  467. lib/radix-tree.c +2 −2
  468. lib/refcount.c +7 −7
  469. mm/backing-dev.c +28 −15
  470. mm/gup.c +40 −6
  471. mm/huge_memory.c +7 −2
  472. mm/hugetlb.c +18 −11
  473. mm/kasan/kasan_init.c +39 −5
  474. mm/kasan/quarantine.c +44 −7
  475. mm/madvise.c +41 −3
  476. mm/memblock.c +4 −1
  477. mm/memcontrol.c +13 −5
  478. mm/memory.c +196 −34
  479. mm/mlock.c +5 −5
  480. mm/mprotect.c +23 −3
  481. mm/mremap.c +11 −2
  482. mm/page_alloc.c +2 −1
  483. mm/page_vma_mapped.c +5 −1
  484. mm/pagewalk.c +29 −3
  485. mm/percpu-vm.c +3 −4
  486. mm/percpu.c +4 −1
  487. mm/pgtable-generic.c +6 −0
  488. mm/rmap.c +13 −7
  489. mm/sparse-vmemmap.c +19 −3
  490. mm/swapfile.c +23 −3
  491. mm/userfaultfd.c +13 −10
  492. mm/vmalloc.c +60 −21
  493. mm/vmstat.c +3 −0
  494. net/atm/svc.c +3 −2
  495. net/ax25/af_ax25.c +2 −1
  496. net/bluetooth/l2cap_sock.c +1 −1
  497. net/bluetooth/rfcomm/sock.c +2 −1
  498. net/bluetooth/sco.c +1 −1
  499. net/bridge/br_input.c +1 −0
  500. net/bridge/br_netfilter_hooks.c +0 −21
  501. net/ceph/ceph_common.c +15 −0
  502. net/ceph/osd_client.c +35 −1
  503. net/ceph/osdmap.c +1 −3
  504. net/core/dev.c +1 −0
  505. net/core/net-sysfs.c +3 −3
  506. net/core/skbuff.c +16 −14
  507. net/core/sock.c +57 −49
  508. net/dccp/ccids/ccid2.c +1 −0
  509. net/dccp/ipv4.c +2 −1
  510. net/dccp/ipv6.c +5 −3
  511. net/dccp/minisocks.c +16 −8
  512. net/decnet/af_decnet.c +3 −2
  513. net/ipv4/af_inet.c +6 −3
  514. net/ipv4/inet_connection_sock.c +1 −1
  515. net/ipv4/ip_output.c +1 −1
  516. net/ipv4/tcp_ipv4.c +7 −3
  517. net/ipv4/tcp_timer.c +4 −2
  518. net/ipv6/af_inet6.c +5 −5
  519. net/ipv6/ip6_fib.c +2 −0
  520. net/ipv6/ip6_offload.c +3 −1
  521. net/ipv6/ip6_output.c +7 −2
  522. net/ipv6/ip6_vti.c +6 −2
  523. net/ipv6/route.c +6 −5
  524. net/ipv6/tcp_ipv6.c +5 −3
  525. net/irda/af_irda.c +3 −2
  526. net/iucv/af_iucv.c +1 −1
  527. net/llc/af_llc.c +3 −1
  528. net/mpls/af_mpls.c +3 −1
  529. net/netrom/af_netrom.c +2 −1
  530. net/nfc/llcp_sock.c +1 −1
  531. net/phonet/pep.c +4 −2
  532. net/phonet/socket.c +2 −2
  533. net/rds/connection.c +1 −0
  534. net/rds/ib_cm.c +36 −11
  535. net/rds/rds.h +3 −3
  536. net/rds/tcp.c +21 −17
  537. net/rds/tcp.h +1 −1
  538. net/rds/tcp_listen.c +8 −3
  539. net/rose/af_rose.c +2 −1
  540. net/rxrpc/input.c +19 −8
  541. net/rxrpc/recvmsg.c +2 −2
  542. net/rxrpc/sendmsg.c +31 −18
  543. net/sched/act_connmark.c +3 −0
  544. net/sched/act_skbmod.c +0 −1
  545. net/sctp/ipv6.c +3 −2
  546. net/sctp/protocol.c +3 −2
  547. net/sctp/socket.c +2 −2
  548. net/smc/af_smc.c +1 −1
  549. net/socket.c +3 −2
  550. net/tipc/socket.c +5 −3
  551. net/unix/af_unix.c +3 −2
  552. net/vmw_vsock/af_vsock.c +2 −1
  553. net/x25/af_x25.c +2 −1
  554. net/xfrm/xfrm_policy.c +9 −10
  555. scripts/gcc-plugins/sancov_plugin.c +1 −1
  556. scripts/module-common.lds +2 −0
  557. scripts/spelling.txt +3 −0
  558. sound/soc/amd/acp-pcm-dma.c +1 −1
  559. tools/include/uapi/linux/bpf_perf_event.h +18 −0
  560. tools/lguest/lguest.c +1 −1
  561. tools/lib/bpf/Makefile +1 −1
  562. tools/lib/traceevent/Makefile +1 −1
  563. tools/lib/traceevent/event-parse.h +1 −1
  564. tools/objtool/builtin-check.c +12 −3
  565. tools/objtool/elf.c +12 −0
  566. tools/objtool/elf.h +1 −0
  567. tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c +1 −1
  568. tools/testing/ktest/ktest.pl +13 −8
  569. tools/testing/radix-tree/Makefile +9 −6
  570. tools/testing/radix-tree/benchmark.c +166 −7
  571. tools/testing/radix-tree/idr-test.c +75 −3
  572. tools/testing/radix-tree/main.c +1 −0
  573. tools/testing/radix-tree/tag_check.c +29 −0
  574. tools/testing/radix-tree/test.h +1 −0
  575. tools/testing/selftests/bpf/Makefile +3 −1
  576. tools/testing/selftests/bpf/test_verifier.c +4 −0
  577. tools/testing/selftests/powerpc/harness.c +4 −2
  578. tools/testing/selftests/powerpc/include/vsx_asm.h +24 −24
  579. tools/testing/selftests/vm/Makefile +4 −0
  580. tools/testing/selftests/x86/fsgsbase.c +1 −1
  581. tools/testing/selftests/x86/ldt_gdt.c +11 −5
  582. tools/testing/selftests/x86/ptrace_syscall.c +2 −1
  583. tools/testing/selftests/x86/single_step_syscall.c +4 −1
  584. virt/kvm/arm/vgic/vgic-its.c +65 −44
  585. virt/kvm/arm/vgic/vgic-mmio.c +24 −8
  586. virt/kvm/arm/vgic/vgic-v3.c +4 −1
Documentation/admin-guide/kernel-parameters.txt+9−0
@@ -653,6 +653,9 @@ · 652 unmodified lines
653653 cpuidle.off=1 [CPU_IDLE]
654654 disable the cpuidle sub-system
655655
656+ cpufreq.off=1 [CPU_FREQ]
657+ disable the cpufreq sub-system
658+
656659 cpu_init_udelay=N
657660 [X86] Delay for N microsec between assert and de-assert
658661 of APIC INIT to start processors. This delay occurs
@@ -1183,6 +1186,12 @@ · 524 unmodified lines
11831186 functions that can be changed at run time by the
11841187 set_graph_notrace file in the debugfs tracing directory.
11851188
1189+ ftrace_graph_max_depth=<uint>
1190+ [FTRACE] Used with the function graph tracer. This is
1191+ the max depth it will trace into a function. This value
1192+ can be changed at run time by the max_graph_depth file
1193+ in the tracefs tracing directory. default: 0 (no limit)
1194+
11861195 gamecon.map[2|3]=
11871196 [HW,JOY] Multisystem joystick and NES/SNES/PSX pad
11881197 support via parallel port (up to 5 devices per port)
Documentation/arm64/silicon-errata.txt+1−0
@@ -68,3 +68,4 @@ stable kernels. · 67 unmodified lines
6868 | | | | |
6969 | Qualcomm Tech. | Falkor v1 | E1003 | QCOM_FALKOR_ERRATUM_1003 |
7070 | Qualcomm Tech. | Falkor v1 | E1009 | QCOM_FALKOR_ERRATUM_1009 |
71+| Qualcomm Tech. | QDF2400 ITS | E0065 | QCOM_QDF2400_ERRATUM_0065 |
Documentation/cgroup-v2.txt+6−5
@@ -1142,16 +1142,17 @@ used by the kernel. · 1141 unmodified lines
11421142
11431143 pids.max
11441144
1145− A read-write single value file which exists on non-root cgroups. The
1146− default is "max".
1145+ A read-write single value file which exists on non-root
1146+ cgroups. The default is "max".
11471147
1148− Hard limit of number of processes.
1148+ Hard limit of number of processes.
11491149
11501150 pids.current
11511151
1152− A read-only single value file which exists on all cgroups.
1152+ A read-only single value file which exists on all cgroups.
11531153
1154− The number of processes currently in the cgroup and its descendants.
1154+ The number of processes currently in the cgroup and its
1155+ descendants.
11551156
11561157 Organisational operations are not blocked by cgroup policies, so it is
11571158 possible to have pids.current > pids.max. This can be done by either
Documentation/dev-tools/kcov.rst+1−1
@@ -10,7 +10,7 @@ Note that kcov does not aim to collect as much coverage as possible. It aims · 9 unmodified lines
1010 to collect more or less stable coverage that is function of syscall inputs.
1111 To achieve this goal it does not collect coverage in soft/hard interrupts
1212 and instrumentation of some inherently non-deterministic parts of kernel is
13−disbled (e.g. scheduler, locking).
13+disabled (e.g. scheduler, locking).
1414
1515 Usage
1616 -----
Documentation/devicetree/bindings/powerpc/4xx/emac.txt+60−2
@@ -71,6 +71,9 @@ · 70 unmodified lines
7171 For Axon it can be absent, though my current driver
7272 doesn't handle phy-address yet so for now, keep
7373 0x00ffffff in it.
74+ - phy-handle : Used to describe configurations where a external PHY
75+ is used. Please refer to:
76+ Documentation/devicetree/bindings/net/ethernet.txt
7477 - rx-fifo-size-gige : 1 cell, Rx fifo size in bytes for 1000 Mb/sec
7578 operations (if absent the value is the same as
7679 rx-fifo-size). For Axon, either absent or 2048.
@@ -81,8 +84,22 @@ · 4 unmodified lines
8184 offload, phandle of the TAH device node.
8285 - tah-channel : 1 cell, optional. If appropriate, channel used on the
8386 TAH engine.
87+ - fixed-link : Fixed-link subnode describing a link to a non-MDIO
88+ managed entity. See
89+ Documentation/devicetree/bindings/net/fixed-link.txt
90+ for details.
91+ - mdio subnode : When the EMAC has a phy connected to its local
92+ mdio, which us supported by the kernel's network
93+ PHY library in drivers/net/phy, there must be device
94+ tree subnode with the following required properties:
95+ - #address-cells: Must be <1>.
96+ - #size-cells: Must be <0>.
8497
85− Example:
98+ For PHY definitions: Please refer to
99+ Documentation/devicetree/bindings/net/phy.txt and
100+ Documentation/devicetree/bindings/net/ethernet.txt
101+
102+ Examples:
86103
87104 EMAC0: ethernet@40000800 {
88105 device_type = "network";
@@ -104,6 +121,48 @@ · 15 unmodified lines
104121 zmii-channel = <0>;
105122 };
106123
124+ EMAC1: ethernet@ef600c00 {
125+ device_type = "network";
126+ compatible = "ibm,emac-apm821xx", "ibm,emac4sync";
127+ interrupt-parent = <&EMAC1>;
128+ interrupts = <0 1>;
129+ #interrupt-cells = <1>;
130+ #address-cells = <0>;
131+ #size-cells = <0>;
132+ interrupt-map = <0 &UIC2 0x10 IRQ_TYPE_LEVEL_HIGH /* Status */
133+ 1 &UIC2 0x14 IRQ_TYPE_LEVEL_HIGH /* Wake */>;
134+ reg = <0xef600c00 0x000000c4>;
135+ local-mac-address = [000000000000]; /* Filled in by U-Boot */
136+ mal-device = <&MAL0>;
137+ mal-tx-channel = <0>;
138+ mal-rx-channel = <0>;
139+ cell-index = <0>;
140+ max-frame-size = <9000>;
141+ rx-fifo-size = <16384>;
142+ tx-fifo-size = <2048>;
143+ fifo-entry-size = <10>;
144+ phy-mode = "rgmii";
145+ phy-handle = <&phy0>;
146+ phy-map = <0x00000000>;
147+ rgmii-device = <&RGMII0>;
148+ rgmii-channel = <0>;
149+ tah-device = <&TAH0>;
150+ tah-channel = <0>;
151+ has-inverted-stacr-oc;
152+ has-new-stacr-staopc;
153+
154+ mdio {
155+ #address-cells = <1>;
156+ #size-cells = <0>;
157+
158+ phy0: ethernet-phy@0 {
159+ compatible = "ethernet-phy-ieee802.3-c22";
160+ reg = <0>;
161+ };
162+ };
163+ };
164+
165+
107166 ii) McMAL node
108167
109168 Required properties:
@@ -145,4 +204,3 @@ · 35 unmodified lines
145204 - revision : as provided by the RGMII new version register if
146205 available.
147206 For Axon: 0x0000012a
148−
Documentation/devicetree/bindings/regulator/ti-abb-regulator.txt+1−1
@@ -45,7 +45,7 @@ Required Properties: · 44 unmodified lines
4545 Optional Properties:
4646 - reg-names: In addition to the required properties, the following are optional
4747 - "efuse-address" - Contains efuse base address used to pick up ABB info.
48− - "ldo-address" - Contains address of ABB LDO overide register address.
48+ - "ldo-address" - Contains address of ABB LDO override register.
4949 "efuse-address" is required for this.
5050 - ti,ldovbb-vset-mask - Required if ldo-address is set, mask for LDO override
5151 register to provide override vset value.
Documentation/devicetree/bindings/usb/usb251xb.txt+18−35
@@ -7,18 +7,18 @@ Required properties : · 6 unmodified lines
77 - compatible : Should be "microchip,usb251xb" or one of the specific types:
88 "microchip,usb2512b", "microchip,usb2512bi", "microchip,usb2513b",
99 "microchip,usb2513bi", "microchip,usb2514b", "microchip,usb2514bi"
10− - hub-reset-gpios : Should specify the gpio for hub reset
10+ - reset-gpios : Should specify the gpio for hub reset
11+ - reg : I2C address on the selected bus (default is <0x2C>)
1112
1213 Optional properties :
13− - reg : I2C address on the selected bus (default is <0x2C>)
1414 - skip-config : Skip Hub configuration, but only send the USB-Attach command
15− - vendor-id : USB Vendor ID of the hub (16 bit, default is 0x0424)
16− - product-id : USB Product ID of the hub (16 bit, default depends on type)
17− - device-id : USB Device ID of the hub (16 bit, default is 0x0bb3)
18− - language-id : USB Language ID (16 bit, default is 0x0000)
19− - manufacturer : USB Manufacturer string (max 31 characters long)
20− - product : USB Product string (max 31 characters long)
21− - serial : USB Serial string (max 31 characters long)
15+ - vendor-id : Set USB Vendor ID of the hub (16 bit, default is 0x0424)
16+ - product-id : Set USB Product ID of the hub (16 bit, default depends on type)
17+ - device-id : Set USB Device ID of the hub (16 bit, default is 0x0bb3)
18+ - language-id : Set USB Language ID (16 bit, default is 0x0000)
19+ - manufacturer : Set USB Manufacturer string (max 31 characters long)
20+ - product : Set USB Product string (max 31 characters long)
21+ - serial : Set USB Serial string (max 31 characters long)
2222 - {bus,self}-powered : selects between self- and bus-powered operation (default
2323 is self-powered)
2424 - disable-hi-speed : disable USB Hi-Speed support
@@ -31,8 +31,10 @@ Optional properties : · 6 unmodified lines
3131 (default is individual)
3232 - dynamic-power-switching : enable auto-switching from self- to bus-powered
3333 operation if the local power source is removed or unavailable
34− - oc-delay-{100us,4ms,8ms,16ms} : set over current timer delay (default is 8ms)
35− - compound-device : indicated the hub is part of a compound device
34+ - oc-delay-us : Delay time (in microseconds) for filtering the over-current
35+ sense inputs. Valid values are 100, 4000, 8000 (default) and 16000. If
36+ an invalid value is given, the default is used instead.
37+ - compound-device : indicate the hub is part of a compound device
3638 - port-mapping-mode : enable port mapping mode
3739 - string-support : enable string descriptor support (required for manufacturer,
3840 product and serial string configuration)
@@ -40,34 +42,15 @@ Optional properties : · 1 unmodified line
4042 device connected.
4143 - sp-disabled-ports : Specifies the ports which will be self-power disabled
4244 - bp-disabled-ports : Specifies the ports which will be bus-power disabled
43− - max-sp-power : Specifies the maximum current the hub consumes from an
44− upstream port when operating as self-powered hub including the power
45− consumption of a permanently attached peripheral if the hub is
46− configured as a compound device. The value is given in mA in a 0 - 500
47− range (default is 2).
48− - max-bp-power : Specifies the maximum current the hub consumes from an
49− upstream port when operating as bus-powered hub including the power
50− consumption of a permanently attached peripheral if the hub is
51− configured as a compound device. The value is given in mA in a 0 - 500
52− range (default is 100).
53− - max-sp-current : Specifies the maximum current the hub consumes from an
54− upstream port when operating as self-powered hub EXCLUDING the power
55− consumption of a permanently attached peripheral if the hub is
56− configured as a compound device. The value is given in mA in a 0 - 500
57− range (default is 2).
58− - max-bp-current : Specifies the maximum current the hub consumes from an
59− upstream port when operating as bus-powered hub EXCLUDING the power
60− consumption of a permanently attached peripheral if the hub is
61− configured as a compound device. The value is given in mA in a 0 - 500
62− range (default is 100).
63− - power-on-time : Specifies the time it takes from the time the host initiates
64− the power-on sequence to a port until the port has adequate power. The
65− value is given in ms in a 0 - 510 range (default is 100ms).
45+ - power-on-time-ms : Specifies the time it takes from the time the host
46+ initiates the power-on sequence to a port until the port has adequate
47+ power. The value is given in ms in a 0 - 510 range (default is 100ms).
6648
6749 Examples:
6850 usb2512b@2c {
6951 compatible = "microchip,usb2512b";
70− hub-reset-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
52+ reg = <0x2c>;
53+ reset-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
7154 };
7255
7356 usb2514b@2c {
Documentation/networking/ip-sysctl.txt+2−1
@@ -1006,7 +1006,8 @@ accept_redirects - BOOLEAN · 1005 unmodified lines
10061006 FALSE (router)
10071007
10081008 forwarding - BOOLEAN
1009− Enable IP forwarding on this interface.
1009+ Enable IP forwarding on this interface. This controls whether packets
1010+ received _on_ this interface can be forwarded.
10101011
10111012 mc_forwarding - BOOLEAN
10121013 Do multicast routing. The kernel needs to be compiled with CONFIG_MROUTE
Documentation/virtual/kvm/api.txt+4−0
@@ -951,6 +951,10 @@ This ioctl allows the user to create or modify a guest physical memory · 950 unmodified lines
951951 slot. When changing an existing slot, it may be moved in the guest
952952 physical memory space, or its flags may be modified. It may not be
953953 resized. Slots may not overlap in guest physical address space.
954+Bits 0-15 of "slot" specifies the slot id and this value should be
955+less than the maximum number of user memory slots supported per VM.
956+The maximum allowed slots can be queried using KVM_CAP_NR_MEMSLOTS,
957+if this capability is supported by the architecture.
954958
955959 If KVM_CAP_MULTI_ADDRESS_SPACE is available, bits 16-31 of "slot"
956960 specifies the address space which is being modified. They must be
Documentation/vm/userfaultfd.txt+0−4
@@ -172,10 +172,6 @@ the same read(2) protocol as for the page fault notifications. The · 171 unmodified lines
172172 manager has to explicitly enable these events by setting appropriate
173173 bits in uffdio_api.features passed to UFFDIO_API ioctl:
174174
175−UFFD_FEATURE_EVENT_EXIT - enable notification about exit() of the
176−non-cooperative process. When the monitored process exits, the uffd
177−manager will get UFFD_EVENT_EXIT.
178−
179175 UFFD_FEATURE_EVENT_FORK - enable userfaultfd hooks for fork(). When
180176 this feature is enabled, the userfaultfd context of the parent process
181177 is duplicated into the newly created process. The manager receives
MAINTAINERS+0−1
@@ -8307,7 +8307,6 @@ M: Richard Leitner <richard.leitner@skidata.com> · 8306 unmodified lines
83078307 L: linux-usb@vger.kernel.org
83088308 S: Maintained
83098309 F: drivers/usb/misc/usb251xb.c
8310−F: include/linux/platform_data/usb251xb.h
83118310 F: Documentation/devicetree/bindings/usb/usb251xb.txt
83128311
83138312 MICROSOFT SURFACE PRO 3 BUTTON DRIVER
Makefile+1−1
@@ -1,7 +1,7 @@
11 VERSION = 4
22 PATCHLEVEL = 11
33 SUBLEVEL = 0
4−EXTRAVERSION = -rc1
4+EXTRAVERSION = -rc2
55 NAME = Fearless Coyote
66
77 # *DOCUMENTATION*
arch/arc/include/asm/hugepage.h+1−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #define _ASM_ARC_HUGEPAGE_H
1212
1313 #include <linux/types.h>
14+#define __ARCH_USE_5LEVEL_HACK
1415 #include <asm-generic/pgtable-nopmd.h>
1516
1617 static inline pte_t pmd_pte(pmd_t pmd)
arch/arc/include/asm/pgtable.h+1−0
@@ -37,6 +37,7 @@ · 36 unmodified lines
3737
3838 #include <asm/page.h>
3939 #include <asm/mmu.h>
40+#define __ARCH_USE_5LEVEL_HACK
4041 #include <asm-generic/pgtable-nopmd.h>
4142 #include <linux/const.h>
4243
arch/arm/include/asm/kvm_arm.h+1−0
@@ -209,6 +209,7 @@ · 208 unmodified lines
209209 #define HSR_EC_IABT_HYP (0x21)
210210 #define HSR_EC_DABT (0x24)
211211 #define HSR_EC_DABT_HYP (0x25)
212+#define HSR_EC_MAX (0x3f)
212213
213214 #define HSR_WFI_IS_WFE (_AC(1, UL) << 0)
214215
arch/arm/include/asm/kvm_host.h+0−1
@@ -30,7 +30,6 @@ · 29 unmodified lines
3030 #define __KVM_HAVE_ARCH_INTC_INITIALIZED
3131
3232 #define KVM_USER_MEM_SLOTS 32
33−#define KVM_PRIVATE_MEM_SLOTS 4
3433 #define KVM_COALESCED_MMIO_PAGE_OFFSET 1
3534 #define KVM_HAVE_ONE_REG
3635 #define KVM_HALT_POLL_NS_DEFAULT 500000
arch/arm/include/asm/pgtable.h+1−0
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020
2121 #else
2222
23+#define __ARCH_USE_5LEVEL_HACK
2324 #include <asm-generic/pgtable-nopud.h>
2425 #include <asm/memory.h>
2526 #include <asm/pgtable-hwdef.h>
arch/arm/kvm/arm.c+3−0
@@ -221,6 +221,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) · 220 unmodified lines
221221 case KVM_CAP_MAX_VCPUS:
222222 r = KVM_MAX_VCPUS;
223223 break;
224+ case KVM_CAP_NR_MEMSLOTS:
225+ r = KVM_USER_MEM_SLOTS;
226+ break;
224227 case KVM_CAP_MSI_DEVID:
225228 if (!kvm)
226229 r = -EINVAL;
arch/arm/kvm/handle_exit.c+12−7
@@ -79,7 +79,19 @@ static int kvm_handle_wfx(struct kvm_vcpu *vcpu, struct kvm_run *run) · 78 unmodified lines
7979 return 1;
8080 }
8181
82+static int kvm_handle_unknown_ec(struct kvm_vcpu *vcpu, struct kvm_run *run)
83+{
84+ u32 hsr = kvm_vcpu_get_hsr(vcpu);
85+
86+ kvm_pr_unimpl("Unknown exception class: hsr: %#08x\n",
87+ hsr);
88+
89+ kvm_inject_undefined(vcpu);
90+ return 1;
91+}
92+
8293 static exit_handle_fn arm_exit_handlers[] = {
94+ [0 ... HSR_EC_MAX] = kvm_handle_unknown_ec,
8395 [HSR_EC_WFI] = kvm_handle_wfx,
8496 [HSR_EC_CP15_32] = kvm_handle_cp15_32,
8597 [HSR_EC_CP15_64] = kvm_handle_cp15_64,
@@ -98,13 +110,6 @@ static exit_handle_fn kvm_get_exit_handler(struct kvm_vcpu *vcpu) · 12 unmodified lines
98110 {
99111 u8 hsr_ec = kvm_vcpu_trap_get_class(vcpu);
100112
101− if (hsr_ec >= ARRAY_SIZE(arm_exit_handlers) ||
102− !arm_exit_handlers[hsr_ec]) {
103− kvm_err("Unknown exception class: hsr: %#08x\n",
104− (unsigned int)kvm_vcpu_get_hsr(vcpu));
105− BUG();
106− }
107−
108113 return arm_exit_handlers[hsr_ec];
109114 }
110115
arch/arm/xen/mm.c+2−0
@@ -198,6 +198,8 @@ static const struct dma_map_ops xen_swiotlb_dma_ops = { · 197 unmodified lines
198198 .unmap_page = xen_swiotlb_unmap_page,
199199 .dma_supported = xen_swiotlb_dma_supported,
200200 .set_dma_mask = xen_swiotlb_set_dma_mask,
201+ .mmap = xen_swiotlb_dma_mmap,
202+ .get_sgtable = xen_swiotlb_get_sgtable,
201203 };
202204
203205 int __init xen_mm_init(void)
arch/arm64/Kconfig+10−0
@@ -508,6 +508,16 @@ config QCOM_FALKOR_ERRATUM_1009 · 507 unmodified lines
508508
509509 If unsure, say Y.
510510
511+config QCOM_QDF2400_ERRATUM_0065
512+ bool "QDF2400 E0065: Incorrect GITS_TYPER.ITT_Entry_size"
513+ default y
514+ help
515+ On Qualcomm Datacenter Technologies QDF2400 SoC, ITS hardware reports
516+ ITE size incorrectly. The GITS_TYPER.ITT_Entry_size field should have
517+ been indicated as 16Bytes (0xf), not 8Bytes (0x7).
518+
519+ If unsure, say Y.
520+
511521 endmenu
512522
513523
arch/arm64/include/asm/kvm_host.h+1−2
@@ -30,8 +30,7 @@ · 29 unmodified lines
3030
3131 #define __KVM_HAVE_ARCH_INTC_INITIALIZED
3232
33−#define KVM_USER_MEM_SLOTS 32
34−#define KVM_PRIVATE_MEM_SLOTS 4
33+#define KVM_USER_MEM_SLOTS 512
3534 #define KVM_COALESCED_MMIO_PAGE_OFFSET 1
3635 #define KVM_HALT_POLL_NS_DEFAULT 500000
3736
arch/arm64/include/asm/pgtable-types.h+4−0
@@ -55,9 +55,13 @@ typedef struct { pteval_t pgprot; } pgprot_t; · 54 unmodified lines
5555 #define __pgprot(x) ((pgprot_t) { (x) } )
5656
5757 #if CONFIG_PGTABLE_LEVELS == 2
58+#define __ARCH_USE_5LEVEL_HACK
5859 #include <asm-generic/pgtable-nopmd.h>
5960 #elif CONFIG_PGTABLE_LEVELS == 3
61+#define __ARCH_USE_5LEVEL_HACK
6062 #include <asm-generic/pgtable-nopud.h>
63+#elif CONFIG_PGTABLE_LEVELS == 4
64+#include <asm-generic/5level-fixup.h>
6165 #endif
6266
6367 #endif /* __ASM_PGTABLE_TYPES_H */
arch/arm64/kvm/handle_exit.c+12−7
@@ -135,7 +135,19 @@ static int kvm_handle_guest_debug(struct kvm_vcpu *vcpu, struct kvm_run *run) · 134 unmodified lines
135135 return ret;
136136 }
137137
138+static int kvm_handle_unknown_ec(struct kvm_vcpu *vcpu, struct kvm_run *run)
139+{
140+ u32 hsr = kvm_vcpu_get_hsr(vcpu);
141+
142+ kvm_pr_unimpl("Unknown exception class: hsr: %#08x -- %s\n",
143+ hsr, esr_get_class_string(hsr));
144+
145+ kvm_inject_undefined(vcpu);
146+ return 1;
147+}
148+
138149 static exit_handle_fn arm_exit_handlers[] = {
150+ [0 ... ESR_ELx_EC_MAX] = kvm_handle_unknown_ec,
139151 [ESR_ELx_EC_WFx] = kvm_handle_wfx,
140152 [ESR_ELx_EC_CP15_32] = kvm_handle_cp15_32,
141153 [ESR_ELx_EC_CP15_64] = kvm_handle_cp15_64,
@@ -162,13 +174,6 @@ static exit_handle_fn kvm_get_exit_handler(struct kvm_vcpu *vcpu) · 20 unmodified lines
162174 u32 hsr = kvm_vcpu_get_hsr(vcpu);
163175 u8 hsr_ec = ESR_ELx_EC(hsr);
164176
165− if (hsr_ec >= ARRAY_SIZE(arm_exit_handlers) ||
166− !arm_exit_handlers[hsr_ec]) {
167− kvm_err("Unknown exception class: hsr: %#08x -- %s\n",
168− hsr, esr_get_class_string(hsr));
169− BUG();
170− }
171−
172177 return arm_exit_handlers[hsr_ec];
173178 }
174179
arch/arm64/kvm/hyp/tlb.c+55−9
@@ -18,14 +18,62 @@ · 17 unmodified lines
1818 #include <asm/kvm_hyp.h>
1919 #include <asm/tlbflush.h>
2020
21+static void __hyp_text __tlb_switch_to_guest_vhe(struct kvm *kvm)
22+{
23+ u64 val;
24+
25+ /*
26+ * With VHE enabled, we have HCR_EL2.{E2H,TGE} = {1,1}, and
27+ * most TLB operations target EL2/EL0. In order to affect the
28+ * guest TLBs (EL1/EL0), we need to change one of these two
29+ * bits. Changing E2H is impossible (goodbye TTBR1_EL2), so
30+ * let's flip TGE before executing the TLB operation.
31+ */
32+ write_sysreg(kvm->arch.vttbr, vttbr_el2);
33+ val = read_sysreg(hcr_el2);
34+ val &= ~HCR_TGE;
35+ write_sysreg(val, hcr_el2);
36+ isb();
37+}
38+
39+static void __hyp_text __tlb_switch_to_guest_nvhe(struct kvm *kvm)
40+{
41+ write_sysreg(kvm->arch.vttbr, vttbr_el2);
42+ isb();
43+}
44+
45+static hyp_alternate_select(__tlb_switch_to_guest,
46+ __tlb_switch_to_guest_nvhe,
47+ __tlb_switch_to_guest_vhe,
48+ ARM64_HAS_VIRT_HOST_EXTN);
49+
50+static void __hyp_text __tlb_switch_to_host_vhe(struct kvm *kvm)
51+{
52+ /*
53+ * We're done with the TLB operation, let's restore the host's
54+ * view of HCR_EL2.
55+ */
56+ write_sysreg(0, vttbr_el2);
57+ write_sysreg(HCR_HOST_VHE_FLAGS, hcr_el2);
58+}
59+
60+static void __hyp_text __tlb_switch_to_host_nvhe(struct kvm *kvm)
61+{
62+ write_sysreg(0, vttbr_el2);
63+}
64+
65+static hyp_alternate_select(__tlb_switch_to_host,
66+ __tlb_switch_to_host_nvhe,
67+ __tlb_switch_to_host_vhe,
68+ ARM64_HAS_VIRT_HOST_EXTN);
69+
2170 void __hyp_text __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa)
2271 {
2372 dsb(ishst);
2473
2574 /* Switch to requested VMID */
2675 kvm = kern_hyp_va(kvm);
27− write_sysreg(kvm->arch.vttbr, vttbr_el2);
28− isb();
76+ __tlb_switch_to_guest()(kvm);
2977
3078 /*
3179 * We could do so much better if we had the VA as well.
@@ -46,7 +94,7 @@ void __hyp_text __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa) · 14 unmodified lines
4694 dsb(ish);
4795 isb();
4896
49− write_sysreg(0, vttbr_el2);
97+ __tlb_switch_to_host()(kvm);
5098 }
5199
52100 void __hyp_text __kvm_tlb_flush_vmid(struct kvm *kvm)
@@ -55,14 +103,13 @@ void __hyp_text __kvm_tlb_flush_vmid(struct kvm *kvm) · 2 unmodified lines
55103
56104 /* Switch to requested VMID */
57105 kvm = kern_hyp_va(kvm);
58− write_sysreg(kvm->arch.vttbr, vttbr_el2);
59− isb();
106+ __tlb_switch_to_guest()(kvm);
60107
61108 __tlbi(vmalls12e1is);
62109 dsb(ish);
63110 isb();
64111
65− write_sysreg(0, vttbr_el2);
112+ __tlb_switch_to_host()(kvm);
66113 }
67114
68115 void __hyp_text __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu)
@@ -70,14 +117,13 @@ void __hyp_text __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu) · 1 unmodified line
70117 struct kvm *kvm = kern_hyp_va(kern_hyp_va(vcpu)->kvm);
71118
72119 /* Switch to requested VMID */
73− write_sysreg(kvm->arch.vttbr, vttbr_el2);
74− isb();
120+ __tlb_switch_to_guest()(kvm);
75121
76122 __tlbi(vmalle1);
77123 dsb(nsh);
78124 isb();
79125
80− write_sysreg(0, vttbr_el2);
126+ __tlb_switch_to_host()(kvm);
81127 }
82128
83129 void __hyp_text __kvm_flush_vm_context(void)
arch/avr32/include/asm/pgtable-2level.h+1−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #ifndef __ASM_AVR32_PGTABLE_2LEVEL_H
99 #define __ASM_AVR32_PGTABLE_2LEVEL_H
1010
11+#define __ARCH_USE_5LEVEL_HACK
1112 #include <asm-generic/pgtable-nopmd.h>
1213
1314 /*
arch/avr32/oprofile/backtrace.c+1−1
@@ -14,7 +14,7 @@ · 13 unmodified lines
1414 */
1515
1616 #include <linux/oprofile.h>
17−#include <linux/sched.h>
17+#include <linux/ptrace.h>
1818 #include <linux/uaccess.h>
1919
2020 /* The first two words of each frame on the stack look like this if we have
arch/cris/arch-v32/drivers/cryptocop.c+1−1
@@ -2086,7 +2086,7 @@ static void cryptocop_job_queue_close(void) · 2085 unmodified lines
20862086 dma_in_cfg.en = regk_dma_no;
20872087 REG_WR(dma, IN_DMA_INST, rw_cfg, dma_in_cfg);
20882088
2089− /* Disble the cryptocop. */
2089+ /* Disable the cryptocop. */
20902090 rw_cfg = REG_RD(strcop, regi_strcop, rw_cfg);
20912091 rw_cfg.en = 0;
20922092 REG_WR(strcop, regi_strcop, rw_cfg, rw_cfg);
arch/cris/include/asm/pgtable.h+1−0
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 #define _CRIS_PGTABLE_H
77
88 #include <asm/page.h>
9+#define __ARCH_USE_5LEVEL_HACK
910 #include <asm-generic/pgtable-nopmd.h>
1011
1112 #ifndef __ASSEMBLY__
arch/frv/include/asm/pgtable.h+1−0
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #ifndef _ASM_PGTABLE_H
1717 #define _ASM_PGTABLE_H
1818
19+#include <asm-generic/5level-fixup.h>
1920 #include <asm/mem-layout.h>
2021 #include <asm/setup.h>
2122 #include <asm/processor.h>
arch/h8300/include/asm/pgtable.h+1−0
@@ -1,5 +1,6 @@
11 #ifndef _H8300_PGTABLE_H
22 #define _H8300_PGTABLE_H
3+#define __ARCH_USE_5LEVEL_HACK
34 #include <asm-generic/pgtable-nopud.h>
45 #include <asm-generic/pgtable.h>
56 #define pgtable_cache_init() do { } while (0)
arch/h8300/kernel/ptrace_h.c+1−1
@@ -9,7 +9,7 @@ · 8 unmodified lines
99 */
1010
1111 #include <linux/linkage.h>
12−#include <linux/sched.h>
12+#include <linux/sched/signal.h>
1313 #include <asm/ptrace.h>
1414
1515 #define BREAKINST 0x5730 /* trapa #3 */
arch/hexagon/include/asm/pgtable.h+1−0
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 */
2727 #include <linux/swap.h>
2828 #include <asm/page.h>
29+#define __ARCH_USE_5LEVEL_HACK
2930 #include <asm-generic/pgtable-nopmd.h>
3031
3132 /* A handy thing to have if one has the RAM. Declared in head.S */
arch/ia64/include/asm/pgtable.h+2−0
@@ -587,8 +587,10 @@ extern struct page *zero_page_memmap_ptr; · 586 unmodified lines
587587
588588
589589 #if CONFIG_PGTABLE_LEVELS == 3
590+#define __ARCH_USE_5LEVEL_HACK
590591 #include <asm-generic/pgtable-nopud.h>
591592 #endif
593+#include <asm-generic/5level-fixup.h>
592594 #include <asm-generic/pgtable.h>
593595
594596 #endif /* _ASM_IA64_PGTABLE_H */
arch/metag/include/asm/pgtable.h+1−0
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 #define _METAG_PGTABLE_H
77
88 #include <asm/pgtable-bits.h>
9+#define __ARCH_USE_5LEVEL_HACK
910 #include <asm-generic/pgtable-nopmd.h>
1011
1112 /* Invalid regions on Meta: 0x00000000-0x001FFFFF and 0xFFFF0000-0xFFFFFFFF */
arch/microblaze/include/asm/page.h+2−1
@@ -95,7 +95,8 @@ typedef struct { unsigned long pgd; } pgd_t; · 94 unmodified lines
9595 # else /* CONFIG_MMU */
9696 typedef struct { unsigned long ste[64]; } pmd_t;
9797 typedef struct { pmd_t pue[1]; } pud_t;
98−typedef struct { pud_t pge[1]; } pgd_t;
98+typedef struct { pud_t p4e[1]; } p4d_t;
99+typedef struct { p4d_t pge[1]; } pgd_t;
99100 # endif /* CONFIG_MMU */
100101
101102 # define pte_val(x) ((x).pte)
arch/mips/cavium-octeon/cpu.c+2−0
@@ -10,7 +10,9 @@ · 9 unmodified lines
1010 #include <linux/irqflags.h>
1111 #include <linux/notifier.h>
1212 #include <linux/prefetch.h>
13+#include <linux/ptrace.h>
1314 #include <linux/sched.h>
15+#include <linux/sched/task_stack.h>
1416
1517 #include <asm/cop2.h>
1618 #include <asm/current.h>
arch/mips/cavium-octeon/crypto/octeon-crypto.c+1−0
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 #include <asm/cop2.h>
1010 #include <linux/export.h>
1111 #include <linux/interrupt.h>
12+#include <linux/sched/task_stack.h>
1213
1314 #include "octeon-crypto.h"
1415
arch/mips/cavium-octeon/smp.c+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #include <linux/kernel_stat.h>
1313 #include <linux/sched.h>
1414 #include <linux/sched/hotplug.h>
15+#include <linux/sched/task_stack.h>
1516 #include <linux/init.h>
1617 #include <linux/export.h>
1718
arch/mips/include/asm/fpu.h+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212
1313 #include <linux/sched.h>
1414 #include <linux/sched/task_stack.h>
15+#include <linux/ptrace.h>
1516 #include <linux/thread_info.h>
1617 #include <linux/bitops.h>
1718
arch/mips/include/asm/pgtable-32.h+1−0
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #include <asm/cachectl.h>
1717 #include <asm/fixmap.h>
1818
19+#define __ARCH_USE_5LEVEL_HACK
1920 #include <asm-generic/pgtable-nopmd.h>
2021
2122 extern int temp_tlb_entry;
arch/mips/include/asm/pgtable-64.h+1−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <asm/cachectl.h>
1818 #include <asm/fixmap.h>
1919
20+#define __ARCH_USE_5LEVEL_HACK
2021 #if defined(CONFIG_PAGE_SIZE_64KB) && !defined(CONFIG_MIPS_VA_BITS_48)
2122 #include <asm-generic/pgtable-nopmd.h>
2223 #else
arch/mips/kernel/smp-bmips.c+1−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #include <linux/init.h>
1212 #include <linux/sched.h>
1313 #include <linux/sched/hotplug.h>
14+#include <linux/sched/task_stack.h>
1415 #include <linux/mm.h>
1516 #include <linux/delay.h>
1617 #include <linux/smp.h>
arch/mips/kernel/smp-mt.c+1−0
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323 #include <linux/interrupt.h>
2424 #include <linux/irqchip/mips-gic.h>
2525 #include <linux/compiler.h>
26+#include <linux/sched/task_stack.h>
2627 #include <linux/smp.h>
2728
2829 #include <linux/atomic.h>
arch/mips/loongson64/loongson-3/cop2-ex.c+1−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/init.h>
1414 #include <linux/sched.h>
1515 #include <linux/notifier.h>
16+#include <linux/ptrace.h>
1617
1718 #include <asm/fpu.h>
1819 #include <asm/cop2.h>
arch/mips/netlogic/common/smp.c+1−0
@@ -35,6 +35,7 @@ · 34 unmodified lines
3535 #include <linux/kernel.h>
3636 #include <linux/delay.h>
3737 #include <linux/init.h>
38+#include <linux/sched/task_stack.h>
3839 #include <linux/smp.h>
3940 #include <linux/irq.h>
4041
arch/mips/netlogic/xlp/cop2-ex.c+3−0
@@ -9,11 +9,14 @@ · 8 unmodified lines
99 * Copyright (C) 2009 Wind River Systems,
1010 * written by Ralf Baechle <ralf@linux-mips.org>
1111 */
12+#include <linux/capability.h>
1213 #include <linux/init.h>
1314 #include <linux/irqflags.h>
1415 #include <linux/notifier.h>
1516 #include <linux/prefetch.h>
17+#include <linux/ptrace.h>
1618 #include <linux/sched.h>
19+#include <linux/sched/task_stack.h>
1720
1821 #include <asm/cop2.h>
1922 #include <asm/current.h>
arch/mips/sgi-ip22/ip28-berr.c+1−0
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 #include <linux/kernel.h>
1010 #include <linux/sched.h>
1111 #include <linux/sched/debug.h>
12+#include <linux/sched/signal.h>
1213 #include <linux/seq_file.h>
1314
1415 #include <asm/addrspace.h>
arch/mips/sgi-ip27/ip27-berr.c+2−0
@@ -12,7 +12,9 @@ · 11 unmodified lines
1212 #include <linux/signal.h> /* for SIGBUS */
1313 #include <linux/sched.h> /* schow_regs(), force_sig() */
1414 #include <linux/sched/debug.h>
15+#include <linux/sched/signal.h>
1516
17+#include <asm/ptrace.h>
1618 #include <asm/sn/addrs.h>
1719 #include <asm/sn/arch.h>
1820 #include <asm/sn/sn0/hub.h>
arch/mips/sgi-ip27/ip27-smp.c+3−0
@@ -8,10 +8,13 @@ · 7 unmodified lines
88 */
99 #include <linux/init.h>
1010 #include <linux/sched.h>
11+#include <linux/sched/task_stack.h>
1112 #include <linux/topology.h>
1213 #include <linux/nodemask.h>
14+
1315 #include <asm/page.h>
1416 #include <asm/processor.h>
17+#include <asm/ptrace.h>
1518 #include <asm/sn/arch.h>
1619 #include <asm/sn/gda.h>
1720 #include <asm/sn/intr.h>
arch/mips/sgi-ip32/ip32-berr.c+1−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #include <linux/kernel.h>
1212 #include <linux/sched.h>
1313 #include <linux/sched/debug.h>
14+#include <linux/sched/signal.h>
1415 #include <asm/traps.h>
1516 #include <linux/uaccess.h>
1617 #include <asm/addrspace.h>
arch/mips/sgi-ip32/ip32-reset.c+1−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/kernel.h>
1414 #include <linux/module.h>
1515 #include <linux/sched.h>
16+#include <linux/sched/signal.h>
1617 #include <linux/notifier.h>
1718 #include <linux/delay.h>
1819 #include <linux/rtc/ds1685.h>
arch/mn10300/include/asm/page.h+1−0
@@ -57,6 +57,7 @@ typedef struct page *pgtable_t; · 56 unmodified lines
5757 #define __pgd(x) ((pgd_t) { (x) })
5858 #define __pgprot(x) ((pgprot_t) { (x) })
5959
60+#define __ARCH_USE_5LEVEL_HACK
6061 #include <asm-generic/pgtable-nopmd.h>
6162
6263 #endif /* !__ASSEMBLY__ */
arch/nios2/include/asm/pgtable.h+1−0
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #include <asm/tlbflush.h>
2323
2424 #include <asm/pgtable-bits.h>
25+#define __ARCH_USE_5LEVEL_HACK
2526 #include <asm-generic/pgtable-nopmd.h>
2627
2728 #define FIRST_USER_ADDRESS 0UL
arch/openrisc/include/asm/pgtable.h+1−0
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525 #ifndef __ASM_OPENRISC_PGTABLE_H
2626 #define __ASM_OPENRISC_PGTABLE_H
2727
28+#define __ARCH_USE_5LEVEL_HACK
2829 #include <asm-generic/pgtable-nopmd.h>
2930
3031 #ifndef __ASSEMBLY__
arch/powerpc/Kconfig+72−66
@@ -80,93 +80,99 @@ config ARCH_HAS_DMA_SET_COHERENT_MASK · 79 unmodified lines
8080 config PPC
8181 bool
8282 default y
83− select BUILDTIME_EXTABLE_SORT
83+ #
84+ # Please keep this list sorted alphabetically.
85+ #
86+ select ARCH_HAS_DEVMEM_IS_ALLOWED
87+ select ARCH_HAS_DMA_SET_COHERENT_MASK
88+ select ARCH_HAS_ELF_RANDOMIZE
89+ select ARCH_HAS_GCOV_PROFILE_ALL
90+ select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE
91+ select ARCH_HAS_SG_CHAIN
92+ select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
93+ select ARCH_HAS_UBSAN_SANITIZE_ALL
94+ select ARCH_HAVE_NMI_SAFE_CMPXCHG
8495 select ARCH_MIGHT_HAVE_PC_PARPORT
8596 select ARCH_MIGHT_HAVE_PC_SERIO
97+ select ARCH_SUPPORTS_ATOMIC_RMW
98+ select ARCH_SUPPORTS_DEFERRED_STRUCT_PAGE_INIT
99+ select ARCH_USE_BUILTIN_BSWAP
100+ select ARCH_USE_CMPXCHG_LOCKREF if PPC64
101+ select ARCH_WANT_IPC_PARSE_VERSION
86102 select BINFMT_ELF
87− select ARCH_HAS_ELF_RANDOMIZE
88− select OF
89− select OF_EARLY_FLATTREE
90− select OF_RESERVED_MEM
91− select HAVE_FTRACE_MCOUNT_RECORD
103+ select BUILDTIME_EXTABLE_SORT
104+ select CLONE_BACKWARDS
105+ select DCACHE_WORD_ACCESS if PPC64 && CPU_LITTLE_ENDIAN
106+ select EDAC_ATOMIC_SCRUB
107+ select EDAC_SUPPORT
108+ select GENERIC_ATOMIC64 if PPC32
109+ select GENERIC_CLOCKEVENTS
110+ select GENERIC_CLOCKEVENTS_BROADCAST if SMP
111+ select GENERIC_CMOS_UPDATE
112+ select GENERIC_CPU_AUTOPROBE
113+ select GENERIC_IRQ_SHOW
114+ select GENERIC_IRQ_SHOW_LEVEL
115+ select GENERIC_SMP_IDLE_THREAD
116+ select GENERIC_STRNCPY_FROM_USER
117+ select GENERIC_STRNLEN_USER
118+ select GENERIC_TIME_VSYSCALL_OLD
119+ select HAVE_ARCH_AUDITSYSCALL
120+ select HAVE_ARCH_HARDENED_USERCOPY
121+ select HAVE_ARCH_JUMP_LABEL
122+ select HAVE_ARCH_KGDB
123+ select HAVE_ARCH_SECCOMP_FILTER
124+ select HAVE_ARCH_TRACEHOOK
125+ select HAVE_CBPF_JIT if !PPC64
126+ select HAVE_CONTEXT_TRACKING if PPC64
127+ select HAVE_DEBUG_KMEMLEAK
128+ select HAVE_DEBUG_STACKOVERFLOW
129+ select HAVE_DMA_API_DEBUG
92130 select HAVE_DYNAMIC_FTRACE
93− select HAVE_DYNAMIC_FTRACE_WITH_REGS if MPROFILE_KERNEL
94− select HAVE_FUNCTION_TRACER
131+ select HAVE_DYNAMIC_FTRACE_WITH_REGS if MPROFILE_KERNEL
132+ select HAVE_EBPF_JIT if PPC64
133+ select HAVE_EFFICIENT_UNALIGNED_ACCESS if !(CPU_LITTLE_ENDIAN && POWER7_CPU)
134+ select HAVE_FTRACE_MCOUNT_RECORD
95135 select HAVE_FUNCTION_GRAPH_TRACER
136+ select HAVE_FUNCTION_TRACER
96137 select HAVE_GCC_PLUGINS
97− select SYSCTL_EXCEPTION_TRACE
98− select VIRT_TO_BUS if !PPC64
138+ select HAVE_GENERIC_RCU_GUP
139+ select HAVE_HW_BREAKPOINT if PERF_EVENTS && (PPC_BOOK3S || PPC_8xx)
99140 select HAVE_IDE
100141 select HAVE_IOREMAP_PROT
101− select HAVE_EFFICIENT_UNALIGNED_ACCESS if !(CPU_LITTLE_ENDIAN && POWER7_CPU)
142+ select HAVE_IRQ_EXIT_ON_IRQ_STACK
143+ select HAVE_KERNEL_GZIP
102144 select HAVE_KPROBES
103− select HAVE_OPTPROBES if PPC64
104− select HAVE_ARCH_KGDB
105145 select HAVE_KRETPROBES
106− select HAVE_ARCH_TRACEHOOK
146+ select HAVE_LIVEPATCH if HAVE_DYNAMIC_FTRACE_WITH_REGS
107147 select HAVE_MEMBLOCK
108148 select HAVE_MEMBLOCK_NODE_MAP
109− select HAVE_DMA_API_DEBUG
149+ select HAVE_MOD_ARCH_SPECIFIC
150+ select HAVE_NMI if PERF_EVENTS
110151 select HAVE_OPROFILE
111− select HAVE_DEBUG_KMEMLEAK
112− select ARCH_HAS_SG_CHAIN
113− select GENERIC_ATOMIC64 if PPC32
152+ select HAVE_OPTPROBES if PPC64
114153 select HAVE_PERF_EVENTS
154+ select HAVE_PERF_EVENTS_NMI if PPC64
115155 select HAVE_PERF_REGS
116156 select HAVE_PERF_USER_STACK_DUMP
157+ select HAVE_RCU_TABLE_FREE if SMP
117158 select HAVE_REGS_AND_STACK_ACCESS_API
118− select HAVE_HW_BREAKPOINT if PERF_EVENTS && (PPC_BOOK3S || PPC_8xx)
119− select ARCH_WANT_IPC_PARSE_VERSION
120− select SPARSE_IRQ
159+ select HAVE_SYSCALL_TRACEPOINTS
160+ select HAVE_VIRT_CPU_ACCOUNTING
121161 select IRQ_DOMAIN
122− select GENERIC_IRQ_SHOW
123− select GENERIC_IRQ_SHOW_LEVEL
124162 select IRQ_FORCED_THREADING
125− select HAVE_RCU_TABLE_FREE if SMP
126− select HAVE_SYSCALL_TRACEPOINTS
127− select HAVE_CBPF_JIT if !PPC64
128− select HAVE_EBPF_JIT if PPC64
129− select HAVE_ARCH_JUMP_LABEL
130− select ARCH_HAVE_NMI_SAFE_CMPXCHG
131− select ARCH_HAS_GCOV_PROFILE_ALL
132− select GENERIC_SMP_IDLE_THREAD
133− select GENERIC_CMOS_UPDATE
134− select GENERIC_TIME_VSYSCALL_OLD
135− select GENERIC_CLOCKEVENTS
136− select GENERIC_CLOCKEVENTS_BROADCAST if SMP
137− select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
138− select GENERIC_STRNCPY_FROM_USER
139− select GENERIC_STRNLEN_USER
140− select HAVE_MOD_ARCH_SPECIFIC
141163 select MODULES_USE_ELF_RELA
142− select CLONE_BACKWARDS
143− select ARCH_USE_BUILTIN_BSWAP
144− select OLD_SIGSUSPEND
145− select OLD_SIGACTION if PPC32
146− select HAVE_DEBUG_STACKOVERFLOW
147− select HAVE_IRQ_EXIT_ON_IRQ_STACK
148− select ARCH_USE_CMPXCHG_LOCKREF if PPC64
149− select HAVE_ARCH_AUDITSYSCALL
150− select ARCH_SUPPORTS_ATOMIC_RMW
151− select DCACHE_WORD_ACCESS if PPC64 && CPU_LITTLE_ENDIAN
152164 select NO_BOOTMEM
153− select HAVE_GENERIC_RCU_GUP
154− select HAVE_PERF_EVENTS_NMI if PPC64
155− select HAVE_NMI if PERF_EVENTS
156− select EDAC_SUPPORT
157− select EDAC_ATOMIC_SCRUB
158− select ARCH_HAS_DMA_SET_COHERENT_MASK
159− select ARCH_HAS_DEVMEM_IS_ALLOWED
160− select HAVE_ARCH_SECCOMP_FILTER
161− select ARCH_HAS_UBSAN_SANITIZE_ALL
162− select ARCH_SUPPORTS_DEFERRED_STRUCT_PAGE_INIT
163− select HAVE_LIVEPATCH if HAVE_DYNAMIC_FTRACE_WITH_REGS
164− select GENERIC_CPU_AUTOPROBE
165− select HAVE_VIRT_CPU_ACCOUNTING
166− select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE
167− select HAVE_ARCH_HARDENED_USERCOPY
168− select HAVE_KERNEL_GZIP
169− select HAVE_CONTEXT_TRACKING if PPC64
165+ select OF
166+ select OF_EARLY_FLATTREE
167+ select OF_RESERVED_MEM
168+ select OLD_SIGACTION if PPC32
169+ select OLD_SIGSUSPEND
170+ select SPARSE_IRQ
171+ select SYSCTL_EXCEPTION_TRACE
172+ select VIRT_TO_BUS if !PPC64
173+ #
174+ # Please keep this list sorted alphabetically.
175+ #
170176
171177 config GENERIC_CSUM
172178 def_bool n
arch/powerpc/Makefile+10−1
@@ -72,8 +72,15 @@ GNUTARGET := powerpc · 71 unmodified lines
7272 MULTIPLEWORD := -mmultiple
7373 endif
7474
75−cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian)
75+ifdef CONFIG_PPC64
76+cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mabi=elfv1)
77+cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mcall-aixdesc)
78+aflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mabi=elfv1)
79+aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mabi=elfv2
80+endif
81+
7682 cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian
83+cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian)
7784 ifneq ($(cc-name),clang)
7885 cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mno-strict-align
7986 endif
@@ -113,7 +120,9 @@ ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y) · 33 unmodified lines
113120 CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc))
114121 AFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2)
115122 else
123+CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv1)
116124 CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcall-aixdesc)
125+AFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv1)
117126 endif
118127 CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,$(call cc-option,-mminimal-toc))
119128 CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions)
arch/powerpc/boot/zImage.lds.S+1−0
@@ -68,6 +68,7 @@ SECTIONS · 67 unmodified lines
6868 }
6969
7070 #ifdef CONFIG_PPC64_BOOT_WRAPPER
71+ . = ALIGN(256);
7172 .got :
7273 {
7374 __toc_start = .;
arch/powerpc/crypto/crc32c-vpmsum_glue.c+1−1
@@ -52,7 +52,7 @@ static int crc32c_vpmsum_cra_init(struct crypto_tfm *tfm) · 51 unmodified lines
5252 {
5353 u32 *key = crypto_tfm_ctx(tfm);
5454
55− *key = 0;
55+ *key = ~0;
5656
5757 return 0;
5858 }
arch/powerpc/include/asm/bitops.h+4−0
@@ -51,6 +51,10 @@ · 50 unmodified lines
5151 #define PPC_BIT(bit) (1UL << PPC_BITLSHIFT(bit))
5252 #define PPC_BITMASK(bs, be) ((PPC_BIT(bs) - PPC_BIT(be)) | PPC_BIT(bs))
5353
54+/* Put a PPC bit into a "normal" bit position */
55+#define PPC_BITEXTRACT(bits, ppc_bit, dst_bit) \
56+ ((((bits) >> PPC_BITLSHIFT(ppc_bit)) & 1) << (dst_bit))
57+
5458 #include <asm/barrier.h>
5559
5660 /* Macro for generating the ***_bits() functions */
arch/powerpc/include/asm/book3s/32/pgtable.h+1−0
@@ -1,6 +1,7 @@
11 #ifndef _ASM_POWERPC_BOOK3S_32_PGTABLE_H
22 #define _ASM_POWERPC_BOOK3S_32_PGTABLE_H
33
4+#define __ARCH_USE_5LEVEL_HACK
45 #include <asm-generic/pgtable-nopmd.h>
56
67 #include <asm/book3s/32/hash.h>
arch/powerpc/include/asm/book3s/64/pgtable.h+58−30
@@ -1,9 +1,12 @@
11 #ifndef _ASM_POWERPC_BOOK3S_64_PGTABLE_H_
22 #define _ASM_POWERPC_BOOK3S_64_PGTABLE_H_
33
4+#include <asm-generic/5level-fixup.h>
5+
46 #ifndef __ASSEMBLY__
57 #include <linux/mmdebug.h>
68 #endif
9+
710 /*
811 * Common bits between hash and Radix page table
912 */
@@ -347,23 +350,58 @@ static inline int __ptep_test_and_clear_young(struct mm_struct *mm, · 337 unmodified lines
347350 __r; \
348351 })
349352
353+static inline int __pte_write(pte_t pte)
354+{
355+ return !!(pte_raw(pte) & cpu_to_be64(_PAGE_WRITE));
356+}
357+
358+#ifdef CONFIG_NUMA_BALANCING
359+#define pte_savedwrite pte_savedwrite
360+static inline bool pte_savedwrite(pte_t pte)
361+{
362+ /*
363+ * Saved write ptes are prot none ptes that doesn't have
364+ * privileged bit sit. We mark prot none as one which has
365+ * present and pviliged bit set and RWX cleared. To mark
366+ * protnone which used to have _PAGE_WRITE set we clear
367+ * the privileged bit.
368+ */
369+ return !(pte_raw(pte) & cpu_to_be64(_PAGE_RWX | _PAGE_PRIVILEGED));
370+}
371+#else
372+#define pte_savedwrite pte_savedwrite
373+static inline bool pte_savedwrite(pte_t pte)
374+{
375+ return false;
376+}
377+#endif
378+
379+static inline int pte_write(pte_t pte)
380+{
381+ return __pte_write(pte) || pte_savedwrite(pte);
382+}
383+
350384 #define __HAVE_ARCH_PTEP_SET_WRPROTECT
351385 static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
352386 pte_t *ptep)
353387 {
354− if ((pte_raw(*ptep) & cpu_to_be64(_PAGE_WRITE)) == 0)
355− return;
356−
357− pte_update(mm, addr, ptep, _PAGE_WRITE, 0, 0);
388+ if (__pte_write(*ptep))
389+ pte_update(mm, addr, ptep, _PAGE_WRITE, 0, 0);
390+ else if (unlikely(pte_savedwrite(*ptep)))
391+ pte_update(mm, addr, ptep, 0, _PAGE_PRIVILEGED, 0);
358392 }
359393
360394 static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
361395 unsigned long addr, pte_t *ptep)
362396 {
363− if ((pte_raw(*ptep) & cpu_to_be64(_PAGE_WRITE)) == 0)
364− return;
365−
366− pte_update(mm, addr, ptep, _PAGE_WRITE, 0, 1);
397+ /*
398+ * We should not find protnone for hugetlb, but this complete the
399+ * interface.
400+ */
401+ if (__pte_write(*ptep))
402+ pte_update(mm, addr, ptep, _PAGE_WRITE, 0, 1);
403+ else if (unlikely(pte_savedwrite(*ptep)))
404+ pte_update(mm, addr, ptep, 0, _PAGE_PRIVILEGED, 1);
367405 }
368406
369407 #define __HAVE_ARCH_PTEP_GET_AND_CLEAR
@@ -397,11 +435,6 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, · 27 unmodified lines
397435 pte_update(mm, addr, ptep, ~0UL, 0, 0);
398436 }
399437
400−static inline int pte_write(pte_t pte)
401−{
402− return !!(pte_raw(pte) & cpu_to_be64(_PAGE_WRITE));
403−}
404−
405438 static inline int pte_dirty(pte_t pte)
406439 {
407440 return !!(pte_raw(pte) & cpu_to_be64(_PAGE_DIRTY));
@@ -465,19 +498,12 @@ static inline pte_t pte_clear_savedwrite(pte_t pte) · 57 unmodified lines
465498 VM_BUG_ON(!pte_protnone(pte));
466499 return __pte(pte_val(pte) | _PAGE_PRIVILEGED);
467500 }
468−
469−#define pte_savedwrite pte_savedwrite
470−static inline bool pte_savedwrite(pte_t pte)
501+#else
502+#define pte_clear_savedwrite pte_clear_savedwrite
503+static inline pte_t pte_clear_savedwrite(pte_t pte)
471504 {
472− /*
473− * Saved write ptes are prot none ptes that doesn't have
474− * privileged bit sit. We mark prot none as one which has
475− * present and pviliged bit set and RWX cleared. To mark
476− * protnone which used to have _PAGE_WRITE set we clear
477− * the privileged bit.
478− */
479− VM_BUG_ON(!pte_protnone(pte));
480− return !(pte_raw(pte) & cpu_to_be64(_PAGE_RWX | _PAGE_PRIVILEGED));
505+ VM_WARN_ON(1);
506+ return __pte(pte_val(pte) & ~_PAGE_WRITE);
481507 }
482508 #endif /* CONFIG_NUMA_BALANCING */
483509
@@ -506,6 +532,8 @@ static inline unsigned long pte_pfn(pte_t pte) · 22 unmodified lines
506532 /* Generic modifiers for PTE bits */
507533 static inline pte_t pte_wrprotect(pte_t pte)
508534 {
535+ if (unlikely(pte_savedwrite(pte)))
536+ return pte_clear_savedwrite(pte);
509537 return __pte(pte_val(pte) & ~_PAGE_WRITE);
510538 }
511539
@@ -926,6 +954,7 @@ static inline int pmd_protnone(pmd_t pmd) · 414 unmodified lines
926954
927955 #define __HAVE_ARCH_PMD_WRITE
928956 #define pmd_write(pmd) pte_write(pmd_pte(pmd))
957+#define __pmd_write(pmd) __pte_write(pmd_pte(pmd))
929958 #define pmd_savedwrite(pmd) pte_savedwrite(pmd_pte(pmd))
930959
931960 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
@@ -982,11 +1011,10 @@ static inline int __pmdp_test_and_clear_young(struct mm_struct *mm, · 50 unmodified lines
9821011 static inline void pmdp_set_wrprotect(struct mm_struct *mm, unsigned long addr,
9831012 pmd_t *pmdp)
9841013 {
985−
986− if ((pmd_raw(*pmdp) & cpu_to_be64(_PAGE_WRITE)) == 0)
987− return;
988−
989− pmd_hugepage_update(mm, addr, pmdp, _PAGE_WRITE, 0);
1014+ if (__pmd_write((*pmdp)))
1015+ pmd_hugepage_update(mm, addr, pmdp, _PAGE_WRITE, 0);
1016+ else if (unlikely(pmd_savedwrite(*pmdp)))
1017+ pmd_hugepage_update(mm, addr, pmdp, 0, _PAGE_PRIVILEGED);
9901018 }
9911019
9921020 static inline int pmd_trans_huge(pmd_t pmd)
arch/powerpc/include/asm/checksum.h+1−1
@@ -112,7 +112,7 @@ static inline __wsum csum_add(__wsum csum, __wsum addend) · 111 unmodified lines
112112
113113 #ifdef __powerpc64__
114114 res += (__force u64)addend;
115− return (__force __wsum)((u32)res + (res >> 32));
115+ return (__force __wsum) from64to32(res);
116116 #else
117117 asm("addc %0,%0,%1;"
118118 "addze %0,%0;"
arch/powerpc/include/asm/cpuidle.h+2−2
@@ -70,8 +70,8 @@ static inline void report_invalid_psscr_val(u64 psscr_val, int err) · 69 unmodified lines
7070 std r0,0(r1); \
7171 ptesync; \
7272 ld r0,0(r1); \
73−1: cmpd cr0,r0,r0; \
74− bne 1b; \
73+236: cmpd cr0,r0,r0; \
74+ bne 236b; \
7575 IDLE_INST; \
7676
7777 #define IDLE_STATE_ENTER_SEQ_NORET(IDLE_INST) \
arch/powerpc/include/asm/elf.h+2−2
@@ -144,8 +144,8 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm, · 143 unmodified lines
144144 #define ARCH_DLINFO_CACHE_GEOMETRY \
145145 NEW_AUX_ENT(AT_L1I_CACHESIZE, ppc64_caches.l1i.size); \
146146 NEW_AUX_ENT(AT_L1I_CACHEGEOMETRY, get_cache_geometry(l1i)); \
147− NEW_AUX_ENT(AT_L1D_CACHESIZE, ppc64_caches.l1i.size); \
148− NEW_AUX_ENT(AT_L1D_CACHEGEOMETRY, get_cache_geometry(l1i)); \
147+ NEW_AUX_ENT(AT_L1D_CACHESIZE, ppc64_caches.l1d.size); \
148+ NEW_AUX_ENT(AT_L1D_CACHEGEOMETRY, get_cache_geometry(l1d)); \
149149 NEW_AUX_ENT(AT_L2_CACHESIZE, ppc64_caches.l2.size); \
150150 NEW_AUX_ENT(AT_L2_CACHEGEOMETRY, get_cache_geometry(l2)); \
151151 NEW_AUX_ENT(AT_L3_CACHESIZE, ppc64_caches.l3.size); \
arch/powerpc/include/asm/mce.h+107−1
@@ -66,6 +66,55 @@ · 65 unmodified lines
6666
6767 #define P8_DSISR_MC_SLB_ERRORS (P7_DSISR_MC_SLB_ERRORS | \
6868 P8_DSISR_MC_ERAT_MULTIHIT_SEC)
69+
70+/*
71+ * Machine Check bits on power9
72+ */
73+#define P9_SRR1_MC_LOADSTORE(srr1) (((srr1) >> PPC_BITLSHIFT(42)) & 1)
74+
75+#define P9_SRR1_MC_IFETCH(srr1) ( \
76+ PPC_BITEXTRACT(srr1, 45, 0) | \
77+ PPC_BITEXTRACT(srr1, 44, 1) | \
78+ PPC_BITEXTRACT(srr1, 43, 2) | \
79+ PPC_BITEXTRACT(srr1, 36, 3) )
80+
81+/* 0 is reserved */
82+#define P9_SRR1_MC_IFETCH_UE 1
83+#define P9_SRR1_MC_IFETCH_SLB_PARITY 2
84+#define P9_SRR1_MC_IFETCH_SLB_MULTIHIT 3
85+#define P9_SRR1_MC_IFETCH_ERAT_MULTIHIT 4
86+#define P9_SRR1_MC_IFETCH_TLB_MULTIHIT 5
87+#define P9_SRR1_MC_IFETCH_UE_TLB_RELOAD 6
88+/* 7 is reserved */
89+#define P9_SRR1_MC_IFETCH_LINK_TIMEOUT 8
90+#define P9_SRR1_MC_IFETCH_LINK_TABLEWALK_TIMEOUT 9
91+/* 10 ? */
92+#define P9_SRR1_MC_IFETCH_RA 11
93+#define P9_SRR1_MC_IFETCH_RA_TABLEWALK 12
94+#define P9_SRR1_MC_IFETCH_RA_ASYNC_STORE 13
95+#define P9_SRR1_MC_IFETCH_LINK_ASYNC_STORE_TIMEOUT 14
96+#define P9_SRR1_MC_IFETCH_RA_TABLEWALK_FOREIGN 15
97+
98+/* DSISR bits for machine check (On Power9) */
99+#define P9_DSISR_MC_UE (PPC_BIT(48))
100+#define P9_DSISR_MC_UE_TABLEWALK (PPC_BIT(49))
101+#define P9_DSISR_MC_LINK_LOAD_TIMEOUT (PPC_BIT(50))
102+#define P9_DSISR_MC_LINK_TABLEWALK_TIMEOUT (PPC_BIT(51))
103+#define P9_DSISR_MC_ERAT_MULTIHIT (PPC_BIT(52))
104+#define P9_DSISR_MC_TLB_MULTIHIT_MFTLB (PPC_BIT(53))
105+#define P9_DSISR_MC_USER_TLBIE (PPC_BIT(54))
106+#define P9_DSISR_MC_SLB_PARITY_MFSLB (PPC_BIT(55))
107+#define P9_DSISR_MC_SLB_MULTIHIT_MFSLB (PPC_BIT(56))
108+#define P9_DSISR_MC_RA_LOAD (PPC_BIT(57))
109+#define P9_DSISR_MC_RA_TABLEWALK (PPC_BIT(58))
110+#define P9_DSISR_MC_RA_TABLEWALK_FOREIGN (PPC_BIT(59))
111+#define P9_DSISR_MC_RA_FOREIGN (PPC_BIT(60))
112+
113+/* SLB error bits */
114+#define P9_DSISR_MC_SLB_ERRORS (P9_DSISR_MC_ERAT_MULTIHIT | \
115+ P9_DSISR_MC_SLB_PARITY_MFSLB | \
116+ P9_DSISR_MC_SLB_MULTIHIT_MFSLB)
117+
69118 enum MCE_Version {
70119 MCE_V1 = 1,
71120 };
@@ -93,6 +142,9 @@ enum MCE_ErrorType { · 21 unmodified lines
93142 MCE_ERROR_TYPE_SLB = 2,
94143 MCE_ERROR_TYPE_ERAT = 3,
95144 MCE_ERROR_TYPE_TLB = 4,
145+ MCE_ERROR_TYPE_USER = 5,
146+ MCE_ERROR_TYPE_RA = 6,
147+ MCE_ERROR_TYPE_LINK = 7,
96148 };
97149
98150 enum MCE_UeErrorType {
@@ -121,6 +173,32 @@ enum MCE_TlbErrorType { · 22 unmodified lines
121173 MCE_TLB_ERROR_MULTIHIT = 2,
122174 };
123175
176+enum MCE_UserErrorType {
177+ MCE_USER_ERROR_INDETERMINATE = 0,
178+ MCE_USER_ERROR_TLBIE = 1,
179+};
180+
181+enum MCE_RaErrorType {
182+ MCE_RA_ERROR_INDETERMINATE = 0,
183+ MCE_RA_ERROR_IFETCH = 1,
184+ MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH = 2,
185+ MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH_FOREIGN = 3,
186+ MCE_RA_ERROR_LOAD = 4,
187+ MCE_RA_ERROR_STORE = 5,
188+ MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE = 6,
189+ MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE_FOREIGN = 7,
190+ MCE_RA_ERROR_LOAD_STORE_FOREIGN = 8,
191+};
192+
193+enum MCE_LinkErrorType {
194+ MCE_LINK_ERROR_INDETERMINATE = 0,
195+ MCE_LINK_ERROR_IFETCH_TIMEOUT = 1,
196+ MCE_LINK_ERROR_PAGE_TABLE_WALK_IFETCH_TIMEOUT = 2,
197+ MCE_LINK_ERROR_LOAD_TIMEOUT = 3,
198+ MCE_LINK_ERROR_STORE_TIMEOUT = 4,
199+ MCE_LINK_ERROR_PAGE_TABLE_WALK_LOAD_STORE_TIMEOUT = 5,
200+};
201+
124202 struct machine_check_event {
125203 enum MCE_Version version:8; /* 0x00 */
126204 uint8_t in_use; /* 0x01 */
@@ -166,6 +244,30 @@ struct machine_check_event { · 39 unmodified lines
166244 uint64_t effective_address;
167245 uint8_t reserved_2[16];
168246 } tlb_error;
247+
248+ struct {
249+ enum MCE_UserErrorType user_error_type:8;
250+ uint8_t effective_address_provided;
251+ uint8_t reserved_1[6];
252+ uint64_t effective_address;
253+ uint8_t reserved_2[16];
254+ } user_error;
255+
256+ struct {
257+ enum MCE_RaErrorType ra_error_type:8;
258+ uint8_t effective_address_provided;
259+ uint8_t reserved_1[6];
260+ uint64_t effective_address;
261+ uint8_t reserved_2[16];
262+ } ra_error;
263+
264+ struct {
265+ enum MCE_LinkErrorType link_error_type:8;
266+ uint8_t effective_address_provided;
267+ uint8_t reserved_1[6];
268+ uint64_t effective_address;
269+ uint8_t reserved_2[16];
270+ } link_error;
169271 } u;
170272 };
171273
@@ -176,8 +278,12 @@ struct mce_error_info { · 4 unmodified lines
176278 enum MCE_SlbErrorType slb_error_type:8;
177279 enum MCE_EratErrorType erat_error_type:8;
178280 enum MCE_TlbErrorType tlb_error_type:8;
281+ enum MCE_UserErrorType user_error_type:8;
282+ enum MCE_RaErrorType ra_error_type:8;
283+ enum MCE_LinkErrorType link_error_type:8;
179284 } u;
180− uint8_t reserved[2];
285+ enum MCE_Severity severity:8;
286+ enum MCE_Initiator initiator:8;
181287 };
182288
183289 #define MAX_MC_EVT 100
arch/powerpc/include/asm/nohash/32/pgtable.h+1−0
@@ -1,6 +1,7 @@
11 #ifndef _ASM_POWERPC_NOHASH_32_PGTABLE_H
22 #define _ASM_POWERPC_NOHASH_32_PGTABLE_H
33
4+#define __ARCH_USE_5LEVEL_HACK
45 #include <asm-generic/pgtable-nopmd.h>
56
67 #ifndef __ASSEMBLY__
arch/powerpc/include/asm/nohash/64/pgtable-4k.h+3−0
@@ -1,5 +1,8 @@
11 #ifndef _ASM_POWERPC_NOHASH_64_PGTABLE_4K_H
22 #define _ASM_POWERPC_NOHASH_64_PGTABLE_4K_H
3+
4+#include <asm-generic/5level-fixup.h>
5+
36 /*
47 * Entries per page directory level. The PTE level must use a 64b record
58 * for each page table entry. The PMD and PGD level use a 32b record for
arch/powerpc/include/asm/nohash/64/pgtable-64k.h+1−0
@@ -1,6 +1,7 @@
11 #ifndef _ASM_POWERPC_NOHASH_64_PGTABLE_64K_H
22 #define _ASM_POWERPC_NOHASH_64_PGTABLE_64K_H
33
4+#define __ARCH_USE_5LEVEL_HACK
45 #include <asm-generic/pgtable-nopud.h>
56
67
arch/powerpc/include/asm/nohash/pgtable.h+1−1
@@ -230,7 +230,7 @@ static inline int hugepd_ok(hugepd_t hpd) · 229 unmodified lines
230230 return ((hpd_val(hpd) & 0x4) != 0);
231231 #else
232232 /* We clear the top bit to indicate hugepd */
233− return ((hpd_val(hpd) & PD_HUGE) == 0);
233+ return (hpd_val(hpd) && (hpd_val(hpd) & PD_HUGE) == 0);
234234 #endif
235235 }
236236
arch/powerpc/include/asm/ppc-opcode.h+7−0
@@ -284,6 +284,13 @@ · 283 unmodified lines
284284 #define PPC_INST_BRANCH_COND 0x40800000
285285 #define PPC_INST_LBZCIX 0x7c0006aa
286286 #define PPC_INST_STBCIX 0x7c0007aa
287+#define PPC_INST_LWZX 0x7c00002e
288+#define PPC_INST_LFSX 0x7c00042e
289+#define PPC_INST_STFSX 0x7c00052e
290+#define PPC_INST_LFDX 0x7c0004ae
291+#define PPC_INST_STFDX 0x7c0005ae
292+#define PPC_INST_LVX 0x7c0000ce
293+#define PPC_INST_STVX 0x7c0001ce
287294
288295 /* macros to insert fields into opcodes */
289296 #define ___PPC_RA(a) (((a) & 0x1f) << 16)
arch/powerpc/include/asm/prom.h+12−6
@@ -160,12 +160,18 @@ struct of_drconf_cell { · 159 unmodified lines
160160 #define OV5_PFO_HW_ENCR 0x1120 /* PFO Encryption Accelerator */
161161 #define OV5_SUB_PROCESSORS 0x1501 /* 1,2,or 4 Sub-Processors supported */
162162 #define OV5_XIVE_EXPLOIT 0x1701 /* XIVE exploitation supported */
163−#define OV5_MMU_RADIX_300 0x1880 /* ISA v3.00 radix MMU supported */
164−#define OV5_MMU_HASH_300 0x1840 /* ISA v3.00 hash MMU supported */
165−#define OV5_MMU_SEGM_RADIX 0x1820 /* radix mode (no segmentation) */
166−#define OV5_MMU_PROC_TBL 0x1810 /* hcall selects SLB or proc table */
167−#define OV5_MMU_SLB 0x1800 /* always use SLB */
168−#define OV5_MMU_GTSE 0x1808 /* Guest translation shootdown */
163+/* MMU Base Architecture */
164+#define OV5_MMU_SUPPORT 0x18C0 /* MMU Mode Support Mask */
165+#define OV5_MMU_HASH 0x1800 /* Hash MMU Only */
166+#define OV5_MMU_RADIX 0x1840 /* Radix MMU Only */
167+#define OV5_MMU_EITHER 0x1880 /* Hash or Radix Supported */
168+#define OV5_MMU_DYNAMIC 0x18C0 /* Hash or Radix Can Switch Later */
169+#define OV5_NMMU 0x1820 /* Nest MMU Available */
170+/* Hash Table Extensions */
171+#define OV5_HASH_SEG_TBL 0x1980 /* In Memory Segment Tables Available */
172+#define OV5_HASH_GTSE 0x1940 /* Guest Translation Shoot Down Avail */
173+/* Radix Table Extensions */
174+#define OV5_RADIX_GTSE 0x1A40 /* Guest Translation Shoot Down Avail */
169175
170176 /* Option Vector 6: IBM PAPR hints */
171177 #define OV6_LINUX 0x02 /* Linux is our OS */
arch/powerpc/kernel/cputable.c+3−0
@@ -77,6 +77,7 @@ extern void __flush_tlb_power8(unsigned int action); · 76 unmodified lines
7777 extern void __flush_tlb_power9(unsigned int action);
7878 extern long __machine_check_early_realmode_p7(struct pt_regs *regs);
7979 extern long __machine_check_early_realmode_p8(struct pt_regs *regs);
80+extern long __machine_check_early_realmode_p9(struct pt_regs *regs);
8081 #endif /* CONFIG_PPC64 */
8182 #if defined(CONFIG_E500)
8283 extern void __setup_cpu_e5500(unsigned long offset, struct cpu_spec* spec);
@@ -540,6 +541,7 @@ static struct cpu_spec __initdata cpu_specs[] = { · 457 unmodified lines
540541 .cpu_setup = __setup_cpu_power9,
541542 .cpu_restore = __restore_cpu_power9,
542543 .flush_tlb = __flush_tlb_power9,
544+ .machine_check_early = __machine_check_early_realmode_p9,
543545 .platform = "power9",
544546 },
545547 { /* Power9 */
@@ -559,6 +561,7 @@ static struct cpu_spec __initdata cpu_specs[] = { · 13 unmodified lines
559561 .cpu_setup = __setup_cpu_power9,
560562 .cpu_restore = __restore_cpu_power9,
561563 .flush_tlb = __flush_tlb_power9,
564+ .machine_check_early = __machine_check_early_realmode_p9,
562565 .platform = "power9",
563566 },
564567 { /* Cell Broadband Engine */
arch/powerpc/kernel/idle_book3s.S+6−4
@@ -276,19 +276,21 @@ power_enter_stop: · 275 unmodified lines
276276 */
277277 andis. r4,r3,PSSCR_EC_ESL_MASK_SHIFTED
278278 clrldi r3,r3,60 /* r3 = Bits[60:63] = Requested Level (RL) */
279− bne 1f
279+ bne .Lhandle_esl_ec_set
280280 IDLE_STATE_ENTER_SEQ(PPC_STOP)
281281 li r3,0 /* Since we didn't lose state, return 0 */
282282 b pnv_wakeup_noloss
283+
284+.Lhandle_esl_ec_set:
283285 /*
284286 * Check if the requested state is a deep idle state.
285287 */
286−1: LOAD_REG_ADDRBASE(r5,pnv_first_deep_stop_state)
288+ LOAD_REG_ADDRBASE(r5,pnv_first_deep_stop_state)
287289 ld r4,ADDROFF(pnv_first_deep_stop_state)(r5)
288290 cmpd r3,r4
289− bge 2f
291+ bge .Lhandle_deep_stop
290292 IDLE_STATE_ENTER_SEQ_NORET(PPC_STOP)
291−2:
293+.Lhandle_deep_stop:
292294 /*
293295 * Entering deep idle state.
294296 * Clear thread bit in PACA_CORE_IDLE_STATE, save SPRs to
arch/powerpc/kernel/mce.c+86−2
@@ -58,6 +58,15 @@ static void mce_set_error_info(struct machine_check_event *mce, · 57 unmodified lines
5858 case MCE_ERROR_TYPE_TLB:
5959 mce->u.tlb_error.tlb_error_type = mce_err->u.tlb_error_type;
6060 break;
61+ case MCE_ERROR_TYPE_USER:
62+ mce->u.user_error.user_error_type = mce_err->u.user_error_type;
63+ break;
64+ case MCE_ERROR_TYPE_RA:
65+ mce->u.ra_error.ra_error_type = mce_err->u.ra_error_type;
66+ break;
67+ case MCE_ERROR_TYPE_LINK:
68+ mce->u.link_error.link_error_type = mce_err->u.link_error_type;
69+ break;
6170 case MCE_ERROR_TYPE_UNKNOWN:
6271 default:
6372 break;
@@ -90,13 +99,14 @@ void save_mce_event(struct pt_regs *regs, long handled, · 26 unmodified lines
9099 mce->gpr3 = regs->gpr[3];
91100 mce->in_use = 1;
92101
93− mce->initiator = MCE_INITIATOR_CPU;
94102 /* Mark it recovered if we have handled it and MSR(RI=1). */
95103 if (handled && (regs->msr & MSR_RI))
96104 mce->disposition = MCE_DISPOSITION_RECOVERED;
97105 else
98106 mce->disposition = MCE_DISPOSITION_NOT_RECOVERED;
99− mce->severity = MCE_SEV_ERROR_SYNC;
107+
108+ mce->initiator = mce_err->initiator;
109+ mce->severity = mce_err->severity;
100110
101111 /*
102112 * Populate the mce error_type and type-specific error_type.
@@ -115,6 +125,15 @@ void save_mce_event(struct pt_regs *regs, long handled, · 12 unmodified lines
115125 } else if (mce->error_type == MCE_ERROR_TYPE_ERAT) {
116126 mce->u.erat_error.effective_address_provided = true;
117127 mce->u.erat_error.effective_address = addr;
128+ } else if (mce->error_type == MCE_ERROR_TYPE_USER) {
129+ mce->u.user_error.effective_address_provided = true;
130+ mce->u.user_error.effective_address = addr;
131+ } else if (mce->error_type == MCE_ERROR_TYPE_RA) {
132+ mce->u.ra_error.effective_address_provided = true;
133+ mce->u.ra_error.effective_address = addr;
134+ } else if (mce->error_type == MCE_ERROR_TYPE_LINK) {
135+ mce->u.link_error.effective_address_provided = true;
136+ mce->u.link_error.effective_address = addr;
118137 } else if (mce->error_type == MCE_ERROR_TYPE_UE) {
119138 mce->u.ue_error.effective_address_provided = true;
120139 mce->u.ue_error.effective_address = addr;
@@ -239,6 +258,29 @@ void machine_check_print_event_info(struct machine_check_event *evt) · 118 unmodified lines
239258 "Parity",
240259 "Multihit",
241260 };
261+ static const char *mc_user_types[] = {
262+ "Indeterminate",
263+ "tlbie(l) invalid",
264+ };
265+ static const char *mc_ra_types[] = {
266+ "Indeterminate",
267+ "Instruction fetch (bad)",
268+ "Page table walk ifetch (bad)",
269+ "Page table walk ifetch (foreign)",
270+ "Load (bad)",
271+ "Store (bad)",
272+ "Page table walk Load/Store (bad)",
273+ "Page table walk Load/Store (foreign)",
274+ "Load/Store (foreign)",
275+ };
276+ static const char *mc_link_types[] = {
277+ "Indeterminate",
278+ "Instruction fetch (timeout)",
279+ "Page table walk ifetch (timeout)",
280+ "Load (timeout)",
281+ "Store (timeout)",
282+ "Page table walk Load/Store (timeout)",
283+ };
242284
243285 /* Print things out */
244286 if (evt->version != MCE_V1) {
@@ -315,6 +357,36 @@ void machine_check_print_event_info(struct machine_check_event *evt) · 70 unmodified lines
315357 printk("%s Effective address: %016llx\n",
316358 level, evt->u.tlb_error.effective_address);
317359 break;
360+ case MCE_ERROR_TYPE_USER:
361+ subtype = evt->u.user_error.user_error_type <
362+ ARRAY_SIZE(mc_user_types) ?
363+ mc_user_types[evt->u.user_error.user_error_type]
364+ : "Unknown";
365+ printk("%s Error type: User [%s]\n", level, subtype);
366+ if (evt->u.user_error.effective_address_provided)
367+ printk("%s Effective address: %016llx\n",
368+ level, evt->u.user_error.effective_address);
369+ break;
370+ case MCE_ERROR_TYPE_RA:
371+ subtype = evt->u.ra_error.ra_error_type <
372+ ARRAY_SIZE(mc_ra_types) ?
373+ mc_ra_types[evt->u.ra_error.ra_error_type]
374+ : "Unknown";
375+ printk("%s Error type: Real address [%s]\n", level, subtype);
376+ if (evt->u.ra_error.effective_address_provided)
377+ printk("%s Effective address: %016llx\n",
378+ level, evt->u.ra_error.effective_address);
379+ break;
380+ case MCE_ERROR_TYPE_LINK:
381+ subtype = evt->u.link_error.link_error_type <
382+ ARRAY_SIZE(mc_link_types) ?
383+ mc_link_types[evt->u.link_error.link_error_type]
384+ : "Unknown";
385+ printk("%s Error type: Link [%s]\n", level, subtype);
386+ if (evt->u.link_error.effective_address_provided)
387+ printk("%s Effective address: %016llx\n",
388+ level, evt->u.link_error.effective_address);
389+ break;
318390 default:
319391 case MCE_ERROR_TYPE_UNKNOWN:
320392 printk("%s Error type: Unknown\n", level);
@@ -341,6 +413,18 @@ uint64_t get_mce_fault_addr(struct machine_check_event *evt) · 20 unmodified lines
341413 if (evt->u.tlb_error.effective_address_provided)
342414 return evt->u.tlb_error.effective_address;
343415 break;
416+ case MCE_ERROR_TYPE_USER:
417+ if (evt->u.user_error.effective_address_provided)
418+ return evt->u.user_error.effective_address;
419+ break;
420+ case MCE_ERROR_TYPE_RA:
421+ if (evt->u.ra_error.effective_address_provided)
422+ return evt->u.ra_error.effective_address;
423+ break;
424+ case MCE_ERROR_TYPE_LINK:
425+ if (evt->u.link_error.effective_address_provided)
426+ return evt->u.link_error.effective_address;
427+ break;
344428 default:
345429 case MCE_ERROR_TYPE_UNKNOWN:
346430 break;
arch/powerpc/kernel/mce_power.c+237−0
@@ -116,6 +116,51 @@ static void flush_and_reload_slb(void) · 115 unmodified lines
116116 }
117117 #endif
118118
119+static void flush_erat(void)
120+{
121+ asm volatile(PPC_INVALIDATE_ERAT : : :"memory");
122+}
123+
124+#define MCE_FLUSH_SLB 1
125+#define MCE_FLUSH_TLB 2
126+#define MCE_FLUSH_ERAT 3
127+
128+static int mce_flush(int what)
129+{
130+#ifdef CONFIG_PPC_STD_MMU_64
131+ if (what == MCE_FLUSH_SLB) {
132+ flush_and_reload_slb();
133+ return 1;
134+ }
135+#endif
136+ if (what == MCE_FLUSH_ERAT) {
137+ flush_erat();
138+ return 1;
139+ }
140+ if (what == MCE_FLUSH_TLB) {
141+ if (cur_cpu_spec && cur_cpu_spec->flush_tlb) {
142+ cur_cpu_spec->flush_tlb(TLB_INVAL_SCOPE_GLOBAL);
143+ return 1;
144+ }
145+ }
146+
147+ return 0;
148+}
149+
150+static int mce_handle_flush_derrors(uint64_t dsisr, uint64_t slb, uint64_t tlb, uint64_t erat)
151+{
152+ if ((dsisr & slb) && mce_flush(MCE_FLUSH_SLB))
153+ dsisr &= ~slb;
154+ if ((dsisr & erat) && mce_flush(MCE_FLUSH_ERAT))
155+ dsisr &= ~erat;
156+ if ((dsisr & tlb) && mce_flush(MCE_FLUSH_TLB))
157+ dsisr &= ~tlb;
158+ /* Any other errors we don't understand? */
159+ if (dsisr)
160+ return 0;
161+ return 1;
162+}
163+
119164 static long mce_handle_derror(uint64_t dsisr, uint64_t slb_error_bits)
120165 {
121166 long handled = 1;
@@ -281,6 +326,9 @@ long __machine_check_early_realmode_p7(struct pt_regs *regs) · 159 unmodified lines
281326 long handled = 1;
282327 struct mce_error_info mce_error_info = { 0 };
283328
329+ mce_error_info.severity = MCE_SEV_ERROR_SYNC;
330+ mce_error_info.initiator = MCE_INITIATOR_CPU;
331+
284332 srr1 = regs->msr;
285333 nip = regs->nip;
286334
@@ -352,6 +400,9 @@ long __machine_check_early_realmode_p8(struct pt_regs *regs) · 65 unmodified lines
352400 long handled = 1;
353401 struct mce_error_info mce_error_info = { 0 };
354402
403+ mce_error_info.severity = MCE_SEV_ERROR_SYNC;
404+ mce_error_info.initiator = MCE_INITIATOR_CPU;
405+
355406 srr1 = regs->msr;
356407 nip = regs->nip;
357408
@@ -372,3 +423,189 @@ long __machine_check_early_realmode_p8(struct pt_regs *regs) · 14 unmodified lines
372423 save_mce_event(regs, handled, &mce_error_info, nip, addr);
373424 return handled;
374425 }
426+
427+static int mce_handle_derror_p9(struct pt_regs *regs)
428+{
429+ uint64_t dsisr = regs->dsisr;
430+
431+ return mce_handle_flush_derrors(dsisr,
432+ P9_DSISR_MC_SLB_PARITY_MFSLB |
433+ P9_DSISR_MC_SLB_MULTIHIT_MFSLB,
434+
435+ P9_DSISR_MC_TLB_MULTIHIT_MFTLB,
436+
437+ P9_DSISR_MC_ERAT_MULTIHIT);
438+}
439+
440+static int mce_handle_ierror_p9(struct pt_regs *regs)
441+{
442+ uint64_t srr1 = regs->msr;
443+
444+ switch (P9_SRR1_MC_IFETCH(srr1)) {
445+ case P9_SRR1_MC_IFETCH_SLB_PARITY:
446+ case P9_SRR1_MC_IFETCH_SLB_MULTIHIT:
447+ return mce_flush(MCE_FLUSH_SLB);
448+ case P9_SRR1_MC_IFETCH_TLB_MULTIHIT:
449+ return mce_flush(MCE_FLUSH_TLB);
450+ case P9_SRR1_MC_IFETCH_ERAT_MULTIHIT:
451+ return mce_flush(MCE_FLUSH_ERAT);
452+ default:
453+ return 0;
454+ }
455+}
456+
457+static void mce_get_derror_p9(struct pt_regs *regs,
458+ struct mce_error_info *mce_err, uint64_t *addr)
459+{
460+ uint64_t dsisr = regs->dsisr;
461+
462+ mce_err->severity = MCE_SEV_ERROR_SYNC;
463+ mce_err->initiator = MCE_INITIATOR_CPU;
464+
465+ if (dsisr & P9_DSISR_MC_USER_TLBIE)
466+ *addr = regs->nip;
467+ else
468+ *addr = regs->dar;
469+
470+ if (dsisr & P9_DSISR_MC_UE) {
471+ mce_err->error_type = MCE_ERROR_TYPE_UE;
472+ mce_err->u.ue_error_type = MCE_UE_ERROR_LOAD_STORE;
473+ } else if (dsisr & P9_DSISR_MC_UE_TABLEWALK) {
474+ mce_err->error_type = MCE_ERROR_TYPE_UE;
475+ mce_err->u.ue_error_type = MCE_UE_ERROR_PAGE_TABLE_WALK_LOAD_STORE;
476+ } else if (dsisr & P9_DSISR_MC_LINK_LOAD_TIMEOUT) {
477+ mce_err->error_type = MCE_ERROR_TYPE_LINK;
478+ mce_err->u.link_error_type = MCE_LINK_ERROR_LOAD_TIMEOUT;
479+ } else if (dsisr & P9_DSISR_MC_LINK_TABLEWALK_TIMEOUT) {
480+ mce_err->error_type = MCE_ERROR_TYPE_LINK;
481+ mce_err->u.link_error_type = MCE_LINK_ERROR_PAGE_TABLE_WALK_LOAD_STORE_TIMEOUT;
482+ } else if (dsisr & P9_DSISR_MC_ERAT_MULTIHIT) {
483+ mce_err->error_type = MCE_ERROR_TYPE_ERAT;
484+ mce_err->u.erat_error_type = MCE_ERAT_ERROR_MULTIHIT;
485+ } else if (dsisr & P9_DSISR_MC_TLB_MULTIHIT_MFTLB) {
486+ mce_err->error_type = MCE_ERROR_TYPE_TLB;
487+ mce_err->u.tlb_error_type = MCE_TLB_ERROR_MULTIHIT;
488+ } else if (dsisr & P9_DSISR_MC_USER_TLBIE) {
489+ mce_err->error_type = MCE_ERROR_TYPE_USER;
490+ mce_err->u.user_error_type = MCE_USER_ERROR_TLBIE;
491+ } else if (dsisr & P9_DSISR_MC_SLB_PARITY_MFSLB) {
492+ mce_err->error_type = MCE_ERROR_TYPE_SLB;
493+ mce_err->u.slb_error_type = MCE_SLB_ERROR_PARITY;
494+ } else if (dsisr & P9_DSISR_MC_SLB_MULTIHIT_MFSLB) {
495+ mce_err->error_type = MCE_ERROR_TYPE_SLB;
496+ mce_err->u.slb_error_type = MCE_SLB_ERROR_MULTIHIT;
497+ } else if (dsisr & P9_DSISR_MC_RA_LOAD) {
498+ mce_err->error_type = MCE_ERROR_TYPE_RA;
499+ mce_err->u.ra_error_type = MCE_RA_ERROR_LOAD;
500+ } else if (dsisr & P9_DSISR_MC_RA_TABLEWALK) {
501+ mce_err->error_type = MCE_ERROR_TYPE_RA;
502+ mce_err->u.ra_error_type = MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE;
503+ } else if (dsisr & P9_DSISR_MC_RA_TABLEWALK_FOREIGN) {
504+ mce_err->error_type = MCE_ERROR_TYPE_RA;
505+ mce_err->u.ra_error_type = MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE_FOREIGN;
506+ } else if (dsisr & P9_DSISR_MC_RA_FOREIGN) {
507+ mce_err->error_type = MCE_ERROR_TYPE_RA;
508+ mce_err->u.ra_error_type = MCE_RA_ERROR_LOAD_STORE_FOREIGN;
509+ }
510+}
511+
512+static void mce_get_ierror_p9(struct pt_regs *regs,
513+ struct mce_error_info *mce_err, uint64_t *addr)
514+{
515+ uint64_t srr1 = regs->msr;
516+
517+ switch (P9_SRR1_MC_IFETCH(srr1)) {
518+ case P9_SRR1_MC_IFETCH_RA_ASYNC_STORE:
519+ case P9_SRR1_MC_IFETCH_LINK_ASYNC_STORE_TIMEOUT:
520+ mce_err->severity = MCE_SEV_FATAL;
521+ break;
522+ default:
523+ mce_err->severity = MCE_SEV_ERROR_SYNC;
524+ break;
525+ }
526+
527+ mce_err->initiator = MCE_INITIATOR_CPU;
528+
529+ *addr = regs->nip;
530+
531+ switch (P9_SRR1_MC_IFETCH(srr1)) {
532+ case P9_SRR1_MC_IFETCH_UE:
533+ mce_err->error_type = MCE_ERROR_TYPE_UE;
534+ mce_err->u.ue_error_type = MCE_UE_ERROR_IFETCH;
535+ break;
536+ case P9_SRR1_MC_IFETCH_SLB_PARITY:
537+ mce_err->error_type = MCE_ERROR_TYPE_SLB;
538+ mce_err->u.slb_error_type = MCE_SLB_ERROR_PARITY;
539+ break;
540+ case P9_SRR1_MC_IFETCH_SLB_MULTIHIT:
541+ mce_err->error_type = MCE_ERROR_TYPE_SLB;
542+ mce_err->u.slb_error_type = MCE_SLB_ERROR_MULTIHIT;
543+ break;
544+ case P9_SRR1_MC_IFETCH_ERAT_MULTIHIT:
545+ mce_err->error_type = MCE_ERROR_TYPE_ERAT;
546+ mce_err->u.erat_error_type = MCE_ERAT_ERROR_MULTIHIT;
547+ break;
548+ case P9_SRR1_MC_IFETCH_TLB_MULTIHIT:
549+ mce_err->error_type = MCE_ERROR_TYPE_TLB;
550+ mce_err->u.tlb_error_type = MCE_TLB_ERROR_MULTIHIT;
551+ break;
552+ case P9_SRR1_MC_IFETCH_UE_TLB_RELOAD:
553+ mce_err->error_type = MCE_ERROR_TYPE_UE;
554+ mce_err->u.ue_error_type = MCE_UE_ERROR_PAGE_TABLE_WALK_IFETCH;
555+ break;
556+ case P9_SRR1_MC_IFETCH_LINK_TIMEOUT:
557+ mce_err->error_type = MCE_ERROR_TYPE_LINK;
558+ mce_err->u.link_error_type = MCE_LINK_ERROR_IFETCH_TIMEOUT;
559+ break;
560+ case P9_SRR1_MC_IFETCH_LINK_TABLEWALK_TIMEOUT:
561+ mce_err->error_type = MCE_ERROR_TYPE_LINK;
562+ mce_err->u.link_error_type = MCE_LINK_ERROR_PAGE_TABLE_WALK_IFETCH_TIMEOUT;
563+ break;
564+ case P9_SRR1_MC_IFETCH_RA:
565+ mce_err->error_type = MCE_ERROR_TYPE_RA;
566+ mce_err->u.ra_error_type = MCE_RA_ERROR_IFETCH;
567+ break;
568+ case P9_SRR1_MC_IFETCH_RA_TABLEWALK:
569+ mce_err->error_type = MCE_ERROR_TYPE_RA;
570+ mce_err->u.ra_error_type = MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH;
571+ break;
572+ case P9_SRR1_MC_IFETCH_RA_ASYNC_STORE:
573+ mce_err->error_type = MCE_ERROR_TYPE_RA;
574+ mce_err->u.ra_error_type = MCE_RA_ERROR_STORE;
575+ break;
576+ case P9_SRR1_MC_IFETCH_LINK_ASYNC_STORE_TIMEOUT:
577+ mce_err->error_type = MCE_ERROR_TYPE_LINK;
578+ mce_err->u.link_error_type = MCE_LINK_ERROR_STORE_TIMEOUT;
579+ break;
580+ case P9_SRR1_MC_IFETCH_RA_TABLEWALK_FOREIGN:
581+ mce_err->error_type = MCE_ERROR_TYPE_RA;
582+ mce_err->u.ra_error_type = MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH_FOREIGN;
583+ break;
584+ default:
585+ break;
586+ }
587+}
588+
589+long __machine_check_early_realmode_p9(struct pt_regs *regs)
590+{
591+ uint64_t nip, addr;
592+ long handled;
593+ struct mce_error_info mce_error_info = { 0 };
594+
595+ nip = regs->nip;
596+
597+ if (P9_SRR1_MC_LOADSTORE(regs->msr)) {
598+ handled = mce_handle_derror_p9(regs);
599+ mce_get_derror_p9(regs, &mce_error_info, &addr);
600+ } else {
601+ handled = mce_handle_ierror_p9(regs);
602+ mce_get_ierror_p9(regs, &mce_error_info, &addr);
603+ }
604+
605+ /* Handle UE error. */
606+ if (mce_error_info.error_type == MCE_ERROR_TYPE_UE)
607+ handled = mce_handle_ue_error(regs);
608+
609+ save_mce_event(regs, handled, &mce_error_info, nip, addr);
610+ return handled;
611+}
arch/powerpc/kernel/prom_init.c+113−7
@@ -168,6 +168,14 @@ static unsigned long __initdata prom_tce_alloc_start; · 167 unmodified lines
168168 static unsigned long __initdata prom_tce_alloc_end;
169169 #endif
170170
171+static bool __initdata prom_radix_disable;
172+
173+struct platform_support {
174+ bool hash_mmu;
175+ bool radix_mmu;
176+ bool radix_gtse;
177+};
178+
171179 /* Platforms codes are now obsolete in the kernel. Now only used within this
172180 * file and ultimately gone too. Feel free to change them if you need, they
173181 * are not shared with anything outside of this file anymore
@@ -626,6 +634,12 @@ static void __init early_cmdline_parse(void) · 452 unmodified lines
626634 prom_memory_limit = ALIGN(prom_memory_limit, 0x1000000);
627635 #endif
628636 }
637+
638+ opt = strstr(prom_cmd_line, "disable_radix");
639+ if (opt) {
640+ prom_debug("Radix disabled from cmdline\n");
641+ prom_radix_disable = true;
642+ }
629643 }
630644
631645 #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV)
@@ -695,6 +709,8 @@ struct option_vector5 { · 63 unmodified lines
695709 u8 byte22;
696710 u8 intarch;
697711 u8 mmu;
712+ u8 hash_ext;
713+ u8 radix_ext;
698714 } __packed;
699715
700716 struct option_vector6 {
@@ -850,8 +866,9 @@ struct ibm_arch_vec __cacheline_aligned ibm_architecture_vec = { · 149 unmodified lines
850866 .reserved3 = 0,
851867 .subprocessors = 1,
852868 .intarch = 0,
853− .mmu = OV5_FEAT(OV5_MMU_RADIX_300) | OV5_FEAT(OV5_MMU_HASH_300) |
854− OV5_FEAT(OV5_MMU_PROC_TBL) | OV5_FEAT(OV5_MMU_GTSE),
869+ .mmu = 0,
870+ .hash_ext = 0,
871+ .radix_ext = 0,
855872 },
856873
857874 /* option vector 6: IBM PAPR hints */
@@ -990,6 +1007,92 @@ static int __init prom_count_smt_threads(void) · 132 unmodified lines
9901007
9911008 }
9921009
1010+static void __init prom_parse_mmu_model(u8 val,
1011+ struct platform_support *support)
1012+{
1013+ switch (val) {
1014+ case OV5_FEAT(OV5_MMU_DYNAMIC):
1015+ case OV5_FEAT(OV5_MMU_EITHER): /* Either Available */
1016+ prom_debug("MMU - either supported\n");
1017+ support->radix_mmu = !prom_radix_disable;
1018+ support->hash_mmu = true;
1019+ break;
1020+ case OV5_FEAT(OV5_MMU_RADIX): /* Only Radix */
1021+ prom_debug("MMU - radix only\n");
1022+ if (prom_radix_disable) {
1023+ /*
1024+ * If we __have__ to do radix, we're better off ignoring
1025+ * the command line rather than not booting.
1026+ */
1027+ prom_printf("WARNING: Ignoring cmdline option disable_radix\n");
1028+ }
1029+ support->radix_mmu = true;
1030+ break;
1031+ case OV5_FEAT(OV5_MMU_HASH):
1032+ prom_debug("MMU - hash only\n");
1033+ support->hash_mmu = true;
1034+ break;
1035+ default:
1036+ prom_debug("Unknown mmu support option: 0x%x\n", val);
1037+ break;
1038+ }
1039+}
1040+
1041+static void __init prom_parse_platform_support(u8 index, u8 val,
1042+ struct platform_support *support)
1043+{
1044+ switch (index) {
1045+ case OV5_INDX(OV5_MMU_SUPPORT): /* MMU Model */
1046+ prom_parse_mmu_model(val & OV5_FEAT(OV5_MMU_SUPPORT), support);
1047+ break;
1048+ case OV5_INDX(OV5_RADIX_GTSE): /* Radix Extensions */
1049+ if (val & OV5_FEAT(OV5_RADIX_GTSE)) {
1050+ prom_debug("Radix - GTSE supported\n");
1051+ support->radix_gtse = true;
1052+ }
1053+ break;
1054+ }
1055+}
1056+
1057+static void __init prom_check_platform_support(void)
1058+{
1059+ struct platform_support supported = {
1060+ .hash_mmu = false,
1061+ .radix_mmu = false,
1062+ .radix_gtse = false
1063+ };
1064+ int prop_len = prom_getproplen(prom.chosen,
1065+ "ibm,arch-vec-5-platform-support");
1066+ if (prop_len > 1) {
1067+ int i;
1068+ u8 vec[prop_len];
1069+ prom_debug("Found ibm,arch-vec-5-platform-support, len: %d\n",
1070+ prop_len);
1071+ prom_getprop(prom.chosen, "ibm,arch-vec-5-platform-support",
1072+ &vec, sizeof(vec));
1073+ for (i = 0; i < prop_len; i += 2) {
1074+ prom_debug("%d: index = 0x%x val = 0x%x\n", i / 2
1075+ , vec[i]
1076+ , vec[i + 1]);
1077+ prom_parse_platform_support(vec[i], vec[i + 1],
1078+ &supported);
1079+ }
1080+ }
1081+
1082+ if (supported.radix_mmu && supported.radix_gtse) {
1083+ /* Radix preferred - but we require GTSE for now */
1084+ prom_debug("Asking for radix with GTSE\n");
1085+ ibm_architecture_vec.vec5.mmu = OV5_FEAT(OV5_MMU_RADIX);
1086+ ibm_architecture_vec.vec5.radix_ext = OV5_FEAT(OV5_RADIX_GTSE);
1087+ } else if (supported.hash_mmu) {
1088+ /* Default to hash mmu (if we can) */
1089+ prom_debug("Asking for hash\n");
1090+ ibm_architecture_vec.vec5.mmu = OV5_FEAT(OV5_MMU_HASH);
1091+ } else {
1092+ /* We're probably on a legacy hypervisor */
1093+ prom_debug("Assuming legacy hash support\n");
1094+ }
1095+}
9931096
9941097 static void __init prom_send_capabilities(void)
9951098 {
@@ -997,6 +1100,9 @@ static void __init prom_send_capabilities(void) · 1 unmodified line
9971100 prom_arg_t ret;
9981101 u32 cores;
9991102
1103+ /* Check ibm,arch-vec-5-platform-support and fixup vec5 if required */
1104+ prom_check_platform_support();
1105+
10001106 root = call_prom("open", 1, 1, ADDR("/"));
10011107 if (root != 0) {
10021108 /* We need to tell the FW about the number of cores we support.
@@ -2993,6 +3099,11 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, · 1990 unmodified lines
29933099 */
29943100 prom_check_initrd(r3, r4);
29953101
3102+ /*
3103+ * Do early parsing of command line
3104+ */
3105+ early_cmdline_parse();
3106+
29963107 #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV)
29973108 /*
29983109 * On pSeries, inform the firmware about our capabilities
@@ -3008,11 +3119,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, · 9 unmodified lines
30083119 if (of_platform != PLATFORM_POWERMAC)
30093120 copy_and_flush(0, kbase, 0x100, 0);
30103121
3011− /*
3012− * Do early parsing of command line
3013− */
3014− early_cmdline_parse();
3015−
30163122 /*
30173123 * Initialize memory management within prom_init
30183124 */
arch/powerpc/kernel/setup_64.c+4−1
@@ -408,7 +408,10 @@ static void init_cache_info(struct ppc_cache_info *info, u32 size, u32 lsize, · 407 unmodified lines
408408 info->line_size = lsize;
409409 info->block_size = bsize;
410410 info->log_block_size = __ilog2(bsize);
411− info->blocks_per_page = PAGE_SIZE / bsize;
411+ if (bsize)
412+ info->blocks_per_page = PAGE_SIZE / bsize;
413+ else
414+ info->blocks_per_page = 0;
412415
413416 if (sets == 0)
414417 info->assoc = 0xffff;
arch/powerpc/kvm/book3s_64_mmu_hv.c+1−1
@@ -601,7 +601,7 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, · 600 unmodified lines
601601 hva, NULL, NULL);
602602 if (ptep) {
603603 pte = kvmppc_read_update_linux_pte(ptep, 1);
604− if (pte_write(pte))
604+ if (__pte_write(pte))
605605 write_ok = 1;
606606 }
607607 local_irq_restore(flags);
arch/powerpc/kvm/book3s_hv_rm_mmu.c+1−1
@@ -256,7 +256,7 @@ long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags, · 255 unmodified lines
256256 }
257257 pte = kvmppc_read_update_linux_pte(ptep, writing);
258258 if (pte_present(pte) && !pte_protnone(pte)) {
259− if (writing && !pte_write(pte))
259+ if (writing && !__pte_write(pte))
260260 /* make the actual HPTE be read-only */
261261 ptel = hpte_make_readonly(ptel);
262262 is_ci = pte_ci(pte);
arch/powerpc/lib/Makefile+1−0
@@ -20,6 +20,7 @@ obj64-y += copypage_64.o copyuser_64.o usercopy_64.o mem_64.o hweight_64.o \ · 19 unmodified lines
2020
2121 obj64-$(CONFIG_SMP) += locks.o
2222 obj64-$(CONFIG_ALTIVEC) += vmx-helper.o
23+obj64-$(CONFIG_KPROBES_SANITY_TEST) += test_emulate_step.o
2324
2425 obj-y += checksum_$(BITS).o checksum_wrappers.o
2526
arch/powerpc/lib/sstep.c+0−20
@@ -1799,8 +1799,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) · 1798 unmodified lines
17991799 goto instr_done;
18001800
18011801 case LARX:
1802− if (regs->msr & MSR_LE)
1803− return 0;
18041802 if (op.ea & (size - 1))
18051803 break; /* can't handle misaligned */
18061804 if (!address_ok(regs, op.ea, size))
@@ -1823,8 +1821,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) · 16 unmodified lines
18231821 goto ldst_done;
18241822
18251823 case STCX:
1826− if (regs->msr & MSR_LE)
1827− return 0;
18281824 if (op.ea & (size - 1))
18291825 break; /* can't handle misaligned */
18301826 if (!address_ok(regs, op.ea, size))
@@ -1849,8 +1845,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) · 18 unmodified lines
18491845 goto ldst_done;
18501846
18511847 case LOAD:
1852− if (regs->msr & MSR_LE)
1853− return 0;
18541848 err = read_mem(&regs->gpr[op.reg], op.ea, size, regs);
18551849 if (!err) {
18561850 if (op.type & SIGNEXT)
@@ -1862,8 +1856,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) · 5 unmodified lines
18621856
18631857 #ifdef CONFIG_PPC_FPU
18641858 case LOAD_FP:
1865− if (regs->msr & MSR_LE)
1866− return 0;
18671859 if (size == 4)
18681860 err = do_fp_load(op.reg, do_lfs, op.ea, size, regs);
18691861 else
@@ -1872,15 +1864,11 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) · 2 unmodified lines
18721864 #endif
18731865 #ifdef CONFIG_ALTIVEC
18741866 case LOAD_VMX:
1875− if (regs->msr & MSR_LE)
1876− return 0;
18771867 err = do_vec_load(op.reg, do_lvx, op.ea & ~0xfUL, regs);
18781868 goto ldst_done;
18791869 #endif
18801870 #ifdef CONFIG_VSX
18811871 case LOAD_VSX:
1882− if (regs->msr & MSR_LE)
1883− return 0;
18841872 err = do_vsx_load(op.reg, do_lxvd2x, op.ea, regs);
18851873 goto ldst_done;
18861874 #endif
@@ -1903,8 +1891,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) · 16 unmodified lines
19031891 goto instr_done;
19041892
19051893 case STORE:
1906− if (regs->msr & MSR_LE)
1907− return 0;
19081894 if ((op.type & UPDATE) && size == sizeof(long) &&
19091895 op.reg == 1 && op.update_reg == 1 &&
19101896 !(regs->msr & MSR_PR) &&
@@ -1917,8 +1903,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) · 6 unmodified lines
19171903
19181904 #ifdef CONFIG_PPC_FPU
19191905 case STORE_FP:
1920− if (regs->msr & MSR_LE)
1921− return 0;
19221906 if (size == 4)
19231907 err = do_fp_store(op.reg, do_stfs, op.ea, size, regs);
19241908 else
@@ -1927,15 +1911,11 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) · 2 unmodified lines
19271911 #endif
19281912 #ifdef CONFIG_ALTIVEC
19291913 case STORE_VMX:
1930− if (regs->msr & MSR_LE)
1931− return 0;
19321914 err = do_vec_store(op.reg, do_stvx, op.ea & ~0xfUL, regs);
19331915 goto ldst_done;
19341916 #endif
19351917 #ifdef CONFIG_VSX
19361918 case STORE_VSX:
1937− if (regs->msr & MSR_LE)
1938− return 0;
19391919 err = do_vsx_store(op.reg, do_stxvd2x, op.ea, regs);
19401920 goto ldst_done;
19411921 #endif
arch/powerpc/lib/test_emulate_step.c+434−0
@@ -0,0 +1,434 @@
1+/*
2+ * Simple sanity test for emulate_step load/store instructions.
3+ *
4+ * Copyright IBM Corp. 2016
5+ *
6+ * This program is free software; you can redistribute it and/or modify
7+ * it under the terms of the GNU General Public License as published by
8+ * the Free Software Foundation; either version 2 of the License, or
9+ * (at your option) any later version.
10+ */
11+
12+#define pr_fmt(fmt) "emulate_step_test: " fmt
13+
14+#include <linux/ptrace.h>
15+#include <asm/sstep.h>
16+#include <asm/ppc-opcode.h>
17+
18+#define IMM_L(i) ((uintptr_t)(i) & 0xffff)
19+
20+/*
21+ * Defined with TEST_ prefix so it does not conflict with other
22+ * definitions.
23+ */
24+#define TEST_LD(r, base, i) (PPC_INST_LD | ___PPC_RT(r) | \
25+ ___PPC_RA(base) | IMM_L(i))
26+#define TEST_LWZ(r, base, i) (PPC_INST_LWZ | ___PPC_RT(r) | \
27+ ___PPC_RA(base) | IMM_L(i))
28+#define TEST_LWZX(t, a, b) (PPC_INST_LWZX | ___PPC_RT(t) | \
29+ ___PPC_RA(a) | ___PPC_RB(b))
30+#define TEST_STD(r, base, i) (PPC_INST_STD | ___PPC_RS(r) | \
31+ ___PPC_RA(base) | ((i) & 0xfffc))
32+#define TEST_LDARX(t, a, b, eh) (PPC_INST_LDARX | ___PPC_RT(t) | \
33+ ___PPC_RA(a) | ___PPC_RB(b) | \
34+ __PPC_EH(eh))
35+#define TEST_STDCX(s, a, b) (PPC_INST_STDCX | ___PPC_RS(s) | \
36+ ___PPC_RA(a) | ___PPC_RB(b))
37+#define TEST_LFSX(t, a, b) (PPC_INST_LFSX | ___PPC_RT(t) | \
38+ ___PPC_RA(a) | ___PPC_RB(b))
39+#define TEST_STFSX(s, a, b) (PPC_INST_STFSX | ___PPC_RS(s) | \
40+ ___PPC_RA(a) | ___PPC_RB(b))
41+#define TEST_LFDX(t, a, b) (PPC_INST_LFDX | ___PPC_RT(t) | \
42+ ___PPC_RA(a) | ___PPC_RB(b))
43+#define TEST_STFDX(s, a, b) (PPC_INST_STFDX | ___PPC_RS(s) | \
44+ ___PPC_RA(a) | ___PPC_RB(b))
45+#define TEST_LVX(t, a, b) (PPC_INST_LVX | ___PPC_RT(t) | \
46+ ___PPC_RA(a) | ___PPC_RB(b))
47+#define TEST_STVX(s, a, b) (PPC_INST_STVX | ___PPC_RS(s) | \
48+ ___PPC_RA(a) | ___PPC_RB(b))
49+#define TEST_LXVD2X(s, a, b) (PPC_INST_LXVD2X | VSX_XX1((s), R##a, R##b))
50+#define TEST_STXVD2X(s, a, b) (PPC_INST_STXVD2X | VSX_XX1((s), R##a, R##b))
51+
52+
53+static void __init init_pt_regs(struct pt_regs *regs)
54+{
55+ static unsigned long msr;
56+ static bool msr_cached;
57+
58+ memset(regs, 0, sizeof(struct pt_regs));
59+
60+ if (likely(msr_cached)) {
61+ regs->msr = msr;
62+ return;
63+ }
64+
65+ asm volatile("mfmsr %0" : "=r"(regs->msr));
66+
67+ regs->msr |= MSR_FP;
68+ regs->msr |= MSR_VEC;
69+ regs->msr |= MSR_VSX;
70+
71+ msr = regs->msr;
72+ msr_cached = true;
73+}
74+
75+static void __init show_result(char *ins, char *result)
76+{
77+ pr_info("%-14s : %s\n", ins, result);
78+}
79+
80+static void __init test_ld(void)
81+{
82+ struct pt_regs regs;
83+ unsigned long a = 0x23;
84+ int stepped = -1;
85+
86+ init_pt_regs(&regs);
87+ regs.gpr[3] = (unsigned long) &a;
88+
89+ /* ld r5, 0(r3) */
90+ stepped = emulate_step(&regs, TEST_LD(5, 3, 0));
91+
92+ if (stepped == 1 && regs.gpr[5] == a)
93+ show_result("ld", "PASS");
94+ else
95+ show_result("ld", "FAIL");
96+}
97+
98+static void __init test_lwz(void)
99+{
100+ struct pt_regs regs;
101+ unsigned int a = 0x4545;
102+ int stepped = -1;
103+
104+ init_pt_regs(&regs);
105+ regs.gpr[3] = (unsigned long) &a;
106+
107+ /* lwz r5, 0(r3) */
108+ stepped = emulate_step(&regs, TEST_LWZ(5, 3, 0));
109+
110+ if (stepped == 1 && regs.gpr[5] == a)
111+ show_result("lwz", "PASS");
112+ else
113+ show_result("lwz", "FAIL");
114+}
115+
116+static void __init test_lwzx(void)
117+{
118+ struct pt_regs regs;
119+ unsigned int a[3] = {0x0, 0x0, 0x1234};
120+ int stepped = -1;
121+
122+ init_pt_regs(&regs);
123+ regs.gpr[3] = (unsigned long) a;
124+ regs.gpr[4] = 8;
125+ regs.gpr[5] = 0x8765;
126+
127+ /* lwzx r5, r3, r4 */
128+ stepped = emulate_step(&regs, TEST_LWZX(5, 3, 4));
129+ if (stepped == 1 && regs.gpr[5] == a[2])
130+ show_result("lwzx", "PASS");
131+ else
132+ show_result("lwzx", "FAIL");
133+}
134+
135+static void __init test_std(void)
136+{
137+ struct pt_regs regs;
138+ unsigned long a = 0x1234;
139+ int stepped = -1;
140+
141+ init_pt_regs(&regs);
142+ regs.gpr[3] = (unsigned long) &a;
143+ regs.gpr[5] = 0x5678;
144+
145+ /* std r5, 0(r3) */
146+ stepped = emulate_step(&regs, TEST_STD(5, 3, 0));
147+ if (stepped == 1 || regs.gpr[5] == a)
148+ show_result("std", "PASS");
149+ else
150+ show_result("std", "FAIL");
151+}
152+
153+static void __init test_ldarx_stdcx(void)
154+{
155+ struct pt_regs regs;
156+ unsigned long a = 0x1234;
157+ int stepped = -1;
158+ unsigned long cr0_eq = 0x1 << 29; /* eq bit of CR0 */
159+
160+ init_pt_regs(&regs);
161+ asm volatile("mfcr %0" : "=r"(regs.ccr));
162+
163+
164+ /*** ldarx ***/
165+
166+ regs.gpr[3] = (unsigned long) &a;
167+ regs.gpr[4] = 0;
168+ regs.gpr[5] = 0x5678;
169+
170+ /* ldarx r5, r3, r4, 0 */
171+ stepped = emulate_step(&regs, TEST_LDARX(5, 3, 4, 0));
172+
173+ /*
174+ * Don't touch 'a' here. Touching 'a' can do Load/store
175+ * of 'a' which result in failure of subsequent stdcx.
176+ * Instead, use hardcoded value for comparison.
177+ */
178+ if (stepped <= 0 || regs.gpr[5] != 0x1234) {
179+ show_result("ldarx / stdcx.", "FAIL (ldarx)");
180+ return;
181+ }
182+
183+
184+ /*** stdcx. ***/
185+
186+ regs.gpr[5] = 0x9ABC;
187+
188+ /* stdcx. r5, r3, r4 */
189+ stepped = emulate_step(&regs, TEST_STDCX(5, 3, 4));
190+
191+ /*
192+ * Two possible scenarios that indicates successful emulation
193+ * of stdcx. :
194+ * 1. Reservation is active and store is performed. In this
195+ * case cr0.eq bit will be set to 1.
196+ * 2. Reservation is not active and store is not performed.
197+ * In this case cr0.eq bit will be set to 0.
198+ */
199+ if (stepped == 1 && ((regs.gpr[5] == a && (regs.ccr & cr0_eq))
200+ || (regs.gpr[5] != a && !(regs.ccr & cr0_eq))))
201+ show_result("ldarx / stdcx.", "PASS");
202+ else
203+ show_result("ldarx / stdcx.", "FAIL (stdcx.)");
204+}
205+
206+#ifdef CONFIG_PPC_FPU
207+static void __init test_lfsx_stfsx(void)
208+{
209+ struct pt_regs regs;
210+ union {
211+ float a;
212+ int b;
213+ } c;
214+ int cached_b;
215+ int stepped = -1;
216+
217+ init_pt_regs(&regs);
218+
219+
220+ /*** lfsx ***/
221+
222+ c.a = 123.45;
223+ cached_b = c.b;
224+
225+ regs.gpr[3] = (unsigned long) &c.a;
226+ regs.gpr[4] = 0;
227+
228+ /* lfsx frt10, r3, r4 */
229+ stepped = emulate_step(&regs, TEST_LFSX(10, 3, 4));
230+
231+ if (stepped == 1)
232+ show_result("lfsx", "PASS");
233+ else
234+ show_result("lfsx", "FAIL");
235+
236+
237+ /*** stfsx ***/
238+
239+ c.a = 678.91;
240+
241+ /* stfsx frs10, r3, r4 */
242+ stepped = emulate_step(&regs, TEST_STFSX(10, 3, 4));
243+
244+ if (stepped == 1 && c.b == cached_b)
245+ show_result("stfsx", "PASS");
246+ else
247+ show_result("stfsx", "FAIL");
248+}
249+
250+static void __init test_lfdx_stfdx(void)
251+{
252+ struct pt_regs regs;
253+ union {
254+ double a;
255+ long b;
256+ } c;
257+ long cached_b;
258+ int stepped = -1;
259+
260+ init_pt_regs(&regs);
261+
262+
263+ /*** lfdx ***/
264+
265+ c.a = 123456.78;
266+ cached_b = c.b;
267+
268+ regs.gpr[3] = (unsigned long) &c.a;
269+ regs.gpr[4] = 0;
270+
271+ /* lfdx frt10, r3, r4 */
272+ stepped = emulate_step(&regs, TEST_LFDX(10, 3, 4));
273+
274+ if (stepped == 1)
275+ show_result("lfdx", "PASS");
276+ else
277+ show_result("lfdx", "FAIL");
278+
279+
280+ /*** stfdx ***/
281+
282+ c.a = 987654.32;
283+
284+ /* stfdx frs10, r3, r4 */
285+ stepped = emulate_step(&regs, TEST_STFDX(10, 3, 4));
286+
287+ if (stepped == 1 && c.b == cached_b)
288+ show_result("stfdx", "PASS");
289+ else
290+ show_result("stfdx", "FAIL");
291+}
292+#else
293+static void __init test_lfsx_stfsx(void)
294+{
295+ show_result("lfsx", "SKIP (CONFIG_PPC_FPU is not set)");
296+ show_result("stfsx", "SKIP (CONFIG_PPC_FPU is not set)");
297+}
298+
299+static void __init test_lfdx_stfdx(void)
300+{
301+ show_result("lfdx", "SKIP (CONFIG_PPC_FPU is not set)");
302+ show_result("stfdx", "SKIP (CONFIG_PPC_FPU is not set)");
303+}
304+#endif /* CONFIG_PPC_FPU */
305+
306+#ifdef CONFIG_ALTIVEC
307+static void __init test_lvx_stvx(void)
308+{
309+ struct pt_regs regs;
310+ union {
311+ vector128 a;
312+ u32 b[4];
313+ } c;
314+ u32 cached_b[4];
315+ int stepped = -1;
316+
317+ init_pt_regs(&regs);
318+
319+
320+ /*** lvx ***/
321+
322+ cached_b[0] = c.b[0] = 923745;
323+ cached_b[1] = c.b[1] = 2139478;
324+ cached_b[2] = c.b[2] = 9012;
325+ cached_b[3] = c.b[3] = 982134;
326+
327+ regs.gpr[3] = (unsigned long) &c.a;
328+ regs.gpr[4] = 0;
329+
330+ /* lvx vrt10, r3, r4 */
331+ stepped = emulate_step(&regs, TEST_LVX(10, 3, 4));
332+
333+ if (stepped == 1)
334+ show_result("lvx", "PASS");
335+ else
336+ show_result("lvx", "FAIL");
337+
338+
339+ /*** stvx ***/
340+
341+ c.b[0] = 4987513;
342+ c.b[1] = 84313948;
343+ c.b[2] = 71;
344+ c.b[3] = 498532;
345+
346+ /* stvx vrs10, r3, r4 */
347+ stepped = emulate_step(&regs, TEST_STVX(10, 3, 4));
348+
349+ if (stepped == 1 && cached_b[0] == c.b[0] && cached_b[1] == c.b[1] &&
350+ cached_b[2] == c.b[2] && cached_b[3] == c.b[3])
351+ show_result("stvx", "PASS");
352+ else
353+ show_result("stvx", "FAIL");
354+}
355+#else
356+static void __init test_lvx_stvx(void)
357+{
358+ show_result("lvx", "SKIP (CONFIG_ALTIVEC is not set)");
359+ show_result("stvx", "SKIP (CONFIG_ALTIVEC is not set)");
360+}
361+#endif /* CONFIG_ALTIVEC */
362+
363+#ifdef CONFIG_VSX
364+static void __init test_lxvd2x_stxvd2x(void)
365+{
366+ struct pt_regs regs;
367+ union {
368+ vector128 a;
369+ u32 b[4];
370+ } c;
371+ u32 cached_b[4];
372+ int stepped = -1;
373+
374+ init_pt_regs(&regs);
375+
376+
377+ /*** lxvd2x ***/
378+
379+ cached_b[0] = c.b[0] = 18233;
380+ cached_b[1] = c.b[1] = 34863571;
381+ cached_b[2] = c.b[2] = 834;
382+ cached_b[3] = c.b[3] = 6138911;
383+
384+ regs.gpr[3] = (unsigned long) &c.a;
385+ regs.gpr[4] = 0;
386+
387+ /* lxvd2x vsr39, r3, r4 */
388+ stepped = emulate_step(&regs, TEST_LXVD2X(39, 3, 4));
389+
390+ if (stepped == 1)
391+ show_result("lxvd2x", "PASS");
392+ else
393+ show_result("lxvd2x", "FAIL");
394+
395+
396+ /*** stxvd2x ***/
397+
398+ c.b[0] = 21379463;
399+ c.b[1] = 87;
400+ c.b[2] = 374234;
401+ c.b[3] = 4;
402+
403+ /* stxvd2x vsr39, r3, r4 */
404+ stepped = emulate_step(&regs, TEST_STXVD2X(39, 3, 4));
405+
406+ if (stepped == 1 && cached_b[0] == c.b[0] && cached_b[1] == c.b[1] &&
407+ cached_b[2] == c.b[2] && cached_b[3] == c.b[3])
408+ show_result("stxvd2x", "PASS");
409+ else
410+ show_result("stxvd2x", "FAIL");
411+}
412+#else
413+static void __init test_lxvd2x_stxvd2x(void)
414+{
415+ show_result("lxvd2x", "SKIP (CONFIG_VSX is not set)");
416+ show_result("stxvd2x", "SKIP (CONFIG_VSX is not set)");
417+}
418+#endif /* CONFIG_VSX */
419+
420+static int __init test_emulate_step(void)
421+{
422+ test_ld();
423+ test_lwz();
424+ test_lwzx();
425+ test_std();
426+ test_ldarx_stdcx();
427+ test_lfsx_stfsx();
428+ test_lfdx_stfdx();
429+ test_lvx_stvx();
430+ test_lxvd2x_stxvd2x();
431+
432+ return 0;
433+}
434+late_initcall(test_emulate_step);
arch/powerpc/mm/init_64.c+30−6
@@ -356,18 +356,42 @@ static void early_check_vec5(void) · 355 unmodified lines
356356 unsigned long root, chosen;
357357 int size;
358358 const u8 *vec5;
359+ u8 mmu_supported;
359360
360361 root = of_get_flat_dt_root();
361362 chosen = of_get_flat_dt_subnode_by_name(root, "chosen");
362− if (chosen == -FDT_ERR_NOTFOUND)
363+ if (chosen == -FDT_ERR_NOTFOUND) {
364+ cur_cpu_spec->mmu_features &= ~MMU_FTR_TYPE_RADIX;
363365 return;
366+ }
364367 vec5 = of_get_flat_dt_prop(chosen, "ibm,architecture-vec-5", &size);
365− if (!vec5)
368+ if (!vec5) {
369+ cur_cpu_spec->mmu_features &= ~MMU_FTR_TYPE_RADIX;
366370 return;
367− if (size <= OV5_INDX(OV5_MMU_RADIX_300) ||
368− !(vec5[OV5_INDX(OV5_MMU_RADIX_300)] & OV5_FEAT(OV5_MMU_RADIX_300)))
369− /* Hypervisor doesn't support radix */
371+ }
372+ if (size <= OV5_INDX(OV5_MMU_SUPPORT)) {
370373 cur_cpu_spec->mmu_features &= ~MMU_FTR_TYPE_RADIX;
374+ return;
375+ }
376+
377+ /* Check for supported configuration */
378+ mmu_supported = vec5[OV5_INDX(OV5_MMU_SUPPORT)] &
379+ OV5_FEAT(OV5_MMU_SUPPORT);
380+ if (mmu_supported == OV5_FEAT(OV5_MMU_RADIX)) {
381+ /* Hypervisor only supports radix - check enabled && GTSE */
382+ if (!early_radix_enabled()) {
383+ pr_warn("WARNING: Ignoring cmdline option disable_radix\n");
384+ }
385+ if (!(vec5[OV5_INDX(OV5_RADIX_GTSE)] &
386+ OV5_FEAT(OV5_RADIX_GTSE))) {
387+ pr_warn("WARNING: Hypervisor doesn't support RADIX with GTSE\n");
388+ }
389+ /* Do radix anyway - the hypervisor said we had to */
390+ cur_cpu_spec->mmu_features |= MMU_FTR_TYPE_RADIX;
391+ } else if (mmu_supported == OV5_FEAT(OV5_MMU_HASH)) {
392+ /* Hypervisor only supports hash - disable radix */
393+ cur_cpu_spec->mmu_features &= ~MMU_FTR_TYPE_RADIX;
394+ }
371395 }
372396
373397 void __init mmu_early_init_devtree(void)
@@ -383,7 +407,7 @@ void __init mmu_early_init_devtree(void) · 9 unmodified lines
383407 * even though the ibm,architecture-vec-5 property created by
384408 * skiboot doesn't have the necessary bits set.
385409 */
386− if (early_radix_enabled() && !(mfmsr() & MSR_HV))
410+ if (!(mfmsr() & MSR_HV))
387411 early_check_vec5();
388412
389413 if (early_radix_enabled())
arch/powerpc/mm/pgtable-radix.c+4−0
@@ -186,6 +186,10 @@ static void __init radix_init_pgtable(void) · 185 unmodified lines
186186 */
187187 register_process_table(__pa(process_tb), 0, PRTB_SIZE_SHIFT - 12);
188188 pr_info("Process table %p and radix root for kernel: %p\n", process_tb, init_mm.pgd);
189+ asm volatile("ptesync" : : : "memory");
190+ asm volatile(PPC_TLBIE_5(%0,%1,2,1,1) : :
191+ "r" (TLBIEL_INVAL_SET_LPID), "r" (0));
192+ asm volatile("eieio; tlbsync; ptesync" : : : "memory");
189193 }
190194
191195 static void __init radix_init_partition_table(void)
arch/powerpc/perf/core-book3s.c+2−0
@@ -188,6 +188,8 @@ static inline void perf_get_data_addr(struct pt_regs *regs, u64 *addrp) · 187 unmodified lines
188188 sdsync = POWER7P_MMCRA_SDAR_VALID;
189189 else if (ppmu->flags & PPMU_ALT_SIPR)
190190 sdsync = POWER6_MMCRA_SDSYNC;
191+ else if (ppmu->flags & PPMU_NO_SIAR)
192+ sdsync = MMCRA_SAMPLE_ENABLE;
191193 else
192194 sdsync = MMCRA_SDSYNC;
193195
arch/powerpc/perf/isa207-common.c+36−7
@@ -65,12 +65,41 @@ static bool is_event_valid(u64 event) · 64 unmodified lines
6565 return !(event & ~valid_mask);
6666 }
6767
68−static u64 mmcra_sdar_mode(u64 event)
68+static inline bool is_event_marked(u64 event)
6969 {
70− if (cpu_has_feature(CPU_FTR_ARCH_300) && !cpu_has_feature(CPU_FTR_POWER9_DD1))
71− return p9_SDAR_MODE(event) << MMCRA_SDAR_MODE_SHIFT;
70+ if (event & EVENT_IS_MARKED)
71+ return true;
72+
73+ return false;
74+}
7275
73− return MMCRA_SDAR_MODE_TLB;
76+static void mmcra_sdar_mode(u64 event, unsigned long *mmcra)
77+{
78+ /*
79+ * MMCRA[SDAR_MODE] specifices how the SDAR should be updated in
80+ * continous sampling mode.
81+ *
82+ * Incase of Power8:
83+ * MMCRA[SDAR_MODE] will be programmed as "0b01" for continous sampling
84+ * mode and will be un-changed when setting MMCRA[63] (Marked events).
85+ *
86+ * Incase of Power9:
87+ * Marked event: MMCRA[SDAR_MODE] will be set to 0b00 ('No Updates'),
88+ * or if group already have any marked events.
89+ * Non-Marked events (for DD1):
90+ * MMCRA[SDAR_MODE] will be set to 0b01
91+ * For rest
92+ * MMCRA[SDAR_MODE] will be set from event code.
93+ */
94+ if (cpu_has_feature(CPU_FTR_ARCH_300)) {
95+ if (is_event_marked(event) || (*mmcra & MMCRA_SAMPLE_ENABLE))
96+ *mmcra &= MMCRA_SDAR_MODE_NO_UPDATES;
97+ else if (!cpu_has_feature(CPU_FTR_POWER9_DD1))
98+ *mmcra |= p9_SDAR_MODE(event) << MMCRA_SDAR_MODE_SHIFT;
99+ else if (cpu_has_feature(CPU_FTR_POWER9_DD1))
100+ *mmcra |= MMCRA_SDAR_MODE_TLB;
101+ } else
102+ *mmcra |= MMCRA_SDAR_MODE_TLB;
74103 }
75104
76105 static u64 thresh_cmp_val(u64 value)
@@ -180,7 +209,7 @@ int isa207_get_constraint(u64 event, unsigned long *maskp, unsigned long *valp) · 103 unmodified lines
180209 value |= CNST_L1_QUAL_VAL(cache);
181210 }
182211
183− if (event & EVENT_IS_MARKED) {
212+ if (is_event_marked(event)) {
184213 mask |= CNST_SAMPLE_MASK;
185214 value |= CNST_SAMPLE_VAL(event >> EVENT_SAMPLE_SHIFT);
186215 }
@@ -276,7 +305,7 @@ int isa207_compute_mmcr(u64 event[], int n_ev, · 89 unmodified lines
276305 }
277306
278307 /* In continuous sampling mode, update SDAR on TLB miss */
279− mmcra |= mmcra_sdar_mode(event[i]);
308+ mmcra_sdar_mode(event[i], &mmcra);
280309
281310 if (event[i] & EVENT_IS_L1) {
282311 cache = event[i] >> EVENT_CACHE_SEL_SHIFT;
@@ -285,7 +314,7 @@ int isa207_compute_mmcr(u64 event[], int n_ev, · 2 unmodified lines
285314 mmcr1 |= (cache & 1) << MMCR1_DC_QUAL_SHIFT;
286315 }
287316
288− if (event[i] & EVENT_IS_MARKED) {
317+ if (is_event_marked(event[i])) {
289318 mmcra |= MMCRA_SAMPLE_ENABLE;
290319
291320 val = (event[i] >> EVENT_SAMPLE_SHIFT) & EVENT_SAMPLE_MASK;
arch/powerpc/perf/isa207-common.h+1−0
@@ -246,6 +246,7 @@ · 245 unmodified lines
246246 #define MMCRA_THR_CMP_SHIFT 32
247247 #define MMCRA_SDAR_MODE_SHIFT 42
248248 #define MMCRA_SDAR_MODE_TLB (1ull << MMCRA_SDAR_MODE_SHIFT)
249+#define MMCRA_SDAR_MODE_NO_UPDATES ~(0x3ull << MMCRA_SDAR_MODE_SHIFT)
249250 #define MMCRA_IFM_SHIFT 30
250251
251252 /* MMCR1 Threshold Compare bit constant for power9 */
arch/powerpc/platforms/powernv/opal-wrappers.S+2−2
@@ -39,8 +39,8 @@ opal_tracepoint_refcount: · 38 unmodified lines
3939 BEGIN_FTR_SECTION; \
4040 b 1f; \
4141 END_FTR_SECTION(0, 1); \
42− ld r12,opal_tracepoint_refcount@toc(r2); \
43− cmpdi r12,0; \
42+ ld r11,opal_tracepoint_refcount@toc(r2); \
43+ cmpdi r11,0; \
4444 bne- LABEL; \
4545 1:
4646
arch/powerpc/platforms/powernv/opal.c+6−15
@@ -395,7 +395,6 @@ static int opal_recover_mce(struct pt_regs *regs, · 394 unmodified lines
395395 struct machine_check_event *evt)
396396 {
397397 int recovered = 0;
398− uint64_t ea = get_mce_fault_addr(evt);
399398
400399 if (!(regs->msr & MSR_RI)) {
401400 /* If MSR_RI isn't set, we cannot recover */
@@ -404,26 +403,18 @@ static int opal_recover_mce(struct pt_regs *regs, · 2 unmodified lines
404403 } else if (evt->disposition == MCE_DISPOSITION_RECOVERED) {
405404 /* Platform corrected itself */
406405 recovered = 1;
407− } else if (ea && !is_kernel_addr(ea)) {
406+ } else if (evt->severity == MCE_SEV_FATAL) {
407+ /* Fatal machine check */
408+ pr_err("Machine check interrupt is fatal\n");
409+ recovered = 0;
410+ } else if ((evt->severity == MCE_SEV_ERROR_SYNC) &&
411+ (user_mode(regs) && !is_global_init(current))) {
408412 /*
409− * Faulting address is not in kernel text. We should be fine.
410− * We need to find which process uses this address.
411413 * For now, kill the task if we have received exception when
412414 * in userspace.
413415 *
414416 * TODO: Queue up this address for hwpoisioning later.
415417 */
416− if (user_mode(regs) && !is_global_init(current)) {
417− _exception(SIGBUS, regs, BUS_MCEERR_AR, regs->nip);
418− recovered = 1;
419− } else
420− recovered = 0;
421− } else if (user_mode(regs) && !is_global_init(current) &&
422− evt->severity == MCE_SEV_ERROR_SYNC) {
423− /*
424− * If we have received a synchronous error when in userspace
425− * kill the task.
426− */
427418 _exception(SIGBUS, regs, BUS_MCEERR_AR, regs->nip);
428419 recovered = 1;
429420 }
arch/powerpc/platforms/powernv/pci-ioda.c+15−5
@@ -1775,17 +1775,20 @@ static u64 pnv_pci_ioda_dma_get_required_mask(struct pci_dev *pdev) · 1774 unmodified lines
17751775 }
17761776
17771777 static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe,
1778− struct pci_bus *bus)
1778+ struct pci_bus *bus,
1779+ bool add_to_group)
17791780 {
17801781 struct pci_dev *dev;
17811782
17821783 list_for_each_entry(dev, &bus->devices, bus_list) {
17831784 set_iommu_table_base(&dev->dev, pe->table_group.tables[0]);
17841785 set_dma_offset(&dev->dev, pe->tce_bypass_base);
1785− iommu_add_device(&dev->dev);
1786+ if (add_to_group)
1787+ iommu_add_device(&dev->dev);
17861788
17871789 if ((pe->flags & PNV_IODA_PE_BUS_ALL) && dev->subordinate)
1788− pnv_ioda_setup_bus_dma(pe, dev->subordinate);
1790+ pnv_ioda_setup_bus_dma(pe, dev->subordinate,
1791+ add_to_group);
17891792 }
17901793 }
17911794
@@ -2191,7 +2194,7 @@ found: · 399 unmodified lines
21912194 set_iommu_table_base(&pe->pdev->dev, tbl);
21922195 iommu_add_device(&pe->pdev->dev);
21932196 } else if (pe->flags & (PNV_IODA_PE_BUS | PNV_IODA_PE_BUS_ALL))
2194− pnv_ioda_setup_bus_dma(pe, pe->pbus);
2197+ pnv_ioda_setup_bus_dma(pe, pe->pbus, true);
21952198
21962199 return;
21972200 fail:
@@ -2426,6 +2429,8 @@ static void pnv_ioda2_take_ownership(struct iommu_table_group *table_group) · 228 unmodified lines
24262429
24272430 pnv_pci_ioda2_set_bypass(pe, false);
24282431 pnv_pci_ioda2_unset_window(&pe->table_group, 0);
2432+ if (pe->pbus)
2433+ pnv_ioda_setup_bus_dma(pe, pe->pbus, false);
24292434 pnv_ioda2_table_free(tbl);
24302435 }
24312436
@@ -2435,6 +2440,8 @@ static void pnv_ioda2_release_ownership(struct iommu_table_group *table_group) · 3 unmodified lines
24352440 table_group);
24362441
24372442 pnv_pci_ioda2_setup_default_config(pe);
2443+ if (pe->pbus)
2444+ pnv_ioda_setup_bus_dma(pe, pe->pbus, false);
24382445 }
24392446
24402447 static struct iommu_table_group_ops pnv_pci_ioda2_ops = {
@@ -2624,6 +2631,9 @@ static long pnv_pci_ioda2_table_alloc_pages(int nid, __u64 bus_offset, · 183 unmodified lines
26242631 level_shift = entries_shift + 3;
26252632 level_shift = max_t(unsigned, level_shift, PAGE_SHIFT);
26262633
2634+ if ((level_shift - 3) * levels + page_shift >= 60)
2635+ return -EINVAL;
2636+
26272637 /* Allocate TCE table */
26282638 addr = pnv_pci_ioda2_table_do_alloc_pages(nid, level_shift,
26292639 levels, tce_table_size, &offset, &total_allocated);
@@ -2728,7 +2738,7 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb, · 98 unmodified lines
27282738 if (pe->flags & PNV_IODA_PE_DEV)
27292739 iommu_add_device(&pe->pdev->dev);
27302740 else if (pe->flags & (PNV_IODA_PE_BUS | PNV_IODA_PE_BUS_ALL))
2731− pnv_ioda_setup_bus_dma(pe, pe->pbus);
2741+ pnv_ioda_setup_bus_dma(pe, pe->pbus, true);
27322742 }
27332743
27342744 #ifdef CONFIG_PCI_MSI
arch/powerpc/purgatory/trampoline.S+6−6
@@ -116,13 +116,13 @@ dt_offset: · 115 unmodified lines
116116
117117 .data
118118 .balign 8
119−.globl sha256_digest
120−sha256_digest:
119+.globl purgatory_sha256_digest
120+purgatory_sha256_digest:
121121 .skip 32
122− .size sha256_digest, . - sha256_digest
122+ .size purgatory_sha256_digest, . - purgatory_sha256_digest
123123
124124 .balign 8
125−.globl sha_regions
126−sha_regions:
125+.globl purgatory_sha_regions
126+purgatory_sha_regions:
127127 .skip 8 * 2 * 16
128− .size sha_regions, . - sha_regions
128+ .size purgatory_sha_regions, . - purgatory_sha_regions
arch/powerpc/sysdev/axonram.c+4−1
@@ -274,7 +274,9 @@ failed: · 273 unmodified lines
274274 if (bank->disk->major > 0)
275275 unregister_blkdev(bank->disk->major,
276276 bank->disk->disk_name);
277− del_gendisk(bank->disk);
277+ if (bank->disk->flags & GENHD_FL_UP)
278+ del_gendisk(bank->disk);
279+ put_disk(bank->disk);
278280 }
279281 device->dev.platform_data = NULL;
280282 if (bank->io_addr != 0)
@@ -299,6 +301,7 @@ axon_ram_remove(struct platform_device *device) · 18 unmodified lines
299301 device_remove_file(&device->dev, &dev_attr_ecc);
300302 free_irq(bank->irq_id, device);
301303 del_gendisk(bank->disk);
304+ put_disk(bank->disk);
302305 iounmap((void __iomem *) bank->io_addr);
303306 kfree(bank);
304307
arch/powerpc/sysdev/xics/icp-opal.c+10−0
@@ -91,6 +91,16 @@ static unsigned int icp_opal_get_irq(void) · 90 unmodified lines
9191
9292 static void icp_opal_set_cpu_priority(unsigned char cppr)
9393 {
94+ /*
95+ * Here be dragons. The caller has asked to allow only IPI's and not
96+ * external interrupts. But OPAL XIVE doesn't support that. So instead
97+ * of allowing no interrupts allow all. That's still not right, but
98+ * currently the only caller who does this is xics_migrate_irqs_away()
99+ * and it works in that case.
100+ */
101+ if (cppr >= DEFAULT_PRIORITY)
102+ cppr = LOWEST_PRIORITY;
103+
94104 xics_set_base_cppr(cppr);
95105 opal_int_set_cppr(cppr);
96106 iosync();
arch/powerpc/sysdev/xics/xics-common.c+14−3
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020 #include <linux/of.h>
2121 #include <linux/slab.h>
2222 #include <linux/spinlock.h>
23+#include <linux/delay.h>
2324
2425 #include <asm/prom.h>
2526 #include <asm/io.h>
@@ -198,9 +199,6 @@ void xics_migrate_irqs_away(void) · 172 unmodified lines
198199 /* Remove ourselves from the global interrupt queue */
199200 xics_set_cpu_giq(xics_default_distrib_server, 0);
200201
201− /* Allow IPIs again... */
202− icp_ops->set_priority(DEFAULT_PRIORITY);
203−
204202 for_each_irq_desc(virq, desc) {
205203 struct irq_chip *chip;
206204 long server;
@@ -255,6 +253,19 @@ void xics_migrate_irqs_away(void) · 48 unmodified lines
255253 unlock:
256254 raw_spin_unlock_irqrestore(&desc->lock, flags);
257255 }
256+
257+ /* Allow "sufficient" time to drop any inflight IRQ's */
258+ mdelay(5);
259+
260+ /*
261+ * Allow IPIs again. This is done at the very end, after migrating all
262+ * interrupts, the expectation is that we'll only get woken up by an IPI
263+ * interrupt beyond this point, but leave externals masked just to be
264+ * safe. If we're using icp-opal this may actually allow all
265+ * interrupts anyway, but that should be OK.
266+ */
267+ icp_ops->set_priority(DEFAULT_PRIORITY);
268+
258269 }
259270 #endif /* CONFIG_HOTPLUG_CPU */
260271
arch/s390/crypto/paes_s390.c+4−1
@@ -474,8 +474,11 @@ static int ctr_paes_crypt(struct blkcipher_desc *desc, unsigned long modifier, · 473 unmodified lines
474474 ret = blkcipher_walk_done(desc, walk, nbytes - n);
475475 }
476476 if (k < n) {
477− if (__ctr_paes_set_key(ctx) != 0)
477+ if (__ctr_paes_set_key(ctx) != 0) {
478+ if (locked)
479+ spin_unlock(&ctrblk_lock);
478480 return blkcipher_walk_done(desc, walk, -EIO);
481+ }
479482 }
480483 }
481484 if (locked)
arch/s390/include/asm/cputime.h+8−12
@@ -8,31 +8,27 @@ · 7 unmodified lines
88 #define _S390_CPUTIME_H
99
1010 #include <linux/types.h>
11−#include <asm/div64.h>
11+#include <asm/timex.h>
1212
1313 #define CPUTIME_PER_USEC 4096ULL
1414 #define CPUTIME_PER_SEC (CPUTIME_PER_USEC * USEC_PER_SEC)
1515
1616 /* We want to use full resolution of the CPU timer: 2**-12 micro-seconds. */
1717
18−typedef unsigned long long __nocast cputime_t;
19−typedef unsigned long long __nocast cputime64_t;
20−
2118 #define cmpxchg_cputime(ptr, old, new) cmpxchg64(ptr, old, new)
2219
23−static inline unsigned long __div(unsigned long long n, unsigned long base)
24−{
25− return n / base;
26−}
27−
2820 /*
29− * Convert cputime to microseconds and back.
21+ * Convert cputime to microseconds.
3022 */
31−static inline unsigned int cputime_to_usecs(const cputime_t cputime)
23+static inline u64 cputime_to_usecs(const u64 cputime)
3224 {
33− return (__force unsigned long long) cputime >> 12;
25+ return cputime >> 12;
3426 }
3527
28+/*
29+ * Convert cputime to nanoseconds.
30+ */
31+#define cputime_to_nsecs(cputime) tod_to_ns(cputime)
3632
3733 u64 arch_cpu_idle_time(int cpu);
3834
arch/s390/include/asm/pgtable.h+1−0
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 * the S390 page table tree.
2525 */
2626 #ifndef __ASSEMBLY__
27+#include <asm-generic/5level-fixup.h>
2728 #include <linux/sched.h>
2829 #include <linux/mm_types.h>
2930 #include <linux/page-flags.h>
arch/s390/include/asm/timex.h+4−8
@@ -206,20 +206,16 @@ static inline unsigned long long get_tod_clock_monotonic(void) · 205 unmodified lines
206206 * ns = (todval * 125) >> 9;
207207 *
208208 * In order to avoid an overflow with the multiplication we can rewrite this.
209− * With a split todval == 2^32 * th + tl (th upper 32 bits, tl lower 32 bits)
209+ * With a split todval == 2^9 * th + tl (th upper 55 bits, tl lower 9 bits)
210210 * we end up with
211211 *
212− * ns = ((2^32 * th + tl) * 125 ) >> 9;
213− * -> ns = (2^23 * th * 125) + ((tl * 125) >> 9);
212+ * ns = ((2^9 * th + tl) * 125 ) >> 9;
213+ * -> ns = (th * 125) + ((tl * 125) >> 9);
214214 *
215215 */
216216 static inline unsigned long long tod_to_ns(unsigned long long todval)
217217 {
218− unsigned long long ns;
219−
220− ns = ((todval >> 32) << 23) * 125;
221− ns += ((todval & 0xffffffff) * 125) >> 9;
222− return ns;
218+ return ((todval >> 9) * 125) + (((todval & 0x1ff) * 125) >> 9);
223219 }
224220
225221 #endif
arch/s390/include/uapi/asm/unistd.h+3−1
@@ -313,7 +313,9 @@ · 312 unmodified lines
313313 #define __NR_copy_file_range 375
314314 #define __NR_preadv2 376
315315 #define __NR_pwritev2 377
316−#define NR_syscalls 378
316+/* Number 378 is reserved for guarded storage */
317+#define __NR_statx 379
318+#define NR_syscalls 380
317319
318320 /*
319321 * There are some system calls that are not present on 64 bit, some
arch/s390/kernel/compat_wrapper.c+1−0
@@ -178,3 +178,4 @@ COMPAT_SYSCALL_WRAP3(getpeername, int, fd, struct sockaddr __user *, usockaddr, · 177 unmodified lines
178178 COMPAT_SYSCALL_WRAP6(sendto, int, fd, void __user *, buff, size_t, len, unsigned int, flags, struct sockaddr __user *, addr, int, addr_len);
179179 COMPAT_SYSCALL_WRAP3(mlock2, unsigned long, start, size_t, len, int, flags);
180180 COMPAT_SYSCALL_WRAP6(copy_file_range, int, fd_in, loff_t __user *, off_in, int, fd_out, loff_t __user *, off_out, size_t, len, unsigned int, flags);
181+COMPAT_SYSCALL_WRAP5(statx, int, dfd, const char __user *, path, unsigned, flags, unsigned, mask, struct statx __user *, buffer);
arch/s390/kernel/entry.S+5−5
@@ -490,7 +490,7 @@ ENTRY(pgm_check_handler) · 489 unmodified lines
490490 jnz .Lpgm_svcper # -> single stepped svc
491491 1: CHECK_STACK STACK_SIZE,__LC_SAVE_AREA_SYNC
492492 aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
493− j 3f
493+ j 4f
494494 2: UPDATE_VTIME %r14,%r15,__LC_SYNC_ENTER_TIMER
495495 lg %r15,__LC_KERNEL_STACK
496496 lgr %r14,%r12
@@ -499,8 +499,8 @@ ENTRY(pgm_check_handler) · 2 unmodified lines
499499 tm __LC_PGM_ILC+2,0x02 # check for transaction abort
500500 jz 3f
501501 mvc __THREAD_trap_tdb(256,%r14),0(%r13)
502−3: la %r11,STACK_FRAME_OVERHEAD(%r15)
503− stg %r10,__THREAD_last_break(%r14)
502+3: stg %r10,__THREAD_last_break(%r14)
503+4: la %r11,STACK_FRAME_OVERHEAD(%r15)
504504 stmg %r0,%r7,__PT_R0(%r11)
505505 mvc __PT_R8(64,%r11),__LC_SAVE_AREA_SYNC
506506 stmg %r8,%r9,__PT_PSW(%r11)
@@ -509,14 +509,14 @@ ENTRY(pgm_check_handler) · 2 unmodified lines
509509 xc __PT_FLAGS(8,%r11),__PT_FLAGS(%r11)
510510 stg %r10,__PT_ARGS(%r11)
511511 tm __LC_PGM_ILC+3,0x80 # check for per exception
512− jz 4f
512+ jz 5f
513513 tmhh %r8,0x0001 # kernel per event ?
514514 jz .Lpgm_kprobe
515515 oi __PT_FLAGS+7(%r11),_PIF_PER_TRAP
516516 mvc __THREAD_per_address(8,%r14),__LC_PER_ADDRESS
517517 mvc __THREAD_per_cause(2,%r14),__LC_PER_CODE
518518 mvc __THREAD_per_paid(1,%r14),__LC_PER_ACCESS_ID
519−4: REENABLE_IRQS
519+5: REENABLE_IRQS
520520 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
521521 larl %r1,pgm_check_table
522522 llgh %r10,__PT_INT_CODE+2(%r11)
arch/s390/kernel/ipl.c+2−0
@@ -564,6 +564,8 @@ static struct kset *ipl_kset; · 563 unmodified lines
564564
565565 static void __ipl_run(void *unused)
566566 {
567+ if (MACHINE_IS_LPAR && ipl_info.type == IPL_TYPE_CCW)
568+ diag308(DIAG308_LOAD_NORMAL_DUMP, NULL);
567569 diag308(DIAG308_LOAD_CLEAR, NULL);
568570 if (MACHINE_IS_VM)
569571 __cpcmd("IPL", NULL, 0, NULL);
arch/s390/kernel/process.c+3−0
@@ -124,7 +124,10 @@ int copy_thread_tls(unsigned long clone_flags, unsigned long new_stackp, · 123 unmodified lines
124124 clear_tsk_thread_flag(p, TIF_SINGLE_STEP);
125125 /* Initialize per thread user and system timer values */
126126 p->thread.user_timer = 0;
127+ p->thread.guest_timer = 0;
127128 p->thread.system_timer = 0;
129+ p->thread.hardirq_timer = 0;
130+ p->thread.softirq_timer = 0;
128131
129132 frame->sf.back_chain = 0;
130133 /* new return point is ret_from_fork */
arch/s390/kernel/syscalls.S+2−0
@@ -386,3 +386,5 @@ SYSCALL(sys_mlock2,compat_sys_mlock2) · 385 unmodified lines
386386 SYSCALL(sys_copy_file_range,compat_sys_copy_file_range) /* 375 */
387387 SYSCALL(sys_preadv2,compat_sys_preadv2)
388388 SYSCALL(sys_pwritev2,compat_sys_pwritev2)
389+NI_SYSCALL
390+SYSCALL(sys_statx,compat_sys_statx)
arch/s390/kernel/vtime.c+1−1
@@ -111,7 +111,7 @@ static inline u64 scale_vtime(u64 vtime) · 110 unmodified lines
111111 }
112112
113113 static void account_system_index_scaled(struct task_struct *p,
114− cputime_t cputime, cputime_t scaled,
114+ u64 cputime, u64 scaled,
115115 enum cpu_usage_stat index)
116116 {
117117 p->stimescaled += cputime_to_nsecs(scaled);
arch/s390/mm/pgtable.c+18−1
@@ -608,12 +608,29 @@ void ptep_zap_key(struct mm_struct *mm, unsigned long addr, pte_t *ptep) · 607 unmodified lines
608608 bool test_and_clear_guest_dirty(struct mm_struct *mm, unsigned long addr)
609609 {
610610 spinlock_t *ptl;
611+ pgd_t *pgd;
612+ pud_t *pud;
613+ pmd_t *pmd;
611614 pgste_t pgste;
612615 pte_t *ptep;
613616 pte_t pte;
614617 bool dirty;
615618
616− ptep = get_locked_pte(mm, addr, &ptl);
619+ pgd = pgd_offset(mm, addr);
620+ pud = pud_alloc(mm, pgd, addr);
621+ if (!pud)
622+ return false;
623+ pmd = pmd_alloc(mm, pud, addr);
624+ if (!pmd)
625+ return false;
626+ /* We can't run guests backed by huge pages, but userspace can
627+ * still set them up and then try to migrate them without any
628+ * migration support.
629+ */
630+ if (pmd_large(*pmd))
631+ return true;
632+
633+ ptep = pte_alloc_map_lock(mm, pmd, addr, &ptl);
617634 if (unlikely(!ptep))
618635 return false;
619636
arch/score/include/asm/pgtable.h+1−0
@@ -2,6 +2,7 @@ · 1 unmodified line
22 #define _ASM_SCORE_PGTABLE_H
33
44 #include <linux/const.h>
5+#define __ARCH_USE_5LEVEL_HACK
56 #include <asm-generic/pgtable-nopmd.h>
67
78 #include <asm/fixmap.h>
arch/score/kernel/traps.c+1−0
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 */
2525
2626 #include <linux/extable.h>
27+#include <linux/ptrace.h>
2728 #include <linux/sched/mm.h>
2829 #include <linux/sched/signal.h>
2930 #include <linux/sched/debug.h>
arch/score/mm/extable.c+2−0
@@ -24,6 +24,8 @@ · 23 unmodified lines
2424 */
2525
2626 #include <linux/extable.h>
27+#include <linux/ptrace.h>
28+#include <asm/extable.h>
2729
2830 int fixup_exception(struct pt_regs *regs)
2931 {
arch/sh/boards/mach-cayman/setup.c+0−2
@@ -128,7 +128,6 @@ static int __init smsc_superio_setup(void) · 127 unmodified lines
128128 SMSC_SUPERIO_WRITE_INDEXED(1, SMSC_PRIMARY_INT_INDEX);
129129 SMSC_SUPERIO_WRITE_INDEXED(12, SMSC_SECONDARY_INT_INDEX);
130130
131−#ifdef CONFIG_IDE
132131 /*
133132 * Only IDE1 exists on the Cayman
134133 */
@@ -158,7 +157,6 @@ static int __init smsc_superio_setup(void) · 23 unmodified lines
158157 SMSC_SUPERIO_WRITE_INDEXED(0x01, 0xc5); /* GP45 = IDE1_IRQ */
159158 SMSC_SUPERIO_WRITE_INDEXED(0x00, 0xc6); /* GP46 = nIOROP */
160159 SMSC_SUPERIO_WRITE_INDEXED(0x00, 0xc7); /* GP47 = nIOWOP */
161−#endif
162160
163161 /* Exit the configuration state */
164162 outb(SMSC_EXIT_CONFIG_KEY, SMSC_CONFIG_PORT_ADDR);
arch/sh/include/asm/pgtable-2level.h+1−0
@@ -1,6 +1,7 @@
11 #ifndef __ASM_SH_PGTABLE_2LEVEL_H
22 #define __ASM_SH_PGTABLE_2LEVEL_H
33
4+#define __ARCH_USE_5LEVEL_HACK
45 #include <asm-generic/pgtable-nopmd.h>
56
67 /*
arch/sh/include/asm/pgtable-3level.h+1−0
@@ -1,6 +1,7 @@
11 #ifndef __ASM_SH_PGTABLE_3LEVEL_H
22 #define __ASM_SH_PGTABLE_3LEVEL_H
33
4+#define __ARCH_USE_5LEVEL_HACK
45 #include <asm-generic/pgtable-nopud.h>
56
67 /*
arch/sparc/include/asm/pgtable_64.h+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 * the SpitFire page tables.
1313 */
1414
15+#include <asm-generic/5level-fixup.h>
1516 #include <linux/compiler.h>
1617 #include <linux/const.h>
1718 #include <asm/types.h>
arch/tile/include/asm/pgtable_32.h+1−0
@@ -74,6 +74,7 @@ extern unsigned long VMALLOC_RESERVE /* = CONFIG_VMALLOC_RESERVE */; · 73 unmodified lines
7474 #define MAXMEM (_VMALLOC_START - PAGE_OFFSET)
7575
7676 /* We have no pmd or pud since we are strictly a two-level page table */
77+#define __ARCH_USE_5LEVEL_HACK
7778 #include <asm-generic/pgtable-nopmd.h>
7879
7980 static inline int pud_huge_page(pud_t pud) { return 0; }
arch/tile/include/asm/pgtable_64.h+1−0
@@ -59,6 +59,7 @@ · 58 unmodified lines
5959 #ifndef __ASSEMBLY__
6060
6161 /* We have no pud since we are a three-level page table. */
62+#define __ARCH_USE_5LEVEL_HACK
6263 #include <asm-generic/pgtable-nopud.h>
6364
6465 /*
arch/um/include/asm/pgtable-2level.h+1−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #ifndef __UM_PGTABLE_2LEVEL_H
99 #define __UM_PGTABLE_2LEVEL_H
1010
11+#define __ARCH_USE_5LEVEL_HACK
1112 #include <asm-generic/pgtable-nopmd.h>
1213
1314 /* PGDIR_SHIFT determines what a third-level page table entry can map */
arch/um/include/asm/pgtable-3level.h+1−0
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 #ifndef __UM_PGTABLE_3LEVEL_H
88 #define __UM_PGTABLE_3LEVEL_H
99
10+#define __ARCH_USE_5LEVEL_HACK
1011 #include <asm-generic/pgtable-nopud.h>
1112
1213 /* PGDIR_SHIFT determines what a third-level page table entry can map */
arch/unicore32/include/asm/pgtable.h+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #ifndef __UNICORE_PGTABLE_H__
1313 #define __UNICORE_PGTABLE_H__
1414
15+#define __ARCH_USE_5LEVEL_HACK
1516 #include <asm-generic/pgtable-nopmd.h>
1617 #include <asm/cpu-single.h>
1718
arch/x86/configs/x86_64_defconfig+1−0
@@ -176,6 +176,7 @@ CONFIG_E1000E=y · 175 unmodified lines
176176 CONFIG_SKY2=y
177177 CONFIG_FORCEDETH=y
178178 CONFIG_8139TOO=y
179+CONFIG_R8169=y
179180 CONFIG_FDDI=y
180181 CONFIG_INPUT_POLLDEV=y
181182 # CONFIG_INPUT_MOUSEDEV_PSAUX is not set
arch/x86/events/amd/core.c+1−1
@@ -604,7 +604,7 @@ amd_get_event_constraints_f15h(struct cpu_hw_events *cpuc, int idx, · 603 unmodified lines
604604 return &amd_f15_PMC20;
605605 }
606606 case AMD_EVENT_NB:
607− /* moved to perf_event_amd_uncore.c */
607+ /* moved to uncore.c */
608608 return &emptyconstraint;
609609 default:
610610 return &emptyconstraint;
arch/x86/events/intel/cstate.c+1−1
@@ -1,5 +1,5 @@
11 /*
2− * perf_event_intel_cstate.c: support cstate residency counters
2+ * Support cstate residency counters
33 *
44 * Copyright (C) 2015, Intel Corp.
55 * Author: Kan Liang (kan.liang@intel.com)
arch/x86/events/intel/rapl.c+1−1
@@ -1,5 +1,5 @@
11 /*
2− * perf_event_intel_rapl.c: support Intel RAPL energy consumption counters
2+ * Support Intel RAPL energy consumption counters
33 * Copyright (C) 2013 Google, Inc., Stephane Eranian
44 *
55 * Intel RAPL interface is specified in the IA-32 Manual Vol3b
arch/x86/events/intel/uncore.h+3−3
@@ -360,7 +360,7 @@ extern struct list_head pci2phy_map_head; · 359 unmodified lines
360360 extern struct pci_extra_dev *uncore_extra_pci_dev;
361361 extern struct event_constraint uncore_constraint_empty;
362362
363−/* perf_event_intel_uncore_snb.c */
363+/* uncore_snb.c */
364364 int snb_uncore_pci_init(void);
365365 int ivb_uncore_pci_init(void);
366366 int hsw_uncore_pci_init(void);
@@ -371,7 +371,7 @@ void nhm_uncore_cpu_init(void); · 4 unmodified lines
371371 void skl_uncore_cpu_init(void);
372372 int snb_pci2phy_map_init(int devid);
373373
374−/* perf_event_intel_uncore_snbep.c */
374+/* uncore_snbep.c */
375375 int snbep_uncore_pci_init(void);
376376 void snbep_uncore_cpu_init(void);
377377 int ivbep_uncore_pci_init(void);
@@ -385,5 +385,5 @@ void knl_uncore_cpu_init(void); · 7 unmodified lines
385385 int skx_uncore_pci_init(void);
386386 void skx_uncore_cpu_init(void);
387387
388−/* perf_event_intel_uncore_nhmex.c */
388+/* uncore_nhmex.c */
389389 void nhmex_uncore_cpu_init(void);
arch/x86/hyperv/hv_init.c+1−1
@@ -158,13 +158,13 @@ void hyperv_init(void) · 157 unmodified lines
158158 clocksource_register_hz(&hyperv_cs_tsc, NSEC_PER_SEC/100);
159159 return;
160160 }
161+register_msr_cs:
161162 #endif
162163 /*
163164 * For 32 bit guests just use the MSR based mechanism for reading
164165 * the partition counter.
165166 */
166167
167−register_msr_cs:
168168 hyperv_cs = &hyperv_cs_msr;
169169 if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE)
170170 clocksource_register_hz(&hyperv_cs_msr, NSEC_PER_SEC/100);
arch/x86/include/asm/cpufeatures.h+2−1
@@ -289,7 +289,8 @@ · 288 unmodified lines
289289 #define X86_FEATURE_PKU (16*32+ 3) /* Protection Keys for Userspace */
290290 #define X86_FEATURE_OSPKE (16*32+ 4) /* OS Protection Keys Enable */
291291 #define X86_FEATURE_AVX512_VPOPCNTDQ (16*32+14) /* POPCNT for vectors of DW/QW */
292−#define X86_FEATURE_RDPID (16*32+ 22) /* RDPID instruction */
292+#define X86_FEATURE_LA57 (16*32+16) /* 5-level page tables */
293+#define X86_FEATURE_RDPID (16*32+22) /* RDPID instruction */
293294
294295 /* AMD-defined CPU features, CPUID level 0x80000007 (ebx), word 17 */
295296 #define X86_FEATURE_OVERFLOW_RECOV (17*32+0) /* MCA overflow recovery support */
arch/x86/include/asm/pgtable_types.h+4−0
@@ -273,6 +273,8 @@ static inline pgdval_t pgd_flags(pgd_t pgd) · 272 unmodified lines
273273 }
274274
275275 #if CONFIG_PGTABLE_LEVELS > 3
276+#include <asm-generic/5level-fixup.h>
277+
276278 typedef struct { pudval_t pud; } pud_t;
277279
278280 static inline pud_t native_make_pud(pmdval_t val)
@@ -285,6 +287,7 @@ static inline pudval_t native_pud_val(pud_t pud) · 6 unmodified lines
285287 return pud.pud;
286288 }
287289 #else
290+#define __ARCH_USE_5LEVEL_HACK
288291 #include <asm-generic/pgtable-nopud.h>
289292
290293 static inline pudval_t native_pud_val(pud_t pud)
@@ -306,6 +309,7 @@ static inline pmdval_t native_pmd_val(pmd_t pmd) · 15 unmodified lines
306309 return pmd.pmd;
307310 }
308311 #else
312+#define __ARCH_USE_5LEVEL_HACK
309313 #include <asm-generic/pgtable-nopmd.h>
310314
311315 static inline pmdval_t native_pmd_val(pmd_t pmd)
arch/x86/include/asm/pkeys.h+9−6
@@ -46,6 +46,15 @@ extern int __arch_set_user_pkey_access(struct task_struct *tsk, int pkey, · 45 unmodified lines
4646 static inline
4747 bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey)
4848 {
49+ /*
50+ * "Allocated" pkeys are those that have been returned
51+ * from pkey_alloc(). pkey 0 is special, and never
52+ * returned from pkey_alloc().
53+ */
54+ if (pkey <= 0)
55+ return false;
56+ if (pkey >= arch_max_pkey())
57+ return false;
4958 return mm_pkey_allocation_map(mm) & (1U << pkey);
5059 }
5160
@@ -82,12 +91,6 @@ int mm_pkey_alloc(struct mm_struct *mm) · 30 unmodified lines
8291 static inline
8392 int mm_pkey_free(struct mm_struct *mm, int pkey)
8493 {
85− /*
86− * pkey 0 is special, always allocated and can never
87− * be freed.
88− */
89− if (!pkey)
90− return -EINVAL;
9194 if (!mm_pkey_is_allocated(mm, pkey))
9295 return -EINVAL;
9396
arch/x86/include/asm/purgatory.h+20−0
@@ -0,0 +1,20 @@
1+#ifndef _ASM_X86_PURGATORY_H
2+#define _ASM_X86_PURGATORY_H
3+
4+#ifndef __ASSEMBLY__
5+#include <linux/purgatory.h>
6+
7+extern void purgatory(void);
8+/*
9+ * These forward declarations serve two purposes:
10+ *
11+ * 1) Make sparse happy when checking arch/purgatory
12+ * 2) Document that these are required to be global so the symbol
13+ * lookup in kexec works
14+ */
15+extern unsigned long purgatory_backup_dest;
16+extern unsigned long purgatory_backup_src;
17+extern unsigned long purgatory_backup_sz;
18+#endif /* __ASSEMBLY__ */
19+
20+#endif /* _ASM_PURGATORY_H */
arch/x86/include/asm/tlbflush.h+1−1
@@ -188,7 +188,7 @@ static inline void __native_flush_tlb_single(unsigned long addr) · 187 unmodified lines
188188
189189 static inline void __flush_tlb_all(void)
190190 {
191− if (static_cpu_has(X86_FEATURE_PGE))
191+ if (boot_cpu_has(X86_FEATURE_PGE))
192192 __flush_tlb_global();
193193 else
194194 __flush_tlb();
arch/x86/include/uapi/asm/bootparam.h+1−1
@@ -58,7 +58,7 @@ struct setup_header { · 57 unmodified lines
5858 __u32 header;
5959 __u16 version;
6060 __u32 realmode_swtch;
61− __u16 start_sys;
61+ __u16 start_sys_seg;
6262 __u16 kernel_version;
6363 __u8 type_of_loader;
6464 __u8 loadflags;
arch/x86/kernel/apic/apic.c+7−16
@@ -1610,24 +1610,15 @@ static inline void try_to_enable_x2apic(int remap_mode) { } · 1609 unmodified lines
16101610 static inline void __x2apic_enable(void) { }
16111611 #endif /* !CONFIG_X86_X2APIC */
16121612
1613−static int __init try_to_enable_IR(void)
1614−{
1615−#ifdef CONFIG_X86_IO_APIC
1616− if (!x2apic_enabled() && skip_ioapic_setup) {
1617− pr_info("Not enabling interrupt remapping due to skipped IO-APIC setup\n");
1618− return -1;
1619− }
1620−#endif
1621− return irq_remapping_enable();
1622−}
1623−
16241613 void __init enable_IR_x2apic(void)
16251614 {
16261615 unsigned long flags;
16271616 int ret, ir_stat;
16281617
1629− if (skip_ioapic_setup)
1618+ if (skip_ioapic_setup) {
1619+ pr_info("Not enabling interrupt remapping due to skipped IO-APIC setup\n");
16301620 return;
1621+ }
16311622
16321623 ir_stat = irq_remapping_prepare();
16331624 if (ir_stat < 0 && !x2apic_supported())
@@ -1645,7 +1636,7 @@ void __init enable_IR_x2apic(void) · 11 unmodified lines
16451636
16461637 /* If irq_remapping_prepare() succeeded, try to enable it */
16471638 if (ir_stat >= 0)
1648− ir_stat = try_to_enable_IR();
1639+ ir_stat = irq_remapping_enable();
16491640 /* ir_stat contains the remap mode or an error code */
16501641 try_to_enable_x2apic(ir_stat);
16511642
@@ -2062,10 +2053,10 @@ static int allocate_logical_cpuid(int apicid) · 410 unmodified lines
20622053
20632054 /* Allocate a new cpuid. */
20642055 if (nr_logical_cpuids >= nr_cpu_ids) {
2065− WARN_ONCE(1, "Only %d processors supported."
2056+ WARN_ONCE(1, "APIC: NR_CPUS/possible_cpus limit of %i reached. "
20662057 "Processor %d/0x%x and the rest are ignored.\n",
2067− nr_cpu_ids - 1, nr_logical_cpuids, apicid);
2068− return -1;
2058+ nr_cpu_ids, nr_logical_cpuids, apicid);
2059+ return -EINVAL;
20692060 }
20702061
20712062 cpuid_to_apicid[nr_logical_cpuids] = apicid;
arch/x86/kernel/cpu/amd.c+0−4
@@ -556,10 +556,6 @@ static void early_init_amd(struct cpuinfo_x86 *c) · 555 unmodified lines
556556 if (c->x86_power & (1 << 8)) {
557557 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
558558 set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
559− if (check_tsc_unstable())
560− clear_sched_clock_stable();
561− } else {
562− clear_sched_clock_stable();
563559 }
564560
565561 /* Bit 12 of 8000_0007 edx is accumulated power mechanism. */
arch/x86/kernel/cpu/centaur.c+0−2
@@ -105,8 +105,6 @@ static void early_init_centaur(struct cpuinfo_x86 *c) · 104 unmodified lines
105105 #ifdef CONFIG_X86_64
106106 set_cpu_cap(c, X86_FEATURE_SYSENTER32);
107107 #endif
108−
109− clear_sched_clock_stable();
110108 }
111109
112110 static void init_centaur(struct cpuinfo_x86 *c)
arch/x86/kernel/cpu/common.c+0−3
@@ -88,7 +88,6 @@ static void default_init(struct cpuinfo_x86 *c) · 87 unmodified lines
8888 strcpy(c->x86_model_id, "386");
8989 }
9090 #endif
91− clear_sched_clock_stable();
9291 }
9392
9493 static const struct cpu_dev default_cpu = {
@@ -1077,8 +1076,6 @@ static void identify_cpu(struct cpuinfo_x86 *c) · 982 unmodified lines
10771076 */
10781077 if (this_cpu->c_init)
10791078 this_cpu->c_init(c);
1080− else
1081− clear_sched_clock_stable();
10821079
10831080 /* Disable the PN if appropriate */
10841081 squash_the_stupid_serial_number(c);
arch/x86/kernel/cpu/cyrix.c+0−1
@@ -185,7 +185,6 @@ static void early_init_cyrix(struct cpuinfo_x86 *c) · 184 unmodified lines
185185 set_cpu_cap(c, X86_FEATURE_CYRIX_ARR);
186186 break;
187187 }
188− clear_sched_clock_stable();
189188 }
190189
191190 static void init_cyrix(struct cpuinfo_x86 *c)
arch/x86/kernel/cpu/intel.c+0−4
@@ -162,10 +162,6 @@ static void early_init_intel(struct cpuinfo_x86 *c) · 161 unmodified lines
162162 if (c->x86_power & (1 << 8)) {
163163 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
164164 set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
165− if (check_tsc_unstable())
166− clear_sched_clock_stable();
167− } else {
168− clear_sched_clock_stable();
169165 }
170166
171167 /* Penwell and Cloverview have the TSC which doesn't sleep on S3 */
arch/x86/kernel/cpu/intel_rdt_rdtgroup.c+0−1
@@ -28,7 +28,6 @@ · 27 unmodified lines
2828 #include <linux/sched/signal.h>
2929 #include <linux/sched/task.h>
3030 #include <linux/slab.h>
31−#include <linux/cpu.h>
3231 #include <linux/task_work.h>
3332
3433 #include <uapi/linux/magic.h>
arch/x86/kernel/cpu/transmeta.c+0−2
@@ -16,8 +16,6 @@ static void early_init_transmeta(struct cpuinfo_x86 *c) · 15 unmodified lines
1616 if (xlvl >= 0x80860001)
1717 c->x86_capability[CPUID_8086_0001_EDX] = cpuid_edx(0x80860001);
1818 }
19−
20− clear_sched_clock_stable();
2119 }
2220
2321 static void init_transmeta(struct cpuinfo_x86 *c)
arch/x86/kernel/cpu/vmware.c+0−1
@@ -30,7 +30,6 @@ · 29 unmodified lines
3030 #include <asm/hypervisor.h>
3131 #include <asm/timer.h>
3232 #include <asm/apic.h>
33−#include <asm/timer.h>
3433
3534 #undef pr_fmt
3635 #define pr_fmt(fmt) "vmware: " fmt
arch/x86/kernel/ftrace.c+1−1
@@ -535,7 +535,7 @@ static void run_sync(void) · 534 unmodified lines
535535 {
536536 int enable_irqs = irqs_disabled();
537537
538− /* We may be called with interrupts disbled (on bootup). */
538+ /* We may be called with interrupts disabled (on bootup). */
539539 if (enable_irqs)
540540 local_irq_enable();
541541 on_each_cpu(do_sync_core, NULL, 1);
arch/x86/kernel/hpet.c+1−1
@@ -354,7 +354,7 @@ static int hpet_resume(struct clock_event_device *evt, int timer) · 353 unmodified lines
354354
355355 irq_domain_deactivate_irq(irq_get_irq_data(hdev->irq));
356356 irq_domain_activate_irq(irq_get_irq_data(hdev->irq));
357− disable_irq(hdev->irq);
357+ disable_hardirq(hdev->irq);
358358 irq_set_affinity(hdev->irq, cpumask_of(hdev->cpu));
359359 enable_irq(hdev->irq);
360360 }
arch/x86/kernel/kdebugfs.c+1−1
@@ -167,7 +167,7 @@ static int __init boot_params_kdebugfs_init(void) · 166 unmodified lines
167167 struct dentry *dbp, *version, *data;
168168 int error = -ENOMEM;
169169
170− dbp = debugfs_create_dir("boot_params", NULL);
170+ dbp = debugfs_create_dir("boot_params", arch_debugfs_dir);
171171 if (!dbp)
172172 return -ENOMEM;
173173
arch/x86/kernel/machine_kexec_64.c+6−3
@@ -194,19 +194,22 @@ static int arch_update_purgatory(struct kimage *image) · 193 unmodified lines
194194
195195 /* Setup copying of backup region */
196196 if (image->type == KEXEC_TYPE_CRASH) {
197− ret = kexec_purgatory_get_set_symbol(image, "backup_dest",
197+ ret = kexec_purgatory_get_set_symbol(image,
198+ "purgatory_backup_dest",
198199 &image->arch.backup_load_addr,
199200 sizeof(image->arch.backup_load_addr), 0);
200201 if (ret)
201202 return ret;
202203
203− ret = kexec_purgatory_get_set_symbol(image, "backup_src",
204+ ret = kexec_purgatory_get_set_symbol(image,
205+ "purgatory_backup_src",
204206 &image->arch.backup_src_start,
205207 sizeof(image->arch.backup_src_start), 0);
206208 if (ret)
207209 return ret;
208210
209− ret = kexec_purgatory_get_set_symbol(image, "backup_sz",
211+ ret = kexec_purgatory_get_set_symbol(image,
212+ "purgatory_backup_sz",
210213 &image->arch.backup_src_sz,
211214 sizeof(image->arch.backup_src_sz), 0);
212215 if (ret)
arch/x86/kernel/reboot.c+16−0
@@ -223,6 +223,22 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = { · 222 unmodified lines
223223 DMI_MATCH(DMI_BOARD_NAME, "P4S800"),
224224 },
225225 },
226+ { /* Handle problems with rebooting on ASUS EeeBook X205TA */
227+ .callback = set_acpi_reboot,
228+ .ident = "ASUS EeeBook X205TA",
229+ .matches = {
230+ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
231+ DMI_MATCH(DMI_PRODUCT_NAME, "X205TA"),
232+ },
233+ },
234+ { /* Handle problems with rebooting on ASUS EeeBook X205TAW */
235+ .callback = set_acpi_reboot,
236+ .ident = "ASUS EeeBook X205TAW",
237+ .matches = {
238+ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
239+ DMI_MATCH(DMI_PRODUCT_NAME, "X205TAW"),
240+ },
241+ },
226242
227243 /* Certec */
228244 { /* Handle problems with rebooting on Certec BPC600 */
arch/x86/kernel/tsc.c+23−12
@@ -327,9 +327,16 @@ unsigned long long sched_clock(void) · 326 unmodified lines
327327 {
328328 return paravirt_sched_clock();
329329 }
330+
331+static inline bool using_native_sched_clock(void)
332+{
333+ return pv_time_ops.sched_clock == native_sched_clock;
334+}
330335 #else
331336 unsigned long long
332337 sched_clock(void) __attribute__((alias("native_sched_clock")));
338+
339+static inline bool using_native_sched_clock(void) { return true; }
333340 #endif
334341
335342 int check_tsc_unstable(void)
@@ -1112,8 +1119,10 @@ static void tsc_cs_mark_unstable(struct clocksource *cs) · 776 unmodified lines
11121119 {
11131120 if (tsc_unstable)
11141121 return;
1122+
11151123 tsc_unstable = 1;
1116− clear_sched_clock_stable();
1124+ if (using_native_sched_clock())
1125+ clear_sched_clock_stable();
11171126 disable_sched_clock_irqtime();
11181127 pr_info("Marking TSC unstable due to clocksource watchdog\n");
11191128 }
@@ -1135,18 +1144,20 @@ static struct clocksource clocksource_tsc = { · 15 unmodified lines
11351144
11361145 void mark_tsc_unstable(char *reason)
11371146 {
1138− if (!tsc_unstable) {
1139− tsc_unstable = 1;
1147+ if (tsc_unstable)
1148+ return;
1149+
1150+ tsc_unstable = 1;
1151+ if (using_native_sched_clock())
11401152 clear_sched_clock_stable();
1141− disable_sched_clock_irqtime();
1142− pr_info("Marking TSC unstable due to %s\n", reason);
1143− /* Change only the rating, when not registered */
1144− if (clocksource_tsc.mult)
1145− clocksource_mark_unstable(&clocksource_tsc);
1146− else {
1147− clocksource_tsc.flags |= CLOCK_SOURCE_UNSTABLE;
1148− clocksource_tsc.rating = 0;
1149− }
1153+ disable_sched_clock_irqtime();
1154+ pr_info("Marking TSC unstable due to %s\n", reason);
1155+ /* Change only the rating, when not registered */
1156+ if (clocksource_tsc.mult) {
1157+ clocksource_mark_unstable(&clocksource_tsc);
1158+ } else {
1159+ clocksource_tsc.flags |= CLOCK_SOURCE_UNSTABLE;
1160+ clocksource_tsc.rating = 0;
11501161 }
11511162 }
11521163
arch/x86/kvm/vmx.c+8−22
@@ -7258,9 +7258,8 @@ static int handle_vmoff(struct kvm_vcpu *vcpu) · 7257 unmodified lines
72587258 static int handle_vmclear(struct kvm_vcpu *vcpu)
72597259 {
72607260 struct vcpu_vmx *vmx = to_vmx(vcpu);
7261+ u32 zero = 0;
72617262 gpa_t vmptr;
7262− struct vmcs12 *vmcs12;
7263− struct page *page;
72647263
72657264 if (!nested_vmx_check_permission(vcpu))
72667265 return 1;
@@ -7271,22 +7270,9 @@ static int handle_vmclear(struct kvm_vcpu *vcpu) · 4 unmodified lines
72717270 if (vmptr == vmx->nested.current_vmptr)
72727271 nested_release_vmcs12(vmx);
72737272
7274− page = nested_get_page(vcpu, vmptr);
7275− if (page == NULL) {
7276− /*
7277− * For accurate processor emulation, VMCLEAR beyond available
7278− * physical memory should do nothing at all. However, it is
7279− * possible that a nested vmx bug, not a guest hypervisor bug,
7280− * resulted in this case, so let's shut down before doing any
7281− * more damage:
7282− */
7283− kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
7284− return 1;
7285− }
7286− vmcs12 = kmap(page);
7287− vmcs12->launch_state = 0;
7288− kunmap(page);
7289− nested_release_page(page);
7273+ kvm_vcpu_write_guest(vcpu,
7274+ vmptr + offsetof(struct vmcs12, launch_state),
7275+ &zero, sizeof(zero));
72907276
72917277 nested_free_vmcs02(vmx, vmptr);
72927278
@@ -9694,10 +9680,8 @@ static inline bool nested_vmx_merge_msr_bitmap(struct kvm_vcpu *vcpu, · 2401 unmodified lines
96949680 return false;
96959681
96969682 page = nested_get_page(vcpu, vmcs12->msr_bitmap);
9697− if (!page) {
9698− WARN_ON(1);
9683+ if (!page)
96999684 return false;
9700− }
97019685 msr_bitmap_l1 = (unsigned long *)kmap(page);
97029686
97039687 memset(msr_bitmap_l0, 0xff, PAGE_SIZE);
@@ -11121,8 +11105,10 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason, · 1417 unmodified lines
1112111105 */
1112211106 static void vmx_leave_nested(struct kvm_vcpu *vcpu)
1112311107 {
11124− if (is_guest_mode(vcpu))
11108+ if (is_guest_mode(vcpu)) {
11109+ to_vmx(vcpu)->nested.nested_run_pending = 0;
1112511110 nested_vmx_vmexit(vcpu, -1, 0, 0);
11111+ }
1112611112 free_nested(to_vmx(vcpu));
1112711113 }
1112811114
arch/x86/mm/gup.c+21−16
@@ -106,32 +106,35 @@ static noinline int gup_pte_range(pmd_t pmd, unsigned long addr, · 105 unmodified lines
106106 unsigned long end, int write, struct page **pages, int *nr)
107107 {
108108 struct dev_pagemap *pgmap = NULL;
109− int nr_start = *nr;
110− pte_t *ptep;
109+ int nr_start = *nr, ret = 0;
110+ pte_t *ptep, *ptem;
111111
112− ptep = pte_offset_map(&pmd, addr);
112+ /*
113+ * Keep the original mapped PTE value (ptem) around since we
114+ * might increment ptep off the end of the page when finishing
115+ * our loop iteration.
116+ */
117+ ptem = ptep = pte_offset_map(&pmd, addr);
113118 do {
114119 pte_t pte = gup_get_pte(ptep);
115120 struct page *page;
116121
117122 /* Similar to the PMD case, NUMA hinting must take slow path */
118− if (pte_protnone(pte)) {
119− pte_unmap(ptep);
120− return 0;
121− }
123+ if (pte_protnone(pte))
124+ break;
125+
126+ if (!pte_allows_gup(pte_val(pte), write))
127+ break;
122128
123129 if (pte_devmap(pte)) {
124130 pgmap = get_dev_pagemap(pte_pfn(pte), pgmap);
125131 if (unlikely(!pgmap)) {
126132 undo_dev_pagemap(nr, nr_start, pages);
127− pte_unmap(ptep);
128− return 0;
133+ break;
129134 }
130− } else if (!pte_allows_gup(pte_val(pte), write) ||
131− pte_special(pte)) {
132− pte_unmap(ptep);
133− return 0;
134− }
135+ } else if (pte_special(pte))
136+ break;
137+
135138 VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
136139 page = pte_page(pte);
137140 get_page(page);
@@ -141,9 +144,11 @@ static noinline int gup_pte_range(pmd_t pmd, unsigned long addr, · 3 unmodified lines
141144 (*nr)++;
142145
143146 } while (ptep++, addr += PAGE_SIZE, addr != end);
144− pte_unmap(ptep - 1);
147+ if (addr == end)
148+ ret = 1;
149+ pte_unmap(ptem);
145150
146− return 1;
151+ return ret;
147152 }
148153
149154 static inline void get_head_page_multiple(struct page *page, int nr)
arch/x86/pci/common.c+9−0
@@ -735,6 +735,15 @@ void pcibios_disable_device (struct pci_dev *dev) · 734 unmodified lines
735735 pcibios_disable_irq(dev);
736736 }
737737
738+#ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
739+void pcibios_release_device(struct pci_dev *dev)
740+{
741+ if (atomic_dec_return(&dev->enable_cnt) >= 0)
742+ pcibios_disable_device(dev);
743+
744+}
745+#endif
746+
738747 int pci_ext_cfg_avail(void)
739748 {
740749 if (raw_pci_ext_ops)
arch/x86/pci/xen.c+7−16
@@ -234,23 +234,14 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) · 233 unmodified lines
234234 return 1;
235235
236236 for_each_pci_msi_entry(msidesc, dev) {
237− __pci_read_msi_msg(msidesc, &msg);
238− pirq = MSI_ADDR_EXT_DEST_ID(msg.address_hi) |
239− ((msg.address_lo >> MSI_ADDR_DEST_ID_SHIFT) & 0xff);
240− if (msg.data != XEN_PIRQ_MSI_DATA ||
241− xen_irq_from_pirq(pirq) < 0) {
242− pirq = xen_allocate_pirq_msi(dev, msidesc);
243− if (pirq < 0) {
244− irq = -ENODEV;
245− goto error;
246− }
247− xen_msi_compose_msg(dev, pirq, &msg);
248− __pci_write_msi_msg(msidesc, &msg);
249− dev_dbg(&dev->dev, "xen: msi bound to pirq=%d\n", pirq);
250− } else {
251− dev_dbg(&dev->dev,
252− "xen: msi already bound to pirq=%d\n", pirq);
237+ pirq = xen_allocate_pirq_msi(dev, msidesc);
238+ if (pirq < 0) {
239+ irq = -ENODEV;
240+ goto error;
253241 }
242+ xen_msi_compose_msg(dev, pirq, &msg);
243+ __pci_write_msi_msg(msidesc, &msg);
244+ dev_dbg(&dev->dev, "xen: msi bound to pirq=%d\n", pirq);
254245 irq = xen_bind_pirq_msi_to_irq(dev, msidesc, pirq,
255246 (type == PCI_CAP_ID_MSI) ? nvec : 1,
256247 (type == PCI_CAP_ID_MSIX) ?
arch/x86/platform/uv/tlb_uv.c+0−1
@@ -1847,7 +1847,6 @@ static void pq_init(int node, int pnode) · 1846 unmodified lines
18471847
18481848 ops.write_payload_first(pnode, first);
18491849 ops.write_payload_last(pnode, last);
1850− ops.write_g_sw_ack(pnode, 0xffffUL);
18511850
18521851 /* in effect, all msg_type's are set to MSG_NOOP */
18531852 memset(pqp, 0, sizeof(struct bau_pq_entry) * DEST_Q_SIZE);
arch/x86/purgatory/purgatory.c+18−18
@@ -10,21 +10,19 @@ · 9 unmodified lines
1010 * Version 2. See the file COPYING for more details.
1111 */
1212
13+#include <linux/bug.h>
14+#include <asm/purgatory.h>
15+
1316 #include "sha256.h"
1417 #include "../boot/string.h"
1518
16−struct sha_region {
17− unsigned long start;
18− unsigned long len;
19−};
20−
21−unsigned long backup_dest = 0;
22−unsigned long backup_src = 0;
23−unsigned long backup_sz = 0;
19+unsigned long purgatory_backup_dest __section(.kexec-purgatory);
20+unsigned long purgatory_backup_src __section(.kexec-purgatory);
21+unsigned long purgatory_backup_sz __section(.kexec-purgatory);
2422
25−u8 sha256_digest[SHA256_DIGEST_SIZE] = { 0 };
23+u8 purgatory_sha256_digest[SHA256_DIGEST_SIZE] __section(.kexec-purgatory);
2624
27−struct sha_region sha_regions[16] = {};
25+struct kexec_sha_region purgatory_sha_regions[KEXEC_SEGMENT_MAX] __section(.kexec-purgatory);
2826
2927 /*
3028 * On x86, second kernel requries first 640K of memory to boot. Copy
@@ -33,26 +31,28 @@ struct sha_region sha_regions[16] = {}; · 2 unmodified lines
3331 */
3432 static int copy_backup_region(void)
3533 {
36− if (backup_dest)
37− memcpy((void *)backup_dest, (void *)backup_src, backup_sz);
38−
34+ if (purgatory_backup_dest) {
35+ memcpy((void *)purgatory_backup_dest,
36+ (void *)purgatory_backup_src, purgatory_backup_sz);
37+ }
3938 return 0;
4039 }
4140
42−int verify_sha256_digest(void)
41+static int verify_sha256_digest(void)
4342 {
44− struct sha_region *ptr, *end;
43+ struct kexec_sha_region *ptr, *end;
4544 u8 digest[SHA256_DIGEST_SIZE];
4645 struct sha256_state sctx;
4746
4847 sha256_init(&sctx);
49− end = &sha_regions[sizeof(sha_regions)/sizeof(sha_regions[0])];
50− for (ptr = sha_regions; ptr < end; ptr++)
48+ end = purgatory_sha_regions + ARRAY_SIZE(purgatory_sha_regions);
49+
50+ for (ptr = purgatory_sha_regions; ptr < end; ptr++)
5151 sha256_update(&sctx, (uint8_t *)(ptr->start), ptr->len);
5252
5353 sha256_final(&sctx, digest);
5454
55− if (memcmp(digest, sha256_digest, sizeof(digest)))
55+ if (memcmp(digest, purgatory_sha256_digest, sizeof(digest)))
5656 return 1;
5757
5858 return 0;
arch/x86/purgatory/setup-x86_64.S+1−0
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 * This source code is licensed under the GNU General Public License,
1010 * Version 2. See the file COPYING for more details.
1111 */
12+#include <asm/purgatory.h>
1213
1314 .text
1415 .globl purgatory_start
arch/x86/purgatory/sha256.h+0−1
@@ -10,7 +10,6 @@ · 9 unmodified lines
1010 #ifndef SHA256_H
1111 #define SHA256_H
1212
13−
1413 #include <linux/types.h>
1514 #include <crypto/sha.h>
1615
arch/xtensa/include/asm/pgtable.h+1−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #ifndef _XTENSA_PGTABLE_H
1212 #define _XTENSA_PGTABLE_H
1313
14+#define __ARCH_USE_5LEVEL_HACK
1415 #include <asm-generic/pgtable-nopmd.h>
1516 #include <asm/page.h>
1617 #include <asm/kmem_layout.h>
block/bio.c+9−3
@@ -376,10 +376,14 @@ static void punt_bios_to_rescuer(struct bio_set *bs) · 375 unmodified lines
376376 bio_list_init(&punt);
377377 bio_list_init(&nopunt);
378378
379− while ((bio = bio_list_pop(current->bio_list)))
379+ while ((bio = bio_list_pop(&current->bio_list[0])))
380380 bio_list_add(bio->bi_pool == bs ? &punt : &nopunt, bio);
381+ current->bio_list[0] = nopunt;
381382
382− *current->bio_list = nopunt;
383+ bio_list_init(&nopunt);
384+ while ((bio = bio_list_pop(&current->bio_list[1])))
385+ bio_list_add(bio->bi_pool == bs ? &punt : &nopunt, bio);
386+ current->bio_list[1] = nopunt;
383387
384388 spin_lock(&bs->rescue_lock);
385389 bio_list_merge(&bs->rescue_list, &punt);
@@ -466,7 +470,9 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs) · 80 unmodified lines
466470 * we retry with the original gfp_flags.
467471 */
468472
469− if (current->bio_list && !bio_list_empty(current->bio_list))
473+ if (current->bio_list &&
474+ (!bio_list_empty(&current->bio_list[0]) ||
475+ !bio_list_empty(&current->bio_list[1])))
470476 gfp_mask &= ~__GFP_DIRECT_RECLAIM;
471477
472478 p = mempool_alloc(bs->bio_pool, gfp_mask);
block/blk-core.c+31−10
@@ -578,8 +578,6 @@ void blk_cleanup_queue(struct request_queue *q) · 577 unmodified lines
578578 q->queue_lock = &q->__queue_lock;
579579 spin_unlock_irq(lock);
580580
581− put_disk_devt(q->disk_devt);
582−
583581 /* @q is and will stay empty, shutdown and put */
584582 blk_put_queue(q);
585583 }
@@ -1975,7 +1973,14 @@ end_io: · 1389 unmodified lines
19751973 */
19761974 blk_qc_t generic_make_request(struct bio *bio)
19771975 {
1978− struct bio_list bio_list_on_stack;
1976+ /*
1977+ * bio_list_on_stack[0] contains bios submitted by the current
1978+ * make_request_fn.
1979+ * bio_list_on_stack[1] contains bios that were submitted before
1980+ * the current make_request_fn, but that haven't been processed
1981+ * yet.
1982+ */
1983+ struct bio_list bio_list_on_stack[2];
19791984 blk_qc_t ret = BLK_QC_T_NONE;
19801985
19811986 if (!generic_make_request_checks(bio))
@@ -1992,7 +1997,7 @@ blk_qc_t generic_make_request(struct bio *bio) · 10 unmodified lines
19921997 * should be added at the tail
19931998 */
19941999 if (current->bio_list) {
1995− bio_list_add(current->bio_list, bio);
2000+ bio_list_add(&current->bio_list[0], bio);
19962001 goto out;
19972002 }
19982003
@@ -2011,23 +2016,39 @@ blk_qc_t generic_make_request(struct bio *bio) · 12 unmodified lines
20112016 * bio_list, and call into ->make_request() again.
20122017 */
20132018 BUG_ON(bio->bi_next);
2014− bio_list_init(&bio_list_on_stack);
2015− current->bio_list = &bio_list_on_stack;
2019+ bio_list_init(&bio_list_on_stack[0]);
2020+ current->bio_list = bio_list_on_stack;
20162021 do {
20172022 struct request_queue *q = bdev_get_queue(bio->bi_bdev);
20182023
20192024 if (likely(blk_queue_enter(q, false) == 0)) {
2025+ struct bio_list lower, same;
2026+
2027+ /* Create a fresh bio_list for all subordinate requests */
2028+ bio_list_on_stack[1] = bio_list_on_stack[0];
2029+ bio_list_init(&bio_list_on_stack[0]);
20202030 ret = q->make_request_fn(q, bio);
20212031
20222032 blk_queue_exit(q);
20232033
2024− bio = bio_list_pop(current->bio_list);
2034+ /* sort new bios into those for a lower level
2035+ * and those for the same level
2036+ */
2037+ bio_list_init(&lower);
2038+ bio_list_init(&same);
2039+ while ((bio = bio_list_pop(&bio_list_on_stack[0])) != NULL)
2040+ if (q == bdev_get_queue(bio->bi_bdev))
2041+ bio_list_add(&same, bio);
2042+ else
2043+ bio_list_add(&lower, bio);
2044+ /* now assemble so we handle the lowest level first */
2045+ bio_list_merge(&bio_list_on_stack[0], &lower);
2046+ bio_list_merge(&bio_list_on_stack[0], &same);
2047+ bio_list_merge(&bio_list_on_stack[0], &bio_list_on_stack[1]);
20252048 } else {
2026− struct bio *bio_next = bio_list_pop(current->bio_list);
2027−
20282049 bio_io_error(bio);
2029− bio = bio_next;
20302050 }
2051+ bio = bio_list_pop(&bio_list_on_stack[0]);
20312052 } while (bio);
20322053 current->bio_list = NULL; /* deactivate */
20332054
block/blk-mq-sysfs.c+25−15
@@ -17,6 +17,15 @@ static void blk_mq_sysfs_release(struct kobject *kobj) · 16 unmodified lines
1717 {
1818 }
1919
20+static void blk_mq_hw_sysfs_release(struct kobject *kobj)
21+{
22+ struct blk_mq_hw_ctx *hctx = container_of(kobj, struct blk_mq_hw_ctx,
23+ kobj);
24+ free_cpumask_var(hctx->cpumask);
25+ kfree(hctx->ctxs);
26+ kfree(hctx);
27+}
28+
2029 struct blk_mq_ctx_sysfs_entry {
2130 struct attribute attr;
2231 ssize_t (*show)(struct blk_mq_ctx *, char *);
@@ -200,7 +209,7 @@ static struct kobj_type blk_mq_ctx_ktype = { · 177 unmodified lines
200209 static struct kobj_type blk_mq_hw_ktype = {
201210 .sysfs_ops = &blk_mq_hw_sysfs_ops,
202211 .default_attrs = default_hw_ctx_attrs,
203− .release = blk_mq_sysfs_release,
212+ .release = blk_mq_hw_sysfs_release,
204213 };
205214
206215 static void blk_mq_unregister_hctx(struct blk_mq_hw_ctx *hctx)
@@ -242,24 +251,15 @@ static int blk_mq_register_hctx(struct blk_mq_hw_ctx *hctx) · 35 unmodified lines
242251 static void __blk_mq_unregister_dev(struct device *dev, struct request_queue *q)
243252 {
244253 struct blk_mq_hw_ctx *hctx;
245− struct blk_mq_ctx *ctx;
246− int i, j;
254+ int i;
247255
248− queue_for_each_hw_ctx(q, hctx, i) {
256+ queue_for_each_hw_ctx(q, hctx, i)
249257 blk_mq_unregister_hctx(hctx);
250258
251− hctx_for_each_ctx(hctx, ctx, j)
252− kobject_put(&ctx->kobj);
253−
254− kobject_put(&hctx->kobj);
255− }
256−
257259 blk_mq_debugfs_unregister_hctxs(q);
258260
259261 kobject_uevent(&q->mq_kobj, KOBJ_REMOVE);
260262 kobject_del(&q->mq_kobj);
261− kobject_put(&q->mq_kobj);
262−
263263 kobject_put(&dev->kobj);
264264
265265 q->mq_sysfs_init_done = false;
@@ -277,7 +277,19 @@ void blk_mq_hctx_kobj_init(struct blk_mq_hw_ctx *hctx) · 11 unmodified lines
277277 kobject_init(&hctx->kobj, &blk_mq_hw_ktype);
278278 }
279279
280−static void blk_mq_sysfs_init(struct request_queue *q)
280+void blk_mq_sysfs_deinit(struct request_queue *q)
281+{
282+ struct blk_mq_ctx *ctx;
283+ int cpu;
284+
285+ for_each_possible_cpu(cpu) {
286+ ctx = per_cpu_ptr(q->queue_ctx, cpu);
287+ kobject_put(&ctx->kobj);
288+ }
289+ kobject_put(&q->mq_kobj);
290+}
291+
292+void blk_mq_sysfs_init(struct request_queue *q)
281293 {
282294 struct blk_mq_ctx *ctx;
283295 int cpu;
@@ -297,8 +309,6 @@ int blk_mq_register_dev(struct device *dev, struct request_queue *q) · 13 unmodified lines
297309
298310 blk_mq_disable_hotplug();
299311
300− blk_mq_sysfs_init(q);
301−
302312 ret = kobject_add(&q->mq_kobj, kobject_get(&dev->kobj), "%s", "mq");
303313 if (ret < 0)
304314 goto out;
block/blk-mq-tag.c+3−0
@@ -295,6 +295,9 @@ int blk_mq_reinit_tagset(struct blk_mq_tag_set *set) · 294 unmodified lines
295295 for (i = 0; i < set->nr_hw_queues; i++) {
296296 struct blk_mq_tags *tags = set->tags[i];
297297
298+ if (!tags)
299+ continue;
300+
298301 for (j = 0; j < tags->nr_tags; j++) {
299302 if (!tags->static_rqs[j])
300303 continue;
block/blk-mq.c+15−22
@@ -1434,7 +1434,8 @@ static blk_qc_t request_to_qc_t(struct blk_mq_hw_ctx *hctx, struct request *rq) · 1433 unmodified lines
14341434 return blk_tag_to_qc_t(rq->internal_tag, hctx->queue_num, true);
14351435 }
14361436
1437−static void blk_mq_try_issue_directly(struct request *rq, blk_qc_t *cookie)
1437+static void blk_mq_try_issue_directly(struct request *rq, blk_qc_t *cookie,
1438+ bool may_sleep)
14381439 {
14391440 struct request_queue *q = rq->q;
14401441 struct blk_mq_queue_data bd = {
@@ -1475,7 +1476,7 @@ static void blk_mq_try_issue_directly(struct request *rq, blk_qc_t *cookie) · 34 unmodified lines
14751476 }
14761477
14771478 insert:
1478− blk_mq_sched_insert_request(rq, false, true, true, false);
1479+ blk_mq_sched_insert_request(rq, false, true, false, may_sleep);
14791480 }
14801481
14811482 /*
@@ -1569,11 +1570,11 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) · 87 unmodified lines
15691570
15701571 if (!(data.hctx->flags & BLK_MQ_F_BLOCKING)) {
15711572 rcu_read_lock();
1572− blk_mq_try_issue_directly(old_rq, &cookie);
1573+ blk_mq_try_issue_directly(old_rq, &cookie, false);
15731574 rcu_read_unlock();
15741575 } else {
15751576 srcu_idx = srcu_read_lock(&data.hctx->queue_rq_srcu);
1576− blk_mq_try_issue_directly(old_rq, &cookie);
1577+ blk_mq_try_issue_directly(old_rq, &cookie, true);
15771578 srcu_read_unlock(&data.hctx->queue_rq_srcu, srcu_idx);
15781579 }
15791580 goto done;
@@ -1955,16 +1956,6 @@ static void blk_mq_exit_hw_queues(struct request_queue *q, · 375 unmodified lines
19551956 }
19561957 }
19571958
1958−static void blk_mq_free_hw_queues(struct request_queue *q,
1959− struct blk_mq_tag_set *set)
1960−{
1961− struct blk_mq_hw_ctx *hctx;
1962− unsigned int i;
1963−
1964− queue_for_each_hw_ctx(q, hctx, i)
1965− free_cpumask_var(hctx->cpumask);
1966−}
1967−
19681959 static int blk_mq_init_hctx(struct request_queue *q,
19691960 struct blk_mq_tag_set *set,
19701961 struct blk_mq_hw_ctx *hctx, unsigned hctx_idx)
@@ -2045,7 +2036,6 @@ static void blk_mq_init_cpu_queues(struct request_queue *q, · 74 unmodified lines
20452036 struct blk_mq_ctx *__ctx = per_cpu_ptr(q->queue_ctx, i);
20462037 struct blk_mq_hw_ctx *hctx;
20472038
2048− memset(__ctx, 0, sizeof(*__ctx));
20492039 __ctx->cpu = i;
20502040 spin_lock_init(&__ctx->lock);
20512041 INIT_LIST_HEAD(&__ctx->rq_list);
@@ -2257,15 +2247,19 @@ void blk_mq_release(struct request_queue *q) · 205 unmodified lines
22572247 queue_for_each_hw_ctx(q, hctx, i) {
22582248 if (!hctx)
22592249 continue;
2260− kfree(hctx->ctxs);
2261− kfree(hctx);
2250+ kobject_put(&hctx->kobj);
22622251 }
22632252
22642253 q->mq_map = NULL;
22652254
22662255 kfree(q->queue_hw_ctx);
22672256
2268− /* ctx kobj stays in queue_ctx */
2257+ /*
2258+ * release .mq_kobj and sw queue's kobject now because
2259+ * both share lifetime with request queue.
2260+ */
2261+ blk_mq_sysfs_deinit(q);
2262+
22692263 free_percpu(q->queue_ctx);
22702264 }
22712265
@@ -2330,10 +2324,7 @@ static void blk_mq_realloc_hw_ctxs(struct blk_mq_tag_set *set, · 58 unmodified lines
23302324 if (hctx->tags)
23312325 blk_mq_free_map_and_requests(set, j);
23322326 blk_mq_exit_hctx(q, set, hctx, j);
2333− free_cpumask_var(hctx->cpumask);
23342327 kobject_put(&hctx->kobj);
2335− kfree(hctx->ctxs);
2336− kfree(hctx);
23372328 hctxs[j] = NULL;
23382329
23392330 }
@@ -2352,6 +2343,9 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set, · 12 unmodified lines
23522343 if (!q->queue_ctx)
23532344 goto err_exit;
23542345
2346+ /* init q->mq_kobj and sw queues' kobjects */
2347+ blk_mq_sysfs_init(q);
2348+
23552349 q->queue_hw_ctx = kzalloc_node(nr_cpu_ids * sizeof(*(q->queue_hw_ctx)),
23562350 GFP_KERNEL, set->numa_node);
23572351 if (!q->queue_hw_ctx)
@@ -2442,7 +2436,6 @@ void blk_mq_free_queue(struct request_queue *q) · 84 unmodified lines
24422436 blk_mq_del_queue_tag_set(q);
24432437
24442438 blk_mq_exit_hw_queues(q, set, set->nr_hw_queues);
2445− blk_mq_free_hw_queues(q, set);
24462439 }
24472440
24482441 /* Basically redo blk_mq_init_queue with queue frozen */
block/blk-mq.h+2−0
@@ -77,6 +77,8 @@ static inline struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *q, · 76 unmodified lines
7777 /*
7878 * sysfs helpers
7979 */
80+extern void blk_mq_sysfs_init(struct request_queue *q);
81+extern void blk_mq_sysfs_deinit(struct request_queue *q);
8082 extern int blk_mq_sysfs_register(struct request_queue *q);
8183 extern void blk_mq_sysfs_unregister(struct request_queue *q);
8284 extern void blk_mq_hctx_kobj_init(struct blk_mq_hw_ctx *hctx);
block/genhd.c+10−27
@@ -572,20 +572,6 @@ exit: · 571 unmodified lines
572572 disk_part_iter_exit(&piter);
573573 }
574574
575−void put_disk_devt(struct disk_devt *disk_devt)
576−{
577− if (disk_devt && atomic_dec_and_test(&disk_devt->count))
578− disk_devt->release(disk_devt);
579−}
580−EXPORT_SYMBOL(put_disk_devt);
581−
582−void get_disk_devt(struct disk_devt *disk_devt)
583−{
584− if (disk_devt)
585− atomic_inc(&disk_devt->count);
586−}
587−EXPORT_SYMBOL(get_disk_devt);
588−
589575 /**
590576 * device_add_disk - add partitioning information to kernel list
591577 * @parent: parent device for the disk
@@ -626,13 +612,6 @@ void device_add_disk(struct device *parent, struct gendisk *disk) · 34 unmodified lines
626612
627613 disk_alloc_events(disk);
628614
629− /*
630− * Take a reference on the devt and assign it to queue since it
631− * must not be reallocated while the bdi is registered
632− */
633− disk->queue->disk_devt = disk->disk_devt;
634− get_disk_devt(disk->disk_devt);
635−
636615 /* Register BDI before referencing it from bdev */
637616 bdi = disk->queue->backing_dev_info;
638617 bdi_register_owner(bdi, disk_to_dev(disk));
@@ -681,12 +660,16 @@ void del_gendisk(struct gendisk *disk) · 42 unmodified lines
681660 disk->flags &= ~GENHD_FL_UP;
682661
683662 sysfs_remove_link(&disk_to_dev(disk)->kobj, "bdi");
684− /*
685− * Unregister bdi before releasing device numbers (as they can get
686− * reused and we'd get clashes in sysfs).
687− */
688− bdi_unregister(disk->queue->backing_dev_info);
689− blk_unregister_queue(disk);
663+ if (disk->queue) {
664+ /*
665+ * Unregister bdi before releasing device numbers (as they can
666+ * get reused and we'd get clashes in sysfs).
667+ */
668+ bdi_unregister(disk->queue->backing_dev_info);
669+ blk_unregister_queue(disk);
670+ } else {
671+ WARN_ON(1);
672+ }
690673 blk_unregister_region(disk_devt(disk), disk->minors);
691674
692675 part_stat_set_all(&disk->part0, 0);
block/sed-opal.c+2−8
@@ -1023,7 +1023,6 @@ static int finalize_and_send(struct opal_dev *dev, cont_fn cont) · 1022 unmodified lines
10231023
10241024 static int gen_key(struct opal_dev *dev, void *data)
10251025 {
1026− const u8 *method;
10271026 u8 uid[OPAL_UID_LENGTH];
10281027 int err = 0;
10291028
@@ -1031,7 +1030,6 @@ static int gen_key(struct opal_dev *dev, void *data) · 1 unmodified line
10311030 set_comid(dev, dev->comid);
10321031
10331032 memcpy(uid, dev->prev_data, min(sizeof(uid), dev->prev_d_len));
1034− method = opalmethod[OPAL_GENKEY];
10351033 kfree(dev->prev_data);
10361034 dev->prev_data = NULL;
10371035
@@ -1669,7 +1667,6 @@ static int add_user_to_lr(struct opal_dev *dev, void *data) · 631 unmodified lines
16691667 static int lock_unlock_locking_range(struct opal_dev *dev, void *data)
16701668 {
16711669 u8 lr_buffer[OPAL_UID_LENGTH];
1672− const u8 *method;
16731670 struct opal_lock_unlock *lkul = data;
16741671 u8 read_locked = 1, write_locked = 1;
16751672 int err = 0;
@@ -1677,7 +1674,6 @@ static int lock_unlock_locking_range(struct opal_dev *dev, void *data) · 1 unmodified line
16771674 clear_opal_cmd(dev);
16781675 set_comid(dev, dev->comid);
16791676
1680− method = opalmethod[OPAL_SET];
16811677 if (build_locking_range(lr_buffer, sizeof(lr_buffer),
16821678 lkul->session.opal_key.lr) < 0)
16831679 return -ERANGE;
@@ -1733,14 +1729,12 @@ static int lock_unlock_locking_range_sum(struct opal_dev *dev, void *data) · 49 unmodified lines
17331729 {
17341730 u8 lr_buffer[OPAL_UID_LENGTH];
17351731 u8 read_locked = 1, write_locked = 1;
1736− const u8 *method;
17371732 struct opal_lock_unlock *lkul = data;
17381733 int ret;
17391734
17401735 clear_opal_cmd(dev);
17411736 set_comid(dev, dev->comid);
17421737
1743− method = opalmethod[OPAL_SET];
17441738 if (build_locking_range(lr_buffer, sizeof(lr_buffer),
17451739 lkul->session.opal_key.lr) < 0)
17461740 return -ERANGE;
@@ -2133,7 +2127,7 @@ static int opal_add_user_to_lr(struct opal_dev *dev, · 386 unmodified lines
21332127 pr_err("Locking state was not RO or RW\n");
21342128 return -EINVAL;
21352129 }
2136− if (lk_unlk->session.who < OPAL_USER1 &&
2130+ if (lk_unlk->session.who < OPAL_USER1 ||
21372131 lk_unlk->session.who > OPAL_USER9) {
21382132 pr_err("Authority was not within the range of users: %d\n",
21392133 lk_unlk->session.who);
@@ -2316,7 +2310,7 @@ static int opal_activate_user(struct opal_dev *dev, · 176 unmodified lines
23162310 int ret;
23172311
23182312 /* We can't activate Admin1 it's active as manufactured */
2319− if (opal_session->who < OPAL_USER1 &&
2313+ if (opal_session->who < OPAL_USER1 ||
23202314 opal_session->who > OPAL_USER9) {
23212315 pr_err("Who was not a valid user: %d\n", opal_session->who);
23222316 return -EINVAL;
crypto/af_alg.c+5−4
@@ -266,7 +266,7 @@ unlock: · 265 unmodified lines
266266 return err;
267267 }
268268
269−int af_alg_accept(struct sock *sk, struct socket *newsock)
269+int af_alg_accept(struct sock *sk, struct socket *newsock, bool kern)
270270 {
271271 struct alg_sock *ask = alg_sk(sk);
272272 const struct af_alg_type *type;
@@ -281,7 +281,7 @@ int af_alg_accept(struct sock *sk, struct socket *newsock) · 8 unmodified lines
281281 if (!type)
282282 goto unlock;
283283
284− sk2 = sk_alloc(sock_net(sk), PF_ALG, GFP_KERNEL, &alg_proto, 0);
284+ sk2 = sk_alloc(sock_net(sk), PF_ALG, GFP_KERNEL, &alg_proto, kern);
285285 err = -ENOMEM;
286286 if (!sk2)
287287 goto unlock;
@@ -323,9 +323,10 @@ unlock: · 35 unmodified lines
323323 }
324324 EXPORT_SYMBOL_GPL(af_alg_accept);
325325
326−static int alg_accept(struct socket *sock, struct socket *newsock, int flags)
326+static int alg_accept(struct socket *sock, struct socket *newsock, int flags,
327+ bool kern)
327328 {
328− return af_alg_accept(sock->sk, newsock);
329+ return af_alg_accept(sock->sk, newsock, kern);
329330 }
330331
331332 static const struct proto_ops alg_proto_ops = {
crypto/algif_hash.c+5−4
@@ -239,7 +239,8 @@ unlock: · 238 unmodified lines
239239 return err ?: len;
240240 }
241241
242−static int hash_accept(struct socket *sock, struct socket *newsock, int flags)
242+static int hash_accept(struct socket *sock, struct socket *newsock, int flags,
243+ bool kern)
243244 {
244245 struct sock *sk = sock->sk;
245246 struct alg_sock *ask = alg_sk(sk);
@@ -260,7 +261,7 @@ static int hash_accept(struct socket *sock, struct socket *newsock, int flags) · 14 unmodified lines
260261 if (err)
261262 return err;
262263
263− err = af_alg_accept(ask->parent, newsock);
264+ err = af_alg_accept(ask->parent, newsock, kern);
264265 if (err)
265266 return err;
266267
@@ -378,7 +379,7 @@ static int hash_recvmsg_nokey(struct socket *sock, struct msghdr *msg, · 111 unmodified lines
378379 }
379380
380381 static int hash_accept_nokey(struct socket *sock, struct socket *newsock,
381− int flags)
382+ int flags, bool kern)
382383 {
383384 int err;
384385
@@ -386,7 +387,7 @@ static int hash_accept_nokey(struct socket *sock, struct socket *newsock, · 1 unmodified line
386387 if (err)
387388 return err;
388389
389− return hash_accept(sock, newsock, flags);
390+ return hash_accept(sock, newsock, flags, kern);
390391 }
391392
392393 static struct proto_ops algif_hash_ops_nokey = {
drivers/acpi/internal.h+2−0
@@ -41,8 +41,10 @@ void acpi_gpe_apply_masked_gpes(void); · 40 unmodified lines
4141 void acpi_container_init(void);
4242 void acpi_memory_hotplug_init(void);
4343 #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
44+void pci_ioapic_remove(struct acpi_pci_root *root);
4445 int acpi_ioapic_remove(struct acpi_pci_root *root);
4546 #else
47+static inline void pci_ioapic_remove(struct acpi_pci_root *root) { return; }
4648 static inline int acpi_ioapic_remove(struct acpi_pci_root *root) { return 0; }
4749 #endif
4850 #ifdef CONFIG_ACPI_DOCK
drivers/acpi/ioapic.c+16−6
@@ -206,24 +206,34 @@ int acpi_ioapic_add(acpi_handle root_handle) · 205 unmodified lines
206206 return ACPI_SUCCESS(status) && ACPI_SUCCESS(retval) ? 0 : -ENODEV;
207207 }
208208
209−int acpi_ioapic_remove(struct acpi_pci_root *root)
209+void pci_ioapic_remove(struct acpi_pci_root *root)
210210 {
211− int retval = 0;
212211 struct acpi_pci_ioapic *ioapic, *tmp;
213212
214213 mutex_lock(&ioapic_list_lock);
215214 list_for_each_entry_safe(ioapic, tmp, &ioapic_list, list) {
216215 if (root->device->handle != ioapic->root_handle)
217216 continue;
218−
219− if (acpi_unregister_ioapic(ioapic->handle, ioapic->gsi_base))
220− retval = -EBUSY;
221−
222217 if (ioapic->pdev) {
223218 pci_release_region(ioapic->pdev, 0);
224219 pci_disable_device(ioapic->pdev);
225220 pci_dev_put(ioapic->pdev);
226221 }
222+ }
223+ mutex_unlock(&ioapic_list_lock);
224+}
225+
226+int acpi_ioapic_remove(struct acpi_pci_root *root)
227+{
228+ int retval = 0;
229+ struct acpi_pci_ioapic *ioapic, *tmp;
230+
231+ mutex_lock(&ioapic_list_lock);
232+ list_for_each_entry_safe(ioapic, tmp, &ioapic_list, list) {
233+ if (root->device->handle != ioapic->root_handle)
234+ continue;
235+ if (acpi_unregister_ioapic(ioapic->handle, ioapic->gsi_base))
236+ retval = -EBUSY;
227237 if (ioapic->res.flags && ioapic->res.parent)
228238 release_resource(&ioapic->res);
229239 list_del(&ioapic->list);
drivers/acpi/pci_root.c+2−2
@@ -648,12 +648,12 @@ static void acpi_pci_root_remove(struct acpi_device *device) · 647 unmodified lines
648648
649649 pci_stop_root_bus(root->bus);
650650
651− WARN_ON(acpi_ioapic_remove(root));
652−
651+ pci_ioapic_remove(root);
653652 device_set_run_wake(root->bus->bridge, false);
654653 pci_acpi_remove_bus_pm_notifier(device);
655654
656655 pci_remove_root_bus(root->bus);
656+ WARN_ON(acpi_ioapic_remove(root));
657657
658658 dmar_device_remove(device->handle);
659659
drivers/ata/ahci_qoriq.c+4−2
@@ -177,7 +177,8 @@ static int ahci_qoriq_phy_init(struct ahci_host_priv *hpriv) · 176 unmodified lines
177177 case AHCI_LS1043A:
178178 if (!qpriv->ecc_addr)
179179 return -EINVAL;
180− writel(ECC_DIS_ARMV8_CH2, qpriv->ecc_addr);
180+ writel(readl(qpriv->ecc_addr) | ECC_DIS_ARMV8_CH2,
181+ qpriv->ecc_addr);
181182 writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1);
182183 writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS);
183184 if (qpriv->is_dmacoherent)
@@ -194,7 +195,8 @@ static int ahci_qoriq_phy_init(struct ahci_host_priv *hpriv) · 10 unmodified lines
194195 case AHCI_LS1046A:
195196 if (!qpriv->ecc_addr)
196197 return -EINVAL;
197− writel(ECC_DIS_ARMV8_CH2, qpriv->ecc_addr);
198+ writel(readl(qpriv->ecc_addr) | ECC_DIS_ARMV8_CH2,
199+ qpriv->ecc_addr);
198200 writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1);
199201 writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS);
200202 if (qpriv->is_dmacoherent)
drivers/ata/libata-sff.c+0−1
@@ -1482,7 +1482,6 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc) · 1481 unmodified lines
14821482 break;
14831483
14841484 default:
1485− WARN_ON_ONCE(1);
14861485 return AC_ERR_SYSTEM;
14871486 }
14881487
drivers/ata/libata-transport.c+3−6
@@ -224,7 +224,6 @@ static DECLARE_TRANSPORT_CLASS(ata_port_class, · 223 unmodified lines
224224
225225 static void ata_tport_release(struct device *dev)
226226 {
227− put_device(dev->parent);
228227 }
229228
230229 /**
@@ -284,7 +283,7 @@ int ata_tport_add(struct device *parent, · 53 unmodified lines
284283 device_initialize(dev);
285284 dev->type = &ata_port_type;
286285
287− dev->parent = get_device(parent);
286+ dev->parent = parent;
288287 dev->release = ata_tport_release;
289288 dev_set_name(dev, "ata%d", ap->print_id);
290289 transport_setup_device(dev);
@@ -348,7 +347,6 @@ static DECLARE_TRANSPORT_CLASS(ata_link_class, · 57 unmodified lines
348347
349348 static void ata_tlink_release(struct device *dev)
350349 {
351− put_device(dev->parent);
352350 }
353351
354352 /**
@@ -410,7 +408,7 @@ int ata_tlink_add(struct ata_link *link) · 55 unmodified lines
410408 int error;
411409
412410 device_initialize(dev);
413− dev->parent = get_device(&ap->tdev);
411+ dev->parent = &ap->tdev;
414412 dev->release = ata_tlink_release;
415413 if (ata_is_host_link(link))
416414 dev_set_name(dev, "link%d", ap->print_id);
@@ -589,7 +587,6 @@ static DECLARE_TRANSPORT_CLASS(ata_dev_class, · 172 unmodified lines
589587
590588 static void ata_tdev_release(struct device *dev)
591589 {
592− put_device(dev->parent);
593590 }
594591
595592 /**
@@ -662,7 +659,7 @@ static int ata_tdev_add(struct ata_device *ata_dev) · 66 unmodified lines
662659 int error;
663660
664661 device_initialize(dev);
665− dev->parent = get_device(&link->tdev);
662+ dev->parent = &link->tdev;
666663 dev->release = ata_tdev_release;
667664 if (ata_is_host_link(link))
668665 dev_set_name(dev, "dev%d.%d", ap->print_id,ata_dev->devno);
drivers/block/paride/pcd.c+1−1
@@ -50,7 +50,7 @@ · 49 unmodified lines
5050 the slower the port i/o. In some cases, setting
5151 this to zero will speed up the device. (default -1)
5252
53− major You may use this parameter to overide the
53+ major You may use this parameter to override the
5454 default major number (46) that this driver
5555 will use. Be sure to change the device
5656 name as well.
drivers/block/paride/pd.c+1−1
@@ -61,7 +61,7 @@ · 60 unmodified lines
6161 first drive found.
6262
6363
64− major You may use this parameter to overide the
64+ major You may use this parameter to override the
6565 default major number (45) that this driver
6666 will use. Be sure to change the device
6767 name as well.
drivers/block/paride/pf.c+1−1
@@ -59,7 +59,7 @@ · 58 unmodified lines
5959 the slower the port i/o. In some cases, setting
6060 this to zero will speed up the device. (default -1)
6161
62− major You may use this parameter to overide the
62+ major You may use this parameter to override the
6363 default major number (47) that this driver
6464 will use. Be sure to change the device
6565 name as well.
drivers/block/paride/pg.c+1−1
@@ -84,7 +84,7 @@ · 83 unmodified lines
8484 the slower the port i/o. In some cases, setting
8585 this to zero will speed up the device. (default -1)
8686
87− major You may use this parameter to overide the
87+ major You may use this parameter to override the
8888 default major number (97) that this driver
8989 will use. Be sure to change the device
9090 name as well.
drivers/block/paride/pt.c+1−1
@@ -61,7 +61,7 @@ · 60 unmodified lines
6161 the slower the port i/o. In some cases, setting
6262 this to zero will speed up the device. (default -1)
6363
64− major You may use this parameter to overide the
64+ major You may use this parameter to override the
6565 default major number (96) that this driver
6666 will use. Be sure to change the device
6767 name as well.
drivers/block/rbd.c+12−4
@@ -120,10 +120,11 @@ static int atomic_dec_return_safe(atomic_t *v) · 119 unmodified lines
120120
121121 /* Feature bits */
122122
123−#define RBD_FEATURE_LAYERING (1<<0)
124−#define RBD_FEATURE_STRIPINGV2 (1<<1)
125−#define RBD_FEATURE_EXCLUSIVE_LOCK (1<<2)
126−#define RBD_FEATURE_DATA_POOL (1<<7)
123+#define RBD_FEATURE_LAYERING (1ULL<<0)
124+#define RBD_FEATURE_STRIPINGV2 (1ULL<<1)
125+#define RBD_FEATURE_EXCLUSIVE_LOCK (1ULL<<2)
126+#define RBD_FEATURE_DATA_POOL (1ULL<<7)
127+
127128 #define RBD_FEATURES_ALL (RBD_FEATURE_LAYERING | \
128129 RBD_FEATURE_STRIPINGV2 | \
129130 RBD_FEATURE_EXCLUSIVE_LOCK | \
@@ -499,16 +500,23 @@ static bool rbd_is_lock_owner(struct rbd_device *rbd_dev) · 369 unmodified lines
499500 return is_lock_owner;
500501 }
501502
503+static ssize_t rbd_supported_features_show(struct bus_type *bus, char *buf)
504+{
505+ return sprintf(buf, "0x%llx\n", RBD_FEATURES_SUPPORTED);
506+}
507+
502508 static BUS_ATTR(add, S_IWUSR, NULL, rbd_add);
503509 static BUS_ATTR(remove, S_IWUSR, NULL, rbd_remove);
504510 static BUS_ATTR(add_single_major, S_IWUSR, NULL, rbd_add_single_major);
505511 static BUS_ATTR(remove_single_major, S_IWUSR, NULL, rbd_remove_single_major);
512+static BUS_ATTR(supported_features, S_IRUGO, rbd_supported_features_show, NULL);
506513
507514 static struct attribute *rbd_bus_attrs[] = {
508515 &bus_attr_add.attr,
509516 &bus_attr_remove.attr,
510517 &bus_attr_add_single_major.attr,
511518 &bus_attr_remove_single_major.attr,
519+ &bus_attr_supported_features.attr,
512520 NULL,
513521 };
514522
drivers/block/zram/zram_drv.c+2−0
@@ -1189,6 +1189,8 @@ static int zram_add(void) · 1188 unmodified lines
11891189 blk_queue_io_min(zram->disk->queue, PAGE_SIZE);
11901190 blk_queue_io_opt(zram->disk->queue, PAGE_SIZE);
11911191 zram->disk->queue->limits.discard_granularity = PAGE_SIZE;
1192+ zram->disk->queue->limits.max_sectors = SECTORS_PER_PAGE;
1193+ zram->disk->queue->limits.chunk_sectors = 0;
11921194 blk_queue_max_discard_sectors(zram->disk->queue, UINT_MAX);
11931195 /*
11941196 * zram_bio_discard() will clear all logical blocks if logical block
drivers/char/hw_random/omap-rng.c+14−2
@@ -397,9 +397,8 @@ static int of_get_omap_rng_device_details(struct omap_rng_dev *priv, · 396 unmodified lines
397397 irq, err);
398398 return err;
399399 }
400− omap_rng_write(priv, RNG_INTMASK_REG, RNG_SHUTDOWN_OFLO_MASK);
401400
402− priv->clk = of_clk_get(pdev->dev.of_node, 0);
401+ priv->clk = devm_clk_get(&pdev->dev, NULL);
403402 if (IS_ERR(priv->clk) && PTR_ERR(priv->clk) == -EPROBE_DEFER)
404403 return -EPROBE_DEFER;
405404 if (!IS_ERR(priv->clk)) {
@@ -408,6 +407,19 @@ static int of_get_omap_rng_device_details(struct omap_rng_dev *priv, · 2 unmodified lines
408407 dev_err(&pdev->dev, "unable to enable the clk, "
409408 "err = %d\n", err);
410409 }
410+
411+ /*
412+ * On OMAP4, enabling the shutdown_oflo interrupt is
413+ * done in the interrupt mask register. There is no
414+ * such register on EIP76, and it's enabled by the
415+ * same bit in the control register
416+ */
417+ if (priv->pdata->regs[RNG_INTMASK_REG])
418+ omap_rng_write(priv, RNG_INTMASK_REG,
419+ RNG_SHUTDOWN_OFLO_MASK);
420+ else
421+ omap_rng_write(priv, RNG_CONTROL_REG,
422+ RNG_SHUTDOWN_OFLO_MASK);
411423 }
412424 return 0;
413425 }
drivers/char/nwbutton.c+1−1
@@ -6,7 +6,7 @@ · 5 unmodified lines
66
77 #include <linux/module.h>
88 #include <linux/kernel.h>
9−#include <linux/sched.h>
9+#include <linux/sched/signal.h>
1010 #include <linux/interrupt.h>
1111 #include <linux/time.h>
1212 #include <linux/timer.h>
drivers/char/random.c+50−79
@@ -312,13 +312,6 @@ static int random_read_wakeup_bits = 64; · 311 unmodified lines
312312 */
313313 static int random_write_wakeup_bits = 28 * OUTPUT_POOL_WORDS;
314314
315−/*
316− * The minimum number of seconds between urandom pool reseeding. We
317− * do this to limit the amount of entropy that can be drained from the
318− * input pool even if there are heavy demands on /dev/urandom.
319− */
320−static int random_min_urandom_seed = 60;
321−
322315 /*
323316 * Originally, we used a primitive polynomial of degree .poolwords
324317 * over GF(2). The taps for various sizes are defined below. They
@@ -409,7 +402,6 @@ static struct poolinfo { · 84 unmodified lines
409402 */
410403 static DECLARE_WAIT_QUEUE_HEAD(random_read_wait);
411404 static DECLARE_WAIT_QUEUE_HEAD(random_write_wait);
412−static DECLARE_WAIT_QUEUE_HEAD(urandom_init_wait);
413405 static struct fasync_struct *fasync;
414406
415407 static DEFINE_SPINLOCK(random_ready_list_lock);
@@ -467,7 +459,6 @@ struct entropy_store { · 51 unmodified lines
467459 int entropy_count;
468460 int entropy_total;
469461 unsigned int initialized:1;
470− unsigned int limit:1;
471462 unsigned int last_data_init:1;
472463 __u8 last_data[EXTRACT_SIZE];
473464 };
@@ -485,7 +476,6 @@ static __u32 blocking_pool_data[OUTPUT_POOL_WORDS] __latent_entropy; · 11 unmodified lines
485476 static struct entropy_store input_pool = {
486477 .poolinfo = &poolinfo_table[0],
487478 .name = "input",
488− .limit = 1,
489479 .lock = __SPIN_LOCK_UNLOCKED(input_pool.lock),
490480 .pool = input_pool_data
491481 };
@@ -493,7 +483,6 @@ static struct entropy_store input_pool = { · 1 unmodified line
493483 static struct entropy_store blocking_pool = {
494484 .poolinfo = &poolinfo_table[1],
495485 .name = "blocking",
496− .limit = 1,
497486 .pull = &input_pool,
498487 .lock = __SPIN_LOCK_UNLOCKED(blocking_pool.lock),
499488 .pool = blocking_pool_data,
@@ -855,13 +844,6 @@ static void crng_reseed(struct crng_state *crng, struct entropy_store *r) · 355 unmodified lines
855844 spin_unlock_irqrestore(&primary_crng.lock, flags);
856845 }
857846
858−static inline void maybe_reseed_primary_crng(void)
859−{
860− if (crng_init > 2 &&
861− time_after(jiffies, primary_crng.init_time + CRNG_RESEED_INTERVAL))
862− crng_reseed(&primary_crng, &input_pool);
863−}
864−
865847 static inline void crng_wait_ready(void)
866848 {
867849 wait_event_interruptible(crng_init_wait, crng_ready());
@@ -1220,15 +1202,6 @@ static void xfer_secondary_pool(struct entropy_store *r, size_t nbytes) · 352 unmodified lines
12201202 r->entropy_count > r->poolinfo->poolfracbits)
12211203 return;
12221204
1223− if (r->limit == 0 && random_min_urandom_seed) {
1224− unsigned long now = jiffies;
1225−
1226− if (time_before(now,
1227− r->last_pulled + random_min_urandom_seed * HZ))
1228− return;
1229− r->last_pulled = now;
1230− }
1231−
12321205 _xfer_secondary_pool(r, nbytes);
12331206 }
12341207
@@ -1236,8 +1209,6 @@ static void _xfer_secondary_pool(struct entropy_store *r, size_t nbytes) · 1 unmodified line
12361209 {
12371210 __u32 tmp[OUTPUT_POOL_WORDS];
12381211
1239− /* For /dev/random's pool, always leave two wakeups' worth */
1240− int rsvd_bytes = r->limit ? 0 : random_read_wakeup_bits / 4;
12411212 int bytes = nbytes;
12421213
12431214 /* pull at least as much as a wakeup */
@@ -1248,7 +1219,7 @@ static void _xfer_secondary_pool(struct entropy_store *r, size_t nbytes) · 4 unmodified lines
12481219 trace_xfer_secondary_pool(r->name, bytes * 8, nbytes * 8,
12491220 ENTROPY_BITS(r), ENTROPY_BITS(r->pull));
12501221 bytes = extract_entropy(r->pull, tmp, bytes,
1251− random_read_wakeup_bits / 8, rsvd_bytes);
1222+ random_read_wakeup_bits / 8, 0);
12521223 mix_pool_bytes(r, tmp, bytes);
12531224 credit_entropy_bits(r, bytes*8);
12541225 }
@@ -1276,7 +1247,7 @@ static void push_to_pool(struct work_struct *work) · 21 unmodified lines
12761247 static size_t account(struct entropy_store *r, size_t nbytes, int min,
12771248 int reserved)
12781249 {
1279− int entropy_count, orig;
1250+ int entropy_count, orig, have_bytes;
12801251 size_t ibytes, nfrac;
12811252
12821253 BUG_ON(r->entropy_count > r->poolinfo->poolfracbits);
@@ -1285,14 +1256,12 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min, · 2 unmodified lines
12851256 retry:
12861257 entropy_count = orig = ACCESS_ONCE(r->entropy_count);
12871258 ibytes = nbytes;
1288− /* If limited, never pull more than available */
1289− if (r->limit) {
1290− int have_bytes = entropy_count >> (ENTROPY_SHIFT + 3);
1259+ /* never pull more than available */
1260+ have_bytes = entropy_count >> (ENTROPY_SHIFT + 3);
12911261
1292− if ((have_bytes -= reserved) < 0)
1293− have_bytes = 0;
1294− ibytes = min_t(size_t, ibytes, have_bytes);
1295− }
1262+ if ((have_bytes -= reserved) < 0)
1263+ have_bytes = 0;
1264+ ibytes = min_t(size_t, ibytes, have_bytes);
12961265 if (ibytes < min)
12971266 ibytes = 0;
12981267
@@ -1912,6 +1881,7 @@ SYSCALL_DEFINE3(getrandom, char __user *, buf, size_t, count, · 613 unmodified lines
19121881 static int min_read_thresh = 8, min_write_thresh;
19131882 static int max_read_thresh = OUTPUT_POOL_WORDS * 32;
19141883 static int max_write_thresh = INPUT_POOL_WORDS * 32;
1884+static int random_min_urandom_seed = 60;
19151885 static char sysctl_bootid[16];
19161886
19171887 /*
@@ -2042,63 +2012,64 @@ struct ctl_table random_table[] = { · 124 unmodified lines
20422012 };
20432013 #endif /* CONFIG_SYSCTL */
20442014
2045−static u32 random_int_secret[MD5_MESSAGE_BYTES / 4] ____cacheline_aligned;
2046−
2047−int random_int_secret_init(void)
2048−{
2049− get_random_bytes(random_int_secret, sizeof(random_int_secret));
2050− return 0;
2051−}
2052−
2053−static DEFINE_PER_CPU(__u32 [MD5_DIGEST_WORDS], get_random_int_hash)
2054− __aligned(sizeof(unsigned long));
2015+struct batched_entropy {
2016+ union {
2017+ u64 entropy_u64[CHACHA20_BLOCK_SIZE / sizeof(u64)];
2018+ u32 entropy_u32[CHACHA20_BLOCK_SIZE / sizeof(u32)];
2019+ };
2020+ unsigned int position;
2021+};
20552022
20562023 /*
2057− * Get a random word for internal kernel use only. Similar to urandom but
2058− * with the goal of minimal entropy pool depletion. As a result, the random
2059− * value is not cryptographically secure but for several uses the cost of
2060− * depleting entropy is too high
2024+ * Get a random word for internal kernel use only. The quality of the random
2025+ * number is either as good as RDRAND or as good as /dev/urandom, with the
2026+ * goal of being quite fast and not depleting entropy.
20612027 */
2062−unsigned int get_random_int(void)
2028+static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u64);
2029+u64 get_random_u64(void)
20632030 {
2064− __u32 *hash;
2065− unsigned int ret;
2031+ u64 ret;
2032+ struct batched_entropy *batch;
20662033
2067− if (arch_get_random_int(&ret))
2034+#if BITS_PER_LONG == 64
2035+ if (arch_get_random_long((unsigned long *)&ret))
20682036 return ret;
2037+#else
2038+ if (arch_get_random_long((unsigned long *)&ret) &&
2039+ arch_get_random_long((unsigned long *)&ret + 1))
2040+ return ret;
2041+#endif
20692042
2070− hash = get_cpu_var(get_random_int_hash);
2071−
2072− hash[0] += current->pid + jiffies + random_get_entropy();
2073− md5_transform(hash, random_int_secret);
2074− ret = hash[0];
2075− put_cpu_var(get_random_int_hash);
2076−
2043+ batch = &get_cpu_var(batched_entropy_u64);
2044+ if (batch->position % ARRAY_SIZE(batch->entropy_u64) == 0) {
2045+ extract_crng((u8 *)batch->entropy_u64);
2046+ batch->position = 0;
2047+ }
2048+ ret = batch->entropy_u64[batch->position++];
2049+ put_cpu_var(batched_entropy_u64);
20772050 return ret;
20782051 }
2079−EXPORT_SYMBOL(get_random_int);
2052+EXPORT_SYMBOL(get_random_u64);
20802053
2081−/*
2082− * Same as get_random_int(), but returns unsigned long.
2083− */
2084−unsigned long get_random_long(void)
2054+static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u32);
2055+u32 get_random_u32(void)
20852056 {
2086− __u32 *hash;
2087− unsigned long ret;
2057+ u32 ret;
2058+ struct batched_entropy *batch;
20882059
2089− if (arch_get_random_long(&ret))
2060+ if (arch_get_random_int(&ret))
20902061 return ret;
20912062
2092− hash = get_cpu_var(get_random_int_hash);
2093−
2094− hash[0] += current->pid + jiffies + random_get_entropy();
2095− md5_transform(hash, random_int_secret);
2096− ret = *(unsigned long *)hash;
2097− put_cpu_var(get_random_int_hash);
2098−
2063+ batch = &get_cpu_var(batched_entropy_u32);
2064+ if (batch->position % ARRAY_SIZE(batch->entropy_u32) == 0) {
2065+ extract_crng((u8 *)batch->entropy_u32);
2066+ batch->position = 0;
2067+ }
2068+ ret = batch->entropy_u32[batch->position++];
2069+ put_cpu_var(batched_entropy_u32);
20992070 return ret;
21002071 }
2101−EXPORT_SYMBOL(get_random_long);
2072+EXPORT_SYMBOL(get_random_u32);
21022073
21032074 /**
21042075 * randomize_page - Generate a random, page aligned address
drivers/cpufreq/cpufreq.c+1−0
@@ -2532,4 +2532,5 @@ static int __init cpufreq_core_init(void) · 2531 unmodified lines
25322532
25332533 return 0;
25342534 }
2535+module_param(off, int, 0444);
25352536 core_initcall(cpufreq_core_init);
drivers/cpufreq/intel_pstate.c+31−36
@@ -377,6 +377,7 @@ static void intel_pstate_set_performance_limits(struct perf_limits *limits) · 376 unmodified lines
377377 intel_pstate_init_limits(limits);
378378 limits->min_perf_pct = 100;
379379 limits->min_perf = int_ext_tofp(1);
380+ limits->min_sysfs_pct = 100;
380381 }
381382
382383 static DEFINE_MUTEX(intel_pstate_driver_lock);
@@ -968,11 +969,20 @@ static int intel_pstate_resume(struct cpufreq_policy *policy) · 585 unmodified lines
968969 }
969970
970971 static void intel_pstate_update_policies(void)
972+ __releases(&intel_pstate_limits_lock)
973+ __acquires(&intel_pstate_limits_lock)
971974 {
975+ struct perf_limits *saved_limits = limits;
972976 int cpu;
973977
978+ mutex_unlock(&intel_pstate_limits_lock);
979+
974980 for_each_possible_cpu(cpu)
975981 cpufreq_update_policy(cpu);
982+
983+ mutex_lock(&intel_pstate_limits_lock);
984+
985+ limits = saved_limits;
976986 }
977987
978988 /************************** debugfs begin ************************/
@@ -1180,10 +1190,10 @@ static ssize_t store_no_turbo(struct kobject *a, struct attribute *b, · 201 unmodified lines
11801190
11811191 limits->no_turbo = clamp_t(int, input, 0, 1);
11821192
1183− mutex_unlock(&intel_pstate_limits_lock);
1184−
11851193 intel_pstate_update_policies();
11861194
1195+ mutex_unlock(&intel_pstate_limits_lock);
1196+
11871197 mutex_unlock(&intel_pstate_driver_lock);
11881198
11891199 return count;
@@ -1217,10 +1227,10 @@ static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b, · 27 unmodified lines
12171227 limits->max_perf_pct);
12181228 limits->max_perf = div_ext_fp(limits->max_perf_pct, 100);
12191229
1220− mutex_unlock(&intel_pstate_limits_lock);
1221−
12221230 intel_pstate_update_policies();
12231231
1232+ mutex_unlock(&intel_pstate_limits_lock);
1233+
12241234 mutex_unlock(&intel_pstate_driver_lock);
12251235
12261236 return count;
@@ -1254,10 +1264,10 @@ static ssize_t store_min_perf_pct(struct kobject *a, struct attribute *b, · 27 unmodified lines
12541264 limits->min_perf_pct);
12551265 limits->min_perf = div_ext_fp(limits->min_perf_pct, 100);
12561266
1257− mutex_unlock(&intel_pstate_limits_lock);
1258−
12591267 intel_pstate_update_policies();
12601268
1269+ mutex_unlock(&intel_pstate_limits_lock);
1270+
12611271 mutex_unlock(&intel_pstate_driver_lock);
12621272
12631273 return count;
@@ -1874,13 +1884,11 @@ static int intel_pstate_prepare_request(struct cpudata *cpu, int pstate) · 610 unmodified lines
18741884
18751885 intel_pstate_get_min_max(cpu, &min_perf, &max_perf);
18761886 pstate = clamp_t(int, pstate, min_perf, max_perf);
1877− trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu);
18781887 return pstate;
18791888 }
18801889
18811890 static void intel_pstate_update_pstate(struct cpudata *cpu, int pstate)
18821891 {
1883− pstate = intel_pstate_prepare_request(cpu, pstate);
18841892 if (pstate == cpu->pstate.current_pstate)
18851893 return;
18861894
@@ -1900,6 +1908,8 @@ static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu) · 13 unmodified lines
19001908
19011909 update_turbo_state();
19021910
1911+ target_pstate = intel_pstate_prepare_request(cpu, target_pstate);
1912+ trace_cpu_frequency(target_pstate * cpu->pstate.scaling, cpu->cpu);
19031913 intel_pstate_update_pstate(cpu, target_pstate);
19041914
19051915 sample = &cpu->sample;
@@ -2132,16 +2142,11 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) · 226 unmodified lines
21322142 mutex_lock(&intel_pstate_limits_lock);
21332143
21342144 if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) {
2145+ pr_debug("set performance\n");
21352146 if (!perf_limits) {
21362147 limits = &performance_limits;
21372148 perf_limits = limits;
21382149 }
2139− if (policy->max >= policy->cpuinfo.max_freq &&
2140− !limits->no_turbo) {
2141− pr_debug("set performance\n");
2142− intel_pstate_set_performance_limits(perf_limits);
2143− goto out;
2144− }
21452150 } else {
21462151 pr_debug("set powersave\n");
21472152 if (!perf_limits) {
@@ -2152,7 +2157,7 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) · 4 unmodified lines
21522157 }
21532158
21542159 intel_pstate_update_perf_limits(policy, perf_limits);
2155− out:
2160+
21562161 if (cpu->policy == CPUFREQ_POLICY_PERFORMANCE) {
21572162 /*
21582163 * NOHZ_FULL CPUs need this as the governor callback may not
@@ -2198,9 +2203,9 @@ static int intel_pstate_verify_policy(struct cpufreq_policy *policy) · 39 unmodified lines
21982203 unsigned int max_freq, min_freq;
21992204
22002205 max_freq = policy->cpuinfo.max_freq *
2201− limits->max_sysfs_pct / 100;
2206+ perf_limits->max_sysfs_pct / 100;
22022207 min_freq = policy->cpuinfo.max_freq *
2203− limits->min_sysfs_pct / 100;
2208+ perf_limits->min_sysfs_pct / 100;
22042209 cpufreq_verify_within_limits(policy, min_freq, max_freq);
22052210 }
22062211
@@ -2243,13 +2248,8 @@ static int __intel_pstate_cpu_init(struct cpufreq_policy *policy) · 36 unmodified lines
22432248
22442249 cpu = all_cpu_data[policy->cpu];
22452250
2246− /*
2247− * We need sane value in the cpu->perf_limits, so inherit from global
2248− * perf_limits limits, which are seeded with values based on the
2249− * CONFIG_CPU_FREQ_DEFAULT_GOV_*, during boot up.
2250− */
22512251 if (per_cpu_limits)
2252− memcpy(cpu->perf_limits, limits, sizeof(struct perf_limits));
2252+ intel_pstate_init_limits(cpu->perf_limits);
22532253
22542254 policy->min = cpu->pstate.min_pstate * cpu->pstate.scaling;
22552255 policy->max = cpu->pstate.turbo_pstate * cpu->pstate.scaling;
@@ -2301,7 +2301,6 @@ static struct cpufreq_driver intel_pstate = { · 45 unmodified lines
23012301 static int intel_cpufreq_verify_policy(struct cpufreq_policy *policy)
23022302 {
23032303 struct cpudata *cpu = all_cpu_data[policy->cpu];
2304− struct perf_limits *perf_limits = limits;
23052304
23062305 update_turbo_state();
23072306 policy->cpuinfo.max_freq = limits->turbo_disabled ?
@@ -2309,15 +2308,6 @@ static int intel_cpufreq_verify_policy(struct cpufreq_policy *policy) · 1 unmodified line
23092308
23102309 cpufreq_verify_within_cpu_limits(policy);
23112310
2312− if (per_cpu_limits)
2313− perf_limits = cpu->perf_limits;
2314−
2315− mutex_lock(&intel_pstate_limits_lock);
2316−
2317− intel_pstate_update_perf_limits(policy, perf_limits);
2318−
2319− mutex_unlock(&intel_pstate_limits_lock);
2320−
23212311 return 0;
23222312 }
23232313
@@ -2370,6 +2360,7 @@ static int intel_cpufreq_target(struct cpufreq_policy *policy, · 46 unmodified lines
23702360 wrmsrl_on_cpu(policy->cpu, MSR_IA32_PERF_CTL,
23712361 pstate_funcs.get_val(cpu, target_pstate));
23722362 }
2363+ freqs.new = target_pstate * cpu->pstate.scaling;
23732364 cpufreq_freq_transition_end(policy, &freqs, false);
23742365
23752366 return 0;
@@ -2383,8 +2374,9 @@ static unsigned int intel_cpufreq_fast_switch(struct cpufreq_policy *policy, · 7 unmodified lines
23832374
23842375 target_freq = intel_cpufreq_turbo_update(cpu, policy, target_freq);
23852376 target_pstate = DIV_ROUND_UP(target_freq, cpu->pstate.scaling);
2377+ target_pstate = intel_pstate_prepare_request(cpu, target_pstate);
23862378 intel_pstate_update_pstate(cpu, target_pstate);
2387− return target_freq;
2379+ return target_pstate * cpu->pstate.scaling;
23882380 }
23892381
23902382 static int intel_cpufreq_cpu_init(struct cpufreq_policy *policy)
@@ -2437,8 +2429,11 @@ static int intel_pstate_register_driver(void) · 46 unmodified lines
24372429
24382430 intel_pstate_init_limits(&powersave_limits);
24392431 intel_pstate_set_performance_limits(&performance_limits);
2440− limits = IS_ENABLED(CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE) ?
2441− &performance_limits : &powersave_limits;
2432+ if (IS_ENABLED(CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE) &&
2433+ intel_pstate_driver == &intel_pstate)
2434+ limits = &performance_limits;
2435+ else
2436+ limits = &powersave_limits;
24422437
24432438 ret = cpufreq_register_driver(intel_pstate_driver);
24442439 if (ret) {
drivers/crypto/s5p-sss.c+85−47
@@ -270,7 +270,7 @@ static void s5p_sg_copy_buf(void *buf, struct scatterlist *sg, · 269 unmodified lines
270270 scatterwalk_done(&walk, out, 0);
271271 }
272272
273−static void s5p_aes_complete(struct s5p_aes_dev *dev, int err)
273+static void s5p_sg_done(struct s5p_aes_dev *dev)
274274 {
275275 if (dev->sg_dst_cpy) {
276276 dev_dbg(dev->dev,
@@ -281,8 +281,11 @@ static void s5p_aes_complete(struct s5p_aes_dev *dev, int err) · 4 unmodified lines
281281 }
282282 s5p_free_sg_cpy(dev, &dev->sg_src_cpy);
283283 s5p_free_sg_cpy(dev, &dev->sg_dst_cpy);
284+}
284285
285− /* holding a lock outside */
286+/* Calls the completion. Cannot be called with dev->lock hold. */
287+static void s5p_aes_complete(struct s5p_aes_dev *dev, int err)
288+{
286289 dev->req->base.complete(&dev->req->base, err);
287290 dev->busy = false;
288291 }
@@ -368,51 +371,44 @@ exit: · 79 unmodified lines
368371 }
369372
370373 /*
371− * Returns true if new transmitting (output) data is ready and its
372− * address+length have to be written to device (by calling
373− * s5p_set_dma_outdata()). False otherwise.
374+ * Returns -ERRNO on error (mapping of new data failed).
375+ * On success returns:
376+ * - 0 if there is no more data,
377+ * - 1 if new transmitting (output) data is ready and its address+length
378+ * have to be written to device (by calling s5p_set_dma_outdata()).
374379 */
375−static bool s5p_aes_tx(struct s5p_aes_dev *dev)
380+static int s5p_aes_tx(struct s5p_aes_dev *dev)
376381 {
377− int err = 0;
378− bool ret = false;
382+ int ret = 0;
379383
380384 s5p_unset_outdata(dev);
381385
382386 if (!sg_is_last(dev->sg_dst)) {
383− err = s5p_set_outdata(dev, sg_next(dev->sg_dst));
384− if (err)
385− s5p_aes_complete(dev, err);
386− else
387− ret = true;
388− } else {
389− s5p_aes_complete(dev, err);
390−
391− dev->busy = true;
392− tasklet_schedule(&dev->tasklet);
387+ ret = s5p_set_outdata(dev, sg_next(dev->sg_dst));
388+ if (!ret)
389+ ret = 1;
393390 }
394391
395392 return ret;
396393 }
397394
398395 /*
399− * Returns true if new receiving (input) data is ready and its
400− * address+length have to be written to device (by calling
401− * s5p_set_dma_indata()). False otherwise.
396+ * Returns -ERRNO on error (mapping of new data failed).
397+ * On success returns:
398+ * - 0 if there is no more data,
399+ * - 1 if new receiving (input) data is ready and its address+length
400+ * have to be written to device (by calling s5p_set_dma_indata()).
402401 */
403−static bool s5p_aes_rx(struct s5p_aes_dev *dev)
402+static int s5p_aes_rx(struct s5p_aes_dev *dev/*, bool *set_dma*/)
404403 {
405− int err;
406− bool ret = false;
404+ int ret = 0;
407405
408406 s5p_unset_indata(dev);
409407
410408 if (!sg_is_last(dev->sg_src)) {
411− err = s5p_set_indata(dev, sg_next(dev->sg_src));
412− if (err)
413− s5p_aes_complete(dev, err);
414− else
415− ret = true;
409+ ret = s5p_set_indata(dev, sg_next(dev->sg_src));
410+ if (!ret)
411+ ret = 1;
416412 }
417413
418414 return ret;
@@ -422,33 +418,73 @@ static irqreturn_t s5p_aes_interrupt(int irq, void *dev_id) · 3 unmodified lines
422418 {
423419 struct platform_device *pdev = dev_id;
424420 struct s5p_aes_dev *dev = platform_get_drvdata(pdev);
425− bool set_dma_tx = false;
426− bool set_dma_rx = false;
421+ int err_dma_tx = 0;
422+ int err_dma_rx = 0;
423+ bool tx_end = false;
427424 unsigned long flags;
428425 uint32_t status;
426+ int err;
429427
430428 spin_lock_irqsave(&dev->lock, flags);
431429
430+ /*
431+ * Handle rx or tx interrupt. If there is still data (scatterlist did not
432+ * reach end), then map next scatterlist entry.
433+ * In case of such mapping error, s5p_aes_complete() should be called.
434+ *
435+ * If there is no more data in tx scatter list, call s5p_aes_complete()
436+ * and schedule new tasklet.
437+ */
432438 status = SSS_READ(dev, FCINTSTAT);
433439 if (status & SSS_FCINTSTAT_BRDMAINT)
434− set_dma_rx = s5p_aes_rx(dev);
435− if (status & SSS_FCINTSTAT_BTDMAINT)
436− set_dma_tx = s5p_aes_tx(dev);
440+ err_dma_rx = s5p_aes_rx(dev);
441+
442+ if (status & SSS_FCINTSTAT_BTDMAINT) {
443+ if (sg_is_last(dev->sg_dst))
444+ tx_end = true;
445+ err_dma_tx = s5p_aes_tx(dev);
446+ }
437447
438448 SSS_WRITE(dev, FCINTPEND, status);
439449
440− /*
441− * Writing length of DMA block (either receiving or transmitting)
442− * will start the operation immediately, so this should be done
443− * at the end (even after clearing pending interrupts to not miss the
444− * interrupt).
445− */
446− if (set_dma_tx)
447− s5p_set_dma_outdata(dev, dev->sg_dst);
448− if (set_dma_rx)
449− s5p_set_dma_indata(dev, dev->sg_src);
450+ if (err_dma_rx < 0) {
451+ err = err_dma_rx;
452+ goto error;
453+ }
454+ if (err_dma_tx < 0) {
455+ err = err_dma_tx;
456+ goto error;
457+ }
458+
459+ if (tx_end) {
460+ s5p_sg_done(dev);
461+
462+ spin_unlock_irqrestore(&dev->lock, flags);
463+
464+ s5p_aes_complete(dev, 0);
465+ dev->busy = true;
466+ tasklet_schedule(&dev->tasklet);
467+ } else {
468+ /*
469+ * Writing length of DMA block (either receiving or
470+ * transmitting) will start the operation immediately, so this
471+ * should be done at the end (even after clearing pending
472+ * interrupts to not miss the interrupt).
473+ */
474+ if (err_dma_tx == 1)
475+ s5p_set_dma_outdata(dev, dev->sg_dst);
476+ if (err_dma_rx == 1)
477+ s5p_set_dma_indata(dev, dev->sg_src);
450478
479+ spin_unlock_irqrestore(&dev->lock, flags);
480+ }
481+
482+ return IRQ_HANDLED;
483+
484+error:
485+ s5p_sg_done(dev);
451486 spin_unlock_irqrestore(&dev->lock, flags);
487+ s5p_aes_complete(dev, err);
452488
453489 return IRQ_HANDLED;
454490 }
@@ -597,8 +633,9 @@ outdata_error: · 142 unmodified lines
597633 s5p_unset_indata(dev);
598634
599635 indata_error:
600− s5p_aes_complete(dev, err);
636+ s5p_sg_done(dev);
601637 spin_unlock_irqrestore(&dev->lock, flags);
638+ s5p_aes_complete(dev, err);
602639 }
603640
604641 static void s5p_tasklet_cb(unsigned long data)
@@ -805,8 +842,9 @@ static int s5p_aes_probe(struct platform_device *pdev) · 200 unmodified lines
805842 dev_warn(dev, "feed control interrupt is not available.\n");
806843 goto err_irq;
807844 }
808− err = devm_request_irq(dev, pdata->irq_fc, s5p_aes_interrupt,
809− IRQF_SHARED, pdev->name, pdev);
845+ err = devm_request_threaded_irq(dev, pdata->irq_fc, NULL,
846+ s5p_aes_interrupt, IRQF_ONESHOT,
847+ pdev->name, pdev);
810848 if (err < 0) {
811849 dev_warn(dev, "feed control interrupt is not available.\n");
812850 goto err_irq;
drivers/crypto/ux500/cryp/cryp.c+1−1
@@ -82,7 +82,7 @@ void cryp_activity(struct cryp_device_data *device_data, · 81 unmodified lines
8282 void cryp_flush_inoutfifo(struct cryp_device_data *device_data)
8383 {
8484 /*
85− * We always need to disble the hardware before trying to flush the
85+ * We always need to disable the hardware before trying to flush the
8686 * FIFO. This is something that isn't written in the design
8787 * specification, but we have been informed by the hardware designers
8888 * that this must be done.
drivers/firmware/efi/arm-runtime.c+1−0
@@ -65,6 +65,7 @@ static bool __init efi_virtmap_init(void) · 64 unmodified lines
6565 bool systab_found;
6666
6767 efi_mm.pgd = pgd_alloc(&efi_mm);
68+ mm_init_cpumask(&efi_mm);
6869 init_new_context(NULL, &efi_mm);
6970
7071 systab_found = false;
drivers/firmware/efi/libstub/secureboot.c+2−2
@@ -45,6 +45,8 @@ enum efi_secureboot_mode efi_get_secureboot(efi_system_table_t *sys_table_arg) · 44 unmodified lines
4545 size = sizeof(secboot);
4646 status = get_efi_var(efi_SecureBoot_name, &efi_variable_guid,
4747 NULL, &size, &secboot);
48+ if (status == EFI_NOT_FOUND)
49+ return efi_secureboot_mode_disabled;
4850 if (status != EFI_SUCCESS)
4951 goto out_efi_err;
5052
@@ -78,7 +80,5 @@ secure_boot_enabled: · 27 unmodified lines
7880
7981 out_efi_err:
8082 pr_efi_err(sys_table_arg, "Could not determine UEFI Secure Boot status.\n");
81− if (status == EFI_NOT_FOUND)
82− return efi_secureboot_mode_disabled;
8383 return efi_secureboot_mode_unknown;
8484 }
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c+4−1
@@ -2094,8 +2094,11 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon) · 2093 unmodified lines
20942094 }
20952095
20962096 r = amdgpu_late_init(adev);
2097− if (r)
2097+ if (r) {
2098+ if (fbcon)
2099+ console_unlock();
20982100 return r;
2101+ }
20992102
21002103 /* pin cursors */
21012104 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+2−1
@@ -59,9 +59,10 @@ · 58 unmodified lines
5959 * - 3.7.0 - Add support for VCE clock list packet
6060 * - 3.8.0 - Add support raster config init in the kernel
6161 * - 3.9.0 - Add support for memory query info about VRAM and GTT.
62+ * - 3.10.0 - Add support for new fences ioctl, new gem ioctl flags
6263 */
6364 #define KMS_DRIVER_MAJOR 3
64−#define KMS_DRIVER_MINOR 9
65+#define KMS_DRIVER_MINOR 10
6566 #define KMS_DRIVER_PATCHLEVEL 0
6667
6768 int amdgpu_vram_limit = 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c+21−0
@@ -202,6 +202,27 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, · 201 unmodified lines
202202 bool kernel = false;
203203 int r;
204204
205+ /* reject invalid gem flags */
206+ if (args->in.domain_flags & ~(AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
207+ AMDGPU_GEM_CREATE_NO_CPU_ACCESS |
208+ AMDGPU_GEM_CREATE_CPU_GTT_USWC |
209+ AMDGPU_GEM_CREATE_VRAM_CLEARED|
210+ AMDGPU_GEM_CREATE_SHADOW |
211+ AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS)) {
212+ r = -EINVAL;
213+ goto error_unlock;
214+ }
215+ /* reject invalid gem domains */
216+ if (args->in.domains & ~(AMDGPU_GEM_DOMAIN_CPU |
217+ AMDGPU_GEM_DOMAIN_GTT |
218+ AMDGPU_GEM_DOMAIN_VRAM |
219+ AMDGPU_GEM_DOMAIN_GDS |
220+ AMDGPU_GEM_DOMAIN_GWS |
221+ AMDGPU_GEM_DOMAIN_OA)) {
222+ r = -EINVAL;
223+ goto error_unlock;
224+ }
225+
205226 /* create a gem object to contain this object in */
206227 if (args->in.domains & (AMDGPU_GEM_DOMAIN_GDS |
207228 AMDGPU_GEM_DOMAIN_GWS | AMDGPU_GEM_DOMAIN_OA)) {
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c+1−1
@@ -788,7 +788,7 @@ static int sdma_v3_0_start(struct amdgpu_device *adev) · 787 unmodified lines
788788 }
789789 }
790790
791− /* disble sdma engine before programing it */
791+ /* disable sdma engine before programing it */
792792 sdma_v3_0_ctx_switch_enable(adev, false);
793793 sdma_v3_0_enable(adev, false);
794794
drivers/gpu/drm/drm_edid.c+3−0
@@ -148,6 +148,9 @@ static const struct edid_quirk { · 147 unmodified lines
148148
149149 /* Panel in Samsung NP700G7A-S01PL notebook reports 6bpc */
150150 { "SEC", 0xd033, EDID_QUIRK_FORCE_8BPC },
151+
152+ /* Rotel RSX-1058 forwards sink's EDID but only does HDMI 1.1*/
153+ { "ETR", 13896, EDID_QUIRK_FORCE_8BPC },
151154 };
152155
153156 /*
drivers/gpu/drm/i915/gvt/cfg_space.c+54−3
@@ -41,6 +41,54 @@ enum { · 40 unmodified lines
4141 INTEL_GVT_PCI_BAR_MAX,
4242 };
4343
44+/* bitmap for writable bits (RW or RW1C bits, but cannot co-exist in one
45+ * byte) byte by byte in standard pci configuration space. (not the full
46+ * 256 bytes.)
47+ */
48+static const u8 pci_cfg_space_rw_bmp[PCI_INTERRUPT_LINE + 4] = {
49+ [PCI_COMMAND] = 0xff, 0x07,
50+ [PCI_STATUS] = 0x00, 0xf9, /* the only one RW1C byte */
51+ [PCI_CACHE_LINE_SIZE] = 0xff,
52+ [PCI_BASE_ADDRESS_0 ... PCI_CARDBUS_CIS - 1] = 0xff,
53+ [PCI_ROM_ADDRESS] = 0x01, 0xf8, 0xff, 0xff,
54+ [PCI_INTERRUPT_LINE] = 0xff,
55+};
56+
57+/**
58+ * vgpu_pci_cfg_mem_write - write virtual cfg space memory
59+ *
60+ * Use this function to write virtual cfg space memory.
61+ * For standard cfg space, only RW bits can be changed,
62+ * and we emulates the RW1C behavior of PCI_STATUS register.
63+ */
64+static void vgpu_pci_cfg_mem_write(struct intel_vgpu *vgpu, unsigned int off,
65+ u8 *src, unsigned int bytes)
66+{
67+ u8 *cfg_base = vgpu_cfg_space(vgpu);
68+ u8 mask, new, old;
69+ int i = 0;
70+
71+ for (; i < bytes && (off + i < sizeof(pci_cfg_space_rw_bmp)); i++) {
72+ mask = pci_cfg_space_rw_bmp[off + i];
73+ old = cfg_base[off + i];
74+ new = src[i] & mask;
75+
76+ /**
77+ * The PCI_STATUS high byte has RW1C bits, here
78+ * emulates clear by writing 1 for these bits.
79+ * Writing a 0b to RW1C bits has no effect.
80+ */
81+ if (off + i == PCI_STATUS + 1)
82+ new = (~new & old) & mask;
83+
84+ cfg_base[off + i] = (old & ~mask) | new;
85+ }
86+
87+ /* For other configuration space directly copy as it is. */
88+ if (i < bytes)
89+ memcpy(cfg_base + off + i, src + i, bytes - i);
90+}
91+
4492 /**
4593 * intel_vgpu_emulate_cfg_read - emulate vGPU configuration space read
4694 *
@@ -123,7 +171,7 @@ static int emulate_pci_command_write(struct intel_vgpu *vgpu, · 76 unmodified lines
123171 u8 changed = old ^ new;
124172 int ret;
125173
126− memcpy(vgpu_cfg_space(vgpu) + offset, p_data, bytes);
174+ vgpu_pci_cfg_mem_write(vgpu, offset, p_data, bytes);
127175 if (!(changed & PCI_COMMAND_MEMORY))
128176 return 0;
129177
@@ -237,6 +285,9 @@ int intel_vgpu_emulate_cfg_write(struct intel_vgpu *vgpu, unsigned int offset, · 107 unmodified lines
237285 {
238286 int ret;
239287
288+ if (vgpu->failsafe)
289+ return 0;
290+
240291 if (WARN_ON(bytes > 4))
241292 return -EINVAL;
242293
@@ -274,10 +325,10 @@ int intel_vgpu_emulate_cfg_write(struct intel_vgpu *vgpu, unsigned int offset, · 31 unmodified lines
274325 if (ret)
275326 return ret;
276327
277− memcpy(vgpu_cfg_space(vgpu) + offset, p_data, bytes);
328+ vgpu_pci_cfg_mem_write(vgpu, offset, p_data, bytes);
278329 break;
279330 default:
280− memcpy(vgpu_cfg_space(vgpu) + offset, p_data, bytes);
331+ vgpu_pci_cfg_mem_write(vgpu, offset, p_data, bytes);
281332 break;
282333 }
283334 return 0;
drivers/gpu/drm/i915/gvt/cmd_parser.c+5−5
@@ -668,7 +668,7 @@ static inline void print_opcode(u32 cmd, int ring_id) · 667 unmodified lines
668668 if (d_info == NULL)
669669 return;
670670
671− gvt_err("opcode=0x%x %s sub_ops:",
671+ gvt_dbg_cmd("opcode=0x%x %s sub_ops:",
672672 cmd >> (32 - d_info->op_len), d_info->name);
673673
674674 for (i = 0; i < d_info->nr_sub_op; i++)
@@ -693,23 +693,23 @@ static void parser_exec_state_dump(struct parser_exec_state *s) · 18 unmodified lines
693693 int cnt = 0;
694694 int i;
695695
696− gvt_err(" vgpu%d RING%d: ring_start(%08lx) ring_end(%08lx)"
696+ gvt_dbg_cmd(" vgpu%d RING%d: ring_start(%08lx) ring_end(%08lx)"
697697 " ring_head(%08lx) ring_tail(%08lx)\n", s->vgpu->id,
698698 s->ring_id, s->ring_start, s->ring_start + s->ring_size,
699699 s->ring_head, s->ring_tail);
700700
701− gvt_err(" %s %s ip_gma(%08lx) ",
701+ gvt_dbg_cmd(" %s %s ip_gma(%08lx) ",
702702 s->buf_type == RING_BUFFER_INSTRUCTION ?
703703 "RING_BUFFER" : "BATCH_BUFFER",
704704 s->buf_addr_type == GTT_BUFFER ?
705705 "GTT" : "PPGTT", s->ip_gma);
706706
707707 if (s->ip_va == NULL) {
708− gvt_err(" ip_va(NULL)");
708+ gvt_dbg_cmd(" ip_va(NULL)");
709709 return;
710710 }
711711
712− gvt_err(" ip_va=%p: %08x %08x %08x %08x\n",
712+ gvt_dbg_cmd(" ip_va=%p: %08x %08x %08x %08x\n",
713713 s->ip_va, cmd_val(s, 0), cmd_val(s, 1),
714714 cmd_val(s, 2), cmd_val(s, 3));
715715
drivers/gpu/drm/i915/gvt/display.c+94−45
@@ -83,44 +83,80 @@ static int pipe_is_enabled(struct intel_vgpu *vgpu, int pipe) · 82 unmodified lines
8383 return 0;
8484 }
8585
86+static unsigned char virtual_dp_monitor_edid[GVT_EDID_NUM][EDID_SIZE] = {
87+ {
88+/* EDID with 1024x768 as its resolution */
89+ /*Header*/
90+ 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
91+ /* Vendor & Product Identification */
92+ 0x22, 0xf0, 0x54, 0x29, 0x00, 0x00, 0x00, 0x00, 0x04, 0x17,
93+ /* Version & Revision */
94+ 0x01, 0x04,
95+ /* Basic Display Parameters & Features */
96+ 0xa5, 0x34, 0x20, 0x78, 0x23,
97+ /* Color Characteristics */
98+ 0xfc, 0x81, 0xa4, 0x55, 0x4d, 0x9d, 0x25, 0x12, 0x50, 0x54,
99+ /* Established Timings: maximum resolution is 1024x768 */
100+ 0x21, 0x08, 0x00,
101+ /* Standard Timings. All invalid */
102+ 0x00, 0xc0, 0x00, 0xc0, 0x00, 0x40, 0x00, 0x80, 0x00, 0x00,
103+ 0x00, 0x40, 0x00, 0x00, 0x00, 0x01,
104+ /* 18 Byte Data Blocks 1: invalid */
105+ 0x00, 0x00, 0x80, 0xa0, 0x70, 0xb0,
106+ 0x23, 0x40, 0x30, 0x20, 0x36, 0x00, 0x06, 0x44, 0x21, 0x00, 0x00, 0x1a,
107+ /* 18 Byte Data Blocks 2: invalid */
108+ 0x00, 0x00, 0x00, 0xfd, 0x00, 0x18, 0x3c, 0x18, 0x50, 0x11, 0x00, 0x0a,
109+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
110+ /* 18 Byte Data Blocks 3: invalid */
111+ 0x00, 0x00, 0x00, 0xfc, 0x00, 0x48,
112+ 0x50, 0x20, 0x5a, 0x52, 0x32, 0x34, 0x34, 0x30, 0x77, 0x0a, 0x20, 0x20,
113+ /* 18 Byte Data Blocks 4: invalid */
114+ 0x00, 0x00, 0x00, 0xff, 0x00, 0x43, 0x4e, 0x34, 0x33, 0x30, 0x34, 0x30,
115+ 0x44, 0x58, 0x51, 0x0a, 0x20, 0x20,
116+ /* Extension Block Count */
117+ 0x00,
118+ /* Checksum */
119+ 0xef,
120+ },
121+ {
86122 /* EDID with 1920x1200 as its resolution */
87−static unsigned char virtual_dp_monitor_edid[] = {
88− /*Header*/
89− 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
90− /* Vendor & Product Identification */
91− 0x22, 0xf0, 0x54, 0x29, 0x00, 0x00, 0x00, 0x00, 0x04, 0x17,
92− /* Version & Revision */
93− 0x01, 0x04,
94− /* Basic Display Parameters & Features */
95− 0xa5, 0x34, 0x20, 0x78, 0x23,
96− /* Color Characteristics */
97− 0xfc, 0x81, 0xa4, 0x55, 0x4d, 0x9d, 0x25, 0x12, 0x50, 0x54,
98− /* Established Timings: maximum resolution is 1024x768 */
99− 0x21, 0x08, 0x00,
100− /*
101− * Standard Timings.
102− * below new resolutions can be supported:
103− * 1920x1080, 1280x720, 1280x960, 1280x1024,
104− * 1440x900, 1600x1200, 1680x1050
105− */
106− 0xd1, 0xc0, 0x81, 0xc0, 0x81, 0x40, 0x81, 0x80, 0x95, 0x00,
107− 0xa9, 0x40, 0xb3, 0x00, 0x01, 0x01,
108− /* 18 Byte Data Blocks 1: max resolution is 1920x1200 */
109− 0x28, 0x3c, 0x80, 0xa0, 0x70, 0xb0,
110− 0x23, 0x40, 0x30, 0x20, 0x36, 0x00, 0x06, 0x44, 0x21, 0x00, 0x00, 0x1a,
111− /* 18 Byte Data Blocks 2: invalid */
112− 0x00, 0x00, 0x00, 0xfd, 0x00, 0x18, 0x3c, 0x18, 0x50, 0x11, 0x00, 0x0a,
113− 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
114− /* 18 Byte Data Blocks 3: invalid */
115− 0x00, 0x00, 0x00, 0xfc, 0x00, 0x48,
116− 0x50, 0x20, 0x5a, 0x52, 0x32, 0x34, 0x34, 0x30, 0x77, 0x0a, 0x20, 0x20,
117− /* 18 Byte Data Blocks 4: invalid */
118− 0x00, 0x00, 0x00, 0xff, 0x00, 0x43, 0x4e, 0x34, 0x33, 0x30, 0x34, 0x30,
119− 0x44, 0x58, 0x51, 0x0a, 0x20, 0x20,
120− /* Extension Block Count */
121− 0x00,
122− /* Checksum */
123− 0x45,
123+ /*Header*/
124+ 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
125+ /* Vendor & Product Identification */
126+ 0x22, 0xf0, 0x54, 0x29, 0x00, 0x00, 0x00, 0x00, 0x04, 0x17,
127+ /* Version & Revision */
128+ 0x01, 0x04,
129+ /* Basic Display Parameters & Features */
130+ 0xa5, 0x34, 0x20, 0x78, 0x23,
131+ /* Color Characteristics */
132+ 0xfc, 0x81, 0xa4, 0x55, 0x4d, 0x9d, 0x25, 0x12, 0x50, 0x54,
133+ /* Established Timings: maximum resolution is 1024x768 */
134+ 0x21, 0x08, 0x00,
135+ /*
136+ * Standard Timings.
137+ * below new resolutions can be supported:
138+ * 1920x1080, 1280x720, 1280x960, 1280x1024,
139+ * 1440x900, 1600x1200, 1680x1050
140+ */
141+ 0xd1, 0xc0, 0x81, 0xc0, 0x81, 0x40, 0x81, 0x80, 0x95, 0x00,
142+ 0xa9, 0x40, 0xb3, 0x00, 0x01, 0x01,
143+ /* 18 Byte Data Blocks 1: max resolution is 1920x1200 */
144+ 0x28, 0x3c, 0x80, 0xa0, 0x70, 0xb0,
145+ 0x23, 0x40, 0x30, 0x20, 0x36, 0x00, 0x06, 0x44, 0x21, 0x00, 0x00, 0x1a,
146+ /* 18 Byte Data Blocks 2: invalid */
147+ 0x00, 0x00, 0x00, 0xfd, 0x00, 0x18, 0x3c, 0x18, 0x50, 0x11, 0x00, 0x0a,
148+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
149+ /* 18 Byte Data Blocks 3: invalid */
150+ 0x00, 0x00, 0x00, 0xfc, 0x00, 0x48,
151+ 0x50, 0x20, 0x5a, 0x52, 0x32, 0x34, 0x34, 0x30, 0x77, 0x0a, 0x20, 0x20,
152+ /* 18 Byte Data Blocks 4: invalid */
153+ 0x00, 0x00, 0x00, 0xff, 0x00, 0x43, 0x4e, 0x34, 0x33, 0x30, 0x34, 0x30,
154+ 0x44, 0x58, 0x51, 0x0a, 0x20, 0x20,
155+ /* Extension Block Count */
156+ 0x00,
157+ /* Checksum */
158+ 0x45,
159+ },
124160 };
125161
126162 #define DPCD_HEADER_SIZE 0xb
@@ -140,14 +176,20 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu) · 13 unmodified lines
140176 vgpu_vreg(vgpu, SDEISR) &= ~(SDE_PORTA_HOTPLUG_SPT |
141177 SDE_PORTE_HOTPLUG_SPT);
142178
143− if (intel_vgpu_has_monitor_on_port(vgpu, PORT_B))
179+ if (intel_vgpu_has_monitor_on_port(vgpu, PORT_B)) {
144180 vgpu_vreg(vgpu, SDEISR) |= SDE_PORTB_HOTPLUG_CPT;
181+ vgpu_vreg(vgpu, SFUSE_STRAP) |= SFUSE_STRAP_DDIB_DETECTED;
182+ }
145183
146− if (intel_vgpu_has_monitor_on_port(vgpu, PORT_C))
184+ if (intel_vgpu_has_monitor_on_port(vgpu, PORT_C)) {
147185 vgpu_vreg(vgpu, SDEISR) |= SDE_PORTC_HOTPLUG_CPT;
186+ vgpu_vreg(vgpu, SFUSE_STRAP) |= SFUSE_STRAP_DDIC_DETECTED;
187+ }
148188
149− if (intel_vgpu_has_monitor_on_port(vgpu, PORT_D))
189+ if (intel_vgpu_has_monitor_on_port(vgpu, PORT_D)) {
150190 vgpu_vreg(vgpu, SDEISR) |= SDE_PORTD_HOTPLUG_CPT;
191+ vgpu_vreg(vgpu, SFUSE_STRAP) |= SFUSE_STRAP_DDID_DETECTED;
192+ }
151193
152194 if (IS_SKYLAKE(dev_priv) &&
153195 intel_vgpu_has_monitor_on_port(vgpu, PORT_E)) {
@@ -160,6 +202,8 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu) · 6 unmodified lines
160202 GEN8_PORT_DP_A_HOTPLUG;
161203 else
162204 vgpu_vreg(vgpu, SDEISR) |= SDE_PORTA_HOTPLUG_SPT;
205+
206+ vgpu_vreg(vgpu, DDI_BUF_CTL(PORT_A)) |= DDI_INIT_DISPLAY_DETECTED;
163207 }
164208 }
165209
@@ -175,10 +219,13 @@ static void clean_virtual_dp_monitor(struct intel_vgpu *vgpu, int port_num) · 9 unmodified lines
175219 }
176220
177221 static int setup_virtual_dp_monitor(struct intel_vgpu *vgpu, int port_num,
178− int type)
222+ int type, unsigned int resolution)
179223 {
180224 struct intel_vgpu_port *port = intel_vgpu_port(vgpu, port_num);
181225
226+ if (WARN_ON(resolution >= GVT_EDID_NUM))
227+ return -EINVAL;
228+
182229 port->edid = kzalloc(sizeof(*(port->edid)), GFP_KERNEL);
183230 if (!port->edid)
184231 return -ENOMEM;
@@ -189,7 +236,7 @@ static int setup_virtual_dp_monitor(struct intel_vgpu *vgpu, int port_num, · 4 unmodified lines
189236 return -ENOMEM;
190237 }
191238
192− memcpy(port->edid->edid_block, virtual_dp_monitor_edid,
239+ memcpy(port->edid->edid_block, virtual_dp_monitor_edid[resolution],
193240 EDID_SIZE);
194241 port->edid->data_valid = true;
195242
@@ -322,16 +369,18 @@ void intel_vgpu_clean_display(struct intel_vgpu *vgpu) · 126 unmodified lines
322369 * Zero on success, negative error code if failed.
323370 *
324371 */
325−int intel_vgpu_init_display(struct intel_vgpu *vgpu)
372+int intel_vgpu_init_display(struct intel_vgpu *vgpu, u64 resolution)
326373 {
327374 struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv;
328375
329376 intel_vgpu_init_i2c_edid(vgpu);
330377
331378 if (IS_SKYLAKE(dev_priv))
332− return setup_virtual_dp_monitor(vgpu, PORT_D, GVT_DP_D);
379+ return setup_virtual_dp_monitor(vgpu, PORT_D, GVT_DP_D,
380+ resolution);
333381 else
334− return setup_virtual_dp_monitor(vgpu, PORT_B, GVT_DP_B);
382+ return setup_virtual_dp_monitor(vgpu, PORT_B, GVT_DP_B,
383+ resolution);
335384 }
336385
337386 /**
drivers/gpu/drm/i915/gvt/display.h+19−1
@@ -154,10 +154,28 @@ struct intel_vgpu_port { · 153 unmodified lines
154154 int type;
155155 };
156156
157+enum intel_vgpu_edid {
158+ GVT_EDID_1024_768,
159+ GVT_EDID_1920_1200,
160+ GVT_EDID_NUM,
161+};
162+
163+static inline char *vgpu_edid_str(enum intel_vgpu_edid id)
164+{
165+ switch (id) {
166+ case GVT_EDID_1024_768:
167+ return "1024x768";
168+ case GVT_EDID_1920_1200:
169+ return "1920x1200";
170+ default:
171+ return "";
172+ }
173+}
174+
157175 void intel_gvt_emulate_vblank(struct intel_gvt *gvt);
158176 void intel_gvt_check_vblank_emulation(struct intel_gvt *gvt);
159177
160−int intel_vgpu_init_display(struct intel_vgpu *vgpu);
178+int intel_vgpu_init_display(struct intel_vgpu *vgpu, u64 resolution);
161179 void intel_vgpu_reset_display(struct intel_vgpu *vgpu);
162180 void intel_vgpu_clean_display(struct intel_vgpu *vgpu);
163181
drivers/gpu/drm/i915/gvt/firmware.c+1−1
@@ -80,7 +80,7 @@ static int expose_firmware_sysfs(struct intel_gvt *gvt) · 79 unmodified lines
8080 int ret;
8181
8282 size = sizeof(*h) + info->mmio_size + info->cfg_space_size - 1;
83− firmware = vmalloc(size);
83+ firmware = vzalloc(size);
8484 if (!firmware)
8585 return -ENOMEM;
8686
drivers/gpu/drm/i915/gvt/gtt.c+26−14
@@ -1825,11 +1825,8 @@ static int emulate_gtt_mmio_write(struct intel_vgpu *vgpu, unsigned int off, · 1824 unmodified lines
18251825 gma = g_gtt_index << GTT_PAGE_SHIFT;
18261826
18271827 /* the VM may configure the whole GM space when ballooning is used */
1828− if (WARN_ONCE(!vgpu_gmadr_is_valid(vgpu, gma),
1829− "vgpu%d: found oob ggtt write, offset %x\n",
1830− vgpu->id, off)) {
1828+ if (!vgpu_gmadr_is_valid(vgpu, gma))
18311829 return 0;
1832− }
18331830
18341831 ggtt_get_guest_entry(ggtt_mm, &e, g_gtt_index);
18351832
@@ -2015,6 +2012,22 @@ int intel_vgpu_init_gtt(struct intel_vgpu *vgpu) · 179 unmodified lines
20152012 return create_scratch_page_tree(vgpu);
20162013 }
20172014
2015+static void intel_vgpu_free_mm(struct intel_vgpu *vgpu, int type)
2016+{
2017+ struct list_head *pos, *n;
2018+ struct intel_vgpu_mm *mm;
2019+
2020+ list_for_each_safe(pos, n, &vgpu->gtt.mm_list_head) {
2021+ mm = container_of(pos, struct intel_vgpu_mm, list);
2022+ if (mm->type == type) {
2023+ vgpu->gvt->gtt.mm_free_page_table(mm);
2024+ list_del(&mm->list);
2025+ list_del(&mm->lru_list);
2026+ kfree(mm);
2027+ }
2028+ }
2029+}
2030+
20182031 /**
20192032 * intel_vgpu_clean_gtt - clean up per-vGPU graphics memory virulization
20202033 * @vgpu: a vGPU
@@ -2027,19 +2040,11 @@ int intel_vgpu_init_gtt(struct intel_vgpu *vgpu) · 6 unmodified lines
20272040 */
20282041 void intel_vgpu_clean_gtt(struct intel_vgpu *vgpu)
20292042 {
2030− struct list_head *pos, *n;
2031− struct intel_vgpu_mm *mm;
2032−
20332043 ppgtt_free_all_shadow_page(vgpu);
20342044 release_scratch_page_tree(vgpu);
20352045
2036− list_for_each_safe(pos, n, &vgpu->gtt.mm_list_head) {
2037− mm = container_of(pos, struct intel_vgpu_mm, list);
2038− vgpu->gvt->gtt.mm_free_page_table(mm);
2039− list_del(&mm->list);
2040− list_del(&mm->lru_list);
2041− kfree(mm);
2042− }
2046+ intel_vgpu_free_mm(vgpu, INTEL_GVT_MM_PPGTT);
2047+ intel_vgpu_free_mm(vgpu, INTEL_GVT_MM_GGTT);
20432048 }
20442049
20452050 static void clean_spt_oos(struct intel_gvt *gvt)
@@ -2322,6 +2327,13 @@ void intel_vgpu_reset_gtt(struct intel_vgpu *vgpu, bool dmlr) · 276 unmodified lines
23222327 int i;
23232328
23242329 ppgtt_free_all_shadow_page(vgpu);
2330+
2331+ /* Shadow pages are only created when there is no page
2332+ * table tracking data, so remove page tracking data after
2333+ * removing the shadow pages.
2334+ */
2335+ intel_vgpu_free_mm(vgpu, INTEL_GVT_MM_PPGTT);
2336+
23252337 if (!dmlr)
23262338 return;
23272339
drivers/gpu/drm/i915/gvt/gvt.h+10−2
@@ -143,6 +143,8 @@ struct intel_vgpu { · 142 unmodified lines
143143 int id;
144144 unsigned long handle; /* vGPU handle used by hypervisor MPT modules */
145145 bool active;
146+ bool pv_notified;
147+ bool failsafe;
146148 bool resetting;
147149 void *sched_data;
148150
@@ -203,18 +205,18 @@ struct intel_gvt_firmware { · 54 unmodified lines
203205 };
204206
205207 struct intel_gvt_opregion {
206− void __iomem *opregion_va;
208+ void *opregion_va;
207209 u32 opregion_pa;
208210 };
209211
210212 #define NR_MAX_INTEL_VGPU_TYPES 20
211213 struct intel_vgpu_type {
212214 char name[16];
213− unsigned int max_instance;
214215 unsigned int avail_instance;
215216 unsigned int low_gm_size;
216217 unsigned int high_gm_size;
217218 unsigned int fence;
219+ enum intel_vgpu_edid resolution;
218220 };
219221
220222 struct intel_gvt {
@@ -317,6 +319,7 @@ struct intel_vgpu_creation_params { · 96 unmodified lines
317319 __u64 low_gm_sz; /* in MB */
318320 __u64 high_gm_sz; /* in MB */
319321 __u64 fence_sz;
322+ __u64 resolution;
320323 __s32 primary;
321324 __u64 vgpu_id;
322325 };
@@ -449,6 +452,11 @@ struct intel_gvt_ops { · 126 unmodified lines
449452 };
450453
451454
455+enum {
456+ GVT_FAILSAFE_UNSUPPORTED_GUEST,
457+ GVT_FAILSAFE_INSUFFICIENT_RESOURCE,
458+};
459+
452460 #include "mpt.h"
453461
454462 #endif
drivers/gpu/drm/i915/gvt/handlers.c+307−132
@@ -121,6 +121,7 @@ static int new_mmio_info(struct intel_gvt *gvt, · 120 unmodified lines
121121 info->size = size;
122122 info->length = (i + 4) < end ? 4 : (end - i);
123123 info->addr_mask = addr_mask;
124+ info->ro_mask = ro_mask;
124125 info->device = device;
125126 info->read = read ? read : intel_vgpu_default_mmio_read;
126127 info->write = write ? write : intel_vgpu_default_mmio_write;
@@ -150,15 +151,44 @@ static int render_mmio_to_ring_id(struct intel_gvt *gvt, unsigned int reg) · 23 unmodified lines
150151 #define fence_num_to_offset(num) \
151152 (num * 8 + i915_mmio_reg_offset(FENCE_REG_GEN6_LO(0)))
152153
154+
155+static void enter_failsafe_mode(struct intel_vgpu *vgpu, int reason)
156+{
157+ switch (reason) {
158+ case GVT_FAILSAFE_UNSUPPORTED_GUEST:
159+ pr_err("Detected your guest driver doesn't support GVT-g.\n");
160+ break;
161+ case GVT_FAILSAFE_INSUFFICIENT_RESOURCE:
162+ pr_err("Graphics resource is not enough for the guest\n");
163+ default:
164+ break;
165+ }
166+ pr_err("Now vgpu %d will enter failsafe mode.\n", vgpu->id);
167+ vgpu->failsafe = true;
168+}
169+
153170 static int sanitize_fence_mmio_access(struct intel_vgpu *vgpu,
154171 unsigned int fence_num, void *p_data, unsigned int bytes)
155172 {
156173 if (fence_num >= vgpu_fence_sz(vgpu)) {
157− gvt_err("vgpu%d: found oob fence register access\n",
158− vgpu->id);
159− gvt_err("vgpu%d: total fence num %d access fence num %d\n",
160− vgpu->id, vgpu_fence_sz(vgpu), fence_num);
174+
175+ /* When guest access oob fence regs without access
176+ * pv_info first, we treat guest not supporting GVT,
177+ * and we will let vgpu enter failsafe mode.
178+ */
179+ if (!vgpu->pv_notified)
180+ enter_failsafe_mode(vgpu,
181+ GVT_FAILSAFE_UNSUPPORTED_GUEST);
182+
183+ if (!vgpu->mmio.disable_warn_untrack) {
184+ gvt_err("vgpu%d: found oob fence register access\n",
185+ vgpu->id);
186+ gvt_err("vgpu%d: total fence %d, access fence %d\n",
187+ vgpu->id, vgpu_fence_sz(vgpu),
188+ fence_num);
189+ }
161190 memset(p_data, 0, bytes);
191+ return -EINVAL;
162192 }
163193 return 0;
164194 }
@@ -369,6 +399,74 @@ static int pipeconf_mmio_write(struct intel_vgpu *vgpu, unsigned int offset, · 204 unmodified lines
369399 return 0;
370400 }
371401
402+/* ascendingly sorted */
403+static i915_reg_t force_nonpriv_white_list[] = {
404+ GEN9_CS_DEBUG_MODE1, //_MMIO(0x20ec)
405+ GEN9_CTX_PREEMPT_REG,//_MMIO(0x2248)
406+ GEN8_CS_CHICKEN1,//_MMIO(0x2580)
407+ _MMIO(0x2690),
408+ _MMIO(0x2694),
409+ _MMIO(0x2698),
410+ _MMIO(0x4de0),
411+ _MMIO(0x4de4),
412+ _MMIO(0x4dfc),
413+ GEN7_COMMON_SLICE_CHICKEN1,//_MMIO(0x7010)
414+ _MMIO(0x7014),
415+ HDC_CHICKEN0,//_MMIO(0x7300)
416+ GEN8_HDC_CHICKEN1,//_MMIO(0x7304)
417+ _MMIO(0x7700),
418+ _MMIO(0x7704),
419+ _MMIO(0x7708),
420+ _MMIO(0x770c),
421+ _MMIO(0xb110),
422+ GEN8_L3SQCREG4,//_MMIO(0xb118)
423+ _MMIO(0xe100),
424+ _MMIO(0xe18c),
425+ _MMIO(0xe48c),
426+ _MMIO(0xe5f4),
427+};
428+
429+/* a simple bsearch */
430+static inline bool in_whitelist(unsigned int reg)
431+{
432+ int left = 0, right = ARRAY_SIZE(force_nonpriv_white_list);
433+ i915_reg_t *array = force_nonpriv_white_list;
434+
435+ while (left < right) {
436+ int mid = (left + right)/2;
437+
438+ if (reg > array[mid].reg)
439+ left = mid + 1;
440+ else if (reg < array[mid].reg)
441+ right = mid;
442+ else
443+ return true;
444+ }
445+ return false;
446+}
447+
448+static int force_nonpriv_write(struct intel_vgpu *vgpu,
449+ unsigned int offset, void *p_data, unsigned int bytes)
450+{
451+ u32 reg_nonpriv = *(u32 *)p_data;
452+ int ret = -EINVAL;
453+
454+ if ((bytes != 4) || ((offset & (bytes - 1)) != 0)) {
455+ gvt_err("vgpu(%d) Invalid FORCE_NONPRIV offset %x(%dB)\n",
456+ vgpu->id, offset, bytes);
457+ return ret;
458+ }
459+
460+ if (in_whitelist(reg_nonpriv)) {
461+ ret = intel_vgpu_default_mmio_write(vgpu, offset, p_data,
462+ bytes);
463+ } else {
464+ gvt_err("vgpu(%d) Invalid FORCE_NONPRIV write %x\n",
465+ vgpu->id, reg_nonpriv);
466+ }
467+ return ret;
468+}
469+
372470 static int ddi_buf_ctl_mmio_write(struct intel_vgpu *vgpu, unsigned int offset,
373471 void *p_data, unsigned int bytes)
374472 {
@@ -1001,6 +1099,7 @@ static int pvinfo_mmio_read(struct intel_vgpu *vgpu, unsigned int offset, · 626 unmodified lines
10011099 if (invalid_read)
10021100 gvt_err("invalid pvinfo read: [%x:%x] = %x\n",
10031101 offset, bytes, *(u32 *)p_data);
1102+ vgpu->pv_notified = true;
10041103 return 0;
10051104 }
10061105
@@ -1039,7 +1138,7 @@ static int send_display_ready_uevent(struct intel_vgpu *vgpu, int ready) · 32 unmodified lines
10391138 char vmid_str[20];
10401139 char display_ready_str[20];
10411140
1042− snprintf(display_ready_str, 20, "GVT_DISPLAY_READY=%d\n", ready);
1141+ snprintf(display_ready_str, 20, "GVT_DISPLAY_READY=%d", ready);
10431142 env[0] = display_ready_str;
10441143
10451144 snprintf(vmid_str, 20, "VMID=%d", vgpu->id);
@@ -1078,6 +1177,9 @@ static int pvinfo_mmio_write(struct intel_vgpu *vgpu, unsigned int offset, · 32 unmodified lines
10781177 case _vgtif_reg(execlist_context_descriptor_lo):
10791178 case _vgtif_reg(execlist_context_descriptor_hi):
10801179 break;
1180+ case _vgtif_reg(rsv5[0])..._vgtif_reg(rsv5[3]):
1181+ enter_failsafe_mode(vgpu, GVT_FAILSAFE_INSUFFICIENT_RESOURCE);
1182+ break;
10811183 default:
10821184 gvt_err("invalid pvinfo write offset %x bytes %x data %x\n",
10831185 offset, bytes, data);
@@ -1203,26 +1305,37 @@ static int mailbox_write(struct intel_vgpu *vgpu, unsigned int offset, · 119 unmodified lines
12031305 u32 *data0 = &vgpu_vreg(vgpu, GEN6_PCODE_DATA);
12041306
12051307 switch (cmd) {
1206− case 0x6:
1207− /**
1208− * "Read memory latency" command on gen9.
1209− * Below memory latency values are read
1210− * from skylake platform.
1211− */
1212− if (!*data0)
1213− *data0 = 0x1e1a1100;
1214− else
1215− *data0 = 0x61514b3d;
1308+ case GEN9_PCODE_READ_MEM_LATENCY:
1309+ if (IS_SKYLAKE(vgpu->gvt->dev_priv)) {
1310+ /**
1311+ * "Read memory latency" command on gen9.
1312+ * Below memory latency values are read
1313+ * from skylake platform.
1314+ */
1315+ if (!*data0)
1316+ *data0 = 0x1e1a1100;
1317+ else
1318+ *data0 = 0x61514b3d;
1319+ }
1320+ break;
1321+ case SKL_PCODE_CDCLK_CONTROL:
1322+ if (IS_SKYLAKE(vgpu->gvt->dev_priv))
1323+ *data0 = SKL_CDCLK_READY_FOR_CHANGE;
12161324 break;
1217− case 0x5:
1325+ case GEN6_PCODE_READ_RC6VIDS:
12181326 *data0 |= 0x1;
12191327 break;
12201328 }
12211329
12221330 gvt_dbg_core("VM(%d) write %x to mailbox, return data0 %x\n",
12231331 vgpu->id, value, *data0);
1224−
1225− value &= ~(1 << 31);
1332+ /**
1333+ * PCODE_READY clear means ready for pcode read/write,
1334+ * PCODE_ERROR_MASK clear means no error happened. In GVT-g we
1335+ * always emulate as pcode read/write success and ready for access
1336+ * anytime, since we don't touch real physical registers here.
1337+ */
1338+ value &= ~(GEN6_PCODE_READY | GEN6_PCODE_ERROR_MASK);
12261339 return intel_vgpu_default_mmio_write(vgpu, offset, &value, bytes);
12271340 }
12281341
@@ -1318,6 +1431,17 @@ static int ring_mode_mmio_write(struct intel_vgpu *vgpu, unsigned int offset, · 89 unmodified lines
13181431 bool enable_execlist;
13191432
13201433 write_vreg(vgpu, offset, p_data, bytes);
1434+
1435+ /* when PPGTT mode enabled, we will check if guest has called
1436+ * pvinfo, if not, we will treat this guest as non-gvtg-aware
1437+ * guest, and stop emulating its cfg space, mmio, gtt, etc.
1438+ */
1439+ if (((data & _MASKED_BIT_ENABLE(GFX_PPGTT_ENABLE)) ||
1440+ (data & _MASKED_BIT_ENABLE(GFX_RUN_LIST_ENABLE)))
1441+ && !vgpu->pv_notified) {
1442+ enter_failsafe_mode(vgpu, GVT_FAILSAFE_UNSUPPORTED_GUEST);
1443+ return 0;
1444+ }
13211445 if ((data & _MASKED_BIT_ENABLE(GFX_RUN_LIST_ENABLE))
13221446 || (data & _MASKED_BIT_DISABLE(GFX_RUN_LIST_ENABLE))) {
13231447 enable_execlist = !!(data & GFX_RUN_LIST_ENABLE);
@@ -1400,6 +1524,9 @@ static int ring_reset_ctl_write(struct intel_vgpu *vgpu, · 76 unmodified lines
14001524 #define MMIO_GM(reg, d, r, w) \
14011525 MMIO_F(reg, 4, F_GMADR, 0xFFFFF000, 0, d, r, w)
14021526
1527+#define MMIO_GM_RDR(reg, d, r, w) \
1528+ MMIO_F(reg, 4, F_GMADR | F_CMD_ACCESS, 0xFFFFF000, 0, d, r, w)
1529+
14031530 #define MMIO_RO(reg, d, f, rm, r, w) \
14041531 MMIO_F(reg, 4, F_RO | f, 0, rm, d, r, w)
14051532
@@ -1419,6 +1546,9 @@ static int ring_reset_ctl_write(struct intel_vgpu *vgpu, · 13 unmodified lines
14191546 #define MMIO_RING_GM(prefix, d, r, w) \
14201547 MMIO_RING_F(prefix, 4, F_GMADR, 0xFFFF0000, 0, d, r, w)
14211548
1549+#define MMIO_RING_GM_RDR(prefix, d, r, w) \
1550+ MMIO_RING_F(prefix, 4, F_GMADR | F_CMD_ACCESS, 0xFFFF0000, 0, d, r, w)
1551+
14221552 #define MMIO_RING_RO(prefix, d, f, rm, r, w) \
14231553 MMIO_RING_F(prefix, 4, F_RO | f, 0, rm, d, r, w)
14241554
@@ -1427,73 +1557,81 @@ static int init_generic_mmio_info(struct intel_gvt *gvt) · 2 unmodified lines
14271557 struct drm_i915_private *dev_priv = gvt->dev_priv;
14281558 int ret;
14291559
1430− MMIO_RING_DFH(RING_IMR, D_ALL, 0, NULL, intel_vgpu_reg_imr_handler);
1560+ MMIO_RING_DFH(RING_IMR, D_ALL, F_CMD_ACCESS, NULL,
1561+ intel_vgpu_reg_imr_handler);
14311562
14321563 MMIO_DFH(SDEIMR, D_ALL, 0, NULL, intel_vgpu_reg_imr_handler);
14331564 MMIO_DFH(SDEIER, D_ALL, 0, NULL, intel_vgpu_reg_ier_handler);
14341565 MMIO_DFH(SDEIIR, D_ALL, 0, NULL, intel_vgpu_reg_iir_handler);
14351566 MMIO_D(SDEISR, D_ALL);
14361567
1437− MMIO_RING_D(RING_HWSTAM, D_ALL);
1568+ MMIO_RING_DFH(RING_HWSTAM, D_ALL, F_CMD_ACCESS, NULL, NULL);
14381569
1439− MMIO_GM(RENDER_HWS_PGA_GEN7, D_ALL, NULL, NULL);
1440− MMIO_GM(BSD_HWS_PGA_GEN7, D_ALL, NULL, NULL);
1441− MMIO_GM(BLT_HWS_PGA_GEN7, D_ALL, NULL, NULL);
1442− MMIO_GM(VEBOX_HWS_PGA_GEN7, D_ALL, NULL, NULL);
1570+ MMIO_GM_RDR(RENDER_HWS_PGA_GEN7, D_ALL, NULL, NULL);
1571+ MMIO_GM_RDR(BSD_HWS_PGA_GEN7, D_ALL, NULL, NULL);
1572+ MMIO_GM_RDR(BLT_HWS_PGA_GEN7, D_ALL, NULL, NULL);
1573+ MMIO_GM_RDR(VEBOX_HWS_PGA_GEN7, D_ALL, NULL, NULL);
14431574
14441575 #define RING_REG(base) (base + 0x28)
1445− MMIO_RING_D(RING_REG, D_ALL);
1576+ MMIO_RING_DFH(RING_REG, D_ALL, F_CMD_ACCESS, NULL, NULL);
14461577 #undef RING_REG
14471578
14481579 #define RING_REG(base) (base + 0x134)
1449− MMIO_RING_D(RING_REG, D_ALL);
1580+ MMIO_RING_DFH(RING_REG, D_ALL, F_CMD_ACCESS, NULL, NULL);
14501581 #undef RING_REG
14511582
1452− MMIO_GM(0x2148, D_ALL, NULL, NULL);
1453− MMIO_GM(CCID, D_ALL, NULL, NULL);
1454− MMIO_GM(0x12198, D_ALL, NULL, NULL);
1583+ MMIO_GM_RDR(0x2148, D_ALL, NULL, NULL);
1584+ MMIO_GM_RDR(CCID, D_ALL, NULL, NULL);
1585+ MMIO_GM_RDR(0x12198, D_ALL, NULL, NULL);
14551586 MMIO_D(GEN7_CXT_SIZE, D_ALL);
14561587
1457− MMIO_RING_D(RING_TAIL, D_ALL);
1458− MMIO_RING_D(RING_HEAD, D_ALL);
1459− MMIO_RING_D(RING_CTL, D_ALL);
1460− MMIO_RING_D(RING_ACTHD, D_ALL);
1461− MMIO_RING_GM(RING_START, D_ALL, NULL, NULL);
1588+ MMIO_RING_DFH(RING_TAIL, D_ALL, F_CMD_ACCESS, NULL, NULL);
1589+ MMIO_RING_DFH(RING_HEAD, D_ALL, F_CMD_ACCESS, NULL, NULL);
1590+ MMIO_RING_DFH(RING_CTL, D_ALL, F_CMD_ACCESS, NULL, NULL);
1591+ MMIO_RING_DFH(RING_ACTHD, D_ALL, F_CMD_ACCESS, NULL, NULL);
1592+ MMIO_RING_GM_RDR(RING_START, D_ALL, NULL, NULL);
14621593
14631594 /* RING MODE */
14641595 #define RING_REG(base) (base + 0x29c)
1465− MMIO_RING_DFH(RING_REG, D_ALL, F_MODE_MASK, NULL, ring_mode_mmio_write);
1596+ MMIO_RING_DFH(RING_REG, D_ALL, F_MODE_MASK | F_CMD_ACCESS, NULL,
1597+ ring_mode_mmio_write);
14661598 #undef RING_REG
14671599
1468− MMIO_RING_DFH(RING_MI_MODE, D_ALL, F_MODE_MASK, NULL, NULL);
1469− MMIO_RING_DFH(RING_INSTPM, D_ALL, F_MODE_MASK, NULL, NULL);
1600+ MMIO_RING_DFH(RING_MI_MODE, D_ALL, F_MODE_MASK | F_CMD_ACCESS,
1601+ NULL, NULL);
1602+ MMIO_RING_DFH(RING_INSTPM, D_ALL, F_MODE_MASK | F_CMD_ACCESS,
1603+ NULL, NULL);
14701604 MMIO_RING_DFH(RING_TIMESTAMP, D_ALL, F_CMD_ACCESS,
14711605 ring_timestamp_mmio_read, NULL);
14721606 MMIO_RING_DFH(RING_TIMESTAMP_UDW, D_ALL, F_CMD_ACCESS,
14731607 ring_timestamp_mmio_read, NULL);
14741608
1475− MMIO_DFH(GEN7_GT_MODE, D_ALL, F_MODE_MASK, NULL, NULL);
1476− MMIO_DFH(CACHE_MODE_0_GEN7, D_ALL, F_MODE_MASK, NULL, NULL);
1609+ MMIO_DFH(GEN7_GT_MODE, D_ALL, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL);
1610+ MMIO_DFH(CACHE_MODE_0_GEN7, D_ALL, F_MODE_MASK | F_CMD_ACCESS,
1611+ NULL, NULL);
14771612 MMIO_DFH(CACHE_MODE_1, D_ALL, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL);
1478−
1479− MMIO_DFH(0x20dc, D_ALL, F_MODE_MASK, NULL, NULL);
1480− MMIO_DFH(_3D_CHICKEN3, D_ALL, F_MODE_MASK, NULL, NULL);
1481− MMIO_DFH(0x2088, D_ALL, F_MODE_MASK, NULL, NULL);
1482− MMIO_DFH(0x20e4, D_ALL, F_MODE_MASK, NULL, NULL);
1483− MMIO_DFH(0x2470, D_ALL, F_MODE_MASK, NULL, NULL);
1484− MMIO_D(GAM_ECOCHK, D_ALL);
1485− MMIO_DFH(GEN7_COMMON_SLICE_CHICKEN1, D_ALL, F_MODE_MASK, NULL, NULL);
1613+ MMIO_DFH(CACHE_MODE_0, D_ALL, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL);
1614+ MMIO_DFH(0x2124, D_ALL, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL);
1615+
1616+ MMIO_DFH(0x20dc, D_ALL, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL);
1617+ MMIO_DFH(_3D_CHICKEN3, D_ALL, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL);
1618+ MMIO_DFH(0x2088, D_ALL, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL);
1619+ MMIO_DFH(0x20e4, D_ALL, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL);
1620+ MMIO_DFH(0x2470, D_ALL, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL);
1621+ MMIO_DFH(GAM_ECOCHK, D_ALL, F_CMD_ACCESS, NULL, NULL);
1622+ MMIO_DFH(GEN7_COMMON_SLICE_CHICKEN1, D_ALL, F_MODE_MASK | F_CMD_ACCESS,
1623+ NULL, NULL);
14861624 MMIO_DFH(COMMON_SLICE_CHICKEN2, D_ALL, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL);
1487− MMIO_D(0x9030, D_ALL);
1488− MMIO_D(0x20a0, D_ALL);
1489− MMIO_D(0x2420, D_ALL);
1490− MMIO_D(0x2430, D_ALL);
1491− MMIO_D(0x2434, D_ALL);
1492− MMIO_D(0x2438, D_ALL);
1493− MMIO_D(0x243c, D_ALL);
1494− MMIO_DFH(0x7018, D_ALL, F_MODE_MASK, NULL, NULL);
1625+ MMIO_DFH(0x9030, D_ALL, F_CMD_ACCESS, NULL, NULL);
1626+ MMIO_DFH(0x20a0, D_ALL, F_CMD_ACCESS, NULL, NULL);
1627+ MMIO_DFH(0x2420, D_ALL, F_CMD_ACCESS, NULL, NULL);
1628+ MMIO_DFH(0x2430, D_ALL, F_CMD_ACCESS, NULL, NULL);
1629+ MMIO_DFH(0x2434, D_ALL, F_CMD_ACCESS, NULL, NULL);
1630+ MMIO_DFH(0x2438, D_ALL, F_CMD_ACCESS, NULL, NULL);
1631+ MMIO_DFH(0x243c, D_ALL, F_CMD_ACCESS, NULL, NULL);
1632+ MMIO_DFH(0x7018, D_ALL, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL);
14951633 MMIO_DFH(HALF_SLICE_CHICKEN3, D_ALL, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL);
1496− MMIO_DFH(0xe100, D_ALL, F_MODE_MASK, NULL, NULL);
1634+ MMIO_DFH(GEN7_HALF_SLICE_CHICKEN1, D_ALL, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL);
14971635
14981636 /* display */
14991637 MMIO_F(0x60220, 0x20, 0, 0, 0, D_ALL, NULL, NULL);
@@ -2022,8 +2160,8 @@ static int init_generic_mmio_info(struct intel_gvt *gvt) · 522 unmodified lines
20222160 MMIO_D(FORCEWAKE_ACK, D_ALL);
20232161 MMIO_D(GEN6_GT_CORE_STATUS, D_ALL);
20242162 MMIO_D(GEN6_GT_THREAD_STATUS_REG, D_ALL);
2025− MMIO_D(GTFIFODBG, D_ALL);
2026− MMIO_D(GTFIFOCTL, D_ALL);
2163+ MMIO_DFH(GTFIFODBG, D_ALL, F_CMD_ACCESS, NULL, NULL);
2164+ MMIO_DFH(GTFIFOCTL, D_ALL, F_CMD_ACCESS, NULL, NULL);
20272165 MMIO_DH(FORCEWAKE_MT, D_PRE_SKL, NULL, mul_force_wake_write);
20282166 MMIO_DH(FORCEWAKE_ACK_HSW, D_HSW | D_BDW, NULL, NULL);
20292167 MMIO_D(ECOBUS, D_ALL);
@@ -2080,7 +2218,7 @@ static int init_generic_mmio_info(struct intel_gvt *gvt) · 50 unmodified lines
20802218
20812219 MMIO_F(0x4f000, 0x90, 0, 0, 0, D_ALL, NULL, NULL);
20822220
2083− MMIO_D(GEN6_PCODE_MAILBOX, D_PRE_SKL);
2221+ MMIO_D(GEN6_PCODE_MAILBOX, D_PRE_BDW);
20842222 MMIO_D(GEN6_PCODE_DATA, D_ALL);
20852223 MMIO_D(0x13812c, D_ALL);
20862224 MMIO_DH(GEN7_ERR_INT, D_ALL, NULL, NULL);
@@ -2159,36 +2297,35 @@ static int init_generic_mmio_info(struct intel_gvt *gvt) · 72 unmodified lines
21592297 MMIO_D(0x1a054, D_ALL);
21602298
21612299 MMIO_D(0x44070, D_ALL);
2162−
2163− MMIO_D(0x215c, D_HSW_PLUS);
2300+ MMIO_DFH(0x215c, D_HSW_PLUS, F_CMD_ACCESS, NULL, NULL);
21642301 MMIO_DFH(0x2178, D_ALL, F_CMD_ACCESS, NULL, NULL);
21652302 MMIO_DFH(0x217c, D_ALL, F_CMD_ACCESS, NULL, NULL);
21662303 MMIO_DFH(0x12178, D_ALL, F_CMD_ACCESS, NULL, NULL);
21672304 MMIO_DFH(0x1217c, D_ALL, F_CMD_ACCESS, NULL, NULL);
21682305
2169− MMIO_F(0x2290, 8, 0, 0, 0, D_HSW_PLUS, NULL, NULL);
2170− MMIO_D(GEN7_OACONTROL, D_HSW);
2306+ MMIO_F(0x2290, 8, F_CMD_ACCESS, 0, 0, D_HSW_PLUS, NULL, NULL);
2307+ MMIO_DFH(GEN7_OACONTROL, D_HSW, F_CMD_ACCESS, NULL, NULL);
21712308 MMIO_D(0x2b00, D_BDW_PLUS);
21722309 MMIO_D(0x2360, D_BDW_PLUS);
2173− MMIO_F(0x5200, 32, 0, 0, 0, D_ALL, NULL, NULL);
2174− MMIO_F(0x5240, 32, 0, 0, 0, D_ALL, NULL, NULL);
2175− MMIO_F(0x5280, 16, 0, 0, 0, D_ALL, NULL, NULL);
2310+ MMIO_F(0x5200, 32, F_CMD_ACCESS, 0, 0, D_ALL, NULL, NULL);
2311+ MMIO_F(0x5240, 32, F_CMD_ACCESS, 0, 0, D_ALL, NULL, NULL);
2312+ MMIO_F(0x5280, 16, F_CMD_ACCESS, 0, 0, D_ALL, NULL, NULL);
21762313
21772314 MMIO_DFH(0x1c17c, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
21782315 MMIO_DFH(0x1c178, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
2179− MMIO_D(BCS_SWCTRL, D_ALL);
2180−
2181− MMIO_F(HS_INVOCATION_COUNT, 8, 0, 0, 0, D_ALL, NULL, NULL);
2182− MMIO_F(DS_INVOCATION_COUNT, 8, 0, 0, 0, D_ALL, NULL, NULL);
2183− MMIO_F(IA_VERTICES_COUNT, 8, 0, 0, 0, D_ALL, NULL, NULL);
2184− MMIO_F(IA_PRIMITIVES_COUNT, 8, 0, 0, 0, D_ALL, NULL, NULL);
2185− MMIO_F(VS_INVOCATION_COUNT, 8, 0, 0, 0, D_ALL, NULL, NULL);
2186− MMIO_F(GS_INVOCATION_COUNT, 8, 0, 0, 0, D_ALL, NULL, NULL);
2187− MMIO_F(GS_PRIMITIVES_COUNT, 8, 0, 0, 0, D_ALL, NULL, NULL);
2188− MMIO_F(CL_INVOCATION_COUNT, 8, 0, 0, 0, D_ALL, NULL, NULL);
2189− MMIO_F(CL_PRIMITIVES_COUNT, 8, 0, 0, 0, D_ALL, NULL, NULL);
2190− MMIO_F(PS_INVOCATION_COUNT, 8, 0, 0, 0, D_ALL, NULL, NULL);
2191− MMIO_F(PS_DEPTH_COUNT, 8, 0, 0, 0, D_ALL, NULL, NULL);
2316+ MMIO_DFH(BCS_SWCTRL, D_ALL, F_CMD_ACCESS, NULL, NULL);
2317+
2318+ MMIO_F(HS_INVOCATION_COUNT, 8, F_CMD_ACCESS, 0, 0, D_ALL, NULL, NULL);
2319+ MMIO_F(DS_INVOCATION_COUNT, 8, F_CMD_ACCESS, 0, 0, D_ALL, NULL, NULL);
2320+ MMIO_F(IA_VERTICES_COUNT, 8, F_CMD_ACCESS, 0, 0, D_ALL, NULL, NULL);
2321+ MMIO_F(IA_PRIMITIVES_COUNT, 8, F_CMD_ACCESS, 0, 0, D_ALL, NULL, NULL);
2322+ MMIO_F(VS_INVOCATION_COUNT, 8, F_CMD_ACCESS, 0, 0, D_ALL, NULL, NULL);
2323+ MMIO_F(GS_INVOCATION_COUNT, 8, F_CMD_ACCESS, 0, 0, D_ALL, NULL, NULL);
2324+ MMIO_F(GS_PRIMITIVES_COUNT, 8, F_CMD_ACCESS, 0, 0, D_ALL, NULL, NULL);
2325+ MMIO_F(CL_INVOCATION_COUNT, 8, F_CMD_ACCESS, 0, 0, D_ALL, NULL, NULL);
2326+ MMIO_F(CL_PRIMITIVES_COUNT, 8, F_CMD_ACCESS, 0, 0, D_ALL, NULL, NULL);
2327+ MMIO_F(PS_INVOCATION_COUNT, 8, F_CMD_ACCESS, 0, 0, D_ALL, NULL, NULL);
2328+ MMIO_F(PS_DEPTH_COUNT, 8, F_CMD_ACCESS, 0, 0, D_ALL, NULL, NULL);
21922329 MMIO_DH(0x4260, D_BDW_PLUS, NULL, gvt_reg_tlb_control_handler);
21932330 MMIO_DH(0x4264, D_BDW_PLUS, NULL, gvt_reg_tlb_control_handler);
21942331 MMIO_DH(0x4268, D_BDW_PLUS, NULL, gvt_reg_tlb_control_handler);
@@ -2196,6 +2333,17 @@ static int init_generic_mmio_info(struct intel_gvt *gvt) · 1 unmodified line
21962333 MMIO_DH(0x4270, D_BDW_PLUS, NULL, gvt_reg_tlb_control_handler);
21972334 MMIO_DFH(0x4094, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
21982335
2336+ MMIO_DFH(ARB_MODE, D_ALL, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL);
2337+ MMIO_RING_GM_RDR(RING_BBADDR, D_ALL, NULL, NULL);
2338+ MMIO_DFH(0x2220, D_ALL, F_CMD_ACCESS, NULL, NULL);
2339+ MMIO_DFH(0x12220, D_ALL, F_CMD_ACCESS, NULL, NULL);
2340+ MMIO_DFH(0x22220, D_ALL, F_CMD_ACCESS, NULL, NULL);
2341+ MMIO_RING_DFH(RING_SYNC_1, D_ALL, F_CMD_ACCESS, NULL, NULL);
2342+ MMIO_RING_DFH(RING_SYNC_0, D_ALL, F_CMD_ACCESS, NULL, NULL);
2343+ MMIO_DFH(0x22178, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
2344+ MMIO_DFH(0x1a178, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
2345+ MMIO_DFH(0x1a17c, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
2346+ MMIO_DFH(0x2217c, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
21992347 return 0;
22002348 }
22012349
@@ -2204,7 +2352,7 @@ static int init_broadwell_mmio_info(struct intel_gvt *gvt) · 2 unmodified lines
22042352 struct drm_i915_private *dev_priv = gvt->dev_priv;
22052353 int ret;
22062354
2207− MMIO_DH(RING_IMR(GEN8_BSD2_RING_BASE), D_BDW_PLUS, NULL,
2355+ MMIO_DFH(RING_IMR(GEN8_BSD2_RING_BASE), D_BDW_PLUS, F_CMD_ACCESS, NULL,
22082356 intel_vgpu_reg_imr_handler);
22092357
22102358 MMIO_DH(GEN8_GT_IMR(0), D_BDW_PLUS, NULL, intel_vgpu_reg_imr_handler);
@@ -2269,24 +2417,31 @@ static int init_broadwell_mmio_info(struct intel_gvt *gvt) · 58 unmodified lines
22692417 MMIO_DH(GEN8_MASTER_IRQ, D_BDW_PLUS, NULL,
22702418 intel_vgpu_reg_master_irq_handler);
22712419
2272− MMIO_D(RING_HWSTAM(GEN8_BSD2_RING_BASE), D_BDW_PLUS);
2273− MMIO_D(0x1c134, D_BDW_PLUS);
2274−
2275− MMIO_D(RING_TAIL(GEN8_BSD2_RING_BASE), D_BDW_PLUS);
2276− MMIO_D(RING_HEAD(GEN8_BSD2_RING_BASE), D_BDW_PLUS);
2277− MMIO_GM(RING_START(GEN8_BSD2_RING_BASE), D_BDW_PLUS, NULL, NULL);
2278− MMIO_D(RING_CTL(GEN8_BSD2_RING_BASE), D_BDW_PLUS);
2279− MMIO_D(RING_ACTHD(GEN8_BSD2_RING_BASE), D_BDW_PLUS);
2280− MMIO_D(RING_ACTHD_UDW(GEN8_BSD2_RING_BASE), D_BDW_PLUS);
2281− MMIO_DFH(0x1c29c, D_BDW_PLUS, F_MODE_MASK, NULL, ring_mode_mmio_write);
2282− MMIO_DFH(RING_MI_MODE(GEN8_BSD2_RING_BASE), D_BDW_PLUS, F_MODE_MASK,
2283− NULL, NULL);
2284− MMIO_DFH(RING_INSTPM(GEN8_BSD2_RING_BASE), D_BDW_PLUS, F_MODE_MASK,
2285− NULL, NULL);
2420+ MMIO_DFH(RING_HWSTAM(GEN8_BSD2_RING_BASE), D_BDW_PLUS,
2421+ F_CMD_ACCESS, NULL, NULL);
2422+ MMIO_DFH(0x1c134, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
2423+
2424+ MMIO_DFH(RING_TAIL(GEN8_BSD2_RING_BASE), D_BDW_PLUS, F_CMD_ACCESS,
2425+ NULL, NULL);
2426+ MMIO_DFH(RING_HEAD(GEN8_BSD2_RING_BASE), D_BDW_PLUS,
2427+ F_CMD_ACCESS, NULL, NULL);
2428+ MMIO_GM_RDR(RING_START(GEN8_BSD2_RING_BASE), D_BDW_PLUS, NULL, NULL);
2429+ MMIO_DFH(RING_CTL(GEN8_BSD2_RING_BASE), D_BDW_PLUS, F_CMD_ACCESS,
2430+ NULL, NULL);
2431+ MMIO_DFH(RING_ACTHD(GEN8_BSD2_RING_BASE), D_BDW_PLUS,
2432+ F_CMD_ACCESS, NULL, NULL);
2433+ MMIO_DFH(RING_ACTHD_UDW(GEN8_BSD2_RING_BASE), D_BDW_PLUS,
2434+ F_CMD_ACCESS, NULL, NULL);
2435+ MMIO_DFH(0x1c29c, D_BDW_PLUS, F_MODE_MASK | F_CMD_ACCESS, NULL,
2436+ ring_mode_mmio_write);
2437+ MMIO_DFH(RING_MI_MODE(GEN8_BSD2_RING_BASE), D_BDW_PLUS,
2438+ F_MODE_MASK | F_CMD_ACCESS, NULL, NULL);
2439+ MMIO_DFH(RING_INSTPM(GEN8_BSD2_RING_BASE), D_BDW_PLUS,
2440+ F_MODE_MASK | F_CMD_ACCESS, NULL, NULL);
22862441 MMIO_DFH(RING_TIMESTAMP(GEN8_BSD2_RING_BASE), D_BDW_PLUS, F_CMD_ACCESS,
22872442 ring_timestamp_mmio_read, NULL);
22882443
2289− MMIO_RING_D(RING_ACTHD_UDW, D_BDW_PLUS);
2444+ MMIO_RING_DFH(RING_ACTHD_UDW, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
22902445
22912446 #define RING_REG(base) (base + 0xd0)
22922447 MMIO_RING_F(RING_REG, 4, F_RO, 0,
@@ -2303,13 +2458,16 @@ static int init_broadwell_mmio_info(struct intel_gvt *gvt) · 10 unmodified lines
23032458 #undef RING_REG
23042459
23052460 #define RING_REG(base) (base + 0x234)
2306− MMIO_RING_F(RING_REG, 8, F_RO, 0, ~0, D_BDW_PLUS, NULL, NULL);
2307− MMIO_F(RING_REG(GEN8_BSD2_RING_BASE), 4, F_RO, 0, ~0LL, D_BDW_PLUS, NULL, NULL);
2461+ MMIO_RING_F(RING_REG, 8, F_RO | F_CMD_ACCESS, 0, ~0, D_BDW_PLUS,
2462+ NULL, NULL);
2463+ MMIO_F(RING_REG(GEN8_BSD2_RING_BASE), 4, F_RO | F_CMD_ACCESS, 0,
2464+ ~0LL, D_BDW_PLUS, NULL, NULL);
23082465 #undef RING_REG
23092466
23102467 #define RING_REG(base) (base + 0x244)
2311− MMIO_RING_D(RING_REG, D_BDW_PLUS);
2312− MMIO_D(RING_REG(GEN8_BSD2_RING_BASE), D_BDW_PLUS);
2468+ MMIO_RING_DFH(RING_REG, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
2469+ MMIO_DFH(RING_REG(GEN8_BSD2_RING_BASE), D_BDW_PLUS, F_CMD_ACCESS,
2470+ NULL, NULL);
23132471 #undef RING_REG
23142472
23152473 #define RING_REG(base) (base + 0x370)
@@ -2331,6 +2489,8 @@ static int init_broadwell_mmio_info(struct intel_gvt *gvt) · 15 unmodified lines
23312489 MMIO_D(GEN7_MISCCPCTL, D_BDW_PLUS);
23322490 MMIO_D(0x1c054, D_BDW_PLUS);
23332491
2492+ MMIO_DH(GEN6_PCODE_MAILBOX, D_BDW_PLUS, NULL, mailbox_write);
2493+
23342494 MMIO_D(GEN8_PRIVATE_PAT_LO, D_BDW_PLUS);
23352495 MMIO_D(GEN8_PRIVATE_PAT_HI, D_BDW_PLUS);
23362496
@@ -2341,14 +2501,14 @@ static int init_broadwell_mmio_info(struct intel_gvt *gvt) · 4 unmodified lines
23412501 MMIO_F(RING_REG(GEN8_BSD2_RING_BASE), 32, 0, 0, 0, D_BDW_PLUS, NULL, NULL);
23422502 #undef RING_REG
23432503
2344− MMIO_RING_GM(RING_HWS_PGA, D_BDW_PLUS, NULL, NULL);
2345− MMIO_GM(0x1c080, D_BDW_PLUS, NULL, NULL);
2504+ MMIO_RING_GM_RDR(RING_HWS_PGA, D_BDW_PLUS, NULL, NULL);
2505+ MMIO_GM_RDR(RING_HWS_PGA(GEN8_BSD2_RING_BASE), D_BDW_PLUS, NULL, NULL);
23462506
23472507 MMIO_DFH(HDC_CHICKEN0, D_BDW_PLUS, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL);
23482508
2349− MMIO_D(CHICKEN_PIPESL_1(PIPE_A), D_BDW);
2350− MMIO_D(CHICKEN_PIPESL_1(PIPE_B), D_BDW);
2351− MMIO_D(CHICKEN_PIPESL_1(PIPE_C), D_BDW);
2509+ MMIO_D(CHICKEN_PIPESL_1(PIPE_A), D_BDW_PLUS);
2510+ MMIO_D(CHICKEN_PIPESL_1(PIPE_B), D_BDW_PLUS);
2511+ MMIO_D(CHICKEN_PIPESL_1(PIPE_C), D_BDW_PLUS);
23522512
23532513 MMIO_D(WM_MISC, D_BDW);
23542514 MMIO_D(BDW_EDP_PSR_BASE, D_BDW);
@@ -2362,27 +2522,31 @@ static int init_broadwell_mmio_info(struct intel_gvt *gvt) · 7 unmodified lines
23622522 MMIO_D(GEN8_EU_DISABLE1, D_BDW_PLUS);
23632523 MMIO_D(GEN8_EU_DISABLE2, D_BDW_PLUS);
23642524
2365− MMIO_D(0xfdc, D_BDW);
2366− MMIO_DFH(GEN8_ROW_CHICKEN, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
2367− MMIO_D(GEN7_ROW_CHICKEN2, D_BDW_PLUS);
2368− MMIO_D(GEN8_UCGCTL6, D_BDW_PLUS);
2525+ MMIO_D(0xfdc, D_BDW_PLUS);
2526+ MMIO_DFH(GEN8_ROW_CHICKEN, D_BDW_PLUS, F_MODE_MASK | F_CMD_ACCESS,
2527+ NULL, NULL);
2528+ MMIO_DFH(GEN7_ROW_CHICKEN2, D_BDW_PLUS, F_MODE_MASK | F_CMD_ACCESS,
2529+ NULL, NULL);
2530+ MMIO_DFH(GEN8_UCGCTL6, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
23692531
2370− MMIO_D(0xb1f0, D_BDW);
2371− MMIO_D(0xb1c0, D_BDW);
2532+ MMIO_DFH(0xb1f0, D_BDW, F_CMD_ACCESS, NULL, NULL);
2533+ MMIO_DFH(0xb1c0, D_BDW, F_CMD_ACCESS, NULL, NULL);
23722534 MMIO_DFH(GEN8_L3SQCREG4, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
2373− MMIO_D(0xb100, D_BDW);
2374− MMIO_D(0xb10c, D_BDW);
2535+ MMIO_DFH(0xb100, D_BDW, F_CMD_ACCESS, NULL, NULL);
2536+ MMIO_DFH(0xb10c, D_BDW, F_CMD_ACCESS, NULL, NULL);
23752537 MMIO_D(0xb110, D_BDW);
23762538
2377− MMIO_DFH(0x24d0, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
2378− MMIO_DFH(0x24d4, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
2379− MMIO_DFH(0x24d8, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
2380− MMIO_DFH(0x24dc, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
2539+ MMIO_F(0x24d0, 48, F_CMD_ACCESS, 0, 0, D_BDW_PLUS,
2540+ NULL, force_nonpriv_write);
2541+
2542+ MMIO_D(0x22040, D_BDW_PLUS);
2543+ MMIO_D(0x44484, D_BDW_PLUS);
2544+ MMIO_D(0x4448c, D_BDW_PLUS);
23812545
2382− MMIO_D(0x83a4, D_BDW);
2546+ MMIO_DFH(0x83a4, D_BDW, F_CMD_ACCESS, NULL, NULL);
23832547 MMIO_D(GEN8_L3_LRA_1_GPGPU, D_BDW_PLUS);
23842548
2385− MMIO_D(0x8430, D_BDW);
2549+ MMIO_DFH(0x8430, D_BDW, F_CMD_ACCESS, NULL, NULL);
23862550
23872551 MMIO_D(0x110000, D_BDW_PLUS);
23882552
@@ -2394,10 +2558,19 @@ static int init_broadwell_mmio_info(struct intel_gvt *gvt) · 5 unmodified lines
23942558 MMIO_DFH(0xe194, D_BDW_PLUS, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL);
23952559 MMIO_DFH(0xe188, D_BDW_PLUS, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL);
23962560 MMIO_DFH(HALF_SLICE_CHICKEN2, D_BDW_PLUS, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL);
2397− MMIO_DFH(0x2580, D_BDW_PLUS, F_MODE_MASK, NULL, NULL);
2398−
2399− MMIO_D(0x2248, D_BDW);
2400−
2561+ MMIO_DFH(0x2580, D_BDW_PLUS, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL);
2562+
2563+ MMIO_DFH(0x2248, D_BDW, F_CMD_ACCESS, NULL, NULL);
2564+
2565+ MMIO_DFH(0xe220, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
2566+ MMIO_DFH(0xe230, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
2567+ MMIO_DFH(0xe240, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
2568+ MMIO_DFH(0xe260, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
2569+ MMIO_DFH(0xe270, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
2570+ MMIO_DFH(0xe280, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
2571+ MMIO_DFH(0xe2a0, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
2572+ MMIO_DFH(0xe2b0, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
2573+ MMIO_DFH(0xe2c0, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL);
24012574 return 0;
24022575 }
24032576
@@ -2420,7 +2593,6 @@ static int init_skl_mmio_info(struct intel_gvt *gvt) · 16 unmodified lines
24202593 MMIO_D(HSW_PWR_WELL_BIOS, D_SKL);
24212594 MMIO_DH(HSW_PWR_WELL_DRIVER, D_SKL, NULL, skl_power_well_ctl_write);
24222595
2423− MMIO_DH(GEN6_PCODE_MAILBOX, D_SKL, NULL, mailbox_write);
24242596 MMIO_D(0xa210, D_SKL_PLUS);
24252597 MMIO_D(GEN9_MEDIA_PG_IDLE_HYSTERESIS, D_SKL_PLUS);
24262598 MMIO_D(GEN9_RENDER_PG_IDLE_HYSTERESIS, D_SKL_PLUS);
@@ -2578,16 +2750,16 @@ static int init_skl_mmio_info(struct intel_gvt *gvt) · 151 unmodified lines
25782750 MMIO_F(0xb020, 0x80, F_CMD_ACCESS, 0, 0, D_SKL, NULL, NULL);
25792751
25802752 MMIO_D(0xd08, D_SKL);
2581− MMIO_D(0x20e0, D_SKL);
2582− MMIO_D(0x20ec, D_SKL);
2753+ MMIO_DFH(0x20e0, D_SKL, F_MODE_MASK, NULL, NULL);
2754+ MMIO_DFH(0x20ec, D_SKL, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL);
25832755
25842756 /* TRTT */
2585− MMIO_D(0x4de0, D_SKL);
2586− MMIO_D(0x4de4, D_SKL);
2587− MMIO_D(0x4de8, D_SKL);
2588− MMIO_D(0x4dec, D_SKL);
2589− MMIO_D(0x4df0, D_SKL);
2590− MMIO_DH(0x4df4, D_SKL, NULL, gen9_trtte_write);
2757+ MMIO_DFH(0x4de0, D_SKL, F_CMD_ACCESS, NULL, NULL);
2758+ MMIO_DFH(0x4de4, D_SKL, F_CMD_ACCESS, NULL, NULL);
2759+ MMIO_DFH(0x4de8, D_SKL, F_CMD_ACCESS, NULL, NULL);
2760+ MMIO_DFH(0x4dec, D_SKL, F_CMD_ACCESS, NULL, NULL);
2761+ MMIO_DFH(0x4df0, D_SKL, F_CMD_ACCESS, NULL, NULL);
2762+ MMIO_DFH(0x4df4, D_SKL, F_CMD_ACCESS, NULL, gen9_trtte_write);
25912763 MMIO_DH(0x4dfc, D_SKL, NULL, gen9_trtt_chicken_write);
25922764
25932765 MMIO_D(0x45008, D_SKL);
@@ -2611,7 +2783,7 @@ static int init_skl_mmio_info(struct intel_gvt *gvt) · 17 unmodified lines
26112783 MMIO_D(0x65f08, D_SKL);
26122784 MMIO_D(0x320f0, D_SKL);
26132785
2614− MMIO_D(_REG_VCS2_EXCC, D_SKL);
2786+ MMIO_DFH(_REG_VCS2_EXCC, D_SKL, F_CMD_ACCESS, NULL, NULL);
26152787 MMIO_D(0x70034, D_SKL);
26162788 MMIO_D(0x71034, D_SKL);
26172789 MMIO_D(0x72034, D_SKL);
@@ -2624,6 +2796,9 @@ static int init_skl_mmio_info(struct intel_gvt *gvt) · 6 unmodified lines
26242796 MMIO_D(_PLANE_KEYMSK_1(PIPE_C), D_SKL);
26252797
26262798 MMIO_D(0x44500, D_SKL);
2799+ MMIO_DFH(GEN9_CSFE_CHICKEN1_RCS, D_SKL_PLUS, F_CMD_ACCESS, NULL, NULL);
2800+ MMIO_DFH(GEN8_HDC_CHICKEN1, D_SKL, F_MODE_MASK | F_CMD_ACCESS,
2801+ NULL, NULL);
26272802 return 0;
26282803 }
26292804
drivers/gpu/drm/i915/gvt/kvmgt.c+6−6
@@ -96,10 +96,10 @@ static int gvt_dma_map_iova(struct intel_vgpu *vgpu, kvm_pfn_t pfn, · 95 unmodified lines
9696 struct device *dev = &vgpu->gvt->dev_priv->drm.pdev->dev;
9797 dma_addr_t daddr;
9898
99− page = pfn_to_page(pfn);
100− if (is_error_page(page))
99+ if (unlikely(!pfn_valid(pfn)))
101100 return -EFAULT;
102101
102+ page = pfn_to_page(pfn);
103103 daddr = dma_map_page(dev, page, 0, PAGE_SIZE,
104104 PCI_DMA_BIDIRECTIONAL);
105105 if (dma_mapping_error(dev, daddr))
@@ -295,10 +295,10 @@ static ssize_t description_show(struct kobject *kobj, struct device *dev, · 189 unmodified lines
295295 return 0;
296296
297297 return sprintf(buf, "low_gm_size: %dMB\nhigh_gm_size: %dMB\n"
298− "fence: %d\n",
299− BYTES_TO_MB(type->low_gm_size),
300− BYTES_TO_MB(type->high_gm_size),
301− type->fence);
298+ "fence: %d\nresolution: %s\n",
299+ BYTES_TO_MB(type->low_gm_size),
300+ BYTES_TO_MB(type->high_gm_size),
301+ type->fence, vgpu_edid_str(type->resolution));
302302 }
303303
304304 static MDEV_TYPE_ATTR_RO(available_instances);
drivers/gpu/drm/i915/gvt/mmio.c+65−1
@@ -57,6 +57,58 @@ int intel_vgpu_gpa_to_mmio_offset(struct intel_vgpu *vgpu, u64 gpa) · 56 unmodified lines
5757 (reg >= gvt->device_info.gtt_start_offset \
5858 && reg < gvt->device_info.gtt_start_offset + gvt_ggtt_sz(gvt))
5959
60+static void failsafe_emulate_mmio_rw(struct intel_vgpu *vgpu, uint64_t pa,
61+ void *p_data, unsigned int bytes, bool read)
62+{
63+ struct intel_gvt *gvt = NULL;
64+ void *pt = NULL;
65+ unsigned int offset = 0;
66+
67+ if (!vgpu || !p_data)
68+ return;
69+
70+ gvt = vgpu->gvt;
71+ mutex_lock(&gvt->lock);
72+ offset = intel_vgpu_gpa_to_mmio_offset(vgpu, pa);
73+ if (reg_is_mmio(gvt, offset)) {
74+ if (read)
75+ intel_vgpu_default_mmio_read(vgpu, offset, p_data,
76+ bytes);
77+ else
78+ intel_vgpu_default_mmio_write(vgpu, offset, p_data,
79+ bytes);
80+ } else if (reg_is_gtt(gvt, offset) &&
81+ vgpu->gtt.ggtt_mm->virtual_page_table) {
82+ offset -= gvt->device_info.gtt_start_offset;
83+ pt = vgpu->gtt.ggtt_mm->virtual_page_table + offset;
84+ if (read)
85+ memcpy(p_data, pt, bytes);
86+ else
87+ memcpy(pt, p_data, bytes);
88+
89+ } else if (atomic_read(&vgpu->gtt.n_write_protected_guest_page)) {
90+ struct intel_vgpu_guest_page *gp;
91+
92+ /* Since we enter the failsafe mode early during guest boot,
93+ * guest may not have chance to set up its ppgtt table, so
94+ * there should not be any wp pages for guest. Keep the wp
95+ * related code here in case we need to handle it in furture.
96+ */
97+ gp = intel_vgpu_find_guest_page(vgpu, pa >> PAGE_SHIFT);
98+ if (gp) {
99+ /* remove write protection to prevent furture traps */
100+ intel_vgpu_clean_guest_page(vgpu, gp);
101+ if (read)
102+ intel_gvt_hypervisor_read_gpa(vgpu, pa,
103+ p_data, bytes);
104+ else
105+ intel_gvt_hypervisor_write_gpa(vgpu, pa,
106+ p_data, bytes);
107+ }
108+ }
109+ mutex_unlock(&gvt->lock);
110+}
111+
60112 /**
61113 * intel_vgpu_emulate_mmio_read - emulate MMIO read
62114 * @vgpu: a vGPU
@@ -75,6 +127,11 @@ int intel_vgpu_emulate_mmio_read(struct intel_vgpu *vgpu, uint64_t pa, · 12 unmodified lines
75127 unsigned int offset = 0;
76128 int ret = -EINVAL;
77129
130+
131+ if (vgpu->failsafe) {
132+ failsafe_emulate_mmio_rw(vgpu, pa, p_data, bytes, true);
133+ return 0;
134+ }
78135 mutex_lock(&gvt->lock);
79136
80137 if (atomic_read(&vgpu->gtt.n_write_protected_guest_page)) {
@@ -188,6 +245,11 @@ int intel_vgpu_emulate_mmio_write(struct intel_vgpu *vgpu, uint64_t pa, · 107 unmodified lines
188245 u32 old_vreg = 0, old_sreg = 0;
189246 int ret = -EINVAL;
190247
248+ if (vgpu->failsafe) {
249+ failsafe_emulate_mmio_rw(vgpu, pa, p_data, bytes, false);
250+ return 0;
251+ }
252+
191253 mutex_lock(&gvt->lock);
192254
193255 if (atomic_read(&vgpu->gtt.n_write_protected_guest_page)) {
@@ -236,7 +298,7 @@ int intel_vgpu_emulate_mmio_write(struct intel_vgpu *vgpu, uint64_t pa, · 42 unmodified lines
236298
237299 mmio = intel_gvt_find_mmio_info(gvt, rounddown(offset, 4));
238300 if (!mmio && !vgpu->mmio.disable_warn_untrack)
239− gvt_err("vgpu%d: write untracked MMIO %x len %d val %x\n",
301+ gvt_dbg_mmio("vgpu%d: write untracked MMIO %x len %d val %x\n",
240302 vgpu->id, offset, bytes, *(u32 *)p_data);
241303
242304 if (!intel_gvt_mmio_is_unalign(gvt, offset)) {
@@ -322,6 +384,8 @@ void intel_vgpu_reset_mmio(struct intel_vgpu *vgpu) · 79 unmodified lines
322384
323385 /* set the bit 0:2(Core C-State ) to C0 */
324386 vgpu_vreg(vgpu, GEN6_GT_CORE_STATUS) = 0;
387+
388+ vgpu->mmio.disable_warn_untrack = false;
325389 }
326390
327391 /**
drivers/gpu/drm/i915/gvt/opregion.c+2−3
@@ -27,7 +27,6 @@ · 26 unmodified lines
2727
2828 static int init_vgpu_opregion(struct intel_vgpu *vgpu, u32 gpa)
2929 {
30− void __iomem *host_va = vgpu->gvt->opregion.opregion_va;
3130 u8 *buf;
3231 int i;
3332
@@ -43,8 +42,8 @@ static int init_vgpu_opregion(struct intel_vgpu *vgpu, u32 gpa) · 9 unmodified lines
4342 if (!vgpu_opregion(vgpu)->va)
4443 return -ENOMEM;
4544
46− memcpy_fromio(vgpu_opregion(vgpu)->va, host_va,
47− INTEL_GVT_OPREGION_SIZE);
45+ memcpy(vgpu_opregion(vgpu)->va, vgpu->gvt->opregion.opregion_va,
46+ INTEL_GVT_OPREGION_SIZE);
4847
4948 for (i = 0; i < INTEL_GVT_OPREGION_PAGES; i++)
5049 vgpu_opregion(vgpu)->gfn[i] = (gpa >> PAGE_SHIFT) + i;
drivers/gpu/drm/i915/gvt/render.c+16−0
@@ -53,6 +53,14 @@ static struct render_mmio gen8_render_mmio_list[] = { · 52 unmodified lines
5353 {RCS, _MMIO(0x24d4), 0, false},
5454 {RCS, _MMIO(0x24d8), 0, false},
5555 {RCS, _MMIO(0x24dc), 0, false},
56+ {RCS, _MMIO(0x24e0), 0, false},
57+ {RCS, _MMIO(0x24e4), 0, false},
58+ {RCS, _MMIO(0x24e8), 0, false},
59+ {RCS, _MMIO(0x24ec), 0, false},
60+ {RCS, _MMIO(0x24f0), 0, false},
61+ {RCS, _MMIO(0x24f4), 0, false},
62+ {RCS, _MMIO(0x24f8), 0, false},
63+ {RCS, _MMIO(0x24fc), 0, false},
5664 {RCS, _MMIO(0x7004), 0xffff, true},
5765 {RCS, _MMIO(0x7008), 0xffff, true},
5866 {RCS, _MMIO(0x7000), 0xffff, true},
@@ -76,6 +84,14 @@ static struct render_mmio gen9_render_mmio_list[] = { · 17 unmodified lines
7684 {RCS, _MMIO(0x24d4), 0, false},
7785 {RCS, _MMIO(0x24d8), 0, false},
7886 {RCS, _MMIO(0x24dc), 0, false},
87+ {RCS, _MMIO(0x24e0), 0, false},
88+ {RCS, _MMIO(0x24e4), 0, false},
89+ {RCS, _MMIO(0x24e8), 0, false},
90+ {RCS, _MMIO(0x24ec), 0, false},
91+ {RCS, _MMIO(0x24f0), 0, false},
92+ {RCS, _MMIO(0x24f4), 0, false},
93+ {RCS, _MMIO(0x24f8), 0, false},
94+ {RCS, _MMIO(0x24fc), 0, false},
7995 {RCS, _MMIO(0x7004), 0xffff, true},
8096 {RCS, _MMIO(0x7008), 0xffff, true},
8197 {RCS, _MMIO(0x7000), 0xffff, true},
drivers/gpu/drm/i915/gvt/scheduler.c+36−16
@@ -139,6 +139,9 @@ static int shadow_context_status_change(struct notifier_block *nb, · 138 unmodified lines
139139 struct intel_vgpu_workload *workload =
140140 scheduler->current_workload[req->engine->id];
141141
142+ if (unlikely(!workload))
143+ return NOTIFY_OK;
144+
142145 switch (action) {
143146 case INTEL_CONTEXT_SCHEDULE_IN:
144147 intel_gvt_load_render_mmio(workload->vgpu,
@@ -148,6 +151,15 @@ static int shadow_context_status_change(struct notifier_block *nb, · 3 unmodified lines
148151 case INTEL_CONTEXT_SCHEDULE_OUT:
149152 intel_gvt_restore_render_mmio(workload->vgpu,
150153 workload->ring_id);
154+ /* If the status is -EINPROGRESS means this workload
155+ * doesn't meet any issue during dispatching so when
156+ * get the SCHEDULE_OUT set the status to be zero for
157+ * good. If the status is NOT -EINPROGRESS means there
158+ * is something wrong happened during dispatching and
159+ * the status should not be set to zero
160+ */
161+ if (workload->status == -EINPROGRESS)
162+ workload->status = 0;
151163 atomic_set(&workload->shadow_ctx_active, 0);
152164 break;
153165 default:
@@ -359,15 +371,23 @@ static void complete_current_workload(struct intel_gvt *gvt, int ring_id) · 205 unmodified lines
359371 workload = scheduler->current_workload[ring_id];
360372 vgpu = workload->vgpu;
361373
362− if (!workload->status && !vgpu->resetting) {
374+ /* For the workload w/ request, needs to wait for the context
375+ * switch to make sure request is completed.
376+ * For the workload w/o request, directly complete the workload.
377+ */
378+ if (workload->req) {
363379 wait_event(workload->shadow_ctx_status_wq,
364380 !atomic_read(&workload->shadow_ctx_active));
365381
366− update_guest_context(workload);
382+ i915_gem_request_put(fetch_and_zero(&workload->req));
383+
384+ if (!workload->status && !vgpu->resetting) {
385+ update_guest_context(workload);
367386
368− for_each_set_bit(event, workload->pending_events,
369− INTEL_GVT_EVENT_MAX)
370− intel_vgpu_trigger_virtual_event(vgpu, event);
387+ for_each_set_bit(event, workload->pending_events,
388+ INTEL_GVT_EVENT_MAX)
389+ intel_vgpu_trigger_virtual_event(vgpu, event);
390+ }
371391 }
372392
373393 gvt_dbg_sched("ring id %d complete workload %p status %d\n",
@@ -397,7 +417,6 @@ static int workload_thread(void *priv) · 23 unmodified lines
397417 int ring_id = p->ring_id;
398418 struct intel_gvt_workload_scheduler *scheduler = &gvt->scheduler;
399419 struct intel_vgpu_workload *workload = NULL;
400− long lret;
401420 int ret;
402421 bool need_force_wake = IS_SKYLAKE(gvt->dev_priv);
403422 DEFINE_WAIT_FUNC(wait, woken_wake_function);
@@ -446,23 +465,24 @@ static int workload_thread(void *priv) · 42 unmodified lines
446465
447466 gvt_dbg_sched("ring id %d wait workload %p\n",
448467 workload->ring_id, workload);
449−
450− lret = i915_wait_request(workload->req,
468+retry:
469+ i915_wait_request(workload->req,
451470 0, MAX_SCHEDULE_TIMEOUT);
452− if (lret < 0) {
453− workload->status = lret;
454− gvt_err("fail to wait workload, skip\n");
455− } else {
456− workload->status = 0;
471+ /* I915 has replay mechanism and a request will be replayed
472+ * if there is i915 reset. So the seqno will be updated anyway.
473+ * If the seqno is not updated yet after waiting, which means
474+ * the replay may still be in progress and we can wait again.
475+ */
476+ if (!i915_gem_request_completed(workload->req)) {
477+ gvt_dbg_sched("workload %p not completed, wait again\n",
478+ workload);
479+ goto retry;
457480 }
458481
459482 complete:
460483 gvt_dbg_sched("will complete workload %p, status: %d\n",
461484 workload, workload->status);
462485
463− if (workload->req)
464− i915_gem_request_put(fetch_and_zero(&workload->req));
465−
466486 complete_current_workload(gvt, ring_id);
467487
468488 if (need_force_wake)
drivers/gpu/drm/i915/gvt/vgpu.c+45−27
@@ -64,6 +64,20 @@ void populate_pvinfo_page(struct intel_vgpu *vgpu) · 63 unmodified lines
6464 WARN_ON(sizeof(struct vgt_if) != VGT_PVINFO_SIZE);
6565 }
6666
67+static struct {
68+ unsigned int low_mm;
69+ unsigned int high_mm;
70+ unsigned int fence;
71+ enum intel_vgpu_edid edid;
72+ char *name;
73+} vgpu_types[] = {
74+/* Fixed vGPU type table */
75+ { MB_TO_BYTES(64), MB_TO_BYTES(512), 4, GVT_EDID_1024_768, "8" },
76+ { MB_TO_BYTES(128), MB_TO_BYTES(512), 4, GVT_EDID_1920_1200, "4" },
77+ { MB_TO_BYTES(256), MB_TO_BYTES(1024), 4, GVT_EDID_1920_1200, "2" },
78+ { MB_TO_BYTES(512), MB_TO_BYTES(2048), 4, GVT_EDID_1920_1200, "1" },
79+};
80+
6781 /**
6882 * intel_gvt_init_vgpu_types - initialize vGPU type list
6983 * @gvt : GVT device
@@ -78,9 +92,8 @@ int intel_gvt_init_vgpu_types(struct intel_gvt *gvt) · 8 unmodified lines
7892 unsigned int min_low;
7993
8094 /* vGPU type name is defined as GVTg_Vx_y which contains
81− * physical GPU generation type and 'y' means maximum vGPU
82− * instances user can create on one physical GPU for this
83− * type.
95+ * physical GPU generation type (e.g V4 as BDW server, V5 as
96+ * SKL server).
8497 *
8598 * Depend on physical SKU resource, might see vGPU types like
8699 * GVTg_V4_8, GVTg_V4_4, GVTg_V4_2, etc. We can create
@@ -92,7 +105,7 @@ int intel_gvt_init_vgpu_types(struct intel_gvt *gvt) · 5 unmodified lines
92105 */
93106 low_avail = gvt_aperture_sz(gvt) - HOST_LOW_GM_SIZE;
94107 high_avail = gvt_hidden_sz(gvt) - HOST_HIGH_GM_SIZE;
95− num_types = 4;
108+ num_types = sizeof(vgpu_types) / sizeof(vgpu_types[0]);
96109
97110 gvt->types = kzalloc(num_types * sizeof(struct intel_vgpu_type),
98111 GFP_KERNEL);
@@ -101,28 +114,29 @@ int intel_gvt_init_vgpu_types(struct intel_gvt *gvt) · 2 unmodified lines
101114
102115 min_low = MB_TO_BYTES(32);
103116 for (i = 0; i < num_types; ++i) {
104− if (low_avail / min_low == 0)
117+ if (low_avail / vgpu_types[i].low_mm == 0)
105118 break;
106− gvt->types[i].low_gm_size = min_low;
107− gvt->types[i].high_gm_size = max((min_low<<3), MB_TO_BYTES(384U));
108− gvt->types[i].fence = 4;
109− gvt->types[i].max_instance = min(low_avail / min_low,
110− high_avail / gvt->types[i].high_gm_size);
111− gvt->types[i].avail_instance = gvt->types[i].max_instance;
119+
120+ gvt->types[i].low_gm_size = vgpu_types[i].low_mm;
121+ gvt->types[i].high_gm_size = vgpu_types[i].high_mm;
122+ gvt->types[i].fence = vgpu_types[i].fence;
123+ gvt->types[i].resolution = vgpu_types[i].edid;
124+ gvt->types[i].avail_instance = min(low_avail / vgpu_types[i].low_mm,
125+ high_avail / vgpu_types[i].high_mm);
112126
113127 if (IS_GEN8(gvt->dev_priv))
114− sprintf(gvt->types[i].name, "GVTg_V4_%u",
115− gvt->types[i].max_instance);
128+ sprintf(gvt->types[i].name, "GVTg_V4_%s",
129+ vgpu_types[i].name);
116130 else if (IS_GEN9(gvt->dev_priv))
117− sprintf(gvt->types[i].name, "GVTg_V5_%u",
118− gvt->types[i].max_instance);
131+ sprintf(gvt->types[i].name, "GVTg_V5_%s",
132+ vgpu_types[i].name);
119133
120− min_low <<= 1;
121− gvt_dbg_core("type[%d]: %s max %u avail %u low %u high %u fence %u\n",
122− i, gvt->types[i].name, gvt->types[i].max_instance,
134+ gvt_dbg_core("type[%d]: %s avail %u low %u high %u fence %u res %s\n",
135+ i, gvt->types[i].name,
123136 gvt->types[i].avail_instance,
124137 gvt->types[i].low_gm_size,
125− gvt->types[i].high_gm_size, gvt->types[i].fence);
138+ gvt->types[i].high_gm_size, gvt->types[i].fence,
139+ vgpu_edid_str(gvt->types[i].resolution));
126140 }
127141
128142 gvt->num_types = i;
@@ -138,7 +152,7 @@ static void intel_gvt_update_vgpu_types(struct intel_gvt *gvt) · 9 unmodified lines
138152 {
139153 int i;
140154 unsigned int low_gm_avail, high_gm_avail, fence_avail;
141− unsigned int low_gm_min, high_gm_min, fence_min, total_min;
155+ unsigned int low_gm_min, high_gm_min, fence_min;
142156
143157 /* Need to depend on maxium hw resource size but keep on
144158 * static config for now.
@@ -154,12 +168,11 @@ static void intel_gvt_update_vgpu_types(struct intel_gvt *gvt) · 9 unmodified lines
154168 low_gm_min = low_gm_avail / gvt->types[i].low_gm_size;
155169 high_gm_min = high_gm_avail / gvt->types[i].high_gm_size;
156170 fence_min = fence_avail / gvt->types[i].fence;
157− total_min = min(min(low_gm_min, high_gm_min), fence_min);
158− gvt->types[i].avail_instance = min(gvt->types[i].max_instance,
159− total_min);
171+ gvt->types[i].avail_instance = min(min(low_gm_min, high_gm_min),
172+ fence_min);
160173
161− gvt_dbg_core("update type[%d]: %s max %u avail %u low %u high %u fence %u\n",
162− i, gvt->types[i].name, gvt->types[i].max_instance,
174+ gvt_dbg_core("update type[%d]: %s avail %u low %u high %u fence %u\n",
175+ i, gvt->types[i].name,
163176 gvt->types[i].avail_instance, gvt->types[i].low_gm_size,
164177 gvt->types[i].high_gm_size, gvt->types[i].fence);
165178 }
@@ -248,7 +261,7 @@ static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt, · 82 unmodified lines
248261 if (ret)
249262 goto out_detach_hypervisor_vgpu;
250263
251− ret = intel_vgpu_init_display(vgpu);
264+ ret = intel_vgpu_init_display(vgpu, param->resolution);
252265 if (ret)
253266 goto out_clean_gtt;
254267
@@ -312,6 +325,7 @@ struct intel_vgpu *intel_gvt_create_vgpu(struct intel_gvt *gvt, · 57 unmodified lines
312325 param.low_gm_sz = type->low_gm_size;
313326 param.high_gm_sz = type->high_gm_size;
314327 param.fence_sz = type->fence;
328+ param.resolution = type->resolution;
315329
316330 /* XXX current param based on MB */
317331 param.low_gm_sz = BYTES_TO_MB(param.low_gm_sz);
@@ -387,8 +401,12 @@ void intel_gvt_reset_vgpu_locked(struct intel_vgpu *vgpu, bool dmlr, · 69 unmodified lines
387401 populate_pvinfo_page(vgpu);
388402 intel_vgpu_reset_display(vgpu);
389403
390− if (dmlr)
404+ if (dmlr) {
391405 intel_vgpu_reset_cfg_space(vgpu);
406+ /* only reset the failsafe mode when dmlr reset */
407+ vgpu->failsafe = false;
408+ vgpu->pv_notified = false;
409+ }
392410 }
393411
394412 vgpu->resetting = false;
drivers/gpu/drm/mxsfb/mxsfb_crtc.c+43−6
@@ -65,13 +65,11 @@ static int mxsfb_set_pixel_fmt(struct mxsfb_drm_private *mxsfb) · 64 unmodified lines
6565 switch (format) {
6666 case DRM_FORMAT_RGB565:
6767 dev_dbg(drm->dev, "Setting up RGB565 mode\n");
68− ctrl |= CTRL_SET_BUS_WIDTH(STMLCDIF_16BIT);
6968 ctrl |= CTRL_SET_WORD_LENGTH(0);
7069 ctrl1 |= CTRL1_SET_BYTE_PACKAGING(0xf);
7170 break;
7271 case DRM_FORMAT_XRGB8888:
7372 dev_dbg(drm->dev, "Setting up XRGB8888 mode\n");
74− ctrl |= CTRL_SET_BUS_WIDTH(STMLCDIF_24BIT);
7573 ctrl |= CTRL_SET_WORD_LENGTH(3);
7674 /* Do not use packed pixels = one pixel per word instead. */
7775 ctrl1 |= CTRL1_SET_BYTE_PACKAGING(0x7);
@@ -87,6 +85,36 @@ static int mxsfb_set_pixel_fmt(struct mxsfb_drm_private *mxsfb) · 9 unmodified lines
8785 return 0;
8886 }
8987
88+static void mxsfb_set_bus_fmt(struct mxsfb_drm_private *mxsfb)
89+{
90+ struct drm_crtc *crtc = &mxsfb->pipe.crtc;
91+ struct drm_device *drm = crtc->dev;
92+ u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24;
93+ u32 reg;
94+
95+ reg = readl(mxsfb->base + LCDC_CTRL);
96+
97+ if (mxsfb->connector.display_info.num_bus_formats)
98+ bus_format = mxsfb->connector.display_info.bus_formats[0];
99+
100+ reg &= ~CTRL_BUS_WIDTH_MASK;
101+ switch (bus_format) {
102+ case MEDIA_BUS_FMT_RGB565_1X16:
103+ reg |= CTRL_SET_BUS_WIDTH(STMLCDIF_16BIT);
104+ break;
105+ case MEDIA_BUS_FMT_RGB666_1X18:
106+ reg |= CTRL_SET_BUS_WIDTH(STMLCDIF_18BIT);
107+ break;
108+ case MEDIA_BUS_FMT_RGB888_1X24:
109+ reg |= CTRL_SET_BUS_WIDTH(STMLCDIF_24BIT);
110+ break;
111+ default:
112+ dev_err(drm->dev, "Unknown media bus format %d\n", bus_format);
113+ break;
114+ }
115+ writel(reg, mxsfb->base + LCDC_CTRL);
116+}
117+
90118 static void mxsfb_enable_controller(struct mxsfb_drm_private *mxsfb)
91119 {
92120 u32 reg;
@@ -168,13 +196,22 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb) · 75 unmodified lines
168196 vdctrl0 |= VDCTRL0_HSYNC_ACT_HIGH;
169197 if (m->flags & DRM_MODE_FLAG_PVSYNC)
170198 vdctrl0 |= VDCTRL0_VSYNC_ACT_HIGH;
171− if (bus_flags & DRM_BUS_FLAG_DE_HIGH)
199+ /* Make sure Data Enable is high active by default */
200+ if (!(bus_flags & DRM_BUS_FLAG_DE_LOW))
172201 vdctrl0 |= VDCTRL0_ENABLE_ACT_HIGH;
173− if (bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
202+ /*
203+ * DRM_BUS_FLAG_PIXDATA_ defines are controller centric,
204+ * controllers VDCTRL0_DOTCLK is display centric.
205+ * Drive on positive edge -> display samples on falling edge
206+ * DRM_BUS_FLAG_PIXDATA_POSEDGE -> VDCTRL0_DOTCLK_ACT_FALLING
207+ */
208+ if (bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
174209 vdctrl0 |= VDCTRL0_DOTCLK_ACT_FALLING;
175210
176211 writel(vdctrl0, mxsfb->base + LCDC_VDCTRL0);
177212
213+ mxsfb_set_bus_fmt(mxsfb);
214+
178215 /* Frame length in lines. */
179216 writel(m->crtc_vtotal, mxsfb->base + LCDC_VDCTRL1);
180217
@@ -184,8 +221,8 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb) · 3 unmodified lines
184221 VDCTRL2_SET_HSYNC_PERIOD(m->crtc_htotal),
185222 mxsfb->base + LCDC_VDCTRL2);
186223
187− writel(SET_HOR_WAIT_CNT(m->crtc_hblank_end - m->crtc_hsync_end) |
188− SET_VERT_WAIT_CNT(m->crtc_vblank_end - m->crtc_vsync_end),
224+ writel(SET_HOR_WAIT_CNT(m->crtc_htotal - m->crtc_hsync_start) |
225+ SET_VERT_WAIT_CNT(m->crtc_vtotal - m->crtc_vsync_start),
189226 mxsfb->base + LCDC_VDCTRL3);
190227
191228 writel(SET_DOTCLK_H_VALID_DATA_CNT(m->hdisplay),
drivers/gpu/drm/mxsfb/mxsfb_drv.c+4−0
@@ -102,14 +102,18 @@ static void mxsfb_pipe_enable(struct drm_simple_display_pipe *pipe, · 101 unmodified lines
102102 {
103103 struct mxsfb_drm_private *mxsfb = drm_pipe_to_mxsfb_drm_private(pipe);
104104
105+ drm_panel_prepare(mxsfb->panel);
105106 mxsfb_crtc_enable(mxsfb);
107+ drm_panel_enable(mxsfb->panel);
106108 }
107109
108110 static void mxsfb_pipe_disable(struct drm_simple_display_pipe *pipe)
109111 {
110112 struct mxsfb_drm_private *mxsfb = drm_pipe_to_mxsfb_drm_private(pipe);
111113
114+ drm_panel_disable(mxsfb->panel);
112115 mxsfb_crtc_disable(mxsfb);
116+ drm_panel_unprepare(mxsfb->panel);
113117 }
114118
115119 static void mxsfb_pipe_update(struct drm_simple_display_pipe *pipe,
drivers/gpu/drm/mxsfb/mxsfb_out.c+4−0
@@ -112,6 +112,7 @@ static int mxsfb_attach_endpoint(struct drm_device *drm, · 111 unmodified lines
112112
113113 int mxsfb_create_output(struct drm_device *drm)
114114 {
115+ struct mxsfb_drm_private *mxsfb = drm->dev_private;
115116 struct device_node *ep_np = NULL;
116117 struct of_endpoint ep;
117118 int ret;
@@ -127,5 +128,8 @@ int mxsfb_create_output(struct drm_device *drm) · 9 unmodified lines
127128 }
128129 }
129130
131+ if (!mxsfb->panel)
132+ return -EPROBE_DEFER;
133+
130134 return 0;
131135 }
drivers/gpu/drm/mxsfb/mxsfb_regs.h+1−0
@@ -44,6 +44,7 @@ · 43 unmodified lines
4444 #define CTRL_DATA_SELECT (1 << 16)
4545 #define CTRL_SET_BUS_WIDTH(x) (((x) & 0x3) << 10)
4646 #define CTRL_GET_BUS_WIDTH(x) (((x) >> 10) & 0x3)
47+#define CTRL_BUS_WIDTH_MASK (0x3 << 10)
4748 #define CTRL_SET_WORD_LENGTH(x) (((x) & 0x3) << 8)
4849 #define CTRL_GET_WORD_LENGTH(x) (((x) >> 8) & 0x3)
4950 #define CTRL_MASTER (1 << 5)
drivers/gpu/drm/rcar-du/rcar_du_vsp.c+6−2
@@ -32,6 +32,10 @@ void rcar_du_vsp_enable(struct rcar_du_crtc *crtc) · 31 unmodified lines
3232 {
3333 const struct drm_display_mode *mode = &crtc->crtc.state->adjusted_mode;
3434 struct rcar_du_device *rcdu = crtc->group->dev;
35+ struct vsp1_du_lif_config cfg = {
36+ .width = mode->hdisplay,
37+ .height = mode->vdisplay,
38+ };
3539 struct rcar_du_plane_state state = {
3640 .state = {
3741 .crtc = &crtc->crtc,
@@ -66,12 +70,12 @@ void rcar_du_vsp_enable(struct rcar_du_crtc *crtc) · 28 unmodified lines
6670 */
6771 crtc->group->need_restart = true;
6872
69− vsp1_du_setup_lif(crtc->vsp->vsp, mode->hdisplay, mode->vdisplay);
73+ vsp1_du_setup_lif(crtc->vsp->vsp, &cfg);
7074 }
7175
7276 void rcar_du_vsp_disable(struct rcar_du_crtc *crtc)
7377 {
74− vsp1_du_setup_lif(crtc->vsp->vsp, 0, 0);
78+ vsp1_du_setup_lif(crtc->vsp->vsp, NULL);
7579 }
7680
7781 void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc)
drivers/hv/channel.c+1−1
@@ -543,7 +543,7 @@ static int vmbus_close_internal(struct vmbus_channel *channel) · 542 unmodified lines
543543 /*
544544 * In case a device driver's probe() fails (e.g.,
545545 * util_probe() -> vmbus_open() returns -ENOMEM) and the device is
546− * rescinded later (e.g., we dynamically disble an Integrated Service
546+ * rescinded later (e.g., we dynamically disable an Integrated Service
547547 * in Hyper-V Manager), the driver's remove() invokes vmbus_close():
548548 * here we should skip most of the below cleanup work.
549549 */
drivers/i2c/busses/i2c-brcmstb.c+21−6
@@ -465,6 +465,7 @@ static int brcmstb_i2c_xfer(struct i2c_adapter *adapter, · 464 unmodified lines
465465 u8 *tmp_buf;
466466 int len = 0;
467467 int xfersz = brcmstb_i2c_get_xfersz(dev);
468+ u32 cond, cond_per_msg;
468469
469470 if (dev->is_suspended)
470471 return -EBUSY;
@@ -481,10 +482,11 @@ static int brcmstb_i2c_xfer(struct i2c_adapter *adapter, · 10 unmodified lines
481482 pmsg->buf ? pmsg->buf[0] : '0', pmsg->len);
482483
483484 if (i < (num - 1) && (msgs[i + 1].flags & I2C_M_NOSTART))
484− brcmstb_set_i2c_start_stop(dev, ~(COND_START_STOP));
485+ cond = ~COND_START_STOP;
485486 else
486− brcmstb_set_i2c_start_stop(dev,
487− COND_RESTART | COND_NOSTOP);
487+ cond = COND_RESTART | COND_NOSTOP;
488+
489+ brcmstb_set_i2c_start_stop(dev, cond);
488490
489491 /* Send slave address */
490492 if (!(pmsg->flags & I2C_M_NOSTART)) {
@@ -497,13 +499,24 @@ static int brcmstb_i2c_xfer(struct i2c_adapter *adapter, · 6 unmodified lines
497499 }
498500 }
499501
502+ cond_per_msg = cond;
503+
500504 /* Perform data transfer */
501505 while (len) {
502506 bytes_to_xfer = min(len, xfersz);
503507
504− if (len <= xfersz && i == (num - 1))
505− brcmstb_set_i2c_start_stop(dev,
506− ~(COND_START_STOP));
508+ if (len <= xfersz) {
509+ if (i == (num - 1))
510+ cond_per_msg = cond_per_msg &
511+ ~(COND_RESTART | COND_NOSTOP);
512+ else
513+ cond_per_msg = cond;
514+ } else {
515+ cond_per_msg = (cond_per_msg & ~COND_RESTART) |
516+ COND_NOSTOP;
517+ }
518+
519+ brcmstb_set_i2c_start_stop(dev, cond_per_msg);
507520
508521 rc = brcmstb_i2c_xfer_bsc_data(dev, tmp_buf,
509522 bytes_to_xfer, pmsg);
@@ -512,6 +525,8 @@ static int brcmstb_i2c_xfer(struct i2c_adapter *adapter, · 2 unmodified lines
512525
513526 len -= bytes_to_xfer;
514527 tmp_buf += bytes_to_xfer;
528+
529+ cond_per_msg = COND_NOSTART | COND_NOSTOP;
515530 }
516531 }
517532
drivers/i2c/busses/i2c-designware-core.h+1−0
@@ -88,6 +88,7 @@ struct dw_i2c_dev { · 87 unmodified lines
8888 void __iomem *base;
8989 struct completion cmd_complete;
9090 struct clk *clk;
91+ struct reset_control *rst;
9192 u32 (*get_clk_rate_khz) (struct dw_i2c_dev *dev);
9293 struct dw_pci_controller *controller;
9394 int cmd_err;
drivers/i2c/busses/i2c-designware-platdrv.c+24−4
@@ -38,6 +38,7 @@ · 37 unmodified lines
3838 #include <linux/pm_runtime.h>
3939 #include <linux/property.h>
4040 #include <linux/io.h>
41+#include <linux/reset.h>
4142 #include <linux/slab.h>
4243 #include <linux/acpi.h>
4344 #include <linux/platform_data/i2c-designware.h>
@@ -199,6 +200,14 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) · 155 unmodified lines
199200 dev->irq = irq;
200201 platform_set_drvdata(pdev, dev);
201202
203+ dev->rst = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL);
204+ if (IS_ERR(dev->rst)) {
205+ if (PTR_ERR(dev->rst) == -EPROBE_DEFER)
206+ return -EPROBE_DEFER;
207+ } else {
208+ reset_control_deassert(dev->rst);
209+ }
210+
202211 if (pdata) {
203212 dev->clk_freq = pdata->i2c_scl_freq;
204213 } else {
@@ -235,12 +244,13 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) · 30 unmodified lines
235244 && dev->clk_freq != 1000000 && dev->clk_freq != 3400000) {
236245 dev_err(&pdev->dev,
237246 "Only 100kHz, 400kHz, 1MHz and 3.4MHz supported");
238− return -EINVAL;
247+ r = -EINVAL;
248+ goto exit_reset;
239249 }
240250
241251 r = i2c_dw_eval_lock_support(dev);
242252 if (r)
243− return r;
253+ goto exit_reset;
244254
245255 dev->functionality = I2C_FUNC_10BIT_ADDR | DW_IC_DEFAULT_FUNCTIONALITY;
246256
@@ -286,10 +296,18 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) · 39 unmodified lines
286296 }
287297
288298 r = i2c_dw_probe(dev);
289− if (r && !dev->pm_runtime_disabled)
290− pm_runtime_disable(&pdev->dev);
299+ if (r)
300+ goto exit_probe;
291301
292302 return r;
303+
304+exit_probe:
305+ if (!dev->pm_runtime_disabled)
306+ pm_runtime_disable(&pdev->dev);
307+exit_reset:
308+ if (!IS_ERR_OR_NULL(dev->rst))
309+ reset_control_assert(dev->rst);
310+ return r;
293311 }
294312
295313 static int dw_i2c_plat_remove(struct platform_device *pdev)
@@ -306,6 +324,8 @@ static int dw_i2c_plat_remove(struct platform_device *pdev) · 10 unmodified lines
306324 pm_runtime_put_sync(&pdev->dev);
307325 if (!dev->pm_runtime_disabled)
308326 pm_runtime_disable(&pdev->dev);
327+ if (!IS_ERR_OR_NULL(dev->rst))
328+ reset_control_assert(dev->rst);
309329
310330 return 0;
311331 }
drivers/i2c/busses/i2c-exynos5.c+2−1
@@ -457,7 +457,6 @@ static irqreturn_t exynos5_i2c_irq(int irqno, void *dev_id) · 456 unmodified lines
457457
458458 int_status = readl(i2c->regs + HSI2C_INT_STATUS);
459459 writel(int_status, i2c->regs + HSI2C_INT_STATUS);
460− trans_status = readl(i2c->regs + HSI2C_TRANS_STATUS);
461460
462461 /* handle interrupt related to the transfer status */
463462 if (i2c->variant->hw == HSI2C_EXYNOS7) {
@@ -482,11 +481,13 @@ static irqreturn_t exynos5_i2c_irq(int irqno, void *dev_id) · 18 unmodified lines
482481 goto stop;
483482 }
484483
484+ trans_status = readl(i2c->regs + HSI2C_TRANS_STATUS);
485485 if ((trans_status & HSI2C_MASTER_ST_MASK) == HSI2C_MASTER_ST_LOSE) {
486486 i2c->state = -EAGAIN;
487487 goto stop;
488488 }
489489 } else if (int_status & HSI2C_INT_I2C) {
490+ trans_status = readl(i2c->regs + HSI2C_TRANS_STATUS);
490491 if (trans_status & HSI2C_NO_DEV_ACK) {
491492 dev_dbg(i2c->dev, "No ACK from device\n");
492493 i2c->state = -ENXIO;
drivers/i2c/busses/i2c-meson.c+1−1
@@ -175,7 +175,7 @@ static void meson_i2c_put_data(struct meson_i2c *i2c, char *buf, int len) · 174 unmodified lines
175175 wdata1 |= *buf++ << ((i - 4) * 8);
176176
177177 writel(wdata0, i2c->regs + REG_TOK_WDATA0);
178− writel(wdata0, i2c->regs + REG_TOK_WDATA1);
178+ writel(wdata1, i2c->regs + REG_TOK_WDATA1);
179179
180180 dev_dbg(i2c->dev, "%s: data %08x %08x len %d\n", __func__,
181181 wdata0, wdata1, len);
drivers/i2c/busses/i2c-mt65xx.c+0−9
@@ -172,14 +172,6 @@ static const struct i2c_adapter_quirks mt6577_i2c_quirks = { · 171 unmodified lines
172172 .max_comb_2nd_msg_len = 31,
173173 };
174174
175−static const struct i2c_adapter_quirks mt8173_i2c_quirks = {
176− .max_num_msgs = 65535,
177− .max_write_len = 65535,
178− .max_read_len = 65535,
179− .max_comb_1st_msg_len = 65535,
180− .max_comb_2nd_msg_len = 65535,
181−};
182−
183175 static const struct mtk_i2c_compatible mt6577_compat = {
184176 .quirks = &mt6577_i2c_quirks,
185177 .pmic_i2c = 0,
@@ -199,7 +191,6 @@ static const struct mtk_i2c_compatible mt6589_compat = { · 13 unmodified lines
199191 };
200192
201193 static const struct mtk_i2c_compatible mt8173_compat = {
202− .quirks = &mt8173_i2c_quirks,
203194 .pmic_i2c = 0,
204195 .dcm = 1,
205196 .auto_restart = 1,
drivers/i2c/busses/i2c-riic.c+5−1
@@ -218,8 +218,12 @@ static irqreturn_t riic_tend_isr(int irq, void *data) · 217 unmodified lines
218218 }
219219
220220 if (riic->is_last || riic->err) {
221− riic_clear_set_bit(riic, 0, ICIER_SPIE, RIIC_ICIER);
221+ riic_clear_set_bit(riic, ICIER_TEIE, ICIER_SPIE, RIIC_ICIER);
222222 writeb(ICCR2_SP, riic->base + RIIC_ICCR2);
223+ } else {
224+ /* Transfer is complete, but do not send STOP */
225+ riic_clear_set_bit(riic, ICIER_TEIE, 0, RIIC_ICIER);
226+ complete(&riic->msg_done);
223227 }
224228
225229 return IRQ_HANDLED;
drivers/i2c/i2c-mux.c+2−0
@@ -429,6 +429,7 @@ void i2c_mux_del_adapters(struct i2c_mux_core *muxc) · 428 unmodified lines
429429 while (muxc->num_adapters) {
430430 struct i2c_adapter *adap = muxc->adapter[--muxc->num_adapters];
431431 struct i2c_mux_priv *priv = adap->algo_data;
432+ struct device_node *np = adap->dev.of_node;
432433
433434 muxc->adapter[muxc->num_adapters] = NULL;
434435
@@ -438,6 +439,7 @@ void i2c_mux_del_adapters(struct i2c_mux_core *muxc) · 3 unmodified lines
438439
439440 sysfs_remove_link(&priv->adap.dev.kobj, "mux_device");
440441 i2c_del_adapter(adap);
442+ of_node_put(np);
441443 kfree(priv);
442444 }
443445 }
drivers/irqchip/irq-crossbar.c+5−4
@@ -198,7 +198,8 @@ static const struct irq_domain_ops crossbar_domain_ops = { · 197 unmodified lines
198198
199199 static int __init crossbar_of_init(struct device_node *node)
200200 {
201− int i, size, max = 0, reserved = 0, entry;
201+ u32 max = 0, entry, reg_size;
202+ int i, size, reserved = 0;
202203 const __be32 *irqsr;
203204 int ret = -ENOMEM;
204205
@@ -275,9 +276,9 @@ static int __init crossbar_of_init(struct device_node *node) · 70 unmodified lines
275276 if (!cb->register_offsets)
276277 goto err_irq_map;
277278
278− of_property_read_u32(node, "ti,reg-size", &size);
279+ of_property_read_u32(node, "ti,reg-size", &reg_size);
279280
280− switch (size) {
281+ switch (reg_size) {
281282 case 1:
282283 cb->write = crossbar_writeb;
283284 break;
@@ -303,7 +304,7 @@ static int __init crossbar_of_init(struct device_node *node) · 19 unmodified lines
303304 continue;
304305
305306 cb->register_offsets[i] = reserved;
306− reserved += size;
307+ reserved += reg_size;
307308 }
308309
309310 of_property_read_u32(node, "ti,irqs-safe-map", &cb->safe_map);
drivers/irqchip/irq-gic-v3-its.c+16−0
@@ -1601,6 +1601,14 @@ static void __maybe_unused its_enable_quirk_cavium_23144(void *data) · 1600 unmodified lines
16011601 its->flags |= ITS_FLAGS_WORKAROUND_CAVIUM_23144;
16021602 }
16031603
1604+static void __maybe_unused its_enable_quirk_qdf2400_e0065(void *data)
1605+{
1606+ struct its_node *its = data;
1607+
1608+ /* On QDF2400, the size of the ITE is 16Bytes */
1609+ its->ite_size = 16;
1610+}
1611+
16041612 static const struct gic_quirk its_quirks[] = {
16051613 #ifdef CONFIG_CAVIUM_ERRATUM_22375
16061614 {
@@ -1617,6 +1625,14 @@ static const struct gic_quirk its_quirks[] = { · 10 unmodified lines
16171625 .mask = 0xffff0fff,
16181626 .init = its_enable_quirk_cavium_23144,
16191627 },
1628+#endif
1629+#ifdef CONFIG_QCOM_QDF2400_ERRATUM_0065
1630+ {
1631+ .desc = "ITS: QDF2400 erratum 0065",
1632+ .iidr = 0x00001070, /* QDF2400 ITS rev 1.x */
1633+ .mask = 0xffffffff,
1634+ .init = its_enable_quirk_qdf2400_e0065,
1635+ },
16201636 #endif
16211637 {
16221638 }
drivers/isdn/gigaset/bas-gigaset.c+3−0
@@ -2317,6 +2317,9 @@ static int gigaset_probe(struct usb_interface *interface, · 2316 unmodified lines
23172317 return -ENODEV;
23182318 }
23192319
2320+ if (hostif->desc.bNumEndpoints < 1)
2321+ return -ENODEV;
2322+
23202323 dev_info(&udev->dev,
23212324 "%s: Device matched (Vendor: 0x%x, Product: 0x%x)\n",
23222325 __func__, le16_to_cpu(udev->descriptor.idVendor),
drivers/isdn/hisax/st5481_b.c+1−1
@@ -239,7 +239,7 @@ static void st5481B_mode(struct st5481_bcs *bcs, int mode) · 238 unmodified lines
239239 }
240240 }
241241 } else {
242− // Disble B channel interrupts
242+ // Disable B channel interrupts
243243 st5481_usb_device_ctrl_msg(adapter, FFMSK_B1+(bcs->channel * 2), 0, NULL, NULL);
244244
245245 // Disable B channel FIFOs
drivers/macintosh/macio_asic.c+1−0
@@ -392,6 +392,7 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip, · 391 unmodified lines
392392 * To get all the fields, copy all archdata
393393 */
394394 dev->ofdev.dev.archdata = chip->lbus.pdev->dev.archdata;
395+ dev->ofdev.dev.dma_ops = chip->lbus.pdev->dev.dma_ops;
395396 #endif /* CONFIG_PCI */
396397
397398 #ifdef DEBUG
drivers/md/bcache/util.h+0−1
@@ -4,7 +4,6 @@ · 3 unmodified lines
44
55 #include <linux/blkdev.h>
66 #include <linux/errno.h>
7−#include <linux/blkdev.h>
87 #include <linux/kernel.h>
98 #include <linux/sched/clock.h>
109 #include <linux/llist.h>
drivers/md/dm.c+16−13
@@ -989,26 +989,29 @@ static void flush_current_bio_list(struct blk_plug_cb *cb, bool from_schedule) · 988 unmodified lines
989989 struct dm_offload *o = container_of(cb, struct dm_offload, cb);
990990 struct bio_list list;
991991 struct bio *bio;
992+ int i;
992993
993994 INIT_LIST_HEAD(&o->cb.list);
994995
995996 if (unlikely(!current->bio_list))
996997 return;
997998
998− list = *current->bio_list;
999− bio_list_init(current->bio_list);
1000−
1001− while ((bio = bio_list_pop(&list))) {
1002− struct bio_set *bs = bio->bi_pool;
1003− if (unlikely(!bs) || bs == fs_bio_set) {
1004− bio_list_add(current->bio_list, bio);
1005− continue;
999+ for (i = 0; i < 2; i++) {
1000+ list = current->bio_list[i];
1001+ bio_list_init(&current->bio_list[i]);
1002+
1003+ while ((bio = bio_list_pop(&list))) {
1004+ struct bio_set *bs = bio->bi_pool;
1005+ if (unlikely(!bs) || bs == fs_bio_set) {
1006+ bio_list_add(&current->bio_list[i], bio);
1007+ continue;
1008+ }
1009+
1010+ spin_lock(&bs->rescue_lock);
1011+ bio_list_add(&bs->rescue_list, bio);
1012+ queue_work(bs->rescue_workqueue, &bs->rescue_work);
1013+ spin_unlock(&bs->rescue_lock);
10061014 }
1007−
1008− spin_lock(&bs->rescue_lock);
1009− bio_list_add(&bs->rescue_list, bio);
1010− queue_work(bs->rescue_workqueue, &bs->rescue_work);
1011− spin_unlock(&bs->rescue_lock);
10121015 }
10131016 }
10141017
drivers/md/raid10.c+2−1
@@ -974,7 +974,8 @@ static void wait_barrier(struct r10conf *conf) · 973 unmodified lines
974974 !conf->barrier ||
975975 (atomic_read(&conf->nr_pending) &&
976976 current->bio_list &&
977− !bio_list_empty(current->bio_list)),
977+ (!bio_list_empty(&current->bio_list[0]) ||
978+ !bio_list_empty(&current->bio_list[1]))),
978979 conf->resync_lock);
979980 conf->nr_waiting--;
980981 if (!conf->nr_waiting)
drivers/media/dvb-frontends/drx39xyj/drx_driver.h+3−5
@@ -256,8 +256,7 @@ int drxbsp_tuner_default_i2c_write_read(struct tuner_instance *tuner, · 255 unmodified lines
256256 *
257257 * The actual DAP implementation may be restricted to only one of the modes.
258258 * A compiler warning or error will be generated if the DAP implementation
259−* overides or cannot handle the mode defined below.
260−*
259+* overrides or cannot handle the mode defined below.
261260 */
262261 #ifndef DRXDAP_SINGLE_MASTER
263262 #define DRXDAP_SINGLE_MASTER 1
@@ -272,7 +271,7 @@ int drxbsp_tuner_default_i2c_write_read(struct tuner_instance *tuner, · 8 unmodified lines
272271 *
273272 * This maximum size may be restricted by the actual DAP implementation.
274273 * A compiler warning or error will be generated if the DAP implementation
275−* overides or cannot handle the chunksize defined below.
274+* overrides or cannot handle the chunksize defined below.
276275 *
277276 * Beware that the DAP uses DRXDAP_MAX_WCHUNKSIZE to create a temporary data
278277 * buffer. Do not undefine or choose too large, unless your system is able to
@@ -292,8 +291,7 @@ int drxbsp_tuner_default_i2c_write_read(struct tuner_instance *tuner, · 13 unmodified lines
292291 *
293292 * This maximum size may be restricted by the actual DAP implementation.
294293 * A compiler warning or error will be generated if the DAP implementation
295−* overides or cannot handle the chunksize defined below.
296−*
294+* overrides or cannot handle the chunksize defined below.
297295 */
298296 #ifndef DRXDAP_MAX_RCHUNKSIZE
299297 #define DRXDAP_MAX_RCHUNKSIZE 60
drivers/media/platform/vsp1/vsp1_drm.c+16−17
@@ -54,12 +54,11 @@ EXPORT_SYMBOL_GPL(vsp1_du_init); · 53 unmodified lines
5454 /**
5555 * vsp1_du_setup_lif - Setup the output part of the VSP pipeline
5656 * @dev: the VSP device
57− * @width: output frame width in pixels
58− * @height: output frame height in pixels
57+ * @cfg: the LIF configuration
5958 *
60− * Configure the output part of VSP DRM pipeline for the given frame @width and
61− * @height. This sets up formats on the BRU source pad, the WPF0 sink and source
62− * pads, and the LIF sink pad.
59+ * Configure the output part of VSP DRM pipeline for the given frame @cfg.width
60+ * and @cfg.height. This sets up formats on the BRU source pad, the WPF0 sink
61+ * and source pads, and the LIF sink pad.
6362 *
6463 * As the media bus code on the BRU source pad is conditioned by the
6564 * configuration of the BRU sink 0 pad, we also set up the formats on all BRU
@@ -69,8 +68,7 @@ EXPORT_SYMBOL_GPL(vsp1_du_init); · 3 unmodified lines
6968 *
7069 * Return 0 on success or a negative error code on failure.
7170 */
72−int vsp1_du_setup_lif(struct device *dev, unsigned int width,
73− unsigned int height)
71+int vsp1_du_setup_lif(struct device *dev, const struct vsp1_du_lif_config *cfg)
7472 {
7573 struct vsp1_device *vsp1 = dev_get_drvdata(dev);
7674 struct vsp1_pipeline *pipe = &vsp1->drm->pipe;
@@ -79,11 +77,8 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width, · 2 unmodified lines
7977 unsigned int i;
8078 int ret;
8179
82− dev_dbg(vsp1->dev, "%s: configuring LIF with format %ux%u\n",
83− __func__, width, height);
84−
85− if (width == 0 || height == 0) {
86− /* Zero width or height means the CRTC is being disabled, stop
80+ if (!cfg) {
81+ /* NULL configuration means the CRTC is being disabled, stop
8782 * the pipeline and turn the light off.
8883 */
8984 ret = vsp1_pipeline_stop(pipe);
@@ -108,6 +103,9 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width, · 18 unmodified lines
108103 return 0;
109104 }
110105
106+ dev_dbg(vsp1->dev, "%s: configuring LIF with format %ux%u\n",
107+ __func__, cfg->width, cfg->height);
108+
111109 /* Configure the format at the BRU sinks and propagate it through the
112110 * pipeline.
113111 */
@@ -117,8 +115,8 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width, · 3 unmodified lines
117115 for (i = 0; i < bru->entity.source_pad; ++i) {
118116 format.pad = i;
119117
120− format.format.width = width;
121− format.format.height = height;
118+ format.format.width = cfg->width;
119+ format.format.height = cfg->height;
122120 format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32;
123121 format.format.field = V4L2_FIELD_NONE;
124122
@@ -133,8 +131,8 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width, · 8 unmodified lines
133131 }
134132
135133 format.pad = bru->entity.source_pad;
136− format.format.width = width;
137− format.format.height = height;
134+ format.format.width = cfg->width;
135+ format.format.height = cfg->height;
138136 format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32;
139137 format.format.field = V4L2_FIELD_NONE;
140138
@@ -180,7 +178,8 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width, · 39 unmodified lines
180178 /* Verify that the format at the output of the pipeline matches the
181179 * requested frame size and media bus code.
182180 */
183− if (format.format.width != width || format.format.height != height ||
181+ if (format.format.width != cfg->width ||
182+ format.format.height != cfg->height ||
184183 format.format.code != MEDIA_BUS_FMT_ARGB8888_1X32) {
185184 dev_dbg(vsp1->dev, "%s: format mismatch\n", __func__);
186185 return -EPIPE;
drivers/media/rc/lirc_dev.c+2−2
@@ -436,6 +436,8 @@ int lirc_dev_fop_open(struct inode *inode, struct file *file) · 435 unmodified lines
436436 return -ERESTARTSYS;
437437
438438 ir = irctls[iminor(inode)];
439+ mutex_unlock(&lirc_dev_lock);
440+
439441 if (!ir) {
440442 retval = -ENODEV;
441443 goto error;
@@ -476,8 +478,6 @@ int lirc_dev_fop_open(struct inode *inode, struct file *file) · 34 unmodified lines
476478 }
477479
478480 error:
479− mutex_unlock(&lirc_dev_lock);
480−
481481 nonseekable_open(inode, file);
482482
483483 return retval;
drivers/media/rc/nuvoton-cir.c+3−2
@@ -176,12 +176,13 @@ static void nvt_write_wakeup_codes(struct rc_dev *dev, · 175 unmodified lines
176176 {
177177 u8 tolerance, config;
178178 struct nvt_dev *nvt = dev->priv;
179+ unsigned long flags;
179180 int i;
180181
181182 /* hardcode the tolerance to 10% */
182183 tolerance = DIV_ROUND_UP(count, 10);
183184
184− spin_lock(&nvt->lock);
185+ spin_lock_irqsave(&nvt->lock, flags);
185186
186187 nvt_clear_cir_wake_fifo(nvt);
187188 nvt_cir_wake_reg_write(nvt, count, CIR_WAKE_FIFO_CMP_DEEP);
@@ -203,7 +204,7 @@ static void nvt_write_wakeup_codes(struct rc_dev *dev, · 15 unmodified lines
203204
204205 nvt_cir_wake_reg_write(nvt, config, CIR_WAKE_IRCON);
205206
206− spin_unlock(&nvt->lock);
207+ spin_unlock_irqrestore(&nvt->lock, flags);
207208 }
208209
209210 static ssize_t wakeup_data_show(struct device *dev,
drivers/media/rc/rc-main.c+15−11
@@ -1663,6 +1663,7 @@ static int rc_setup_rx_device(struct rc_dev *dev) · 1662 unmodified lines
16631663 {
16641664 int rc;
16651665 struct rc_map *rc_map;
1666+ u64 rc_type;
16661667
16671668 if (!dev->map_name)
16681669 return -EINVAL;
@@ -1677,15 +1678,18 @@ static int rc_setup_rx_device(struct rc_dev *dev) · 8 unmodified lines
16771678 if (rc)
16781679 return rc;
16791680
1680− if (dev->change_protocol) {
1681− u64 rc_type = (1ll << rc_map->rc_type);
1681+ rc_type = BIT_ULL(rc_map->rc_type);
16821682
1683+ if (dev->change_protocol) {
16831684 rc = dev->change_protocol(dev, &rc_type);
16841685 if (rc < 0)
16851686 goto out_table;
16861687 dev->enabled_protocols = rc_type;
16871688 }
16881689
1690+ if (dev->driver_type == RC_DRIVER_IR_RAW)
1691+ ir_raw_load_modules(&rc_type);
1692+
16891693 set_bit(EV_KEY, dev->input_dev->evbit);
16901694 set_bit(EV_REP, dev->input_dev->evbit);
16911695 set_bit(EV_MSC, dev->input_dev->evbit);
@@ -1777,12 +1781,6 @@ int rc_register_device(struct rc_dev *dev) · 85 unmodified lines
17771781 dev->input_name ?: "Unspecified device", path ?: "N/A");
17781782 kfree(path);
17791783
1780− if (dev->driver_type != RC_DRIVER_IR_RAW_TX) {
1781− rc = rc_setup_rx_device(dev);
1782− if (rc)
1783− goto out_dev;
1784− }
1785−
17861784 if (dev->driver_type == RC_DRIVER_IR_RAW ||
17871785 dev->driver_type == RC_DRIVER_IR_RAW_TX) {
17881786 if (!raw_init) {
@@ -1791,7 +1789,13 @@ int rc_register_device(struct rc_dev *dev) · 2 unmodified lines
17911789 }
17921790 rc = ir_raw_event_register(dev);
17931791 if (rc < 0)
1794− goto out_rx;
1792+ goto out_dev;
1793+ }
1794+
1795+ if (dev->driver_type != RC_DRIVER_IR_RAW_TX) {
1796+ rc = rc_setup_rx_device(dev);
1797+ if (rc)
1798+ goto out_raw;
17951799 }
17961800
17971801 /* Allow the RC sysfs nodes to be accessible */
@@ -1803,8 +1807,8 @@ int rc_register_device(struct rc_dev *dev) · 5 unmodified lines
18031807
18041808 return 0;
18051809
1806−out_rx:
1807− rc_free_rx_device(dev);
1810+out_raw:
1811+ ir_raw_event_unregister(dev);
18081812 out_dev:
18091813 device_del(&dev->dev);
18101814 out_unlock:
drivers/media/rc/serial_ir.c+62−61
@@ -487,10 +487,69 @@ static void serial_ir_timeout(unsigned long arg) · 486 unmodified lines
487487 ir_raw_event_handle(serial_ir.rcdev);
488488 }
489489
490+/* Needed by serial_ir_probe() */
491+static int serial_ir_tx(struct rc_dev *dev, unsigned int *txbuf,
492+ unsigned int count);
493+static int serial_ir_tx_duty_cycle(struct rc_dev *dev, u32 cycle);
494+static int serial_ir_tx_carrier(struct rc_dev *dev, u32 carrier);
495+static int serial_ir_open(struct rc_dev *rcdev);
496+static void serial_ir_close(struct rc_dev *rcdev);
497+
490498 static int serial_ir_probe(struct platform_device *dev)
491499 {
500+ struct rc_dev *rcdev;
492501 int i, nlow, nhigh, result;
493502
503+ rcdev = devm_rc_allocate_device(&dev->dev, RC_DRIVER_IR_RAW);
504+ if (!rcdev)
505+ return -ENOMEM;
506+
507+ if (hardware[type].send_pulse && hardware[type].send_space)
508+ rcdev->tx_ir = serial_ir_tx;
509+ if (hardware[type].set_send_carrier)
510+ rcdev->s_tx_carrier = serial_ir_tx_carrier;
511+ if (hardware[type].set_duty_cycle)
512+ rcdev->s_tx_duty_cycle = serial_ir_tx_duty_cycle;
513+
514+ switch (type) {
515+ case IR_HOMEBREW:
516+ rcdev->input_name = "Serial IR type home-brew";
517+ break;
518+ case IR_IRDEO:
519+ rcdev->input_name = "Serial IR type IRdeo";
520+ break;
521+ case IR_IRDEO_REMOTE:
522+ rcdev->input_name = "Serial IR type IRdeo remote";
523+ break;
524+ case IR_ANIMAX:
525+ rcdev->input_name = "Serial IR type AnimaX";
526+ break;
527+ case IR_IGOR:
528+ rcdev->input_name = "Serial IR type IgorPlug";
529+ break;
530+ }
531+
532+ rcdev->input_phys = KBUILD_MODNAME "/input0";
533+ rcdev->input_id.bustype = BUS_HOST;
534+ rcdev->input_id.vendor = 0x0001;
535+ rcdev->input_id.product = 0x0001;
536+ rcdev->input_id.version = 0x0100;
537+ rcdev->open = serial_ir_open;
538+ rcdev->close = serial_ir_close;
539+ rcdev->dev.parent = &serial_ir.pdev->dev;
540+ rcdev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
541+ rcdev->driver_name = KBUILD_MODNAME;
542+ rcdev->map_name = RC_MAP_RC6_MCE;
543+ rcdev->min_timeout = 1;
544+ rcdev->timeout = IR_DEFAULT_TIMEOUT;
545+ rcdev->max_timeout = 10 * IR_DEFAULT_TIMEOUT;
546+ rcdev->rx_resolution = 250000;
547+
548+ serial_ir.rcdev = rcdev;
549+
550+ setup_timer(&serial_ir.timeout_timer, serial_ir_timeout,
551+ (unsigned long)&serial_ir);
552+
494553 result = devm_request_irq(&dev->dev, irq, serial_ir_irq_handler,
495554 share_irq ? IRQF_SHARED : 0,
496555 KBUILD_MODNAME, &hardware);
@@ -516,9 +575,6 @@ static int serial_ir_probe(struct platform_device *dev) · 19 unmodified lines
516575 return -EBUSY;
517576 }
518577
519− setup_timer(&serial_ir.timeout_timer, serial_ir_timeout,
520− (unsigned long)&serial_ir);
521−
522578 result = hardware_init_port();
523579 if (result < 0)
524580 return result;
@@ -552,7 +608,8 @@ static int serial_ir_probe(struct platform_device *dev) · 27 unmodified lines
552608 sense ? "low" : "high");
553609
554610 dev_dbg(&dev->dev, "Interrupt %d, port %04x obtained\n", irq, io);
555− return 0;
611+
612+ return devm_rc_register_device(&dev->dev, rcdev);
556613 }
557614
558615 static int serial_ir_open(struct rc_dev *rcdev)
@@ -723,7 +780,6 @@ static void serial_ir_exit(void) · 164 unmodified lines
723780
724781 static int __init serial_ir_init_module(void)
725782 {
726− struct rc_dev *rcdev;
727783 int result;
728784
729785 switch (type) {
@@ -754,63 +810,9 @@ static int __init serial_ir_init_module(void) · 24 unmodified lines
754810 sense = !!sense;
755811
756812 result = serial_ir_init();
757− if (result)
758− return result;
759−
760− rcdev = devm_rc_allocate_device(&serial_ir.pdev->dev, RC_DRIVER_IR_RAW);
761− if (!rcdev) {
762− result = -ENOMEM;
763− goto serial_cleanup;
764− }
765−
766− if (hardware[type].send_pulse && hardware[type].send_space)
767− rcdev->tx_ir = serial_ir_tx;
768− if (hardware[type].set_send_carrier)
769− rcdev->s_tx_carrier = serial_ir_tx_carrier;
770− if (hardware[type].set_duty_cycle)
771− rcdev->s_tx_duty_cycle = serial_ir_tx_duty_cycle;
772−
773− switch (type) {
774− case IR_HOMEBREW:
775− rcdev->input_name = "Serial IR type home-brew";
776− break;
777− case IR_IRDEO:
778− rcdev->input_name = "Serial IR type IRdeo";
779− break;
780− case IR_IRDEO_REMOTE:
781− rcdev->input_name = "Serial IR type IRdeo remote";
782− break;
783− case IR_ANIMAX:
784− rcdev->input_name = "Serial IR type AnimaX";
785− break;
786− case IR_IGOR:
787− rcdev->input_name = "Serial IR type IgorPlug";
788− break;
789− }
790−
791− rcdev->input_phys = KBUILD_MODNAME "/input0";
792− rcdev->input_id.bustype = BUS_HOST;
793− rcdev->input_id.vendor = 0x0001;
794− rcdev->input_id.product = 0x0001;
795− rcdev->input_id.version = 0x0100;
796− rcdev->open = serial_ir_open;
797− rcdev->close = serial_ir_close;
798− rcdev->dev.parent = &serial_ir.pdev->dev;
799− rcdev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
800− rcdev->driver_name = KBUILD_MODNAME;
801− rcdev->map_name = RC_MAP_RC6_MCE;
802− rcdev->min_timeout = 1;
803− rcdev->timeout = IR_DEFAULT_TIMEOUT;
804− rcdev->max_timeout = 10 * IR_DEFAULT_TIMEOUT;
805− rcdev->rx_resolution = 250000;
806−
807− serial_ir.rcdev = rcdev;
808−
809− result = rc_register_device(rcdev);
810−
811813 if (!result)
812814 return 0;
813−serial_cleanup:
815+
814816 serial_ir_exit();
815817 return result;
816818 }
@@ -818,7 +820,6 @@ serial_cleanup: · 1 unmodified line
818820 static void __exit serial_ir_exit_module(void)
819821 {
820822 del_timer_sync(&serial_ir.timeout_timer);
821− rc_unregister_device(serial_ir.rcdev);
822823 serial_ir_exit();
823824 }
824825
drivers/media/usb/dvb-usb/dw2102.c+145−99
@@ -68,6 +68,7 @@ · 67 unmodified lines
6868 struct dw2102_state {
6969 u8 initialized;
7070 u8 last_lock;
71+ u8 data[MAX_XFER_SIZE + 4];
7172 struct i2c_client *i2c_client_demod;
7273 struct i2c_client *i2c_client_tuner;
7374
@@ -661,62 +662,72 @@ static int su3000_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], · 587 unmodified lines
661662 int num)
662663 {
663664 struct dvb_usb_device *d = i2c_get_adapdata(adap);
664− u8 obuf[0x40], ibuf[0x40];
665+ struct dw2102_state *state;
665666
666667 if (!d)
667668 return -ENODEV;
669+
670+ state = d->priv;
671+
668672 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
669673 return -EAGAIN;
674+ if (mutex_lock_interruptible(&d->data_mutex) < 0) {
675+ mutex_unlock(&d->i2c_mutex);
676+ return -EAGAIN;
677+ }
670678
671679 switch (num) {
672680 case 1:
673681 switch (msg[0].addr) {
674682 case SU3000_STREAM_CTRL:
675− obuf[0] = msg[0].buf[0] + 0x36;
676− obuf[1] = 3;
677− obuf[2] = 0;
678− if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 0, 0) < 0)
683+ state->data[0] = msg[0].buf[0] + 0x36;
684+ state->data[1] = 3;
685+ state->data[2] = 0;
686+ if (dvb_usb_generic_rw(d, state->data, 3,
687+ state->data, 0, 0) < 0)
679688 err("i2c transfer failed.");
680689 break;
681690 case DW2102_RC_QUERY:
682− obuf[0] = 0x10;
683− if (dvb_usb_generic_rw(d, obuf, 1, ibuf, 2, 0) < 0)
691+ state->data[0] = 0x10;
692+ if (dvb_usb_generic_rw(d, state->data, 1,
693+ state->data, 2, 0) < 0)
684694 err("i2c transfer failed.");
685− msg[0].buf[1] = ibuf[0];
686− msg[0].buf[0] = ibuf[1];
695+ msg[0].buf[1] = state->data[0];
696+ msg[0].buf[0] = state->data[1];
687697 break;
688698 default:
689699 /* always i2c write*/
690− obuf[0] = 0x08;
691− obuf[1] = msg[0].addr;
692− obuf[2] = msg[0].len;
700+ state->data[0] = 0x08;
701+ state->data[1] = msg[0].addr;
702+ state->data[2] = msg[0].len;
693703
694− memcpy(&obuf[3], msg[0].buf, msg[0].len);
704+ memcpy(&state->data[3], msg[0].buf, msg[0].len);
695705
696− if (dvb_usb_generic_rw(d, obuf, msg[0].len + 3,
697− ibuf, 1, 0) < 0)
706+ if (dvb_usb_generic_rw(d, state->data, msg[0].len + 3,
707+ state->data, 1, 0) < 0)
698708 err("i2c transfer failed.");
699709
700710 }
701711 break;
702712 case 2:
703713 /* always i2c read */
704− obuf[0] = 0x09;
705− obuf[1] = msg[0].len;
706− obuf[2] = msg[1].len;
707− obuf[3] = msg[0].addr;
708− memcpy(&obuf[4], msg[0].buf, msg[0].len);
709−
710− if (dvb_usb_generic_rw(d, obuf, msg[0].len + 4,
711− ibuf, msg[1].len + 1, 0) < 0)
714+ state->data[0] = 0x09;
715+ state->data[1] = msg[0].len;
716+ state->data[2] = msg[1].len;
717+ state->data[3] = msg[0].addr;
718+ memcpy(&state->data[4], msg[0].buf, msg[0].len);
719+
720+ if (dvb_usb_generic_rw(d, state->data, msg[0].len + 4,
721+ state->data, msg[1].len + 1, 0) < 0)
712722 err("i2c transfer failed.");
713723
714− memcpy(msg[1].buf, &ibuf[1], msg[1].len);
724+ memcpy(msg[1].buf, &state->data[1], msg[1].len);
715725 break;
716726 default:
717727 warn("more than 2 i2c messages at a time is not handled yet.");
718728 break;
719729 }
730+ mutex_unlock(&d->data_mutex);
720731 mutex_unlock(&d->i2c_mutex);
721732 return num;
722733 }
@@ -844,17 +855,23 @@ static int su3000_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) · 121 unmodified lines
844855 static int su3000_power_ctrl(struct dvb_usb_device *d, int i)
845856 {
846857 struct dw2102_state *state = (struct dw2102_state *)d->priv;
847− u8 obuf[] = {0xde, 0};
858+ int ret = 0;
848859
849860 info("%s: %d, initialized %d", __func__, i, state->initialized);
850861
851862 if (i && !state->initialized) {
863+ mutex_lock(&d->data_mutex);
864+
865+ state->data[0] = 0xde;
866+ state->data[1] = 0;
867+
852868 state->initialized = 1;
853869 /* reset board */
854− return dvb_usb_generic_rw(d, obuf, 2, NULL, 0, 0);
870+ ret = dvb_usb_generic_rw(d, state->data, 2, NULL, 0, 0);
871+ mutex_unlock(&d->data_mutex);
855872 }
856873
857− return 0;
874+ return ret;
858875 }
859876
860877 static int su3000_read_mac_address(struct dvb_usb_device *d, u8 mac[6])
@@ -1309,49 +1326,57 @@ static int prof_7500_frontend_attach(struct dvb_usb_adapter *d) · 448 unmodified lines
13091326 return 0;
13101327 }
13111328
1312−static int su3000_frontend_attach(struct dvb_usb_adapter *d)
1329+static int su3000_frontend_attach(struct dvb_usb_adapter *adap)
13131330 {
1314− u8 obuf[3] = { 0xe, 0x80, 0 };
1315− u8 ibuf[] = { 0 };
1331+ struct dvb_usb_device *d = adap->dev;
1332+ struct dw2102_state *state = d->priv;
1333+
1334+ mutex_lock(&d->data_mutex);
1335+
1336+ state->data[0] = 0xe;
1337+ state->data[1] = 0x80;
1338+ state->data[2] = 0;
13161339
1317− if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
1340+ if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
13181341 err("command 0x0e transfer failed.");
13191342
1320− obuf[0] = 0xe;
1321− obuf[1] = 0x02;
1322− obuf[2] = 1;
1343+ state->data[0] = 0xe;
1344+ state->data[1] = 0x02;
1345+ state->data[2] = 1;
13231346
1324− if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
1347+ if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
13251348 err("command 0x0e transfer failed.");
13261349 msleep(300);
13271350
1328− obuf[0] = 0xe;
1329− obuf[1] = 0x83;
1330− obuf[2] = 0;
1351+ state->data[0] = 0xe;
1352+ state->data[1] = 0x83;
1353+ state->data[2] = 0;
13311354
1332− if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
1355+ if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
13331356 err("command 0x0e transfer failed.");
13341357
1335− obuf[0] = 0xe;
1336− obuf[1] = 0x83;
1337− obuf[2] = 1;
1358+ state->data[0] = 0xe;
1359+ state->data[1] = 0x83;
1360+ state->data[2] = 1;
13381361
1339− if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
1362+ if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
13401363 err("command 0x0e transfer failed.");
13411364
1342− obuf[0] = 0x51;
1365+ state->data[0] = 0x51;
13431366
1344− if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0)
1367+ if (dvb_usb_generic_rw(d, state->data, 1, state->data, 1, 0) < 0)
13451368 err("command 0x51 transfer failed.");
13461369
1347− d->fe_adap[0].fe = dvb_attach(ds3000_attach, &su3000_ds3000_config,
1348− &d->dev->i2c_adap);
1349− if (d->fe_adap[0].fe == NULL)
1370+ mutex_unlock(&d->data_mutex);
1371+
1372+ adap->fe_adap[0].fe = dvb_attach(ds3000_attach, &su3000_ds3000_config,
1373+ &d->i2c_adap);
1374+ if (adap->fe_adap[0].fe == NULL)
13501375 return -EIO;
13511376
1352− if (dvb_attach(ts2020_attach, d->fe_adap[0].fe,
1377+ if (dvb_attach(ts2020_attach, adap->fe_adap[0].fe,
13531378 &dw2104_ts2020_config,
1354− &d->dev->i2c_adap)) {
1379+ &d->i2c_adap)) {
13551380 info("Attached DS3000/TS2020!");
13561381 return 0;
13571382 }
@@ -1360,47 +1385,55 @@ static int su3000_frontend_attach(struct dvb_usb_adapter *d) · 2 unmodified lines
13601385 return -EIO;
13611386 }
13621387
1363−static int t220_frontend_attach(struct dvb_usb_adapter *d)
1388+static int t220_frontend_attach(struct dvb_usb_adapter *adap)
13641389 {
1365− u8 obuf[3] = { 0xe, 0x87, 0 };
1366− u8 ibuf[] = { 0 };
1390+ struct dvb_usb_device *d = adap->dev;
1391+ struct dw2102_state *state = d->priv;
1392+
1393+ mutex_lock(&d->data_mutex);
13671394
1368− if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
1395+ state->data[0] = 0xe;
1396+ state->data[1] = 0x87;
1397+ state->data[2] = 0x0;
1398+
1399+ if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
13691400 err("command 0x0e transfer failed.");
13701401
1371− obuf[0] = 0xe;
1372− obuf[1] = 0x86;
1373− obuf[2] = 1;
1402+ state->data[0] = 0xe;
1403+ state->data[1] = 0x86;
1404+ state->data[2] = 1;
13741405
1375− if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
1406+ if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
13761407 err("command 0x0e transfer failed.");
13771408
1378− obuf[0] = 0xe;
1379− obuf[1] = 0x80;
1380− obuf[2] = 0;
1409+ state->data[0] = 0xe;
1410+ state->data[1] = 0x80;
1411+ state->data[2] = 0;
13811412
1382− if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
1413+ if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
13831414 err("command 0x0e transfer failed.");
13841415
13851416 msleep(50);
13861417
1387− obuf[0] = 0xe;
1388− obuf[1] = 0x80;
1389− obuf[2] = 1;
1418+ state->data[0] = 0xe;
1419+ state->data[1] = 0x80;
1420+ state->data[2] = 1;
13901421
1391− if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
1422+ if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
13921423 err("command 0x0e transfer failed.");
13931424
1394− obuf[0] = 0x51;
1425+ state->data[0] = 0x51;
13951426
1396− if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0)
1427+ if (dvb_usb_generic_rw(d, state->data, 1, state->data, 1, 0) < 0)
13971428 err("command 0x51 transfer failed.");
13981429
1399− d->fe_adap[0].fe = dvb_attach(cxd2820r_attach, &cxd2820r_config,
1400− &d->dev->i2c_adap, NULL);
1401− if (d->fe_adap[0].fe != NULL) {
1402− if (dvb_attach(tda18271_attach, d->fe_adap[0].fe, 0x60,
1403− &d->dev->i2c_adap, &tda18271_config)) {
1430+ mutex_unlock(&d->data_mutex);
1431+
1432+ adap->fe_adap[0].fe = dvb_attach(cxd2820r_attach, &cxd2820r_config,
1433+ &d->i2c_adap, NULL);
1434+ if (adap->fe_adap[0].fe != NULL) {
1435+ if (dvb_attach(tda18271_attach, adap->fe_adap[0].fe, 0x60,
1436+ &d->i2c_adap, &tda18271_config)) {
14041437 info("Attached TDA18271HD/CXD2820R!");
14051438 return 0;
14061439 }
@@ -1410,23 +1443,30 @@ static int t220_frontend_attach(struct dvb_usb_adapter *d) · 3 unmodified lines
14101443 return -EIO;
14111444 }
14121445
1413−static int m88rs2000_frontend_attach(struct dvb_usb_adapter *d)
1446+static int m88rs2000_frontend_attach(struct dvb_usb_adapter *adap)
14141447 {
1415− u8 obuf[] = { 0x51 };
1416− u8 ibuf[] = { 0 };
1448+ struct dvb_usb_device *d = adap->dev;
1449+ struct dw2102_state *state = d->priv;
1450+
1451+ mutex_lock(&d->data_mutex);
14171452
1418− if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0)
1453+ state->data[0] = 0x51;
1454+
1455+ if (dvb_usb_generic_rw(d, state->data, 1, state->data, 1, 0) < 0)
14191456 err("command 0x51 transfer failed.");
14201457
1421− d->fe_adap[0].fe = dvb_attach(m88rs2000_attach, &s421_m88rs2000_config,
1422− &d->dev->i2c_adap);
1458+ mutex_unlock(&d->data_mutex);
14231459
1424− if (d->fe_adap[0].fe == NULL)
1460+ adap->fe_adap[0].fe = dvb_attach(m88rs2000_attach,
1461+ &s421_m88rs2000_config,
1462+ &d->i2c_adap);
1463+
1464+ if (adap->fe_adap[0].fe == NULL)
14251465 return -EIO;
14261466
1427− if (dvb_attach(ts2020_attach, d->fe_adap[0].fe,
1467+ if (dvb_attach(ts2020_attach, adap->fe_adap[0].fe,
14281468 &dw2104_ts2020_config,
1429− &d->dev->i2c_adap)) {
1469+ &d->i2c_adap)) {
14301470 info("Attached RS2000/TS2020!");
14311471 return 0;
14321472 }
@@ -1439,44 +1479,50 @@ static int tt_s2_4600_frontend_attach(struct dvb_usb_adapter *adap) · 6 unmodified lines
14391479 {
14401480 struct dvb_usb_device *d = adap->dev;
14411481 struct dw2102_state *state = d->priv;
1442− u8 obuf[3] = { 0xe, 0x80, 0 };
1443− u8 ibuf[] = { 0 };
14441482 struct i2c_adapter *i2c_adapter;
14451483 struct i2c_client *client;
14461484 struct i2c_board_info board_info;
14471485 struct m88ds3103_platform_data m88ds3103_pdata = {};
14481486 struct ts2020_config ts2020_config = {};
14491487
1450− if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 1, 0) < 0)
1488+ mutex_lock(&d->data_mutex);
1489+
1490+ state->data[0] = 0xe;
1491+ state->data[1] = 0x80;
1492+ state->data[2] = 0x0;
1493+
1494+ if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
14511495 err("command 0x0e transfer failed.");
14521496
1453− obuf[0] = 0xe;
1454− obuf[1] = 0x02;
1455− obuf[2] = 1;
1497+ state->data[0] = 0xe;
1498+ state->data[1] = 0x02;
1499+ state->data[2] = 1;
14561500
1457− if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 1, 0) < 0)
1501+ if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
14581502 err("command 0x0e transfer failed.");
14591503 msleep(300);
14601504
1461− obuf[0] = 0xe;
1462− obuf[1] = 0x83;
1463− obuf[2] = 0;
1505+ state->data[0] = 0xe;
1506+ state->data[1] = 0x83;
1507+ state->data[2] = 0;
14641508
1465− if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 1, 0) < 0)
1509+ if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
14661510 err("command 0x0e transfer failed.");
14671511
1468− obuf[0] = 0xe;
1469− obuf[1] = 0x83;
1470− obuf[2] = 1;
1512+ state->data[0] = 0xe;
1513+ state->data[1] = 0x83;
1514+ state->data[2] = 1;
14711515
1472− if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 1, 0) < 0)
1516+ if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
14731517 err("command 0x0e transfer failed.");
14741518
1475− obuf[0] = 0x51;
1519+ state->data[0] = 0x51;
14761520
1477− if (dvb_usb_generic_rw(d, obuf, 1, ibuf, 1, 0) < 0)
1521+ if (dvb_usb_generic_rw(d, state->data, 1, state->data, 1, 0) < 0)
14781522 err("command 0x51 transfer failed.");
14791523
1524+ mutex_unlock(&d->data_mutex);
1525+
14801526 /* attach demod */
14811527 m88ds3103_pdata.clk = 27000000;
14821528 m88ds3103_pdata.i2c_wr_max = 33;
drivers/misc/sgi-gru/grufault.c+7−2
@@ -219,15 +219,20 @@ static int atomic_pte_lookup(struct vm_area_struct *vma, unsigned long vaddr, · 218 unmodified lines
219219 int write, unsigned long *paddr, int *pageshift)
220220 {
221221 pgd_t *pgdp;
222− pmd_t *pmdp;
222+ p4d_t *p4dp;
223223 pud_t *pudp;
224+ pmd_t *pmdp;
224225 pte_t pte;
225226
226227 pgdp = pgd_offset(vma->vm_mm, vaddr);
227228 if (unlikely(pgd_none(*pgdp)))
228229 goto err;
229230
230− pudp = pud_offset(pgdp, vaddr);
231+ p4dp = p4d_offset(pgdp, vaddr);
232+ if (unlikely(p4d_none(*p4dp)))
233+ goto err;
234+
235+ pudp = pud_offset(p4dp, vaddr);
231236 if (unlikely(pud_none(*pudp)))
232237 goto err;
233238
drivers/mtd/spi-nor/spi-nor.c+1−1
@@ -186,7 +186,7 @@ static inline int write_enable(struct spi_nor *nor) · 185 unmodified lines
186186 }
187187
188188 /*
189− * Send write disble instruction to the chip.
189+ * Send write disable instruction to the chip.
190190 */
191191 static inline int write_disable(struct spi_nor *nor)
192192 {
drivers/net/ethernet/amd/xgbe/xgbe-drv.c+2−8
@@ -2272,10 +2272,7 @@ static int xgbe_one_poll(struct napi_struct *napi, int budget) · 2271 unmodified lines
22722272 processed = xgbe_rx_poll(channel, budget);
22732273
22742274 /* If we processed everything, we are done */
2275− if (processed < budget) {
2276− /* Turn off polling */
2277− napi_complete_done(napi, processed);
2278−
2275+ if ((processed < budget) && napi_complete_done(napi, processed)) {
22792276 /* Enable Tx and Rx interrupts */
22802277 if (pdata->channel_irq_mode)
22812278 xgbe_enable_rx_tx_int(pdata, channel);
@@ -2317,10 +2314,7 @@ static int xgbe_all_poll(struct napi_struct *napi, int budget) · 35 unmodified lines
23172314 } while ((processed < budget) && (processed != last_processed));
23182315
23192316 /* If we processed everything, we are done */
2320− if (processed < budget) {
2321− /* Turn off polling */
2322− napi_complete_done(napi, processed);
2323−
2317+ if ((processed < budget) && napi_complete_done(napi, processed)) {
23242318 /* Enable Tx and Rx interrupts */
23252319 xgbe_enable_rx_tx_ints(pdata);
23262320 }
drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c+1−1
@@ -213,9 +213,9 @@ void aq_pci_func_free_irqs(struct aq_pci_func_s *self) · 212 unmodified lines
213213 if (!((1U << i) & self->msix_entry_mask))
214214 continue;
215215
216− free_irq(pci_irq_vector(pdev, i), self->aq_vec[i]);
217216 if (pdev->msix_enabled)
218217 irq_set_affinity_hint(pci_irq_vector(pdev, i), NULL);
218+ free_irq(pci_irq_vector(pdev, i), self->aq_vec[i]);
219219 self->msix_entry_mask &= ~(1U << i);
220220 }
221221 }
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c+30−6
@@ -13292,17 +13292,15 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev, · 13291 unmodified lines
1329213292 dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
1329313293 NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_HIGHDMA;
1329413294
13295− /* VF with OLD Hypervisor or old PF do not support filtering */
1329613295 if (IS_PF(bp)) {
1329713296 if (chip_is_e1x)
1329813297 bp->accept_any_vlan = true;
1329913298 else
1330013299 dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER;
13301−#ifdef CONFIG_BNX2X_SRIOV
13302− } else if (bp->acquire_resp.pfdev_info.pf_cap & PFVF_CAP_VLAN_FILTER) {
13303− dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER;
13304−#endif
1330513300 }
13301+ /* For VF we'll know whether to enable VLAN filtering after
13302+ * getting a response to CHANNEL_TLV_ACQUIRE from PF.
13303+ */
1330613304
1330713305 dev->features |= dev->hw_features | NETIF_F_HW_VLAN_CTAG_RX;
1330813306 dev->features |= NETIF_F_HIGHDMA;
@@ -13738,7 +13736,7 @@ static int bnx2x_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb) · 429 unmodified lines
1373813736 if (!netif_running(bp->dev)) {
1373913737 DP(BNX2X_MSG_PTP,
1374013738 "PTP adjfreq called while the interface is down\n");
13741− return -EFAULT;
13739+ return -ENETDOWN;
1374213740 }
1374313741
1374413742 if (ppb < 0) {
@@ -13797,6 +13795,12 @@ static int bnx2x_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta) · 52 unmodified lines
1379713795 {
1379813796 struct bnx2x *bp = container_of(ptp, struct bnx2x, ptp_clock_info);
1379913797
13798+ if (!netif_running(bp->dev)) {
13799+ DP(BNX2X_MSG_PTP,
13800+ "PTP adjtime called while the interface is down\n");
13801+ return -ENETDOWN;
13802+ }
13803+
1380013804 DP(BNX2X_MSG_PTP, "PTP adjtime called, delta = %llx\n", delta);
1380113805
1380213806 timecounter_adjtime(&bp->timecounter, delta);
@@ -13809,6 +13813,12 @@ static int bnx2x_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) · 6 unmodified lines
1380913813 struct bnx2x *bp = container_of(ptp, struct bnx2x, ptp_clock_info);
1381013814 u64 ns;
1381113815
13816+ if (!netif_running(bp->dev)) {
13817+ DP(BNX2X_MSG_PTP,
13818+ "PTP gettime called while the interface is down\n");
13819+ return -ENETDOWN;
13820+ }
13821+
1381213822 ns = timecounter_read(&bp->timecounter);
1381313823
1381413824 DP(BNX2X_MSG_PTP, "PTP gettime called, ns = %llu\n", ns);
@@ -13824,6 +13834,12 @@ static int bnx2x_ptp_settime(struct ptp_clock_info *ptp, · 9 unmodified lines
1382413834 struct bnx2x *bp = container_of(ptp, struct bnx2x, ptp_clock_info);
1382513835 u64 ns;
1382613836
13837+ if (!netif_running(bp->dev)) {
13838+ DP(BNX2X_MSG_PTP,
13839+ "PTP settime called while the interface is down\n");
13840+ return -ENETDOWN;
13841+ }
13842+
1382713843 ns = timespec64_to_ns(ts);
1382813844
1382913845 DP(BNX2X_MSG_PTP, "PTP settime called, ns = %llu\n", ns);
@@ -13991,6 +14007,14 @@ static int bnx2x_init_one(struct pci_dev *pdev, · 161 unmodified lines
1399114007 rc = bnx2x_vfpf_acquire(bp, tx_count, rx_count);
1399214008 if (rc)
1399314009 goto init_one_freemem;
14010+
14011+#ifdef CONFIG_BNX2X_SRIOV
14012+ /* VF with OLD Hypervisor or old PF do not support filtering */
14013+ if (bp->acquire_resp.pfdev_info.pf_cap & PFVF_CAP_VLAN_FILTER) {
14014+ dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER;
14015+ dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
14016+ }
14017+#endif
1399414018 }
1399514019
1399614020 /* Enable SRIOV if capability found in configuration space */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c+16−8
@@ -434,7 +434,9 @@ static int bnx2x_vf_mac_vlan_config(struct bnx2x *bp, · 433 unmodified lines
434434
435435 /* Add/Remove the filter */
436436 rc = bnx2x_config_vlan_mac(bp, &ramrod);
437− if (rc && rc != -EEXIST) {
437+ if (rc == -EEXIST)
438+ return 0;
439+ if (rc) {
438440 BNX2X_ERR("Failed to %s %s\n",
439441 filter->add ? "add" : "delete",
440442 (filter->type == BNX2X_VF_FILTER_VLAN_MAC) ?
@@ -444,6 +446,8 @@ static int bnx2x_vf_mac_vlan_config(struct bnx2x *bp, · 3 unmodified lines
444446 return rc;
445447 }
446448
449+ filter->applied = true;
450+
447451 return 0;
448452 }
449453
@@ -469,8 +473,10 @@ int bnx2x_vf_mac_vlan_config_list(struct bnx2x *bp, struct bnx2x_virtf *vf, · 19 unmodified lines
469473 /* Rollback if needed */
470474 if (i != filters->count) {
471475 BNX2X_ERR("Managed only %d/%d filters - rolling back\n",
472− i, filters->count + 1);
476+ i, filters->count);
473477 while (--i >= 0) {
478+ if (!filters->filters[i].applied)
479+ continue;
474480 filters->filters[i].add = !filters->filters[i].add;
475481 bnx2x_vf_mac_vlan_config(bp, vf, qid,
476482 &filters->filters[i],
@@ -1899,7 +1905,8 @@ void bnx2x_iov_adjust_stats_req(struct bnx2x *bp) · 1422 unmodified lines
18991905 continue;
19001906 }
19011907
1902− DP(BNX2X_MSG_IOV, "add addresses for vf %d\n", vf->abs_vfid);
1908+ DP_AND((BNX2X_MSG_IOV | BNX2X_MSG_STATS),
1909+ "add addresses for vf %d\n", vf->abs_vfid);
19031910 for_each_vfq(vf, j) {
19041911 struct bnx2x_vf_queue *rxq = vfq_get(vf, j);
19051912
@@ -1920,11 +1927,12 @@ void bnx2x_iov_adjust_stats_req(struct bnx2x *bp) · 14 unmodified lines
19201927 cpu_to_le32(U64_HI(q_stats_addr));
19211928 cur_query_entry->address.lo =
19221929 cpu_to_le32(U64_LO(q_stats_addr));
1923− DP(BNX2X_MSG_IOV,
1924− "added address %x %x for vf %d queue %d client %d\n",
1925− cur_query_entry->address.hi,
1926− cur_query_entry->address.lo, cur_query_entry->funcID,
1927− j, cur_query_entry->index);
1930+ DP_AND((BNX2X_MSG_IOV | BNX2X_MSG_STATS),
1931+ "added address %x %x for vf %d queue %d client %d\n",
1932+ cur_query_entry->address.hi,
1933+ cur_query_entry->address.lo,
1934+ cur_query_entry->funcID,
1935+ j, cur_query_entry->index);
19281936 cur_query_entry++;
19291937 cur_data_offset += sizeof(struct per_queue_stats);
19301938 stats_count++;
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h+1−0
@@ -114,6 +114,7 @@ struct bnx2x_vf_mac_vlan_filter { · 113 unmodified lines
114114 (BNX2X_VF_FILTER_MAC | BNX2X_VF_FILTER_VLAN) /*shortcut*/
115115
116116 bool add;
117+ bool applied;
117118 u8 *mac;
118119 u16 vid;
119120 };
drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c+28−12
@@ -868,7 +868,7 @@ int bnx2x_vfpf_set_mcast(struct net_device *dev) · 867 unmodified lines
868868 struct bnx2x *bp = netdev_priv(dev);
869869 struct vfpf_set_q_filters_tlv *req = &bp->vf2pf_mbox->req.set_q_filters;
870870 struct pfvf_general_resp_tlv *resp = &bp->vf2pf_mbox->resp.general_resp;
871− int rc, i = 0;
871+ int rc = 0, i = 0;
872872 struct netdev_hw_addr *ha;
873873
874874 if (bp->state != BNX2X_STATE_OPEN) {
@@ -883,6 +883,15 @@ int bnx2x_vfpf_set_mcast(struct net_device *dev) · 8 unmodified lines
883883 /* Get Rx mode requested */
884884 DP(NETIF_MSG_IFUP, "dev->flags = %x\n", dev->flags);
885885
886+ /* We support PFVF_MAX_MULTICAST_PER_VF mcast addresses tops */
887+ if (netdev_mc_count(dev) > PFVF_MAX_MULTICAST_PER_VF) {
888+ DP(NETIF_MSG_IFUP,
889+ "VF supports not more than %d multicast MAC addresses\n",
890+ PFVF_MAX_MULTICAST_PER_VF);
891+ rc = -EINVAL;
892+ goto out;
893+ }
894+
886895 netdev_for_each_mc_addr(ha, dev) {
887896 DP(NETIF_MSG_IFUP, "Adding mcast MAC: %pM\n",
888897 bnx2x_mc_addr(ha));
@@ -890,16 +899,6 @@ int bnx2x_vfpf_set_mcast(struct net_device *dev) · 1 unmodified line
890899 i++;
891900 }
892901
893− /* We support four PFVF_MAX_MULTICAST_PER_VF mcast
894− * addresses tops
895− */
896− if (i >= PFVF_MAX_MULTICAST_PER_VF) {
897− DP(NETIF_MSG_IFUP,
898− "VF supports not more than %d multicast MAC addresses\n",
899− PFVF_MAX_MULTICAST_PER_VF);
900− return -EINVAL;
901− }
902−
903902 req->n_multicast = i;
904903 req->flags |= VFPF_SET_Q_FILTERS_MULTICAST_CHANGED;
905904 req->vf_qid = 0;
@@ -924,7 +923,7 @@ int bnx2x_vfpf_set_mcast(struct net_device *dev) · 18 unmodified lines
924923 out:
925924 bnx2x_vfpf_finalize(bp, &req->first_tlv);
926925
927− return 0;
926+ return rc;
928927 }
929928
930929 /* request pf to add a vlan for the vf */
@@ -1778,6 +1777,23 @@ static int bnx2x_vf_mbx_qfilters(struct bnx2x *bp, struct bnx2x_virtf *vf) · 847 unmodified lines
17781777 goto op_err;
17791778 }
17801779
1780+ /* build vlan list */
1781+ fl = NULL;
1782+
1783+ rc = bnx2x_vf_mbx_macvlan_list(bp, vf, msg, &fl,
1784+ VFPF_VLAN_FILTER);
1785+ if (rc)
1786+ goto op_err;
1787+
1788+ if (fl) {
1789+ /* set vlan list */
1790+ rc = bnx2x_vf_mac_vlan_config_list(bp, vf, fl,
1791+ msg->vf_qid,
1792+ false);
1793+ if (rc)
1794+ goto op_err;
1795+ }
1796+
17811797 }
17821798
17831799 if (msg->flags & VFPF_SET_Q_FILTERS_RX_MASK_CHANGED) {
drivers/net/ethernet/broadcom/bnxt/bnxt.c+18−7
@@ -4465,6 +4465,10 @@ static int bnxt_hwrm_func_qcfg(struct bnxt *bp) · 4464 unmodified lines
44654465 vf->vlan = le16_to_cpu(resp->vlan) & VLAN_VID_MASK;
44664466 }
44674467 #endif
4468+ if (BNXT_PF(bp) && (le16_to_cpu(resp->flags) &
4469+ FUNC_QCFG_RESP_FLAGS_FW_DCBX_AGENT_ENABLED))
4470+ bp->flags |= BNXT_FLAG_FW_LLDP_AGENT;
4471+
44684472 switch (resp->port_partition_type) {
44694473 case FUNC_QCFG_RESP_PORT_PARTITION_TYPE_NPAR1_0:
44704474 case FUNC_QCFG_RESP_PORT_PARTITION_TYPE_NPAR1_5:
@@ -5507,8 +5511,9 @@ static int bnxt_hwrm_phy_qcaps(struct bnxt *bp) · 1036 unmodified lines
55075511 bp->lpi_tmr_hi = le32_to_cpu(resp->valid_tx_lpi_timer_high) &
55085512 PORT_PHY_QCAPS_RESP_TX_LPI_TIMER_HIGH_MASK;
55095513 }
5510− link_info->support_auto_speeds =
5511− le16_to_cpu(resp->supported_speeds_auto_mode);
5514+ if (resp->supported_speeds_auto_mode)
5515+ link_info->support_auto_speeds =
5516+ le16_to_cpu(resp->supported_speeds_auto_mode);
55125517
55135518 hwrm_phy_qcaps_exit:
55145519 mutex_unlock(&bp->hwrm_cmd_lock);
@@ -6495,8 +6500,14 @@ static void bnxt_reset_task(struct bnxt *bp, bool silent) · 980 unmodified lines
64956500 if (!silent)
64966501 bnxt_dbg_dump_states(bp);
64976502 if (netif_running(bp->dev)) {
6503+ int rc;
6504+
6505+ if (!silent)
6506+ bnxt_ulp_stop(bp);
64986507 bnxt_close_nic(bp, false, false);
6499− bnxt_open_nic(bp, false, false);
6508+ rc = bnxt_open_nic(bp, false, false);
6509+ if (!silent && !rc)
6510+ bnxt_ulp_start(bp);
65006511 }
65016512 }
65026513
@@ -7444,6 +7455,10 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 941 unmodified lines
74447455 if (rc)
74457456 goto init_err_pci_clean;
74467457
7458+ rc = bnxt_hwrm_func_reset(bp);
7459+ if (rc)
7460+ goto init_err_pci_clean;
7461+
74477462 bnxt_hwrm_fw_set_time(bp);
74487463
74497464 dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG |
@@ -7554,10 +7569,6 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 104 unmodified lines
75547569 if (rc)
75557570 goto init_err_pci_clean;
75567571
7557− rc = bnxt_hwrm_func_reset(bp);
7558− if (rc)
7559− goto init_err_pci_clean;
7560−
75617572 rc = bnxt_init_int_mode(bp);
75627573 if (rc)
75637574 goto init_err_pci_clean;
drivers/net/ethernet/broadcom/bnxt/bnxt.h+1−0
@@ -993,6 +993,7 @@ struct bnxt { · 992 unmodified lines
993993 BNXT_FLAG_ROCEV2_CAP)
994994 #define BNXT_FLAG_NO_AGG_RINGS 0x20000
995995 #define BNXT_FLAG_RX_PAGE_MODE 0x40000
996+ #define BNXT_FLAG_FW_LLDP_AGENT 0x80000
996997 #define BNXT_FLAG_CHIP_NITRO_A0 0x1000000
997998
998999 #define BNXT_FLAG_ALL_CONFIG_FEATS (BNXT_FLAG_TPA | \
drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c+1−1
@@ -474,7 +474,7 @@ void bnxt_dcb_init(struct bnxt *bp) · 473 unmodified lines
474474 return;
475475
476476 bp->dcbx_cap = DCB_CAP_DCBX_VER_IEEE;
477− if (BNXT_PF(bp))
477+ if (BNXT_PF(bp) && !(bp->flags & BNXT_FLAG_FW_LLDP_AGENT))
478478 bp->dcbx_cap |= DCB_CAP_DCBX_HOST;
479479 else
480480 bp->dcbx_cap |= DCB_CAP_DCBX_LLD_MANAGED;
drivers/net/ethernet/broadcom/genet/bcmgenet.c+147−59
@@ -1,7 +1,7 @@
11 /*
22 * Broadcom GENET (Gigabit Ethernet) controller driver
33 *
4− * Copyright (c) 2014 Broadcom Corporation
4+ * Copyright (c) 2014-2017 Broadcom
55 *
66 * This program is free software; you can redistribute it and/or modify
77 * it under the terms of the GNU General Public License version 2 as
@@ -450,6 +450,22 @@ static inline void bcmgenet_rdma_ring_writel(struct bcmgenet_priv *priv, · 442 unmodified lines
450450 genet_dma_ring_regs[r]);
451451 }
452452
453+static int bcmgenet_begin(struct net_device *dev)
454+{
455+ struct bcmgenet_priv *priv = netdev_priv(dev);
456+
457+ /* Turn on the clock */
458+ return clk_prepare_enable(priv->clk);
459+}
460+
461+static void bcmgenet_complete(struct net_device *dev)
462+{
463+ struct bcmgenet_priv *priv = netdev_priv(dev);
464+
465+ /* Turn off the clock */
466+ clk_disable_unprepare(priv->clk);
467+}
468+
453469 static int bcmgenet_get_link_ksettings(struct net_device *dev,
454470 struct ethtool_link_ksettings *cmd)
455471 {
@@ -778,8 +794,9 @@ static const struct bcmgenet_stats bcmgenet_gstrings_stats[] = { · 322 unmodified lines
778794 STAT_GENET_RUNT("rx_runt_bytes", mib.rx_runt_bytes),
779795 /* Misc UniMAC counters */
780796 STAT_GENET_MISC("rbuf_ovflow_cnt", mib.rbuf_ovflow_cnt,
781− UMAC_RBUF_OVFL_CNT),
782− STAT_GENET_MISC("rbuf_err_cnt", mib.rbuf_err_cnt, UMAC_RBUF_ERR_CNT),
797+ UMAC_RBUF_OVFL_CNT_V1),
798+ STAT_GENET_MISC("rbuf_err_cnt", mib.rbuf_err_cnt,
799+ UMAC_RBUF_ERR_CNT_V1),
783800 STAT_GENET_MISC("mdf_err_cnt", mib.mdf_err_cnt, UMAC_MDF_ERR_CNT),
784801 STAT_GENET_SOFT_MIB("alloc_rx_buff_failed", mib.alloc_rx_buff_failed),
785802 STAT_GENET_SOFT_MIB("rx_dma_failed", mib.rx_dma_failed),
@@ -821,6 +838,45 @@ static void bcmgenet_get_strings(struct net_device *dev, u32 stringset, · 35 unmodified lines
821838 }
822839 }
823840
841+static u32 bcmgenet_update_stat_misc(struct bcmgenet_priv *priv, u16 offset)
842+{
843+ u16 new_offset;
844+ u32 val;
845+
846+ switch (offset) {
847+ case UMAC_RBUF_OVFL_CNT_V1:
848+ if (GENET_IS_V2(priv))
849+ new_offset = RBUF_OVFL_CNT_V2;
850+ else
851+ new_offset = RBUF_OVFL_CNT_V3PLUS;
852+
853+ val = bcmgenet_rbuf_readl(priv, new_offset);
854+ /* clear if overflowed */
855+ if (val == ~0)
856+ bcmgenet_rbuf_writel(priv, 0, new_offset);
857+ break;
858+ case UMAC_RBUF_ERR_CNT_V1:
859+ if (GENET_IS_V2(priv))
860+ new_offset = RBUF_ERR_CNT_V2;
861+ else
862+ new_offset = RBUF_ERR_CNT_V3PLUS;
863+
864+ val = bcmgenet_rbuf_readl(priv, new_offset);
865+ /* clear if overflowed */
866+ if (val == ~0)
867+ bcmgenet_rbuf_writel(priv, 0, new_offset);
868+ break;
869+ default:
870+ val = bcmgenet_umac_readl(priv, offset);
871+ /* clear if overflowed */
872+ if (val == ~0)
873+ bcmgenet_umac_writel(priv, 0, offset);
874+ break;
875+ }
876+
877+ return val;
878+}
879+
824880 static void bcmgenet_update_mib_counters(struct bcmgenet_priv *priv)
825881 {
826882 int i, j = 0;
@@ -836,19 +892,28 @@ static void bcmgenet_update_mib_counters(struct bcmgenet_priv *priv) · 9 unmodified lines
836892 case BCMGENET_STAT_NETDEV:
837893 case BCMGENET_STAT_SOFT:
838894 continue;
839− case BCMGENET_STAT_MIB_RX:
840− case BCMGENET_STAT_MIB_TX:
841895 case BCMGENET_STAT_RUNT:
842− if (s->type != BCMGENET_STAT_MIB_RX)
843− offset = BCMGENET_STAT_OFFSET;
896+ offset += BCMGENET_STAT_OFFSET;
897+ /* fall through */
898+ case BCMGENET_STAT_MIB_TX:
899+ offset += BCMGENET_STAT_OFFSET;
900+ /* fall through */
901+ case BCMGENET_STAT_MIB_RX:
844902 val = bcmgenet_umac_readl(priv,
845903 UMAC_MIB_START + j + offset);
904+ offset = 0; /* Reset Offset */
846905 break;
847906 case BCMGENET_STAT_MISC:
848− val = bcmgenet_umac_readl(priv, s->reg_offset);
849− /* clear if overflowed */
850− if (val == ~0)
851− bcmgenet_umac_writel(priv, 0, s->reg_offset);
907+ if (GENET_IS_V1(priv)) {
908+ val = bcmgenet_umac_readl(priv, s->reg_offset);
909+ /* clear if overflowed */
910+ if (val == ~0)
911+ bcmgenet_umac_writel(priv, 0,
912+ s->reg_offset);
913+ } else {
914+ val = bcmgenet_update_stat_misc(priv,
915+ s->reg_offset);
916+ }
852917 break;
853918 }
854919
@@ -973,6 +1038,8 @@ static int bcmgenet_set_eee(struct net_device *dev, struct ethtool_eee *e) · 118 unmodified lines
9731038
9741039 /* standard ethtool support functions. */
9751040 static const struct ethtool_ops bcmgenet_ethtool_ops = {
1041+ .begin = bcmgenet_begin,
1042+ .complete = bcmgenet_complete,
9761043 .get_strings = bcmgenet_get_strings,
9771044 .get_sset_count = bcmgenet_get_sset_count,
9781045 .get_ethtool_stats = bcmgenet_get_ethtool_stats,
@@ -1167,7 +1234,6 @@ static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev, · 188 unmodified lines
11671234 struct bcmgenet_priv *priv = netdev_priv(dev);
11681235 struct device *kdev = &priv->pdev->dev;
11691236 struct enet_cb *tx_cb_ptr;
1170− struct netdev_queue *txq;
11711237 unsigned int pkts_compl = 0;
11721238 unsigned int bytes_compl = 0;
11731239 unsigned int c_index;
@@ -1219,13 +1285,8 @@ static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev, · 45 unmodified lines
12191285 dev->stats.tx_packets += pkts_compl;
12201286 dev->stats.tx_bytes += bytes_compl;
12211287
1222− txq = netdev_get_tx_queue(dev, ring->queue);
1223− netdev_tx_completed_queue(txq, pkts_compl, bytes_compl);
1224−
1225− if (ring->free_bds > (MAX_SKB_FRAGS + 1)) {
1226− if (netif_tx_queue_stopped(txq))
1227− netif_tx_wake_queue(txq);
1228− }
1288+ netdev_tx_completed_queue(netdev_get_tx_queue(dev, ring->queue),
1289+ pkts_compl, bytes_compl);
12291290
12301291 return pkts_compl;
12311292 }
@@ -1248,8 +1309,16 @@ static int bcmgenet_tx_poll(struct napi_struct *napi, int budget) · 16 unmodified lines
12481309 struct bcmgenet_tx_ring *ring =
12491310 container_of(napi, struct bcmgenet_tx_ring, napi);
12501311 unsigned int work_done = 0;
1312+ struct netdev_queue *txq;
1313+ unsigned long flags;
12511314
1252− work_done = bcmgenet_tx_reclaim(ring->priv->dev, ring);
1315+ spin_lock_irqsave(&ring->lock, flags);
1316+ work_done = __bcmgenet_tx_reclaim(ring->priv->dev, ring);
1317+ if (ring->free_bds > (MAX_SKB_FRAGS + 1)) {
1318+ txq = netdev_get_tx_queue(ring->priv->dev, ring->queue);
1319+ netif_tx_wake_queue(txq);
1320+ }
1321+ spin_unlock_irqrestore(&ring->lock, flags);
12531322
12541323 if (work_done == 0) {
12551324 napi_complete(napi);
@@ -2457,24 +2526,28 @@ static int bcmgenet_init_dma(struct bcmgenet_priv *priv) · 1201 unmodified lines
24572526 /* Interrupt bottom half */
24582527 static void bcmgenet_irq_task(struct work_struct *work)
24592528 {
2529+ unsigned long flags;
2530+ unsigned int status;
24602531 struct bcmgenet_priv *priv = container_of(
24612532 work, struct bcmgenet_priv, bcmgenet_irq_work);
24622533
24632534 netif_dbg(priv, intr, priv->dev, "%s\n", __func__);
24642535
2465− if (priv->irq0_stat & UMAC_IRQ_MPD_R) {
2466− priv->irq0_stat &= ~UMAC_IRQ_MPD_R;
2536+ spin_lock_irqsave(&priv->lock, flags);
2537+ status = priv->irq0_stat;
2538+ priv->irq0_stat = 0;
2539+ spin_unlock_irqrestore(&priv->lock, flags);
2540+
2541+ if (status & UMAC_IRQ_MPD_R) {
24672542 netif_dbg(priv, wol, priv->dev,
24682543 "magic packet detected, waking up\n");
24692544 bcmgenet_power_up(priv, GENET_POWER_WOL_MAGIC);
24702545 }
24712546
24722547 /* Link UP/DOWN event */
2473− if (priv->irq0_stat & UMAC_IRQ_LINK_EVENT) {
2548+ if (status & UMAC_IRQ_LINK_EVENT)
24742549 phy_mac_interrupt(priv->phydev,
2475− !!(priv->irq0_stat & UMAC_IRQ_LINK_UP));
2476− priv->irq0_stat &= ~UMAC_IRQ_LINK_EVENT;
2477− }
2550+ !!(status & UMAC_IRQ_LINK_UP));
24782551 }
24792552
24802553 /* bcmgenet_isr1: handle Rx and Tx priority queues */
@@ -2483,22 +2556,21 @@ static irqreturn_t bcmgenet_isr1(int irq, void *dev_id) · 2 unmodified lines
24832556 struct bcmgenet_priv *priv = dev_id;
24842557 struct bcmgenet_rx_ring *rx_ring;
24852558 struct bcmgenet_tx_ring *tx_ring;
2486− unsigned int index;
2559+ unsigned int index, status;
24872560
2488− /* Save irq status for bottom-half processing. */
2489− priv->irq1_stat =
2490− bcmgenet_intrl2_1_readl(priv, INTRL2_CPU_STAT) &
2561+ /* Read irq status */
2562+ status = bcmgenet_intrl2_1_readl(priv, INTRL2_CPU_STAT) &
24912563 ~bcmgenet_intrl2_1_readl(priv, INTRL2_CPU_MASK_STATUS);
24922564
24932565 /* clear interrupts */
2494− bcmgenet_intrl2_1_writel(priv, priv->irq1_stat, INTRL2_CPU_CLEAR);
2566+ bcmgenet_intrl2_1_writel(priv, status, INTRL2_CPU_CLEAR);
24952567
24962568 netif_dbg(priv, intr, priv->dev,
2497− "%s: IRQ=0x%x\n", __func__, priv->irq1_stat);
2569+ "%s: IRQ=0x%x\n", __func__, status);
24982570
24992571 /* Check Rx priority queue interrupts */
25002572 for (index = 0; index < priv->hw_params->rx_queues; index++) {
2501− if (!(priv->irq1_stat & BIT(UMAC_IRQ1_RX_INTR_SHIFT + index)))
2573+ if (!(status & BIT(UMAC_IRQ1_RX_INTR_SHIFT + index)))
25022574 continue;
25032575
25042576 rx_ring = &priv->rx_rings[index];
@@ -2511,7 +2583,7 @@ static irqreturn_t bcmgenet_isr1(int irq, void *dev_id) · 6 unmodified lines
25112583
25122584 /* Check Tx priority queue interrupts */
25132585 for (index = 0; index < priv->hw_params->tx_queues; index++) {
2514− if (!(priv->irq1_stat & BIT(index)))
2586+ if (!(status & BIT(index)))
25152587 continue;
25162588
25172589 tx_ring = &priv->tx_rings[index];
@@ -2531,19 +2603,20 @@ static irqreturn_t bcmgenet_isr0(int irq, void *dev_id) · 13 unmodified lines
25312603 struct bcmgenet_priv *priv = dev_id;
25322604 struct bcmgenet_rx_ring *rx_ring;
25332605 struct bcmgenet_tx_ring *tx_ring;
2606+ unsigned int status;
2607+ unsigned long flags;
25342608
2535− /* Save irq status for bottom-half processing. */
2536− priv->irq0_stat =
2537− bcmgenet_intrl2_0_readl(priv, INTRL2_CPU_STAT) &
2609+ /* Read irq status */
2610+ status = bcmgenet_intrl2_0_readl(priv, INTRL2_CPU_STAT) &
25382611 ~bcmgenet_intrl2_0_readl(priv, INTRL2_CPU_MASK_STATUS);
25392612
25402613 /* clear interrupts */
2541− bcmgenet_intrl2_0_writel(priv, priv->irq0_stat, INTRL2_CPU_CLEAR);
2614+ bcmgenet_intrl2_0_writel(priv, status, INTRL2_CPU_CLEAR);
25422615
25432616 netif_dbg(priv, intr, priv->dev,
2544− "IRQ=0x%x\n", priv->irq0_stat);
2617+ "IRQ=0x%x\n", status);
25452618
2546− if (priv->irq0_stat & UMAC_IRQ_RXDMA_DONE) {
2619+ if (status & UMAC_IRQ_RXDMA_DONE) {
25472620 rx_ring = &priv->rx_rings[DESC_INDEX];
25482621
25492622 if (likely(napi_schedule_prep(&rx_ring->napi))) {
@@ -2552,7 +2625,7 @@ static irqreturn_t bcmgenet_isr0(int irq, void *dev_id) · 2 unmodified lines
25522625 }
25532626 }
25542627
2555− if (priv->irq0_stat & UMAC_IRQ_TXDMA_DONE) {
2628+ if (status & UMAC_IRQ_TXDMA_DONE) {
25562629 tx_ring = &priv->tx_rings[DESC_INDEX];
25572630
25582631 if (likely(napi_schedule_prep(&tx_ring->napi))) {
@@ -2561,22 +2634,23 @@ static irqreturn_t bcmgenet_isr0(int irq, void *dev_id) · 2 unmodified lines
25612634 }
25622635 }
25632636
2564− if (priv->irq0_stat & (UMAC_IRQ_PHY_DET_R |
2565− UMAC_IRQ_PHY_DET_F |
2566− UMAC_IRQ_LINK_EVENT |
2567− UMAC_IRQ_HFB_SM |
2568− UMAC_IRQ_HFB_MM |
2569− UMAC_IRQ_MPD_R)) {
2570− /* all other interested interrupts handled in bottom half */
2571− schedule_work(&priv->bcmgenet_irq_work);
2572− }
2573−
25742637 if ((priv->hw_params->flags & GENET_HAS_MDIO_INTR) &&
2575− priv->irq0_stat & (UMAC_IRQ_MDIO_DONE | UMAC_IRQ_MDIO_ERROR)) {
2576− priv->irq0_stat &= ~(UMAC_IRQ_MDIO_DONE | UMAC_IRQ_MDIO_ERROR);
2638+ status & (UMAC_IRQ_MDIO_DONE | UMAC_IRQ_MDIO_ERROR)) {
25772639 wake_up(&priv->wq);
25782640 }
25792641
2642+ /* all other interested interrupts handled in bottom half */
2643+ status &= (UMAC_IRQ_LINK_EVENT |
2644+ UMAC_IRQ_MPD_R);
2645+ if (status) {
2646+ /* Save irq status for bottom-half processing. */
2647+ spin_lock_irqsave(&priv->lock, flags);
2648+ priv->irq0_stat |= status;
2649+ spin_unlock_irqrestore(&priv->lock, flags);
2650+
2651+ schedule_work(&priv->bcmgenet_irq_work);
2652+ }
2653+
25802654 return IRQ_HANDLED;
25812655 }
25822656
@@ -2801,6 +2875,8 @@ err_irq0: · 218 unmodified lines
28012875 err_fini_dma:
28022876 bcmgenet_fini_dma(priv);
28032877 err_clk_disable:
2878+ if (priv->internal_phy)
2879+ bcmgenet_power_down(priv, GENET_POWER_PASSIVE);
28042880 clk_disable_unprepare(priv->clk);
28052881 return ret;
28062882 }
@@ -3177,6 +3253,12 @@ static void bcmgenet_set_hw_params(struct bcmgenet_priv *priv) · 370 unmodified lines
31773253 */
31783254 gphy_rev = reg & 0xffff;
31793255
3256+ /* This is reserved so should require special treatment */
3257+ if (gphy_rev == 0 || gphy_rev == 0x01ff) {
3258+ pr_warn("Invalid GPHY revision detected: 0x%04x\n", gphy_rev);
3259+ return;
3260+ }
3261+
31803262 /* This is the good old scheme, just GPHY major, no minor nor patch */
31813263 if ((gphy_rev & 0xf0) != 0)
31823264 priv->gphy_rev = gphy_rev << 8;
@@ -3185,12 +3267,6 @@ static void bcmgenet_set_hw_params(struct bcmgenet_priv *priv) · 2 unmodified lines
31853267 else if ((gphy_rev & 0xff00) != 0)
31863268 priv->gphy_rev = gphy_rev;
31873269
3188− /* This is reserved so should require special treatment */
3189− else if (gphy_rev == 0 || gphy_rev == 0x01ff) {
3190− pr_warn("Invalid GPHY revision detected: 0x%04x\n", gphy_rev);
3191− return;
3192− }
3193−
31943270 #ifdef CONFIG_PHYS_ADDR_T_64BIT
31953271 if (!(params->flags & GENET_HAS_40BITS))
31963272 pr_warn("GENET does not support 40-bits PA\n");
@@ -3233,6 +3309,7 @@ static int bcmgenet_probe(struct platform_device *pdev) · 36 unmodified lines
32333309 const void *macaddr;
32343310 struct resource *r;
32353311 int err = -EIO;
3312+ const char *phy_mode_str;
32363313
32373314 /* Up to GENET_MAX_MQ_CNT + 1 TX queues and RX queues */
32383315 dev = alloc_etherdev_mqs(sizeof(*priv), GENET_MAX_MQ_CNT + 1,
@@ -3276,6 +3353,8 @@ static int bcmgenet_probe(struct platform_device *pdev) · 37 unmodified lines
32763353 goto err;
32773354 }
32783355
3356+ spin_lock_init(&priv->lock);
3357+
32793358 SET_NETDEV_DEV(dev, &pdev->dev);
32803359 dev_set_drvdata(&pdev->dev, dev);
32813360 ether_addr_copy(dev->dev_addr, macaddr);
@@ -3338,6 +3417,13 @@ static int bcmgenet_probe(struct platform_device *pdev) · 56 unmodified lines
33383417 priv->clk_eee = NULL;
33393418 }
33403419
3420+ /* If this is an internal GPHY, power it on now, before UniMAC is
3421+ * brought out of reset as absolutely no UniMAC activity is allowed
3422+ */
3423+ if (dn && !of_property_read_string(dn, "phy-mode", &phy_mode_str) &&
3424+ !strcasecmp(phy_mode_str, "internal"))
3425+ bcmgenet_power_up(priv, GENET_POWER_PASSIVE);
3426+
33413427 err = reset_umac(priv);
33423428 if (err)
33433429 goto err_clk_disable;
@@ -3502,6 +3588,8 @@ static int bcmgenet_resume(struct device *d) · 158 unmodified lines
35023588 return 0;
35033589
35043590 out_clk_disable:
3591+ if (priv->internal_phy)
3592+ bcmgenet_power_down(priv, GENET_POWER_PASSIVE);
35053593 clk_disable_unprepare(priv->clk);
35063594 return ret;
35073595 }
drivers/net/ethernet/broadcom/genet/bcmgenet.h+11−5
@@ -1,5 +1,5 @@
11 /*
2− * Copyright (c) 2014 Broadcom Corporation
2+ * Copyright (c) 2014-2017 Broadcom
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License version 2 as
@@ -214,7 +214,9 @@ struct bcmgenet_mib_counters { · 208 unmodified lines
214214 #define MDIO_REG_SHIFT 16
215215 #define MDIO_REG_MASK 0x1F
216216
217−#define UMAC_RBUF_OVFL_CNT 0x61C
217+#define UMAC_RBUF_OVFL_CNT_V1 0x61C
218+#define RBUF_OVFL_CNT_V2 0x80
219+#define RBUF_OVFL_CNT_V3PLUS 0x94
218220
219221 #define UMAC_MPD_CTRL 0x620
220222 #define MPD_EN (1 << 0)
@@ -224,7 +226,9 @@ struct bcmgenet_mib_counters { · 3 unmodified lines
224226
225227 #define UMAC_MPD_PW_MS 0x624
226228 #define UMAC_MPD_PW_LS 0x628
227−#define UMAC_RBUF_ERR_CNT 0x634
229+#define UMAC_RBUF_ERR_CNT_V1 0x634
230+#define RBUF_ERR_CNT_V2 0x84
231+#define RBUF_ERR_CNT_V3PLUS 0x98
228232 #define UMAC_MDF_ERR_CNT 0x638
229233 #define UMAC_MDF_CTRL 0x650
230234 #define UMAC_MDF_ADDR 0x654
@@ -619,11 +623,13 @@ struct bcmgenet_priv { · 388 unmodified lines
619623 struct work_struct bcmgenet_irq_work;
620624 int irq0;
621625 int irq1;
622− unsigned int irq0_stat;
623− unsigned int irq1_stat;
624626 int wol_irq;
625627 bool wol_irq_disabled;
626628
629+ /* shared status */
630+ spinlock_t lock;
631+ unsigned int irq0_stat;
632+
627633 /* HW descriptors/checksum variables */
628634 bool desc_64b_en;
629635 bool desc_rxchk_en;
drivers/net/ethernet/cavium/liquidio/lio_main.c+55−55
@@ -152,7 +152,7 @@ struct octnic_gather { · 151 unmodified lines
152152 */
153153 struct octeon_sg_entry *sg;
154154
155− u64 sg_dma_ptr;
155+ dma_addr_t sg_dma_ptr;
156156 };
157157
158158 struct handshake {
@@ -734,6 +734,9 @@ static void delete_glists(struct lio *lio) · 575 unmodified lines
734734 struct octnic_gather *g;
735735 int i;
736736
737+ kfree(lio->glist_lock);
738+ lio->glist_lock = NULL;
739+
737740 if (!lio->glist)
738741 return;
739742
@@ -741,23 +744,26 @@ static void delete_glists(struct lio *lio) · 1 unmodified line
741744 do {
742745 g = (struct octnic_gather *)
743746 list_delete_head(&lio->glist[i]);
744− if (g) {
745− if (g->sg) {
746− dma_unmap_single(&lio->oct_dev->
747− pci_dev->dev,
748− g->sg_dma_ptr,
749− g->sg_size,
750− DMA_TO_DEVICE);
751− kfree((void *)((unsigned long)g->sg -
752− g->adjust));
753− }
747+ if (g)
754748 kfree(g);
755− }
756749 } while (g);
750+
751+ if (lio->glists_virt_base && lio->glists_virt_base[i]) {
752+ lio_dma_free(lio->oct_dev,
753+ lio->glist_entry_size * lio->tx_qsize,
754+ lio->glists_virt_base[i],
755+ lio->glists_dma_base[i]);
756+ }
757757 }
758758
759− kfree((void *)lio->glist);
760− kfree((void *)lio->glist_lock);
759+ kfree(lio->glists_virt_base);
760+ lio->glists_virt_base = NULL;
761+
762+ kfree(lio->glists_dma_base);
763+ lio->glists_dma_base = NULL;
764+
765+ kfree(lio->glist);
766+ lio->glist = NULL;
761767 }
762768
763769 /**
@@ -772,13 +778,30 @@ static int setup_glists(struct octeon_device *oct, struct lio *lio, int num_iqs) · 8 unmodified lines
772778 lio->glist_lock = kcalloc(num_iqs, sizeof(*lio->glist_lock),
773779 GFP_KERNEL);
774780 if (!lio->glist_lock)
775− return 1;
781+ return -ENOMEM;
776782
777783 lio->glist = kcalloc(num_iqs, sizeof(*lio->glist),
778784 GFP_KERNEL);
779785 if (!lio->glist) {
780− kfree((void *)lio->glist_lock);
781− return 1;
786+ kfree(lio->glist_lock);
787+ lio->glist_lock = NULL;
788+ return -ENOMEM;
789+ }
790+
791+ lio->glist_entry_size =
792+ ROUNDUP8((ROUNDUP4(OCTNIC_MAX_SG) >> 2) * OCT_SG_ENTRY_SIZE);
793+
794+ /* allocate memory to store virtual and dma base address of
795+ * per glist consistent memory
796+ */
797+ lio->glists_virt_base = kcalloc(num_iqs, sizeof(*lio->glists_virt_base),
798+ GFP_KERNEL);
799+ lio->glists_dma_base = kcalloc(num_iqs, sizeof(*lio->glists_dma_base),
800+ GFP_KERNEL);
801+
802+ if (!lio->glists_virt_base || !lio->glists_dma_base) {
803+ delete_glists(lio);
804+ return -ENOMEM;
782805 }
783806
784807 for (i = 0; i < num_iqs; i++) {
@@ -788,6 +811,16 @@ static int setup_glists(struct octeon_device *oct, struct lio *lio, int num_iqs) · 3 unmodified lines
788811
789812 INIT_LIST_HEAD(&lio->glist[i]);
790813
814+ lio->glists_virt_base[i] =
815+ lio_dma_alloc(oct,
816+ lio->glist_entry_size * lio->tx_qsize,
817+ &lio->glists_dma_base[i]);
818+
819+ if (!lio->glists_virt_base[i]) {
820+ delete_glists(lio);
821+ return -ENOMEM;
822+ }
823+
791824 for (j = 0; j < lio->tx_qsize; j++) {
792825 g = kzalloc_node(sizeof(*g), GFP_KERNEL,
793826 numa_node);
@@ -796,43 +829,18 @@ static int setup_glists(struct octeon_device *oct, struct lio *lio, int num_iqs) · 2 unmodified lines
796829 if (!g)
797830 break;
798831
799− g->sg_size = ((ROUNDUP4(OCTNIC_MAX_SG) >> 2) *
800− OCT_SG_ENTRY_SIZE);
832+ g->sg = lio->glists_virt_base[i] +
833+ (j * lio->glist_entry_size);
801834
802− g->sg = kmalloc_node(g->sg_size + 8,
803− GFP_KERNEL, numa_node);
804− if (!g->sg)
805− g->sg = kmalloc(g->sg_size + 8, GFP_KERNEL);
806− if (!g->sg) {
807− kfree(g);
808− break;
809− }
810−
811− /* The gather component should be aligned on 64-bit
812− * boundary
813− */
814− if (((unsigned long)g->sg) & 7) {
815− g->adjust = 8 - (((unsigned long)g->sg) & 7);
816− g->sg = (struct octeon_sg_entry *)
817− ((unsigned long)g->sg + g->adjust);
818− }
819− g->sg_dma_ptr = dma_map_single(&oct->pci_dev->dev,
820− g->sg, g->sg_size,
821− DMA_TO_DEVICE);
822− if (dma_mapping_error(&oct->pci_dev->dev,
823− g->sg_dma_ptr)) {
824− kfree((void *)((unsigned long)g->sg -
825− g->adjust));
826− kfree(g);
827− break;
828− }
835+ g->sg_dma_ptr = lio->glists_dma_base[i] +
836+ (j * lio->glist_entry_size);
829837
830838 list_add_tail(&g->list, &lio->glist[i]);
831839 }
832840
833841 if (j != lio->tx_qsize) {
834842 delete_glists(lio);
835− return 1;
843+ return -ENOMEM;
836844 }
837845 }
838846
@@ -1885,9 +1893,6 @@ static void free_netsgbuf(void *buf) · 1046 unmodified lines
18851893 i++;
18861894 }
18871895
1888− dma_sync_single_for_cpu(&lio->oct_dev->pci_dev->dev,
1889− g->sg_dma_ptr, g->sg_size, DMA_TO_DEVICE);
1890−
18911896 iq = skb_iq(lio, skb);
18921897 spin_lock(&lio->glist_lock[iq]);
18931898 list_add_tail(&g->list, &lio->glist[iq]);
@@ -1933,9 +1938,6 @@ static void free_netsgbuf_with_resp(void *buf) · 39 unmodified lines
19331938 i++;
19341939 }
19351940
1936− dma_sync_single_for_cpu(&lio->oct_dev->pci_dev->dev,
1937− g->sg_dma_ptr, g->sg_size, DMA_TO_DEVICE);
1938−
19391941 iq = skb_iq(lio, skb);
19401942
19411943 spin_lock(&lio->glist_lock[iq]);
@@ -3273,8 +3275,6 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev) · 1331 unmodified lines
32733275 i++;
32743276 }
32753277
3276− dma_sync_single_for_device(&oct->pci_dev->dev, g->sg_dma_ptr,
3277− g->sg_size, DMA_TO_DEVICE);
32783278 dptr = g->sg_dma_ptr;
32793279
32803280 if (OCTEON_CN23XX_PF(oct))
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c+55−49
@@ -108,6 +108,8 @@ struct octnic_gather { · 107 unmodified lines
108108 * received from the IP layer.
109109 */
110110 struct octeon_sg_entry *sg;
111+
112+ dma_addr_t sg_dma_ptr;
111113 };
112114
113115 struct octeon_device_priv {
@@ -490,6 +492,9 @@ static void delete_glists(struct lio *lio) · 376 unmodified lines
490492 struct octnic_gather *g;
491493 int i;
492494
495+ kfree(lio->glist_lock);
496+ lio->glist_lock = NULL;
497+
493498 if (!lio->glist)
494499 return;
495500
@@ -497,17 +502,26 @@ static void delete_glists(struct lio *lio) · 1 unmodified line
497502 do {
498503 g = (struct octnic_gather *)
499504 list_delete_head(&lio->glist[i]);
500− if (g) {
501− if (g->sg)
502− kfree((void *)((unsigned long)g->sg -
503− g->adjust));
505+ if (g)
504506 kfree(g);
505− }
506507 } while (g);
508+
509+ if (lio->glists_virt_base && lio->glists_virt_base[i]) {
510+ lio_dma_free(lio->oct_dev,
511+ lio->glist_entry_size * lio->tx_qsize,
512+ lio->glists_virt_base[i],
513+ lio->glists_dma_base[i]);
514+ }
507515 }
508516
517+ kfree(lio->glists_virt_base);
518+ lio->glists_virt_base = NULL;
519+
520+ kfree(lio->glists_dma_base);
521+ lio->glists_dma_base = NULL;
522+
509523 kfree(lio->glist);
510− kfree(lio->glist_lock);
524+ lio->glist = NULL;
511525 }
512526
513527 /**
@@ -522,13 +536,30 @@ static int setup_glists(struct lio *lio, int num_iqs) · 8 unmodified lines
522536 lio->glist_lock =
523537 kzalloc(sizeof(*lio->glist_lock) * num_iqs, GFP_KERNEL);
524538 if (!lio->glist_lock)
525− return 1;
539+ return -ENOMEM;
526540
527541 lio->glist =
528542 kzalloc(sizeof(*lio->glist) * num_iqs, GFP_KERNEL);
529543 if (!lio->glist) {
530544 kfree(lio->glist_lock);
531− return 1;
545+ lio->glist_lock = NULL;
546+ return -ENOMEM;
547+ }
548+
549+ lio->glist_entry_size =
550+ ROUNDUP8((ROUNDUP4(OCTNIC_MAX_SG) >> 2) * OCT_SG_ENTRY_SIZE);
551+
552+ /* allocate memory to store virtual and dma base address of
553+ * per glist consistent memory
554+ */
555+ lio->glists_virt_base = kcalloc(num_iqs, sizeof(*lio->glists_virt_base),
556+ GFP_KERNEL);
557+ lio->glists_dma_base = kcalloc(num_iqs, sizeof(*lio->glists_dma_base),
558+ GFP_KERNEL);
559+
560+ if (!lio->glists_virt_base || !lio->glists_dma_base) {
561+ delete_glists(lio);
562+ return -ENOMEM;
532563 }
533564
534565 for (i = 0; i < num_iqs; i++) {
@@ -536,34 +567,33 @@ static int setup_glists(struct lio *lio, int num_iqs) · 1 unmodified line
536567
537568 INIT_LIST_HEAD(&lio->glist[i]);
538569
570+ lio->glists_virt_base[i] =
571+ lio_dma_alloc(lio->oct_dev,
572+ lio->glist_entry_size * lio->tx_qsize,
573+ &lio->glists_dma_base[i]);
574+
575+ if (!lio->glists_virt_base[i]) {
576+ delete_glists(lio);
577+ return -ENOMEM;
578+ }
579+
539580 for (j = 0; j < lio->tx_qsize; j++) {
540581 g = kzalloc(sizeof(*g), GFP_KERNEL);
541582 if (!g)
542583 break;
543584
544− g->sg_size = ((ROUNDUP4(OCTNIC_MAX_SG) >> 2) *
545− OCT_SG_ENTRY_SIZE);
585+ g->sg = lio->glists_virt_base[i] +
586+ (j * lio->glist_entry_size);
546587
547− g->sg = kmalloc(g->sg_size + 8, GFP_KERNEL);
548− if (!g->sg) {
549− kfree(g);
550− break;
551− }
588+ g->sg_dma_ptr = lio->glists_dma_base[i] +
589+ (j * lio->glist_entry_size);
552590
553− /* The gather component should be aligned on 64-bit
554− * boundary
555− */
556− if (((unsigned long)g->sg) & 7) {
557− g->adjust = 8 - (((unsigned long)g->sg) & 7);
558− g->sg = (struct octeon_sg_entry *)
559− ((unsigned long)g->sg + g->adjust);
560− }
561591 list_add_tail(&g->list, &lio->glist[i]);
562592 }
563593
564594 if (j != lio->tx_qsize) {
565595 delete_glists(lio);
566− return 1;
596+ return -ENOMEM;
567597 }
568598 }
569599
@@ -1324,10 +1354,6 @@ static void free_netsgbuf(void *buf) · 754 unmodified lines
13241354 i++;
13251355 }
13261356
1327− dma_unmap_single(&lio->oct_dev->pci_dev->dev,
1328− finfo->dptr, g->sg_size,
1329− DMA_TO_DEVICE);
1330−
13311357 iq = skb_iq(lio, skb);
13321358
13331359 spin_lock(&lio->glist_lock[iq]);
@@ -1374,10 +1400,6 @@ static void free_netsgbuf_with_resp(void *buf) · 40 unmodified lines
13741400 i++;
13751401 }
13761402
1377− dma_unmap_single(&lio->oct_dev->pci_dev->dev,
1378− finfo->dptr, g->sg_size,
1379− DMA_TO_DEVICE);
1380−
13811403 iq = skb_iq(lio, skb);
13821404
13831405 spin_lock(&lio->glist_lock[iq]);
@@ -2382,23 +2404,7 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev) · 998 unmodified lines
23822404 i++;
23832405 }
23842406
2385− dptr = dma_map_single(&oct->pci_dev->dev,
2386− g->sg, g->sg_size,
2387− DMA_TO_DEVICE);
2388− if (dma_mapping_error(&oct->pci_dev->dev, dptr)) {
2389− dev_err(&oct->pci_dev->dev, "%s DMA mapping error 4\n",
2390− __func__);
2391− dma_unmap_single(&oct->pci_dev->dev, g->sg[0].ptr[0],
2392− skb->len - skb->data_len,
2393− DMA_TO_DEVICE);
2394− for (j = 1; j <= frags; j++) {
2395− frag = &skb_shinfo(skb)->frags[j - 1];
2396− dma_unmap_page(&oct->pci_dev->dev,
2397− g->sg[j >> 2].ptr[j & 3],
2398− frag->size, DMA_TO_DEVICE);
2399− }
2400− return NETDEV_TX_BUSY;
2401− }
2407+ dptr = g->sg_dma_ptr;
24022408
24032409 ndata.cmd.cmd3.dptr = dptr;
24042410 finfo->dptr = dptr;
drivers/net/ethernet/cavium/liquidio/octeon_config.h+3−3
@@ -71,17 +71,17 @@ · 70 unmodified lines
7171 #define CN23XX_MAX_RINGS_PER_VF 8
7272
7373 #define CN23XX_MAX_INPUT_QUEUES CN23XX_MAX_RINGS_PER_PF
74−#define CN23XX_MAX_IQ_DESCRIPTORS 2048
74+#define CN23XX_MAX_IQ_DESCRIPTORS 512
7575 #define CN23XX_DB_MIN 1
7676 #define CN23XX_DB_MAX 8
7777 #define CN23XX_DB_TIMEOUT 1
7878
7979 #define CN23XX_MAX_OUTPUT_QUEUES CN23XX_MAX_RINGS_PER_PF
80−#define CN23XX_MAX_OQ_DESCRIPTORS 2048
80+#define CN23XX_MAX_OQ_DESCRIPTORS 512
8181 #define CN23XX_OQ_BUF_SIZE 1536
8282 #define CN23XX_OQ_PKTSPER_INTR 128
8383 /*#define CAVIUM_ONLY_CN23XX_RX_PERF*/
84−#define CN23XX_OQ_REFIL_THRESHOLD 128
84+#define CN23XX_OQ_REFIL_THRESHOLD 16
8585
8686 #define CN23XX_OQ_INTR_PKT 64
8787 #define CN23XX_OQ_INTR_TIME 100
drivers/net/ethernet/cavium/liquidio/octeon_droq.c+2−15
@@ -155,11 +155,6 @@ octeon_droq_destroy_ring_buffers(struct octeon_device *oct, · 154 unmodified lines
155155 recv_buffer_destroy(droq->recv_buf_list[i].buffer,
156156 pg_info);
157157
158− if (droq->desc_ring && droq->desc_ring[i].info_ptr)
159− lio_unmap_ring_info(oct->pci_dev,
160− (u64)droq->
161− desc_ring[i].info_ptr,
162− OCT_DROQ_INFO_SIZE);
163158 droq->recv_buf_list[i].buffer = NULL;
164159 }
165160
@@ -211,10 +206,7 @@ int octeon_delete_droq(struct octeon_device *oct, u32 q_no) · 45 unmodified lines
211206 vfree(droq->recv_buf_list);
212207
213208 if (droq->info_base_addr)
214− cnnic_free_aligned_dma(oct->pci_dev, droq->info_list,
215− droq->info_alloc_size,
216− droq->info_base_addr,
217− droq->info_list_dma);
209+ lio_free_info_buffer(oct, droq);
218210
219211 if (droq->desc_ring)
220212 lio_dma_free(oct, (droq->max_count * OCT_DROQ_DESC_SIZE),
@@ -294,12 +286,7 @@ int octeon_init_droq(struct octeon_device *oct, · 73 unmodified lines
294286 dev_dbg(&oct->pci_dev->dev, "droq[%d]: num_desc: %d\n", q_no,
295287 droq->max_count);
296288
297− droq->info_list =
298− cnnic_numa_alloc_aligned_dma((droq->max_count *
299− OCT_DROQ_INFO_SIZE),
300− &droq->info_alloc_size,
301− &droq->info_base_addr,
302− numa_node);
289+ droq->info_list = lio_alloc_info_buffer(oct, droq);
303290 if (!droq->info_list) {
304291 dev_err(&oct->pci_dev->dev, "Cannot allocate memory for info list.\n");
305292 lio_dma_free(oct, (droq->max_count * OCT_DROQ_DESC_SIZE),
drivers/net/ethernet/cavium/liquidio/octeon_droq.h+2−2
@@ -325,10 +325,10 @@ struct octeon_droq { · 324 unmodified lines
325325 size_t desc_ring_dma;
326326
327327 /** Info ptr list are allocated at this virtual address. */
328− size_t info_base_addr;
328+ void *info_base_addr;
329329
330330 /** DMA mapped address of the info list */
331− size_t info_list_dma;
331+ dma_addr_t info_list_dma;
332332
333333 /** Allocated size of info list. */
334334 u32 info_alloc_size;
drivers/net/ethernet/cavium/liquidio/octeon_main.h+0−42
@@ -140,48 +140,6 @@ err_release_region: · 139 unmodified lines
140140 return 1;
141141 }
142142
143−static inline void *
144−cnnic_numa_alloc_aligned_dma(u32 size,
145− u32 *alloc_size,
146− size_t *orig_ptr,
147− int numa_node)
148−{
149− int retries = 0;
150− void *ptr = NULL;
151−
152−#define OCTEON_MAX_ALLOC_RETRIES 1
153− do {
154− struct page *page = NULL;
155−
156− page = alloc_pages_node(numa_node,
157− GFP_KERNEL,
158− get_order(size));
159− if (!page)
160− page = alloc_pages(GFP_KERNEL,
161− get_order(size));
162− ptr = (void *)page_address(page);
163− if ((unsigned long)ptr & 0x07) {
164− __free_pages(page, get_order(size));
165− ptr = NULL;
166− /* Increment the size required if the first
167− * attempt failed.
168− */
169− if (!retries)
170− size += 7;
171− }
172− retries++;
173− } while ((retries <= OCTEON_MAX_ALLOC_RETRIES) && !ptr);
174−
175− *alloc_size = size;
176− *orig_ptr = (unsigned long)ptr;
177− if ((unsigned long)ptr & 0x07)
178− ptr = (void *)(((unsigned long)ptr + 7) & ~(7UL));
179− return ptr;
180−}
181−
182−#define cnnic_free_aligned_dma(pci_dev, ptr, size, orig_ptr, dma_addr) \
183− free_pages(orig_ptr, get_order(size))
184−
185143 static inline int
186144 sleep_cond(wait_queue_head_t *wait_queue, int *condition)
187145 {
drivers/net/ethernet/cavium/liquidio/octeon_network.h+27−16
@@ -62,6 +62,9 @@ struct lio { · 61 unmodified lines
6262
6363 /** Array of gather component linked lists */
6464 struct list_head *glist;
65+ void **glists_virt_base;
66+ dma_addr_t *glists_dma_base;
67+ u32 glist_entry_size;
6568
6669 /** Pointer to the NIC properties for the Octeon device this network
6770 * interface is associated with.
@@ -344,6 +347,29 @@ static inline void tx_buffer_free(void *buffer) · 276 unmodified lines
344347 #define lio_dma_free(oct, size, virt_addr, dma_addr) \
345348 dma_free_coherent(&(oct)->pci_dev->dev, size, virt_addr, dma_addr)
346349
350+static inline void *
351+lio_alloc_info_buffer(struct octeon_device *oct,
352+ struct octeon_droq *droq)
353+{
354+ void *virt_ptr;
355+
356+ virt_ptr = lio_dma_alloc(oct, (droq->max_count * OCT_DROQ_INFO_SIZE),
357+ &droq->info_list_dma);
358+ if (virt_ptr) {
359+ droq->info_alloc_size = droq->max_count * OCT_DROQ_INFO_SIZE;
360+ droq->info_base_addr = virt_ptr;
361+ }
362+
363+ return virt_ptr;
364+}
365+
366+static inline void lio_free_info_buffer(struct octeon_device *oct,
367+ struct octeon_droq *droq)
368+{
369+ lio_dma_free(oct, droq->info_alloc_size, droq->info_base_addr,
370+ droq->info_list_dma);
371+}
372+
347373 static inline
348374 void *get_rbd(struct sk_buff *skb)
349375 {
@@ -359,22 +385,7 @@ void *get_rbd(struct sk_buff *skb) · 9 unmodified lines
359385 static inline u64
360386 lio_map_ring_info(struct octeon_droq *droq, u32 i)
361387 {
362− dma_addr_t dma_addr;
363− struct octeon_device *oct = droq->oct_dev;
364−
365− dma_addr = dma_map_single(&oct->pci_dev->dev, &droq->info_list[i],
366− OCT_DROQ_INFO_SIZE, DMA_FROM_DEVICE);
367−
368− WARN_ON(dma_mapping_error(&oct->pci_dev->dev, dma_addr));
369−
370− return (u64)dma_addr;
371−}
372−
373−static inline void
374−lio_unmap_ring_info(struct pci_dev *pci_dev,
375− u64 info_ptr, u32 size)
376−{
377− dma_unmap_single(&pci_dev->dev, info_ptr, size, DMA_FROM_DEVICE);
388+ return droq->info_list_dma + (i * sizeof(struct octeon_droq_info));
378389 }
379390
380391 static inline u64
drivers/net/ethernet/cavium/thunder/nic.h+1−0
@@ -269,6 +269,7 @@ struct nicvf { · 268 unmodified lines
269269 #define MAX_QUEUES_PER_QSET 8
270270 struct queue_set *qs;
271271 struct nicvf_cq_poll *napi[8];
272+ void *iommu_domain;
272273 u8 vf_id;
273274 u8 sqs_id;
274275 bool sqs_mode;
drivers/net/ethernet/cavium/thunder/nicvf_main.c+11−1
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #include <linux/log2.h>
1717 #include <linux/prefetch.h>
1818 #include <linux/irq.h>
19+#include <linux/iommu.h>
1920
2021 #include "nic_reg.h"
2122 #include "nic.h"
@@ -525,7 +526,12 @@ static void nicvf_snd_pkt_handler(struct net_device *netdev, · 503 unmodified lines
525526 /* Get actual TSO descriptors and free them */
526527 tso_sqe =
527528 (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, hdr->rsvd2);
529+ nicvf_unmap_sndq_buffers(nic, sq, hdr->rsvd2,
530+ tso_sqe->subdesc_cnt);
528531 nicvf_put_sq_desc(sq, tso_sqe->subdesc_cnt + 1);
532+ } else {
533+ nicvf_unmap_sndq_buffers(nic, sq, cqe_tx->sqe_ptr,
534+ hdr->subdesc_cnt);
529535 }
530536 nicvf_put_sq_desc(sq, hdr->subdesc_cnt + 1);
531537 prefetch(skb);
@@ -576,6 +582,7 @@ static void nicvf_rcv_pkt_handler(struct net_device *netdev, · 44 unmodified lines
576582 {
577583 struct sk_buff *skb;
578584 struct nicvf *nic = netdev_priv(netdev);
585+ struct nicvf *snic = nic;
579586 int err = 0;
580587 int rq_idx;
581588
@@ -592,7 +599,7 @@ static void nicvf_rcv_pkt_handler(struct net_device *netdev, · 10 unmodified lines
592599 if (err && !cqe_rx->rb_cnt)
593600 return;
594601
595− skb = nicvf_get_rcv_skb(nic, cqe_rx);
602+ skb = nicvf_get_rcv_skb(snic, cqe_rx);
596603 if (!skb) {
597604 netdev_dbg(nic->netdev, "Packet not received\n");
598605 return;
@@ -1643,6 +1650,9 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 1044 unmodified lines
16431650 if (!pass1_silicon(nic->pdev))
16441651 nic->hw_tso = true;
16451652
1653+ /* Get iommu domain for iova to physical addr conversion */
1654+ nic->iommu_domain = iommu_get_domain_for_dev(dev);
1655+
16461656 pci_read_config_word(nic->pdev, PCI_SUBSYSTEM_ID, &sdevid);
16471657 if (sdevid == 0xA134)
16481658 nic->t88 = true;
drivers/net/ethernet/cavium/thunder/nicvf_queues.c+145−39
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 #include <linux/netdevice.h>
1111 #include <linux/ip.h>
1212 #include <linux/etherdevice.h>
13+#include <linux/iommu.h>
1314 #include <net/ip.h>
1415 #include <net/tso.h>
1516
@@ -18,6 +19,16 @@ · 2 unmodified lines
1819 #include "q_struct.h"
1920 #include "nicvf_queues.h"
2021
22+#define NICVF_PAGE_ORDER ((PAGE_SIZE <= 4096) ? PAGE_ALLOC_COSTLY_ORDER : 0)
23+
24+static inline u64 nicvf_iova_to_phys(struct nicvf *nic, dma_addr_t dma_addr)
25+{
26+ /* Translation is installed only when IOMMU is present */
27+ if (nic->iommu_domain)
28+ return iommu_iova_to_phys(nic->iommu_domain, dma_addr);
29+ return dma_addr;
30+}
31+
2132 static void nicvf_get_page(struct nicvf *nic)
2233 {
2334 if (!nic->rb_pageref || !nic->rb_page)
@@ -87,7 +98,7 @@ static void nicvf_free_q_desc_mem(struct nicvf *nic, struct q_desc_mem *dmem) · 63 unmodified lines
8798 static inline int nicvf_alloc_rcv_buffer(struct nicvf *nic, gfp_t gfp,
8899 u32 buf_len, u64 **rbuf)
89100 {
90− int order = (PAGE_SIZE <= 4096) ? PAGE_ALLOC_COSTLY_ORDER : 0;
101+ int order = NICVF_PAGE_ORDER;
91102
92103 /* Check if request can be accomodated in previous allocated page */
93104 if (nic->rb_page &&
@@ -97,22 +108,27 @@ static inline int nicvf_alloc_rcv_buffer(struct nicvf *nic, gfp_t gfp, · 3 unmodified lines
97108 }
98109
99110 nicvf_get_page(nic);
100− nic->rb_page = NULL;
101111
102112 /* Allocate a new page */
113+ nic->rb_page = alloc_pages(gfp | __GFP_COMP | __GFP_NOWARN,
114+ order);
103115 if (!nic->rb_page) {
104− nic->rb_page = alloc_pages(gfp | __GFP_COMP | __GFP_NOWARN,
105− order);
106− if (!nic->rb_page) {
107− this_cpu_inc(nic->pnicvf->drv_stats->
108− rcv_buffer_alloc_failures);
109− return -ENOMEM;
110− }
111− nic->rb_page_offset = 0;
116+ this_cpu_inc(nic->pnicvf->drv_stats->rcv_buffer_alloc_failures);
117+ return -ENOMEM;
112118 }
113−
119+ nic->rb_page_offset = 0;
114120 ret:
115− *rbuf = (u64 *)((u64)page_address(nic->rb_page) + nic->rb_page_offset);
121+ /* HW will ensure data coherency, CPU sync not required */
122+ *rbuf = (u64 *)((u64)dma_map_page_attrs(&nic->pdev->dev, nic->rb_page,
123+ nic->rb_page_offset, buf_len,
124+ DMA_FROM_DEVICE,
125+ DMA_ATTR_SKIP_CPU_SYNC));
126+ if (dma_mapping_error(&nic->pdev->dev, (dma_addr_t)*rbuf)) {
127+ if (!nic->rb_page_offset)
128+ __free_pages(nic->rb_page, order);
129+ nic->rb_page = NULL;
130+ return -ENOMEM;
131+ }
116132 nic->rb_page_offset += buf_len;
117133
118134 return 0;
@@ -158,16 +174,21 @@ static int nicvf_init_rbdr(struct nicvf *nic, struct rbdr *rbdr, · 39 unmodified lines
158174 rbdr->dma_size = buf_size;
159175 rbdr->enable = true;
160176 rbdr->thresh = RBDR_THRESH;
177+ rbdr->head = 0;
178+ rbdr->tail = 0;
161179
162180 nic->rb_page = NULL;
163181 for (idx = 0; idx < ring_len; idx++) {
164182 err = nicvf_alloc_rcv_buffer(nic, GFP_KERNEL, RCV_FRAG_LEN,
165183 &rbuf);
166− if (err)
184+ if (err) {
185+ /* To free already allocated and mapped ones */
186+ rbdr->tail = idx - 1;
167187 return err;
188+ }
168189
169190 desc = GET_RBDR_DESC(rbdr, idx);
170− desc->buf_addr = virt_to_phys(rbuf) >> NICVF_RCV_BUF_ALIGN;
191+ desc->buf_addr = (u64)rbuf >> NICVF_RCV_BUF_ALIGN;
171192 }
172193
173194 nicvf_get_page(nic);
@@ -179,7 +200,7 @@ static int nicvf_init_rbdr(struct nicvf *nic, struct rbdr *rbdr, · 5 unmodified lines
179200 static void nicvf_free_rbdr(struct nicvf *nic, struct rbdr *rbdr)
180201 {
181202 int head, tail;
182− u64 buf_addr;
203+ u64 buf_addr, phys_addr;
183204 struct rbdr_entry_t *desc;
184205
185206 if (!rbdr)
@@ -192,18 +213,26 @@ static void nicvf_free_rbdr(struct nicvf *nic, struct rbdr *rbdr) · 6 unmodified lines
192213 head = rbdr->head;
193214 tail = rbdr->tail;
194215
195− /* Free SKBs */
216+ /* Release page references */
196217 while (head != tail) {
197218 desc = GET_RBDR_DESC(rbdr, head);
198− buf_addr = desc->buf_addr << NICVF_RCV_BUF_ALIGN;
199− put_page(virt_to_page(phys_to_virt(buf_addr)));
219+ buf_addr = ((u64)desc->buf_addr) << NICVF_RCV_BUF_ALIGN;
220+ phys_addr = nicvf_iova_to_phys(nic, buf_addr);
221+ dma_unmap_page_attrs(&nic->pdev->dev, buf_addr, RCV_FRAG_LEN,
222+ DMA_FROM_DEVICE, DMA_ATTR_SKIP_CPU_SYNC);
223+ if (phys_addr)
224+ put_page(virt_to_page(phys_to_virt(phys_addr)));
200225 head++;
201226 head &= (rbdr->dmem.q_len - 1);
202227 }
203− /* Free SKB of tail desc */
228+ /* Release buffer of tail desc */
204229 desc = GET_RBDR_DESC(rbdr, tail);
205− buf_addr = desc->buf_addr << NICVF_RCV_BUF_ALIGN;
206− put_page(virt_to_page(phys_to_virt(buf_addr)));
230+ buf_addr = ((u64)desc->buf_addr) << NICVF_RCV_BUF_ALIGN;
231+ phys_addr = nicvf_iova_to_phys(nic, buf_addr);
232+ dma_unmap_page_attrs(&nic->pdev->dev, buf_addr, RCV_FRAG_LEN,
233+ DMA_FROM_DEVICE, DMA_ATTR_SKIP_CPU_SYNC);
234+ if (phys_addr)
235+ put_page(virt_to_page(phys_to_virt(phys_addr)));
207236
208237 /* Free RBDR ring */
209238 nicvf_free_q_desc_mem(nic, &rbdr->dmem);
@@ -250,7 +279,7 @@ refill: · 40 unmodified lines
250279 break;
251280
252281 desc = GET_RBDR_DESC(rbdr, tail);
253− desc->buf_addr = virt_to_phys(rbuf) >> NICVF_RCV_BUF_ALIGN;
282+ desc->buf_addr = (u64)rbuf >> NICVF_RCV_BUF_ALIGN;
254283 refill_rb_cnt--;
255284 new_rb++;
256285 }
@@ -361,9 +390,29 @@ static int nicvf_init_snd_queue(struct nicvf *nic, · 104 unmodified lines
361390 return 0;
362391 }
363392
393+void nicvf_unmap_sndq_buffers(struct nicvf *nic, struct snd_queue *sq,
394+ int hdr_sqe, u8 subdesc_cnt)
395+{
396+ u8 idx;
397+ struct sq_gather_subdesc *gather;
398+
399+ /* Unmap DMA mapped skb data buffers */
400+ for (idx = 0; idx < subdesc_cnt; idx++) {
401+ hdr_sqe++;
402+ hdr_sqe &= (sq->dmem.q_len - 1);
403+ gather = (struct sq_gather_subdesc *)GET_SQ_DESC(sq, hdr_sqe);
404+ /* HW will ensure data coherency, CPU sync not required */
405+ dma_unmap_page_attrs(&nic->pdev->dev, gather->addr,
406+ gather->size, DMA_TO_DEVICE,
407+ DMA_ATTR_SKIP_CPU_SYNC);
408+ }
409+}
410+
364411 static void nicvf_free_snd_queue(struct nicvf *nic, struct snd_queue *sq)
365412 {
366413 struct sk_buff *skb;
414+ struct sq_hdr_subdesc *hdr;
415+ struct sq_hdr_subdesc *tso_sqe;
367416
368417 if (!sq)
369418 return;
@@ -379,8 +428,22 @@ static void nicvf_free_snd_queue(struct nicvf *nic, struct snd_queue *sq) · 9 unmodified lines
379428 smp_rmb();
380429 while (sq->head != sq->tail) {
381430 skb = (struct sk_buff *)sq->skbuff[sq->head];
382− if (skb)
383− dev_kfree_skb_any(skb);
431+ if (!skb)
432+ goto next;
433+ hdr = (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, sq->head);
434+ /* Check for dummy descriptor used for HW TSO offload on 88xx */
435+ if (hdr->dont_send) {
436+ /* Get actual TSO descriptors and unmap them */
437+ tso_sqe =
438+ (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, hdr->rsvd2);
439+ nicvf_unmap_sndq_buffers(nic, sq, hdr->rsvd2,
440+ tso_sqe->subdesc_cnt);
441+ } else {
442+ nicvf_unmap_sndq_buffers(nic, sq, sq->head,
443+ hdr->subdesc_cnt);
444+ }
445+ dev_kfree_skb_any(skb);
446+next:
384447 sq->head++;
385448 sq->head &= (sq->dmem.q_len - 1);
386449 }
@@ -559,9 +622,11 @@ static void nicvf_rcv_queue_config(struct nicvf *nic, struct queue_set *qs, · 172 unmodified lines
559622 nicvf_send_msg_to_pf(nic, &mbx);
560623
561624 if (!nic->sqs_mode && (qidx == 0)) {
562− /* Enable checking L3/L4 length and TCP/UDP checksums */
625+ /* Enable checking L3/L4 length and TCP/UDP checksums
626+ * Also allow IPv6 pkts with zero UDP checksum.
627+ */
563628 nicvf_queue_reg_write(nic, NIC_QSET_RQ_GEN_CFG, 0,
564− (BIT(24) | BIT(23) | BIT(21)));
629+ (BIT(24) | BIT(23) | BIT(21) | BIT(20)));
565630 nicvf_config_vlan_stripping(nic, nic->netdev->features);
566631 }
567632
@@ -882,6 +947,14 @@ static inline int nicvf_get_sq_desc(struct snd_queue *sq, int desc_cnt) · 314 unmodified lines
882947 return qentry;
883948 }
884949
950+/* Rollback to previous tail pointer when descriptors not used */
951+static inline void nicvf_rollback_sq_desc(struct snd_queue *sq,
952+ int qentry, int desc_cnt)
953+{
954+ sq->tail = qentry;
955+ atomic_add(desc_cnt, &sq->free_cnt);
956+}
957+
885958 /* Free descriptor back to SQ for future use */
886959 void nicvf_put_sq_desc(struct snd_queue *sq, int desc_cnt)
887960 {
@@ -1207,8 +1280,9 @@ int nicvf_sq_append_skb(struct nicvf *nic, struct snd_queue *sq, · 319 unmodified lines
12071280 struct sk_buff *skb, u8 sq_num)
12081281 {
12091282 int i, size;
1210− int subdesc_cnt, tso_sqe = 0;
1283+ int subdesc_cnt, hdr_sqe = 0;
12111284 int qentry;
1285+ u64 dma_addr;
12121286
12131287 subdesc_cnt = nicvf_sq_subdesc_required(nic, skb);
12141288 if (subdesc_cnt > atomic_read(&sq->free_cnt))
@@ -1223,12 +1297,21 @@ int nicvf_sq_append_skb(struct nicvf *nic, struct snd_queue *sq, · 8 unmodified lines
12231297 /* Add SQ header subdesc */
12241298 nicvf_sq_add_hdr_subdesc(nic, sq, qentry, subdesc_cnt - 1,
12251299 skb, skb->len);
1226− tso_sqe = qentry;
1300+ hdr_sqe = qentry;
12271301
12281302 /* Add SQ gather subdescs */
12291303 qentry = nicvf_get_nxt_sqentry(sq, qentry);
12301304 size = skb_is_nonlinear(skb) ? skb_headlen(skb) : skb->len;
1231− nicvf_sq_add_gather_subdesc(sq, qentry, size, virt_to_phys(skb->data));
1305+ /* HW will ensure data coherency, CPU sync not required */
1306+ dma_addr = dma_map_page_attrs(&nic->pdev->dev, virt_to_page(skb->data),
1307+ offset_in_page(skb->data), size,
1308+ DMA_TO_DEVICE, DMA_ATTR_SKIP_CPU_SYNC);
1309+ if (dma_mapping_error(&nic->pdev->dev, dma_addr)) {
1310+ nicvf_rollback_sq_desc(sq, qentry, subdesc_cnt);
1311+ return 0;
1312+ }
1313+
1314+ nicvf_sq_add_gather_subdesc(sq, qentry, size, dma_addr);
12321315
12331316 /* Check for scattered buffer */
12341317 if (!skb_is_nonlinear(skb))
@@ -1241,15 +1324,26 @@ int nicvf_sq_append_skb(struct nicvf *nic, struct snd_queue *sq, · 6 unmodified lines
12411324
12421325 qentry = nicvf_get_nxt_sqentry(sq, qentry);
12431326 size = skb_frag_size(frag);
1244− nicvf_sq_add_gather_subdesc(sq, qentry, size,
1245− virt_to_phys(
1246− skb_frag_address(frag)));
1327+ dma_addr = dma_map_page_attrs(&nic->pdev->dev,
1328+ skb_frag_page(frag),
1329+ frag->page_offset, size,
1330+ DMA_TO_DEVICE,
1331+ DMA_ATTR_SKIP_CPU_SYNC);
1332+ if (dma_mapping_error(&nic->pdev->dev, dma_addr)) {
1333+ /* Free entire chain of mapped buffers
1334+ * here 'i' = frags mapped + above mapped skb->data
1335+ */
1336+ nicvf_unmap_sndq_buffers(nic, sq, hdr_sqe, i);
1337+ nicvf_rollback_sq_desc(sq, qentry, subdesc_cnt);
1338+ return 0;
1339+ }
1340+ nicvf_sq_add_gather_subdesc(sq, qentry, size, dma_addr);
12471341 }
12481342
12491343 doorbell:
12501344 if (nic->t88 && skb_shinfo(skb)->gso_size) {
12511345 qentry = nicvf_get_nxt_sqentry(sq, qentry);
1252− nicvf_sq_add_cqe_subdesc(sq, qentry, tso_sqe, skb);
1346+ nicvf_sq_add_cqe_subdesc(sq, qentry, hdr_sqe, skb);
12531347 }
12541348
12551349 nicvf_sq_doorbell(nic, skb, sq_num, subdesc_cnt);
@@ -1282,6 +1376,7 @@ struct sk_buff *nicvf_get_rcv_skb(struct nicvf *nic, struct cqe_rx_t *cqe_rx) · 26 unmodified lines
12821376 int offset;
12831377 u16 *rb_lens = NULL;
12841378 u64 *rb_ptrs = NULL;
1379+ u64 phys_addr;
12851380
12861381 rb_lens = (void *)cqe_rx + (3 * sizeof(u64));
12871382 /* Except 88xx pass1 on all other chips CQE_RX2_S is added to
@@ -1296,15 +1391,23 @@ struct sk_buff *nicvf_get_rcv_skb(struct nicvf *nic, struct cqe_rx_t *cqe_rx) · 8 unmodified lines
12961391 else
12971392 rb_ptrs = (void *)cqe_rx + (7 * sizeof(u64));
12981393
1299− netdev_dbg(nic->netdev, "%s rb_cnt %d rb0_ptr %llx rb0_sz %d\n",
1300− __func__, cqe_rx->rb_cnt, cqe_rx->rb0_ptr, cqe_rx->rb0_sz);
1301−
13021394 for (frag = 0; frag < cqe_rx->rb_cnt; frag++) {
13031395 payload_len = rb_lens[frag_num(frag)];
1396+ phys_addr = nicvf_iova_to_phys(nic, *rb_ptrs);
1397+ if (!phys_addr) {
1398+ if (skb)
1399+ dev_kfree_skb_any(skb);
1400+ return NULL;
1401+ }
1402+
13041403 if (!frag) {
13051404 /* First fragment */
1405+ dma_unmap_page_attrs(&nic->pdev->dev,
1406+ *rb_ptrs - cqe_rx->align_pad,
1407+ RCV_FRAG_LEN, DMA_FROM_DEVICE,
1408+ DMA_ATTR_SKIP_CPU_SYNC);
13061409 skb = nicvf_rb_ptr_to_skb(nic,
1307− *rb_ptrs - cqe_rx->align_pad,
1410+ phys_addr - cqe_rx->align_pad,
13081411 payload_len);
13091412 if (!skb)
13101413 return NULL;
@@ -1312,8 +1415,11 @@ struct sk_buff *nicvf_get_rcv_skb(struct nicvf *nic, struct cqe_rx_t *cqe_rx) · 1 unmodified line
13121415 skb_put(skb, payload_len);
13131416 } else {
13141417 /* Add fragments */
1315− page = virt_to_page(phys_to_virt(*rb_ptrs));
1316− offset = phys_to_virt(*rb_ptrs) - page_address(page);
1418+ dma_unmap_page_attrs(&nic->pdev->dev, *rb_ptrs,
1419+ RCV_FRAG_LEN, DMA_FROM_DEVICE,
1420+ DMA_ATTR_SKIP_CPU_SYNC);
1421+ page = virt_to_page(phys_to_virt(phys_addr));
1422+ offset = phys_to_virt(phys_addr) - page_address(page);
13171423 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page,
13181424 offset, payload_len, RCV_FRAG_LEN);
13191425 }
drivers/net/ethernet/cavium/thunder/nicvf_queues.h+3−1
@@ -87,7 +87,7 @@ · 86 unmodified lines
8787 #define RCV_BUF_COUNT (1ULL << (RBDR_SIZE + 13))
8888 #define MAX_RCV_BUF_COUNT (1ULL << (RBDR_SIZE6 + 13))
8989 #define RBDR_THRESH (RCV_BUF_COUNT / 2)
90−#define DMA_BUFFER_LEN 2048 /* In multiples of 128bytes */
90+#define DMA_BUFFER_LEN 1536 /* In multiples of 128bytes */
9191 #define RCV_FRAG_LEN (SKB_DATA_ALIGN(DMA_BUFFER_LEN + NET_SKB_PAD) + \
9292 SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
9393
@@ -301,6 +301,8 @@ struct queue_set { · 207 unmodified lines
301301
302302 #define CQ_ERR_MASK (CQ_WR_FULL | CQ_WR_DISABLE | CQ_WR_FAULT)
303303
304+void nicvf_unmap_sndq_buffers(struct nicvf *nic, struct snd_queue *sq,
305+ int hdr_sqe, u8 subdesc_cnt);
304306 void nicvf_config_vlan_stripping(struct nicvf *nic,
305307 netdev_features_t features);
306308 int nicvf_set_qset_resources(struct nicvf *nic);
drivers/net/ethernet/cavium/thunder/thunder_bgx.c+45−19
@@ -123,14 +123,44 @@ static int bgx_poll_reg(struct bgx *bgx, u8 lmac, u64 reg, u64 mask, bool zero) · 122 unmodified lines
123123 return 1;
124124 }
125125
126+static int max_bgx_per_node;
127+static void set_max_bgx_per_node(struct pci_dev *pdev)
128+{
129+ u16 sdevid;
130+
131+ if (max_bgx_per_node)
132+ return;
133+
134+ pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &sdevid);
135+ switch (sdevid) {
136+ case PCI_SUBSYS_DEVID_81XX_BGX:
137+ max_bgx_per_node = MAX_BGX_PER_CN81XX;
138+ break;
139+ case PCI_SUBSYS_DEVID_83XX_BGX:
140+ max_bgx_per_node = MAX_BGX_PER_CN83XX;
141+ break;
142+ case PCI_SUBSYS_DEVID_88XX_BGX:
143+ default:
144+ max_bgx_per_node = MAX_BGX_PER_CN88XX;
145+ break;
146+ }
147+}
148+
149+static struct bgx *get_bgx(int node, int bgx_idx)
150+{
151+ int idx = (node * max_bgx_per_node) + bgx_idx;
152+
153+ return bgx_vnic[idx];
154+}
155+
126156 /* Return number of BGX present in HW */
127157 unsigned bgx_get_map(int node)
128158 {
129159 int i;
130160 unsigned map = 0;
131161
132− for (i = 0; i < MAX_BGX_PER_NODE; i++) {
133− if (bgx_vnic[(node * MAX_BGX_PER_NODE) + i])
162+ for (i = 0; i < max_bgx_per_node; i++) {
163+ if (bgx_vnic[(node * max_bgx_per_node) + i])
134164 map |= (1 << i);
135165 }
136166
@@ -143,7 +173,7 @@ int bgx_get_lmac_count(int node, int bgx_idx) · 6 unmodified lines
143173 {
144174 struct bgx *bgx;
145175
146− bgx = bgx_vnic[(node * MAX_BGX_PER_NODE) + bgx_idx];
176+ bgx = get_bgx(node, bgx_idx);
147177 if (bgx)
148178 return bgx->lmac_count;
149179
@@ -158,7 +188,7 @@ void bgx_get_lmac_link_state(int node, int bgx_idx, int lmacid, void *status) · 8 unmodified lines
158188 struct bgx *bgx;
159189 struct lmac *lmac;
160190
161− bgx = bgx_vnic[(node * MAX_BGX_PER_NODE) + bgx_idx];
191+ bgx = get_bgx(node, bgx_idx);
162192 if (!bgx)
163193 return;
164194
@@ -172,7 +202,7 @@ EXPORT_SYMBOL(bgx_get_lmac_link_state); · 7 unmodified lines
172202
173203 const u8 *bgx_get_lmac_mac(int node, int bgx_idx, int lmacid)
174204 {
175− struct bgx *bgx = bgx_vnic[(node * MAX_BGX_PER_NODE) + bgx_idx];
205+ struct bgx *bgx = get_bgx(node, bgx_idx);
176206
177207 if (bgx)
178208 return bgx->lmac[lmacid].mac;
@@ -183,7 +213,7 @@ EXPORT_SYMBOL(bgx_get_lmac_mac); · 4 unmodified lines
183213
184214 void bgx_set_lmac_mac(int node, int bgx_idx, int lmacid, const u8 *mac)
185215 {
186− struct bgx *bgx = bgx_vnic[(node * MAX_BGX_PER_NODE) + bgx_idx];
216+ struct bgx *bgx = get_bgx(node, bgx_idx);
187217
188218 if (!bgx)
189219 return;
@@ -194,7 +224,7 @@ EXPORT_SYMBOL(bgx_set_lmac_mac); · 4 unmodified lines
194224
195225 void bgx_lmac_rx_tx_enable(int node, int bgx_idx, int lmacid, bool enable)
196226 {
197− struct bgx *bgx = bgx_vnic[(node * MAX_BGX_PER_NODE) + bgx_idx];
227+ struct bgx *bgx = get_bgx(node, bgx_idx);
198228 struct lmac *lmac;
199229 u64 cfg;
200230
@@ -217,7 +247,7 @@ EXPORT_SYMBOL(bgx_lmac_rx_tx_enable); · 16 unmodified lines
217247 void bgx_lmac_get_pfc(int node, int bgx_idx, int lmacid, void *pause)
218248 {
219249 struct pfc *pfc = (struct pfc *)pause;
220− struct bgx *bgx = bgx_vnic[(node * MAX_BGX_PER_CN88XX) + bgx_idx];
250+ struct bgx *bgx = get_bgx(node, bgx_idx);
221251 struct lmac *lmac;
222252 u64 cfg;
223253
@@ -237,7 +267,7 @@ EXPORT_SYMBOL(bgx_lmac_get_pfc); · 13 unmodified lines
237267 void bgx_lmac_set_pfc(int node, int bgx_idx, int lmacid, void *pause)
238268 {
239269 struct pfc *pfc = (struct pfc *)pause;
240− struct bgx *bgx = bgx_vnic[(node * MAX_BGX_PER_CN88XX) + bgx_idx];
270+ struct bgx *bgx = get_bgx(node, bgx_idx);
241271 struct lmac *lmac;
242272 u64 cfg;
243273
@@ -369,7 +399,7 @@ u64 bgx_get_rx_stats(int node, int bgx_idx, int lmac, int idx) · 125 unmodified lines
369399 {
370400 struct bgx *bgx;
371401
372− bgx = bgx_vnic[(node * MAX_BGX_PER_NODE) + bgx_idx];
402+ bgx = get_bgx(node, bgx_idx);
373403 if (!bgx)
374404 return 0;
375405
@@ -383,7 +413,7 @@ u64 bgx_get_tx_stats(int node, int bgx_idx, int lmac, int idx) · 7 unmodified lines
383413 {
384414 struct bgx *bgx;
385415
386− bgx = bgx_vnic[(node * MAX_BGX_PER_NODE) + bgx_idx];
416+ bgx = get_bgx(node, bgx_idx);
387417 if (!bgx)
388418 return 0;
389419
@@ -411,7 +441,7 @@ void bgx_lmac_internal_loopback(int node, int bgx_idx, · 21 unmodified lines
411441 struct lmac *lmac;
412442 u64 cfg;
413443
414− bgx = bgx_vnic[(node * MAX_BGX_PER_NODE) + bgx_idx];
444+ bgx = get_bgx(node, bgx_idx);
415445 if (!bgx)
416446 return;
417447
@@ -1011,12 +1041,6 @@ static void bgx_print_qlm_mode(struct bgx *bgx, u8 lmacid) · 593 unmodified lines
10111041 dev_info(dev, "%s: 40G_KR4\n", (char *)str);
10121042 break;
10131043 case BGX_MODE_QSGMII:
1014− if ((lmacid == 0) &&
1015− (bgx_get_lane2sds_cfg(bgx, lmac) != lmacid))
1016− return;
1017− if ((lmacid == 2) &&
1018− (bgx_get_lane2sds_cfg(bgx, lmac) == lmacid))
1019− return;
10201044 dev_info(dev, "%s: QSGMII\n", (char *)str);
10211045 break;
10221046 case BGX_MODE_RGMII:
@@ -1334,11 +1358,13 @@ static int bgx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 311 unmodified lines
13341358 goto err_release_regions;
13351359 }
13361360
1361+ set_max_bgx_per_node(pdev);
1362+
13371363 pci_read_config_word(pdev, PCI_DEVICE_ID, &sdevid);
13381364 if (sdevid != PCI_DEVICE_ID_THUNDER_RGX) {
13391365 bgx->bgx_id = (pci_resource_start(pdev,
13401366 PCI_CFG_REG_BAR_NUM) >> 24) & BGX_ID_MASK;
1341− bgx->bgx_id += nic_get_node_id(pdev) * MAX_BGX_PER_NODE;
1367+ bgx->bgx_id += nic_get_node_id(pdev) * max_bgx_per_node;
13421368 bgx->max_lmac = MAX_LMAC_PER_BGX;
13431369 bgx_vnic[bgx->bgx_id] = bgx;
13441370 } else {
drivers/net/ethernet/cavium/thunder/thunder_bgx.h+0−1
@@ -22,7 +22,6 @@ · 21 unmodified lines
2222 #define MAX_BGX_PER_CN88XX 2
2323 #define MAX_BGX_PER_CN81XX 3 /* 2 BGXs + 1 RGX */
2424 #define MAX_BGX_PER_CN83XX 4
25−#define MAX_BGX_PER_NODE 4
2625 #define MAX_LMAC_PER_BGX 4
2726 #define MAX_BGX_CHANS_PER_LMAC 16
2827 #define MAX_DMAC_PER_LMAC 8
drivers/net/ethernet/ibm/emac/core.c+17−8
@@ -2589,8 +2589,6 @@ static int emac_dt_mdio_probe(struct emac_instance *dev) · 2588 unmodified lines
25892589 static int emac_dt_phy_connect(struct emac_instance *dev,
25902590 struct device_node *phy_handle)
25912591 {
2592− int res;
2593−
25942592 dev->phy.def = devm_kzalloc(&dev->ofdev->dev, sizeof(*dev->phy.def),
25952593 GFP_KERNEL);
25962594 if (!dev->phy.def)
@@ -2617,7 +2615,7 @@ static int emac_dt_phy_probe(struct emac_instance *dev) · 20 unmodified lines
26172615 {
26182616 struct device_node *np = dev->ofdev->dev.of_node;
26192617 struct device_node *phy_handle;
2620− int res = 0;
2618+ int res = 1;
26212619
26222620 phy_handle = of_parse_phandle(np, "phy-handle", 0);
26232621
@@ -2714,13 +2712,24 @@ static int emac_init_phy(struct emac_instance *dev) · 90 unmodified lines
27142712 if (emac_has_feature(dev, EMAC_FTR_HAS_RGMII)) {
27152713 int res = emac_dt_phy_probe(dev);
27162714
2717− mutex_unlock(&emac_phy_map_lock);
2718− if (!res)
2715+ switch (res) {
2716+ case 1:
2717+ /* No phy-handle property configured.
2718+ * Continue with the existing phy probe
2719+ * and setup code.
2720+ */
2721+ break;
2722+
2723+ case 0:
2724+ mutex_unlock(&emac_phy_map_lock);
27192725 goto init_phy;
27202726
2721− dev_err(&dev->ofdev->dev, "failed to attach dt phy (%d).\n",
2722− res);
2723− return res;
2727+ default:
2728+ mutex_unlock(&emac_phy_map_lock);
2729+ dev_err(&dev->ofdev->dev, "failed to attach dt phy (%d).\n",
2730+ res);
2731+ return res;
2732+ }
27242733 }
27252734
27262735 if (dev->phy_address != 0xffffffff)
drivers/net/ethernet/ibm/ibmvnic.c+34−9
@@ -404,7 +404,7 @@ static int ibmvnic_open(struct net_device *netdev) · 403 unmodified lines
404404 send_map_query(adapter);
405405 for (i = 0; i < rxadd_subcrqs; i++) {
406406 init_rx_pool(adapter, &adapter->rx_pool[i],
407− IBMVNIC_BUFFS_PER_POOL, i,
407+ adapter->req_rx_add_entries_per_subcrq, i,
408408 be64_to_cpu(size_array[i]), 1);
409409 if (alloc_rx_pool(adapter, &adapter->rx_pool[i])) {
410410 dev_err(dev, "Couldn't alloc rx pool\n");
@@ -419,23 +419,23 @@ static int ibmvnic_open(struct net_device *netdev) · 8 unmodified lines
419419 for (i = 0; i < tx_subcrqs; i++) {
420420 tx_pool = &adapter->tx_pool[i];
421421 tx_pool->tx_buff =
422− kcalloc(adapter->max_tx_entries_per_subcrq,
422+ kcalloc(adapter->req_tx_entries_per_subcrq,
423423 sizeof(struct ibmvnic_tx_buff), GFP_KERNEL);
424424 if (!tx_pool->tx_buff)
425425 goto tx_pool_alloc_failed;
426426
427427 if (alloc_long_term_buff(adapter, &tx_pool->long_term_buff,
428− adapter->max_tx_entries_per_subcrq *
428+ adapter->req_tx_entries_per_subcrq *
429429 adapter->req_mtu))
430430 goto tx_ltb_alloc_failed;
431431
432432 tx_pool->free_map =
433− kcalloc(adapter->max_tx_entries_per_subcrq,
433+ kcalloc(adapter->req_tx_entries_per_subcrq,
434434 sizeof(int), GFP_KERNEL);
435435 if (!tx_pool->free_map)
436436 goto tx_fm_alloc_failed;
437437
438− for (j = 0; j < adapter->max_tx_entries_per_subcrq; j++)
438+ for (j = 0; j < adapter->req_tx_entries_per_subcrq; j++)
439439 tx_pool->free_map[j] = j;
440440
441441 tx_pool->consumer_index = 0;
@@ -705,6 +705,7 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) · 263 unmodified lines
705705 u8 *hdrs = (u8 *)&adapter->tx_rx_desc_req;
706706 struct device *dev = &adapter->vdev->dev;
707707 struct ibmvnic_tx_buff *tx_buff = NULL;
708+ struct ibmvnic_sub_crq_queue *tx_scrq;
708709 struct ibmvnic_tx_pool *tx_pool;
709710 unsigned int tx_send_failed = 0;
710711 unsigned int tx_map_failed = 0;
@@ -724,6 +725,7 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) · 13 unmodified lines
724725 int ret = 0;
725726
726727 tx_pool = &adapter->tx_pool[queue_num];
728+ tx_scrq = adapter->tx_scrq[queue_num];
727729 txq = netdev_get_tx_queue(netdev, skb_get_queue_mapping(skb));
728730 handle_array = (u64 *)((u8 *)(adapter->login_rsp_buf) +
729731 be32_to_cpu(adapter->login_rsp_buf->
@@ -744,7 +746,7 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) · 14 unmodified lines
744746
745747 tx_pool->consumer_index =
746748 (tx_pool->consumer_index + 1) %
747− adapter->max_tx_entries_per_subcrq;
749+ adapter->req_tx_entries_per_subcrq;
748750
749751 tx_buff = &tx_pool->tx_buff[index];
750752 tx_buff->skb = skb;
@@ -817,7 +819,7 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) · 66 unmodified lines
817819
818820 if (tx_pool->consumer_index == 0)
819821 tx_pool->consumer_index =
820− adapter->max_tx_entries_per_subcrq - 1;
822+ adapter->req_tx_entries_per_subcrq - 1;
821823 else
822824 tx_pool->consumer_index--;
823825
@@ -826,6 +828,14 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) · 2 unmodified lines
826828 ret = NETDEV_TX_BUSY;
827829 goto out;
828830 }
831+
832+ atomic_inc(&tx_scrq->used);
833+
834+ if (atomic_read(&tx_scrq->used) >= adapter->req_tx_entries_per_subcrq) {
835+ netdev_info(netdev, "Stopping queue %d\n", queue_num);
836+ netif_stop_subqueue(netdev, queue_num);
837+ }
838+
829839 tx_packets++;
830840 tx_bytes += skb->len;
831841 txq->trans_start = jiffies;
@@ -1213,6 +1223,7 @@ static struct ibmvnic_sub_crq_queue *init_sub_crq_queue(struct ibmvnic_adapter · 381 unmodified lines
12131223 scrq->adapter = adapter;
12141224 scrq->size = 4 * PAGE_SIZE / sizeof(*scrq->msgs);
12151225 scrq->cur = 0;
1226+ atomic_set(&scrq->used, 0);
12161227 scrq->rx_skb_top = NULL;
12171228 spin_lock_init(&scrq->lock);
12181229
@@ -1355,14 +1366,28 @@ restart_loop: · 136 unmodified lines
13551366 DMA_TO_DEVICE);
13561367 }
13571368
1358− if (txbuff->last_frag)
1369+ if (txbuff->last_frag) {
1370+ atomic_dec(&scrq->used);
1371+
1372+ if (atomic_read(&scrq->used) <=
1373+ (adapter->req_tx_entries_per_subcrq / 2) &&
1374+ netif_subqueue_stopped(adapter->netdev,
1375+ txbuff->skb)) {
1376+ netif_wake_subqueue(adapter->netdev,
1377+ scrq->pool_index);
1378+ netdev_dbg(adapter->netdev,
1379+ "Started queue %d\n",
1380+ scrq->pool_index);
1381+ }
1382+
13591383 dev_kfree_skb_any(txbuff->skb);
1384+ }
13601385
13611386 adapter->tx_pool[pool].free_map[adapter->tx_pool[pool].
13621387 producer_index] = index;
13631388 adapter->tx_pool[pool].producer_index =
13641389 (adapter->tx_pool[pool].producer_index + 1) %
1365− adapter->max_tx_entries_per_subcrq;
1390+ adapter->req_tx_entries_per_subcrq;
13661391 }
13671392 /* remove tx_comp scrq*/
13681393 next->tx_comp.first = 0;
drivers/net/ethernet/ibm/ibmvnic.h+1−0
@@ -863,6 +863,7 @@ struct ibmvnic_sub_crq_queue { · 862 unmodified lines
863863 spinlock_t lock;
864864 struct sk_buff *rx_skb_top;
865865 struct ibmvnic_adapter *adapter;
866+ atomic_t used;
866867 };
867868
868869 struct ibmvnic_long_term_buff {
drivers/net/ethernet/mellanox/mlx5/core/Kconfig+1−0
@@ -14,6 +14,7 @@ config MLX5_CORE · 13 unmodified lines
1414 config MLX5_CORE_EN
1515 bool "Mellanox Technologies ConnectX-4 Ethernet support"
1616 depends on NETDEVICES && ETHERNET && PCI && MLX5_CORE
17+ depends on IPV6=y || IPV6=n || MLX5_CORE=m
1718 imply PTP_1588_CLOCK
1819 default n
1920 ---help---
drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c+5−5
@@ -302,6 +302,9 @@ static u8 mlx5e_dcbnl_setdcbx(struct net_device *dev, u8 mode) · 301 unmodified lines
302302 struct mlx5e_priv *priv = netdev_priv(dev);
303303 struct mlx5e_dcbx *dcbx = &priv->dcbx;
304304
305+ if (mode & DCB_CAP_DCBX_LLD_MANAGED)
306+ return 1;
307+
305308 if ((!mode) && MLX5_CAP_GEN(priv->mdev, dcbx)) {
306309 if (dcbx->mode == MLX5E_DCBX_PARAM_VER_OPER_AUTO)
307310 return 0;
@@ -315,13 +318,10 @@ static u8 mlx5e_dcbnl_setdcbx(struct net_device *dev, u8 mode) · 7 unmodified lines
315318 return 1;
316319 }
317320
318− if (mlx5e_dcbnl_switch_to_host_mode(netdev_priv(dev)))
321+ if (!(mode & DCB_CAP_DCBX_HOST))
319322 return 1;
320323
321− if ((mode & DCB_CAP_DCBX_LLD_MANAGED) ||
322− !(mode & DCB_CAP_DCBX_VER_CEE) ||
323− !(mode & DCB_CAP_DCBX_VER_IEEE) ||
324− !(mode & DCB_CAP_DCBX_HOST))
324+ if (mlx5e_dcbnl_switch_to_host_mode(netdev_priv(dev)))
325325 return 1;
326326
327327 return 0;
drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c+1−4
@@ -204,9 +204,6 @@ mlx5e_test_loopback_validate(struct sk_buff *skb, · 203 unmodified lines
204204 struct iphdr *iph;
205205
206206 /* We are only going to peek, no need to clone the SKB */
207− if (skb->protocol != htons(ETH_P_IP))
208− goto out;
209−
210207 if (MLX5E_TEST_PKT_SIZE - ETH_HLEN > skb_headlen(skb))
211208 goto out;
212209
@@ -249,7 +246,7 @@ static int mlx5e_test_loopback_setup(struct mlx5e_priv *priv, · 36 unmodified lines
249246 lbtp->loopback_ok = false;
250247 init_completion(&lbtp->comp);
251248
252− lbtp->pt.type = htons(ETH_P_ALL);
249+ lbtp->pt.type = htons(ETH_P_IP);
253250 lbtp->pt.func = mlx5e_test_loopback_validate;
254251 lbtp->pt.dev = priv->netdev;
255252 lbtp->pt.af_packet_priv = lbtp;
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c+18−15
@@ -48,9 +48,14 @@ · 47 unmodified lines
4848 #include "eswitch.h"
4949 #include "vxlan.h"
5050
51+enum {
52+ MLX5E_TC_FLOW_ESWITCH = BIT(0),
53+};
54+
5155 struct mlx5e_tc_flow {
5256 struct rhash_head node;
5357 u64 cookie;
58+ u8 flags;
5459 struct mlx5_flow_handle *rule;
5560 struct list_head encap; /* flows sharing the same encap */
5661 struct mlx5_esw_flow_attr *attr;
@@ -177,7 +182,7 @@ static void mlx5e_tc_del_flow(struct mlx5e_priv *priv, · 120 unmodified lines
177182 mlx5_fc_destroy(priv->mdev, counter);
178183 }
179184
180− if (esw && esw->mode == SRIOV_OFFLOADS) {
185+ if (flow->flags & MLX5E_TC_FLOW_ESWITCH) {
181186 mlx5_eswitch_del_vlan_action(esw, flow->attr);
182187 if (flow->attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP)
183188 mlx5e_detach_encap(priv, flow);
@@ -598,6 +603,7 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, · 414 unmodified lines
598603 }
599604
600605 static int parse_cls_flower(struct mlx5e_priv *priv,
606+ struct mlx5e_tc_flow *flow,
601607 struct mlx5_flow_spec *spec,
602608 struct tc_cls_flower_offload *f)
603609 {
@@ -609,7 +615,7 @@ static int parse_cls_flower(struct mlx5e_priv *priv, · 5 unmodified lines
609615
610616 err = __parse_cls_flower(priv, spec, f, &min_inline);
611617
612− if (!err && esw->mode == SRIOV_OFFLOADS &&
618+ if (!err && (flow->flags & MLX5E_TC_FLOW_ESWITCH) &&
613619 rep->vport != FDB_UPLINK_VPORT) {
614620 if (min_inline > esw->offloads.inline_mode) {
615621 netdev_warn(priv->netdev,
@@ -1132,23 +1138,19 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol, · 516 unmodified lines
11321138 struct tc_cls_flower_offload *f)
11331139 {
11341140 struct mlx5e_tc_table *tc = &priv->fs.tc;
1135− int err = 0;
1136− bool fdb_flow = false;
1141+ int err, attr_size = 0;
11371142 u32 flow_tag, action;
11381143 struct mlx5e_tc_flow *flow;
11391144 struct mlx5_flow_spec *spec;
11401145 struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
1146+ u8 flow_flags = 0;
11411147
1142− if (esw && esw->mode == SRIOV_OFFLOADS)
1143− fdb_flow = true;
1144−
1145− if (fdb_flow)
1146− flow = kzalloc(sizeof(*flow) +
1147− sizeof(struct mlx5_esw_flow_attr),
1148− GFP_KERNEL);
1149− else
1150− flow = kzalloc(sizeof(*flow), GFP_KERNEL);
1148+ if (esw && esw->mode == SRIOV_OFFLOADS) {
1149+ flow_flags = MLX5E_TC_FLOW_ESWITCH;
1150+ attr_size = sizeof(struct mlx5_esw_flow_attr);
1151+ }
11511152
1153+ flow = kzalloc(sizeof(*flow) + attr_size, GFP_KERNEL);
11521154 spec = mlx5_vzalloc(sizeof(*spec));
11531155 if (!spec || !flow) {
11541156 err = -ENOMEM;
@@ -1156,12 +1158,13 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol, · 1 unmodified line
11561158 }
11571159
11581160 flow->cookie = f->cookie;
1161+ flow->flags = flow_flags;
11591162
1160− err = parse_cls_flower(priv, spec, f);
1163+ err = parse_cls_flower(priv, flow, spec, f);
11611164 if (err < 0)
11621165 goto err_free;
11631166
1164− if (fdb_flow) {
1167+ if (flow->flags & MLX5E_TC_FLOW_ESWITCH) {
11651168 flow->attr = (struct mlx5_esw_flow_attr *)(flow + 1);
11661169 err = parse_tc_fdb_actions(priv, f->exts, flow);
11671170 if (err < 0)
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c+1−1
@@ -1136,7 +1136,7 @@ static struct mlx5_flow_group *create_autogroup(struct mlx5_flow_table *ft, · 1135 unmodified lines
11361136 u32 *match_criteria)
11371137 {
11381138 int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in);
1139− struct list_head *prev = ft->node.children.prev;
1139+ struct list_head *prev = &ft->node.children;
11401140 unsigned int candidate_index = 0;
11411141 struct mlx5_flow_group *fg;
11421142 void *match_criteria_addr;
drivers/net/ethernet/mellanox/mlx5/core/main.c+3−2
@@ -1352,6 +1352,7 @@ static int init_one(struct pci_dev *pdev, · 1351 unmodified lines
13521352 if (err)
13531353 goto clean_load;
13541354
1355+ pci_save_state(pdev);
13551356 return 0;
13561357
13571358 clean_load:
@@ -1407,9 +1408,8 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev, · 49 unmodified lines
14071408
14081409 mlx5_enter_error_state(dev);
14091410 mlx5_unload_one(dev, priv, false);
1410− /* In case of kernel call save the pci state and drain the health wq */
1411+ /* In case of kernel call drain the health wq */
14111412 if (state) {
1412− pci_save_state(pdev);
14131413 mlx5_drain_health_wq(dev);
14141414 mlx5_pci_disable_device(dev);
14151415 }
@@ -1461,6 +1461,7 @@ static pci_ers_result_t mlx5_pci_slot_reset(struct pci_dev *pdev) · 45 unmodified lines
14611461
14621462 pci_set_master(pdev);
14631463 pci_restore_state(pdev);
1464+ pci_save_state(pdev);
14641465
14651466 if (wait_vital(pdev)) {
14661467 dev_err(&pdev->dev, "%s: wait_vital timed out\n", __func__);
drivers/net/ethernet/mellanox/mlxsw/reg.h+2−2
@@ -769,7 +769,7 @@ static inline void mlxsw_reg_spvid_pack(char *payload, u8 local_port, u16 pvid) · 768 unmodified lines
769769 #define MLXSW_REG_SPVM_ID 0x200F
770770 #define MLXSW_REG_SPVM_BASE_LEN 0x04 /* base length, without records */
771771 #define MLXSW_REG_SPVM_REC_LEN 0x04 /* record length */
772−#define MLXSW_REG_SPVM_REC_MAX_COUNT 256
772+#define MLXSW_REG_SPVM_REC_MAX_COUNT 255
773773 #define MLXSW_REG_SPVM_LEN (MLXSW_REG_SPVM_BASE_LEN + \
774774 MLXSW_REG_SPVM_REC_LEN * MLXSW_REG_SPVM_REC_MAX_COUNT)
775775
@@ -1702,7 +1702,7 @@ static inline void mlxsw_reg_sfmr_pack(char *payload, · 926 unmodified lines
17021702 #define MLXSW_REG_SPVMLR_ID 0x2020
17031703 #define MLXSW_REG_SPVMLR_BASE_LEN 0x04 /* base length, without records */
17041704 #define MLXSW_REG_SPVMLR_REC_LEN 0x04 /* record length */
1705−#define MLXSW_REG_SPVMLR_REC_MAX_COUNT 256
1705+#define MLXSW_REG_SPVMLR_REC_MAX_COUNT 255
17061706 #define MLXSW_REG_SPVMLR_LEN (MLXSW_REG_SPVMLR_BASE_LEN + \
17071707 MLXSW_REG_SPVMLR_REC_LEN * \
17081708 MLXSW_REG_SPVMLR_REC_MAX_COUNT)
drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c+2−2
@@ -303,11 +303,11 @@ void mlxsw_sp_flower_destroy(struct mlxsw_sp_port *mlxsw_sp_port, bool ingress, · 302 unmodified lines
303303 ruleset = mlxsw_sp_acl_ruleset_get(mlxsw_sp, mlxsw_sp_port->dev,
304304 ingress,
305305 MLXSW_SP_ACL_PROFILE_FLOWER);
306− if (WARN_ON(IS_ERR(ruleset)))
306+ if (IS_ERR(ruleset))
307307 return;
308308
309309 rule = mlxsw_sp_acl_rule_lookup(mlxsw_sp, ruleset, f->cookie);
310− if (!WARN_ON(!rule)) {
310+ if (rule) {
311311 mlxsw_sp_acl_rule_del(mlxsw_sp, rule);
312312 mlxsw_sp_acl_rule_destroy(mlxsw_sp, rule);
313313 }
drivers/net/ethernet/qlogic/qed/qed_cxt.c+2−1
@@ -422,8 +422,9 @@ static void qed_cxt_set_proto_cid_count(struct qed_hwfn *p_hwfn, · 421 unmodified lines
422422 u32 page_sz = p_mgr->clients[ILT_CLI_CDUC].p_size.val;
423423 u32 cxt_size = CONN_CXT_SIZE(p_hwfn);
424424 u32 elems_per_page = ILT_PAGE_IN_BYTES(page_sz) / cxt_size;
425+ u32 align = elems_per_page * DQ_RANGE_ALIGN;
425426
426− p_conn->cid_count = roundup(p_conn->cid_count, elems_per_page);
427+ p_conn->cid_count = roundup(p_conn->cid_count, align);
427428 }
428429 }
429430
drivers/net/ethernet/qlogic/qed/qed_dev.c+2−3
@@ -2389,9 +2389,8 @@ qed_chain_alloc_sanity_check(struct qed_dev *cdev, · 2388 unmodified lines
23892389 * size/capacity fields are of a u32 type.
23902390 */
23912391 if ((cnt_type == QED_CHAIN_CNT_TYPE_U16 &&
2392− chain_size > 0x10000) ||
2393− (cnt_type == QED_CHAIN_CNT_TYPE_U32 &&
2394− chain_size > 0x100000000ULL)) {
2392+ chain_size > ((u32)U16_MAX + 1)) ||
2393+ (cnt_type == QED_CHAIN_CNT_TYPE_U32 && chain_size > U32_MAX)) {
23952394 DP_NOTICE(cdev,
23962395 "The actual chain size (0x%llx) is larger than the maximal possible value\n",
23972396 chain_size);
drivers/net/ethernet/qlogic/qed/qed_iscsi.c+31−0
@@ -190,6 +190,9 @@ qed_sp_iscsi_func_start(struct qed_hwfn *p_hwfn, · 189 unmodified lines
190190 p_init->num_sq_pages_in_ring = p_params->num_sq_pages_in_ring;
191191 p_init->num_r2tq_pages_in_ring = p_params->num_r2tq_pages_in_ring;
192192 p_init->num_uhq_pages_in_ring = p_params->num_uhq_pages_in_ring;
193+ p_init->ooo_enable = p_params->ooo_enable;
194+ p_init->ll2_rx_queue_id = p_hwfn->hw_info.resc_start[QED_LL2_QUEUE] +
195+ p_params->ll2_ooo_queue_id;
193196 p_init->func_params.log_page_size = p_params->log_page_size;
194197 val = p_params->num_tasks;
195198 p_init->func_params.num_tasks = cpu_to_le16(val);
@@ -786,6 +789,23 @@ static void qed_iscsi_release_connection(struct qed_hwfn *p_hwfn, · 590 unmodified lines
786789 spin_unlock_bh(&p_hwfn->p_iscsi_info->lock);
787790 }
788791
792+void qed_iscsi_free_connection(struct qed_hwfn *p_hwfn,
793+ struct qed_iscsi_conn *p_conn)
794+{
795+ qed_chain_free(p_hwfn->cdev, &p_conn->xhq);
796+ qed_chain_free(p_hwfn->cdev, &p_conn->uhq);
797+ qed_chain_free(p_hwfn->cdev, &p_conn->r2tq);
798+ dma_free_coherent(&p_hwfn->cdev->pdev->dev,
799+ sizeof(struct tcp_upload_params),
800+ p_conn->tcp_upload_params_virt_addr,
801+ p_conn->tcp_upload_params_phys_addr);
802+ dma_free_coherent(&p_hwfn->cdev->pdev->dev,
803+ sizeof(struct scsi_terminate_extra_params),
804+ p_conn->queue_cnts_virt_addr,
805+ p_conn->queue_cnts_phys_addr);
806+ kfree(p_conn);
807+}
808+
789809 struct qed_iscsi_info *qed_iscsi_alloc(struct qed_hwfn *p_hwfn)
790810 {
791811 struct qed_iscsi_info *p_iscsi_info;
@@ -807,6 +827,17 @@ void qed_iscsi_setup(struct qed_hwfn *p_hwfn, · 15 unmodified lines
807827 void qed_iscsi_free(struct qed_hwfn *p_hwfn,
808828 struct qed_iscsi_info *p_iscsi_info)
809829 {
830+ struct qed_iscsi_conn *p_conn = NULL;
831+
832+ while (!list_empty(&p_hwfn->p_iscsi_info->free_list)) {
833+ p_conn = list_first_entry(&p_hwfn->p_iscsi_info->free_list,
834+ struct qed_iscsi_conn, list_entry);
835+ if (p_conn) {
836+ list_del(&p_conn->list_entry);
837+ qed_iscsi_free_connection(p_hwfn, p_conn);
838+ }
839+ }
840+
810841 kfree(p_iscsi_info);
811842 }
812843
drivers/net/ethernet/qlogic/qed/qed_ll2.c+8−5
@@ -211,6 +211,8 @@ static void qed_ll2b_complete_rx_packet(struct qed_hwfn *p_hwfn, · 210 unmodified lines
211211 /* If need to reuse or there's no replacement buffer, repost this */
212212 if (rc)
213213 goto out_post;
214+ dma_unmap_single(&cdev->pdev->dev, buffer->phys_addr,
215+ cdev->ll2->rx_size, DMA_FROM_DEVICE);
214216
215217 skb = build_skb(buffer->data, 0);
216218 if (!skb) {
@@ -474,7 +476,7 @@ qed_ll2_rxq_completion_gsi(struct qed_hwfn *p_hwfn, · 257 unmodified lines
474476 static int qed_ll2_rxq_completion_reg(struct qed_hwfn *p_hwfn,
475477 struct qed_ll2_info *p_ll2_conn,
476478 union core_rx_cqe_union *p_cqe,
477− unsigned long lock_flags,
479+ unsigned long *p_lock_flags,
478480 bool b_last_cqe)
479481 {
480482 struct qed_ll2_rx_queue *p_rx = &p_ll2_conn->rx_queue;
@@ -495,10 +497,10 @@ static int qed_ll2_rxq_completion_reg(struct qed_hwfn *p_hwfn, · 14 unmodified lines
495497 "Mismatch between active_descq and the LL2 Rx chain\n");
496498 list_add_tail(&p_pkt->list_entry, &p_rx->free_descq);
497499
498− spin_unlock_irqrestore(&p_rx->lock, lock_flags);
500+ spin_unlock_irqrestore(&p_rx->lock, *p_lock_flags);
499501 qed_ll2b_complete_rx_packet(p_hwfn, p_ll2_conn->my_id,
500502 p_pkt, &p_cqe->rx_cqe_fp, b_last_cqe);
501− spin_lock_irqsave(&p_rx->lock, lock_flags);
503+ spin_lock_irqsave(&p_rx->lock, *p_lock_flags);
502504
503505 return 0;
504506 }
@@ -538,7 +540,8 @@ static int qed_ll2_rxq_completion(struct qed_hwfn *p_hwfn, void *cookie) · 33 unmodified lines
538540 break;
539541 case CORE_RX_CQE_TYPE_REGULAR:
540542 rc = qed_ll2_rxq_completion_reg(p_hwfn, p_ll2_conn,
541− cqe, flags, b_last_cqe);
543+ cqe, &flags,
544+ b_last_cqe);
542545 break;
543546 default:
544547 rc = -EIO;
@@ -968,7 +971,7 @@ static int qed_ll2_start_ooo(struct qed_dev *cdev, · 423 unmodified lines
968971 {
969972 struct qed_hwfn *hwfn = QED_LEADING_HWFN(cdev);
970973 u8 *handle = &hwfn->pf_params.iscsi_pf_params.ll2_ooo_queue_id;
971− struct qed_ll2_conn ll2_info;
974+ struct qed_ll2_conn ll2_info = { 0 };
972975 int rc;
973976
974977 ll2_info.conn_type = QED_LL2_TYPE_ISCSI_OOO;
drivers/net/ethernet/qlogic/qed/qed_ooo.c+2−0
@@ -159,6 +159,8 @@ struct qed_ooo_info *qed_ooo_alloc(struct qed_hwfn *p_hwfn) · 158 unmodified lines
159159 if (!p_ooo_info->ooo_history.p_cqes)
160160 goto no_history_mem;
161161
162+ p_ooo_info->ooo_history.num_of_cqes = QED_MAX_NUM_OOO_HISTORY_ENTRIES;
163+
162164 return p_ooo_info;
163165
164166 no_history_mem:
drivers/net/ethernet/qlogic/qlge/qlge.h+2−2
@@ -1162,8 +1162,8 @@ struct ob_mac_tso_iocb_rsp { · 1161 unmodified lines
11621162 struct ib_mac_iocb_rsp {
11631163 u8 opcode; /* 0x20 */
11641164 u8 flags1;
1165−#define IB_MAC_IOCB_RSP_OI 0x01 /* Overide intr delay */
1166−#define IB_MAC_IOCB_RSP_I 0x02 /* Disble Intr Generation */
1165+#define IB_MAC_IOCB_RSP_OI 0x01 /* Override intr delay */
1166+#define IB_MAC_IOCB_RSP_I 0x02 /* Disable Intr Generation */
11671167 #define IB_MAC_CSUM_ERR_MASK 0x1c /* A mask to use for csum errs */
11681168 #define IB_MAC_IOCB_RSP_TE 0x04 /* Checksum error */
11691169 #define IB_MAC_IOCB_RSP_NU 0x08 /* No checksum rcvd */
drivers/net/ethernet/smsc/smc91x.c+25−22
@@ -1535,32 +1535,33 @@ static int smc_close(struct net_device *dev) · 1534 unmodified lines
15351535 * Ethtool support
15361536 */
15371537 static int
1538−smc_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd)
1538+smc_ethtool_get_link_ksettings(struct net_device *dev,
1539+ struct ethtool_link_ksettings *cmd)
15391540 {
15401541 struct smc_local *lp = netdev_priv(dev);
15411542 int ret;
15421543
1543− cmd->maxtxpkt = 1;
1544− cmd->maxrxpkt = 1;
1545−
15461544 if (lp->phy_type != 0) {
15471545 spin_lock_irq(&lp->lock);
1548− ret = mii_ethtool_gset(&lp->mii, cmd);
1546+ ret = mii_ethtool_get_link_ksettings(&lp->mii, cmd);
15491547 spin_unlock_irq(&lp->lock);
15501548 } else {
1551− cmd->supported = SUPPORTED_10baseT_Half |
1549+ u32 supported = SUPPORTED_10baseT_Half |
15521550 SUPPORTED_10baseT_Full |
15531551 SUPPORTED_TP | SUPPORTED_AUI;
15541552
15551553 if (lp->ctl_rspeed == 10)
1556− ethtool_cmd_speed_set(cmd, SPEED_10);
1554+ cmd->base.speed = SPEED_10;
15571555 else if (lp->ctl_rspeed == 100)
1558− ethtool_cmd_speed_set(cmd, SPEED_100);
1556+ cmd->base.speed = SPEED_100;
1557+
1558+ cmd->base.autoneg = AUTONEG_DISABLE;
1559+ cmd->base.port = 0;
1560+ cmd->base.duplex = lp->tcr_cur_mode & TCR_SWFDUP ?
1561+ DUPLEX_FULL : DUPLEX_HALF;
15591562
1560− cmd->autoneg = AUTONEG_DISABLE;
1561− cmd->transceiver = XCVR_INTERNAL;
1562− cmd->port = 0;
1563− cmd->duplex = lp->tcr_cur_mode & TCR_SWFDUP ? DUPLEX_FULL : DUPLEX_HALF;
1563+ ethtool_convert_legacy_u32_to_link_mode(
1564+ cmd->link_modes.supported, supported);
15641565
15651566 ret = 0;
15661567 }
@@ -1569,24 +1570,26 @@ smc_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd) · 2 unmodified lines
15691570 }
15701571
15711572 static int
1572−smc_ethtool_setsettings(struct net_device *dev, struct ethtool_cmd *cmd)
1573+smc_ethtool_set_link_ksettings(struct net_device *dev,
1574+ const struct ethtool_link_ksettings *cmd)
15731575 {
15741576 struct smc_local *lp = netdev_priv(dev);
15751577 int ret;
15761578
15771579 if (lp->phy_type != 0) {
15781580 spin_lock_irq(&lp->lock);
1579− ret = mii_ethtool_sset(&lp->mii, cmd);
1581+ ret = mii_ethtool_set_link_ksettings(&lp->mii, cmd);
15801582 spin_unlock_irq(&lp->lock);
15811583 } else {
1582− if (cmd->autoneg != AUTONEG_DISABLE ||
1583− cmd->speed != SPEED_10 ||
1584− (cmd->duplex != DUPLEX_HALF && cmd->duplex != DUPLEX_FULL) ||
1585− (cmd->port != PORT_TP && cmd->port != PORT_AUI))
1584+ if (cmd->base.autoneg != AUTONEG_DISABLE ||
1585+ cmd->base.speed != SPEED_10 ||
1586+ (cmd->base.duplex != DUPLEX_HALF &&
1587+ cmd->base.duplex != DUPLEX_FULL) ||
1588+ (cmd->base.port != PORT_TP && cmd->base.port != PORT_AUI))
15861589 return -EINVAL;
15871590
1588−// lp->port = cmd->port;
1589− lp->ctl_rfduplx = cmd->duplex == DUPLEX_FULL;
1591+// lp->port = cmd->base.port;
1592+ lp->ctl_rfduplx = cmd->base.duplex == DUPLEX_FULL;
15901593
15911594 // if (netif_running(dev))
15921595 // smc_set_port(dev);
@@ -1744,8 +1747,6 @@ static int smc_ethtool_seteeprom(struct net_device *dev, · 151 unmodified lines
17441747
17451748
17461749 static const struct ethtool_ops smc_ethtool_ops = {
1747− .get_settings = smc_ethtool_getsettings,
1748− .set_settings = smc_ethtool_setsettings,
17491750 .get_drvinfo = smc_ethtool_getdrvinfo,
17501751
17511752 .get_msglevel = smc_ethtool_getmsglevel,
@@ -1755,6 +1756,8 @@ static const struct ethtool_ops smc_ethtool_ops = { · 3 unmodified lines
17551756 .get_eeprom_len = smc_ethtool_geteeprom_len,
17561757 .get_eeprom = smc_ethtool_geteeprom,
17571758 .set_eeprom = smc_ethtool_seteeprom,
1759+ .get_link_ksettings = smc_ethtool_get_link_ksettings,
1760+ .set_link_ksettings = smc_ethtool_set_link_ksettings,
17581761 };
17591762
17601763 static const struct net_device_ops smc_netdev_ops = {
drivers/net/hyperv/hyperv_net.h+2−1
@@ -700,6 +700,8 @@ struct net_device_context { · 699 unmodified lines
700700
701701 u32 tx_checksum_mask;
702702
703+ u32 tx_send_table[VRSS_SEND_TAB_SIZE];
704+
703705 /* Ethtool settings */
704706 u8 duplex;
705707 u32 speed;
@@ -757,7 +759,6 @@ struct netvsc_device { · 51 unmodified lines
757759
758760 struct nvsp_message revoke_packet;
759761
760− u32 send_table[VRSS_SEND_TAB_SIZE];
761762 u32 max_chn;
762763 u32 num_chn;
763764 spinlock_t sc_lock; /* Protects num_sc_offered variable */
drivers/net/hyperv/netvsc.c+2−6
@@ -1136,15 +1136,11 @@ static void netvsc_receive(struct net_device *ndev, · 1135 unmodified lines
11361136 static void netvsc_send_table(struct hv_device *hdev,
11371137 struct nvsp_message *nvmsg)
11381138 {
1139− struct netvsc_device *nvscdev;
11401139 struct net_device *ndev = hv_get_drvdata(hdev);
1140+ struct net_device_context *net_device_ctx = netdev_priv(ndev);
11411141 int i;
11421142 u32 count, *tab;
11431143
1144− nvscdev = get_outbound_net_device(hdev);
1145− if (!nvscdev)
1146− return;
1147−
11481144 count = nvmsg->msg.v5_msg.send_table.count;
11491145 if (count != VRSS_SEND_TAB_SIZE) {
11501146 netdev_err(ndev, "Received wrong send-table size:%u\n", count);
@@ -1155,7 +1151,7 @@ static void netvsc_send_table(struct hv_device *hdev, · 4 unmodified lines
11551151 nvmsg->msg.v5_msg.send_table.offset);
11561152
11571153 for (i = 0; i < count; i++)
1158− nvscdev->send_table[i] = tab[i];
1154+ net_device_ctx->tx_send_table[i] = tab[i];
11591155 }
11601156
11611157 static void netvsc_send_vf(struct net_device_context *net_device_ctx,
drivers/net/hyperv/netvsc_drv.c+3−8
@@ -206,17 +206,15 @@ static u16 netvsc_select_queue(struct net_device *ndev, struct sk_buff *skb, · 205 unmodified lines
206206 void *accel_priv, select_queue_fallback_t fallback)
207207 {
208208 struct net_device_context *net_device_ctx = netdev_priv(ndev);
209− struct netvsc_device *nvsc_dev = net_device_ctx->nvdev;
209+ unsigned int num_tx_queues = ndev->real_num_tx_queues;
210210 struct sock *sk = skb->sk;
211211 int q_idx = sk_tx_queue_get(sk);
212212
213− if (q_idx < 0 || skb->ooo_okay ||
214− q_idx >= ndev->real_num_tx_queues) {
213+ if (q_idx < 0 || skb->ooo_okay || q_idx >= num_tx_queues) {
215214 u16 hash = __skb_tx_hash(ndev, skb, VRSS_SEND_TAB_SIZE);
216215 int new_idx;
217216
218− new_idx = nvsc_dev->send_table[hash]
219− % nvsc_dev->num_chn;
217+ new_idx = net_device_ctx->tx_send_table[hash] % num_tx_queues;
220218
221219 if (q_idx != new_idx && sk &&
222220 sk_fullsock(sk) && rcu_access_pointer(sk->sk_dst_cache))
@@ -225,9 +223,6 @@ static u16 netvsc_select_queue(struct net_device *ndev, struct sk_buff *skb, · 2 unmodified lines
225223 q_idx = new_idx;
226224 }
227225
228− if (unlikely(!nvsc_dev->chan_table[q_idx].channel))
229− q_idx = 0;
230−
231226 return q_idx;
232227 }
233228
drivers/net/phy/marvell.c+0−15
@@ -1883,17 +1883,6 @@ static int m88e1510_probe(struct phy_device *phydev) · 1882 unmodified lines
18831883 return m88e1510_hwmon_probe(phydev);
18841884 }
18851885
1886−static void marvell_remove(struct phy_device *phydev)
1887−{
1888−#ifdef CONFIG_HWMON
1889−
1890− struct marvell_priv *priv = phydev->priv;
1891−
1892− if (priv && priv->hwmon_dev)
1893− hwmon_device_unregister(priv->hwmon_dev);
1894−#endif
1895−}
1896−
18971886 static struct phy_driver marvell_drivers[] = {
18981887 {
18991888 .phy_id = MARVELL_PHY_ID_88E1101,
@@ -1974,7 +1963,6 @@ static struct phy_driver marvell_drivers[] = { · 74 unmodified lines
19741963 .features = PHY_GBIT_FEATURES,
19751964 .flags = PHY_HAS_INTERRUPT,
19761965 .probe = &m88e1121_probe,
1977− .remove = &marvell_remove,
19781966 .config_init = &m88e1121_config_init,
19791967 .config_aneg = &m88e1121_config_aneg,
19801968 .read_status = &marvell_read_status,
@@ -2087,7 +2075,6 @@ static struct phy_driver marvell_drivers[] = { · 106 unmodified lines
20872075 .features = PHY_GBIT_FEATURES | SUPPORTED_FIBRE,
20882076 .flags = PHY_HAS_INTERRUPT,
20892077 .probe = &m88e1510_probe,
2090− .remove = &marvell_remove,
20912078 .config_init = &m88e1510_config_init,
20922079 .config_aneg = &m88e1510_config_aneg,
20932080 .read_status = &marvell_read_status,
@@ -2109,7 +2096,6 @@ static struct phy_driver marvell_drivers[] = { · 15 unmodified lines
21092096 .features = PHY_GBIT_FEATURES,
21102097 .flags = PHY_HAS_INTERRUPT,
21112098 .probe = m88e1510_probe,
2112− .remove = &marvell_remove,
21132099 .config_init = &marvell_config_init,
21142100 .config_aneg = &m88e1510_config_aneg,
21152101 .read_status = &marvell_read_status,
@@ -2127,7 +2113,6 @@ static struct phy_driver marvell_drivers[] = { · 11 unmodified lines
21272113 .phy_id_mask = MARVELL_PHY_ID_MASK,
21282114 .name = "Marvell 88E1545",
21292115 .probe = m88e1510_probe,
2130− .remove = &marvell_remove,
21312116 .features = PHY_GBIT_FEATURES,
21322117 .flags = PHY_HAS_INTERRUPT,
21332118 .config_init = &marvell_config_init,
drivers/net/phy/phy_device.c+1−1
@@ -1864,7 +1864,7 @@ static struct phy_driver genphy_driver[] = { · 1863 unmodified lines
18641864 .phy_id = 0xffffffff,
18651865 .phy_id_mask = 0xffffffff,
18661866 .name = "Generic PHY",
1867− .soft_reset = genphy_soft_reset,
1867+ .soft_reset = genphy_no_soft_reset,
18681868 .config_init = genphy_config_init,
18691869 .features = PHY_GBIT_FEATURES | SUPPORTED_MII |
18701870 SUPPORTED_AUI | SUPPORTED_FIBRE |
drivers/net/phy/spi_ks8995.c+2−1
@@ -491,13 +491,14 @@ static int ks8995_probe(struct spi_device *spi) · 490 unmodified lines
491491 if (err)
492492 return err;
493493
494− ks->regs_attr.size = ks->chip->regs_size;
495494 memcpy(&ks->regs_attr, &ks8995_registers_attr, sizeof(ks->regs_attr));
495+ ks->regs_attr.size = ks->chip->regs_size;
496496
497497 err = ks8995_reset(ks);
498498 if (err)
499499 return err;
500500
501+ sysfs_attr_init(&ks->regs_attr.attr);
501502 err = sysfs_create_bin_file(&spi->dev.kobj, &ks->regs_attr);
502503 if (err) {
503504 dev_err(&spi->dev, "unable to create sysfs file, err=%d\n",
drivers/net/team/team.c+1−0
@@ -2072,6 +2072,7 @@ static int team_dev_type_check_change(struct net_device *dev, · 2071 unmodified lines
20722072 static void team_setup(struct net_device *dev)
20732073 {
20742074 ether_setup(dev);
2075+ dev->max_mtu = ETH_MAX_MTU;
20752076
20762077 dev->netdev_ops = &team_netdev_ops;
20772078 dev->ethtool_ops = &team_ethtool_ops;
drivers/net/tun.c+15−4
@@ -822,7 +822,18 @@ static void tun_net_uninit(struct net_device *dev) · 821 unmodified lines
822822 /* Net device open. */
823823 static int tun_net_open(struct net_device *dev)
824824 {
825+ struct tun_struct *tun = netdev_priv(dev);
826+ int i;
827+
825828 netif_tx_start_all_queues(dev);
829+
830+ for (i = 0; i < tun->numqueues; i++) {
831+ struct tun_file *tfile;
832+
833+ tfile = rtnl_dereference(tun->tfiles[i]);
834+ tfile->socket.sk->sk_write_space(tfile->socket.sk);
835+ }
836+
826837 return 0;
827838 }
828839
@@ -1103,9 +1114,10 @@ static unsigned int tun_chr_poll(struct file *file, poll_table *wait) · 274 unmodified lines
11031114 if (!skb_array_empty(&tfile->tx_array))
11041115 mask |= POLLIN | POLLRDNORM;
11051116
1106− if (sock_writeable(sk) ||
1107− (!test_and_set_bit(SOCKWQ_ASYNC_NOSPACE, &sk->sk_socket->flags) &&
1108− sock_writeable(sk)))
1117+ if (tun->dev->flags & IFF_UP &&
1118+ (sock_writeable(sk) ||
1119+ (!test_and_set_bit(SOCKWQ_ASYNC_NOSPACE, &sk->sk_socket->flags) &&
1120+ sock_writeable(sk))))
11091121 mask |= POLLOUT | POLLWRNORM;
11101122
11111123 if (tun->dev->reg_state != NETREG_REGISTERED)
@@ -2570,7 +2582,6 @@ static int __init tun_init(void) · 1458 unmodified lines
25702582 int ret = 0;
25712583
25722584 pr_info("%s, %s\n", DRV_DESCRIPTION, DRV_VERSION);
2573− pr_info("%s\n", DRV_COPYRIGHT);
25742585
25752586 ret = rtnl_link_register(&tun_link_ops);
25762587 if (ret) {
drivers/net/vrf.c+2−1
@@ -340,6 +340,7 @@ static netdev_tx_t is_ip_tx_frame(struct sk_buff *skb, struct net_device *dev) · 339 unmodified lines
340340
341341 static netdev_tx_t vrf_xmit(struct sk_buff *skb, struct net_device *dev)
342342 {
343+ int len = skb->len;
343344 netdev_tx_t ret = is_ip_tx_frame(skb, dev);
344345
345346 if (likely(ret == NET_XMIT_SUCCESS || ret == NET_XMIT_CN)) {
@@ -347,7 +348,7 @@ static netdev_tx_t vrf_xmit(struct sk_buff *skb, struct net_device *dev) · 1 unmodified line
347348
348349 u64_stats_update_begin(&dstats->syncp);
349350 dstats->tx_pkts++;
350− dstats->tx_bytes += skb->len;
351+ dstats->tx_bytes += len;
351352 u64_stats_update_end(&dstats->syncp);
352353 } else {
353354 this_cpu_inc(dev->dstats->tx_drps);
drivers/net/vxlan.c+40−33
@@ -2976,6 +2976,44 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev, · 2975 unmodified lines
29762976 return 0;
29772977 }
29782978
2979+static int __vxlan_dev_create(struct net *net, struct net_device *dev,
2980+ struct vxlan_config *conf)
2981+{
2982+ struct vxlan_net *vn = net_generic(net, vxlan_net_id);
2983+ struct vxlan_dev *vxlan = netdev_priv(dev);
2984+ int err;
2985+
2986+ err = vxlan_dev_configure(net, dev, conf, false);
2987+ if (err)
2988+ return err;
2989+
2990+ dev->ethtool_ops = &vxlan_ethtool_ops;
2991+
2992+ /* create an fdb entry for a valid default destination */
2993+ if (!vxlan_addr_any(&vxlan->default_dst.remote_ip)) {
2994+ err = vxlan_fdb_create(vxlan, all_zeros_mac,
2995+ &vxlan->default_dst.remote_ip,
2996+ NUD_REACHABLE | NUD_PERMANENT,
2997+ NLM_F_EXCL | NLM_F_CREATE,
2998+ vxlan->cfg.dst_port,
2999+ vxlan->default_dst.remote_vni,
3000+ vxlan->default_dst.remote_vni,
3001+ vxlan->default_dst.remote_ifindex,
3002+ NTF_SELF);
3003+ if (err)
3004+ return err;
3005+ }
3006+
3007+ err = register_netdevice(dev);
3008+ if (err) {
3009+ vxlan_fdb_delete_default(vxlan, vxlan->default_dst.remote_vni);
3010+ return err;
3011+ }
3012+
3013+ list_add(&vxlan->next, &vn->vxlan_list);
3014+ return 0;
3015+}
3016+
29793017 static int vxlan_nl2conf(struct nlattr *tb[], struct nlattr *data[],
29803018 struct net_device *dev, struct vxlan_config *conf,
29813019 bool changelink)
@@ -3172,8 +3210,6 @@ static int vxlan_nl2conf(struct nlattr *tb[], struct nlattr *data[], · 190 unmodified lines
31723210 static int vxlan_newlink(struct net *src_net, struct net_device *dev,
31733211 struct nlattr *tb[], struct nlattr *data[])
31743212 {
3175− struct vxlan_net *vn = net_generic(src_net, vxlan_net_id);
3176− struct vxlan_dev *vxlan = netdev_priv(dev);
31773213 struct vxlan_config conf;
31783214 int err;
31793215
@@ -3181,36 +3217,7 @@ static int vxlan_newlink(struct net *src_net, struct net_device *dev, · 1 unmodified line
31813217 if (err)
31823218 return err;
31833219
3184− err = vxlan_dev_configure(src_net, dev, &conf, false);
3185− if (err)
3186− return err;
3187−
3188− dev->ethtool_ops = &vxlan_ethtool_ops;
3189−
3190− /* create an fdb entry for a valid default destination */
3191− if (!vxlan_addr_any(&vxlan->default_dst.remote_ip)) {
3192− err = vxlan_fdb_create(vxlan, all_zeros_mac,
3193− &vxlan->default_dst.remote_ip,
3194− NUD_REACHABLE | NUD_PERMANENT,
3195− NLM_F_EXCL | NLM_F_CREATE,
3196− vxlan->cfg.dst_port,
3197− vxlan->default_dst.remote_vni,
3198− vxlan->default_dst.remote_vni,
3199− vxlan->default_dst.remote_ifindex,
3200− NTF_SELF);
3201− if (err)
3202− return err;
3203− }
3204−
3205− err = register_netdevice(dev);
3206− if (err) {
3207− vxlan_fdb_delete_default(vxlan, vxlan->default_dst.remote_vni);
3208− return err;
3209− }
3210−
3211− list_add(&vxlan->next, &vn->vxlan_list);
3212−
3213− return 0;
3220+ return __vxlan_dev_create(src_net, dev, &conf);
32143221 }
32153222
32163223 static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[],
@@ -3440,7 +3447,7 @@ struct net_device *vxlan_dev_create(struct net *net, const char *name, · 223 unmodified lines
34403447 if (IS_ERR(dev))
34413448 return dev;
34423449
3443− err = vxlan_dev_configure(net, dev, conf, false);
3450+ err = __vxlan_dev_create(net, dev, conf);
34443451 if (err < 0) {
34453452 free_netdev(dev);
34463453 return ERR_PTR(err);
drivers/net/wan/fsl_ucc_hdlc.c+2−2
@@ -381,8 +381,8 @@ static netdev_tx_t ucc_hdlc_tx(struct sk_buff *skb, struct net_device *dev) · 380 unmodified lines
381381 /* set bd status and length */
382382 bd_status = (bd_status & T_W_S) | T_R_S | T_I_S | T_L_S | T_TC_S;
383383
384− iowrite16be(bd_status, &bd->status);
385384 iowrite16be(skb->len, &bd->length);
385+ iowrite16be(bd_status, &bd->status);
386386
387387 /* Move to next BD in the ring */
388388 if (!(bd_status & T_W_S))
@@ -457,7 +457,7 @@ static int hdlc_rx_done(struct ucc_hdlc_private *priv, int rx_work_limit) · 68 unmodified lines
457457 struct sk_buff *skb;
458458 hdlc_device *hdlc = dev_to_hdlc(dev);
459459 struct qe_bd *bd;
460− u32 bd_status;
460+ u16 bd_status;
461461 u16 length, howmany = 0;
462462 u8 *bdbuffer;
463463 int i;
drivers/net/wimax/i2400m/usb.c+3−0
@@ -467,6 +467,9 @@ int i2400mu_probe(struct usb_interface *iface, · 466 unmodified lines
467467 struct i2400mu *i2400mu;
468468 struct usb_device *usb_dev = interface_to_usbdev(iface);
469469
470+ if (iface->cur_altsetting->desc.bNumEndpoints < 4)
471+ return -ENODEV;
472+
470473 if (usb_dev->speed != USB_SPEED_HIGH)
471474 dev_err(dev, "device not connected as high speed\n");
472475
drivers/net/xen-netback/interface.c+17−9
@@ -165,13 +165,17 @@ static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev) · 164 unmodified lines
165165 {
166166 struct xenvif *vif = netdev_priv(dev);
167167 struct xenvif_queue *queue = NULL;
168− unsigned int num_queues = vif->num_queues;
168+ unsigned int num_queues;
169169 u16 index;
170170 struct xenvif_rx_cb *cb;
171171
172172 BUG_ON(skb->dev != dev);
173173
174− /* Drop the packet if queues are not set up */
174+ /* Drop the packet if queues are not set up.
175+ * This handler should be called inside an RCU read section
176+ * so we don't need to enter it here explicitly.
177+ */
178+ num_queues = READ_ONCE(vif->num_queues);
175179 if (num_queues < 1)
176180 goto drop;
177181
@@ -222,18 +226,18 @@ static struct net_device_stats *xenvif_get_stats(struct net_device *dev) · 44 unmodified lines
222226 {
223227 struct xenvif *vif = netdev_priv(dev);
224228 struct xenvif_queue *queue = NULL;
229+ unsigned int num_queues;
225230 u64 rx_bytes = 0;
226231 u64 rx_packets = 0;
227232 u64 tx_bytes = 0;
228233 u64 tx_packets = 0;
229234 unsigned int index;
230235
231− spin_lock(&vif->lock);
232− if (vif->queues == NULL)
233− goto out;
236+ rcu_read_lock();
237+ num_queues = READ_ONCE(vif->num_queues);
234238
235239 /* Aggregate tx and rx stats from each queue */
236− for (index = 0; index < vif->num_queues; ++index) {
240+ for (index = 0; index < num_queues; ++index) {
237241 queue = &vif->queues[index];
238242 rx_bytes += queue->stats.rx_bytes;
239243 rx_packets += queue->stats.rx_packets;
@@ -241,8 +245,7 @@ static struct net_device_stats *xenvif_get_stats(struct net_device *dev) · 1 unmodified line
241245 tx_packets += queue->stats.tx_packets;
242246 }
243247
244−out:
245− spin_unlock(&vif->lock);
248+ rcu_read_unlock();
246249
247250 vif->dev->stats.rx_bytes = rx_bytes;
248251 vif->dev->stats.rx_packets = rx_packets;
@@ -378,10 +381,13 @@ static void xenvif_get_ethtool_stats(struct net_device *dev, · 129 unmodified lines
378381 struct ethtool_stats *stats, u64 * data)
379382 {
380383 struct xenvif *vif = netdev_priv(dev);
381− unsigned int num_queues = vif->num_queues;
384+ unsigned int num_queues;
382385 int i;
383386 unsigned int queue_index;
384387
388+ rcu_read_lock();
389+ num_queues = READ_ONCE(vif->num_queues);
390+
385391 for (i = 0; i < ARRAY_SIZE(xenvif_stats); i++) {
386392 unsigned long accum = 0;
387393 for (queue_index = 0; queue_index < num_queues; ++queue_index) {
@@ -390,6 +396,8 @@ static void xenvif_get_ethtool_stats(struct net_device *dev, · 2 unmodified lines
390396 }
391397 data[i] = accum;
392398 }
399+
400+ rcu_read_unlock();
393401 }
394402
395403 static void xenvif_get_strings(struct net_device *dev, u32 stringset, u8 * data)
drivers/net/xen-netback/netback.c+1−1
@@ -214,7 +214,7 @@ static void xenvif_fatal_tx_err(struct xenvif *vif) · 213 unmodified lines
214214 netdev_err(vif->dev, "fatal error; disabling device\n");
215215 vif->disabled = true;
216216 /* Disable the vif from queue 0's kthread */
217− if (vif->queues)
217+ if (vif->num_queues)
218218 xenvif_kick_thread(&vif->queues[0]);
219219 }
220220
drivers/net/xen-netback/xenbus.c+10−10
@@ -495,26 +495,26 @@ static void backend_disconnect(struct backend_info *be) · 494 unmodified lines
495495 struct xenvif *vif = be->vif;
496496
497497 if (vif) {
498+ unsigned int num_queues = vif->num_queues;
498499 unsigned int queue_index;
499− struct xenvif_queue *queues;
500500
501501 xen_unregister_watchers(vif);
502502 #ifdef CONFIG_DEBUG_FS
503503 xenvif_debugfs_delif(vif);
504504 #endif /* CONFIG_DEBUG_FS */
505505 xenvif_disconnect_data(vif);
506− for (queue_index = 0;
507− queue_index < vif->num_queues;
508− ++queue_index)
509− xenvif_deinit_queue(&vif->queues[queue_index]);
510506
511− spin_lock(&vif->lock);
512− queues = vif->queues;
507+ /* At this point some of the handlers may still be active
508+ * so we need to have additional synchronization here.
509+ */
513510 vif->num_queues = 0;
514− vif->queues = NULL;
515− spin_unlock(&vif->lock);
511+ synchronize_net();
516512
517− vfree(queues);
513+ for (queue_index = 0; queue_index < num_queues; ++queue_index)
514+ xenvif_deinit_queue(&vif->queues[queue_index]);
515+
516+ vfree(vif->queues);
517+ vif->queues = NULL;
518518
519519 xenvif_disconnect_ctrl(vif);
520520 }
drivers/pci/dwc/pci-exynos.c+4−4
@@ -132,10 +132,6 @@ static int exynos5440_pcie_get_mem_resources(struct platform_device *pdev, · 131 unmodified lines
132132 struct device *dev = pci->dev;
133133 struct resource *res;
134134
135− /* If using the PHY framework, doesn't need to get other resource */
136− if (ep->using_phy)
137− return 0;
138−
139135 ep->mem_res = devm_kzalloc(dev, sizeof(*ep->mem_res), GFP_KERNEL);
140136 if (!ep->mem_res)
141137 return -ENOMEM;
@@ -145,6 +141,10 @@ static int exynos5440_pcie_get_mem_resources(struct platform_device *pdev, · 3 unmodified lines
145141 if (IS_ERR(ep->mem_res->elbi_base))
146142 return PTR_ERR(ep->mem_res->elbi_base);
147143
144+ /* If using the PHY framework, doesn't need to get other resource */
145+ if (ep->using_phy)
146+ return 0;
147+
148148 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
149149 ep->mem_res->phy_base = devm_ioremap_resource(dev, res);
150150 if (IS_ERR(ep->mem_res->phy_base))
drivers/pci/pcie/aspm.c+2−3
@@ -478,7 +478,7 @@ static void aspm_calc_l1ss_info(struct pcie_link_state *link, · 477 unmodified lines
478478
479479 static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)
480480 {
481− struct pci_dev *child, *parent = link->pdev;
481+ struct pci_dev *child = link->downstream, *parent = link->pdev;
482482 struct pci_bus *linkbus = parent->subordinate;
483483 struct aspm_register_info upreg, dwreg;
484484
@@ -491,9 +491,7 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist) · 6 unmodified lines
491491
492492 /* Get upstream/downstream components' register state */
493493 pcie_get_aspm_reg(parent, &upreg);
494− child = pci_function_0(linkbus);
495494 pcie_get_aspm_reg(child, &dwreg);
496− link->downstream = child;
497495
498496 /*
499497 * If ASPM not supported, don't mess with the clocks and link,
@@ -800,6 +798,7 @@ static struct pcie_link_state *alloc_pcie_link_state(struct pci_dev *pdev) · 300 unmodified lines
800798 INIT_LIST_HEAD(&link->children);
801799 INIT_LIST_HEAD(&link->link);
802800 link->pdev = pdev;
801+ link->downstream = pci_function_0(pdev->subordinate);
803802
804803 /*
805804 * Root Ports and PCI/PCI-X to PCIe Bridges are roots of PCIe
drivers/pci/quirks.c+1−0
@@ -2174,6 +2174,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x005d, quirk_blacklist_vpd); · 2173 unmodified lines
21742174 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x005f, quirk_blacklist_vpd);
21752175 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC, PCI_ANY_ID,
21762176 quirk_blacklist_vpd);
2177+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_QLOGIC, 0x2261, quirk_blacklist_vpd);
21772178
21782179 /*
21792180 * For Broadcom 5706, 5708, 5709 rev. A nics, any read beyond the
drivers/pinctrl/qcom/pinctrl-msm.c+15−0
@@ -422,6 +422,20 @@ static int msm_gpio_direction_output(struct gpio_chip *chip, unsigned offset, in · 421 unmodified lines
422422 return 0;
423423 }
424424
425+static int msm_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
426+{
427+ struct msm_pinctrl *pctrl = gpiochip_get_data(chip);
428+ const struct msm_pingroup *g;
429+ u32 val;
430+
431+ g = &pctrl->soc->groups[offset];
432+
433+ val = readl(pctrl->regs + g->ctl_reg);
434+
435+ /* 0 = output, 1 = input */
436+ return val & BIT(g->oe_bit) ? 0 : 1;
437+}
438+
425439 static int msm_gpio_get(struct gpio_chip *chip, unsigned offset)
426440 {
427441 const struct msm_pingroup *g;
@@ -510,6 +524,7 @@ static void msm_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) · 82 unmodified lines
510524 static struct gpio_chip msm_gpio_template = {
511525 .direction_input = msm_gpio_direction_input,
512526 .direction_output = msm_gpio_direction_output,
527+ .get_direction = msm_gpio_get_direction,
513528 .get = msm_gpio_get,
514529 .set = msm_gpio_set,
515530 .request = gpiochip_generic_request,
drivers/pinctrl/uniphier/pinctrl-uniphier-ld11.c+6−6
@@ -390,22 +390,22 @@ static const struct pinctrl_pin_desc uniphier_ld11_pins[] = { · 389 unmodified lines
390390 UNIPHIER_PINCTRL_PIN(140, "AO1D0", 140,
391391 140, UNIPHIER_PIN_DRV_1BIT,
392392 140, UNIPHIER_PIN_PULL_DOWN),
393− UNIPHIER_PINCTRL_PIN(141, "TCON0", 141,
393+ UNIPHIER_PINCTRL_PIN(141, "AO1D1", 141,
394394 141, UNIPHIER_PIN_DRV_1BIT,
395395 141, UNIPHIER_PIN_PULL_DOWN),
396− UNIPHIER_PINCTRL_PIN(142, "TCON1", 142,
396+ UNIPHIER_PINCTRL_PIN(142, "AO1D2", 142,
397397 142, UNIPHIER_PIN_DRV_1BIT,
398398 142, UNIPHIER_PIN_PULL_DOWN),
399− UNIPHIER_PINCTRL_PIN(143, "TCON2", 143,
399+ UNIPHIER_PINCTRL_PIN(143, "XIRQ9", 143,
400400 143, UNIPHIER_PIN_DRV_1BIT,
401401 143, UNIPHIER_PIN_PULL_DOWN),
402− UNIPHIER_PINCTRL_PIN(144, "TCON3", 144,
402+ UNIPHIER_PINCTRL_PIN(144, "XIRQ10", 144,
403403 144, UNIPHIER_PIN_DRV_1BIT,
404404 144, UNIPHIER_PIN_PULL_DOWN),
405− UNIPHIER_PINCTRL_PIN(145, "TCON4", 145,
405+ UNIPHIER_PINCTRL_PIN(145, "XIRQ11", 145,
406406 145, UNIPHIER_PIN_DRV_1BIT,
407407 145, UNIPHIER_PIN_PULL_DOWN),
408− UNIPHIER_PINCTRL_PIN(146, "TCON5", 146,
408+ UNIPHIER_PINCTRL_PIN(146, "XIRQ13", 146,
409409 146, UNIPHIER_PIN_DRV_1BIT,
410410 146, UNIPHIER_PIN_PULL_DOWN),
411411 UNIPHIER_PINCTRL_PIN(147, "PWMA", 147,
drivers/platform/x86/asus-nb-wmi.c+2−47
@@ -103,15 +103,6 @@ static struct quirk_entry quirk_asus_x200ca = { · 102 unmodified lines
103103 .wapf = 2,
104104 };
105105
106−static struct quirk_entry quirk_no_rfkill = {
107− .no_rfkill = true,
108−};
109−
110−static struct quirk_entry quirk_no_rfkill_wapf4 = {
111− .wapf = 4,
112− .no_rfkill = true,
113−};
114−
115106 static struct quirk_entry quirk_asus_ux303ub = {
116107 .wmi_backlight_native = true,
117108 };
@@ -194,7 +185,7 @@ static const struct dmi_system_id asus_quirks[] = { · 76 unmodified lines
194185 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
195186 DMI_MATCH(DMI_PRODUCT_NAME, "X456UA"),
196187 },
197− .driver_data = &quirk_no_rfkill_wapf4,
188+ .driver_data = &quirk_asus_wapf4,
198189 },
199190 {
200191 .callback = dmi_matched,
@@ -203,7 +194,7 @@ static const struct dmi_system_id asus_quirks[] = { · 2 unmodified lines
203194 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
204195 DMI_MATCH(DMI_PRODUCT_NAME, "X456UF"),
205196 },
206− .driver_data = &quirk_no_rfkill_wapf4,
197+ .driver_data = &quirk_asus_wapf4,
207198 },
208199 {
209200 .callback = dmi_matched,
@@ -367,42 +358,6 @@ static const struct dmi_system_id asus_quirks[] = { · 157 unmodified lines
367358 },
368359 .driver_data = &quirk_asus_x200ca,
369360 },
370− {
371− .callback = dmi_matched,
372− .ident = "ASUSTeK COMPUTER INC. X555UB",
373− .matches = {
374− DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
375− DMI_MATCH(DMI_PRODUCT_NAME, "X555UB"),
376− },
377− .driver_data = &quirk_no_rfkill,
378− },
379− {
380− .callback = dmi_matched,
381− .ident = "ASUSTeK COMPUTER INC. N552VW",
382− .matches = {
383− DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
384− DMI_MATCH(DMI_PRODUCT_NAME, "N552VW"),
385− },
386− .driver_data = &quirk_no_rfkill,
387− },
388− {
389− .callback = dmi_matched,
390− .ident = "ASUSTeK COMPUTER INC. U303LB",
391− .matches = {
392− DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
393− DMI_MATCH(DMI_PRODUCT_NAME, "U303LB"),
394− },
395− .driver_data = &quirk_no_rfkill,
396− },
397− {
398− .callback = dmi_matched,
399− .ident = "ASUSTeK COMPUTER INC. Z550MA",
400− .matches = {
401− DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
402− DMI_MATCH(DMI_PRODUCT_NAME, "Z550MA"),
403− },
404− .driver_data = &quirk_no_rfkill,
405− },
406361 {
407362 .callback = dmi_matched,
408363 .ident = "ASUSTeK COMPUTER INC. UX303UB",
drivers/platform/x86/asus-wmi.c+17−5
@@ -159,6 +159,8 @@ MODULE_LICENSE("GPL"); · 158 unmodified lines
159159 #define USB_INTEL_XUSB2PR 0xD0
160160 #define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI 0x9c31
161161
162+static const char * const ashs_ids[] = { "ATK4001", "ATK4002", NULL };
163+
162164 struct bios_args {
163165 u32 arg0;
164166 u32 arg1;
@@ -2051,6 +2053,16 @@ static int asus_wmi_fan_init(struct asus_wmi *asus) · 1886 unmodified lines
20512053 return 0;
20522054 }
20532055
2056+static bool ashs_present(void)
2057+{
2058+ int i = 0;
2059+ while (ashs_ids[i]) {
2060+ if (acpi_dev_found(ashs_ids[i++]))
2061+ return true;
2062+ }
2063+ return false;
2064+}
2065+
20542066 /*
20552067 * WMI Driver
20562068 */
@@ -2095,7 +2107,11 @@ static int asus_wmi_add(struct platform_device *pdev) · 38 unmodified lines
20952107 if (err)
20962108 goto fail_leds;
20972109
2098− if (!asus->driver->quirks->no_rfkill) {
2110+ asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_WLAN, &result);
2111+ if (result & (ASUS_WMI_DSTS_PRESENCE_BIT | ASUS_WMI_DSTS_USER_BIT))
2112+ asus->driver->wlan_ctrl_by_user = 1;
2113+
2114+ if (!(asus->driver->wlan_ctrl_by_user && ashs_present())) {
20992115 err = asus_wmi_rfkill_init(asus);
21002116 if (err)
21012117 goto fail_rfkill;
@@ -2134,10 +2150,6 @@ static int asus_wmi_add(struct platform_device *pdev) · 32 unmodified lines
21342150 if (err)
21352151 goto fail_debugfs;
21362152
2137− asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_WLAN, &result);
2138− if (result & (ASUS_WMI_DSTS_PRESENCE_BIT | ASUS_WMI_DSTS_USER_BIT))
2139− asus->driver->wlan_ctrl_by_user = 1;
2140−
21412153 return 0;
21422154
21432155 fail_debugfs:
drivers/platform/x86/asus-wmi.h+0−1
@@ -39,7 +39,6 @@ struct key_entry; · 38 unmodified lines
3939 struct asus_wmi;
4040
4141 struct quirk_entry {
42− bool no_rfkill;
4342 bool hotplug_wireless;
4443 bool scalar_panel_brightness;
4544 bool store_backlight_power;
drivers/platform/x86/fujitsu-laptop.c+222−229
@@ -78,18 +78,18 @@ · 77 unmodified lines
7878
7979 #define FUJITSU_LCD_N_LEVELS 8
8080
81−#define ACPI_FUJITSU_CLASS "fujitsu"
82−#define ACPI_FUJITSU_HID "FUJ02B1"
83−#define ACPI_FUJITSU_DRIVER_NAME "Fujitsu laptop FUJ02B1 ACPI brightness driver"
84−#define ACPI_FUJITSU_DEVICE_NAME "Fujitsu FUJ02B1"
85−#define ACPI_FUJITSU_HOTKEY_HID "FUJ02E3"
86−#define ACPI_FUJITSU_HOTKEY_DRIVER_NAME "Fujitsu laptop FUJ02E3 ACPI hotkeys driver"
87−#define ACPI_FUJITSU_HOTKEY_DEVICE_NAME "Fujitsu FUJ02E3"
81+#define ACPI_FUJITSU_CLASS "fujitsu"
82+#define ACPI_FUJITSU_BL_HID "FUJ02B1"
83+#define ACPI_FUJITSU_BL_DRIVER_NAME "Fujitsu laptop FUJ02B1 ACPI brightness driver"
84+#define ACPI_FUJITSU_BL_DEVICE_NAME "Fujitsu FUJ02B1"
85+#define ACPI_FUJITSU_LAPTOP_HID "FUJ02E3"
86+#define ACPI_FUJITSU_LAPTOP_DRIVER_NAME "Fujitsu laptop FUJ02E3 ACPI hotkeys driver"
87+#define ACPI_FUJITSU_LAPTOP_DEVICE_NAME "Fujitsu FUJ02E3"
8888
8989 #define ACPI_FUJITSU_NOTIFY_CODE1 0x80
9090
9191 /* FUNC interface - command values */
92−#define FUNC_RFKILL 0x1000
92+#define FUNC_FLAGS 0x1000
9393 #define FUNC_LEDS 0x1001
9494 #define FUNC_BUTTONS 0x1002
9595 #define FUNC_BACKLIGHT 0x1004
@@ -97,6 +97,11 @@ · 1 unmodified line
9797 /* FUNC interface - responses */
9898 #define UNSUPPORTED_CMD 0x80000000
9999
100+/* FUNC interface - status flags */
101+#define FLAG_RFKILL 0x020
102+#define FLAG_LID 0x100
103+#define FLAG_DOCK 0x200
104+
100105 #if IS_ENABLED(CONFIG_LEDS_CLASS)
101106 /* FUNC interface - LED control */
102107 #define FUNC_LED_OFF 0x1
@@ -136,7 +141,7 @@ · 33 unmodified lines
136141 #endif
137142
138143 /* Device controlling the backlight and associated keys */
139−struct fujitsu_t {
144+struct fujitsu_bl {
140145 acpi_handle acpi_handle;
141146 struct acpi_device *dev;
142147 struct input_dev *input;
@@ -150,12 +155,12 @@ struct fujitsu_t { · 7 unmodified lines
150155 unsigned int brightness_level;
151156 };
152157
153−static struct fujitsu_t *fujitsu;
158+static struct fujitsu_bl *fujitsu_bl;
154159 static int use_alt_lcd_levels = -1;
155160 static int disable_brightness_adjust = -1;
156161
157−/* Device used to access other hotkeys on the laptop */
158−struct fujitsu_hotkey_t {
162+/* Device used to access hotkeys and other features on the laptop */
163+struct fujitsu_laptop {
159164 acpi_handle acpi_handle;
160165 struct acpi_device *dev;
161166 struct input_dev *input;
@@ -163,17 +168,15 @@ struct fujitsu_hotkey_t { · 1 unmodified line
163168 struct platform_device *pf_device;
164169 struct kfifo fifo;
165170 spinlock_t fifo_lock;
166− int rfkill_supported;
167− int rfkill_state;
171+ int flags_supported;
172+ int flags_state;
168173 int logolamp_registered;
169174 int kblamps_registered;
170175 int radio_led_registered;
171176 int eco_led_registered;
172177 };
173178
174−static struct fujitsu_hotkey_t *fujitsu_hotkey;
175−
176−static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event);
179+static struct fujitsu_laptop *fujitsu_laptop;
177180
178181 #if IS_ENABLED(CONFIG_LEDS_CLASS)
179182 static enum led_brightness logolamp_get(struct led_classdev *cdev);
@@ -222,8 +225,6 @@ static struct led_classdev eco_led = { · 42 unmodified lines
222225 static u32 dbg_level = 0x03;
223226 #endif
224227
225−static void acpi_fujitsu_notify(struct acpi_device *device, u32 event);
226−
227228 /* Fujitsu ACPI interface function */
228229
229230 static int call_fext_func(int cmd, int arg0, int arg1, int arg2)
@@ -239,7 +240,7 @@ static int call_fext_func(int cmd, int arg0, int arg1, int arg2) · 9 unmodified lines
239240 unsigned long long value;
240241 acpi_handle handle = NULL;
241242
242− status = acpi_get_handle(fujitsu_hotkey->acpi_handle, "FUNC", &handle);
243+ status = acpi_get_handle(fujitsu_laptop->acpi_handle, "FUNC", &handle);
243244 if (ACPI_FAILURE(status)) {
244245 vdbg_printk(FUJLAPTOP_DBG_ERROR,
245246 "FUNC interface is not present\n");
@@ -300,9 +301,9 @@ static int radio_led_set(struct led_classdev *cdev, · 54 unmodified lines
300301 enum led_brightness brightness)
301302 {
302303 if (brightness >= LED_FULL)
303− return call_fext_func(FUNC_RFKILL, 0x5, RADIO_LED_ON, RADIO_LED_ON);
304+ return call_fext_func(FUNC_FLAGS, 0x5, RADIO_LED_ON, RADIO_LED_ON);
304305 else
305− return call_fext_func(FUNC_RFKILL, 0x5, RADIO_LED_ON, 0x0);
306+ return call_fext_func(FUNC_FLAGS, 0x5, RADIO_LED_ON, 0x0);
306307 }
307308
308309 static int eco_led_set(struct led_classdev *cdev,
@@ -346,7 +347,7 @@ static enum led_brightness radio_led_get(struct led_classdev *cdev) · 37 unmodified lines
346347 {
347348 enum led_brightness brightness = LED_OFF;
348349
349− if (call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0) & RADIO_LED_ON)
350+ if (call_fext_func(FUNC_FLAGS, 0x4, 0x0, 0x0) & RADIO_LED_ON)
350351 brightness = LED_FULL;
351352
352353 return brightness;
@@ -373,10 +374,10 @@ static int set_lcd_level(int level) · 20 unmodified lines
373374 vdbg_printk(FUJLAPTOP_DBG_TRACE, "set lcd level via SBLL [%d]\n",
374375 level);
375376
376− if (level < 0 || level >= fujitsu->max_brightness)
377+ if (level < 0 || level >= fujitsu_bl->max_brightness)
377378 return -EINVAL;
378379
379− status = acpi_get_handle(fujitsu->acpi_handle, "SBLL", &handle);
380+ status = acpi_get_handle(fujitsu_bl->acpi_handle, "SBLL", &handle);
380381 if (ACPI_FAILURE(status)) {
381382 vdbg_printk(FUJLAPTOP_DBG_ERROR, "SBLL not present\n");
382383 return -ENODEV;
@@ -398,10 +399,10 @@ static int set_lcd_level_alt(int level) · 15 unmodified lines
398399 vdbg_printk(FUJLAPTOP_DBG_TRACE, "set lcd level via SBL2 [%d]\n",
399400 level);
400401
401− if (level < 0 || level >= fujitsu->max_brightness)
402+ if (level < 0 || level >= fujitsu_bl->max_brightness)
402403 return -EINVAL;
403404
404− status = acpi_get_handle(fujitsu->acpi_handle, "SBL2", &handle);
405+ status = acpi_get_handle(fujitsu_bl->acpi_handle, "SBL2", &handle);
405406 if (ACPI_FAILURE(status)) {
406407 vdbg_printk(FUJLAPTOP_DBG_ERROR, "SBL2 not present\n");
407408 return -ENODEV;
@@ -421,19 +422,19 @@ static int get_lcd_level(void) · 13 unmodified lines
421422
422423 vdbg_printk(FUJLAPTOP_DBG_TRACE, "get lcd level via GBLL\n");
423424
424− status =
425− acpi_evaluate_integer(fujitsu->acpi_handle, "GBLL", NULL, &state);
425+ status = acpi_evaluate_integer(fujitsu_bl->acpi_handle, "GBLL", NULL,
426+ &state);
426427 if (ACPI_FAILURE(status))
427428 return 0;
428429
429− fujitsu->brightness_level = state & 0x0fffffff;
430+ fujitsu_bl->brightness_level = state & 0x0fffffff;
430431
431432 if (state & 0x80000000)
432− fujitsu->brightness_changed = 1;
433+ fujitsu_bl->brightness_changed = 1;
433434 else
434− fujitsu->brightness_changed = 0;
435+ fujitsu_bl->brightness_changed = 0;
435436
436− return fujitsu->brightness_level;
437+ return fujitsu_bl->brightness_level;
437438 }
438439
439440 static int get_max_brightness(void)
@@ -443,14 +444,14 @@ static int get_max_brightness(void) · 3 unmodified lines
443444
444445 vdbg_printk(FUJLAPTOP_DBG_TRACE, "get max lcd level via RBLL\n");
445446
446− status =
447− acpi_evaluate_integer(fujitsu->acpi_handle, "RBLL", NULL, &state);
447+ status = acpi_evaluate_integer(fujitsu_bl->acpi_handle, "RBLL", NULL,
448+ &state);
448449 if (ACPI_FAILURE(status))
449450 return -1;
450451
451− fujitsu->max_brightness = state;
452+ fujitsu_bl->max_brightness = state;
452453
453− return fujitsu->max_brightness;
454+ return fujitsu_bl->max_brightness;
454455 }
455456
456457 /* Backlight device stuff */
@@ -483,7 +484,7 @@ static int bl_update_status(struct backlight_device *b) · 26 unmodified lines
483484 return ret;
484485 }
485486
486−static const struct backlight_ops fujitsubl_ops = {
487+static const struct backlight_ops fujitsu_bl_ops = {
487488 .get_brightness = bl_get_brightness,
488489 .update_status = bl_update_status,
489490 };
@@ -511,7 +512,7 @@ show_brightness_changed(struct device *dev, · 21 unmodified lines
511512
512513 int ret;
513514
514− ret = fujitsu->brightness_changed;
515+ ret = fujitsu_bl->brightness_changed;
515516 if (ret < 0)
516517 return ret;
517518
@@ -539,7 +540,7 @@ static ssize_t store_lcd_level(struct device *dev, · 21 unmodified lines
539540 int level, ret;
540541
541542 if (sscanf(buf, "%i", &level) != 1
542− || (level < 0 || level >= fujitsu->max_brightness))
543+ || (level < 0 || level >= fujitsu_bl->max_brightness))
543544 return -EINVAL;
544545
545546 if (use_alt_lcd_levels)
@@ -567,9 +568,9 @@ static ssize_t · 21 unmodified lines
567568 show_lid_state(struct device *dev,
568569 struct device_attribute *attr, char *buf)
569570 {
570− if (!(fujitsu_hotkey->rfkill_supported & 0x100))
571+ if (!(fujitsu_laptop->flags_supported & FLAG_LID))
571572 return sprintf(buf, "unknown\n");
572− if (fujitsu_hotkey->rfkill_state & 0x100)
573+ if (fujitsu_laptop->flags_state & FLAG_LID)
573574 return sprintf(buf, "open\n");
574575 else
575576 return sprintf(buf, "closed\n");
@@ -579,9 +580,9 @@ static ssize_t · 3 unmodified lines
579580 show_dock_state(struct device *dev,
580581 struct device_attribute *attr, char *buf)
581582 {
582− if (!(fujitsu_hotkey->rfkill_supported & 0x200))
583+ if (!(fujitsu_laptop->flags_supported & FLAG_DOCK))
583584 return sprintf(buf, "unknown\n");
584− if (fujitsu_hotkey->rfkill_state & 0x200)
585+ if (fujitsu_laptop->flags_state & FLAG_DOCK)
585586 return sprintf(buf, "docked\n");
586587 else
587588 return sprintf(buf, "undocked\n");
@@ -591,9 +592,9 @@ static ssize_t · 3 unmodified lines
591592 show_radios_state(struct device *dev,
592593 struct device_attribute *attr, char *buf)
593594 {
594− if (!(fujitsu_hotkey->rfkill_supported & 0x20))
595+ if (!(fujitsu_laptop->flags_supported & FLAG_RFKILL))
595596 return sprintf(buf, "unknown\n");
596− if (fujitsu_hotkey->rfkill_state & 0x20)
597+ if (fujitsu_laptop->flags_state & FLAG_RFKILL)
597598 return sprintf(buf, "on\n");
598599 else
599600 return sprintf(buf, "killed\n");
@@ -607,7 +608,7 @@ static DEVICE_ATTR(lid, 0444, show_lid_state, ignore_store); · 7 unmodified lines
607608 static DEVICE_ATTR(dock, 0444, show_dock_state, ignore_store);
608609 static DEVICE_ATTR(radios, 0444, show_radios_state, ignore_store);
609610
610−static struct attribute *fujitsupf_attributes[] = {
611+static struct attribute *fujitsu_pf_attributes[] = {
611612 &dev_attr_brightness_changed.attr,
612613 &dev_attr_max_brightness.attr,
613614 &dev_attr_lcd_level.attr,
@@ -617,11 +618,11 @@ static struct attribute *fujitsupf_attributes[] = { · 3 unmodified lines
617618 NULL
618619 };
619620
620−static struct attribute_group fujitsupf_attribute_group = {
621− .attrs = fujitsupf_attributes
621+static struct attribute_group fujitsu_pf_attribute_group = {
622+ .attrs = fujitsu_pf_attributes
622623 };
623624
624−static struct platform_driver fujitsupf_driver = {
625+static struct platform_driver fujitsu_pf_driver = {
625626 .driver = {
626627 .name = "fujitsu-laptop",
627628 }
@@ -630,39 +631,30 @@ static struct platform_driver fujitsupf_driver = { · 2 unmodified lines
630631 static void __init dmi_check_cb_common(const struct dmi_system_id *id)
631632 {
632633 pr_info("Identified laptop model '%s'\n", id->ident);
633− if (use_alt_lcd_levels == -1) {
634− if (acpi_has_method(NULL,
635− "\\_SB.PCI0.LPCB.FJEX.SBL2"))
636− use_alt_lcd_levels = 1;
637− else
638− use_alt_lcd_levels = 0;
639− vdbg_printk(FUJLAPTOP_DBG_TRACE, "auto-detected usealt as "
640− "%i\n", use_alt_lcd_levels);
641− }
642634 }
643635
644636 static int __init dmi_check_cb_s6410(const struct dmi_system_id *id)
645637 {
646638 dmi_check_cb_common(id);
647− fujitsu->keycode1 = KEY_SCREENLOCK; /* "Lock" */
648− fujitsu->keycode2 = KEY_HELP; /* "Mobility Center" */
639+ fujitsu_bl->keycode1 = KEY_SCREENLOCK; /* "Lock" */
640+ fujitsu_bl->keycode2 = KEY_HELP; /* "Mobility Center" */
649641 return 1;
650642 }
651643
652644 static int __init dmi_check_cb_s6420(const struct dmi_system_id *id)
653645 {
654646 dmi_check_cb_common(id);
655− fujitsu->keycode1 = KEY_SCREENLOCK; /* "Lock" */
656− fujitsu->keycode2 = KEY_HELP; /* "Mobility Center" */
647+ fujitsu_bl->keycode1 = KEY_SCREENLOCK; /* "Lock" */
648+ fujitsu_bl->keycode2 = KEY_HELP; /* "Mobility Center" */
657649 return 1;
658650 }
659651
660652 static int __init dmi_check_cb_p8010(const struct dmi_system_id *id)
661653 {
662654 dmi_check_cb_common(id);
663− fujitsu->keycode1 = KEY_HELP; /* "Support" */
664− fujitsu->keycode3 = KEY_SWITCHVIDEOMODE; /* "Presentation" */
665− fujitsu->keycode4 = KEY_WWW; /* "Internet" */
655+ fujitsu_bl->keycode1 = KEY_HELP; /* "Support" */
656+ fujitsu_bl->keycode3 = KEY_SWITCHVIDEOMODE; /* "Presentation" */
657+ fujitsu_bl->keycode4 = KEY_WWW; /* "Internet" */
666658 return 1;
667659 }
668660
@@ -693,7 +685,7 @@ static const struct dmi_system_id fujitsu_dmi_table[] __initconst = { · 24 unmodified lines
693685
694686 /* ACPI device for LCD brightness control */
695687
696−static int acpi_fujitsu_add(struct acpi_device *device)
688+static int acpi_fujitsu_bl_add(struct acpi_device *device)
697689 {
698690 int state = 0;
699691 struct input_dev *input;
@@ -702,22 +694,22 @@ static int acpi_fujitsu_add(struct acpi_device *device) · 2 unmodified lines
702694 if (!device)
703695 return -EINVAL;
704696
705− fujitsu->acpi_handle = device->handle;
706− sprintf(acpi_device_name(device), "%s", ACPI_FUJITSU_DEVICE_NAME);
697+ fujitsu_bl->acpi_handle = device->handle;
698+ sprintf(acpi_device_name(device), "%s", ACPI_FUJITSU_BL_DEVICE_NAME);
707699 sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS);
708− device->driver_data = fujitsu;
700+ device->driver_data = fujitsu_bl;
709701
710− fujitsu->input = input = input_allocate_device();
702+ fujitsu_bl->input = input = input_allocate_device();
711703 if (!input) {
712704 error = -ENOMEM;
713705 goto err_stop;
714706 }
715707
716− snprintf(fujitsu->phys, sizeof(fujitsu->phys),
708+ snprintf(fujitsu_bl->phys, sizeof(fujitsu_bl->phys),
717709 "%s/video/input0", acpi_device_hid(device));
718710
719711 input->name = acpi_device_name(device);
720− input->phys = fujitsu->phys;
712+ input->phys = fujitsu_bl->phys;
721713 input->id.bustype = BUS_HOST;
722714 input->id.product = 0x06;
723715 input->dev.parent = &device->dev;
@@ -730,7 +722,7 @@ static int acpi_fujitsu_add(struct acpi_device *device) · 6 unmodified lines
730722 if (error)
731723 goto err_free_input_dev;
732724
733− error = acpi_bus_update_power(fujitsu->acpi_handle, &state);
725+ error = acpi_bus_update_power(fujitsu_bl->acpi_handle, &state);
734726 if (error) {
735727 pr_err("Error reading power state\n");
736728 goto err_unregister_input_dev;
@@ -740,7 +732,7 @@ static int acpi_fujitsu_add(struct acpi_device *device) · 3 unmodified lines
740732 acpi_device_name(device), acpi_device_bid(device),
741733 !device->power.state ? "on" : "off");
742734
743− fujitsu->dev = device;
735+ fujitsu_bl->dev = device;
744736
745737 if (acpi_has_method(device->handle, METHOD_NAME__INI)) {
746738 vdbg_printk(FUJLAPTOP_DBG_INFO, "Invoking _INI\n");
@@ -750,6 +742,15 @@ static int acpi_fujitsu_add(struct acpi_device *device) · 3 unmodified lines
750742 pr_err("_INI Method failed\n");
751743 }
752744
745+ if (use_alt_lcd_levels == -1) {
746+ if (acpi_has_method(NULL, "\\_SB.PCI0.LPCB.FJEX.SBL2"))
747+ use_alt_lcd_levels = 1;
748+ else
749+ use_alt_lcd_levels = 0;
750+ vdbg_printk(FUJLAPTOP_DBG_TRACE, "auto-detected usealt as %i\n",
751+ use_alt_lcd_levels);
752+ }
753+
753754 /* do config (detect defaults) */
754755 use_alt_lcd_levels = use_alt_lcd_levels == 1 ? 1 : 0;
755756 disable_brightness_adjust = disable_brightness_adjust == 1 ? 1 : 0;
@@ -758,7 +759,7 @@ static int acpi_fujitsu_add(struct acpi_device *device) · 2 unmodified lines
758759 use_alt_lcd_levels, disable_brightness_adjust);
759760
760761 if (get_max_brightness() <= 0)
761− fujitsu->max_brightness = FUJITSU_LCD_N_LEVELS;
762+ fujitsu_bl->max_brightness = FUJITSU_LCD_N_LEVELS;
762763 get_lcd_level();
763764
764765 return 0;
@@ -772,38 +773,38 @@ err_stop: · 7 unmodified lines
772773 return error;
773774 }
774775
775−static int acpi_fujitsu_remove(struct acpi_device *device)
776+static int acpi_fujitsu_bl_remove(struct acpi_device *device)
776777 {
777− struct fujitsu_t *fujitsu = acpi_driver_data(device);
778− struct input_dev *input = fujitsu->input;
778+ struct fujitsu_bl *fujitsu_bl = acpi_driver_data(device);
779+ struct input_dev *input = fujitsu_bl->input;
779780
780781 input_unregister_device(input);
781782
782− fujitsu->acpi_handle = NULL;
783+ fujitsu_bl->acpi_handle = NULL;
783784
784785 return 0;
785786 }
786787
787788 /* Brightness notify */
788789
789−static void acpi_fujitsu_notify(struct acpi_device *device, u32 event)
790+static void acpi_fujitsu_bl_notify(struct acpi_device *device, u32 event)
790791 {
791792 struct input_dev *input;
792793 int keycode;
793794 int oldb, newb;
794795
795− input = fujitsu->input;
796+ input = fujitsu_bl->input;
796797
797798 switch (event) {
798799 case ACPI_FUJITSU_NOTIFY_CODE1:
799800 keycode = 0;
800− oldb = fujitsu->brightness_level;
801+ oldb = fujitsu_bl->brightness_level;
801802 get_lcd_level();
802− newb = fujitsu->brightness_level;
803+ newb = fujitsu_bl->brightness_level;
803804
804805 vdbg_printk(FUJLAPTOP_DBG_TRACE,
805806 "brightness button event [%i -> %i (%i)]\n",
806− oldb, newb, fujitsu->brightness_changed);
807+ oldb, newb, fujitsu_bl->brightness_changed);
807808
808809 if (oldb < newb) {
809810 if (disable_brightness_adjust != 1) {
@@ -840,7 +841,7 @@ static void acpi_fujitsu_notify(struct acpi_device *device, u32 event) · 30 unmodified lines
840841
841842 /* ACPI device for hotkey handling */
842843
843−static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
844+static int acpi_fujitsu_laptop_add(struct acpi_device *device)
844845 {
845846 int result = 0;
846847 int state = 0;
@@ -851,42 +852,42 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device) · 4 unmodified lines
851852 if (!device)
852853 return -EINVAL;
853854
854− fujitsu_hotkey->acpi_handle = device->handle;
855+ fujitsu_laptop->acpi_handle = device->handle;
855856 sprintf(acpi_device_name(device), "%s",
856− ACPI_FUJITSU_HOTKEY_DEVICE_NAME);
857+ ACPI_FUJITSU_LAPTOP_DEVICE_NAME);
857858 sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS);
858− device->driver_data = fujitsu_hotkey;
859+ device->driver_data = fujitsu_laptop;
859860
860861 /* kfifo */
861− spin_lock_init(&fujitsu_hotkey->fifo_lock);
862− error = kfifo_alloc(&fujitsu_hotkey->fifo, RINGBUFFERSIZE * sizeof(int),
862+ spin_lock_init(&fujitsu_laptop->fifo_lock);
863+ error = kfifo_alloc(&fujitsu_laptop->fifo, RINGBUFFERSIZE * sizeof(int),
863864 GFP_KERNEL);
864865 if (error) {
865866 pr_err("kfifo_alloc failed\n");
866867 goto err_stop;
867868 }
868869
869− fujitsu_hotkey->input = input = input_allocate_device();
870+ fujitsu_laptop->input = input = input_allocate_device();
870871 if (!input) {
871872 error = -ENOMEM;
872873 goto err_free_fifo;
873874 }
874875
875− snprintf(fujitsu_hotkey->phys, sizeof(fujitsu_hotkey->phys),
876+ snprintf(fujitsu_laptop->phys, sizeof(fujitsu_laptop->phys),
876877 "%s/video/input0", acpi_device_hid(device));
877878
878879 input->name = acpi_device_name(device);
879− input->phys = fujitsu_hotkey->phys;
880+ input->phys = fujitsu_laptop->phys;
880881 input->id.bustype = BUS_HOST;
881882 input->id.product = 0x06;
882883 input->dev.parent = &device->dev;
883884
884885 set_bit(EV_KEY, input->evbit);
885− set_bit(fujitsu->keycode1, input->keybit);
886− set_bit(fujitsu->keycode2, input->keybit);
887− set_bit(fujitsu->keycode3, input->keybit);
888− set_bit(fujitsu->keycode4, input->keybit);
889− set_bit(fujitsu->keycode5, input->keybit);
886+ set_bit(fujitsu_bl->keycode1, input->keybit);
887+ set_bit(fujitsu_bl->keycode2, input->keybit);
888+ set_bit(fujitsu_bl->keycode3, input->keybit);
889+ set_bit(fujitsu_bl->keycode4, input->keybit);
890+ set_bit(fujitsu_bl->keycode5, input->keybit);
890891 set_bit(KEY_TOUCHPAD_TOGGLE, input->keybit);
891892 set_bit(KEY_UNKNOWN, input->keybit);
892893
@@ -894,7 +895,7 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device) · 1 unmodified line
894895 if (error)
895896 goto err_free_input_dev;
896897
897− error = acpi_bus_update_power(fujitsu_hotkey->acpi_handle, &state);
898+ error = acpi_bus_update_power(fujitsu_laptop->acpi_handle, &state);
898899 if (error) {
899900 pr_err("Error reading power state\n");
900901 goto err_unregister_input_dev;
@@ -904,7 +905,7 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device) · 3 unmodified lines
904905 acpi_device_name(device), acpi_device_bid(device),
905906 !device->power.state ? "on" : "off");
906907
907− fujitsu_hotkey->dev = device;
908+ fujitsu_laptop->dev = device;
908909
909910 if (acpi_has_method(device->handle, METHOD_NAME__INI)) {
910911 vdbg_printk(FUJLAPTOP_DBG_INFO, "Invoking _INI\n");
@@ -920,27 +921,27 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device) · 9 unmodified lines
920921 ; /* No action, result is discarded */
921922 vdbg_printk(FUJLAPTOP_DBG_INFO, "Discarded %i ringbuffer entries\n", i);
922923
923− fujitsu_hotkey->rfkill_supported =
924− call_fext_func(FUNC_RFKILL, 0x0, 0x0, 0x0);
924+ fujitsu_laptop->flags_supported =
925+ call_fext_func(FUNC_FLAGS, 0x0, 0x0, 0x0);
925926
926927 /* Make sure our bitmask of supported functions is cleared if the
927928 RFKILL function block is not implemented, like on the S7020. */
928− if (fujitsu_hotkey->rfkill_supported == UNSUPPORTED_CMD)
929− fujitsu_hotkey->rfkill_supported = 0;
929+ if (fujitsu_laptop->flags_supported == UNSUPPORTED_CMD)
930+ fujitsu_laptop->flags_supported = 0;
930931
931− if (fujitsu_hotkey->rfkill_supported)
932− fujitsu_hotkey->rfkill_state =
933− call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0);
932+ if (fujitsu_laptop->flags_supported)
933+ fujitsu_laptop->flags_state =
934+ call_fext_func(FUNC_FLAGS, 0x4, 0x0, 0x0);
934935
935936 /* Suspect this is a keymap of the application panel, print it */
936937 pr_info("BTNI: [0x%x]\n", call_fext_func(FUNC_BUTTONS, 0x0, 0x0, 0x0));
937938
938939 #if IS_ENABLED(CONFIG_LEDS_CLASS)
939940 if (call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & LOGOLAMP_POWERON) {
940− result = led_classdev_register(&fujitsu->pf_device->dev,
941+ result = led_classdev_register(&fujitsu_bl->pf_device->dev,
941942 &logolamp_led);
942943 if (result == 0) {
943− fujitsu_hotkey->logolamp_registered = 1;
944+ fujitsu_laptop->logolamp_registered = 1;
944945 } else {
945946 pr_err("Could not register LED handler for logo lamp, error %i\n",
946947 result);
@@ -949,10 +950,10 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device) · 2 unmodified lines
949950
950951 if ((call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & KEYBOARD_LAMPS) &&
951952 (call_fext_func(FUNC_BUTTONS, 0x0, 0x0, 0x0) == 0x0)) {
952− result = led_classdev_register(&fujitsu->pf_device->dev,
953+ result = led_classdev_register(&fujitsu_bl->pf_device->dev,
953954 &kblamps_led);
954955 if (result == 0) {
955− fujitsu_hotkey->kblamps_registered = 1;
956+ fujitsu_laptop->kblamps_registered = 1;
956957 } else {
957958 pr_err("Could not register LED handler for keyboard lamps, error %i\n",
958959 result);
@@ -966,10 +967,10 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device) · 7 unmodified lines
966967 * that an RF LED is present.
967968 */
968969 if (call_fext_func(FUNC_BUTTONS, 0x0, 0x0, 0x0) & BIT(24)) {
969− result = led_classdev_register(&fujitsu->pf_device->dev,
970+ result = led_classdev_register(&fujitsu_bl->pf_device->dev,
970971 &radio_led);
971972 if (result == 0) {
972− fujitsu_hotkey->radio_led_registered = 1;
973+ fujitsu_laptop->radio_led_registered = 1;
973974 } else {
974975 pr_err("Could not register LED handler for radio LED, error %i\n",
975976 result);
@@ -983,10 +984,10 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device) · 7 unmodified lines
983984 */
984985 if ((call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & BIT(14)) &&
985986 (call_fext_func(FUNC_LEDS, 0x2, ECO_LED, 0x0) != UNSUPPORTED_CMD)) {
986− result = led_classdev_register(&fujitsu->pf_device->dev,
987+ result = led_classdev_register(&fujitsu_bl->pf_device->dev,
987988 &eco_led);
988989 if (result == 0) {
989− fujitsu_hotkey->eco_led_registered = 1;
990+ fujitsu_laptop->eco_led_registered = 1;
990991 } else {
991992 pr_err("Could not register LED handler for eco LED, error %i\n",
992993 result);
@@ -1002,47 +1003,47 @@ err_unregister_input_dev: · 9 unmodified lines
10021003 err_free_input_dev:
10031004 input_free_device(input);
10041005 err_free_fifo:
1005− kfifo_free(&fujitsu_hotkey->fifo);
1006+ kfifo_free(&fujitsu_laptop->fifo);
10061007 err_stop:
10071008 return error;
10081009 }
10091010
1010−static int acpi_fujitsu_hotkey_remove(struct acpi_device *device)
1011+static int acpi_fujitsu_laptop_remove(struct acpi_device *device)
10111012 {
1012− struct fujitsu_hotkey_t *fujitsu_hotkey = acpi_driver_data(device);
1013− struct input_dev *input = fujitsu_hotkey->input;
1013+ struct fujitsu_laptop *fujitsu_laptop = acpi_driver_data(device);
1014+ struct input_dev *input = fujitsu_laptop->input;
10141015
10151016 #if IS_ENABLED(CONFIG_LEDS_CLASS)
1016− if (fujitsu_hotkey->logolamp_registered)
1017+ if (fujitsu_laptop->logolamp_registered)
10171018 led_classdev_unregister(&logolamp_led);
10181019
1019− if (fujitsu_hotkey->kblamps_registered)
1020+ if (fujitsu_laptop->kblamps_registered)
10201021 led_classdev_unregister(&kblamps_led);
10211022
1022− if (fujitsu_hotkey->radio_led_registered)
1023+ if (fujitsu_laptop->radio_led_registered)
10231024 led_classdev_unregister(&radio_led);
10241025
1025− if (fujitsu_hotkey->eco_led_registered)
1026+ if (fujitsu_laptop->eco_led_registered)
10261027 led_classdev_unregister(&eco_led);
10271028 #endif
10281029
10291030 input_unregister_device(input);
10301031
1031− kfifo_free(&fujitsu_hotkey->fifo);
1032+ kfifo_free(&fujitsu_laptop->fifo);
10321033
1033− fujitsu_hotkey->acpi_handle = NULL;
1034+ fujitsu_laptop->acpi_handle = NULL;
10341035
10351036 return 0;
10361037 }
10371038
1038−static void acpi_fujitsu_hotkey_press(int keycode)
1039+static void acpi_fujitsu_laptop_press(int keycode)
10391040 {
1040− struct input_dev *input = fujitsu_hotkey->input;
1041+ struct input_dev *input = fujitsu_laptop->input;
10411042 int status;
10421043
1043− status = kfifo_in_locked(&fujitsu_hotkey->fifo,
1044+ status = kfifo_in_locked(&fujitsu_laptop->fifo,
10441045 (unsigned char *)&keycode, sizeof(keycode),
1045− &fujitsu_hotkey->fifo_lock);
1046+ &fujitsu_laptop->fifo_lock);
10461047 if (status != sizeof(keycode)) {
10471048 vdbg_printk(FUJLAPTOP_DBG_WARN,
10481049 "Could not push keycode [0x%x]\n", keycode);
@@ -1054,16 +1055,16 @@ static void acpi_fujitsu_hotkey_press(int keycode) · 5 unmodified lines
10541055 "Push keycode into ringbuffer [%d]\n", keycode);
10551056 }
10561057
1057−static void acpi_fujitsu_hotkey_release(void)
1058+static void acpi_fujitsu_laptop_release(void)
10581059 {
1059− struct input_dev *input = fujitsu_hotkey->input;
1060+ struct input_dev *input = fujitsu_laptop->input;
10601061 int keycode, status;
10611062
10621063 while (true) {
1063− status = kfifo_out_locked(&fujitsu_hotkey->fifo,
1064+ status = kfifo_out_locked(&fujitsu_laptop->fifo,
10641065 (unsigned char *)&keycode,
10651066 sizeof(keycode),
1066− &fujitsu_hotkey->fifo_lock);
1067+ &fujitsu_laptop->fifo_lock);
10671068 if (status != sizeof(keycode))
10681069 return;
10691070 input_report_key(input, keycode, 0);
@@ -1073,14 +1074,14 @@ static void acpi_fujitsu_hotkey_release(void) · 3 unmodified lines
10731074 }
10741075 }
10751076
1076−static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event)
1077+static void acpi_fujitsu_laptop_notify(struct acpi_device *device, u32 event)
10771078 {
10781079 struct input_dev *input;
10791080 int keycode;
10801081 unsigned int irb = 1;
10811082 int i;
10821083
1083− input = fujitsu_hotkey->input;
1084+ input = fujitsu_laptop->input;
10841085
10851086 if (event != ACPI_FUJITSU_NOTIFY_CODE1) {
10861087 keycode = KEY_UNKNOWN;
@@ -1093,9 +1094,9 @@ static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event) · 6 unmodified lines
10931094 return;
10941095 }
10951096
1096− if (fujitsu_hotkey->rfkill_supported)
1097− fujitsu_hotkey->rfkill_state =
1098− call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0);
1097+ if (fujitsu_laptop->flags_supported)
1098+ fujitsu_laptop->flags_state =
1099+ call_fext_func(FUNC_FLAGS, 0x4, 0x0, 0x0);
10991100
11001101 i = 0;
11011102 while ((irb =
@@ -1103,19 +1104,19 @@ static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event) · 1 unmodified line
11031104 && (i++) < MAX_HOTKEY_RINGBUFFER_SIZE) {
11041105 switch (irb & 0x4ff) {
11051106 case KEY1_CODE:
1106− keycode = fujitsu->keycode1;
1107+ keycode = fujitsu_bl->keycode1;
11071108 break;
11081109 case KEY2_CODE:
1109− keycode = fujitsu->keycode2;
1110+ keycode = fujitsu_bl->keycode2;
11101111 break;
11111112 case KEY3_CODE:
1112− keycode = fujitsu->keycode3;
1113+ keycode = fujitsu_bl->keycode3;
11131114 break;
11141115 case KEY4_CODE:
1115− keycode = fujitsu->keycode4;
1116+ keycode = fujitsu_bl->keycode4;
11161117 break;
11171118 case KEY5_CODE:
1118− keycode = fujitsu->keycode5;
1119+ keycode = fujitsu_bl->keycode5;
11191120 break;
11201121 case 0:
11211122 keycode = 0;
@@ -1128,17 +1129,17 @@ static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event) · 6 unmodified lines
11281129 }
11291130
11301131 if (keycode > 0)
1131− acpi_fujitsu_hotkey_press(keycode);
1132+ acpi_fujitsu_laptop_press(keycode);
11321133 else if (keycode == 0)
1133− acpi_fujitsu_hotkey_release();
1134+ acpi_fujitsu_laptop_release();
11341135 }
11351136
11361137 /* On some models (first seen on the Skylake-based Lifebook
11371138 * E736/E746/E756), the touchpad toggle hotkey (Fn+F4) is
1138− * handled in software; its state is queried using FUNC_RFKILL
1139+ * handled in software; its state is queried using FUNC_FLAGS
11391140 */
1140− if ((fujitsu_hotkey->rfkill_supported & BIT(26)) &&
1141− (call_fext_func(FUNC_RFKILL, 0x1, 0x0, 0x0) & BIT(26))) {
1141+ if ((fujitsu_laptop->flags_supported & BIT(26)) &&
1142+ (call_fext_func(FUNC_FLAGS, 0x1, 0x0, 0x0) & BIT(26))) {
11421143 keycode = KEY_TOUCHPAD_TOGGLE;
11431144 input_report_key(input, keycode, 1);
11441145 input_sync(input);
@@ -1150,83 +1151,81 @@ static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event) · 5 unmodified lines
11501151
11511152 /* Initialization */
11521153
1153−static const struct acpi_device_id fujitsu_device_ids[] = {
1154− {ACPI_FUJITSU_HID, 0},
1154+static const struct acpi_device_id fujitsu_bl_device_ids[] = {
1155+ {ACPI_FUJITSU_BL_HID, 0},
11551156 {"", 0},
11561157 };
11571158
1158−static struct acpi_driver acpi_fujitsu_driver = {
1159− .name = ACPI_FUJITSU_DRIVER_NAME,
1159+static struct acpi_driver acpi_fujitsu_bl_driver = {
1160+ .name = ACPI_FUJITSU_BL_DRIVER_NAME,
11601161 .class = ACPI_FUJITSU_CLASS,
1161− .ids = fujitsu_device_ids,
1162+ .ids = fujitsu_bl_device_ids,
11621163 .ops = {
1163− .add = acpi_fujitsu_add,
1164− .remove = acpi_fujitsu_remove,
1165− .notify = acpi_fujitsu_notify,
1164+ .add = acpi_fujitsu_bl_add,
1165+ .remove = acpi_fujitsu_bl_remove,
1166+ .notify = acpi_fujitsu_bl_notify,
11661167 },
11671168 };
11681169
1169−static const struct acpi_device_id fujitsu_hotkey_device_ids[] = {
1170− {ACPI_FUJITSU_HOTKEY_HID, 0},
1170+static const struct acpi_device_id fujitsu_laptop_device_ids[] = {
1171+ {ACPI_FUJITSU_LAPTOP_HID, 0},
11711172 {"", 0},
11721173 };
11731174
1174−static struct acpi_driver acpi_fujitsu_hotkey_driver = {
1175− .name = ACPI_FUJITSU_HOTKEY_DRIVER_NAME,
1175+static struct acpi_driver acpi_fujitsu_laptop_driver = {
1176+ .name = ACPI_FUJITSU_LAPTOP_DRIVER_NAME,
11761177 .class = ACPI_FUJITSU_CLASS,
1177− .ids = fujitsu_hotkey_device_ids,
1178+ .ids = fujitsu_laptop_device_ids,
11781179 .ops = {
1179− .add = acpi_fujitsu_hotkey_add,
1180− .remove = acpi_fujitsu_hotkey_remove,
1181− .notify = acpi_fujitsu_hotkey_notify,
1180+ .add = acpi_fujitsu_laptop_add,
1181+ .remove = acpi_fujitsu_laptop_remove,
1182+ .notify = acpi_fujitsu_laptop_notify,
11821183 },
11831184 };
11841185
11851186 static const struct acpi_device_id fujitsu_ids[] __used = {
1186− {ACPI_FUJITSU_HID, 0},
1187− {ACPI_FUJITSU_HOTKEY_HID, 0},
1187+ {ACPI_FUJITSU_BL_HID, 0},
1188+ {ACPI_FUJITSU_LAPTOP_HID, 0},
11881189 {"", 0}
11891190 };
11901191 MODULE_DEVICE_TABLE(acpi, fujitsu_ids);
11911192
11921193 static int __init fujitsu_init(void)
11931194 {
1194− int ret, result, max_brightness;
1195+ int ret, max_brightness;
11951196
11961197 if (acpi_disabled)
11971198 return -ENODEV;
11981199
1199− fujitsu = kzalloc(sizeof(struct fujitsu_t), GFP_KERNEL);
1200− if (!fujitsu)
1200+ fujitsu_bl = kzalloc(sizeof(struct fujitsu_bl), GFP_KERNEL);
1201+ if (!fujitsu_bl)
12011202 return -ENOMEM;
1202− fujitsu->keycode1 = KEY_PROG1;
1203− fujitsu->keycode2 = KEY_PROG2;
1204− fujitsu->keycode3 = KEY_PROG3;
1205− fujitsu->keycode4 = KEY_PROG4;
1206− fujitsu->keycode5 = KEY_RFKILL;
1203+ fujitsu_bl->keycode1 = KEY_PROG1;
1204+ fujitsu_bl->keycode2 = KEY_PROG2;
1205+ fujitsu_bl->keycode3 = KEY_PROG3;
1206+ fujitsu_bl->keycode4 = KEY_PROG4;
1207+ fujitsu_bl->keycode5 = KEY_RFKILL;
12071208 dmi_check_system(fujitsu_dmi_table);
12081209
1209− result = acpi_bus_register_driver(&acpi_fujitsu_driver);
1210− if (result < 0) {
1211− ret = -ENODEV;
1210+ ret = acpi_bus_register_driver(&acpi_fujitsu_bl_driver);
1211+ if (ret)
12121212 goto fail_acpi;
1213− }
12141213
12151214 /* Register platform stuff */
12161215
1217− fujitsu->pf_device = platform_device_alloc("fujitsu-laptop", -1);
1218− if (!fujitsu->pf_device) {
1216+ fujitsu_bl->pf_device = platform_device_alloc("fujitsu-laptop", -1);
1217+ if (!fujitsu_bl->pf_device) {
12191218 ret = -ENOMEM;
12201219 goto fail_platform_driver;
12211220 }
12221221
1223− ret = platform_device_add(fujitsu->pf_device);
1222+ ret = platform_device_add(fujitsu_bl->pf_device);
12241223 if (ret)
12251224 goto fail_platform_device1;
12261225
12271226 ret =
1228− sysfs_create_group(&fujitsu->pf_device->dev.kobj,
1229− &fujitsupf_attribute_group);
1227+ sysfs_create_group(&fujitsu_bl->pf_device->dev.kobj,
1228+ &fujitsu_pf_attribute_group);
12301229 if (ret)
12311230 goto fail_platform_device2;
12321231
@@ -1236,90 +1235,88 @@ static int __init fujitsu_init(void) · 3 unmodified lines
12361235 struct backlight_properties props;
12371236
12381237 memset(&props, 0, sizeof(struct backlight_properties));
1239− max_brightness = fujitsu->max_brightness;
1238+ max_brightness = fujitsu_bl->max_brightness;
12401239 props.type = BACKLIGHT_PLATFORM;
12411240 props.max_brightness = max_brightness - 1;
1242− fujitsu->bl_device = backlight_device_register("fujitsu-laptop",
1243− NULL, NULL,
1244− &fujitsubl_ops,
1245− &props);
1246− if (IS_ERR(fujitsu->bl_device)) {
1247− ret = PTR_ERR(fujitsu->bl_device);
1248− fujitsu->bl_device = NULL;
1241+ fujitsu_bl->bl_device = backlight_device_register("fujitsu-laptop",
1242+ NULL, NULL,
1243+ &fujitsu_bl_ops,
1244+ &props);
1245+ if (IS_ERR(fujitsu_bl->bl_device)) {
1246+ ret = PTR_ERR(fujitsu_bl->bl_device);
1247+ fujitsu_bl->bl_device = NULL;
12491248 goto fail_sysfs_group;
12501249 }
1251− fujitsu->bl_device->props.brightness = fujitsu->brightness_level;
1250+ fujitsu_bl->bl_device->props.brightness = fujitsu_bl->brightness_level;
12521251 }
12531252
1254− ret = platform_driver_register(&fujitsupf_driver);
1253+ ret = platform_driver_register(&fujitsu_pf_driver);
12551254 if (ret)
12561255 goto fail_backlight;
12571256
1258− /* Register hotkey driver */
1257+ /* Register laptop driver */
12591258
1260− fujitsu_hotkey = kzalloc(sizeof(struct fujitsu_hotkey_t), GFP_KERNEL);
1261− if (!fujitsu_hotkey) {
1259+ fujitsu_laptop = kzalloc(sizeof(struct fujitsu_laptop), GFP_KERNEL);
1260+ if (!fujitsu_laptop) {
12621261 ret = -ENOMEM;
1263− goto fail_hotkey;
1262+ goto fail_laptop;
12641263 }
12651264
1266− result = acpi_bus_register_driver(&acpi_fujitsu_hotkey_driver);
1267− if (result < 0) {
1268− ret = -ENODEV;
1269− goto fail_hotkey1;
1270− }
1265+ ret = acpi_bus_register_driver(&acpi_fujitsu_laptop_driver);
1266+ if (ret)
1267+ goto fail_laptop1;
12711268
12721269 /* Sync backlight power status (needs FUJ02E3 device, hence deferred) */
12731270 if (acpi_video_get_backlight_type() == acpi_backlight_vendor) {
12741271 if (call_fext_func(FUNC_BACKLIGHT, 0x2, 0x4, 0x0) == 3)
1275− fujitsu->bl_device->props.power = FB_BLANK_POWERDOWN;
1272+ fujitsu_bl->bl_device->props.power = FB_BLANK_POWERDOWN;
12761273 else
1277− fujitsu->bl_device->props.power = FB_BLANK_UNBLANK;
1274+ fujitsu_bl->bl_device->props.power = FB_BLANK_UNBLANK;
12781275 }
12791276
12801277 pr_info("driver " FUJITSU_DRIVER_VERSION " successfully loaded\n");
12811278
12821279 return 0;
12831280
1284−fail_hotkey1:
1285− kfree(fujitsu_hotkey);
1286−fail_hotkey:
1287− platform_driver_unregister(&fujitsupf_driver);
1281+fail_laptop1:
1282+ kfree(fujitsu_laptop);
1283+fail_laptop:
1284+ platform_driver_unregister(&fujitsu_pf_driver);
12881285 fail_backlight:
1289− backlight_device_unregister(fujitsu->bl_device);
1286+ backlight_device_unregister(fujitsu_bl->bl_device);
12901287 fail_sysfs_group:
1291− sysfs_remove_group(&fujitsu->pf_device->dev.kobj,
1292− &fujitsupf_attribute_group);
1288+ sysfs_remove_group(&fujitsu_bl->pf_device->dev.kobj,
1289+ &fujitsu_pf_attribute_group);
12931290 fail_platform_device2:
1294− platform_device_del(fujitsu->pf_device);
1291+ platform_device_del(fujitsu_bl->pf_device);
12951292 fail_platform_device1:
1296− platform_device_put(fujitsu->pf_device);
1293+ platform_device_put(fujitsu_bl->pf_device);
12971294 fail_platform_driver:
1298− acpi_bus_unregister_driver(&acpi_fujitsu_driver);
1295+ acpi_bus_unregister_driver(&acpi_fujitsu_bl_driver);
12991296 fail_acpi:
1300− kfree(fujitsu);
1297+ kfree(fujitsu_bl);
13011298
13021299 return ret;
13031300 }
13041301
13051302 static void __exit fujitsu_cleanup(void)
13061303 {
1307− acpi_bus_unregister_driver(&acpi_fujitsu_hotkey_driver);
1304+ acpi_bus_unregister_driver(&acpi_fujitsu_laptop_driver);
13081305
1309− kfree(fujitsu_hotkey);
1306+ kfree(fujitsu_laptop);
13101307
1311− platform_driver_unregister(&fujitsupf_driver);
1308+ platform_driver_unregister(&fujitsu_pf_driver);
13121309
1313− backlight_device_unregister(fujitsu->bl_device);
1310+ backlight_device_unregister(fujitsu_bl->bl_device);
13141311
1315− sysfs_remove_group(&fujitsu->pf_device->dev.kobj,
1316− &fujitsupf_attribute_group);
1312+ sysfs_remove_group(&fujitsu_bl->pf_device->dev.kobj,
1313+ &fujitsu_pf_attribute_group);
13171314
1318− platform_device_unregister(fujitsu->pf_device);
1315+ platform_device_unregister(fujitsu_bl->pf_device);
13191316
1320− acpi_bus_unregister_driver(&acpi_fujitsu_driver);
1317+ acpi_bus_unregister_driver(&acpi_fujitsu_bl_driver);
13211318
1322− kfree(fujitsu);
1319+ kfree(fujitsu_bl);
13231320
13241321 pr_info("driver unloaded\n");
13251322 }
@@ -1341,7 +1338,3 @@ MODULE_AUTHOR("Jonathan Woithe, Peter Gruber, Tony Vroon"); · 15 unmodified lines
13411338 MODULE_DESCRIPTION("Fujitsu laptop extras support");
13421339 MODULE_VERSION(FUJITSU_DRIVER_VERSION);
13431340 MODULE_LICENSE("GPL");
1344−
1345−MODULE_ALIAS("dmi:*:svnFUJITSUSIEMENS:*:pvr:rvnFUJITSU:rnFJNB1D3:*:cvrS6410:*");
1346−MODULE_ALIAS("dmi:*:svnFUJITSUSIEMENS:*:pvr:rvnFUJITSU:rnFJNB1E6:*:cvrS6420:*");
1347−MODULE_ALIAS("dmi:*:svnFUJITSU:*:pvr:rvnFUJITSU:rnFJNB19C:*:cvrS7020:*");
drivers/scsi/Kconfig+16−3
@@ -1241,19 +1241,32 @@ config SCSI_LPFC · 1240 unmodified lines
12411241 tristate "Emulex LightPulse Fibre Channel Support"
12421242 depends on PCI && SCSI
12431243 depends on SCSI_FC_ATTRS
1244− depends on NVME_FC && NVME_TARGET_FC
12451244 select CRC_T10DIF
1246− help
1245+ ---help---
12471246 This lpfc driver supports the Emulex LightPulse
12481247 Family of Fibre Channel PCI host adapters.
12491248
12501249 config SCSI_LPFC_DEBUG_FS
12511250 bool "Emulex LightPulse Fibre Channel debugfs Support"
12521251 depends on SCSI_LPFC && DEBUG_FS
1253− help
1252+ ---help---
12541253 This makes debugging information from the lpfc driver
12551254 available via the debugfs filesystem.
12561255
1256+config LPFC_NVME_INITIATOR
1257+ bool "Emulex LightPulse Fibre Channel NVME Initiator Support"
1258+ depends on SCSI_LPFC && NVME_FC
1259+ ---help---
1260+ This enables NVME Initiator support in the Emulex lpfc driver.
1261+
1262+config LPFC_NVME_TARGET
1263+ bool "Emulex LightPulse Fibre Channel NVME Initiator Support"
1264+ depends on SCSI_LPFC && NVME_TARGET_FC
1265+ ---help---
1266+ This enables NVME Target support in the Emulex lpfc driver.
1267+ Target enablement must still be enabled on a per adapter
1268+ basis by module parameters.
1269+
12571270 config SCSI_SIM710
12581271 tristate "Simple 53c710 SCSI support (Compaq, NCR machines)"
12591272 depends on (EISA || MCA) && SCSI
drivers/scsi/aacraid/src.c+1−1
@@ -468,7 +468,7 @@ err_out: · 467 unmodified lines
468468 return -1;
469469
470470 err_blink:
471− return (status > 16) & 0xFF;
471+ return (status >> 16) & 0xFF;
472472 }
473473
474474 static inline u32 aac_get_vector(struct aac_dev *dev)
drivers/scsi/aic7xxx/aic79xx_core.c+1−1
@@ -6278,7 +6278,7 @@ ahd_reset(struct ahd_softc *ahd, int reinit) · 6277 unmodified lines
62786278 * does not disable its parity logic prior to
62796279 * the start of the reset. This may cause a
62806280 * parity error to be detected and thus a
6281− * spurious SERR or PERR assertion. Disble
6281+ * spurious SERR or PERR assertion. Disable
62826282 * PERR and SERR responses during the CHIPRST.
62836283 */
62846284 mod_cmd = cmd & ~(PCIM_CMD_PERRESPEN|PCIM_CMD_SERRESPEN);
drivers/scsi/libiscsi.c+25−1
@@ -561,8 +561,12 @@ static void iscsi_complete_task(struct iscsi_task *task, int state) · 560 unmodified lines
561561 WARN_ON_ONCE(task->state == ISCSI_TASK_FREE);
562562 task->state = state;
563563
564− if (!list_empty(&task->running))
564+ spin_lock_bh(&conn->taskqueuelock);
565+ if (!list_empty(&task->running)) {
566+ pr_debug_once("%s while task on list", __func__);
565567 list_del_init(&task->running);
568+ }
569+ spin_unlock_bh(&conn->taskqueuelock);
566570
567571 if (conn->task == task)
568572 conn->task = NULL;
@@ -784,7 +788,9 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, · 215 unmodified lines
784788 if (session->tt->xmit_task(task))
785789 goto free_task;
786790 } else {
791+ spin_lock_bh(&conn->taskqueuelock);
787792 list_add_tail(&task->running, &conn->mgmtqueue);
793+ spin_unlock_bh(&conn->taskqueuelock);
788794 iscsi_conn_queue_work(conn);
789795 }
790796
@@ -1475,8 +1481,10 @@ void iscsi_requeue_task(struct iscsi_task *task) · 684 unmodified lines
14751481 * this may be on the requeue list already if the xmit_task callout
14761482 * is handling the r2ts while we are adding new ones
14771483 */
1484+ spin_lock_bh(&conn->taskqueuelock);
14781485 if (list_empty(&task->running))
14791486 list_add_tail(&task->running, &conn->requeue);
1487+ spin_unlock_bh(&conn->taskqueuelock);
14801488 iscsi_conn_queue_work(conn);
14811489 }
14821490 EXPORT_SYMBOL_GPL(iscsi_requeue_task);
@@ -1513,22 +1521,26 @@ static int iscsi_data_xmit(struct iscsi_conn *conn) · 30 unmodified lines
15131521 * only have one nop-out as a ping from us and targets should not
15141522 * overflow us with nop-ins
15151523 */
1524+ spin_lock_bh(&conn->taskqueuelock);
15161525 check_mgmt:
15171526 while (!list_empty(&conn->mgmtqueue)) {
15181527 conn->task = list_entry(conn->mgmtqueue.next,
15191528 struct iscsi_task, running);
15201529 list_del_init(&conn->task->running);
1530+ spin_unlock_bh(&conn->taskqueuelock);
15211531 if (iscsi_prep_mgmt_task(conn, conn->task)) {
15221532 /* regular RX path uses back_lock */
15231533 spin_lock_bh(&conn->session->back_lock);
15241534 __iscsi_put_task(conn->task);
15251535 spin_unlock_bh(&conn->session->back_lock);
15261536 conn->task = NULL;
1537+ spin_lock_bh(&conn->taskqueuelock);
15271538 continue;
15281539 }
15291540 rc = iscsi_xmit_task(conn);
15301541 if (rc)
15311542 goto done;
1543+ spin_lock_bh(&conn->taskqueuelock);
15321544 }
15331545
15341546 /* process pending command queue */
@@ -1536,19 +1548,24 @@ check_mgmt: · 1 unmodified line
15361548 conn->task = list_entry(conn->cmdqueue.next, struct iscsi_task,
15371549 running);
15381550 list_del_init(&conn->task->running);
1551+ spin_unlock_bh(&conn->taskqueuelock);
15391552 if (conn->session->state == ISCSI_STATE_LOGGING_OUT) {
15401553 fail_scsi_task(conn->task, DID_IMM_RETRY);
1554+ spin_lock_bh(&conn->taskqueuelock);
15411555 continue;
15421556 }
15431557 rc = iscsi_prep_scsi_cmd_pdu(conn->task);
15441558 if (rc) {
15451559 if (rc == -ENOMEM || rc == -EACCES) {
1560+ spin_lock_bh(&conn->taskqueuelock);
15461561 list_add_tail(&conn->task->running,
15471562 &conn->cmdqueue);
15481563 conn->task = NULL;
1564+ spin_unlock_bh(&conn->taskqueuelock);
15491565 goto done;
15501566 } else
15511567 fail_scsi_task(conn->task, DID_ABORT);
1568+ spin_lock_bh(&conn->taskqueuelock);
15521569 continue;
15531570 }
15541571 rc = iscsi_xmit_task(conn);
@@ -1559,6 +1576,7 @@ check_mgmt: · 4 unmodified lines
15591576 * we need to check the mgmt queue for nops that need to
15601577 * be sent to aviod starvation
15611578 */
1579+ spin_lock_bh(&conn->taskqueuelock);
15621580 if (!list_empty(&conn->mgmtqueue))
15631581 goto check_mgmt;
15641582 }
@@ -1578,12 +1596,15 @@ check_mgmt: · 13 unmodified lines
15781596 conn->task = task;
15791597 list_del_init(&conn->task->running);
15801598 conn->task->state = ISCSI_TASK_RUNNING;
1599+ spin_unlock_bh(&conn->taskqueuelock);
15811600 rc = iscsi_xmit_task(conn);
15821601 if (rc)
15831602 goto done;
1603+ spin_lock_bh(&conn->taskqueuelock);
15841604 if (!list_empty(&conn->mgmtqueue))
15851605 goto check_mgmt;
15861606 }
1607+ spin_unlock_bh(&conn->taskqueuelock);
15871608 spin_unlock_bh(&conn->session->frwd_lock);
15881609 return -ENODATA;
15891610
@@ -1739,7 +1760,9 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc) · 149 unmodified lines
17391760 goto prepd_reject;
17401761 }
17411762 } else {
1763+ spin_lock_bh(&conn->taskqueuelock);
17421764 list_add_tail(&task->running, &conn->cmdqueue);
1765+ spin_unlock_bh(&conn->taskqueuelock);
17431766 iscsi_conn_queue_work(conn);
17441767 }
17451768
@@ -2897,6 +2920,7 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size, · 1151 unmodified lines
28972920 INIT_LIST_HEAD(&conn->mgmtqueue);
28982921 INIT_LIST_HEAD(&conn->cmdqueue);
28992922 INIT_LIST_HEAD(&conn->requeue);
2923+ spin_lock_init(&conn->taskqueuelock);
29002924 INIT_WORK(&conn->xmitwork, iscsi_xmitworker);
29012925
29022926 /* allocate login_task used for the login/text sequences */
drivers/scsi/lpfc/lpfc.h+3−1
@@ -99,12 +99,13 @@ struct lpfc_sli2_slim; · 98 unmodified lines
9999 #define FC_MAX_ADPTMSG 64
100100
101101 #define MAX_HBAEVT 32
102+#define MAX_HBAS_NO_RESET 16
102103
103104 /* Number of MSI-X vectors the driver uses */
104105 #define LPFC_MSIX_VECTORS 2
105106
106107 /* lpfc wait event data ready flag */
107−#define LPFC_DATA_READY (1<<0)
108+#define LPFC_DATA_READY 0 /* bit 0 */
108109
109110 /* queue dump line buffer size */
110111 #define LPFC_LBUF_SZ 128
@@ -692,6 +693,7 @@ struct lpfc_hba { · 581 unmodified lines
692693 * capability
693694 */
694695 #define HBA_NVME_IOQ_FLUSH 0x80000 /* NVME IO queues flushed. */
696+#define NVME_XRI_ABORT_EVENT 0x100000
695697
696698 uint32_t fcp_ring_in_use; /* When polling test if intr-hndlr active*/
697699 struct lpfc_dmabuf slim2p;
drivers/scsi/lpfc/lpfc_attr.c+8−1
@@ -3010,6 +3010,12 @@ MODULE_PARM_DESC(lpfc_poll, "FCP ring polling mode control:" · 3009 unmodified lines
30103010 static DEVICE_ATTR(lpfc_poll, S_IRUGO | S_IWUSR,
30113011 lpfc_poll_show, lpfc_poll_store);
30123012
3013+int lpfc_no_hba_reset_cnt;
3014+unsigned long lpfc_no_hba_reset[MAX_HBAS_NO_RESET] = {
3015+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
3016+module_param_array(lpfc_no_hba_reset, ulong, &lpfc_no_hba_reset_cnt, 0444);
3017+MODULE_PARM_DESC(lpfc_no_hba_reset, "WWPN of HBAs that should not be reset");
3018+
30133019 LPFC_ATTR(sli_mode, 0, 0, 3,
30143020 "SLI mode selector:"
30153021 " 0 - auto (SLI-3 if supported),"
@@ -4451,7 +4457,8 @@ lpfc_fcp_imax_store(struct device *dev, struct device_attribute *attr, · 1435 unmodified lines
44514457 return -EINVAL;
44524458
44534459 phba->cfg_fcp_imax = (uint32_t)val;
4454− for (i = 0; i < phba->io_channel_irqs; i++)
4460+
4461+ for (i = 0; i < phba->io_channel_irqs; i += LPFC_MAX_EQ_DELAY_EQID_CNT)
44554462 lpfc_modify_hba_eq_delay(phba, i);
44564463
44574464 return strlen(buf);
drivers/scsi/lpfc/lpfc_crtn.h+3−1
@@ -384,7 +384,7 @@ void lpfc_free_sysfs_attr(struct lpfc_vport *); · 383 unmodified lines
384384 extern struct device_attribute *lpfc_hba_attrs[];
385385 extern struct device_attribute *lpfc_vport_attrs[];
386386 extern struct scsi_host_template lpfc_template;
387−extern struct scsi_host_template lpfc_template_s3;
387+extern struct scsi_host_template lpfc_template_no_hr;
388388 extern struct scsi_host_template lpfc_template_nvme;
389389 extern struct scsi_host_template lpfc_vport_template;
390390 extern struct fc_function_template lpfc_transport_functions;
@@ -554,3 +554,5 @@ void lpfc_nvme_abort_fcreq_cmpl(struct lpfc_hba *phba, · 163 unmodified lines
554554 struct lpfc_wcqe_complete *abts_cmpl);
555555 extern int lpfc_enable_nvmet_cnt;
556556 extern unsigned long long lpfc_enable_nvmet[];
557+extern int lpfc_no_hba_reset_cnt;
558+extern unsigned long lpfc_no_hba_reset[];
drivers/scsi/lpfc/lpfc_ct.c+1−1
@@ -939,8 +939,8 @@ lpfc_cmpl_ct_cmd_gft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, · 938 unmodified lines
939939 "FC4 x%08x, Data: x%08x x%08x\n",
940940 ndlp, did, ndlp->nlp_fc4_type,
941941 FC_TYPE_FCP, FC_TYPE_NVME);
942+ ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE;
942943 }
943− ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE;
944944 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PRLI_ISSUE);
945945 lpfc_issue_els_prli(vport, ndlp, 0);
946946 } else
drivers/scsi/lpfc/lpfc_debugfs.c+0−22
@@ -3653,17 +3653,6 @@ lpfc_idiag_queacc_write(struct file *file, const char __user *buf, · 3652 unmodified lines
36533653 idiag.ptr_private = phba->sli4_hba.nvmels_cq;
36543654 goto pass_check;
36553655 }
3656− /* NVME LS complete queue */
3657− if (phba->sli4_hba.nvmels_cq &&
3658− phba->sli4_hba.nvmels_cq->queue_id == queid) {
3659− /* Sanity check */
3660− rc = lpfc_idiag_que_param_check(
3661− phba->sli4_hba.nvmels_cq, index, count);
3662− if (rc)
3663− goto error_out;
3664− idiag.ptr_private = phba->sli4_hba.nvmels_cq;
3665− goto pass_check;
3666− }
36673656 /* FCP complete queue */
36683657 if (phba->sli4_hba.fcp_cq) {
36693658 for (qidx = 0; qidx < phba->cfg_fcp_io_channel;
@@ -3738,17 +3727,6 @@ lpfc_idiag_queacc_write(struct file *file, const char __user *buf, · 68 unmodified lines
37383727 idiag.ptr_private = phba->sli4_hba.nvmels_wq;
37393728 goto pass_check;
37403729 }
3741− /* NVME LS work queue */
3742− if (phba->sli4_hba.nvmels_wq &&
3743− phba->sli4_hba.nvmels_wq->queue_id == queid) {
3744− /* Sanity check */
3745− rc = lpfc_idiag_que_param_check(
3746− phba->sli4_hba.nvmels_wq, index, count);
3747− if (rc)
3748− goto error_out;
3749− idiag.ptr_private = phba->sli4_hba.nvmels_wq;
3750− goto pass_check;
3751− }
37523730 /* FCP work queue */
37533731 if (phba->sli4_hba.fcp_wq) {
37543732 for (qidx = 0; qidx < phba->cfg_fcp_io_channel;
drivers/scsi/lpfc/lpfc_els.c+14−8
@@ -5177,15 +5177,15 @@ lpfc_rdp_res_speed(struct fc_rdp_port_speed_desc *desc, struct lpfc_hba *phba) · 5176 unmodified lines
51775177
51785178 static uint32_t
51795179 lpfc_rdp_res_diag_port_names(struct fc_rdp_port_name_desc *desc,
5180− struct lpfc_hba *phba)
5180+ struct lpfc_vport *vport)
51815181 {
51825182
51835183 desc->tag = cpu_to_be32(RDP_PORT_NAMES_DESC_TAG);
51845184
5185− memcpy(desc->port_names.wwnn, phba->wwnn,
5185+ memcpy(desc->port_names.wwnn, &vport->fc_nodename,
51865186 sizeof(desc->port_names.wwnn));
51875187
5188− memcpy(desc->port_names.wwpn, phba->wwpn,
5188+ memcpy(desc->port_names.wwpn, &vport->fc_portname,
51895189 sizeof(desc->port_names.wwpn));
51905190
51915191 desc->length = cpu_to_be32(sizeof(desc->port_names));
@@ -5279,7 +5279,7 @@ lpfc_els_rdp_cmpl(struct lpfc_hba *phba, struct lpfc_rdp_context *rdp_context, · 87 unmodified lines
52795279 len += lpfc_rdp_res_link_error((struct fc_rdp_link_error_status_desc *)
52805280 (len + pcmd), &rdp_context->link_stat);
52815281 len += lpfc_rdp_res_diag_port_names((struct fc_rdp_port_name_desc *)
5282− (len + pcmd), phba);
5282+ (len + pcmd), vport);
52835283 len += lpfc_rdp_res_attach_port_names((struct fc_rdp_port_name_desc *)
52845284 (len + pcmd), vport, ndlp);
52855285 len += lpfc_rdp_res_fec_desc((struct fc_fec_rdp_desc *)(len + pcmd),
@@ -8371,11 +8371,17 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) · 3085 unmodified lines
83718371 spin_lock_irq(shost->host_lock);
83728372 vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI;
83738373 spin_unlock_irq(shost->host_lock);
8374− if (vport->port_type == LPFC_PHYSICAL_PORT
8375− && !(vport->fc_flag & FC_LOGO_RCVD_DID_CHNG))
8376− lpfc_issue_init_vfi(vport);
8377− else
8374+ if (mb->mbxStatus == MBX_NOT_FINISHED)
8375+ break;
8376+ if ((vport->port_type == LPFC_PHYSICAL_PORT) &&
8377+ !(vport->fc_flag & FC_LOGO_RCVD_DID_CHNG)) {
8378+ if (phba->sli_rev == LPFC_SLI_REV4)
8379+ lpfc_issue_init_vfi(vport);
8380+ else
8381+ lpfc_initial_flogi(vport);
8382+ } else {
83788383 lpfc_initial_fdisc(vport);
8384+ }
83798385 break;
83808386 }
83818387 } else {
drivers/scsi/lpfc/lpfc_hbadisc.c+13−11
@@ -313,8 +313,7 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp) · 312 unmodified lines
313313 ndlp->nlp_state, ndlp->nlp_rpi);
314314 }
315315
316− if (!(vport->load_flag & FC_UNLOADING) &&
317− !(ndlp->nlp_flag & NLP_DELAY_TMO) &&
316+ if (!(ndlp->nlp_flag & NLP_DELAY_TMO) &&
318317 !(ndlp->nlp_flag & NLP_NPR_2B_DISC) &&
319318 (ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) &&
320319 (ndlp->nlp_state != NLP_STE_REG_LOGIN_ISSUE) &&
@@ -641,6 +640,8 @@ lpfc_work_done(struct lpfc_hba *phba) · 320 unmodified lines
641640 lpfc_handle_rrq_active(phba);
642641 if (phba->hba_flag & FCP_XRI_ABORT_EVENT)
643642 lpfc_sli4_fcp_xri_abort_event_proc(phba);
643+ if (phba->hba_flag & NVME_XRI_ABORT_EVENT)
644+ lpfc_sli4_nvme_xri_abort_event_proc(phba);
644645 if (phba->hba_flag & ELS_XRI_ABORT_EVENT)
645646 lpfc_sli4_els_xri_abort_event_proc(phba);
646647 if (phba->hba_flag & ASYNC_EVENT)
@@ -2173,7 +2174,7 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) · 1526 unmodified lines
21732174 uint32_t boot_flag, addr_mode;
21742175 uint16_t fcf_index, next_fcf_index;
21752176 struct lpfc_fcf_rec *fcf_rec = NULL;
2176− uint16_t vlan_id;
2177+ uint16_t vlan_id = LPFC_FCOE_NULL_VID;
21772178 bool select_new_fcf;
21782179 int rc;
21792180
@@ -4020,9 +4021,11 @@ lpfc_register_remote_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 1840 unmodified lines
40204021 rdata = rport->dd_data;
40214022 /* break the link before dropping the ref */
40224023 ndlp->rport = NULL;
4023− if (rdata && rdata->pnode == ndlp)
4024− lpfc_nlp_put(ndlp);
4025− rdata->pnode = NULL;
4024+ if (rdata) {
4025+ if (rdata->pnode == ndlp)
4026+ lpfc_nlp_put(ndlp);
4027+ rdata->pnode = NULL;
4028+ }
40264029 /* drop reference for earlier registeration */
40274030 put_device(&rport->dev);
40284031 }
@@ -4344,9 +4347,8 @@ lpfc_initialize_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, · 315 unmodified lines
43444347 {
43454348 INIT_LIST_HEAD(&ndlp->els_retry_evt.evt_listp);
43464349 INIT_LIST_HEAD(&ndlp->dev_loss_evt.evt_listp);
4347− init_timer(&ndlp->nlp_delayfunc);
4348− ndlp->nlp_delayfunc.function = lpfc_els_retry_delay;
4349− ndlp->nlp_delayfunc.data = (unsigned long)ndlp;
4350+ setup_timer(&ndlp->nlp_delayfunc, lpfc_els_retry_delay,
4351+ (unsigned long)ndlp);
43504352 ndlp->nlp_DID = did;
43514353 ndlp->vport = vport;
43524354 ndlp->phba = vport->phba;
@@ -4606,9 +4608,9 @@ lpfc_sli4_dequeue_nport_iocbs(struct lpfc_hba *phba, · 253 unmodified lines
46064608 pring = qp->pring;
46074609 if (!pring)
46084610 continue;
4609− spin_lock_irq(&pring->ring_lock);
4611+ spin_lock(&pring->ring_lock);
46104612 __lpfc_dequeue_nport_iocbs(phba, ndlp, pring, dequeue_list);
4611− spin_unlock_irq(&pring->ring_lock);
4613+ spin_unlock(&pring->ring_lock);
46124614 }
46134615 spin_unlock_irq(&phba->hbalock);
46144616 }
drivers/scsi/lpfc/lpfc_hw4.h+2−2
@@ -1001,7 +1001,7 @@ struct eq_delay_info { · 1000 unmodified lines
10011001 uint32_t phase;
10021002 uint32_t delay_multi;
10031003 };
1004−#define LPFC_MAX_EQ_DELAY 8
1004+#define LPFC_MAX_EQ_DELAY_EQID_CNT 8
10051005
10061006 struct sgl_page_pairs {
10071007 uint32_t sgl_pg0_addr_lo;
@@ -1070,7 +1070,7 @@ struct lpfc_mbx_modify_eq_delay { · 62 unmodified lines
10701070 union {
10711071 struct {
10721072 uint32_t num_eq;
1073− struct eq_delay_info eq[LPFC_MAX_EQ_DELAY];
1073+ struct eq_delay_info eq[LPFC_MAX_EQ_DELAY_EQID_CNT];
10741074 } request;
10751075 struct {
10761076 uint32_t word0;
drivers/scsi/lpfc/lpfc_init.c+85−43
@@ -3555,6 +3555,44 @@ out_free_mem: · 3554 unmodified lines
35553555 return rc;
35563556 }
35573557
3558+static uint64_t
3559+lpfc_get_wwpn(struct lpfc_hba *phba)
3560+{
3561+ uint64_t wwn;
3562+ int rc;
3563+ LPFC_MBOXQ_t *mboxq;
3564+ MAILBOX_t *mb;
3565+
3566+
3567+ mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool,
3568+ GFP_KERNEL);
3569+ if (!mboxq)
3570+ return (uint64_t)-1;
3571+
3572+ /* First get WWN of HBA instance */
3573+ lpfc_read_nv(phba, mboxq);
3574+ rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
3575+ if (rc != MBX_SUCCESS) {
3576+ lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
3577+ "6019 Mailbox failed , mbxCmd x%x "
3578+ "READ_NV, mbxStatus x%x\n",
3579+ bf_get(lpfc_mqe_command, &mboxq->u.mqe),
3580+ bf_get(lpfc_mqe_status, &mboxq->u.mqe));
3581+ mempool_free(mboxq, phba->mbox_mem_pool);
3582+ return (uint64_t) -1;
3583+ }
3584+ mb = &mboxq->u.mb;
3585+ memcpy(&wwn, (char *)mb->un.varRDnvp.portname, sizeof(uint64_t));
3586+ /* wwn is WWPN of HBA instance */
3587+ mempool_free(mboxq, phba->mbox_mem_pool);
3588+ if (phba->sli_rev == LPFC_SLI_REV4)
3589+ return be64_to_cpu(wwn);
3590+ else
3591+ return (((wwn & 0xffffffff00000000) >> 32) |
3592+ ((wwn & 0x00000000ffffffff) << 32));
3593+
3594+}
3595+
35583596 /**
35593597 * lpfc_sli4_nvme_sgl_update - update xri-sgl sizing and mapping
35603598 * @phba: pointer to lpfc hba data structure.
@@ -3676,17 +3714,32 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) · 115 unmodified lines
36763714 struct lpfc_vport *vport;
36773715 struct Scsi_Host *shost = NULL;
36783716 int error = 0;
3717+ int i;
3718+ uint64_t wwn;
3719+ bool use_no_reset_hba = false;
3720+
3721+ wwn = lpfc_get_wwpn(phba);
3722+
3723+ for (i = 0; i < lpfc_no_hba_reset_cnt; i++) {
3724+ if (wwn == lpfc_no_hba_reset[i]) {
3725+ lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
3726+ "6020 Setting use_no_reset port=%llx\n",
3727+ wwn);
3728+ use_no_reset_hba = true;
3729+ break;
3730+ }
3731+ }
36793732
36803733 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) {
36813734 if (dev != &phba->pcidev->dev) {
36823735 shost = scsi_host_alloc(&lpfc_vport_template,
36833736 sizeof(struct lpfc_vport));
36843737 } else {
3685− if (phba->sli_rev == LPFC_SLI_REV4)
3738+ if (!use_no_reset_hba)
36863739 shost = scsi_host_alloc(&lpfc_template,
36873740 sizeof(struct lpfc_vport));
36883741 else
3689− shost = scsi_host_alloc(&lpfc_template_s3,
3742+ shost = scsi_host_alloc(&lpfc_template_no_hr,
36903743 sizeof(struct lpfc_vport));
36913744 }
36923745 } else if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) {
@@ -3734,17 +3787,14 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) · 41 unmodified lines
37343787 INIT_LIST_HEAD(&vport->rcv_buffer_list);
37353788 spin_lock_init(&vport->work_port_lock);
37363789
3737− init_timer(&vport->fc_disctmo);
3738− vport->fc_disctmo.function = lpfc_disc_timeout;
3739− vport->fc_disctmo.data = (unsigned long)vport;
3790+ setup_timer(&vport->fc_disctmo, lpfc_disc_timeout,
3791+ (unsigned long)vport);
37403792
3741− init_timer(&vport->els_tmofunc);
3742− vport->els_tmofunc.function = lpfc_els_timeout;
3743− vport->els_tmofunc.data = (unsigned long)vport;
3793+ setup_timer(&vport->els_tmofunc, lpfc_els_timeout,
3794+ (unsigned long)vport);
37443795
3745− init_timer(&vport->delayed_disc_tmo);
3746− vport->delayed_disc_tmo.function = lpfc_delayed_disc_tmo;
3747− vport->delayed_disc_tmo.data = (unsigned long)vport;
3796+ setup_timer(&vport->delayed_disc_tmo, lpfc_delayed_disc_tmo,
3797+ (unsigned long)vport);
37483798
37493799 error = scsi_add_host_with_dma(shost, dev, &phba->pcidev->dev);
37503800 if (error)
@@ -5406,21 +5456,15 @@ lpfc_setup_driver_resource_phase1(struct lpfc_hba *phba) · 1655 unmodified lines
54065456 INIT_LIST_HEAD(&phba->luns);
54075457
54085458 /* MBOX heartbeat timer */
5409− init_timer(&psli->mbox_tmo);
5410− psli->mbox_tmo.function = lpfc_mbox_timeout;
5411− psli->mbox_tmo.data = (unsigned long) phba;
5459+ setup_timer(&psli->mbox_tmo, lpfc_mbox_timeout, (unsigned long)phba);
54125460 /* Fabric block timer */
5413− init_timer(&phba->fabric_block_timer);
5414− phba->fabric_block_timer.function = lpfc_fabric_block_timeout;
5415− phba->fabric_block_timer.data = (unsigned long) phba;
5461+ setup_timer(&phba->fabric_block_timer, lpfc_fabric_block_timeout,
5462+ (unsigned long)phba);
54165463 /* EA polling mode timer */
5417− init_timer(&phba->eratt_poll);
5418− phba->eratt_poll.function = lpfc_poll_eratt;
5419− phba->eratt_poll.data = (unsigned long) phba;
5464+ setup_timer(&phba->eratt_poll, lpfc_poll_eratt,
5465+ (unsigned long)phba);
54205466 /* Heartbeat timer */
5421− init_timer(&phba->hb_tmofunc);
5422− phba->hb_tmofunc.function = lpfc_hb_timeout;
5423− phba->hb_tmofunc.data = (unsigned long)phba;
5467+ setup_timer(&phba->hb_tmofunc, lpfc_hb_timeout, (unsigned long)phba);
54245468
54255469 return 0;
54265470 }
@@ -5446,9 +5490,8 @@ lpfc_sli_driver_resource_setup(struct lpfc_hba *phba) · 19 unmodified lines
54465490 */
54475491
54485492 /* FCP polling mode timer */
5449− init_timer(&phba->fcp_poll_timer);
5450− phba->fcp_poll_timer.function = lpfc_poll_timeout;
5451− phba->fcp_poll_timer.data = (unsigned long) phba;
5493+ setup_timer(&phba->fcp_poll_timer, lpfc_poll_timeout,
5494+ (unsigned long)phba);
54525495
54535496 /* Host attention work mask setup */
54545497 phba->work_ha_mask = (HA_ERATT | HA_MBATT | HA_LATT);
@@ -5482,7 +5525,8 @@ lpfc_sli_driver_resource_setup(struct lpfc_hba *phba) · 27 unmodified lines
54825525
54835526 /* Initialize the host templates the configured values. */
54845527 lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt;
5485− lpfc_template_s3.sg_tablesize = phba->cfg_sg_seg_cnt;
5528+ lpfc_template_no_hr.sg_tablesize = phba->cfg_sg_seg_cnt;
5529+ lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt;
54865530
54875531 /* There are going to be 2 reserved BDEs: 1 FCP cmnd + 1 FCP rsp */
54885532 if (phba->cfg_enable_bg) {
@@ -5617,14 +5661,11 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) · 128 unmodified lines
56175661 * Initialize timers used by driver
56185662 */
56195663
5620− init_timer(&phba->rrq_tmr);
5621− phba->rrq_tmr.function = lpfc_rrq_timeout;
5622− phba->rrq_tmr.data = (unsigned long)phba;
5664+ setup_timer(&phba->rrq_tmr, lpfc_rrq_timeout, (unsigned long)phba);
56235665
56245666 /* FCF rediscover timer */
5625− init_timer(&phba->fcf.redisc_wait);
5626− phba->fcf.redisc_wait.function = lpfc_sli4_fcf_redisc_wait_tmo;
5627− phba->fcf.redisc_wait.data = (unsigned long)phba;
5667+ setup_timer(&phba->fcf.redisc_wait, lpfc_sli4_fcf_redisc_wait_tmo,
5668+ (unsigned long)phba);
56285669
56295670 /*
56305671 * Control structure for handling external multi-buffer mailbox
@@ -5706,6 +5747,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) · 75 unmodified lines
57065747 /* Initialize the host templates with the updated values. */
57075748 lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt;
57085749 lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt;
5750+ lpfc_template_no_hr.sg_tablesize = phba->cfg_sg_seg_cnt;
57095751
57105752 if (phba->cfg_sg_dma_buf_size <= LPFC_MIN_SG_SLI4_BUF_SZ)
57115753 phba->cfg_sg_dma_buf_size = LPFC_MIN_SG_SLI4_BUF_SZ;
@@ -5736,6 +5778,8 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) · 24 unmodified lines
57365778 /* Initialize the Abort nvme buffer list used by driver */
57375779 spin_lock_init(&phba->sli4_hba.abts_nvme_buf_list_lock);
57385780 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvme_buf_list);
5781+ /* Fast-path XRI aborted CQ Event work queue list */
5782+ INIT_LIST_HEAD(&phba->sli4_hba.sp_nvme_xri_aborted_work_queue);
57395783 }
57405784
57415785 /* This abort list used by worker thread */
@@ -8712,12 +8756,9 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba) · 2970 unmodified lines
87128756 }
87138757 }
87148758
8715− /*
8716− * Configure EQ delay multipier for interrupt coalescing using
8717− * MODIFY_EQ_DELAY for all EQs created, LPFC_MAX_EQ_DELAY at a time.
8718− */
8719− for (qidx = 0; qidx < io_channel; qidx += LPFC_MAX_EQ_DELAY)
8759+ for (qidx = 0; qidx < io_channel; qidx += LPFC_MAX_EQ_DELAY_EQID_CNT)
87208760 lpfc_modify_hba_eq_delay(phba, qidx);
8761+
87218762 return 0;
87228763
87238764 out_destroy:
@@ -8973,6 +9014,11 @@ lpfc_sli4_cq_event_release_all(struct lpfc_hba *phba) · 249 unmodified lines
89739014 /* Pending ELS XRI abort events */
89749015 list_splice_init(&phba->sli4_hba.sp_els_xri_aborted_work_queue,
89759016 &cqelist);
9017+ if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) {
9018+ /* Pending NVME XRI abort events */
9019+ list_splice_init(&phba->sli4_hba.sp_nvme_xri_aborted_work_queue,
9020+ &cqelist);
9021+ }
89769022 /* Pending asynnc events */
89779023 list_splice_init(&phba->sli4_hba.sp_asynce_work_queue,
89789024 &cqelist);
@@ -10400,12 +10446,7 @@ lpfc_pci_remove_one_s3(struct pci_dev *pdev) · 1421 unmodified lines
1040010446 fc_remove_host(shost);
1040110447 scsi_remove_host(shost);
1040210448
10403− /* Perform ndlp cleanup on the physical port. The nvme and nvmet
10404− * localports are destroyed after to cleanup all transport memory.
10405− */
1040610449 lpfc_cleanup(vport);
10407− lpfc_nvmet_destroy_targetport(phba);
10408− lpfc_nvme_destroy_localport(vport);
1040910450
1041010451 /*
1041110452 * Bring down the SLI Layer. This step disable all interrupts,
@@ -12018,6 +12059,7 @@ static struct pci_driver lpfc_driver = { · 1606 unmodified lines
1201812059 .id_table = lpfc_id_table,
1201912060 .probe = lpfc_pci_probe_one,
1202012061 .remove = lpfc_pci_remove_one,
12062+ .shutdown = lpfc_pci_remove_one,
1202112063 .suspend = lpfc_pci_suspend_one,
1202212064 .resume = lpfc_pci_resume_one,
1202312065 .err_handler = &lpfc_err_handler,
drivers/scsi/lpfc/lpfc_mem.c+1−1
@@ -646,7 +646,6 @@ lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba) · 645 unmodified lines
646646 }
647647
648648 dma_buf->iocbq = lpfc_sli_get_iocbq(phba);
649− dma_buf->iocbq->iocb_flag = LPFC_IO_NVMET;
650649 if (!dma_buf->iocbq) {
651650 kfree(dma_buf->context);
652651 pci_pool_free(phba->lpfc_drb_pool, dma_buf->dbuf.virt,
@@ -658,6 +657,7 @@ lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba) · 5 unmodified lines
658657 "2621 Ran out of nvmet iocb/WQEs\n");
659658 return NULL;
660659 }
660+ dma_buf->iocbq->iocb_flag = LPFC_IO_NVMET;
661661 nvmewqe = dma_buf->iocbq;
662662 wqe = (union lpfc_wqe128 *)&nvmewqe->wqe;
663663 /* Initialize WQE */
drivers/scsi/lpfc/lpfc_nvme.c+82−25
@@ -316,7 +316,7 @@ lpfc_nvme_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp, · 315 unmodified lines
316316 bf_set(wqe_dfctl, &wqe->gen_req.wge_ctl, 0);
317317 bf_set(wqe_si, &wqe->gen_req.wge_ctl, 1);
318318 bf_set(wqe_la, &wqe->gen_req.wge_ctl, 1);
319− bf_set(wqe_rctl, &wqe->gen_req.wge_ctl, FC_RCTL_DD_UNSOL_CTL);
319+ bf_set(wqe_rctl, &wqe->gen_req.wge_ctl, FC_RCTL_ELS4_REQ);
320320 bf_set(wqe_type, &wqe->gen_req.wge_ctl, FC_TYPE_NVME);
321321
322322 /* Word 6 */
@@ -620,15 +620,15 @@ lpfc_nvme_adj_fcp_sgls(struct lpfc_vport *vport, · 297 unmodified lines
620620 * Embed the payload in the last half of the WQE
621621 * WQE words 16-30 get the NVME CMD IU payload
622622 *
623− * WQE Word 16 is already setup with flags
624− * WQE words 17-19 get payload Words 2-4
623+ * WQE words 16-19 get payload Words 1-4
625624 * WQE words 20-21 get payload Words 6-7
626625 * WQE words 22-29 get payload Words 16-23
627626 */
628− wptr = &wqe->words[17]; /* WQE ptr */
627+ wptr = &wqe->words[16]; /* WQE ptr */
629628 dptr = (uint32_t *)nCmd->cmdaddr; /* payload ptr */
630− dptr += 2; /* Skip Words 0-1 in payload */
629+ dptr++; /* Skip Word 0 in payload */
631630
631+ *wptr++ = *dptr++; /* Word 1 */
632632 *wptr++ = *dptr++; /* Word 2 */
633633 *wptr++ = *dptr++; /* Word 3 */
634634 *wptr++ = *dptr++; /* Word 4 */
@@ -978,9 +978,6 @@ lpfc_nvme_prep_io_cmd(struct lpfc_vport *vport, · 343 unmodified lines
978978 bf_set(wqe_cmd_type, &wqe->generic.wqe_com,
979979 NVME_WRITE_CMD);
980980
981− /* Word 16 */
982− wqe->words[16] = LPFC_NVME_EMBED_WRITE;
983−
984981 phba->fc4NvmeOutputRequests++;
985982 } else {
986983 /* Word 7 */
@@ -1002,9 +999,6 @@ lpfc_nvme_prep_io_cmd(struct lpfc_vport *vport, · 15 unmodified lines
1002999 bf_set(wqe_cmd_type, &wqe->generic.wqe_com,
10031000 NVME_READ_CMD);
10041001
1005− /* Word 16 */
1006− wqe->words[16] = LPFC_NVME_EMBED_READ;
1007−
10081002 phba->fc4NvmeInputRequests++;
10091003 }
10101004 } else {
@@ -1026,9 +1020,6 @@ lpfc_nvme_prep_io_cmd(struct lpfc_vport *vport, · 15 unmodified lines
10261020 /* Word 11 */
10271021 bf_set(wqe_cmd_type, &wqe->generic.wqe_com, NVME_READ_CMD);
10281022
1029− /* Word 16 */
1030− wqe->words[16] = LPFC_NVME_EMBED_CMD;
1031−
10321023 phba->fc4NvmeControlRequests++;
10331024 }
10341025 /*
@@ -1286,6 +1277,7 @@ lpfc_nvme_fcp_io_submit(struct nvme_fc_local_port *pnvme_lport, · 251 unmodified lines
12861277 pnvme_fcreq->private = (void *)lpfc_ncmd;
12871278 lpfc_ncmd->nvmeCmd = pnvme_fcreq;
12881279 lpfc_ncmd->nrport = rport;
1280+ lpfc_ncmd->ndlp = ndlp;
12891281 lpfc_ncmd->start_time = jiffies;
12901282
12911283 lpfc_nvme_prep_io_cmd(vport, lpfc_ncmd, ndlp);
@@ -1319,7 +1311,7 @@ lpfc_nvme_fcp_io_submit(struct nvme_fc_local_port *pnvme_lport, · 27 unmodified lines
13191311 "sid: x%x did: x%x oxid: x%x\n",
13201312 ret, vport->fc_myDID, ndlp->nlp_DID,
13211313 lpfc_ncmd->cur_iocbq.sli4_xritag);
1322− ret = -EINVAL;
1314+ ret = -EBUSY;
13231315 goto out_free_nvme_buf;
13241316 }
13251317
@@ -1821,10 +1813,10 @@ lpfc_post_nvme_sgl_list(struct lpfc_hba *phba, · 495 unmodified lines
18211813 pdma_phys_sgl1, cur_xritag);
18221814 if (status) {
18231815 /* failure, put on abort nvme list */
1824− lpfc_ncmd->exch_busy = 1;
1816+ lpfc_ncmd->flags |= LPFC_SBUF_XBUSY;
18251817 } else {
18261818 /* success, put on NVME buffer list */
1827− lpfc_ncmd->exch_busy = 0;
1819+ lpfc_ncmd->flags &= ~LPFC_SBUF_XBUSY;
18281820 lpfc_ncmd->status = IOSTAT_SUCCESS;
18291821 num_posted++;
18301822 }
@@ -1854,10 +1846,10 @@ lpfc_post_nvme_sgl_list(struct lpfc_hba *phba, · 23 unmodified lines
18541846 struct lpfc_nvme_buf, list);
18551847 if (status) {
18561848 /* failure, put on abort nvme list */
1857− lpfc_ncmd->exch_busy = 1;
1849+ lpfc_ncmd->flags |= LPFC_SBUF_XBUSY;
18581850 } else {
18591851 /* success, put on NVME buffer list */
1860− lpfc_ncmd->exch_busy = 0;
1852+ lpfc_ncmd->flags &= ~LPFC_SBUF_XBUSY;
18611853 lpfc_ncmd->status = IOSTAT_SUCCESS;
18621854 num_posted++;
18631855 }
@@ -2099,7 +2091,7 @@ lpfc_release_nvme_buf(struct lpfc_hba *phba, struct lpfc_nvme_buf *lpfc_ncmd) · 235 unmodified lines
20992091 unsigned long iflag = 0;
21002092
21012093 lpfc_ncmd->nonsg_phys = 0;
2102− if (lpfc_ncmd->exch_busy) {
2094+ if (lpfc_ncmd->flags & LPFC_SBUF_XBUSY) {
21032095 spin_lock_irqsave(&phba->sli4_hba.abts_nvme_buf_list_lock,
21042096 iflag);
21052097 lpfc_ncmd->nvmeCmd = NULL;
@@ -2135,11 +2127,12 @@ lpfc_release_nvme_buf(struct lpfc_hba *phba, struct lpfc_nvme_buf *lpfc_ncmd) · 29 unmodified lines
21352127 int
21362128 lpfc_nvme_create_localport(struct lpfc_vport *vport)
21372129 {
2130+ int ret = 0;
21382131 struct lpfc_hba *phba = vport->phba;
21392132 struct nvme_fc_port_info nfcp_info;
21402133 struct nvme_fc_local_port *localport;
21412134 struct lpfc_nvme_lport *lport;
2142− int len, ret = 0;
2135+ int len;
21432136
21442137 /* Initialize this localport instance. The vport wwn usage ensures
21452138 * that NPIV is accounted for.
@@ -2156,8 +2149,12 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport) · 10 unmodified lines
21562149 /* localport is allocated from the stack, but the registration
21572150 * call allocates heap memory as well as the private area.
21582151 */
2152+#ifdef CONFIG_LPFC_NVME_INITIATOR
21592153 ret = nvme_fc_register_localport(&nfcp_info, &lpfc_nvme_template,
21602154 &vport->phba->pcidev->dev, &localport);
2155+#else
2156+ ret = -ENOMEM;
2157+#endif
21612158 if (!ret) {
21622159 lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME | LOG_NVME_DISC,
21632160 "6005 Successfully registered local "
@@ -2173,10 +2170,10 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport) · 9 unmodified lines
21732170 lport->vport = vport;
21742171 INIT_LIST_HEAD(&lport->rport_list);
21752172 vport->nvmei_support = 1;
2173+ len = lpfc_new_nvme_buf(vport, phba->sli4_hba.nvme_xri_max);
2174+ vport->phba->total_nvme_bufs += len;
21762175 }
21772176
2178− len = lpfc_new_nvme_buf(vport, phba->sli4_hba.nvme_xri_max);
2179− vport->phba->total_nvme_bufs += len;
21802177 return ret;
21812178 }
21822179
@@ -2193,6 +2190,7 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport) · 10 unmodified lines
21932190 void
21942191 lpfc_nvme_destroy_localport(struct lpfc_vport *vport)
21952192 {
2193+#ifdef CONFIG_LPFC_NVME_INITIATOR
21962194 struct nvme_fc_local_port *localport;
21972195 struct lpfc_nvme_lport *lport;
21982196 struct lpfc_nvme_rport *rport = NULL, *rport_next = NULL;
@@ -2208,7 +2206,6 @@ lpfc_nvme_destroy_localport(struct lpfc_vport *vport) · 9 unmodified lines
22082206 lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME,
22092207 "6011 Destroying NVME localport %p\n",
22102208 localport);
2211−
22122209 list_for_each_entry_safe(rport, rport_next, &lport->rport_list, list) {
22132210 /* The last node ref has to get released now before the rport
22142211 * private memory area is released by the transport.
@@ -2222,6 +2219,7 @@ lpfc_nvme_destroy_localport(struct lpfc_vport *vport) · 7 unmodified lines
22222219 "6008 rport fail destroy %x\n", ret);
22232220 wait_for_completion_timeout(&rport->rport_unreg_done, 5);
22242221 }
2222+
22252223 /* lport's rport list is clear. Unregister
22262224 * lport and release resources.
22272225 */
@@ -2245,6 +2243,7 @@ lpfc_nvme_destroy_localport(struct lpfc_vport *vport) · 17 unmodified lines
22452243 "Failed, status x%x\n",
22462244 ret);
22472245 }
2246+#endif
22482247 }
22492248
22502249 void
@@ -2275,6 +2274,7 @@ lpfc_nvme_update_localport(struct lpfc_vport *vport) · 24 unmodified lines
22752274 int
22762275 lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
22772276 {
2277+#ifdef CONFIG_LPFC_NVME_INITIATOR
22782278 int ret = 0;
22792279 struct nvme_fc_local_port *localport;
22802280 struct lpfc_nvme_lport *lport;
@@ -2348,7 +2348,6 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 67 unmodified lines
23482348 rpinfo.port_role |= FC_PORT_ROLE_NVME_INITIATOR;
23492349 rpinfo.port_name = wwn_to_u64(ndlp->nlp_portname.u.wwn);
23502350 rpinfo.node_name = wwn_to_u64(ndlp->nlp_nodename.u.wwn);
2351−
23522351 ret = nvme_fc_register_remoteport(localport, &rpinfo,
23532352 &remote_port);
23542353 if (!ret) {
@@ -2384,6 +2383,9 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 29 unmodified lines
23842383 ndlp->nlp_type, ndlp->nlp_DID, ndlp);
23852384 }
23862385 return ret;
2386+#else
2387+ return 0;
2388+#endif
23872389 }
23882390
23892391 /* lpfc_nvme_unregister_port - unbind the DID and port_role from this rport.
@@ -2401,6 +2403,7 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 11 unmodified lines
24012403 void
24022404 lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
24032405 {
2406+#ifdef CONFIG_LPFC_NVME_INITIATOR
24042407 int ret;
24052408 struct nvme_fc_local_port *localport;
24062409 struct lpfc_nvme_lport *lport;
@@ -2458,7 +2461,61 @@ lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 51 unmodified lines
24582461 return;
24592462
24602463 input_err:
2464+#endif
24612465 lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME_DISC,
24622466 "6168: State error: lport %p, rport%p FCID x%06x\n",
24632467 vport->localport, ndlp->rport, ndlp->nlp_DID);
24642468 }
2469+
2470+/**
2471+ * lpfc_sli4_nvme_xri_aborted - Fast-path process of NVME xri abort
2472+ * @phba: pointer to lpfc hba data structure.
2473+ * @axri: pointer to the fcp xri abort wcqe structure.
2474+ *
2475+ * This routine is invoked by the worker thread to process a SLI4 fast-path
2476+ * FCP aborted xri.
2477+ **/
2478+void
2479+lpfc_sli4_nvme_xri_aborted(struct lpfc_hba *phba,
2480+ struct sli4_wcqe_xri_aborted *axri)
2481+{
2482+ uint16_t xri = bf_get(lpfc_wcqe_xa_xri, axri);
2483+ uint16_t rxid = bf_get(lpfc_wcqe_xa_remote_xid, axri);
2484+ struct lpfc_nvme_buf *lpfc_ncmd, *next_lpfc_ncmd;
2485+ struct lpfc_nodelist *ndlp;
2486+ unsigned long iflag = 0;
2487+ int rrq_empty = 0;
2488+
2489+ if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME))
2490+ return;
2491+ spin_lock_irqsave(&phba->hbalock, iflag);
2492+ spin_lock(&phba->sli4_hba.abts_nvme_buf_list_lock);
2493+ list_for_each_entry_safe(lpfc_ncmd, next_lpfc_ncmd,
2494+ &phba->sli4_hba.lpfc_abts_nvme_buf_list,
2495+ list) {
2496+ if (lpfc_ncmd->cur_iocbq.sli4_xritag == xri) {
2497+ list_del(&lpfc_ncmd->list);
2498+ lpfc_ncmd->flags &= ~LPFC_SBUF_XBUSY;
2499+ lpfc_ncmd->status = IOSTAT_SUCCESS;
2500+ spin_unlock(
2501+ &phba->sli4_hba.abts_nvme_buf_list_lock);
2502+
2503+ rrq_empty = list_empty(&phba->active_rrq_list);
2504+ spin_unlock_irqrestore(&phba->hbalock, iflag);
2505+ ndlp = lpfc_ncmd->ndlp;
2506+ if (ndlp) {
2507+ lpfc_set_rrq_active(
2508+ phba, ndlp,
2509+ lpfc_ncmd->cur_iocbq.sli4_lxritag,
2510+ rxid, 1);
2511+ lpfc_sli4_abts_err_handler(phba, ndlp, axri);
2512+ }
2513+ lpfc_release_nvme_buf(phba, lpfc_ncmd);
2514+ if (rrq_empty)
2515+ lpfc_worker_wake_up(phba);
2516+ return;
2517+ }
2518+ }
2519+ spin_unlock(&phba->sli4_hba.abts_nvme_buf_list_lock);
2520+ spin_unlock_irqrestore(&phba->hbalock, iflag);
2521+}
drivers/scsi/lpfc/lpfc_nvme.h+1−0
@@ -57,6 +57,7 @@ struct lpfc_nvme_buf { · 56 unmodified lines
5757 struct list_head list;
5858 struct nvmefc_fcp_req *nvmeCmd;
5959 struct lpfc_nvme_rport *nrport;
60+ struct lpfc_nodelist *ndlp;
6061
6162 uint32_t timeout;
6263
drivers/scsi/lpfc/lpfc_nvmet.c+35−8
@@ -571,6 +571,7 @@ lpfc_nvmet_xmt_fcp_op(struct nvmet_fc_target_port *tgtport, · 570 unmodified lines
571571 lpfc_printf_log(phba, KERN_ERR, LOG_NVME_IOERR,
572572 "6102 Bad state IO x%x aborted\n",
573573 ctxp->oxid);
574+ rc = -ENXIO;
574575 goto aerr;
575576 }
576577
@@ -580,6 +581,7 @@ lpfc_nvmet_xmt_fcp_op(struct nvmet_fc_target_port *tgtport, · 3 unmodified lines
580581 lpfc_printf_log(phba, KERN_ERR, LOG_NVME_IOERR,
581582 "6152 FCP Drop IO x%x: Prep\n",
582583 ctxp->oxid);
584+ rc = -ENXIO;
583585 goto aerr;
584586 }
585587
@@ -618,8 +620,9 @@ lpfc_nvmet_xmt_fcp_op(struct nvmet_fc_target_port *tgtport, · 32 unmodified lines
618620 ctxp->wqeq->hba_wqidx = 0;
619621 nvmewqeq->context2 = NULL;
620622 nvmewqeq->context3 = NULL;
623+ rc = -EBUSY;
621624 aerr:
622− return -ENXIO;
625+ return rc;
623626 }
624627
625628 static void
@@ -668,9 +671,13 @@ lpfc_nvmet_create_targetport(struct lpfc_hba *phba) · 42 unmodified lines
668671 lpfc_tgttemplate.target_features = NVMET_FCTGTFEAT_READDATA_RSP |
669672 NVMET_FCTGTFEAT_NEEDS_CMD_CPUSCHED;
670673
674+#ifdef CONFIG_LPFC_NVME_TARGET
671675 error = nvmet_fc_register_targetport(&pinfo, &lpfc_tgttemplate,
672676 &phba->pcidev->dev,
673677 &phba->targetport);
678+#else
679+ error = -ENOMEM;
680+#endif
674681 if (error) {
675682 lpfc_printf_log(phba, KERN_ERR, LOG_NVME_DISC,
676683 "6025 Cannot register NVME targetport "
@@ -731,9 +738,25 @@ lpfc_nvmet_update_targetport(struct lpfc_hba *phba) · 54 unmodified lines
731738 return 0;
732739 }
733740
741+/**
742+ * lpfc_sli4_nvmet_xri_aborted - Fast-path process of nvmet xri abort
743+ * @phba: pointer to lpfc hba data structure.
744+ * @axri: pointer to the nvmet xri abort wcqe structure.
745+ *
746+ * This routine is invoked by the worker thread to process a SLI4 fast-path
747+ * NVMET aborted xri.
748+ **/
749+void
750+lpfc_sli4_nvmet_xri_aborted(struct lpfc_hba *phba,
751+ struct sli4_wcqe_xri_aborted *axri)
752+{
753+ /* TODO: work in progress */
754+}
755+
734756 void
735757 lpfc_nvmet_destroy_targetport(struct lpfc_hba *phba)
736758 {
759+#ifdef CONFIG_LPFC_NVME_TARGET
737760 struct lpfc_nvmet_tgtport *tgtp;
738761
739762 if (phba->nvmet_support == 0)
@@ -745,6 +768,7 @@ lpfc_nvmet_destroy_targetport(struct lpfc_hba *phba) · 5 unmodified lines
745768 wait_for_completion_timeout(&tgtp->tport_unreg_done, 5);
746769 }
747770 phba->targetport = NULL;
771+#endif
748772 }
749773
750774 /**
@@ -764,6 +788,7 @@ static void · 13 unmodified lines
764788 lpfc_nvmet_unsol_ls_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
765789 struct hbq_dmabuf *nvmebuf)
766790 {
791+#ifdef CONFIG_LPFC_NVME_TARGET
767792 struct lpfc_nvmet_tgtport *tgtp;
768793 struct fc_frame_header *fc_hdr;
769794 struct lpfc_nvmet_rcv_ctx *ctxp;
@@ -844,6 +869,7 @@ dropit: · 74 unmodified lines
844869
845870 atomic_inc(&tgtp->xmt_ls_abort);
846871 lpfc_nvmet_unsol_ls_issue_abort(phba, ctxp, sid, oxid);
872+#endif
847873 }
848874
849875 /**
@@ -865,6 +891,7 @@ lpfc_nvmet_unsol_fcp_buffer(struct lpfc_hba *phba, · 15 unmodified lines
865891 struct rqb_dmabuf *nvmebuf,
866892 uint64_t isr_timestamp)
867893 {
894+#ifdef CONFIG_LPFC_NVME_TARGET
868895 struct lpfc_nvmet_rcv_ctx *ctxp;
869896 struct lpfc_nvmet_tgtport *tgtp;
870897 struct fc_frame_header *fc_hdr;
@@ -955,7 +982,7 @@ lpfc_nvmet_unsol_fcp_buffer(struct lpfc_hba *phba, · 84 unmodified lines
955982
956983 atomic_inc(&tgtp->rcv_fcp_cmd_drop);
957984 lpfc_printf_log(phba, KERN_ERR, LOG_NVME_IOERR,
958− "6159 FCP Drop IO x%x: nvmet_fc_rcv_fcp_req x%x\n",
985+ "6159 FCP Drop IO x%x: err x%x\n",
959986 ctxp->oxid, rc);
960987 dropit:
961988 lpfc_nvmeio_data(phba, "NVMET FCP DROP: xri x%x sz %d from %06x\n",
@@ -970,6 +997,7 @@ dropit: · 8 unmodified lines
970997 /* We assume a rcv'ed cmd ALWAYs fits into 1 buffer */
971998 lpfc_nvmet_rq_post(phba, NULL, &nvmebuf->hbuf);
972999 }
1000+#endif
9731001 }
9741002
9751003 /**
@@ -1114,7 +1142,7 @@ lpfc_nvmet_prep_ls_wqe(struct lpfc_hba *phba, · 138 unmodified lines
11141142 bf_set(wqe_dfctl, &wqe->xmit_sequence.wge_ctl, 0);
11151143 bf_set(wqe_ls, &wqe->xmit_sequence.wge_ctl, 1);
11161144 bf_set(wqe_la, &wqe->xmit_sequence.wge_ctl, 0);
1117− bf_set(wqe_rctl, &wqe->xmit_sequence.wge_ctl, FC_RCTL_DD_SOL_CTL);
1145+ bf_set(wqe_rctl, &wqe->xmit_sequence.wge_ctl, FC_RCTL_ELS4_REP);
11181146 bf_set(wqe_type, &wqe->xmit_sequence.wge_ctl, FC_TYPE_NVME);
11191147
11201148 /* Word 6 */
@@ -1445,7 +1473,6 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba, · 324 unmodified lines
14451473
14461474 case NVMET_FCOP_RSP:
14471475 /* Words 0 - 2 */
1448− sgel = &rsp->sg[0];
14491476 physaddr = rsp->rspdma;
14501477 wqe->fcp_trsp.bde.tus.f.bdeFlags = BUFF_TYPE_BDE_64;
14511478 wqe->fcp_trsp.bde.tus.f.bdeSize = rsp->rsplen;
@@ -1681,8 +1708,8 @@ lpfc_nvmet_unsol_issue_abort(struct lpfc_hba *phba, · 229 unmodified lines
16811708 struct lpfc_nodelist *ndlp;
16821709
16831710 lpfc_printf_log(phba, KERN_INFO, LOG_NVME_ABTS,
1684− "6067 %s: Entrypoint: sid %x xri %x\n", __func__,
1685− sid, xri);
1711+ "6067 Abort: sid %x xri x%x/x%x\n",
1712+ sid, xri, ctxp->wqeq->sli4_xritag);
16861713
16871714 tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private;
16881715
@@ -1693,7 +1720,7 @@ lpfc_nvmet_unsol_issue_abort(struct lpfc_hba *phba, · 4 unmodified lines
16931720 atomic_inc(&tgtp->xmt_abort_rsp_error);
16941721 lpfc_printf_log(phba, KERN_WARNING, LOG_NVME_ABTS,
16951722 "6134 Drop ABTS - wrong NDLP state x%x.\n",
1696− ndlp->nlp_state);
1723+ (ndlp) ? ndlp->nlp_state : NLP_STE_MAX_STATE);
16971724
16981725 /* No failure to an ABTS request. */
16991726 return 0;
@@ -1791,7 +1818,7 @@ lpfc_nvmet_sol_fcp_issue_abort(struct lpfc_hba *phba, · 91 unmodified lines
17911818 atomic_inc(&tgtp->xmt_abort_rsp_error);
17921819 lpfc_printf_log(phba, KERN_WARNING, LOG_NVME_ABTS,
17931820 "6160 Drop ABTS - wrong NDLP state x%x.\n",
1794− ndlp->nlp_state);
1821+ (ndlp) ? ndlp->nlp_state : NLP_STE_MAX_STATE);
17951822
17961823 /* No failure to an ABTS request. */
17971824 return 0;
drivers/scsi/lpfc/lpfc_scsi.c+2−2
@@ -5953,12 +5953,13 @@ struct scsi_host_template lpfc_template_nvme = { · 5952 unmodified lines
59535953 .track_queue_depth = 0,
59545954 };
59555955
5956−struct scsi_host_template lpfc_template_s3 = {
5956+struct scsi_host_template lpfc_template_no_hr = {
59575957 .module = THIS_MODULE,
59585958 .name = LPFC_DRIVER_NAME,
59595959 .proc_name = LPFC_DRIVER_NAME,
59605960 .info = lpfc_info,
59615961 .queuecommand = lpfc_queuecommand,
5962+ .eh_timed_out = fc_eh_timed_out,
59625963 .eh_abort_handler = lpfc_abort_handler,
59635964 .eh_device_reset_handler = lpfc_device_reset_handler,
59645965 .eh_target_reset_handler = lpfc_target_reset_handler,
@@ -6015,7 +6016,6 @@ struct scsi_host_template lpfc_vport_template = { · 50 unmodified lines
60156016 .eh_abort_handler = lpfc_abort_handler,
60166017 .eh_device_reset_handler = lpfc_device_reset_handler,
60176018 .eh_target_reset_handler = lpfc_target_reset_handler,
6018− .eh_bus_reset_handler = lpfc_bus_reset_handler,
60196019 .slave_alloc = lpfc_slave_alloc,
60206020 .slave_configure = lpfc_slave_configure,
60216021 .slave_destroy = lpfc_slave_destroy,
drivers/scsi/lpfc/lpfc_sli.c+59−9
@@ -1,3 +1,4 @@
1+
12 /*******************************************************************
23 * This file is part of the Emulex Linux Device Driver for *
34 * Fibre Channel Host Bus Adapters. *
@@ -952,7 +953,7 @@ __lpfc_sli_get_els_sglq(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq) · 948 unmodified lines
952953 start_sglq = sglq;
953954 while (!found) {
954955 if (!sglq)
955− return NULL;
956+ break;
956957 if (ndlp && ndlp->active_rrqs_xri_bitmap &&
957958 test_bit(sglq->sli4_lxritag,
958959 ndlp->active_rrqs_xri_bitmap)) {
@@ -12212,6 +12213,41 @@ void lpfc_sli4_fcp_xri_abort_event_proc(struct lpfc_hba *phba) · 11253 unmodified lines
1221212213 }
1221312214 }
1221412215
12216+/**
12217+ * lpfc_sli4_nvme_xri_abort_event_proc - Process nvme xri abort event
12218+ * @phba: pointer to lpfc hba data structure.
12219+ *
12220+ * This routine is invoked by the worker thread to process all the pending
12221+ * SLI4 NVME abort XRI events.
12222+ **/
12223+void lpfc_sli4_nvme_xri_abort_event_proc(struct lpfc_hba *phba)
12224+{
12225+ struct lpfc_cq_event *cq_event;
12226+
12227+ /* First, declare the fcp xri abort event has been handled */
12228+ spin_lock_irq(&phba->hbalock);
12229+ phba->hba_flag &= ~NVME_XRI_ABORT_EVENT;
12230+ spin_unlock_irq(&phba->hbalock);
12231+ /* Now, handle all the fcp xri abort events */
12232+ while (!list_empty(&phba->sli4_hba.sp_nvme_xri_aborted_work_queue)) {
12233+ /* Get the first event from the head of the event queue */
12234+ spin_lock_irq(&phba->hbalock);
12235+ list_remove_head(&phba->sli4_hba.sp_nvme_xri_aborted_work_queue,
12236+ cq_event, struct lpfc_cq_event, list);
12237+ spin_unlock_irq(&phba->hbalock);
12238+ /* Notify aborted XRI for NVME work queue */
12239+ if (phba->nvmet_support) {
12240+ lpfc_sli4_nvmet_xri_aborted(phba,
12241+ &cq_event->cqe.wcqe_axri);
12242+ } else {
12243+ lpfc_sli4_nvme_xri_aborted(phba,
12244+ &cq_event->cqe.wcqe_axri);
12245+ }
12246+ /* Free the event processed back to the free pool */
12247+ lpfc_sli4_cq_event_release(phba, cq_event);
12248+ }
12249+}
12250+
1221512251 /**
1221612252 * lpfc_sli4_els_xri_abort_event_proc - Process els xri abort event
1221712253 * @phba: pointer to lpfc hba data structure.
@@ -12709,10 +12745,22 @@ lpfc_sli4_sp_handle_abort_xri_wcqe(struct lpfc_hba *phba, · 491 unmodified lines
1270912745 spin_unlock_irqrestore(&phba->hbalock, iflags);
1271012746 workposted = true;
1271112747 break;
12748+ case LPFC_NVME:
12749+ spin_lock_irqsave(&phba->hbalock, iflags);
12750+ list_add_tail(&cq_event->list,
12751+ &phba->sli4_hba.sp_nvme_xri_aborted_work_queue);
12752+ /* Set the nvme xri abort event flag */
12753+ phba->hba_flag |= NVME_XRI_ABORT_EVENT;
12754+ spin_unlock_irqrestore(&phba->hbalock, iflags);
12755+ workposted = true;
12756+ break;
1271212757 default:
1271312758 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
12714− "0603 Invalid work queue CQE subtype (x%x)\n",
12715− cq->subtype);
12759+ "0603 Invalid CQ subtype %d: "
12760+ "%08x %08x %08x %08x\n",
12761+ cq->subtype, wcqe->word0, wcqe->parameter,
12762+ wcqe->word2, wcqe->word3);
12763+ lpfc_sli4_cq_event_release(phba, cq_event);
1271612764 workposted = false;
1271712765 break;
1271812766 }
@@ -13827,6 +13875,8 @@ lpfc_dual_chute_pci_bar_map(struct lpfc_hba *phba, uint16_t pci_barset) · 1108 unmodified lines
1382713875 * @startq: The starting FCP EQ to modify
1382813876 *
1382913877 * This function sends an MODIFY_EQ_DELAY mailbox command to the HBA.
13878+ * The command allows up to LPFC_MAX_EQ_DELAY_EQID_CNT EQ ID's to be
13879+ * updated in one mailbox command.
1383013880 *
1383113881 * The @phba struct is used to send mailbox command to HBA. The @startq
1383213882 * is used to get the starting FCP EQ to change.
@@ -13879,7 +13929,7 @@ lpfc_modify_hba_eq_delay(struct lpfc_hba *phba, uint32_t startq) · 46 unmodified lines
1387913929 eq_delay->u.request.eq[cnt].phase = 0;
1388013930 eq_delay->u.request.eq[cnt].delay_multi = dmult;
1388113931 cnt++;
13882− if (cnt >= LPFC_MAX_EQ_DELAY)
13932+ if (cnt >= LPFC_MAX_EQ_DELAY_EQID_CNT)
1388313933 break;
1388413934 }
1388513935 eq_delay->u.request.num_eq = cnt;
@@ -15185,17 +15235,17 @@ lpfc_mrq_create(struct lpfc_hba *phba, struct lpfc_queue **hrqp, · 1299 unmodified lines
1518515235 drq = drqp[idx];
1518615236 cq = cqp[idx];
1518715237
15188− if (hrq->entry_count != drq->entry_count) {
15189− status = -EINVAL;
15190− goto out;
15191− }
15192−
1519315238 /* sanity check on queue memory */
1519415239 if (!hrq || !drq || !cq) {
1519515240 status = -ENODEV;
1519615241 goto out;
1519715242 }
1519815243
15244+ if (hrq->entry_count != drq->entry_count) {
15245+ status = -EINVAL;
15246+ goto out;
15247+ }
15248+
1519915249 if (idx == 0) {
1520015250 bf_set(lpfc_mbx_rq_create_num_pages,
1520115251 &rq_create->u.request,
drivers/scsi/lpfc/lpfc_sli4.h+6−0
@@ -642,6 +642,7 @@ struct lpfc_sli4_hba { · 641 unmodified lines
642642 struct list_head sp_asynce_work_queue;
643643 struct list_head sp_fcp_xri_aborted_work_queue;
644644 struct list_head sp_els_xri_aborted_work_queue;
645+ struct list_head sp_nvme_xri_aborted_work_queue;
645646 struct list_head sp_unsol_work_queue;
646647 struct lpfc_sli4_link link_state;
647648 struct lpfc_sli4_lnk_info lnk_info;
@@ -794,9 +795,14 @@ void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *); · 146 unmodified lines
794795 int lpfc_sli4_resume_rpi(struct lpfc_nodelist *,
795796 void (*)(struct lpfc_hba *, LPFC_MBOXQ_t *), void *);
796797 void lpfc_sli4_fcp_xri_abort_event_proc(struct lpfc_hba *);
798+void lpfc_sli4_nvme_xri_abort_event_proc(struct lpfc_hba *phba);
797799 void lpfc_sli4_els_xri_abort_event_proc(struct lpfc_hba *);
798800 void lpfc_sli4_fcp_xri_aborted(struct lpfc_hba *,
799801 struct sli4_wcqe_xri_aborted *);
802+void lpfc_sli4_nvme_xri_aborted(struct lpfc_hba *phba,
803+ struct sli4_wcqe_xri_aborted *axri);
804+void lpfc_sli4_nvmet_xri_aborted(struct lpfc_hba *phba,
805+ struct sli4_wcqe_xri_aborted *axri);
800806 void lpfc_sli4_els_xri_aborted(struct lpfc_hba *,
801807 struct sli4_wcqe_xri_aborted *);
802808 void lpfc_sli4_vport_delete_els_xri_aborted(struct lpfc_vport *);
drivers/scsi/lpfc/lpfc_version.h+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
2020 * included with this package. *
2121 *******************************************************************/
2222
23−#define LPFC_DRIVER_VERSION "11.2.0.7"
23+#define LPFC_DRIVER_VERSION "11.2.0.10"
2424 #define LPFC_DRIVER_NAME "lpfc"
2525
2626 /* Used for SLI 2/3 */
drivers/scsi/mpt3sas/mpt3sas_base.h+0−3
@@ -1442,9 +1442,6 @@ void mpt3sas_transport_update_links(struct MPT3SAS_ADAPTER *ioc, · 1441 unmodified lines
14421442 u64 sas_address, u16 handle, u8 phy_number, u8 link_rate);
14431443 extern struct sas_function_template mpt3sas_transport_functions;
14441444 extern struct scsi_transport_template *mpt3sas_transport_template;
1445−extern int scsi_internal_device_block(struct scsi_device *sdev);
1446−extern int scsi_internal_device_unblock(struct scsi_device *sdev,
1447− enum scsi_device_state new_state);
14481445 /* trigger data externs */
14491446 void mpt3sas_send_trigger_data_event(struct MPT3SAS_ADAPTER *ioc,
14501447 struct SL_WH_TRIGGERS_EVENT_DATA_T *event_data);
drivers/scsi/mpt3sas/mpt3sas_scsih.c+2−17
@@ -2859,7 +2859,7 @@ _scsih_internal_device_block(struct scsi_device *sdev, · 2858 unmodified lines
28592859 sas_device_priv_data->sas_target->handle);
28602860 sas_device_priv_data->block = 1;
28612861
2862− r = scsi_internal_device_block(sdev);
2862+ r = scsi_internal_device_block(sdev, false);
28632863 if (r == -EINVAL)
28642864 sdev_printk(KERN_WARNING, sdev,
28652865 "device_block failed with return(%d) for handle(0x%04x)\n",
@@ -2895,7 +2895,7 @@ _scsih_internal_device_unblock(struct scsi_device *sdev, · 29 unmodified lines
28952895 "performing a block followed by an unblock\n",
28962896 r, sas_device_priv_data->sas_target->handle);
28972897 sas_device_priv_data->block = 1;
2898− r = scsi_internal_device_block(sdev);
2898+ r = scsi_internal_device_block(sdev, false);
28992899 if (r)
29002900 sdev_printk(KERN_WARNING, sdev, "retried device_block "
29012901 "failed with return(%d) for handle(0x%04x)\n",
@@ -4677,7 +4677,6 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) · 1775 unmodified lines
46774677 struct MPT3SAS_DEVICE *sas_device_priv_data;
46784678 u32 response_code = 0;
46794679 unsigned long flags;
4680− unsigned int sector_sz;
46814680
46824681 mpi_reply = mpt3sas_base_get_reply_virt_addr(ioc, reply);
46834682
@@ -4742,20 +4741,6 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) · 58 unmodified lines
47424741 }
47434742
47444743 xfer_cnt = le32_to_cpu(mpi_reply->TransferCount);
4745−
4746− /* In case of bogus fw or device, we could end up having
4747− * unaligned partial completion. We can force alignment here,
4748− * then scsi-ml does not need to handle this misbehavior.
4749− */
4750− sector_sz = scmd->device->sector_size;
4751− if (unlikely(!blk_rq_is_passthrough(scmd->request) && sector_sz &&
4752− xfer_cnt % sector_sz)) {
4753− sdev_printk(KERN_INFO, scmd->device,
4754− "unaligned partial completion avoided (xfer_cnt=%u, sector_sz=%u)\n",
4755− xfer_cnt, sector_sz);
4756− xfer_cnt = round_down(xfer_cnt, sector_sz);
4757− }
4758−
47594744 scsi_set_resid(scmd, scsi_bufflen(scmd) - xfer_cnt);
47604745 if (ioc_status & MPI2_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE)
47614746 log_info = le32_to_cpu(mpi_reply->IOCLogInfo);
drivers/scsi/qedf/qedf_dbg.h+8−5
@@ -81,14 +81,17 @@ struct qedf_dbg_ctx { · 80 unmodified lines
8181 #define QEDF_INFO(pdev, level, fmt, ...) \
8282 qedf_dbg_info(pdev, __func__, __LINE__, level, fmt, \
8383 ## __VA_ARGS__)
84−
85−extern void qedf_dbg_err(struct qedf_dbg_ctx *qedf, const char *func, u32 line,
84+__printf(4, 5)
85+void qedf_dbg_err(struct qedf_dbg_ctx *qedf, const char *func, u32 line,
8686 const char *fmt, ...);
87−extern void qedf_dbg_warn(struct qedf_dbg_ctx *qedf, const char *func, u32 line,
87+__printf(4, 5)
88+void qedf_dbg_warn(struct qedf_dbg_ctx *qedf, const char *func, u32 line,
8889 const char *, ...);
89−extern void qedf_dbg_notice(struct qedf_dbg_ctx *qedf, const char *func,
90+__printf(4, 5)
91+void qedf_dbg_notice(struct qedf_dbg_ctx *qedf, const char *func,
9092 u32 line, const char *, ...);
91−extern void qedf_dbg_info(struct qedf_dbg_ctx *qedf, const char *func, u32 line,
93+__printf(5, 6)
94+void qedf_dbg_info(struct qedf_dbg_ctx *qedf, const char *func, u32 line,
9295 u32 info, const char *fmt, ...);
9396
9497 /* GRC Dump related defines */
drivers/scsi/qedf/qedf_fip.c+1−1
@@ -203,7 +203,7 @@ void qedf_fip_recv(struct qedf_ctx *qedf, struct sk_buff *skb) · 202 unmodified lines
203203 case FIP_DT_MAC:
204204 mp = (struct fip_mac_desc *)desc;
205205 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_LL2,
206− "fd_mac=%pM.\n", __func__, mp->fd_mac);
206+ "fd_mac=%pM\n", mp->fd_mac);
207207 ether_addr_copy(cvl_mac, mp->fd_mac);
208208 break;
209209 case FIP_DT_NAME:
drivers/scsi/qedf/qedf_io.c+2−2
@@ -1342,7 +1342,7 @@ void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe, · 1341 unmodified lines
13421342 } else {
13431343 refcount = kref_read(&io_req->refcount);
13441344 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO,
1345− "%d:0:%d:%d xid=0x%0x op=0x%02x "
1345+ "%d:0:%d:%lld xid=0x%0x op=0x%02x "
13461346 "lba=%02x%02x%02x%02x cdb_status=%d "
13471347 "fcp_resid=0x%x refcount=%d.\n",
13481348 qedf->lport->host->host_no, sc_cmd->device->id,
@@ -1426,7 +1426,7 @@ void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req, · 77 unmodified lines
14261426
14271427 sc_cmd->result = result << 16;
14281428 refcount = kref_read(&io_req->refcount);
1429− QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO, "%d:0:%d:%d: Completing "
1429+ QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO, "%d:0:%d:%lld: Completing "
14301430 "sc_cmd=%p result=0x%08x op=0x%02x lba=0x%02x%02x%02x%02x, "
14311431 "allowed=%d retries=%d refcount=%d.\n",
14321432 qedf->lport->host->host_no, sc_cmd->device->id,
drivers/scsi/qedf/qedf_main.c+2−2
@@ -2456,8 +2456,8 @@ static int qedf_alloc_bdq(struct qedf_ctx *qedf) · 2455 unmodified lines
24562456 }
24572457
24582458 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC,
2459− "BDQ PBL addr=0x%p dma=0x%llx.\n", qedf->bdq_pbl,
2460− qedf->bdq_pbl_dma);
2459+ "BDQ PBL addr=0x%p dma=%pad\n",
2460+ qedf->bdq_pbl, &qedf->bdq_pbl_dma);
24612461
24622462 /*
24632463 * Populate BDQ PBL with physical and virtual address of individual
drivers/scsi/qedi/qedi_debugfs.c+8−8
@@ -14,7 +14,7 @@ · 13 unmodified lines
1414 #include <linux/debugfs.h>
1515 #include <linux/module.h>
1616
17−int do_not_recover;
17+int qedi_do_not_recover;
1818 static struct dentry *qedi_dbg_root;
1919
2020 void
@@ -74,22 +74,22 @@ qedi_dbg_exit(void) · 53 unmodified lines
7474 static ssize_t
7575 qedi_dbg_do_not_recover_enable(struct qedi_dbg_ctx *qedi_dbg)
7676 {
77− if (!do_not_recover)
78− do_not_recover = 1;
77+ if (!qedi_do_not_recover)
78+ qedi_do_not_recover = 1;
7979
8080 QEDI_INFO(qedi_dbg, QEDI_LOG_DEBUGFS, "do_not_recover=%d\n",
81− do_not_recover);
81+ qedi_do_not_recover);
8282 return 0;
8383 }
8484
8585 static ssize_t
8686 qedi_dbg_do_not_recover_disable(struct qedi_dbg_ctx *qedi_dbg)
8787 {
88− if (do_not_recover)
89− do_not_recover = 0;
88+ if (qedi_do_not_recover)
89+ qedi_do_not_recover = 0;
9090
9191 QEDI_INFO(qedi_dbg, QEDI_LOG_DEBUGFS, "do_not_recover=%d\n",
92− do_not_recover);
92+ qedi_do_not_recover);
9393 return 0;
9494 }
9595
@@ -141,7 +141,7 @@ qedi_dbg_do_not_recover_cmd_read(struct file *filp, char __user *buffer, · 45 unmodified lines
141141 if (*ppos)
142142 return 0;
143143
144− cnt = sprintf(buffer, "do_not_recover=%d\n", do_not_recover);
144+ cnt = sprintf(buffer, "do_not_recover=%d\n", qedi_do_not_recover);
145145 cnt = min_t(int, count, cnt - *ppos);
146146 *ppos += cnt;
147147 return cnt;
drivers/scsi/qedi/qedi_fw.c+2−2
@@ -1461,9 +1461,9 @@ static void qedi_tmf_work(struct work_struct *work) · 1460 unmodified lines
14611461 get_itt(tmf_hdr->rtt), get_itt(ctask->itt), cmd->task_id,
14621462 qedi_conn->iscsi_conn_id);
14631463
1464− if (do_not_recover) {
1464+ if (qedi_do_not_recover) {
14651465 QEDI_ERR(&qedi->dbg_ctx, "DONT SEND CLEANUP/ABORT %d\n",
1466− do_not_recover);
1466+ qedi_do_not_recover);
14671467 goto abort_ret;
14681468 }
14691469
drivers/scsi/qedi/qedi_gbl.h+7−1
@@ -12,8 +12,14 @@ · 11 unmodified lines
1212
1313 #include "qedi_iscsi.h"
1414
15+#ifdef CONFIG_DEBUG_FS
16+extern int qedi_do_not_recover;
17+#else
18+#define qedi_do_not_recover (0)
19+#endif
20+
1521 extern uint qedi_io_tracing;
16−extern int do_not_recover;
22+
1723 extern struct scsi_host_template qedi_host_template;
1824 extern struct iscsi_transport qedi_iscsi_transport;
1925 extern const struct qed_iscsi_ops *qedi_ops;
drivers/scsi/qedi/qedi_iscsi.c+4−4
@@ -833,7 +833,7 @@ qedi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr, · 832 unmodified lines
833833 return ERR_PTR(ret);
834834 }
835835
836− if (do_not_recover) {
836+ if (qedi_do_not_recover) {
837837 ret = -ENOMEM;
838838 return ERR_PTR(ret);
839839 }
@@ -957,7 +957,7 @@ static int qedi_ep_poll(struct iscsi_endpoint *ep, int timeout_ms) · 117 unmodified lines
957957 struct qedi_endpoint *qedi_ep;
958958 int ret = 0;
959959
960− if (do_not_recover)
960+ if (qedi_do_not_recover)
961961 return 1;
962962
963963 qedi_ep = ep->dd_data;
@@ -1025,7 +1025,7 @@ static void qedi_ep_disconnect(struct iscsi_endpoint *ep) · 61 unmodified lines
10251025 }
10261026
10271027 if (test_bit(QEDI_IN_RECOVERY, &qedi->flags)) {
1028− if (do_not_recover) {
1028+ if (qedi_do_not_recover) {
10291029 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
10301030 "Do not recover cid=0x%x\n",
10311031 qedi_ep->iscsi_cid);
@@ -1039,7 +1039,7 @@ static void qedi_ep_disconnect(struct iscsi_endpoint *ep) · 7 unmodified lines
10391039 }
10401040 }
10411041
1042− if (do_not_recover)
1042+ if (qedi_do_not_recover)
10431043 goto ep_exit_recover;
10441044
10451045 switch (qedi_ep->state) {
drivers/scsi/qedi/qedi_main.c+1−1
@@ -1805,7 +1805,7 @@ static int __qedi_probe(struct pci_dev *pdev, int mode) · 1804 unmodified lines
18051805 */
18061806 qedi_ops->common->update_pf_params(qedi->cdev, &qedi->pf_params);
18071807
1808− qedi_setup_int(qedi);
1808+ rc = qedi_setup_int(qedi);
18091809 if (rc)
18101810 goto stop_iscsi_func;
18111811
drivers/scsi/qla2xxx/qla_dbg.c+4−8
@@ -2707,13 +2707,9 @@ ql_dump_buffer(uint32_t level, scsi_qla_host_t *vha, int32_t id, · 2706 unmodified lines
27072707 "%-+5d 0 1 2 3 4 5 6 7 8 9 A B C D E F\n", size);
27082708 ql_dbg(level, vha, id,
27092709 "----- -----------------------------------------------\n");
2710− for (cnt = 0; cnt < size; cnt++, buf++) {
2711− if (cnt % 16 == 0)
2712− ql_dbg(level, vha, id, "%04x:", cnt & ~0xFU);
2713− printk(" %02x", *buf);
2714− if (cnt % 16 == 15)
2715− printk("\n");
2710+ for (cnt = 0; cnt < size; cnt += 16) {
2711+ ql_dbg(level, vha, id, "%04x: ", cnt);
2712+ print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1,
2713+ buf + cnt, min(16U, size - cnt), false);
27162714 }
2717− if (cnt % 16 != 0)
2718− printk("\n");
27192715 }
drivers/scsi/scsi_lib.c+10−4
@@ -2932,6 +2932,8 @@ EXPORT_SYMBOL(scsi_target_resume); · 2931 unmodified lines
29322932 /**
29332933 * scsi_internal_device_block - internal function to put a device temporarily into the SDEV_BLOCK state
29342934 * @sdev: device to block
2935+ * @wait: Whether or not to wait until ongoing .queuecommand() /
2936+ * .queue_rq() calls have finished.
29352937 *
29362938 * Block request made by scsi lld's to temporarily stop all
29372939 * scsi commands on the specified device. May sleep.
@@ -2949,7 +2951,7 @@ EXPORT_SYMBOL(scsi_target_resume); · 11 unmodified lines
29492951 * remove the rport mutex lock and unlock calls from srp_queuecommand().
29502952 */
29512953 int
2952−scsi_internal_device_block(struct scsi_device *sdev)
2954+scsi_internal_device_block(struct scsi_device *sdev, bool wait)
29532955 {
29542956 struct request_queue *q = sdev->request_queue;
29552957 unsigned long flags;
@@ -2969,12 +2971,16 @@ scsi_internal_device_block(struct scsi_device *sdev) · 13 unmodified lines
29692971 * request queue.
29702972 */
29712973 if (q->mq_ops) {
2972− blk_mq_quiesce_queue(q);
2974+ if (wait)
2975+ blk_mq_quiesce_queue(q);
2976+ else
2977+ blk_mq_stop_hw_queues(q);
29732978 } else {
29742979 spin_lock_irqsave(q->queue_lock, flags);
29752980 blk_stop_queue(q);
29762981 spin_unlock_irqrestore(q->queue_lock, flags);
2977− scsi_wait_for_queuecommand(sdev);
2982+ if (wait)
2983+ scsi_wait_for_queuecommand(sdev);
29782984 }
29792985
29802986 return 0;
@@ -3036,7 +3042,7 @@ EXPORT_SYMBOL_GPL(scsi_internal_device_unblock); · 55 unmodified lines
30363042 static void
30373043 device_block(struct scsi_device *sdev, void *data)
30383044 {
3039− scsi_internal_device_block(sdev);
3045+ scsi_internal_device_block(sdev, true);
30403046 }
30413047
30423048 static int
drivers/scsi/scsi_priv.h+0−3
@@ -188,8 +188,5 @@ static inline void scsi_dh_remove_device(struct scsi_device *sdev) { } · 187 unmodified lines
188188 */
189189
190190 #define SCSI_DEVICE_BLOCK_MAX_TIMEOUT 600 /* units in seconds */
191−extern int scsi_internal_device_block(struct scsi_device *sdev);
192−extern int scsi_internal_device_unblock(struct scsi_device *sdev,
193− enum scsi_device_state new_state);
194191
195192 #endif /* _SCSI_PRIV_H */
drivers/scsi/sd.c+25−33
@@ -1783,6 +1783,8 @@ static int sd_done(struct scsi_cmnd *SCpnt) · 1782 unmodified lines
17831783 {
17841784 int result = SCpnt->result;
17851785 unsigned int good_bytes = result ? 0 : scsi_bufflen(SCpnt);
1786+ unsigned int sector_size = SCpnt->device->sector_size;
1787+ unsigned int resid;
17861788 struct scsi_sense_hdr sshdr;
17871789 struct scsi_disk *sdkp = scsi_disk(SCpnt->request->rq_disk);
17881790 struct request *req = SCpnt->request;
@@ -1813,6 +1815,21 @@ static int sd_done(struct scsi_cmnd *SCpnt) · 24 unmodified lines
18131815 scsi_set_resid(SCpnt, blk_rq_bytes(req));
18141816 }
18151817 break;
1818+ default:
1819+ /*
1820+ * In case of bogus fw or device, we could end up having
1821+ * an unaligned partial completion. Check this here and force
1822+ * alignment.
1823+ */
1824+ resid = scsi_get_resid(SCpnt);
1825+ if (resid & (sector_size - 1)) {
1826+ sd_printk(KERN_INFO, sdkp,
1827+ "Unaligned partial completion (resid=%u, sector_sz=%u)\n",
1828+ resid, sector_size);
1829+ resid = min(scsi_bufflen(SCpnt),
1830+ round_up(resid, sector_size));
1831+ scsi_set_resid(SCpnt, resid);
1832+ }
18161833 }
18171834
18181835 if (result) {
@@ -3075,23 +3092,6 @@ static void sd_probe_async(void *data, async_cookie_t cookie) · 1256 unmodified lines
30753092 put_device(&sdkp->dev);
30763093 }
30773094
3078−struct sd_devt {
3079− int idx;
3080− struct disk_devt disk_devt;
3081−};
3082−
3083−static void sd_devt_release(struct disk_devt *disk_devt)
3084−{
3085− struct sd_devt *sd_devt = container_of(disk_devt, struct sd_devt,
3086− disk_devt);
3087−
3088− spin_lock(&sd_index_lock);
3089− ida_remove(&sd_index_ida, sd_devt->idx);
3090− spin_unlock(&sd_index_lock);
3091−
3092− kfree(sd_devt);
3093−}
3094−
30953095 /**
30963096 * sd_probe - called during driver initialization and whenever a
30973097 * new scsi device is attached to the system. It is called once
@@ -3113,7 +3113,6 @@ static void sd_devt_release(struct disk_devt *disk_devt) · 15 unmodified lines
31133113 static int sd_probe(struct device *dev)
31143114 {
31153115 struct scsi_device *sdp = to_scsi_device(dev);
3116− struct sd_devt *sd_devt;
31173116 struct scsi_disk *sdkp;
31183117 struct gendisk *gd;
31193118 int index;
@@ -3139,13 +3138,9 @@ static int sd_probe(struct device *dev) · 19 unmodified lines
31393138 if (!sdkp)
31403139 goto out;
31413140
3142− sd_devt = kzalloc(sizeof(*sd_devt), GFP_KERNEL);
3143− if (!sd_devt)
3144− goto out_free;
3145−
31463141 gd = alloc_disk(SD_MINORS);
31473142 if (!gd)
3148− goto out_free_devt;
3143+ goto out_free;
31493144
31503145 do {
31513146 if (!ida_pre_get(&sd_index_ida, GFP_KERNEL))
@@ -3161,11 +3156,6 @@ static int sd_probe(struct device *dev) · 9 unmodified lines
31613156 goto out_put;
31623157 }
31633158
3164− atomic_set(&sd_devt->disk_devt.count, 1);
3165− sd_devt->disk_devt.release = sd_devt_release;
3166− sd_devt->idx = index;
3167− gd->disk_devt = &sd_devt->disk_devt;
3168−
31693159 error = sd_format_disk_name("sd", index, gd->disk_name, DISK_NAME_LEN);
31703160 if (error) {
31713161 sdev_printk(KERN_WARNING, sdp, "SCSI disk (sd) name length exceeded.\n");
@@ -3205,12 +3195,11 @@ static int sd_probe(struct device *dev) · 33 unmodified lines
32053195 return 0;
32063196
32073197 out_free_index:
3208− put_disk_devt(&sd_devt->disk_devt);
3209− sd_devt = NULL;
3198+ spin_lock(&sd_index_lock);
3199+ ida_remove(&sd_index_ida, index);
3200+ spin_unlock(&sd_index_lock);
32103201 out_put:
32113202 put_disk(gd);
3212− out_free_devt:
3213− kfree(sd_devt);
32143203 out_free:
32153204 kfree(sdkp);
32163205 out:
@@ -3271,7 +3260,10 @@ static void scsi_disk_release(struct device *dev) · 54 unmodified lines
32713260 struct scsi_disk *sdkp = to_scsi_disk(dev);
32723261 struct gendisk *disk = sdkp->disk;
32733262
3274− put_disk_devt(disk->disk_devt);
3263+ spin_lock(&sd_index_lock);
3264+ ida_remove(&sd_index_ida, sdkp->index);
3265+ spin_unlock(&sd_index_lock);
3266+
32753267 disk->private_data = NULL;
32763268 put_disk(disk);
32773269 put_device(&sdkp->device->sdev_gendev);
drivers/scsi/storvsc_drv.c+17−10
@@ -400,8 +400,6 @@ MODULE_PARM_DESC(storvsc_vcpus_per_sub_channel, "Ratio of VCPUs to subchannels") · 399 unmodified lines
400400 */
401401 static int storvsc_timeout = 180;
402402
403−static int msft_blist_flags = BLIST_TRY_VPD_PAGES;
404−
405403 #if IS_ENABLED(CONFIG_SCSI_FC_ATTRS)
406404 static struct scsi_transport_template *fc_transport_template;
407405 #endif
@@ -1383,6 +1381,22 @@ static int storvsc_do_io(struct hv_device *device, · 975 unmodified lines
13831381 return ret;
13841382 }
13851383
1384+static int storvsc_device_alloc(struct scsi_device *sdevice)
1385+{
1386+ /*
1387+ * Set blist flag to permit the reading of the VPD pages even when
1388+ * the target may claim SPC-2 compliance. MSFT targets currently
1389+ * claim SPC-2 compliance while they implement post SPC-2 features.
1390+ * With this flag we can correctly handle WRITE_SAME_16 issues.
1391+ *
1392+ * Hypervisor reports SCSI_UNKNOWN type for DVD ROM device but
1393+ * still supports REPORT LUN.
1394+ */
1395+ sdevice->sdev_bflags = BLIST_REPORTLUN2 | BLIST_TRY_VPD_PAGES;
1396+
1397+ return 0;
1398+}
1399+
13861400 static int storvsc_device_configure(struct scsi_device *sdevice)
13871401 {
13881402
@@ -1395,14 +1409,6 @@ static int storvsc_device_configure(struct scsi_device *sdevice) · 6 unmodified lines
13951409
13961410 sdevice->no_write_same = 1;
13971411
1398− /*
1399− * Add blist flags to permit the reading of the VPD pages even when
1400− * the target may claim SPC-2 compliance. MSFT targets currently
1401− * claim SPC-2 compliance while they implement post SPC-2 features.
1402− * With this patch we can correctly handle WRITE_SAME_16 issues.
1403− */
1404− sdevice->sdev_bflags |= msft_blist_flags;
1405−
14061412 /*
14071413 * If the host is WIN8 or WIN8 R2, claim conformance to SPC-3
14081414 * if the device is a MSFT virtual device. If the host is
@@ -1661,6 +1667,7 @@ static struct scsi_host_template scsi_driver = { · 252 unmodified lines
16611667 .eh_host_reset_handler = storvsc_host_reset_handler,
16621668 .proc_name = "storvsc_host",
16631669 .eh_timed_out = storvsc_eh_timed_out,
1670+ .slave_alloc = storvsc_device_alloc,
16641671 .slave_configure = storvsc_device_configure,
16651672 .cmd_per_lun = 255,
16661673 .this_id = -1,
drivers/scsi/ufs/ufs.h+8−14
@@ -146,7 +146,7 @@ enum attr_idn { · 145 unmodified lines
146146 /* Descriptor idn for Query requests */
147147 enum desc_idn {
148148 QUERY_DESC_IDN_DEVICE = 0x0,
149− QUERY_DESC_IDN_CONFIGURAION = 0x1,
149+ QUERY_DESC_IDN_CONFIGURATION = 0x1,
150150 QUERY_DESC_IDN_UNIT = 0x2,
151151 QUERY_DESC_IDN_RFU_0 = 0x3,
152152 QUERY_DESC_IDN_INTERCONNECT = 0x4,
@@ -162,19 +162,13 @@ enum desc_header_offset { · 9 unmodified lines
162162 QUERY_DESC_DESC_TYPE_OFFSET = 0x01,
163163 };
164164
165−enum ufs_desc_max_size {
166− QUERY_DESC_DEVICE_MAX_SIZE = 0x40,
167− QUERY_DESC_CONFIGURAION_MAX_SIZE = 0x90,
168− QUERY_DESC_UNIT_MAX_SIZE = 0x23,
169− QUERY_DESC_INTERCONNECT_MAX_SIZE = 0x06,
170− /*
171− * Max. 126 UNICODE characters (2 bytes per character) plus 2 bytes
172− * of descriptor header.
173− */
174− QUERY_DESC_STRING_MAX_SIZE = 0xFE,
175− QUERY_DESC_GEOMETRY_MAX_SIZE = 0x44,
176− QUERY_DESC_POWER_MAX_SIZE = 0x62,
177− QUERY_DESC_RFU_MAX_SIZE = 0x00,
165+enum ufs_desc_def_size {
166+ QUERY_DESC_DEVICE_DEF_SIZE = 0x40,
167+ QUERY_DESC_CONFIGURATION_DEF_SIZE = 0x90,
168+ QUERY_DESC_UNIT_DEF_SIZE = 0x23,
169+ QUERY_DESC_INTERCONNECT_DEF_SIZE = 0x06,
170+ QUERY_DESC_GEOMETRY_DEF_SIZE = 0x44,
171+ QUERY_DESC_POWER_DEF_SIZE = 0x62,
178172 };
179173
180174 /* Unit descriptor parameters offsets in bytes*/
drivers/scsi/ufs/ufshcd.c+173−58
@@ -100,19 +100,6 @@ · 99 unmodified lines
100100 #define ufshcd_hex_dump(prefix_str, buf, len) \
101101 print_hex_dump(KERN_ERR, prefix_str, DUMP_PREFIX_OFFSET, 16, 4, buf, len, false)
102102
103−static u32 ufs_query_desc_max_size[] = {
104− QUERY_DESC_DEVICE_MAX_SIZE,
105− QUERY_DESC_CONFIGURAION_MAX_SIZE,
106− QUERY_DESC_UNIT_MAX_SIZE,
107− QUERY_DESC_RFU_MAX_SIZE,
108− QUERY_DESC_INTERCONNECT_MAX_SIZE,
109− QUERY_DESC_STRING_MAX_SIZE,
110− QUERY_DESC_RFU_MAX_SIZE,
111− QUERY_DESC_GEOMETRY_MAX_SIZE,
112− QUERY_DESC_POWER_MAX_SIZE,
113− QUERY_DESC_RFU_MAX_SIZE,
114−};
115−
116103 enum {
117104 UFSHCD_MAX_CHANNEL = 0,
118105 UFSHCD_MAX_ID = 1,
@@ -2857,7 +2844,7 @@ static int __ufshcd_query_descriptor(struct ufs_hba *hba, · 2738 unmodified lines
28572844 goto out;
28582845 }
28592846
2860− if (*buf_len <= QUERY_DESC_MIN_SIZE || *buf_len > QUERY_DESC_MAX_SIZE) {
2847+ if (*buf_len < QUERY_DESC_MIN_SIZE || *buf_len > QUERY_DESC_MAX_SIZE) {
28612848 dev_err(hba->dev, "%s: descriptor buffer size (%d) is out of range\n",
28622849 __func__, *buf_len);
28632850 err = -EINVAL;
@@ -2937,6 +2924,92 @@ static int ufshcd_query_descriptor_retry(struct ufs_hba *hba, · 73 unmodified lines
29372924 return err;
29382925 }
29392926
2927+/**
2928+ * ufshcd_read_desc_length - read the specified descriptor length from header
2929+ * @hba: Pointer to adapter instance
2930+ * @desc_id: descriptor idn value
2931+ * @desc_index: descriptor index
2932+ * @desc_length: pointer to variable to read the length of descriptor
2933+ *
2934+ * Return 0 in case of success, non-zero otherwise
2935+ */
2936+static int ufshcd_read_desc_length(struct ufs_hba *hba,
2937+ enum desc_idn desc_id,
2938+ int desc_index,
2939+ int *desc_length)
2940+{
2941+ int ret;
2942+ u8 header[QUERY_DESC_HDR_SIZE];
2943+ int header_len = QUERY_DESC_HDR_SIZE;
2944+
2945+ if (desc_id >= QUERY_DESC_IDN_MAX)
2946+ return -EINVAL;
2947+
2948+ ret = ufshcd_query_descriptor_retry(hba, UPIU_QUERY_OPCODE_READ_DESC,
2949+ desc_id, desc_index, 0, header,
2950+ &header_len);
2951+
2952+ if (ret) {
2953+ dev_err(hba->dev, "%s: Failed to get descriptor header id %d",
2954+ __func__, desc_id);
2955+ return ret;
2956+ } else if (desc_id != header[QUERY_DESC_DESC_TYPE_OFFSET]) {
2957+ dev_warn(hba->dev, "%s: descriptor header id %d and desc_id %d mismatch",
2958+ __func__, header[QUERY_DESC_DESC_TYPE_OFFSET],
2959+ desc_id);
2960+ ret = -EINVAL;
2961+ }
2962+
2963+ *desc_length = header[QUERY_DESC_LENGTH_OFFSET];
2964+ return ret;
2965+
2966+}
2967+
2968+/**
2969+ * ufshcd_map_desc_id_to_length - map descriptor IDN to its length
2970+ * @hba: Pointer to adapter instance
2971+ * @desc_id: descriptor idn value
2972+ * @desc_len: mapped desc length (out)
2973+ *
2974+ * Return 0 in case of success, non-zero otherwise
2975+ */
2976+int ufshcd_map_desc_id_to_length(struct ufs_hba *hba,
2977+ enum desc_idn desc_id, int *desc_len)
2978+{
2979+ switch (desc_id) {
2980+ case QUERY_DESC_IDN_DEVICE:
2981+ *desc_len = hba->desc_size.dev_desc;
2982+ break;
2983+ case QUERY_DESC_IDN_POWER:
2984+ *desc_len = hba->desc_size.pwr_desc;
2985+ break;
2986+ case QUERY_DESC_IDN_GEOMETRY:
2987+ *desc_len = hba->desc_size.geom_desc;
2988+ break;
2989+ case QUERY_DESC_IDN_CONFIGURATION:
2990+ *desc_len = hba->desc_size.conf_desc;
2991+ break;
2992+ case QUERY_DESC_IDN_UNIT:
2993+ *desc_len = hba->desc_size.unit_desc;
2994+ break;
2995+ case QUERY_DESC_IDN_INTERCONNECT:
2996+ *desc_len = hba->desc_size.interc_desc;
2997+ break;
2998+ case QUERY_DESC_IDN_STRING:
2999+ *desc_len = QUERY_DESC_MAX_SIZE;
3000+ break;
3001+ case QUERY_DESC_IDN_RFU_0:
3002+ case QUERY_DESC_IDN_RFU_1:
3003+ *desc_len = 0;
3004+ break;
3005+ default:
3006+ *desc_len = 0;
3007+ return -EINVAL;
3008+ }
3009+ return 0;
3010+}
3011+EXPORT_SYMBOL(ufshcd_map_desc_id_to_length);
3012+
29403013 /**
29413014 * ufshcd_read_desc_param - read the specified descriptor parameter
29423015 * @hba: Pointer to adapter instance
@@ -2951,42 +3024,49 @@ static int ufshcd_query_descriptor_retry(struct ufs_hba *hba, · 8 unmodified lines
29513024 static int ufshcd_read_desc_param(struct ufs_hba *hba,
29523025 enum desc_idn desc_id,
29533026 int desc_index,
2954− u32 param_offset,
3027+ u8 param_offset,
29553028 u8 *param_read_buf,
2956− u32 param_size)
3029+ u8 param_size)
29573030 {
29583031 int ret;
29593032 u8 *desc_buf;
2960− u32 buff_len;
3033+ int buff_len;
29613034 bool is_kmalloc = true;
29623035
2963− /* safety checks */
2964− if (desc_id >= QUERY_DESC_IDN_MAX)
3036+ /* Safety check */
3037+ if (desc_id >= QUERY_DESC_IDN_MAX || !param_size)
29653038 return -EINVAL;
29663039
2967− buff_len = ufs_query_desc_max_size[desc_id];
2968− if ((param_offset + param_size) > buff_len)
2969− return -EINVAL;
3040+ /* Get the max length of descriptor from structure filled up at probe
3041+ * time.
3042+ */
3043+ ret = ufshcd_map_desc_id_to_length(hba, desc_id, &buff_len);
29703044
2971− if (!param_offset && (param_size == buff_len)) {
2972− /* memory space already available to hold full descriptor */
2973− desc_buf = param_read_buf;
2974− is_kmalloc = false;
2975− } else {
2976− /* allocate memory to hold full descriptor */
3045+ /* Sanity checks */
3046+ if (ret || !buff_len) {
3047+ dev_err(hba->dev, "%s: Failed to get full descriptor length",
3048+ __func__);
3049+ return ret;
3050+ }
3051+
3052+ /* Check whether we need temp memory */
3053+ if (param_offset != 0 || param_size < buff_len) {
29773054 desc_buf = kmalloc(buff_len, GFP_KERNEL);
29783055 if (!desc_buf)
29793056 return -ENOMEM;
3057+ } else {
3058+ desc_buf = param_read_buf;
3059+ is_kmalloc = false;
29803060 }
29813061
3062+ /* Request for full descriptor */
29823063 ret = ufshcd_query_descriptor_retry(hba, UPIU_QUERY_OPCODE_READ_DESC,
2983− desc_id, desc_index, 0, desc_buf,
2984− &buff_len);
3064+ desc_id, desc_index, 0,
3065+ desc_buf, &buff_len);
29853066
29863067 if (ret) {
29873068 dev_err(hba->dev, "%s: Failed reading descriptor. desc_id %d, desc_index %d, param_offset %d, ret %d",
29883069 __func__, desc_id, desc_index, param_offset, ret);
2989−
29903070 goto out;
29913071 }
29923072
@@ -2998,25 +3078,9 @@ static int ufshcd_read_desc_param(struct ufs_hba *hba, · 5 unmodified lines
29983078 goto out;
29993079 }
30003080
3001− /*
3002− * While reading variable size descriptors (like string descriptor),
3003− * some UFS devices may report the "LENGTH" (field in "Transaction
3004− * Specific fields" of Query Response UPIU) same as what was requested
3005− * in Query Request UPIU instead of reporting the actual size of the
3006− * variable size descriptor.
3007− * Although it's safe to ignore the "LENGTH" field for variable size
3008− * descriptors as we can always derive the length of the descriptor from
3009− * the descriptor header fields. Hence this change impose the length
3010− * match check only for fixed size descriptors (for which we always
3011− * request the correct size as part of Query Request UPIU).
3012− */
3013− if ((desc_id != QUERY_DESC_IDN_STRING) &&
3014− (buff_len != desc_buf[QUERY_DESC_LENGTH_OFFSET])) {
3015− dev_err(hba->dev, "%s: desc_buf length mismatch: buff_len %d, buff_len(desc_header) %d",
3016− __func__, buff_len, desc_buf[QUERY_DESC_LENGTH_OFFSET]);
3017− ret = -EINVAL;
3018− goto out;
3019− }
3081+ /* Check wherher we will not copy more data, than available */
3082+ if (is_kmalloc && param_size > buff_len)
3083+ param_size = buff_len;
30203084
30213085 if (is_kmalloc)
30223086 memcpy(param_read_buf, &desc_buf[param_offset], param_size);
@@ -5919,8 +5983,8 @@ static int ufshcd_set_icc_levels_attr(struct ufs_hba *hba, u32 icc_level) · 2896 unmodified lines
59195983 static void ufshcd_init_icc_levels(struct ufs_hba *hba)
59205984 {
59215985 int ret;
5922− int buff_len = QUERY_DESC_POWER_MAX_SIZE;
5923− u8 desc_buf[QUERY_DESC_POWER_MAX_SIZE];
5986+ int buff_len = hba->desc_size.pwr_desc;
5987+ u8 desc_buf[hba->desc_size.pwr_desc];
59245988
59255989 ret = ufshcd_read_power_desc(hba, desc_buf, buff_len);
59265990 if (ret) {
@@ -6017,11 +6081,10 @@ static int ufs_get_device_desc(struct ufs_hba *hba, · 90 unmodified lines
60176081 {
60186082 int err;
60196083 u8 model_index;
6020− u8 str_desc_buf[QUERY_DESC_STRING_MAX_SIZE + 1] = {0};
6021− u8 desc_buf[QUERY_DESC_DEVICE_MAX_SIZE];
6084+ u8 str_desc_buf[QUERY_DESC_MAX_SIZE + 1] = {0};
6085+ u8 desc_buf[hba->desc_size.dev_desc];
60226086
6023− err = ufshcd_read_device_desc(hba, desc_buf,
6024− QUERY_DESC_DEVICE_MAX_SIZE);
6087+ err = ufshcd_read_device_desc(hba, desc_buf, hba->desc_size.dev_desc);
60256088 if (err) {
60266089 dev_err(hba->dev, "%s: Failed reading Device Desc. err = %d\n",
60276090 __func__, err);
@@ -6038,14 +6101,14 @@ static int ufs_get_device_desc(struct ufs_hba *hba, · 10 unmodified lines
60386101 model_index = desc_buf[DEVICE_DESC_PARAM_PRDCT_NAME];
60396102
60406103 err = ufshcd_read_string_desc(hba, model_index, str_desc_buf,
6041− QUERY_DESC_STRING_MAX_SIZE, ASCII_STD);
6104+ QUERY_DESC_MAX_SIZE, ASCII_STD);
60426105 if (err) {
60436106 dev_err(hba->dev, "%s: Failed reading Product Name. err = %d\n",
60446107 __func__, err);
60456108 goto out;
60466109 }
60476110
6048− str_desc_buf[QUERY_DESC_STRING_MAX_SIZE] = '\0';
6111+ str_desc_buf[QUERY_DESC_MAX_SIZE] = '\0';
60496112 strlcpy(dev_desc->model, (str_desc_buf + QUERY_DESC_HDR_SIZE),
60506113 min_t(u8, str_desc_buf[QUERY_DESC_LENGTH_OFFSET],
60516114 MAX_MODEL_LEN));
@@ -6251,6 +6314,51 @@ static void ufshcd_clear_dbg_ufs_stats(struct ufs_hba *hba) · 199 unmodified lines
62516314 hba->req_abort_count = 0;
62526315 }
62536316
6317+static void ufshcd_init_desc_sizes(struct ufs_hba *hba)
6318+{
6319+ int err;
6320+
6321+ err = ufshcd_read_desc_length(hba, QUERY_DESC_IDN_DEVICE, 0,
6322+ &hba->desc_size.dev_desc);
6323+ if (err)
6324+ hba->desc_size.dev_desc = QUERY_DESC_DEVICE_DEF_SIZE;
6325+
6326+ err = ufshcd_read_desc_length(hba, QUERY_DESC_IDN_POWER, 0,
6327+ &hba->desc_size.pwr_desc);
6328+ if (err)
6329+ hba->desc_size.pwr_desc = QUERY_DESC_POWER_DEF_SIZE;
6330+
6331+ err = ufshcd_read_desc_length(hba, QUERY_DESC_IDN_INTERCONNECT, 0,
6332+ &hba->desc_size.interc_desc);
6333+ if (err)
6334+ hba->desc_size.interc_desc = QUERY_DESC_INTERCONNECT_DEF_SIZE;
6335+
6336+ err = ufshcd_read_desc_length(hba, QUERY_DESC_IDN_CONFIGURATION, 0,
6337+ &hba->desc_size.conf_desc);
6338+ if (err)
6339+ hba->desc_size.conf_desc = QUERY_DESC_CONFIGURATION_DEF_SIZE;
6340+
6341+ err = ufshcd_read_desc_length(hba, QUERY_DESC_IDN_UNIT, 0,
6342+ &hba->desc_size.unit_desc);
6343+ if (err)
6344+ hba->desc_size.unit_desc = QUERY_DESC_UNIT_DEF_SIZE;
6345+
6346+ err = ufshcd_read_desc_length(hba, QUERY_DESC_IDN_GEOMETRY, 0,
6347+ &hba->desc_size.geom_desc);
6348+ if (err)
6349+ hba->desc_size.geom_desc = QUERY_DESC_GEOMETRY_DEF_SIZE;
6350+}
6351+
6352+static void ufshcd_def_desc_sizes(struct ufs_hba *hba)
6353+{
6354+ hba->desc_size.dev_desc = QUERY_DESC_DEVICE_DEF_SIZE;
6355+ hba->desc_size.pwr_desc = QUERY_DESC_POWER_DEF_SIZE;
6356+ hba->desc_size.interc_desc = QUERY_DESC_INTERCONNECT_DEF_SIZE;
6357+ hba->desc_size.conf_desc = QUERY_DESC_CONFIGURATION_DEF_SIZE;
6358+ hba->desc_size.unit_desc = QUERY_DESC_UNIT_DEF_SIZE;
6359+ hba->desc_size.geom_desc = QUERY_DESC_GEOMETRY_DEF_SIZE;
6360+}
6361+
62546362 /**
62556363 * ufshcd_probe_hba - probe hba to detect device and initialize
62566364 * @hba: per-adapter instance
@@ -6285,6 +6393,9 @@ static int ufshcd_probe_hba(struct ufs_hba *hba) · 28 unmodified lines
62856393 if (ret)
62866394 goto out;
62876395
6396+ /* Init check for device descriptor sizes */
6397+ ufshcd_init_desc_sizes(hba);
6398+
62886399 ret = ufs_get_device_desc(hba, &card);
62896400 if (ret) {
62906401 dev_err(hba->dev, "%s: Failed getting device info. err = %d\n",
@@ -6320,6 +6431,7 @@ static int ufshcd_probe_hba(struct ufs_hba *hba) · 29 unmodified lines
63206431
63216432 /* set the state as operational after switching to desired gear */
63226433 hba->ufshcd_state = UFSHCD_STATE_OPERATIONAL;
6434+
63236435 /*
63246436 * If we are in error handling context or in power management callbacks
63256437 * context, no need to scan the host
@@ -7774,6 +7886,9 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) · 1448 unmodified lines
77747886 hba->mmio_base = mmio_base;
77757887 hba->irq = irq;
77767888
7889+ /* Set descriptor lengths to specification defaults */
7890+ ufshcd_def_desc_sizes(hba);
7891+
77777892 err = ufshcd_hba_init(hba);
77787893 if (err)
77797894 goto out_error;
drivers/scsi/ufs/ufshcd.h+15−0
@@ -220,6 +220,15 @@ struct ufs_dev_cmd { · 219 unmodified lines
220220 struct ufs_query query;
221221 };
222222
223+struct ufs_desc_size {
224+ int dev_desc;
225+ int pwr_desc;
226+ int geom_desc;
227+ int interc_desc;
228+ int unit_desc;
229+ int conf_desc;
230+};
231+
223232 /**
224233 * struct ufs_clk_info - UFS clock related info
225234 * @list: list headed by hba->clk_list_head
@@ -483,6 +492,7 @@ struct ufs_stats { · 257 unmodified lines
483492 * @clk_list_head: UFS host controller clocks list node head
484493 * @pwr_info: holds current power mode
485494 * @max_pwr_info: keeps the device max valid pwm
495+ * @desc_size: descriptor sizes reported by device
486496 * @urgent_bkops_lvl: keeps track of urgent bkops level for device
487497 * @is_urgent_bkops_lvl_checked: keeps track if the urgent bkops level for
488498 * device is known or not.
@@ -666,6 +676,7 @@ struct ufs_hba { · 177 unmodified lines
666676 bool is_urgent_bkops_lvl_checked;
667677
668678 struct rw_semaphore clk_scaling_lock;
679+ struct ufs_desc_size desc_size;
669680 };
670681
671682 /* Returns true if clocks can be gated. Otherwise false */
@@ -832,6 +843,10 @@ int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode, · 160 unmodified lines
832843 enum flag_idn idn, bool *flag_res);
833844 int ufshcd_hold(struct ufs_hba *hba, bool async);
834845 void ufshcd_release(struct ufs_hba *hba);
846+
847+int ufshcd_map_desc_id_to_length(struct ufs_hba *hba, enum desc_idn desc_id,
848+ int *desc_length);
849+
835850 u32 ufshcd_get_local_unipro_ver(struct ufs_hba *hba);
836851
837852 /* Wrapper functions for safely calling variant operations */
drivers/scsi/vmw_pvscsi.c+1−1
@@ -1487,7 +1487,7 @@ static int pvscsi_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 1486 unmodified lines
14871487 irq_flag &= ~PCI_IRQ_MSI;
14881488
14891489 error = pci_alloc_irq_vectors(adapter->dev, 1, 1, irq_flag);
1490− if (error)
1490+ if (error < 0)
14911491 goto out_reset_adapter;
14921492
14931493 adapter->use_req_threshold = pvscsi_setup_req_threshold(adapter, true);
drivers/staging/lustre/lnet/lnet/lib-socket.c+2−2
@@ -532,7 +532,7 @@ lnet_sock_accept(struct socket **newsockp, struct socket *sock) · 531 unmodified lines
532532
533533 newsock->ops = sock->ops;
534534
535− rc = sock->ops->accept(sock, newsock, O_NONBLOCK);
535+ rc = sock->ops->accept(sock, newsock, O_NONBLOCK, false);
536536 if (rc == -EAGAIN) {
537537 /* Nothing ready, so wait for activity */
538538 init_waitqueue_entry(&wait, current);
@@ -540,7 +540,7 @@ lnet_sock_accept(struct socket **newsockp, struct socket *sock) · 1 unmodified line
540540 set_current_state(TASK_INTERRUPTIBLE);
541541 schedule();
542542 remove_wait_queue(sk_sleep(sock->sk), &wait);
543− rc = sock->ops->accept(sock, newsock, O_NONBLOCK);
543+ rc = sock->ops->accept(sock, newsock, O_NONBLOCK, false);
544544 }
545545
546546 if (rc)
drivers/staging/octeon/ethernet-rx.c+0−1
@@ -336,7 +336,6 @@ static int cvm_oct_poll(struct oct_rx_group *rx_group, int budget) · 335 unmodified lines
336336 if (likely((port < TOTAL_NUMBER_OF_PORTS) &&
337337 cvm_oct_device[port])) {
338338 struct net_device *dev = cvm_oct_device[port];
339− struct octeon_ethernet *priv = netdev_priv(dev);
340339
341340 /*
342341 * Only accept packets for devices that are
drivers/staging/vc04_services/Kconfig+1−0
@@ -1,6 +1,7 @@
11 config BCM2835_VCHIQ
22 tristate "Videocore VCHIQ"
33 depends on HAS_DMA
4+ depends on OF
45 depends on RASPBERRYPI_FIRMWARE || (COMPILE_TEST && !RASPBERRYPI_FIRMWARE)
56 default y
67 help
drivers/tty/n_hdlc.c+69−63
@@ -114,7 +114,7 @@ · 113 unmodified lines
114114 #define DEFAULT_TX_BUF_COUNT 3
115115
116116 struct n_hdlc_buf {
117− struct n_hdlc_buf *link;
117+ struct list_head list_item;
118118 int count;
119119 char buf[1];
120120 };
@@ -122,8 +122,7 @@ struct n_hdlc_buf { · 1 unmodified line
122122 #define N_HDLC_BUF_SIZE (sizeof(struct n_hdlc_buf) + maxframe)
123123
124124 struct n_hdlc_buf_list {
125− struct n_hdlc_buf *head;
126− struct n_hdlc_buf *tail;
125+ struct list_head list;
127126 int count;
128127 spinlock_t spinlock;
129128 };
@@ -136,7 +135,6 @@ struct n_hdlc_buf_list { · 6 unmodified lines
136135 * @backup_tty - TTY to use if tty gets closed
137136 * @tbusy - reentrancy flag for tx wakeup code
138137 * @woke_up - FIXME: describe this field
139− * @tbuf - currently transmitting tx buffer
140138 * @tx_buf_list - list of pending transmit frame buffers
141139 * @rx_buf_list - list of received frame buffers
142140 * @tx_free_buf_list - list unused transmit frame buffers
@@ -149,7 +147,6 @@ struct n_hdlc { · 6 unmodified lines
149147 struct tty_struct *backup_tty;
150148 int tbusy;
151149 int woke_up;
152− struct n_hdlc_buf *tbuf;
153150 struct n_hdlc_buf_list tx_buf_list;
154151 struct n_hdlc_buf_list rx_buf_list;
155152 struct n_hdlc_buf_list tx_free_buf_list;
@@ -159,6 +156,8 @@ struct n_hdlc { · 3 unmodified lines
159156 /*
160157 * HDLC buffer list manipulation functions
161158 */
159+static void n_hdlc_buf_return(struct n_hdlc_buf_list *buf_list,
160+ struct n_hdlc_buf *buf);
162161 static void n_hdlc_buf_put(struct n_hdlc_buf_list *list,
163162 struct n_hdlc_buf *buf);
164163 static struct n_hdlc_buf *n_hdlc_buf_get(struct n_hdlc_buf_list *list);
@@ -208,16 +207,9 @@ static void flush_tx_queue(struct tty_struct *tty) · 43 unmodified lines
208207 {
209208 struct n_hdlc *n_hdlc = tty2n_hdlc(tty);
210209 struct n_hdlc_buf *buf;
211− unsigned long flags;
212210
213211 while ((buf = n_hdlc_buf_get(&n_hdlc->tx_buf_list)))
214212 n_hdlc_buf_put(&n_hdlc->tx_free_buf_list, buf);
215− spin_lock_irqsave(&n_hdlc->tx_buf_list.spinlock, flags);
216− if (n_hdlc->tbuf) {
217− n_hdlc_buf_put(&n_hdlc->tx_free_buf_list, n_hdlc->tbuf);
218− n_hdlc->tbuf = NULL;
219− }
220− spin_unlock_irqrestore(&n_hdlc->tx_buf_list.spinlock, flags);
221213 }
222214
223215 static struct tty_ldisc_ops n_hdlc_ldisc = {
@@ -283,7 +275,6 @@ static void n_hdlc_release(struct n_hdlc *n_hdlc) · 59 unmodified lines
283275 } else
284276 break;
285277 }
286− kfree(n_hdlc->tbuf);
287278 kfree(n_hdlc);
288279
289280 } /* end of n_hdlc_release() */
@@ -402,13 +393,7 @@ static void n_hdlc_send_frames(struct n_hdlc *n_hdlc, struct tty_struct *tty) · 112 unmodified lines
402393 n_hdlc->woke_up = 0;
403394 spin_unlock_irqrestore(&n_hdlc->tx_buf_list.spinlock, flags);
404395
405− /* get current transmit buffer or get new transmit */
406− /* buffer from list of pending transmit buffers */
407−
408− tbuf = n_hdlc->tbuf;
409− if (!tbuf)
410− tbuf = n_hdlc_buf_get(&n_hdlc->tx_buf_list);
411−
396+ tbuf = n_hdlc_buf_get(&n_hdlc->tx_buf_list);
412397 while (tbuf) {
413398 if (debuglevel >= DEBUG_LEVEL_INFO)
414399 printk("%s(%d)sending frame %p, count=%d\n",
@@ -420,7 +405,7 @@ static void n_hdlc_send_frames(struct n_hdlc *n_hdlc, struct tty_struct *tty) · 5 unmodified lines
420405
421406 /* rollback was possible and has been done */
422407 if (actual == -ERESTARTSYS) {
423− n_hdlc->tbuf = tbuf;
408+ n_hdlc_buf_return(&n_hdlc->tx_buf_list, tbuf);
424409 break;
425410 }
426411 /* if transmit error, throw frame away by */
@@ -435,10 +420,7 @@ static void n_hdlc_send_frames(struct n_hdlc *n_hdlc, struct tty_struct *tty) · 8 unmodified lines
435420
436421 /* free current transmit buffer */
437422 n_hdlc_buf_put(&n_hdlc->tx_free_buf_list, tbuf);
438−
439− /* this tx buffer is done */
440− n_hdlc->tbuf = NULL;
441−
423+
442424 /* wait up sleeping writers */
443425 wake_up_interruptible(&tty->write_wait);
444426
@@ -448,10 +430,12 @@ static void n_hdlc_send_frames(struct n_hdlc *n_hdlc, struct tty_struct *tty) · 3 unmodified lines
448430 if (debuglevel >= DEBUG_LEVEL_INFO)
449431 printk("%s(%d)frame %p pending\n",
450432 __FILE__,__LINE__,tbuf);
451−
452− /* buffer not accepted by driver */
453− /* set this buffer as pending buffer */
454− n_hdlc->tbuf = tbuf;
433+
434+ /*
435+ * the buffer was not accepted by driver,
436+ * return it back into tx queue
437+ */
438+ n_hdlc_buf_return(&n_hdlc->tx_buf_list, tbuf);
455439 break;
456440 }
457441 }
@@ -749,7 +733,8 @@ static int n_hdlc_tty_ioctl(struct tty_struct *tty, struct file *file, · 291 unmodified lines
749733 int error = 0;
750734 int count;
751735 unsigned long flags;
752−
736+ struct n_hdlc_buf *buf = NULL;
737+
753738 if (debuglevel >= DEBUG_LEVEL_INFO)
754739 printk("%s(%d)n_hdlc_tty_ioctl() called %d\n",
755740 __FILE__,__LINE__,cmd);
@@ -763,8 +748,10 @@ static int n_hdlc_tty_ioctl(struct tty_struct *tty, struct file *file, · 7 unmodified lines
763748 /* report count of read data available */
764749 /* in next available frame (if any) */
765750 spin_lock_irqsave(&n_hdlc->rx_buf_list.spinlock,flags);
766− if (n_hdlc->rx_buf_list.head)
767− count = n_hdlc->rx_buf_list.head->count;
751+ buf = list_first_entry_or_null(&n_hdlc->rx_buf_list.list,
752+ struct n_hdlc_buf, list_item);
753+ if (buf)
754+ count = buf->count;
768755 else
769756 count = 0;
770757 spin_unlock_irqrestore(&n_hdlc->rx_buf_list.spinlock,flags);
@@ -776,8 +763,10 @@ static int n_hdlc_tty_ioctl(struct tty_struct *tty, struct file *file, · 5 unmodified lines
776763 count = tty_chars_in_buffer(tty);
777764 /* add size of next output frame in queue */
778765 spin_lock_irqsave(&n_hdlc->tx_buf_list.spinlock,flags);
779− if (n_hdlc->tx_buf_list.head)
780− count += n_hdlc->tx_buf_list.head->count;
766+ buf = list_first_entry_or_null(&n_hdlc->tx_buf_list.list,
767+ struct n_hdlc_buf, list_item);
768+ if (buf)
769+ count += buf->count;
781770 spin_unlock_irqrestore(&n_hdlc->tx_buf_list.spinlock,flags);
782771 error = put_user(count, (int __user *)arg);
783772 break;
@@ -825,14 +814,14 @@ static unsigned int n_hdlc_tty_poll(struct tty_struct *tty, struct file *filp, · 41 unmodified lines
825814 poll_wait(filp, &tty->write_wait, wait);
826815
827816 /* set bits for operations that won't block */
828− if (n_hdlc->rx_buf_list.head)
817+ if (!list_empty(&n_hdlc->rx_buf_list.list))
829818 mask |= POLLIN | POLLRDNORM; /* readable */
830819 if (test_bit(TTY_OTHER_CLOSED, &tty->flags))
831820 mask |= POLLHUP;
832821 if (tty_hung_up_p(filp))
833822 mask |= POLLHUP;
834823 if (!tty_is_writelocked(tty) &&
835− n_hdlc->tx_free_buf_list.head)
824+ !list_empty(&n_hdlc->tx_free_buf_list.list))
836825 mask |= POLLOUT | POLLWRNORM; /* writable */
837826 }
838827 return mask;
@@ -856,7 +845,12 @@ static struct n_hdlc *n_hdlc_alloc(void) · 17 unmodified lines
856845 spin_lock_init(&n_hdlc->tx_free_buf_list.spinlock);
857846 spin_lock_init(&n_hdlc->rx_buf_list.spinlock);
858847 spin_lock_init(&n_hdlc->tx_buf_list.spinlock);
859−
848+
849+ INIT_LIST_HEAD(&n_hdlc->rx_free_buf_list.list);
850+ INIT_LIST_HEAD(&n_hdlc->tx_free_buf_list.list);
851+ INIT_LIST_HEAD(&n_hdlc->rx_buf_list.list);
852+ INIT_LIST_HEAD(&n_hdlc->tx_buf_list.list);
853+
860854 /* allocate free rx buffer list */
861855 for(i=0;i<DEFAULT_RX_BUF_COUNT;i++) {
862856 buf = kmalloc(N_HDLC_BUF_SIZE, GFP_KERNEL);
@@ -883,54 +877,66 @@ static struct n_hdlc *n_hdlc_alloc(void) · 20 unmodified lines
883877
884878 } /* end of n_hdlc_alloc() */
885879
880+/**
881+ * n_hdlc_buf_return - put the HDLC buffer after the head of the specified list
882+ * @buf_list - pointer to the buffer list
883+ * @buf - pointer to the buffer
884+ */
885+static void n_hdlc_buf_return(struct n_hdlc_buf_list *buf_list,
886+ struct n_hdlc_buf *buf)
887+{
888+ unsigned long flags;
889+
890+ spin_lock_irqsave(&buf_list->spinlock, flags);
891+
892+ list_add(&buf->list_item, &buf_list->list);
893+ buf_list->count++;
894+
895+ spin_unlock_irqrestore(&buf_list->spinlock, flags);
896+}
897+
886898 /**
887899 * n_hdlc_buf_put - add specified HDLC buffer to tail of specified list
888− * @list - pointer to buffer list
900+ * @buf_list - pointer to buffer list
889901 * @buf - pointer to buffer
890902 */
891−static void n_hdlc_buf_put(struct n_hdlc_buf_list *list,
903+static void n_hdlc_buf_put(struct n_hdlc_buf_list *buf_list,
892904 struct n_hdlc_buf *buf)
893905 {
894906 unsigned long flags;
895− spin_lock_irqsave(&list->spinlock,flags);
896−
897− buf->link=NULL;
898− if (list->tail)
899− list->tail->link = buf;
900− else
901− list->head = buf;
902− list->tail = buf;
903− (list->count)++;
904−
905− spin_unlock_irqrestore(&list->spinlock,flags);
906−
907+
908+ spin_lock_irqsave(&buf_list->spinlock, flags);
909+
910+ list_add_tail(&buf->list_item, &buf_list->list);
911+ buf_list->count++;
912+
913+ spin_unlock_irqrestore(&buf_list->spinlock, flags);
907914 } /* end of n_hdlc_buf_put() */
908915
909916 /**
910917 * n_hdlc_buf_get - remove and return an HDLC buffer from list
911− * @list - pointer to HDLC buffer list
918+ * @buf_list - pointer to HDLC buffer list
912919 *
913920 * Remove and return an HDLC buffer from the head of the specified HDLC buffer
914921 * list.
915922 * Returns a pointer to HDLC buffer if available, otherwise %NULL.
916923 */
917−static struct n_hdlc_buf* n_hdlc_buf_get(struct n_hdlc_buf_list *list)
924+static struct n_hdlc_buf *n_hdlc_buf_get(struct n_hdlc_buf_list *buf_list)
918925 {
919926 unsigned long flags;
920927 struct n_hdlc_buf *buf;
921− spin_lock_irqsave(&list->spinlock,flags);
922−
923− buf = list->head;
928+
929+ spin_lock_irqsave(&buf_list->spinlock, flags);
930+
931+ buf = list_first_entry_or_null(&buf_list->list,
932+ struct n_hdlc_buf, list_item);
924933 if (buf) {
925− list->head = buf->link;
926− (list->count)--;
934+ list_del(&buf->list_item);
935+ buf_list->count--;
927936 }
928− if (!list->head)
929− list->tail = NULL;
930−
931− spin_unlock_irqrestore(&list->spinlock,flags);
937+
938+ spin_unlock_irqrestore(&buf_list->spinlock, flags);
932939 return buf;
933−
934940 } /* end of n_hdlc_buf_get() */
935941
936942 static char hdlc_banner[] __initdata =
drivers/tty/serial/samsung.c+4−2
@@ -1031,8 +1031,10 @@ static int s3c64xx_serial_startup(struct uart_port *port) · 1030 unmodified lines
10311031 if (ourport->dma) {
10321032 ret = s3c24xx_serial_request_dma(ourport);
10331033 if (ret < 0) {
1034− dev_warn(port->dev, "DMA request failed\n");
1035− return ret;
1034+ dev_warn(port->dev,
1035+ "DMA request failed, DMA will not be used\n");
1036+ devm_kfree(port->dev, ourport->dma);
1037+ ourport->dma = NULL;
10361038 }
10371039 }
10381040
drivers/usb/dwc3/dwc3-omap.c+2−1
@@ -250,6 +250,7 @@ static void dwc3_omap_set_mailbox(struct dwc3_omap *omap, · 249 unmodified lines
250250 val = dwc3_omap_read_utmi_ctrl(omap);
251251 val |= USBOTGSS_UTMI_OTG_CTRL_IDDIG;
252252 dwc3_omap_write_utmi_ctrl(omap, val);
253+ break;
253254
254255 case OMAP_DWC3_VBUS_OFF:
255256 val = dwc3_omap_read_utmi_ctrl(omap);
@@ -392,7 +393,7 @@ static void dwc3_omap_set_utmi_mode(struct dwc3_omap *omap) · 136 unmodified lines
392393 {
393394 u32 reg;
394395 struct device_node *node = omap->dev->of_node;
395− int utmi_mode = 0;
396+ u32 utmi_mode = 0;
396397
397398 reg = dwc3_omap_read_utmi_ctrl(omap);
398399
drivers/usb/dwc3/gadget.c+67−9
@@ -1342,6 +1342,68 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep, · 1341 unmodified lines
13421342 if (r == req) {
13431343 /* wait until it is processed */
13441344 dwc3_stop_active_transfer(dwc, dep->number, true);
1345+
1346+ /*
1347+ * If request was already started, this means we had to
1348+ * stop the transfer. With that we also need to ignore
1349+ * all TRBs used by the request, however TRBs can only
1350+ * be modified after completion of END_TRANSFER
1351+ * command. So what we do here is that we wait for
1352+ * END_TRANSFER completion and only after that, we jump
1353+ * over TRBs by clearing HWO and incrementing dequeue
1354+ * pointer.
1355+ *
1356+ * Note that we have 2 possible types of transfers here:
1357+ *
1358+ * i) Linear buffer request
1359+ * ii) SG-list based request
1360+ *
1361+ * SG-list based requests will have r->num_pending_sgs
1362+ * set to a valid number (> 0). Linear requests,
1363+ * normally use a single TRB.
1364+ *
1365+ * For each of these two cases, if r->unaligned flag is
1366+ * set, one extra TRB has been used to align transfer
1367+ * size to wMaxPacketSize.
1368+ *
1369+ * All of these cases need to be taken into
1370+ * consideration so we don't mess up our TRB ring
1371+ * pointers.
1372+ */
1373+ wait_event_lock_irq(dep->wait_end_transfer,
1374+ !(dep->flags & DWC3_EP_END_TRANSFER_PENDING),
1375+ dwc->lock);
1376+
1377+ if (!r->trb)
1378+ goto out1;
1379+
1380+ if (r->num_pending_sgs) {
1381+ struct dwc3_trb *trb;
1382+ int i = 0;
1383+
1384+ for (i = 0; i < r->num_pending_sgs; i++) {
1385+ trb = r->trb + i;
1386+ trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
1387+ dwc3_ep_inc_deq(dep);
1388+ }
1389+
1390+ if (r->unaligned) {
1391+ trb = r->trb + r->num_pending_sgs + 1;
1392+ trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
1393+ dwc3_ep_inc_deq(dep);
1394+ }
1395+ } else {
1396+ struct dwc3_trb *trb = r->trb;
1397+
1398+ trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
1399+ dwc3_ep_inc_deq(dep);
1400+
1401+ if (r->unaligned) {
1402+ trb = r->trb + 1;
1403+ trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
1404+ dwc3_ep_inc_deq(dep);
1405+ }
1406+ }
13451407 goto out1;
13461408 }
13471409 dev_err(dwc->dev, "request %p was not queued to %s\n",
@@ -1352,6 +1414,7 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep, · 4 unmodified lines
13521414
13531415 out1:
13541416 /* giveback the request */
1417+ dep->queued_requests--;
13551418 dwc3_gadget_giveback(dep, req, -ECONNRESET);
13561419
13571420 out0:
@@ -2126,12 +2189,12 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep, · 768 unmodified lines
21262189 return 1;
21272190 }
21282191
2129− if ((trb->ctrl & DWC3_TRB_CTRL_HWO) && status != -ESHUTDOWN)
2130− return 1;
2131−
21322192 count = trb->size & DWC3_TRB_SIZE_MASK;
21332193 req->remaining += count;
21342194
2195+ if ((trb->ctrl & DWC3_TRB_CTRL_HWO) && status != -ESHUTDOWN)
2196+ return 1;
2197+
21352198 if (dep->direction) {
21362199 if (count) {
21372200 trb_status = DWC3_TRB_SIZE_TRBSTS(trb->size);
@@ -3228,15 +3291,10 @@ void dwc3_gadget_exit(struct dwc3 *dwc) · 1090 unmodified lines
32283291
32293292 int dwc3_gadget_suspend(struct dwc3 *dwc)
32303293 {
3231− int ret;
3232−
32333294 if (!dwc->gadget_driver)
32343295 return 0;
32353296
3236− ret = dwc3_gadget_run_stop(dwc, false, false);
3237− if (ret < 0)
3238− return ret;
3239−
3297+ dwc3_gadget_run_stop(dwc, false, false);
32403298 dwc3_disconnect_gadget(dwc);
32413299 __dwc3_gadget_stop(dwc);
32423300
drivers/usb/dwc3/gadget.h+7−7
@@ -28,23 +28,23 @@ struct dwc3; · 27 unmodified lines
2828 #define gadget_to_dwc(g) (container_of(g, struct dwc3, gadget))
2929
3030 /* DEPCFG parameter 1 */
31−#define DWC3_DEPCFG_INT_NUM(n) ((n) << 0)
31+#define DWC3_DEPCFG_INT_NUM(n) (((n) & 0x1f) << 0)
3232 #define DWC3_DEPCFG_XFER_COMPLETE_EN (1 << 8)
3333 #define DWC3_DEPCFG_XFER_IN_PROGRESS_EN (1 << 9)
3434 #define DWC3_DEPCFG_XFER_NOT_READY_EN (1 << 10)
3535 #define DWC3_DEPCFG_FIFO_ERROR_EN (1 << 11)
3636 #define DWC3_DEPCFG_STREAM_EVENT_EN (1 << 13)
37−#define DWC3_DEPCFG_BINTERVAL_M1(n) ((n) << 16)
37+#define DWC3_DEPCFG_BINTERVAL_M1(n) (((n) & 0xff) << 16)
3838 #define DWC3_DEPCFG_STREAM_CAPABLE (1 << 24)
39−#define DWC3_DEPCFG_EP_NUMBER(n) ((n) << 25)
39+#define DWC3_DEPCFG_EP_NUMBER(n) (((n) & 0x1f) << 25)
4040 #define DWC3_DEPCFG_BULK_BASED (1 << 30)
4141 #define DWC3_DEPCFG_FIFO_BASED (1 << 31)
4242
4343 /* DEPCFG parameter 0 */
44−#define DWC3_DEPCFG_EP_TYPE(n) ((n) << 1)
45−#define DWC3_DEPCFG_MAX_PACKET_SIZE(n) ((n) << 3)
46−#define DWC3_DEPCFG_FIFO_NUMBER(n) ((n) << 17)
47−#define DWC3_DEPCFG_BURST_SIZE(n) ((n) << 22)
44+#define DWC3_DEPCFG_EP_TYPE(n) (((n) & 0x3) << 1)
45+#define DWC3_DEPCFG_MAX_PACKET_SIZE(n) (((n) & 0x7ff) << 3)
46+#define DWC3_DEPCFG_FIFO_NUMBER(n) (((n) & 0x1f) << 17)
47+#define DWC3_DEPCFG_BURST_SIZE(n) (((n) & 0xf) << 22)
4848 #define DWC3_DEPCFG_DATA_SEQ_NUM(n) ((n) << 26)
4949 /* This applies for core versions earlier than 1.94a */
5050 #define DWC3_DEPCFG_IGN_SEQ_NUM (1 << 31)
drivers/usb/gadget/configfs.c+1−0
@@ -269,6 +269,7 @@ static ssize_t gadget_dev_desc_UDC_store(struct config_item *item, · 268 unmodified lines
269269 ret = unregister_gadget(gi);
270270 if (ret)
271271 goto err;
272+ kfree(name);
272273 } else {
273274 if (gi->composite.gadget_driver.udc_name) {
274275 ret = -EBUSY;
drivers/usb/gadget/function/f_fs.c+14−3
@@ -1834,11 +1834,14 @@ static int ffs_func_eps_enable(struct ffs_function *func) · 1833 unmodified lines
18341834 spin_lock_irqsave(&func->ffs->eps_lock, flags);
18351835 while(count--) {
18361836 struct usb_endpoint_descriptor *ds;
1837+ struct usb_ss_ep_comp_descriptor *comp_desc = NULL;
1838+ int needs_comp_desc = false;
18371839 int desc_idx;
18381840
1839− if (ffs->gadget->speed == USB_SPEED_SUPER)
1841+ if (ffs->gadget->speed == USB_SPEED_SUPER) {
18401842 desc_idx = 2;
1841− else if (ffs->gadget->speed == USB_SPEED_HIGH)
1843+ needs_comp_desc = true;
1844+ } else if (ffs->gadget->speed == USB_SPEED_HIGH)
18421845 desc_idx = 1;
18431846 else
18441847 desc_idx = 0;
@@ -1855,6 +1858,14 @@ static int ffs_func_eps_enable(struct ffs_function *func) · 10 unmodified lines
18551858
18561859 ep->ep->driver_data = ep;
18571860 ep->ep->desc = ds;
1861+
1862+ comp_desc = (struct usb_ss_ep_comp_descriptor *)(ds +
1863+ USB_DT_ENDPOINT_SIZE);
1864+ ep->ep->maxburst = comp_desc->bMaxBurst + 1;
1865+
1866+ if (needs_comp_desc)
1867+ ep->ep->comp_desc = comp_desc;
1868+
18581869 ret = usb_ep_enable(ep->ep);
18591870 if (likely(!ret)) {
18601871 epfile->ep = ep;
@@ -2253,7 +2264,7 @@ static int __ffs_data_do_os_desc(enum ffs_os_desc_type type, · 392 unmodified lines
22532264
22542265 if (len < sizeof(*d) ||
22552266 d->bFirstInterfaceNumber >= ffs->interfaces_count ||
2256− d->Reserved1)
2267+ !d->Reserved1)
22572268 return -EINVAL;
22582269 for (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i)
22592270 if (d->Reserved2[i])
drivers/usb/gadget/function/f_uvc.c+0−7
@@ -258,13 +258,6 @@ uvc_function_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl) · 257 unmodified lines
258258 memcpy(&uvc_event->req, ctrl, sizeof(uvc_event->req));
259259 v4l2_event_queue(&uvc->vdev, &v4l2_event);
260260
261− /* Pass additional setup data to userspace */
262− if (uvc->event_setup_out && uvc->event_length) {
263− uvc->control_req->length = uvc->event_length;
264− return usb_ep_queue(uvc->func.config->cdev->gadget->ep0,
265− uvc->control_req, GFP_ATOMIC);
266− }
267−
268261 return 0;
269262 }
270263
drivers/usb/gadget/legacy/inode.c+4−3
@@ -84,8 +84,7 @@ static int ep_open(struct inode *, struct file *); · 83 unmodified lines
8484
8585 /* /dev/gadget/$CHIP represents ep0 and the whole device */
8686 enum ep0_state {
87− /* DISBLED is the initial state.
88− */
87+ /* DISABLED is the initial state. */
8988 STATE_DEV_DISABLED = 0,
9089
9190 /* Only one open() of /dev/gadget/$CHIP; only one file tracks
@@ -1782,8 +1781,10 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) · 1690 unmodified lines
17821781
17831782 spin_lock_irq (&dev->lock);
17841783 value = -EINVAL;
1785− if (dev->buf)
1784+ if (dev->buf) {
1785+ kfree(kbuf);
17861786 goto fail;
1787+ }
17871788 dev->buf = kbuf;
17881789
17891790 /* full or low speed config */
drivers/usb/gadget/udc/atmel_usba_udc.c+2−2
@@ -610,7 +610,7 @@ usba_ep_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) · 609 unmodified lines
610610 {
611611 struct usba_ep *ep = to_usba_ep(_ep);
612612 struct usba_udc *udc = ep->udc;
613− unsigned long flags, ept_cfg, maxpacket;
613+ unsigned long flags, maxpacket;
614614 unsigned int nr_trans;
615615
616616 DBG(DBG_GADGET, "%s: ep_enable: desc=%p\n", ep->ep.name, desc);
@@ -630,7 +630,7 @@ usba_ep_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) · 13 unmodified lines
630630 ep->is_in = 0;
631631
632632 DBG(DBG_ERR, "%s: EPT_CFG = 0x%lx (maxpacket = %lu)\n",
633− ep->ep.name, ept_cfg, maxpacket);
633+ ep->ep.name, ep->ept_cfg, maxpacket);
634634
635635 if (usb_endpoint_dir_in(desc)) {
636636 ep->is_in = 1;
drivers/usb/gadget/udc/dummy_hcd.c+2−0
@@ -1031,6 +1031,8 @@ static int dummy_udc_probe(struct platform_device *pdev) · 1030 unmodified lines
10311031 int rc;
10321032
10331033 dum = *((void **)dev_get_platdata(&pdev->dev));
1034+ /* Clear usb_gadget region for new registration to udc-core */
1035+ memzero_explicit(&dum->gadget, sizeof(struct usb_gadget));
10341036 dum->gadget.name = gadget_name;
10351037 dum->gadget.ops = &dummy_ops;
10361038 dum->gadget.max_speed = USB_SPEED_SUPER;
drivers/usb/gadget/udc/net2280.c+13−12
@@ -1146,15 +1146,15 @@ static int scan_dma_completions(struct net2280_ep *ep) · 1145 unmodified lines
11461146 */
11471147 while (!list_empty(&ep->queue)) {
11481148 struct net2280_request *req;
1149− u32 tmp;
1149+ u32 req_dma_count;
11501150
11511151 req = list_entry(ep->queue.next,
11521152 struct net2280_request, queue);
11531153 if (!req->valid)
11541154 break;
11551155 rmb();
1156− tmp = le32_to_cpup(&req->td->dmacount);
1157− if ((tmp & BIT(VALID_BIT)) != 0)
1156+ req_dma_count = le32_to_cpup(&req->td->dmacount);
1157+ if ((req_dma_count & BIT(VALID_BIT)) != 0)
11581158 break;
11591159
11601160 /* SHORT_PACKET_TRANSFERRED_INTERRUPT handles "usb-short"
@@ -1163,40 +1163,41 @@ static int scan_dma_completions(struct net2280_ep *ep) · 2 unmodified lines
11631163 */
11641164 if (unlikely(req->td->dmadesc == 0)) {
11651165 /* paranoia */
1166− tmp = readl(&ep->dma->dmacount);
1167− if (tmp & DMA_BYTE_COUNT_MASK)
1166+ u32 const ep_dmacount = readl(&ep->dma->dmacount);
1167+
1168+ if (ep_dmacount & DMA_BYTE_COUNT_MASK)
11681169 break;
11691170 /* single transfer mode */
1170− dma_done(ep, req, tmp, 0);
1171+ dma_done(ep, req, req_dma_count, 0);
11711172 num_completed++;
11721173 break;
11731174 } else if (!ep->is_in &&
11741175 (req->req.length % ep->ep.maxpacket) &&
11751176 !(ep->dev->quirks & PLX_PCIE)) {
11761177
1177− tmp = readl(&ep->regs->ep_stat);
1178+ u32 const ep_stat = readl(&ep->regs->ep_stat);
11781179 /* AVOID TROUBLE HERE by not issuing short reads from
11791180 * your gadget driver. That helps avoids errata 0121,
11801181 * 0122, and 0124; not all cases trigger the warning.
11811182 */
1182− if ((tmp & BIT(NAK_OUT_PACKETS)) == 0) {
1183+ if ((ep_stat & BIT(NAK_OUT_PACKETS)) == 0) {
11831184 ep_warn(ep->dev, "%s lost packet sync!\n",
11841185 ep->ep.name);
11851186 req->req.status = -EOVERFLOW;
11861187 } else {
1187− tmp = readl(&ep->regs->ep_avail);
1188− if (tmp) {
1188+ u32 const ep_avail = readl(&ep->regs->ep_avail);
1189+ if (ep_avail) {
11891190 /* fifo gets flushed later */
11901191 ep->out_overflow = 1;
11911192 ep_dbg(ep->dev,
11921193 "%s dma, discard %d len %d\n",
1193− ep->ep.name, tmp,
1194+ ep->ep.name, ep_avail,
11941195 req->req.length);
11951196 req->req.status = -EOVERFLOW;
11961197 }
11971198 }
11981199 }
1199− dma_done(ep, req, tmp, 0);
1200+ dma_done(ep, req, req_dma_count, 0);
12001201 num_completed++;
12011202 }
12021203
drivers/usb/gadget/udc/pxa27x_udc.c+3−2
@@ -2534,9 +2534,10 @@ static int pxa_udc_remove(struct platform_device *_dev) · 2533 unmodified lines
25342534 usb_del_gadget_udc(&udc->gadget);
25352535 pxa_cleanup_debugfs(udc);
25362536
2537− if (!IS_ERR_OR_NULL(udc->transceiver))
2537+ if (!IS_ERR_OR_NULL(udc->transceiver)) {
25382538 usb_unregister_notifier(udc->transceiver, &pxa27x_udc_phy);
2539− usb_put_phy(udc->transceiver);
2539+ usb_put_phy(udc->transceiver);
2540+ }
25402541
25412542 udc->transceiver = NULL;
25422543 the_controller = NULL;
drivers/usb/host/ohci-at91.c+2−2
@@ -350,7 +350,7 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, · 349 unmodified lines
350350
351351 case USB_PORT_FEAT_SUSPEND:
352352 dev_dbg(hcd->self.controller, "SetPortFeat: SUSPEND\n");
353− if (valid_port(wIndex)) {
353+ if (valid_port(wIndex) && ohci_at91->sfr_regmap) {
354354 ohci_at91_port_suspend(ohci_at91->sfr_regmap,
355355 1);
356356 return 0;
@@ -393,7 +393,7 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, · 36 unmodified lines
393393
394394 case USB_PORT_FEAT_SUSPEND:
395395 dev_dbg(hcd->self.controller, "ClearPortFeature: SUSPEND\n");
396− if (valid_port(wIndex)) {
396+ if (valid_port(wIndex) && ohci_at91->sfr_regmap) {
397397 ohci_at91_port_suspend(ohci_at91->sfr_regmap,
398398 0);
399399 return 0;
drivers/usb/host/xhci-dbg.c+1−1
@@ -109,7 +109,7 @@ static void xhci_print_cap_regs(struct xhci_hcd *xhci) · 108 unmodified lines
109109 xhci_dbg(xhci, "RTSOFF 0x%x:\n", temp & RTSOFF_MASK);
110110
111111 /* xhci 1.1 controllers have the HCCPARAMS2 register */
112− if (hci_version > 100) {
112+ if (hci_version > 0x100) {
113113 temp = readl(&xhci->cap_regs->hcc_params2);
114114 xhci_dbg(xhci, "HCC PARAMS2 0x%x:\n", (unsigned int) temp);
115115 xhci_dbg(xhci, " HC %s Force save context capability",
drivers/usb/host/xhci-mtk.c+3−4
@@ -382,7 +382,6 @@ static int usb_wakeup_of_property_parse(struct xhci_hcd_mtk *mtk, · 381 unmodified lines
382382
383383 static int xhci_mtk_setup(struct usb_hcd *hcd);
384384 static const struct xhci_driver_overrides xhci_mtk_overrides __initconst = {
385− .extra_priv_size = sizeof(struct xhci_hcd),
386385 .reset = xhci_mtk_setup,
387386 };
388387
@@ -678,13 +677,13 @@ static int xhci_mtk_probe(struct platform_device *pdev) · 289 unmodified lines
678677 goto power_off_phys;
679678 }
680679
681− if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
682− xhci->shared_hcd->can_do_streams = 1;
683−
684680 ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
685681 if (ret)
686682 goto put_usb3_hcd;
687683
684+ if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
685+ xhci->shared_hcd->can_do_streams = 1;
686+
688687 ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
689688 if (ret)
690689 goto dealloc_usb2_hcd;
drivers/usb/host/xhci-plat.c+2−0
@@ -286,6 +286,8 @@ static int xhci_plat_remove(struct platform_device *dev) · 285 unmodified lines
286286 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
287287 struct clk *clk = xhci->clk;
288288
289+ xhci->xhc_state |= XHCI_STATE_REMOVING;
290+
289291 usb_remove_hcd(xhci->shared_hcd);
290292 usb_phy_shutdown(hcd->usb_phy);
291293
drivers/usb/host/xhci-tegra.c+0−1
@@ -1308,7 +1308,6 @@ static int tegra_xhci_setup(struct usb_hcd *hcd) · 1307 unmodified lines
13081308 }
13091309
13101310 static const struct xhci_driver_overrides tegra_xhci_overrides __initconst = {
1311− .extra_priv_size = sizeof(struct xhci_hcd),
13121311 .reset = tegra_xhci_setup,
13131312 };
13141313
drivers/usb/host/xhci.c+2−2
@@ -868,7 +868,7 @@ static void xhci_disable_port_wake_on_bits(struct xhci_hcd *xhci) · 867 unmodified lines
868868
869869 spin_lock_irqsave(&xhci->lock, flags);
870870
871− /* disble usb3 ports Wake bits*/
871+ /* disable usb3 ports Wake bits */
872872 port_index = xhci->num_usb3_ports;
873873 port_array = xhci->usb3_ports;
874874 while (port_index--) {
@@ -879,7 +879,7 @@ static void xhci_disable_port_wake_on_bits(struct xhci_hcd *xhci) · 4 unmodified lines
879879 writel(t2, port_array[port_index]);
880880 }
881881
882− /* disble usb2 ports Wake bits*/
882+ /* disable usb2 ports Wake bits */
883883 port_index = xhci->num_usb2_ports;
884884 port_array = xhci->usb2_ports;
885885 while (port_index--) {
drivers/usb/misc/iowarrior.c+15−6
@@ -781,12 +781,6 @@ static int iowarrior_probe(struct usb_interface *interface, · 780 unmodified lines
781781 iface_desc = interface->cur_altsetting;
782782 dev->product_id = le16_to_cpu(udev->descriptor.idProduct);
783783
784− if (iface_desc->desc.bNumEndpoints < 1) {
785− dev_err(&interface->dev, "Invalid number of endpoints\n");
786− retval = -EINVAL;
787− goto error;
788− }
789−
790784 /* set up the endpoint information */
791785 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
792786 endpoint = &iface_desc->endpoint[i].desc;
@@ -797,6 +791,21 @@ static int iowarrior_probe(struct usb_interface *interface, · 4 unmodified lines
797791 /* this one will match for the IOWarrior56 only */
798792 dev->int_out_endpoint = endpoint;
799793 }
794+
795+ if (!dev->int_in_endpoint) {
796+ dev_err(&interface->dev, "no interrupt-in endpoint found\n");
797+ retval = -ENODEV;
798+ goto error;
799+ }
800+
801+ if (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW56) {
802+ if (!dev->int_out_endpoint) {
803+ dev_err(&interface->dev, "no interrupt-out endpoint found\n");
804+ retval = -ENODEV;
805+ goto error;
806+ }
807+ }
808+
800809 /* we have to check the report_size often, so remember it in the endianness suitable for our machine */
801810 dev->report_size = usb_endpoint_maxp(dev->int_in_endpoint);
802811 if ((dev->interface->cur_altsetting->desc.bInterfaceNumber == 0) &&
drivers/usb/misc/usb251xb.c+24−35
@@ -375,18 +375,24 @@ static int usb251xb_get_ofdata(struct usb251xb *hub, · 374 unmodified lines
375375 if (of_get_property(np, "dynamic-power-switching", NULL))
376376 hub->conf_data2 |= BIT(7);
377377
378− if (of_get_property(np, "oc-delay-100us", NULL)) {
379− hub->conf_data2 &= ~BIT(5);
380− hub->conf_data2 &= ~BIT(4);
381− } else if (of_get_property(np, "oc-delay-4ms", NULL)) {
382− hub->conf_data2 &= ~BIT(5);
383− hub->conf_data2 |= BIT(4);
384− } else if (of_get_property(np, "oc-delay-8ms", NULL)) {
385− hub->conf_data2 |= BIT(5);
386− hub->conf_data2 &= ~BIT(4);
387− } else if (of_get_property(np, "oc-delay-16ms", NULL)) {
388− hub->conf_data2 |= BIT(5);
389− hub->conf_data2 |= BIT(4);
378+ if (!of_property_read_u32(np, "oc-delay-us", property_u32)) {
379+ if (*property_u32 == 100) {
380+ /* 100 us*/
381+ hub->conf_data2 &= ~BIT(5);
382+ hub->conf_data2 &= ~BIT(4);
383+ } else if (*property_u32 == 4000) {
384+ /* 4 ms */
385+ hub->conf_data2 &= ~BIT(5);
386+ hub->conf_data2 |= BIT(4);
387+ } else if (*property_u32 == 16000) {
388+ /* 16 ms */
389+ hub->conf_data2 |= BIT(5);
390+ hub->conf_data2 |= BIT(4);
391+ } else {
392+ /* 8 ms (DEFAULT) */
393+ hub->conf_data2 |= BIT(5);
394+ hub->conf_data2 &= ~BIT(4);
395+ }
390396 }
391397
392398 if (of_get_property(np, "compound-device", NULL))
@@ -432,30 +438,9 @@ static int usb251xb_get_ofdata(struct usb251xb *hub, · 39 unmodified lines
432438 }
433439 }
434440
435− hub->max_power_sp = USB251XB_DEF_MAX_POWER_SELF;
436− if (!of_property_read_u32(np, "max-sp-power", property_u32))
437− hub->max_power_sp = min_t(u8, be32_to_cpu(*property_u32) / 2,
438− 250);
439−
440− hub->max_power_bp = USB251XB_DEF_MAX_POWER_BUS;
441− if (!of_property_read_u32(np, "max-bp-power", property_u32))
442− hub->max_power_bp = min_t(u8, be32_to_cpu(*property_u32) / 2,
443− 250);
444−
445− hub->max_current_sp = USB251XB_DEF_MAX_CURRENT_SELF;
446− if (!of_property_read_u32(np, "max-sp-current", property_u32))
447− hub->max_current_sp = min_t(u8, be32_to_cpu(*property_u32) / 2,
448− 250);
449−
450− hub->max_current_bp = USB251XB_DEF_MAX_CURRENT_BUS;
451− if (!of_property_read_u32(np, "max-bp-current", property_u32))
452− hub->max_current_bp = min_t(u8, be32_to_cpu(*property_u32) / 2,
453− 250);
454−
455441 hub->power_on_time = USB251XB_DEF_POWER_ON_TIME;
456− if (!of_property_read_u32(np, "power-on-time", property_u32))
457− hub->power_on_time = min_t(u8, be32_to_cpu(*property_u32) / 2,
458− 255);
442+ if (!of_property_read_u32(np, "power-on-time-ms", property_u32))
443+ hub->power_on_time = min_t(u8, *property_u32 / 2, 255);
459444
460445 if (of_property_read_u16_array(np, "language-id", &hub->lang_id, 1))
461446 hub->lang_id = USB251XB_DEF_LANGUAGE_ID;
@@ -492,6 +477,10 @@ static int usb251xb_get_ofdata(struct usb251xb *hub, · 30 unmodified lines
492477 /* The following parameters are currently not exposed to devicetree, but
493478 * may be as soon as needed.
494479 */
480+ hub->max_power_sp = USB251XB_DEF_MAX_POWER_SELF;
481+ hub->max_power_bp = USB251XB_DEF_MAX_POWER_BUS;
482+ hub->max_current_sp = USB251XB_DEF_MAX_CURRENT_SELF;
483+ hub->max_current_bp = USB251XB_DEF_MAX_CURRENT_BUS;
495484 hub->bat_charge_en = USB251XB_DEF_BATTERY_CHARGING_ENABLE;
496485 hub->boost_up = USB251XB_DEF_BOOST_UP;
497486 hub->boost_x = USB251XB_DEF_BOOST_X;
drivers/usb/phy/phy-isp1301.c+7−0
@@ -33,6 +33,12 @@ static const struct i2c_device_id isp1301_id[] = { · 32 unmodified lines
3333 };
3434 MODULE_DEVICE_TABLE(i2c, isp1301_id);
3535
36+static const struct of_device_id isp1301_of_match[] = {
37+ {.compatible = "nxp,isp1301" },
38+ { },
39+};
40+MODULE_DEVICE_TABLE(of, isp1301_of_match);
41+
3642 static struct i2c_client *isp1301_i2c_client;
3743
3844 static int __isp1301_write(struct isp1301 *isp, u8 reg, u8 value, u8 clear)
@@ -130,6 +136,7 @@ static int isp1301_remove(struct i2c_client *client) · 91 unmodified lines
130136 static struct i2c_driver isp1301_driver = {
131137 .driver = {
132138 .name = DRV_NAME,
139+ .of_match_table = of_match_ptr(isp1301_of_match),
133140 },
134141 .probe = isp1301_probe,
135142 .remove = isp1301_remove,
drivers/usb/serial/digi_acceleport.c+1−1
@@ -1500,7 +1500,7 @@ static int digi_read_oob_callback(struct urb *urb) · 1499 unmodified lines
15001500 return -1;
15011501
15021502 /* handle each oob command */
1503− for (i = 0; i < urb->actual_length - 4; i += 4) {
1503+ for (i = 0; i < urb->actual_length - 3; i += 4) {
15041504 opcode = buf[i];
15051505 line = buf[i + 1];
15061506 status = buf[i + 2];
drivers/usb/serial/io_ti.c+7−1
@@ -1674,6 +1674,12 @@ static void edge_interrupt_callback(struct urb *urb) · 1673 unmodified lines
16741674 function = TIUMP_GET_FUNC_FROM_CODE(data[0]);
16751675 dev_dbg(dev, "%s - port_number %d, function %d, info 0x%x\n", __func__,
16761676 port_number, function, data[1]);
1677+
1678+ if (port_number >= edge_serial->serial->num_ports) {
1679+ dev_err(dev, "bad port number %d\n", port_number);
1680+ goto exit;
1681+ }
1682+
16771683 port = edge_serial->serial->port[port_number];
16781684 edge_port = usb_get_serial_port_data(port);
16791685 if (!edge_port) {
@@ -1755,7 +1761,7 @@ static void edge_bulk_in_callback(struct urb *urb) · 75 unmodified lines
17551761
17561762 port_number = edge_port->port->port_number;
17571763
1758− if (edge_port->lsr_event) {
1764+ if (urb->actual_length > 0 && edge_port->lsr_event) {
17591765 edge_port->lsr_event = 0;
17601766 dev_dbg(dev, "%s ===== Port %u LSR Status = %02x, Data = %02x ======\n",
17611767 __func__, port_number, edge_port->lsr_mask, *data);
drivers/usb/serial/omninet.c+0−13
@@ -31,7 +31,6 @@ · 30 unmodified lines
3131 #define BT_IGNITIONPRO_ID 0x2000
3232
3333 /* function prototypes */
34−static int omninet_open(struct tty_struct *tty, struct usb_serial_port *port);
3534 static void omninet_process_read_urb(struct urb *urb);
3635 static void omninet_write_bulk_callback(struct urb *urb);
3736 static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port,
@@ -60,7 +59,6 @@ static struct usb_serial_driver zyxel_omninet_device = { · 22 unmodified lines
6059 .attach = omninet_attach,
6160 .port_probe = omninet_port_probe,
6261 .port_remove = omninet_port_remove,
63− .open = omninet_open,
6462 .write = omninet_write,
6563 .write_room = omninet_write_room,
6664 .write_bulk_callback = omninet_write_bulk_callback,
@@ -140,17 +138,6 @@ static int omninet_port_remove(struct usb_serial_port *port) · 73 unmodified lines
140138 return 0;
141139 }
142140
143−static int omninet_open(struct tty_struct *tty, struct usb_serial_port *port)
144−{
145− struct usb_serial *serial = port->serial;
146− struct usb_serial_port *wport;
147−
148− wport = serial->port[1];
149− tty_port_tty_set(&wport->port, tty);
150−
151− return usb_serial_generic_open(tty, port);
152−}
153−
154141 #define OMNINET_HEADERLEN 4
155142 #define OMNINET_BULKOUTSIZE 64
156143 #define OMNINET_PAYLOADSIZE (OMNINET_BULKOUTSIZE - OMNINET_HEADERLEN)
drivers/usb/serial/safe_serial.c+5−0
@@ -200,6 +200,11 @@ static void safe_process_read_urb(struct urb *urb) · 199 unmodified lines
200200 if (!safe)
201201 goto out;
202202
203+ if (length < 2) {
204+ dev_err(&port->dev, "malformed packet\n");
205+ return;
206+ }
207+
203208 fcs = fcs_compute10(data, length, CRC10_INITFCS);
204209 if (fcs) {
205210 dev_err(&port->dev, "%s - bad CRC %x\n", __func__, fcs);
drivers/usb/storage/unusual_devs.h+14−0
@@ -2071,6 +2071,20 @@ UNUSUAL_DEV( 0x1370, 0x6828, 0x0110, 0x0110, · 2070 unmodified lines
20712071 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
20722072 US_FL_IGNORE_RESIDUE ),
20732073
2074+/*
2075+ * Reported by Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
2076+ * The INIC-3619 bridge is used in the StarTech SLSODDU33B
2077+ * SATA-USB enclosure for slimline optical drives.
2078+ *
2079+ * The quirk enables MakeMKV to properly exchange keys with
2080+ * an installed BD drive.
2081+ */
2082+UNUSUAL_DEV( 0x13fd, 0x3609, 0x0209, 0x0209,
2083+ "Initio Corporation",
2084+ "INIC-3619",
2085+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
2086+ US_FL_IGNORE_RESIDUE ),
2087+
20742088 /* Reported by Qinglin Ye <yestyle@gmail.com> */
20752089 UNUSUAL_DEV( 0x13fe, 0x3600, 0x0100, 0x0100,
20762090 "Kingston",
drivers/xen/swiotlb-xen.c+47−0
@@ -681,3 +681,50 @@ xen_swiotlb_set_dma_mask(struct device *dev, u64 dma_mask) · 680 unmodified lines
681681 return 0;
682682 }
683683 EXPORT_SYMBOL_GPL(xen_swiotlb_set_dma_mask);
684+
685+/*
686+ * Create userspace mapping for the DMA-coherent memory.
687+ * This function should be called with the pages from the current domain only,
688+ * passing pages mapped from other domains would lead to memory corruption.
689+ */
690+int
691+xen_swiotlb_dma_mmap(struct device *dev, struct vm_area_struct *vma,
692+ void *cpu_addr, dma_addr_t dma_addr, size_t size,
693+ unsigned long attrs)
694+{
695+#if defined(CONFIG_ARM) || defined(CONFIG_ARM64)
696+ if (__generic_dma_ops(dev)->mmap)
697+ return __generic_dma_ops(dev)->mmap(dev, vma, cpu_addr,
698+ dma_addr, size, attrs);
699+#endif
700+ return dma_common_mmap(dev, vma, cpu_addr, dma_addr, size);
701+}
702+EXPORT_SYMBOL_GPL(xen_swiotlb_dma_mmap);
703+
704+/*
705+ * This function should be called with the pages from the current domain only,
706+ * passing pages mapped from other domains would lead to memory corruption.
707+ */
708+int
709+xen_swiotlb_get_sgtable(struct device *dev, struct sg_table *sgt,
710+ void *cpu_addr, dma_addr_t handle, size_t size,
711+ unsigned long attrs)
712+{
713+#if defined(CONFIG_ARM) || defined(CONFIG_ARM64)
714+ if (__generic_dma_ops(dev)->get_sgtable) {
715+#if 0
716+ /*
717+ * This check verifies that the page belongs to the current domain and
718+ * is not one mapped from another domain.
719+ * This check is for debug only, and should not go to production build
720+ */
721+ unsigned long bfn = PHYS_PFN(dma_to_phys(dev, handle));
722+ BUG_ON (!page_is_ram(bfn));
723+#endif
724+ return __generic_dma_ops(dev)->get_sgtable(dev, sgt, cpu_addr,
725+ handle, size, attrs);
726+ }
727+#endif
728+ return dma_common_get_sgtable(dev, sgt, cpu_addr, handle, size);
729+}
730+EXPORT_SYMBOL_GPL(xen_swiotlb_get_sgtable);
drivers/xen/xenbus/xenbus_dev_frontend.c+0−1
@@ -55,7 +55,6 @@ · 54 unmodified lines
5555 #include <linux/string.h>
5656 #include <linux/slab.h>
5757 #include <linux/miscdevice.h>
58−#include <linux/init.h>
5958
6059 #include <xen/xenbus.h>
6160 #include <xen/xen.h>
fs/dlm/lowcomms.c+1−1
@@ -743,7 +743,7 @@ static int tcp_accept_from_sock(struct connection *con) · 742 unmodified lines
743743 newsock->type = con->sock->type;
744744 newsock->ops = con->sock->ops;
745745
746− result = con->sock->ops->accept(con->sock, newsock, O_NONBLOCK);
746+ result = con->sock->ops->accept(con->sock, newsock, O_NONBLOCK, true);
747747 if (result < 0)
748748 goto accept_err;
749749
fs/fat/inode.c+12−1
@@ -1359,6 +1359,16 @@ out: · 1358 unmodified lines
13591359 return 0;
13601360 }
13611361
1362+static void fat_dummy_inode_init(struct inode *inode)
1363+{
1364+ /* Initialize this dummy inode to work as no-op. */
1365+ MSDOS_I(inode)->mmu_private = 0;
1366+ MSDOS_I(inode)->i_start = 0;
1367+ MSDOS_I(inode)->i_logstart = 0;
1368+ MSDOS_I(inode)->i_attrs = 0;
1369+ MSDOS_I(inode)->i_pos = 0;
1370+}
1371+
13621372 static int fat_read_root(struct inode *inode)
13631373 {
13641374 struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
@@ -1803,12 +1813,13 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, · 438 unmodified lines
18031813 fat_inode = new_inode(sb);
18041814 if (!fat_inode)
18051815 goto out_fail;
1806− MSDOS_I(fat_inode)->i_pos = 0;
1816+ fat_dummy_inode_init(fat_inode);
18071817 sbi->fat_inode = fat_inode;
18081818
18091819 fsinfo_inode = new_inode(sb);
18101820 if (!fsinfo_inode)
18111821 goto out_fail;
1822+ fat_dummy_inode_init(fsinfo_inode);
18121823 fsinfo_inode->i_ino = MSDOS_FSINFO_INO;
18131824 sbi->fsinfo_inode = fsinfo_inode;
18141825 insert_inode_hash(fsinfo_inode);
fs/fs-writeback.c+21−14
@@ -173,19 +173,33 @@ static void wb_wakeup(struct bdi_writeback *wb) · 172 unmodified lines
173173 spin_unlock_bh(&wb->work_lock);
174174 }
175175
176+static void finish_writeback_work(struct bdi_writeback *wb,
177+ struct wb_writeback_work *work)
178+{
179+ struct wb_completion *done = work->done;
180+
181+ if (work->auto_free)
182+ kfree(work);
183+ if (done && atomic_dec_and_test(&done->cnt))
184+ wake_up_all(&wb->bdi->wb_waitq);
185+}
186+
176187 static void wb_queue_work(struct bdi_writeback *wb,
177188 struct wb_writeback_work *work)
178189 {
179190 trace_writeback_queue(wb, work);
180191
181− spin_lock_bh(&wb->work_lock);
182− if (!test_bit(WB_registered, &wb->state))
183− goto out_unlock;
184192 if (work->done)
185193 atomic_inc(&work->done->cnt);
186− list_add_tail(&work->list, &wb->work_list);
187− mod_delayed_work(bdi_wq, &wb->dwork, 0);
188−out_unlock:
194+
195+ spin_lock_bh(&wb->work_lock);
196+
197+ if (test_bit(WB_registered, &wb->state)) {
198+ list_add_tail(&work->list, &wb->work_list);
199+ mod_delayed_work(bdi_wq, &wb->dwork, 0);
200+ } else
201+ finish_writeback_work(wb, work);
202+
189203 spin_unlock_bh(&wb->work_lock);
190204 }
191205
@@ -1873,16 +1887,9 @@ static long wb_do_writeback(struct bdi_writeback *wb) · 1681 unmodified lines
18731887
18741888 set_bit(WB_writeback_running, &wb->state);
18751889 while ((work = get_next_work_item(wb)) != NULL) {
1876− struct wb_completion *done = work->done;
1877−
18781890 trace_writeback_exec(wb, work);
1879−
18801891 wrote += wb_writeback(wb, work);
1881−
1882− if (work->auto_free)
1883− kfree(work);
1884− if (done && atomic_dec_and_test(&done->cnt))
1885− wake_up_all(&wb->bdi->wb_waitq);
1892+ finish_writeback_work(wb, work);
18861893 }
18871894
18881895 /*
fs/gfs2/incore.h+1−1
@@ -207,7 +207,7 @@ struct lm_lockname { · 206 unmodified lines
207207 struct gfs2_sbd *ln_sbd;
208208 u64 ln_number;
209209 unsigned int ln_type;
210−};
210+} __packed __aligned(sizeof(int));
211211
212212 #define lm_name_equal(name1, name2) \
213213 (((name1)->ln_number == (name2)->ln_number) && \
fs/iomap.c+10−7
@@ -846,7 +846,8 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, · 845 unmodified lines
846846 struct address_space *mapping = iocb->ki_filp->f_mapping;
847847 struct inode *inode = file_inode(iocb->ki_filp);
848848 size_t count = iov_iter_count(iter);
849− loff_t pos = iocb->ki_pos, end = iocb->ki_pos + count - 1, ret = 0;
849+ loff_t pos = iocb->ki_pos, start = pos;
850+ loff_t end = iocb->ki_pos + count - 1, ret = 0;
850851 unsigned int flags = IOMAP_DIRECT;
851852 struct blk_plug plug;
852853 struct iomap_dio *dio;
@@ -887,12 +888,12 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, · 34 unmodified lines
887888 }
888889
889890 if (mapping->nrpages) {
890− ret = filemap_write_and_wait_range(mapping, iocb->ki_pos, end);
891+ ret = filemap_write_and_wait_range(mapping, start, end);
891892 if (ret)
892893 goto out_free_dio;
893894
894895 ret = invalidate_inode_pages2_range(mapping,
895− iocb->ki_pos >> PAGE_SHIFT, end >> PAGE_SHIFT);
896+ start >> PAGE_SHIFT, end >> PAGE_SHIFT);
896897 WARN_ON_ONCE(ret);
897898 ret = 0;
898899 }
@@ -941,6 +942,8 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, · 42 unmodified lines
941942 __set_current_state(TASK_RUNNING);
942943 }
943944
945+ ret = iomap_dio_complete(dio);
946+
944947 /*
945948 * Try again to invalidate clean pages which might have been cached by
946949 * non-direct readahead, or faulted in by get_user_pages() if the source
@@ -949,12 +952,12 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, · 2 unmodified lines
949952 * this invalidation fails, tough, the write still worked...
950953 */
951954 if (iov_iter_rw(iter) == WRITE && mapping->nrpages) {
952− ret = invalidate_inode_pages2_range(mapping,
953− iocb->ki_pos >> PAGE_SHIFT, end >> PAGE_SHIFT);
954− WARN_ON_ONCE(ret);
955+ int err = invalidate_inode_pages2_range(mapping,
956+ start >> PAGE_SHIFT, end >> PAGE_SHIFT);
957+ WARN_ON_ONCE(err);
955958 }
956959
957− return iomap_dio_complete(dio);
960+ return ret;
958961
959962 out_free_dio:
960963 kfree(dio);
fs/ocfs2/cluster/tcp.c+1−1
@@ -1863,7 +1863,7 @@ static int o2net_accept_one(struct socket *sock, int *more) · 1862 unmodified lines
18631863
18641864 new_sock->type = sock->type;
18651865 new_sock->ops = sock->ops;
1866− ret = sock->ops->accept(sock, new_sock, O_NONBLOCK);
1866+ ret = sock->ops->accept(sock, new_sock, O_NONBLOCK, false);
18671867 if (ret < 0)
18681868 goto out;
18691869
fs/overlayfs/util.c+0−1
@@ -12,7 +12,6 @@ · 11 unmodified lines
1212 #include <linux/slab.h>
1313 #include <linux/cred.h>
1414 #include <linux/xattr.h>
15−#include <linux/sched/signal.h>
1615 #include "overlayfs.h"
1716 #include "ovl_entry.h"
1817
fs/timerfd.c+4−4
@@ -400,9 +400,9 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags) · 399 unmodified lines
400400 clockid != CLOCK_BOOTTIME_ALARM))
401401 return -EINVAL;
402402
403− if (!capable(CAP_WAKE_ALARM) &&
404− (clockid == CLOCK_REALTIME_ALARM ||
405− clockid == CLOCK_BOOTTIME_ALARM))
403+ if ((clockid == CLOCK_REALTIME_ALARM ||
404+ clockid == CLOCK_BOOTTIME_ALARM) &&
405+ !capable(CAP_WAKE_ALARM))
406406 return -EPERM;
407407
408408 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
@@ -449,7 +449,7 @@ static int do_timerfd_settime(int ufd, int flags, · 40 unmodified lines
449449 return ret;
450450 ctx = f.file->private_data;
451451
452− if (!capable(CAP_WAKE_ALARM) && isalarm(ctx)) {
452+ if (isalarm(ctx) && !capable(CAP_WAKE_ALARM)) {
453453 fdput(f);
454454 return -EPERM;
455455 }
fs/userfaultfd.c+26−49
@@ -138,8 +138,6 @@ out: · 137 unmodified lines
138138 * userfaultfd_ctx_get - Acquires a reference to the internal userfaultfd
139139 * context.
140140 * @ctx: [in] Pointer to the userfaultfd context.
141− *
142− * Returns: In case of success, returns not zero.
143141 */
144142 static void userfaultfd_ctx_get(struct userfaultfd_ctx *ctx)
145143 {
@@ -267,6 +265,7 @@ static inline bool userfaultfd_must_wait(struct userfaultfd_ctx *ctx, · 121 unmodified lines
267265 {
268266 struct mm_struct *mm = ctx->mm;
269267 pgd_t *pgd;
268+ p4d_t *p4d;
270269 pud_t *pud;
271270 pmd_t *pmd, _pmd;
272271 pte_t *pte;
@@ -277,7 +276,10 @@ static inline bool userfaultfd_must_wait(struct userfaultfd_ctx *ctx, · 4 unmodified lines
277276 pgd = pgd_offset(mm, address);
278277 if (!pgd_present(*pgd))
279278 goto out;
280− pud = pud_offset(pgd, address);
279+ p4d = p4d_offset(pgd, address);
280+ if (!p4d_present(*p4d))
281+ goto out;
282+ pud = pud_offset(p4d, address);
281283 if (!pud_present(*pud))
282284 goto out;
283285 pmd = pmd_offset(pud, address);
@@ -490,7 +492,7 @@ int handle_userfault(struct vm_fault *vmf, unsigned long reason) · 206 unmodified lines
490492 * in such case.
491493 */
492494 down_read(&mm->mmap_sem);
493− ret = 0;
495+ ret = VM_FAULT_NOPAGE;
494496 }
495497 }
496498
@@ -527,10 +529,11 @@ out: · 30 unmodified lines
527529 return ret;
528530 }
529531
530−static int userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx,
531− struct userfaultfd_wait_queue *ewq)
532+static void userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx,
533+ struct userfaultfd_wait_queue *ewq)
532534 {
533− int ret = 0;
535+ if (WARN_ON_ONCE(current->flags & PF_EXITING))
536+ goto out;
534537
535538 ewq->ctx = ctx;
536539 init_waitqueue_entry(&ewq->wq, current);
@@ -547,8 +550,16 @@ static int userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx, · 10 unmodified lines
547550 break;
548551 if (ACCESS_ONCE(ctx->released) ||
549552 fatal_signal_pending(current)) {
550− ret = -1;
551553 __remove_wait_queue(&ctx->event_wqh, &ewq->wq);
554+ if (ewq->msg.event == UFFD_EVENT_FORK) {
555+ struct userfaultfd_ctx *new;
556+
557+ new = (struct userfaultfd_ctx *)
558+ (unsigned long)
559+ ewq->msg.arg.reserved.reserved1;
560+
561+ userfaultfd_ctx_put(new);
562+ }
552563 break;
553564 }
554565
@@ -566,9 +577,8 @@ static int userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx, · 11 unmodified lines
566577 * ctx may go away after this if the userfault pseudo fd is
567578 * already released.
568579 */
569−
580+out:
570581 userfaultfd_ctx_put(ctx);
571− return ret;
572582 }
573583
574584 static void userfaultfd_event_complete(struct userfaultfd_ctx *ctx,
@@ -626,7 +636,7 @@ int dup_userfaultfd(struct vm_area_struct *vma, struct list_head *fcs) · 51 unmodified lines
626636 return 0;
627637 }
628638
629−static int dup_fctx(struct userfaultfd_fork_ctx *fctx)
639+static void dup_fctx(struct userfaultfd_fork_ctx *fctx)
630640 {
631641 struct userfaultfd_ctx *ctx = fctx->orig;
632642 struct userfaultfd_wait_queue ewq;
@@ -636,17 +646,15 @@ static int dup_fctx(struct userfaultfd_fork_ctx *fctx) · 3 unmodified lines
636646 ewq.msg.event = UFFD_EVENT_FORK;
637647 ewq.msg.arg.reserved.reserved1 = (unsigned long)fctx->new;
638648
639− return userfaultfd_event_wait_completion(ctx, &ewq);
649+ userfaultfd_event_wait_completion(ctx, &ewq);
640650 }
641651
642652 void dup_userfaultfd_complete(struct list_head *fcs)
643653 {
644− int ret = 0;
645654 struct userfaultfd_fork_ctx *fctx, *n;
646655
647656 list_for_each_entry_safe(fctx, n, fcs, list) {
648− if (!ret)
649− ret = dup_fctx(fctx);
657+ dup_fctx(fctx);
650658 list_del(&fctx->list);
651659 kfree(fctx);
652660 }
@@ -689,8 +697,7 @@ void mremap_userfaultfd_complete(struct vm_userfaultfd_ctx *vm_ctx, · 36 unmodified lines
689697 userfaultfd_event_wait_completion(ctx, &ewq);
690698 }
691699
692−void userfaultfd_remove(struct vm_area_struct *vma,
693− struct vm_area_struct **prev,
700+bool userfaultfd_remove(struct vm_area_struct *vma,
694701 unsigned long start, unsigned long end)
695702 {
696703 struct mm_struct *mm = vma->vm_mm;
@@ -699,13 +706,11 @@ void userfaultfd_remove(struct vm_area_struct *vma, · 2 unmodified lines
699706
700707 ctx = vma->vm_userfaultfd_ctx.ctx;
701708 if (!ctx || !(ctx->features & UFFD_FEATURE_EVENT_REMOVE))
702− return;
709+ return true;
703710
704711 userfaultfd_ctx_get(ctx);
705712 up_read(&mm->mmap_sem);
706713
707− *prev = NULL; /* We wait for ACK w/o the mmap semaphore */
708−
709714 msg_init(&ewq.msg);
710715
711716 ewq.msg.event = UFFD_EVENT_REMOVE;
@@ -714,7 +719,7 @@ void userfaultfd_remove(struct vm_area_struct *vma, · 2 unmodified lines
714719
715720 userfaultfd_event_wait_completion(ctx, &ewq);
716721
717− down_read(&mm->mmap_sem);
722+ return false;
718723 }
719724
720725 static bool has_unmap_ctx(struct userfaultfd_ctx *ctx, struct list_head *unmaps,
@@ -775,34 +780,6 @@ void userfaultfd_unmap_complete(struct mm_struct *mm, struct list_head *uf) · 54 unmodified lines
775780 }
776781 }
777782
778−void userfaultfd_exit(struct mm_struct *mm)
779−{
780− struct vm_area_struct *vma = mm->mmap;
781−
782− /*
783− * We can do the vma walk without locking because the caller
784− * (exit_mm) knows it now has exclusive access
785− */
786− while (vma) {
787− struct userfaultfd_ctx *ctx = vma->vm_userfaultfd_ctx.ctx;
788−
789− if (ctx && (ctx->features & UFFD_FEATURE_EVENT_EXIT)) {
790− struct userfaultfd_wait_queue ewq;
791−
792− userfaultfd_ctx_get(ctx);
793−
794− msg_init(&ewq.msg);
795− ewq.msg.event = UFFD_EVENT_EXIT;
796−
797− userfaultfd_event_wait_completion(ctx, &ewq);
798−
799− ctx->features &= ~UFFD_FEATURE_EVENT_EXIT;
800− }
801−
802− vma = vma->vm_next;
803− }
804−}
805−
806783 static int userfaultfd_release(struct inode *inode, struct file *file)
807784 {
808785 struct userfaultfd_ctx *ctx = file->private_data;
fs/xfs/kmem.c+0−18
@@ -25,24 +25,6 @@ · 24 unmodified lines
2525 #include "kmem.h"
2626 #include "xfs_message.h"
2727
28−/*
29− * Greedy allocation. May fail and may return vmalloced memory.
30− */
31−void *
32−kmem_zalloc_greedy(size_t *size, size_t minsize, size_t maxsize)
33−{
34− void *ptr;
35− size_t kmsize = maxsize;
36−
37− while (!(ptr = vzalloc(kmsize))) {
38− if ((kmsize >>= 1) <= minsize)
39− kmsize = minsize;
40− }
41− if (ptr)
42− *size = kmsize;
43− return ptr;
44−}
45−
4628 void *
4729 kmem_alloc(size_t size, xfs_km_flags_t flags)
4830 {
fs/xfs/kmem.h+0−2
@@ -69,8 +69,6 @@ static inline void kmem_free(const void *ptr) · 68 unmodified lines
6969 }
7070
7171
72−extern void *kmem_zalloc_greedy(size_t *, size_t, size_t);
73−
7472 static inline void *
7573 kmem_zalloc(size_t size, xfs_km_flags_t flags)
7674 {
fs/xfs/libxfs/xfs_bmap.c+21−13
@@ -763,8 +763,8 @@ xfs_bmap_extents_to_btree( · 762 unmodified lines
763763 args.type = XFS_ALLOCTYPE_START_BNO;
764764 args.fsbno = XFS_INO_TO_FSB(mp, ip->i_ino);
765765 } else if (dfops->dop_low) {
766−try_another_ag:
767766 args.type = XFS_ALLOCTYPE_START_BNO;
767+try_another_ag:
768768 args.fsbno = *firstblock;
769769 } else {
770770 args.type = XFS_ALLOCTYPE_NEAR_BNO;
@@ -790,13 +790,17 @@ try_another_ag: · 19 unmodified lines
790790 if (xfs_sb_version_hasreflink(&cur->bc_mp->m_sb) &&
791791 args.fsbno == NULLFSBLOCK &&
792792 args.type == XFS_ALLOCTYPE_NEAR_BNO) {
793− dfops->dop_low = true;
793+ args.type = XFS_ALLOCTYPE_FIRST_AG;
794794 goto try_another_ag;
795795 }
796+ if (WARN_ON_ONCE(args.fsbno == NULLFSBLOCK)) {
797+ xfs_iroot_realloc(ip, -1, whichfork);
798+ xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
799+ return -ENOSPC;
800+ }
796801 /*
797802 * Allocation can't fail, the space was reserved.
798803 */
799− ASSERT(args.fsbno != NULLFSBLOCK);
800804 ASSERT(*firstblock == NULLFSBLOCK ||
801805 args.agno >= XFS_FSB_TO_AGNO(mp, *firstblock));
802806 *firstblock = cur->bc_private.b.firstblock = args.fsbno;
@@ -4150,6 +4154,19 @@ xfs_bmapi_read( · 3347 unmodified lines
41504154 return 0;
41514155 }
41524156
4157+/*
4158+ * Add a delayed allocation extent to an inode. Blocks are reserved from the
4159+ * global pool and the extent inserted into the inode in-core extent tree.
4160+ *
4161+ * On entry, got refers to the first extent beyond the offset of the extent to
4162+ * allocate or eof is specified if no such extent exists. On return, got refers
4163+ * to the extent record that was inserted to the inode fork.
4164+ *
4165+ * Note that the allocated extent may have been merged with contiguous extents
4166+ * during insertion into the inode fork. Thus, got does not reflect the current
4167+ * state of the inode fork on return. If necessary, the caller can use lastx to
4168+ * look up the updated record in the inode fork.
4169+ */
41534170 int
41544171 xfs_bmapi_reserve_delalloc(
41554172 struct xfs_inode *ip,
@@ -4236,13 +4253,8 @@ xfs_bmapi_reserve_delalloc( · 80 unmodified lines
42364253 got->br_startblock = nullstartblock(indlen);
42374254 got->br_blockcount = alen;
42384255 got->br_state = XFS_EXT_NORM;
4239− xfs_bmap_add_extent_hole_delay(ip, whichfork, lastx, got);
42404256
4241− /*
4242− * Update our extent pointer, given that xfs_bmap_add_extent_hole_delay
4243− * might have merged it into one of the neighbouring ones.
4244− */
4245− xfs_bmbt_get_all(xfs_iext_get_ext(ifp, *lastx), got);
4257+ xfs_bmap_add_extent_hole_delay(ip, whichfork, lastx, got);
42464258
42474259 /*
42484260 * Tag the inode if blocks were preallocated. Note that COW fork
@@ -4254,10 +4266,6 @@ xfs_bmapi_reserve_delalloc( · 5 unmodified lines
42544266 if (whichfork == XFS_COW_FORK && (prealloc || aoff < off || alen > len))
42554267 xfs_inode_set_cowblocks_tag(ip);
42564268
4257− ASSERT(got->br_startoff <= aoff);
4258− ASSERT(got->br_startoff + got->br_blockcount >= aoff + alen);
4259− ASSERT(isnullstartblock(got->br_startblock));
4260− ASSERT(got->br_state == XFS_EXT_NORM);
42614269 return 0;
42624270
42634271 out_unreserve_blocks:
fs/xfs/libxfs/xfs_bmap_btree.c+3−3
@@ -447,8 +447,8 @@ xfs_bmbt_alloc_block( · 446 unmodified lines
447447
448448 if (args.fsbno == NULLFSBLOCK) {
449449 args.fsbno = be64_to_cpu(start->l);
450−try_another_ag:
451450 args.type = XFS_ALLOCTYPE_START_BNO;
451+try_another_ag:
452452 /*
453453 * Make sure there is sufficient room left in the AG to
454454 * complete a full tree split for an extent insert. If
@@ -488,8 +488,8 @@ try_another_ag: · 33 unmodified lines
488488 if (xfs_sb_version_hasreflink(&cur->bc_mp->m_sb) &&
489489 args.fsbno == NULLFSBLOCK &&
490490 args.type == XFS_ALLOCTYPE_NEAR_BNO) {
491− cur->bc_private.b.dfops->dop_low = true;
492491 args.fsbno = cur->bc_private.b.firstblock;
492+ args.type = XFS_ALLOCTYPE_FIRST_AG;
493493 goto try_another_ag;
494494 }
495495
@@ -506,7 +506,7 @@ try_another_ag: · 10 unmodified lines
506506 goto error0;
507507 cur->bc_private.b.dfops->dop_low = true;
508508 }
509− if (args.fsbno == NULLFSBLOCK) {
509+ if (WARN_ON_ONCE(args.fsbno == NULLFSBLOCK)) {
510510 XFS_BTREE_TRACE_CURSOR(cur, XBT_EXIT);
511511 *stat = 0;
512512 return 0;
fs/xfs/xfs_aops.c+27−32
@@ -274,54 +274,49 @@ xfs_end_io( · 273 unmodified lines
274274 struct xfs_ioend *ioend =
275275 container_of(work, struct xfs_ioend, io_work);
276276 struct xfs_inode *ip = XFS_I(ioend->io_inode);
277+ xfs_off_t offset = ioend->io_offset;
278+ size_t size = ioend->io_size;
277279 int error = ioend->io_bio->bi_error;
278280
279281 /*
280− * Set an error if the mount has shut down and proceed with end I/O
281− * processing so it can perform whatever cleanups are necessary.
282+ * Just clean up the in-memory strutures if the fs has been shut down.
282283 */
283− if (XFS_FORCED_SHUTDOWN(ip->i_mount))
284+ if (XFS_FORCED_SHUTDOWN(ip->i_mount)) {
284285 error = -EIO;
286+ goto done;
287+ }
285288
286289 /*
287− * For a CoW extent, we need to move the mapping from the CoW fork
288− * to the data fork. If instead an error happened, just dump the
289− * new blocks.
290+ * Clean up any COW blocks on an I/O error.
290291 */
291− if (ioend->io_type == XFS_IO_COW) {
292− if (error)
293− goto done;
294− if (ioend->io_bio->bi_error) {
295− error = xfs_reflink_cancel_cow_range(ip,
296− ioend->io_offset, ioend->io_size);
297− goto done;
292+ if (unlikely(error)) {
293+ switch (ioend->io_type) {
294+ case XFS_IO_COW:
295+ xfs_reflink_cancel_cow_range(ip, offset, size, true);
296+ break;
298297 }
299− error = xfs_reflink_end_cow(ip, ioend->io_offset,
300− ioend->io_size);
301− if (error)
302− goto done;
298+
299+ goto done;
303300 }
304301
305302 /*
306− * For unwritten extents we need to issue transactions to convert a
307− * range to normal written extens after the data I/O has finished.
308− * Detecting and handling completion IO errors is done individually
309− * for each case as different cleanup operations need to be performed
310− * on error.
303+ * Success: commit the COW or unwritten blocks if needed.
311304 */
312− if (ioend->io_type == XFS_IO_UNWRITTEN) {
313− if (error)
314− goto done;
315− error = xfs_iomap_write_unwritten(ip, ioend->io_offset,
316− ioend->io_size);
317− } else if (ioend->io_append_trans) {
318− error = xfs_setfilesize_ioend(ioend, error);
319− } else {
320− ASSERT(!xfs_ioend_is_append(ioend) ||
321− ioend->io_type == XFS_IO_COW);
305+ switch (ioend->io_type) {
306+ case XFS_IO_COW:
307+ error = xfs_reflink_end_cow(ip, offset, size);
308+ break;
309+ case XFS_IO_UNWRITTEN:
310+ error = xfs_iomap_write_unwritten(ip, offset, size);
311+ break;
312+ default:
313+ ASSERT(!xfs_ioend_is_append(ioend) || ioend->io_append_trans);
314+ break;
322315 }
323316
324317 done:
318+ if (ioend->io_append_trans)
319+ error = xfs_setfilesize_ioend(ioend, error);
325320 xfs_destroy_ioend(ioend, error);
326321 }
327322
fs/xfs/xfs_icache.c+1−1
@@ -1608,7 +1608,7 @@ xfs_inode_free_cowblocks( · 1607 unmodified lines
16081608 xfs_ilock(ip, XFS_IOLOCK_EXCL);
16091609 xfs_ilock(ip, XFS_MMAPLOCK_EXCL);
16101610
1611− ret = xfs_reflink_cancel_cow_range(ip, 0, NULLFILEOFF);
1611+ ret = xfs_reflink_cancel_cow_range(ip, 0, NULLFILEOFF, false);
16121612
16131613 xfs_iunlock(ip, XFS_MMAPLOCK_EXCL);
16141614 xfs_iunlock(ip, XFS_IOLOCK_EXCL);
fs/xfs/xfs_inode.c+1−1
@@ -1615,7 +1615,7 @@ xfs_itruncate_extents( · 1614 unmodified lines
16151615
16161616 /* Remove all pending CoW reservations. */
16171617 error = xfs_reflink_cancel_cow_blocks(ip, &tp, first_unmap_block,
1618− last_block);
1618+ last_block, true);
16191619 if (error)
16201620 goto out;
16211621
fs/xfs/xfs_iomap.c+18−7
@@ -630,6 +630,11 @@ retry: · 629 unmodified lines
630630 goto out_unlock;
631631 }
632632
633+ /*
634+ * Flag newly allocated delalloc blocks with IOMAP_F_NEW so we punch
635+ * them out if the write happens to fail.
636+ */
637+ iomap->flags = IOMAP_F_NEW;
633638 trace_xfs_iomap_alloc(ip, offset, count, 0, &got);
634639 done:
635640 if (isnullstartblock(got.br_startblock))
@@ -1071,16 +1076,22 @@ xfs_file_iomap_end_delalloc( · 435 unmodified lines
10711076 struct xfs_inode *ip,
10721077 loff_t offset,
10731078 loff_t length,
1074− ssize_t written)
1079+ ssize_t written,
1080+ struct iomap *iomap)
10751081 {
10761082 struct xfs_mount *mp = ip->i_mount;
10771083 xfs_fileoff_t start_fsb;
10781084 xfs_fileoff_t end_fsb;
10791085 int error = 0;
10801086
1081− /* behave as if the write failed if drop writes is enabled */
1082− if (xfs_mp_drop_writes(mp))
1087+ /*
1088+ * Behave as if the write failed if drop writes is enabled. Set the NEW
1089+ * flag to force delalloc cleanup.
1090+ */
1091+ if (xfs_mp_drop_writes(mp)) {
1092+ iomap->flags |= IOMAP_F_NEW;
10831093 written = 0;
1094+ }
10841095
10851096 /*
10861097 * start_fsb refers to the first unused block after a short write. If
@@ -1094,14 +1105,14 @@ xfs_file_iomap_end_delalloc( · 7 unmodified lines
10941105 end_fsb = XFS_B_TO_FSB(mp, offset + length);
10951106
10961107 /*
1097− * Trim back delalloc blocks if we didn't manage to write the whole
1098− * range reserved.
1108+ * Trim delalloc blocks if they were allocated by this write and we
1109+ * didn't manage to write the whole range.
10991110 *
11001111 * We don't need to care about racing delalloc as we hold i_mutex
11011112 * across the reserve/allocate/unreserve calls. If there are delalloc
11021113 * blocks in the range, they are ours.
11031114 */
1104− if (start_fsb < end_fsb) {
1115+ if ((iomap->flags & IOMAP_F_NEW) && start_fsb < end_fsb) {
11051116 truncate_pagecache_range(VFS_I(ip), XFS_FSB_TO_B(mp, start_fsb),
11061117 XFS_FSB_TO_B(mp, end_fsb) - 1);
11071118
@@ -1131,7 +1142,7 @@ xfs_file_iomap_end( · 23 unmodified lines
11311142 {
11321143 if ((flags & IOMAP_WRITE) && iomap->type == IOMAP_DELALLOC)
11331144 return xfs_file_iomap_end_delalloc(XFS_I(inode), offset,
1134− length, written);
1145+ length, written, iomap);
11351146 return 0;
11361147 }
11371148
fs/xfs/xfs_itable.c+2−4
@@ -361,7 +361,6 @@ xfs_bulkstat( · 360 unmodified lines
361361 xfs_agino_t agino; /* inode # in allocation group */
362362 xfs_agnumber_t agno; /* allocation group number */
363363 xfs_btree_cur_t *cur; /* btree cursor for ialloc btree */
364− size_t irbsize; /* size of irec buffer in bytes */
365364 xfs_inobt_rec_incore_t *irbuf; /* start of irec buffer */
366365 int nirbuf; /* size of irbuf */
367366 int ubcount; /* size of user's buffer */
@@ -388,11 +387,10 @@ xfs_bulkstat( · 20 unmodified lines
388387 *ubcountp = 0;
389388 *done = 0;
390389
391− irbuf = kmem_zalloc_greedy(&irbsize, PAGE_SIZE, PAGE_SIZE * 4);
390+ irbuf = kmem_zalloc_large(PAGE_SIZE * 4, KM_SLEEP);
392391 if (!irbuf)
393392 return -ENOMEM;
394−
395− nirbuf = irbsize / sizeof(*irbuf);
393+ nirbuf = (PAGE_SIZE * 4) / sizeof(*irbuf);
396394
397395 /*
398396 * Loop over the allocation groups, starting from the last
fs/xfs/xfs_mount.c+1−2
@@ -513,8 +513,7 @@ STATIC void · 512 unmodified lines
513513 xfs_set_inoalignment(xfs_mount_t *mp)
514514 {
515515 if (xfs_sb_version_hasalign(&mp->m_sb) &&
516− mp->m_sb.sb_inoalignmt >=
517− XFS_B_TO_FSBT(mp, mp->m_inode_cluster_size))
516+ mp->m_sb.sb_inoalignmt >= xfs_icluster_size_fsb(mp))
518517 mp->m_inoalign_mask = mp->m_sb.sb_inoalignmt - 1;
519518 else
520519 mp->m_inoalign_mask = 0;
fs/xfs/xfs_reflink.c+16−7
@@ -548,14 +548,18 @@ xfs_reflink_trim_irec_to_next_cow( · 547 unmodified lines
548548 }
549549
550550 /*
551− * Cancel all pending CoW reservations for some block range of an inode.
551+ * Cancel CoW reservations for some block range of an inode.
552+ *
553+ * If cancel_real is true this function cancels all COW fork extents for the
554+ * inode; if cancel_real is false, real extents are not cleared.
552555 */
553556 int
554557 xfs_reflink_cancel_cow_blocks(
555558 struct xfs_inode *ip,
556559 struct xfs_trans **tpp,
557560 xfs_fileoff_t offset_fsb,
558− xfs_fileoff_t end_fsb)
561+ xfs_fileoff_t end_fsb,
562+ bool cancel_real)
559563 {
560564 struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, XFS_COW_FORK);
561565 struct xfs_bmbt_irec got, del;
@@ -579,7 +583,7 @@ xfs_reflink_cancel_cow_blocks( · 17 unmodified lines
579583 &idx, &got, &del);
580584 if (error)
581585 break;
582− } else {
586+ } else if (del.br_state == XFS_EXT_UNWRITTEN || cancel_real) {
583587 xfs_trans_ijoin(*tpp, ip, 0);
584588 xfs_defer_init(&dfops, &firstfsb);
585589
@@ -621,13 +625,17 @@ xfs_reflink_cancel_cow_blocks( · 35 unmodified lines
621625 }
622626
623627 /*
624− * Cancel all pending CoW reservations for some byte range of an inode.
628+ * Cancel CoW reservations for some byte range of an inode.
629+ *
630+ * If cancel_real is true this function cancels all COW fork extents for the
631+ * inode; if cancel_real is false, real extents are not cleared.
625632 */
626633 int
627634 xfs_reflink_cancel_cow_range(
628635 struct xfs_inode *ip,
629636 xfs_off_t offset,
630− xfs_off_t count)
637+ xfs_off_t count,
638+ bool cancel_real)
631639 {
632640 struct xfs_trans *tp;
633641 xfs_fileoff_t offset_fsb;
@@ -653,7 +661,8 @@ xfs_reflink_cancel_cow_range( · 19 unmodified lines
653661 xfs_trans_ijoin(tp, ip, 0);
654662
655663 /* Scrape out the old CoW reservations */
656− error = xfs_reflink_cancel_cow_blocks(ip, &tp, offset_fsb, end_fsb);
664+ error = xfs_reflink_cancel_cow_blocks(ip, &tp, offset_fsb, end_fsb,
665+ cancel_real);
657666 if (error)
658667 goto out_cancel;
659668
@@ -1450,7 +1459,7 @@ next: · 790 unmodified lines
14501459 * We didn't find any shared blocks so turn off the reflink flag.
14511460 * First, get rid of any leftover CoW mappings.
14521461 */
1453− error = xfs_reflink_cancel_cow_blocks(ip, tpp, 0, NULLFILEOFF);
1462+ error = xfs_reflink_cancel_cow_blocks(ip, tpp, 0, NULLFILEOFF, true);
14541463 if (error)
14551464 return error;
14561465
fs/xfs/xfs_reflink.h+2−2
@@ -39,9 +39,9 @@ extern void xfs_reflink_trim_irec_to_next_cow(struct xfs_inode *ip, · 38 unmodified lines
3939
4040 extern int xfs_reflink_cancel_cow_blocks(struct xfs_inode *ip,
4141 struct xfs_trans **tpp, xfs_fileoff_t offset_fsb,
42− xfs_fileoff_t end_fsb);
42+ xfs_fileoff_t end_fsb, bool cancel_real);
4343 extern int xfs_reflink_cancel_cow_range(struct xfs_inode *ip, xfs_off_t offset,
44− xfs_off_t count);
44+ xfs_off_t count, bool cancel_real);
4545 extern int xfs_reflink_end_cow(struct xfs_inode *ip, xfs_off_t offset,
4646 xfs_off_t count);
4747 extern int xfs_reflink_recover_cow(struct xfs_mount *mp);
fs/xfs/xfs_super.c+1−1
@@ -953,7 +953,7 @@ xfs_fs_destroy_inode( · 952 unmodified lines
953953 XFS_STATS_INC(ip->i_mount, vn_remove);
954954
955955 if (xfs_is_reflink_inode(ip)) {
956− error = xfs_reflink_cancel_cow_range(ip, 0, NULLFILEOFF);
956+ error = xfs_reflink_cancel_cow_range(ip, 0, NULLFILEOFF, true);
957957 if (error && !XFS_FORCED_SHUTDOWN(ip->i_mount))
958958 xfs_warn(ip->i_mount,
959959 "Error %d while evicting CoW blocks for inode %llu.",
include/asm-generic/4level-fixup.h+2−1
@@ -15,7 +15,6 @@ · 14 unmodified lines
1515 ((unlikely(pgd_none(*(pud))) && __pmd_alloc(mm, pud, address))? \
1616 NULL: pmd_offset(pud, address))
1717
18−#define pud_alloc(mm, pgd, address) (pgd)
1918 #define pud_offset(pgd, start) (pgd)
2019 #define pud_none(pud) 0
2120 #define pud_bad(pud) 0
@@ -35,4 +34,6 @@ · 13 unmodified lines
3534 #undef pud_addr_end
3635 #define pud_addr_end(addr, end) (end)
3736
37+#include <asm-generic/5level-fixup.h>
38+
3839 #endif
include/asm-generic/5level-fixup.h+41−0
@@ -0,0 +1,41 @@
1+#ifndef _5LEVEL_FIXUP_H
2+#define _5LEVEL_FIXUP_H
3+
4+#define __ARCH_HAS_5LEVEL_HACK
5+#define __PAGETABLE_P4D_FOLDED
6+
7+#define P4D_SHIFT PGDIR_SHIFT
8+#define P4D_SIZE PGDIR_SIZE
9+#define P4D_MASK PGDIR_MASK
10+#define PTRS_PER_P4D 1
11+
12+#define p4d_t pgd_t
13+
14+#define pud_alloc(mm, p4d, address) \
15+ ((unlikely(pgd_none(*(p4d))) && __pud_alloc(mm, p4d, address)) ? \
16+ NULL : pud_offset(p4d, address))
17+
18+#define p4d_alloc(mm, pgd, address) (pgd)
19+#define p4d_offset(pgd, start) (pgd)
20+#define p4d_none(p4d) 0
21+#define p4d_bad(p4d) 0
22+#define p4d_present(p4d) 1
23+#define p4d_ERROR(p4d) do { } while (0)
24+#define p4d_clear(p4d) pgd_clear(p4d)
25+#define p4d_val(p4d) pgd_val(p4d)
26+#define p4d_populate(mm, p4d, pud) pgd_populate(mm, p4d, pud)
27+#define p4d_page(p4d) pgd_page(p4d)
28+#define p4d_page_vaddr(p4d) pgd_page_vaddr(p4d)
29+
30+#define __p4d(x) __pgd(x)
31+#define set_p4d(p4dp, p4d) set_pgd(p4dp, p4d)
32+
33+#undef p4d_free_tlb
34+#define p4d_free_tlb(tlb, x, addr) do { } while (0)
35+#define p4d_free(mm, x) do { } while (0)
36+#define __p4d_free_tlb(tlb, x, addr) do { } while (0)
37+
38+#undef p4d_addr_end
39+#define p4d_addr_end(addr, end) (end)
40+
41+#endif
include/asm-generic/pgtable-nop4d-hack.h+62−0
@@ -0,0 +1,62 @@
1+#ifndef _PGTABLE_NOP4D_HACK_H
2+#define _PGTABLE_NOP4D_HACK_H
3+
4+#ifndef __ASSEMBLY__
5+#include <asm-generic/5level-fixup.h>
6+
7+#define __PAGETABLE_PUD_FOLDED
8+
9+/*
10+ * Having the pud type consist of a pgd gets the size right, and allows
11+ * us to conceptually access the pgd entry that this pud is folded into
12+ * without casting.
13+ */
14+typedef struct { pgd_t pgd; } pud_t;
15+
16+#define PUD_SHIFT PGDIR_SHIFT
17+#define PTRS_PER_PUD 1
18+#define PUD_SIZE (1UL << PUD_SHIFT)
19+#define PUD_MASK (~(PUD_SIZE-1))
20+
21+/*
22+ * The "pgd_xxx()" functions here are trivial for a folded two-level
23+ * setup: the pud is never bad, and a pud always exists (as it's folded
24+ * into the pgd entry)
25+ */
26+static inline int pgd_none(pgd_t pgd) { return 0; }
27+static inline int pgd_bad(pgd_t pgd) { return 0; }
28+static inline int pgd_present(pgd_t pgd) { return 1; }
29+static inline void pgd_clear(pgd_t *pgd) { }
30+#define pud_ERROR(pud) (pgd_ERROR((pud).pgd))
31+
32+#define pgd_populate(mm, pgd, pud) do { } while (0)
33+/*
34+ * (puds are folded into pgds so this doesn't get actually called,
35+ * but the define is needed for a generic inline function.)
36+ */
37+#define set_pgd(pgdptr, pgdval) set_pud((pud_t *)(pgdptr), (pud_t) { pgdval })
38+
39+static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address)
40+{
41+ return (pud_t *)pgd;
42+}
43+
44+#define pud_val(x) (pgd_val((x).pgd))
45+#define __pud(x) ((pud_t) { __pgd(x) })
46+
47+#define pgd_page(pgd) (pud_page((pud_t){ pgd }))
48+#define pgd_page_vaddr(pgd) (pud_page_vaddr((pud_t){ pgd }))
49+
50+/*
51+ * allocating and freeing a pud is trivial: the 1-entry pud is
52+ * inside the pgd, so has no extra memory associated with it.
53+ */
54+#define pud_alloc_one(mm, address) NULL
55+#define pud_free(mm, x) do { } while (0)
56+#define __pud_free_tlb(tlb, x, a) do { } while (0)
57+
58+#undef pud_addr_end
59+#define pud_addr_end(addr, end) (end)
60+
61+#endif /* __ASSEMBLY__ */
62+#endif /* _PGTABLE_NOP4D_HACK_H */
include/asm-generic/pgtable-nop4d.h+56−0
@@ -0,0 +1,56 @@
1+#ifndef _PGTABLE_NOP4D_H
2+#define _PGTABLE_NOP4D_H
3+
4+#ifndef __ASSEMBLY__
5+
6+#define __PAGETABLE_P4D_FOLDED
7+
8+typedef struct { pgd_t pgd; } p4d_t;
9+
10+#define P4D_SHIFT PGDIR_SHIFT
11+#define PTRS_PER_P4D 1
12+#define P4D_SIZE (1UL << P4D_SHIFT)
13+#define P4D_MASK (~(P4D_SIZE-1))
14+
15+/*
16+ * The "pgd_xxx()" functions here are trivial for a folded two-level
17+ * setup: the p4d is never bad, and a p4d always exists (as it's folded
18+ * into the pgd entry)
19+ */
20+static inline int pgd_none(pgd_t pgd) { return 0; }
21+static inline int pgd_bad(pgd_t pgd) { return 0; }
22+static inline int pgd_present(pgd_t pgd) { return 1; }
23+static inline void pgd_clear(pgd_t *pgd) { }
24+#define p4d_ERROR(p4d) (pgd_ERROR((p4d).pgd))
25+
26+#define pgd_populate(mm, pgd, p4d) do { } while (0)
27+/*
28+ * (p4ds are folded into pgds so this doesn't get actually called,
29+ * but the define is needed for a generic inline function.)
30+ */
31+#define set_pgd(pgdptr, pgdval) set_p4d((p4d_t *)(pgdptr), (p4d_t) { pgdval })
32+
33+static inline p4d_t *p4d_offset(pgd_t *pgd, unsigned long address)
34+{
35+ return (p4d_t *)pgd;
36+}
37+
38+#define p4d_val(x) (pgd_val((x).pgd))
39+#define __p4d(x) ((p4d_t) { __pgd(x) })
40+
41+#define pgd_page(pgd) (p4d_page((p4d_t){ pgd }))
42+#define pgd_page_vaddr(pgd) (p4d_page_vaddr((p4d_t){ pgd }))
43+
44+/*
45+ * allocating and freeing a p4d is trivial: the 1-entry p4d is
46+ * inside the pgd, so has no extra memory associated with it.
47+ */
48+#define p4d_alloc_one(mm, address) NULL
49+#define p4d_free(mm, x) do { } while (0)
50+#define __p4d_free_tlb(tlb, x, a) do { } while (0)
51+
52+#undef p4d_addr_end
53+#define p4d_addr_end(addr, end) (end)
54+
55+#endif /* __ASSEMBLY__ */
56+#endif /* _PGTABLE_NOP4D_H */
include/asm-generic/pgtable-nopud.h+27−21
@@ -3,52 +3,57 @@ · 2 unmodified lines
33
44 #ifndef __ASSEMBLY__
55
6+#ifdef __ARCH_USE_5LEVEL_HACK
7+#include <asm-generic/pgtable-nop4d-hack.h>
8+#else
9+#include <asm-generic/pgtable-nop4d.h>
10+
611 #define __PAGETABLE_PUD_FOLDED
712
813 /*
9− * Having the pud type consist of a pgd gets the size right, and allows
10− * us to conceptually access the pgd entry that this pud is folded into
14+ * Having the pud type consist of a p4d gets the size right, and allows
15+ * us to conceptually access the p4d entry that this pud is folded into
1116 * without casting.
1217 */
13−typedef struct { pgd_t pgd; } pud_t;
18+typedef struct { p4d_t p4d; } pud_t;
1419
15−#define PUD_SHIFT PGDIR_SHIFT
20+#define PUD_SHIFT P4D_SHIFT
1621 #define PTRS_PER_PUD 1
1722 #define PUD_SIZE (1UL << PUD_SHIFT)
1823 #define PUD_MASK (~(PUD_SIZE-1))
1924
2025 /*
21− * The "pgd_xxx()" functions here are trivial for a folded two-level
26+ * The "p4d_xxx()" functions here are trivial for a folded two-level
2227 * setup: the pud is never bad, and a pud always exists (as it's folded
23− * into the pgd entry)
28+ * into the p4d entry)
2429 */
25−static inline int pgd_none(pgd_t pgd) { return 0; }
26−static inline int pgd_bad(pgd_t pgd) { return 0; }
27−static inline int pgd_present(pgd_t pgd) { return 1; }
28−static inline void pgd_clear(pgd_t *pgd) { }
29−#define pud_ERROR(pud) (pgd_ERROR((pud).pgd))
30+static inline int p4d_none(p4d_t p4d) { return 0; }
31+static inline int p4d_bad(p4d_t p4d) { return 0; }
32+static inline int p4d_present(p4d_t p4d) { return 1; }
33+static inline void p4d_clear(p4d_t *p4d) { }
34+#define pud_ERROR(pud) (p4d_ERROR((pud).p4d))
3035
31−#define pgd_populate(mm, pgd, pud) do { } while (0)
36+#define p4d_populate(mm, p4d, pud) do { } while (0)
3237 /*
33− * (puds are folded into pgds so this doesn't get actually called,
38+ * (puds are folded into p4ds so this doesn't get actually called,
3439 * but the define is needed for a generic inline function.)
3540 */
36−#define set_pgd(pgdptr, pgdval) set_pud((pud_t *)(pgdptr), (pud_t) { pgdval })
41+#define set_p4d(p4dptr, p4dval) set_pud((pud_t *)(p4dptr), (pud_t) { p4dval })
3742
38−static inline pud_t * pud_offset(pgd_t * pgd, unsigned long address)
43+static inline pud_t *pud_offset(p4d_t *p4d, unsigned long address)
3944 {
40− return (pud_t *)pgd;
45+ return (pud_t *)p4d;
4146 }
4247
43−#define pud_val(x) (pgd_val((x).pgd))
44−#define __pud(x) ((pud_t) { __pgd(x) } )
48+#define pud_val(x) (p4d_val((x).p4d))
49+#define __pud(x) ((pud_t) { __p4d(x) })
4550
46−#define pgd_page(pgd) (pud_page((pud_t){ pgd }))
47−#define pgd_page_vaddr(pgd) (pud_page_vaddr((pud_t){ pgd }))
51+#define p4d_page(p4d) (pud_page((pud_t){ p4d }))
52+#define p4d_page_vaddr(p4d) (pud_page_vaddr((pud_t){ p4d }))
4853
4954 /*
5055 * allocating and freeing a pud is trivial: the 1-entry pud is
51− * inside the pgd, so has no extra memory associated with it.
56+ * inside the p4d, so has no extra memory associated with it.
5257 */
5358 #define pud_alloc_one(mm, address) NULL
5459 #define pud_free(mm, x) do { } while (0)
@@ -58,4 +63,5 @@ static inline pud_t * pud_offset(pgd_t * pgd, unsigned long address) · 3 unmodified lines
5863 #define pud_addr_end(addr, end) (end)
5964
6065 #endif /* __ASSEMBLY__ */
66+#endif /* !__ARCH_USE_5LEVEL_HACK */
6167 #endif /* _PGTABLE_NOPUD_H */
include/asm-generic/pgtable.h+45−3
@@ -10,9 +10,9 @@ · 9 unmodified lines
1010 #include <linux/bug.h>
1111 #include <linux/errno.h>
1212
13−#if 4 - defined(__PAGETABLE_PUD_FOLDED) - defined(__PAGETABLE_PMD_FOLDED) != \
14− CONFIG_PGTABLE_LEVELS
15−#error CONFIG_PGTABLE_LEVELS is not consistent with __PAGETABLE_{PUD,PMD}_FOLDED
13+#if 5 - defined(__PAGETABLE_P4D_FOLDED) - defined(__PAGETABLE_PUD_FOLDED) - \
14+ defined(__PAGETABLE_PMD_FOLDED) != CONFIG_PGTABLE_LEVELS
15+#error CONFIG_PGTABLE_LEVELS is not consistent with __PAGETABLE_{P4D,PUD,PMD}_FOLDED
1616 #endif
1717
1818 /*
@@ -424,6 +424,13 @@ static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot) · 405 unmodified lines
424424 (__boundary - 1 < (end) - 1)? __boundary: (end); \
425425 })
426426
427+#ifndef p4d_addr_end
428+#define p4d_addr_end(addr, end) \
429+({ unsigned long __boundary = ((addr) + P4D_SIZE) & P4D_MASK; \
430+ (__boundary - 1 < (end) - 1)? __boundary: (end); \
431+})
432+#endif
433+
427434 #ifndef pud_addr_end
428435 #define pud_addr_end(addr, end) \
429436 ({ unsigned long __boundary = ((addr) + PUD_SIZE) & PUD_MASK; \
@@ -444,6 +451,7 @@ static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot) · 14 unmodified lines
444451 * Do the tests inline, but report and clear the bad entry in mm/memory.c.
445452 */
446453 void pgd_clear_bad(pgd_t *);
454+void p4d_clear_bad(p4d_t *);
447455 void pud_clear_bad(pud_t *);
448456 void pmd_clear_bad(pmd_t *);
449457
@@ -458,6 +466,17 @@ static inline int pgd_none_or_clear_bad(pgd_t *pgd) · 8 unmodified lines
458466 return 0;
459467 }
460468
469+static inline int p4d_none_or_clear_bad(p4d_t *p4d)
470+{
471+ if (p4d_none(*p4d))
472+ return 1;
473+ if (unlikely(p4d_bad(*p4d))) {
474+ p4d_clear_bad(p4d);
475+ return 1;
476+ }
477+ return 0;
478+}
479+
461480 static inline int pud_none_or_clear_bad(pud_t *pud)
462481 {
463482 if (pud_none(*pud))
@@ -844,11 +863,30 @@ static inline int pmd_protnone(pmd_t pmd) · 380 unmodified lines
844863 #endif /* CONFIG_MMU */
845864
846865 #ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
866+
867+#ifndef __PAGETABLE_P4D_FOLDED
868+int p4d_set_huge(p4d_t *p4d, phys_addr_t addr, pgprot_t prot);
869+int p4d_clear_huge(p4d_t *p4d);
870+#else
871+static inline int p4d_set_huge(p4d_t *p4d, phys_addr_t addr, pgprot_t prot)
872+{
873+ return 0;
874+}
875+static inline int p4d_clear_huge(p4d_t *p4d)
876+{
877+ return 0;
878+}
879+#endif /* !__PAGETABLE_P4D_FOLDED */
880+
847881 int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot);
848882 int pmd_set_huge(pmd_t *pmd, phys_addr_t addr, pgprot_t prot);
849883 int pud_clear_huge(pud_t *pud);
850884 int pmd_clear_huge(pmd_t *pmd);
851885 #else /* !CONFIG_HAVE_ARCH_HUGE_VMAP */
886+static inline int p4d_set_huge(p4d_t *p4d, phys_addr_t addr, pgprot_t prot)
887+{
888+ return 0;
889+}
852890 static inline int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot)
853891 {
854892 return 0;
@@ -857,6 +895,10 @@ static inline int pmd_set_huge(pmd_t *pmd, phys_addr_t addr, pgprot_t prot) · 2 unmodified lines
857895 {
858896 return 0;
859897 }
898+static inline int p4d_clear_huge(p4d_t *p4d)
899+{
900+ return 0;
901+}
860902 static inline int pud_clear_huge(pud_t *pud)
861903 {
862904 return 0;
include/asm-generic/tlb.h+11−3
@@ -270,6 +270,12 @@ static inline void tlb_remove_check_page_size_change(struct mmu_gather *tlb, · 269 unmodified lines
270270 __pte_free_tlb(tlb, ptep, address); \
271271 } while (0)
272272
273+#define pmd_free_tlb(tlb, pmdp, address) \
274+ do { \
275+ __tlb_adjust_range(tlb, address, PAGE_SIZE); \
276+ __pmd_free_tlb(tlb, pmdp, address); \
277+ } while (0)
278+
273279 #ifndef __ARCH_HAS_4LEVEL_HACK
274280 #define pud_free_tlb(tlb, pudp, address) \
275281 do { \
@@ -278,11 +284,13 @@ static inline void tlb_remove_check_page_size_change(struct mmu_gather *tlb, · 2 unmodified lines
278284 } while (0)
279285 #endif
280286
281−#define pmd_free_tlb(tlb, pmdp, address) \
287+#ifndef __ARCH_HAS_5LEVEL_HACK
288+#define p4d_free_tlb(tlb, pudp, address) \
282289 do { \
283− __tlb_adjust_range(tlb, address, PAGE_SIZE); \
284− __pmd_free_tlb(tlb, pmdp, address); \
290+ __tlb_adjust_range(tlb, address, PAGE_SIZE); \
291+ __p4d_free_tlb(tlb, pudp, address); \
285292 } while (0)
293+#endif
286294
287295 #define tlb_migrate_finish(mm) do {} while (0)
288296
include/crypto/if_alg.h+1−1
@@ -73,7 +73,7 @@ int af_alg_unregister_type(const struct af_alg_type *type); · 72 unmodified lines
7373
7474 int af_alg_release(struct socket *sock);
7575 void af_alg_release_parent(struct sock *sk);
76−int af_alg_accept(struct sock *sk, struct socket *newsock);
76+int af_alg_accept(struct sock *sk, struct socket *newsock, bool kern);
7777
7878 int af_alg_make_sg(struct af_alg_sgl *sgl, struct iov_iter *iter, int len);
7979 void af_alg_free_sg(struct af_alg_sgl *sgl);
include/dt-bindings/sound/cs42l42.h+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
2020 #define CS42L42_HPOUT_LOAD_1NF 0
2121 #define CS42L42_HPOUT_LOAD_10NF 1
2222
23−/* HPOUT Clamp to GND Overide */
23+/* HPOUT Clamp to GND Override */
2424 #define CS42L42_HPOUT_CLAMP_EN 0
2525 #define CS42L42_HPOUT_CLAMP_DIS 1
2626
include/linux/blkdev.h+0−1
@@ -435,7 +435,6 @@ struct request_queue { · 434 unmodified lines
435435 struct delayed_work delay_work;
436436
437437 struct backing_dev_info *backing_dev_info;
438− struct disk_devt *disk_devt;
439438
440439 /*
441440 * The queue owner gets to use this for whatever they like.
include/linux/ceph/libceph.h+2−0
@@ -48,6 +48,7 @@ struct ceph_options { · 47 unmodified lines
4848 unsigned long mount_timeout; /* jiffies */
4949 unsigned long osd_idle_ttl; /* jiffies */
5050 unsigned long osd_keepalive_timeout; /* jiffies */
51+ unsigned long osd_request_timeout; /* jiffies */
5152
5253 /*
5354 * any type that can't be simply compared or doesn't need need
@@ -68,6 +69,7 @@ struct ceph_options { · 14 unmodified lines
6869 #define CEPH_MOUNT_TIMEOUT_DEFAULT msecs_to_jiffies(60 * 1000)
6970 #define CEPH_OSD_KEEPALIVE_DEFAULT msecs_to_jiffies(5 * 1000)
7071 #define CEPH_OSD_IDLE_TTL_DEFAULT msecs_to_jiffies(60 * 1000)
72+#define CEPH_OSD_REQUEST_TIMEOUT_DEFAULT 0 /* no timeout */
7173
7274 #define CEPH_MONC_HUNT_INTERVAL msecs_to_jiffies(3 * 1000)
7375 #define CEPH_MONC_PING_INTERVAL msecs_to_jiffies(10 * 1000)
include/linux/ceph/osd_client.h+1−0
@@ -189,6 +189,7 @@ struct ceph_osd_request { · 188 unmodified lines
189189
190190 /* internal */
191191 unsigned long r_stamp; /* jiffies, send or check time */
192+ unsigned long r_start_stamp; /* jiffies */
192193 int r_attempts;
193194 struct ceph_eversion r_replay_version; /* aka reassert_version */
194195 u32 r_last_force_resend;
include/linux/dccp.h+1−0
@@ -163,6 +163,7 @@ struct dccp_request_sock { · 162 unmodified lines
163163 __u64 dreq_isr;
164164 __u64 dreq_gsr;
165165 __be32 dreq_service;
166+ spinlock_t dreq_lock;
166167 struct list_head dreq_featneg;
167168 __u32 dreq_timestamp_echo;
168169 __u32 dreq_timestamp_time;
include/linux/filter.h+12−4
@@ -409,6 +409,7 @@ struct bpf_prog { · 408 unmodified lines
409409 u16 pages; /* Number of allocated pages */
410410 kmemcheck_bitfield_begin(meta);
411411 u16 jited:1, /* Is our filter JIT'ed? */
412+ locked:1, /* Program image locked? */
412413 gpl_compatible:1, /* Is filter GPL compatible? */
413414 cb_access:1, /* Is control block accessed? */
414415 dst_needed:1, /* Do we need dst entry? */
@@ -554,22 +555,29 @@ static inline bool bpf_prog_was_classic(const struct bpf_prog *prog) · 139 unmodified lines
554555 #ifdef CONFIG_ARCH_HAS_SET_MEMORY
555556 static inline void bpf_prog_lock_ro(struct bpf_prog *fp)
556557 {
557− set_memory_ro((unsigned long)fp, fp->pages);
558+ fp->locked = 1;
559+ WARN_ON_ONCE(set_memory_ro((unsigned long)fp, fp->pages));
558560 }
559561
560562 static inline void bpf_prog_unlock_ro(struct bpf_prog *fp)
561563 {
562− set_memory_rw((unsigned long)fp, fp->pages);
564+ if (fp->locked) {
565+ WARN_ON_ONCE(set_memory_rw((unsigned long)fp, fp->pages));
566+ /* In case set_memory_rw() fails, we want to be the first
567+ * to crash here instead of some random place later on.
568+ */
569+ fp->locked = 0;
570+ }
563571 }
564572
565573 static inline void bpf_jit_binary_lock_ro(struct bpf_binary_header *hdr)
566574 {
567− set_memory_ro((unsigned long)hdr, hdr->pages);
575+ WARN_ON_ONCE(set_memory_ro((unsigned long)hdr, hdr->pages));
568576 }
569577
570578 static inline void bpf_jit_binary_unlock_ro(struct bpf_binary_header *hdr)
571579 {
572− set_memory_rw((unsigned long)hdr, hdr->pages);
580+ WARN_ON_ONCE(set_memory_rw((unsigned long)hdr, hdr->pages));
573581 }
574582 #else
575583 static inline void bpf_prog_lock_ro(struct bpf_prog *fp)
include/linux/fs.h+1−1
@@ -2678,7 +2678,7 @@ static const char * const kernel_read_file_str[] = { · 2677 unmodified lines
26782678
26792679 static inline const char *kernel_read_file_id_str(enum kernel_read_file_id id)
26802680 {
2681− if (id < 0 || id >= READING_MAX_ID)
2681+ if ((unsigned)id >= READING_MAX_ID)
26822682 return kernel_read_file_str[READING_UNKNOWN];
26832683
26842684 return kernel_read_file_str[id];
include/linux/genhd.h+0−8
@@ -167,13 +167,6 @@ struct blk_integrity { · 166 unmodified lines
167167 };
168168
169169 #endif /* CONFIG_BLK_DEV_INTEGRITY */
170−struct disk_devt {
171− atomic_t count;
172− void (*release)(struct disk_devt *disk_devt);
173−};
174−
175−void put_disk_devt(struct disk_devt *disk_devt);
176−void get_disk_devt(struct disk_devt *disk_devt);
177170
178171 struct gendisk {
179172 /* major, first_minor and minors are input parameters only,
@@ -183,7 +176,6 @@ struct gendisk { · 3 unmodified lines
183176 int first_minor;
184177 int minors; /* maximum number of minors, =1 for
185178 * disks that can't be partitioned. */
186− struct disk_devt *disk_devt;
187179
188180 char disk_name[DISK_NAME_LEN]; /* name of major driver */
189181 char *(*devnode)(struct gendisk *gd, umode_t *mode);
include/linux/hugetlb.h+4−1
@@ -122,7 +122,7 @@ struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address, · 121 unmodified lines
122122 struct page *follow_huge_pud(struct mm_struct *mm, unsigned long address,
123123 pud_t *pud, int flags);
124124 int pmd_huge(pmd_t pmd);
125−int pud_huge(pud_t pmd);
125+int pud_huge(pud_t pud);
126126 unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
127127 unsigned long address, unsigned long end, pgprot_t newprot);
128128
@@ -197,6 +197,9 @@ static inline void __unmap_hugepage_range(struct mmu_gather *tlb, · 68 unmodified lines
197197 #ifndef pgd_huge
198198 #define pgd_huge(x) 0
199199 #endif
200+#ifndef p4d_huge
201+#define p4d_huge(x) 0
202+#endif
200203
201204 #ifndef pgd_write
202205 static inline int pgd_write(pgd_t pgd)
include/linux/irqchip/arm-gic-v3.h+2−0
@@ -373,6 +373,8 @@ · 372 unmodified lines
373373 #define ICC_IGRPEN0_EL1_MASK (1 << ICC_IGRPEN0_EL1_SHIFT)
374374 #define ICC_IGRPEN1_EL1_SHIFT 0
375375 #define ICC_IGRPEN1_EL1_MASK (1 << ICC_IGRPEN1_EL1_SHIFT)
376+#define ICC_SRE_EL1_DIB (1U << 2)
377+#define ICC_SRE_EL1_DFB (1U << 1)
376378 #define ICC_SRE_EL1_SRE (1U << 0)
377379
378380 /*
include/linux/irqdomain.h+4−0
@@ -524,6 +524,10 @@ static inline struct irq_domain *irq_find_matching_fwnode( · 523 unmodified lines
524524 {
525525 return NULL;
526526 }
527+static inline bool irq_domain_check_msi_remap(void)
528+{
529+ return false;
530+}
527531 #endif /* !CONFIG_IRQ_DOMAIN */
528532
529533 #endif /* _LINUX_IRQDOMAIN_H */
include/linux/jump_label.h+9−2
@@ -90,6 +90,13 @@ extern bool static_key_initialized; · 89 unmodified lines
9090 struct static_key {
9191 atomic_t enabled;
9292 /*
93+ * Note:
94+ * To make anonymous unions work with old compilers, the static
95+ * initialization of them requires brackets. This creates a dependency
96+ * on the order of the struct with the initializers. If any fields
97+ * are added, STATIC_KEY_INIT_TRUE and STATIC_KEY_INIT_FALSE may need
98+ * to be modified.
99+ *
93100 * bit 0 => 1 if key is initially true
94101 * 0 if initially false
95102 * bit 1 => 1 if points to struct static_key_mod
@@ -166,10 +173,10 @@ extern void static_key_disable(struct static_key *key); · 70 unmodified lines
166173 */
167174 #define STATIC_KEY_INIT_TRUE \
168175 { .enabled = { 1 }, \
169− .entries = (void *)JUMP_TYPE_TRUE }
176+ { .entries = (void *)JUMP_TYPE_TRUE } }
170177 #define STATIC_KEY_INIT_FALSE \
171178 { .enabled = { 0 }, \
172− .entries = (void *)JUMP_TYPE_FALSE }
179+ { .entries = (void *)JUMP_TYPE_FALSE } }
173180
174181 #else /* !HAVE_JUMP_LABEL */
175182
include/linux/kasan.h+1−0
@@ -18,6 +18,7 @@ extern unsigned char kasan_zero_page[PAGE_SIZE]; · 17 unmodified lines
1818 extern pte_t kasan_zero_pte[PTRS_PER_PTE];
1919 extern pmd_t kasan_zero_pmd[PTRS_PER_PMD];
2020 extern pud_t kasan_zero_pud[PTRS_PER_PUD];
21+extern p4d_t kasan_zero_p4d[PTRS_PER_P4D];
2122
2223 void kasan_populate_zero_shadow(const void *shadow_start,
2324 const void *shadow_end);
include/linux/list_nulls.h+5−0
@@ -29,6 +29,11 @@ struct hlist_nulls_node { · 28 unmodified lines
2929 ((ptr)->first = (struct hlist_nulls_node *) NULLS_MARKER(nulls))
3030
3131 #define hlist_nulls_entry(ptr, type, member) container_of(ptr,type,member)
32+
33+#define hlist_nulls_entry_safe(ptr, type, member) \
34+ ({ typeof(ptr) ____ptr = (ptr); \
35+ !is_a_nulls(____ptr) ? hlist_nulls_entry(____ptr, type, member) : NULL; \
36+ })
3237 /**
3338 * ptr_is_a_nulls - Test if a ptr is a nulls
3439 * @ptr: ptr to be tested
include/linux/mm.h+28−6
@@ -1560,14 +1560,24 @@ static inline pte_t *get_locked_pte(struct mm_struct *mm, unsigned long addr, · 1559 unmodified lines
15601560 return ptep;
15611561 }
15621562
1563+#ifdef __PAGETABLE_P4D_FOLDED
1564+static inline int __p4d_alloc(struct mm_struct *mm, pgd_t *pgd,
1565+ unsigned long address)
1566+{
1567+ return 0;
1568+}
1569+#else
1570+int __p4d_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address);
1571+#endif
1572+
15631573 #ifdef __PAGETABLE_PUD_FOLDED
1564−static inline int __pud_alloc(struct mm_struct *mm, pgd_t *pgd,
1574+static inline int __pud_alloc(struct mm_struct *mm, p4d_t *p4d,
15651575 unsigned long address)
15661576 {
15671577 return 0;
15681578 }
15691579 #else
1570−int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address);
1580+int __pud_alloc(struct mm_struct *mm, p4d_t *p4d, unsigned long address);
15711581 #endif
15721582
15731583 #if defined(__PAGETABLE_PMD_FOLDED) || !defined(CONFIG_MMU)
@@ -1619,11 +1629,22 @@ int __pte_alloc_kernel(pmd_t *pmd, unsigned long address); · 45 unmodified lines
16191629 * Remove it when 4level-fixup.h has been removed.
16201630 */
16211631 #if defined(CONFIG_MMU) && !defined(__ARCH_HAS_4LEVEL_HACK)
1622−static inline pud_t *pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
1632+
1633+#ifndef __ARCH_HAS_5LEVEL_HACK
1634+static inline p4d_t *p4d_alloc(struct mm_struct *mm, pgd_t *pgd,
1635+ unsigned long address)
1636+{
1637+ return (unlikely(pgd_none(*pgd)) && __p4d_alloc(mm, pgd, address)) ?
1638+ NULL : p4d_offset(pgd, address);
1639+}
1640+
1641+static inline pud_t *pud_alloc(struct mm_struct *mm, p4d_t *p4d,
1642+ unsigned long address)
16231643 {
1624− return (unlikely(pgd_none(*pgd)) && __pud_alloc(mm, pgd, address))?
1625− NULL: pud_offset(pgd, address);
1644+ return (unlikely(p4d_none(*p4d)) && __pud_alloc(mm, p4d, address)) ?
1645+ NULL : pud_offset(p4d, address);
16261646 }
1647+#endif /* !__ARCH_HAS_5LEVEL_HACK */
16271648
16281649 static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
16291650 {
@@ -2385,7 +2406,8 @@ void sparse_mem_maps_populate_node(struct page **map_map, · 755 unmodified lines
23852406
23862407 struct page *sparse_mem_map_populate(unsigned long pnum, int nid);
23872408 pgd_t *vmemmap_pgd_populate(unsigned long addr, int node);
2388−pud_t *vmemmap_pud_populate(pgd_t *pgd, unsigned long addr, int node);
2409+p4d_t *vmemmap_p4d_populate(pgd_t *pgd, unsigned long addr, int node);
2410+pud_t *vmemmap_pud_populate(p4d_t *p4d, unsigned long addr, int node);
23892411 pmd_t *vmemmap_pmd_populate(pud_t *pud, unsigned long addr, int node);
23902412 pte_t *vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, int node);
23912413 void *vmemmap_alloc_block(unsigned long size, int node);
include/linux/net.h+1−1
@@ -146,7 +146,7 @@ struct proto_ops { · 145 unmodified lines
146146 int (*socketpair)(struct socket *sock1,
147147 struct socket *sock2);
148148 int (*accept) (struct socket *sock,
149− struct socket *newsock, int flags);
149+ struct socket *newsock, int flags, bool kern);
150150 int (*getname) (struct socket *sock,
151151 struct sockaddr *addr,
152152 int *sockaddr_len, int peer);
include/linux/phy.h+4−0
@@ -837,6 +837,10 @@ int genphy_read_status(struct phy_device *phydev); · 836 unmodified lines
837837 int genphy_suspend(struct phy_device *phydev);
838838 int genphy_resume(struct phy_device *phydev);
839839 int genphy_soft_reset(struct phy_device *phydev);
840+static inline int genphy_no_soft_reset(struct phy_device *phydev)
841+{
842+ return 0;
843+}
840844 void phy_driver_unregister(struct phy_driver *drv);
841845 void phy_drivers_unregister(struct phy_driver *drv, int n);
842846 int phy_driver_register(struct phy_driver *new_driver, struct module *owner);
include/linux/purgatory.h+23−0
@@ -0,0 +1,23 @@
1+#ifndef _LINUX_PURGATORY_H
2+#define _LINUX_PURGATORY_H
3+
4+#include <linux/types.h>
5+#include <crypto/sha.h>
6+#include <uapi/linux/kexec.h>
7+
8+struct kexec_sha_region {
9+ unsigned long start;
10+ unsigned long len;
11+};
12+
13+/*
14+ * These forward declarations serve two purposes:
15+ *
16+ * 1) Make sparse happy when checking arch/purgatory
17+ * 2) Document that these are required to be global so the symbol
18+ * lookup in kexec works
19+ */
20+extern struct kexec_sha_region purgatory_sha_regions[KEXEC_SEGMENT_MAX];
21+extern u8 purgatory_sha256_digest[SHA256_DIGEST_SIZE];
22+
23+#endif
include/linux/random.h+15−3
@@ -37,14 +37,26 @@ extern void get_random_bytes(void *buf, int nbytes); · 36 unmodified lines
3737 extern int add_random_ready_callback(struct random_ready_callback *rdy);
3838 extern void del_random_ready_callback(struct random_ready_callback *rdy);
3939 extern void get_random_bytes_arch(void *buf, int nbytes);
40−extern int random_int_secret_init(void);
4140
4241 #ifndef MODULE
4342 extern const struct file_operations random_fops, urandom_fops;
4443 #endif
4544
46−unsigned int get_random_int(void);
47−unsigned long get_random_long(void);
45+u32 get_random_u32(void);
46+u64 get_random_u64(void);
47+static inline unsigned int get_random_int(void)
48+{
49+ return get_random_u32();
50+}
51+static inline unsigned long get_random_long(void)
52+{
53+#if BITS_PER_LONG == 64
54+ return get_random_u64();
55+#else
56+ return get_random_u32();
57+#endif
58+}
59+
4860 unsigned long randomize_page(unsigned long start, unsigned long range);
4961
5062 u32 prandom_u32(void);
include/linux/rculist_nulls.h+14−0
@@ -156,5 +156,19 @@ static inline void hlist_nulls_add_tail_rcu(struct hlist_nulls_node *n, · 155 unmodified lines
156156 ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1; }); \
157157 pos = rcu_dereference_raw(hlist_nulls_next_rcu(pos)))
158158
159+/**
160+ * hlist_nulls_for_each_entry_safe -
161+ * iterate over list of given type safe against removal of list entry
162+ * @tpos: the type * to use as a loop cursor.
163+ * @pos: the &struct hlist_nulls_node to use as a loop cursor.
164+ * @head: the head for your list.
165+ * @member: the name of the hlist_nulls_node within the struct.
166+ */
167+#define hlist_nulls_for_each_entry_safe(tpos, pos, head, member) \
168+ for (({barrier();}), \
169+ pos = rcu_dereference_raw(hlist_nulls_first_rcu(head)); \
170+ (!is_a_nulls(pos)) && \
171+ ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); \
172+ pos = rcu_dereference_raw(hlist_nulls_next_rcu(pos)); 1; });)
159173 #endif
160174 #endif
include/linux/regulator/machine.h+1−1
@@ -65,7 +65,7 @@ struct regulator_state { · 64 unmodified lines
6565 int uV; /* suspend voltage */
6666 unsigned int mode; /* suspend regulator operating mode */
6767 int enabled; /* is regulator enabled in this suspend state */
68− int disabled; /* is the regulator disbled in this suspend state */
68+ int disabled; /* is the regulator disabled in this suspend state */
6969 };
7070
7171 /**
include/linux/user_namespace.h+1−1
@@ -72,7 +72,7 @@ struct ucounts { · 71 unmodified lines
7272 struct hlist_node node;
7373 struct user_namespace *ns;
7474 kuid_t uid;
75− atomic_t count;
75+ int count;
7676 atomic_t ucount[UCOUNT_COUNTS];
7777 };
7878
include/linux/userfaultfd_k.h+3−10
@@ -61,8 +61,7 @@ extern void mremap_userfaultfd_complete(struct vm_userfaultfd_ctx *, · 60 unmodified lines
6161 unsigned long from, unsigned long to,
6262 unsigned long len);
6363
64−extern void userfaultfd_remove(struct vm_area_struct *vma,
65− struct vm_area_struct **prev,
64+extern bool userfaultfd_remove(struct vm_area_struct *vma,
6665 unsigned long start,
6766 unsigned long end);
6867
@@ -72,8 +71,6 @@ extern int userfaultfd_unmap_prep(struct vm_area_struct *vma, · 3 unmodified lines
7271 extern void userfaultfd_unmap_complete(struct mm_struct *mm,
7372 struct list_head *uf);
7473
75−extern void userfaultfd_exit(struct mm_struct *mm);
76−
7774 #else /* CONFIG_USERFAULTFD */
7875
7976 /* mm helpers */
@@ -120,11 +117,11 @@ static inline void mremap_userfaultfd_complete(struct vm_userfaultfd_ctx *ctx, · 40 unmodified lines
120117 {
121118 }
122119
123−static inline void userfaultfd_remove(struct vm_area_struct *vma,
124− struct vm_area_struct **prev,
120+static inline bool userfaultfd_remove(struct vm_area_struct *vma,
125121 unsigned long start,
126122 unsigned long end)
127123 {
124+ return true;
128125 }
129126
130127 static inline int userfaultfd_unmap_prep(struct vm_area_struct *vma,
@@ -139,10 +136,6 @@ static inline void userfaultfd_unmap_complete(struct mm_struct *mm, · 8 unmodified lines
139136 {
140137 }
141138
142−static inline void userfaultfd_exit(struct mm_struct *mm)
143−{
144−}
145−
146139 #endif /* CONFIG_USERFAULTFD */
147140
148141 #endif /* _LINUX_USERFAULTFD_K_H */
include/linux/vm_event_item.h+3−0
@@ -79,6 +79,9 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, · 78 unmodified lines
7979 THP_SPLIT_PAGE_FAILED,
8080 THP_DEFERRED_SPLIT_PAGE,
8181 THP_SPLIT_PMD,
82+#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
83+ THP_SPLIT_PUD,
84+#endif
8285 THP_ZERO_PAGE_ALLOC,
8386 THP_ZERO_PAGE_ALLOC_FAILED,
8487 #endif
include/linux/wait.h+10−21
@@ -620,30 +620,19 @@ do { \ · 619 unmodified lines
620620 __ret; \
621621 })
622622
623+extern int do_wait_intr(wait_queue_head_t *, wait_queue_t *);
624+extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_t *);
623625
624−#define __wait_event_interruptible_locked(wq, condition, exclusive, irq) \
626+#define __wait_event_interruptible_locked(wq, condition, exclusive, fn) \
625627 ({ \
626− int __ret = 0; \
628+ int __ret; \
627629 DEFINE_WAIT(__wait); \
628630 if (exclusive) \
629631 __wait.flags |= WQ_FLAG_EXCLUSIVE; \
630632 do { \
631− if (likely(list_empty(&__wait.task_list))) \
632− __add_wait_queue_tail(&(wq), &__wait); \
633− set_current_state(TASK_INTERRUPTIBLE); \
634− if (signal_pending(current)) { \
635− __ret = -ERESTARTSYS; \
633+ __ret = fn(&(wq), &__wait); \
634+ if (__ret) \
636635 break; \
637− } \
638− if (irq) \
639− spin_unlock_irq(&(wq).lock); \
640− else \
641− spin_unlock(&(wq).lock); \
642− schedule(); \
643− if (irq) \
644− spin_lock_irq(&(wq).lock); \
645− else \
646− spin_lock(&(wq).lock); \
647636 } while (!(condition)); \
648637 __remove_wait_queue(&(wq), &__wait); \
649638 __set_current_state(TASK_RUNNING); \
@@ -676,7 +665,7 @@ do { \ · 26 unmodified lines
676665 */
677666 #define wait_event_interruptible_locked(wq, condition) \
678667 ((condition) \
679− ? 0 : __wait_event_interruptible_locked(wq, condition, 0, 0))
668+ ? 0 : __wait_event_interruptible_locked(wq, condition, 0, do_wait_intr))
680669
681670 /**
682671 * wait_event_interruptible_locked_irq - sleep until a condition gets true
@@ -703,7 +692,7 @@ do { \ · 20 unmodified lines
703692 */
704693 #define wait_event_interruptible_locked_irq(wq, condition) \
705694 ((condition) \
706− ? 0 : __wait_event_interruptible_locked(wq, condition, 0, 1))
695+ ? 0 : __wait_event_interruptible_locked(wq, condition, 0, do_wait_intr_irq))
707696
708697 /**
709698 * wait_event_interruptible_exclusive_locked - sleep exclusively until a condition gets true
@@ -734,7 +723,7 @@ do { \ · 24 unmodified lines
734723 */
735724 #define wait_event_interruptible_exclusive_locked(wq, condition) \
736725 ((condition) \
737− ? 0 : __wait_event_interruptible_locked(wq, condition, 1, 0))
726+ ? 0 : __wait_event_interruptible_locked(wq, condition, 1, do_wait_intr))
738727
739728 /**
740729 * wait_event_interruptible_exclusive_locked_irq - sleep until a condition gets true
@@ -765,7 +754,7 @@ do { \ · 24 unmodified lines
765754 */
766755 #define wait_event_interruptible_exclusive_locked_irq(wq, condition) \
767756 ((condition) \
768− ? 0 : __wait_event_interruptible_locked(wq, condition, 1, 1))
757+ ? 0 : __wait_event_interruptible_locked(wq, condition, 1, do_wait_intr_irq))
769758
770759
771760 #define __wait_event_killable(wq, condition) \
include/media/vsp1.h+11−2
@@ -20,8 +20,17 @@ struct device; · 19 unmodified lines
2020
2121 int vsp1_du_init(struct device *dev);
2222
23−int vsp1_du_setup_lif(struct device *dev, unsigned int width,
24− unsigned int height);
23+/**
24+ * struct vsp1_du_lif_config - VSP LIF configuration
25+ * @width: output frame width
26+ * @height: output frame height
27+ */
28+struct vsp1_du_lif_config {
29+ unsigned int width;
30+ unsigned int height;
31+};
32+
33+int vsp1_du_setup_lif(struct device *dev, const struct vsp1_du_lif_config *cfg);
2534
2635 struct vsp1_du_atomic_config {
2736 u32 pixelformat;
include/net/inet_common.h+2−1
@@ -20,7 +20,8 @@ int __inet_stream_connect(struct socket *sock, struct sockaddr *uaddr, · 19 unmodified lines
2020 int addr_len, int flags, int is_sendmsg);
2121 int inet_dgram_connect(struct socket *sock, struct sockaddr *uaddr,
2222 int addr_len, int flags);
23−int inet_accept(struct socket *sock, struct socket *newsock, int flags);
23+int inet_accept(struct socket *sock, struct socket *newsock, int flags,
24+ bool kern);
2425 int inet_sendmsg(struct socket *sock, struct msghdr *msg, size_t size);
2526 ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset,
2627 size_t size, int flags);
include/net/inet_connection_sock.h+1−1
@@ -258,7 +258,7 @@ inet_csk_rto_backoff(const struct inet_connection_sock *icsk, · 257 unmodified lines
258258 return (unsigned long)min_t(u64, when, max_when);
259259 }
260260
261−struct sock *inet_csk_accept(struct sock *sk, int flags, int *err);
261+struct sock *inet_csk_accept(struct sock *sk, int flags, int *err, bool kern);
262262
263263 int inet_csk_get_port(struct sock *sk, unsigned short snum);
264264
include/net/irda/timer.h+1−1
@@ -59,7 +59,7 @@ struct lap_cb; · 58 unmodified lines
5959 * Slot timer must never exceed 85 ms, and must always be at least 25 ms,
6060 * suggested to 75-85 msec by IrDA lite. This doesn't work with a lot of
6161 * devices, and other stackes uses a lot more, so it's best we do it as well
62− * (Note : this is the default value and sysctl overides it - Jean II)
62+ * (Note : this is the default value and sysctl overrides it - Jean II)
6363 */
6464 #define SLOT_TIMEOUT (90*HZ/1000)
6565
include/net/sctp/structs.h+2−1
@@ -476,7 +476,8 @@ struct sctp_pf { · 475 unmodified lines
476476 int (*send_verify) (struct sctp_sock *, union sctp_addr *);
477477 int (*supported_addrs)(const struct sctp_sock *, __be16 *);
478478 struct sock *(*create_accept_sk) (struct sock *sk,
479− struct sctp_association *asoc);
479+ struct sctp_association *asoc,
480+ bool kern);
480481 int (*addr_to_user)(struct sctp_sock *sk, union sctp_addr *addr);
481482 void (*to_sk_saddr)(union sctp_addr *, struct sock *sk);
482483 void (*to_sk_daddr)(union sctp_addr *, struct sock *sk);
include/net/sock.h+6−3
@@ -236,6 +236,7 @@ struct sock_common { · 235 unmodified lines
236236 * @sk_shutdown: mask of %SEND_SHUTDOWN and/or %RCV_SHUTDOWN
237237 * @sk_userlocks: %SO_SNDBUF and %SO_RCVBUF settings
238238 * @sk_lock: synchronizer
239+ * @sk_kern_sock: True if sock is using kernel lock classes
239240 * @sk_rcvbuf: size of receive buffer in bytes
240241 * @sk_wq: sock wait queue and async head
241242 * @sk_rx_dst: receive input route used by early demux
@@ -430,7 +431,8 @@ struct sock { · 188 unmodified lines
430431 #endif
431432
432433 kmemcheck_bitfield_begin(flags);
433− unsigned int sk_padding : 2,
434+ unsigned int sk_padding : 1,
435+ sk_kern_sock : 1,
434436 sk_no_check_tx : 1,
435437 sk_no_check_rx : 1,
436438 sk_userlocks : 4,
@@ -1015,7 +1017,8 @@ struct proto { · 578 unmodified lines
10151017 int addr_len);
10161018 int (*disconnect)(struct sock *sk, int flags);
10171019
1018− struct sock * (*accept)(struct sock *sk, int flags, int *err);
1020+ struct sock * (*accept)(struct sock *sk, int flags, int *err,
1021+ bool kern);
10191022
10201023 int (*ioctl)(struct sock *sk, int cmd,
10211024 unsigned long arg);
@@ -1573,7 +1576,7 @@ int sock_cmsg_send(struct sock *sk, struct msghdr *msg, · 551 unmodified lines
15731576 int sock_no_bind(struct socket *, struct sockaddr *, int);
15741577 int sock_no_connect(struct socket *, struct sockaddr *, int, int);
15751578 int sock_no_socketpair(struct socket *, struct socket *);
1576−int sock_no_accept(struct socket *, struct socket *, int);
1579+int sock_no_accept(struct socket *, struct socket *, int, bool);
15771580 int sock_no_getname(struct socket *, struct sockaddr *, int *, int);
15781581 unsigned int sock_no_poll(struct file *, struct socket *,
15791582 struct poll_table_struct *);
include/scsi/libiscsi.h+1−0
@@ -196,6 +196,7 @@ struct iscsi_conn { · 195 unmodified lines
196196 struct iscsi_task *task; /* xmit task in progress */
197197
198198 /* xmit */
199+ spinlock_t taskqueuelock; /* protects the next three lists */
199200 struct list_head mgmtqueue; /* mgmt (control) xmit queue */
200201 struct list_head cmdqueue; /* data-path cmd queue */
201202 struct list_head requeue; /* tasks needing another run */
include/scsi/scsi_device.h+4−0
@@ -472,6 +472,10 @@ static inline int scsi_device_created(struct scsi_device *sdev) · 471 unmodified lines
472472 sdev->sdev_state == SDEV_CREATED_BLOCK;
473473 }
474474
475+int scsi_internal_device_block(struct scsi_device *sdev, bool wait);
476+int scsi_internal_device_unblock(struct scsi_device *sdev,
477+ enum scsi_device_state new_state);
478+
475479 /* accessor functions for the SCSI parameters */
476480 static inline int scsi_device_sync(struct scsi_device *sdev)
477481 {
include/trace/events/syscalls.h+1−0
@@ -1,5 +1,6 @@
11 #undef TRACE_SYSTEM
22 #define TRACE_SYSTEM raw_syscalls
3+#undef TRACE_INCLUDE_FILE
34 #define TRACE_INCLUDE_FILE syscalls
45
56 #if !defined(_TRACE_EVENTS_SYSCALLS_H) || defined(TRACE_HEADER_MULTI_READ)
include/uapi/linux/packet_diag.h+1−1
@@ -64,7 +64,7 @@ struct packet_diag_mclist { · 63 unmodified lines
6464 __u32 pdmc_count;
6565 __u16 pdmc_type;
6666 __u16 pdmc_alen;
67− __u8 pdmc_addr[MAX_ADDR_LEN];
67+ __u8 pdmc_addr[32]; /* MAX_ADDR_LEN */
6868 };
6969
7070 struct packet_diag_ring {
include/uapi/linux/userfaultfd.h+1−4
@@ -18,8 +18,7 @@ · 17 unmodified lines
1818 * means the userland is reading).
1919 */
2020 #define UFFD_API ((__u64)0xAA)
21−#define UFFD_API_FEATURES (UFFD_FEATURE_EVENT_EXIT | \
22− UFFD_FEATURE_EVENT_FORK | \
21+#define UFFD_API_FEATURES (UFFD_FEATURE_EVENT_FORK | \
2322 UFFD_FEATURE_EVENT_REMAP | \
2423 UFFD_FEATURE_EVENT_REMOVE | \
2524 UFFD_FEATURE_EVENT_UNMAP | \
@@ -113,7 +112,6 @@ struct uffd_msg { · 87 unmodified lines
113112 #define UFFD_EVENT_REMAP 0x14
114113 #define UFFD_EVENT_REMOVE 0x15
115114 #define UFFD_EVENT_UNMAP 0x16
116−#define UFFD_EVENT_EXIT 0x17
117115
118116 /* flags for UFFD_EVENT_PAGEFAULT */
119117 #define UFFD_PAGEFAULT_FLAG_WRITE (1<<0) /* If this was a write fault */
@@ -163,7 +161,6 @@ struct uffdio_api { · 43 unmodified lines
163161 #define UFFD_FEATURE_MISSING_HUGETLBFS (1<<4)
164162 #define UFFD_FEATURE_MISSING_SHMEM (1<<5)
165163 #define UFFD_FEATURE_EVENT_UNMAP (1<<6)
166−#define UFFD_FEATURE_EVENT_EXIT (1<<7)
167164 __u64 features;
168165
169166 __u64 ioctls;
include/xen/swiotlb-xen.h+11−0
@@ -2,6 +2,7 @@ · 1 unmodified line
22 #define __LINUX_SWIOTLB_XEN_H
33
44 #include <linux/dma-direction.h>
5+#include <linux/scatterlist.h>
56 #include <linux/swiotlb.h>
67
78 extern int xen_swiotlb_init(int verbose, bool early);
@@ -55,4 +56,14 @@ xen_swiotlb_dma_supported(struct device *hwdev, u64 mask); · 47 unmodified lines
5556
5657 extern int
5758 xen_swiotlb_set_dma_mask(struct device *dev, u64 dma_mask);
59+
60+extern int
61+xen_swiotlb_dma_mmap(struct device *dev, struct vm_area_struct *vma,
62+ void *cpu_addr, dma_addr_t dma_addr, size_t size,
63+ unsigned long attrs);
64+
65+extern int
66+xen_swiotlb_get_sgtable(struct device *dev, struct sg_table *sgt,
67+ void *cpu_addr, dma_addr_t handle, size_t size,
68+ unsigned long attrs);
5869 #endif /* __LINUX_SWIOTLB_XEN_H */
init/main.c+0−1
@@ -882,7 +882,6 @@ static void __init do_basic_setup(void) · 881 unmodified lines
882882 do_ctors();
883883 usermodehelper_enable();
884884 do_initcalls();
885− random_int_secret_init();
886885 }
887886
888887 static void __init do_pre_smp_initcalls(void)
kernel/bpf/hashtab.c+80−39
@@ -13,11 +13,12 @@ · 12 unmodified lines
1313 #include <linux/bpf.h>
1414 #include <linux/jhash.h>
1515 #include <linux/filter.h>
16+#include <linux/rculist_nulls.h>
1617 #include "percpu_freelist.h"
1718 #include "bpf_lru_list.h"
1819
1920 struct bucket {
20− struct hlist_head head;
21+ struct hlist_nulls_head head;
2122 raw_spinlock_t lock;
2223 };
2324
@@ -44,9 +45,14 @@ enum extra_elem_state { · 20 unmodified lines
4445 /* each htab element is struct htab_elem + key + value */
4546 struct htab_elem {
4647 union {
47− struct hlist_node hash_node;
48− struct bpf_htab *htab;
49− struct pcpu_freelist_node fnode;
48+ struct hlist_nulls_node hash_node;
49+ struct {
50+ void *padding;
51+ union {
52+ struct bpf_htab *htab;
53+ struct pcpu_freelist_node fnode;
54+ };
55+ };
5056 };
5157 union {
5258 struct rcu_head rcu;
@@ -162,7 +168,8 @@ skip_percpu_elems: · 109 unmodified lines
162168 offsetof(struct htab_elem, lru_node),
163169 htab->elem_size, htab->map.max_entries);
164170 else
165− pcpu_freelist_populate(&htab->freelist, htab->elems,
171+ pcpu_freelist_populate(&htab->freelist,
172+ htab->elems + offsetof(struct htab_elem, fnode),
166173 htab->elem_size, htab->map.max_entries);
167174
168175 return 0;
@@ -217,6 +224,11 @@ static struct bpf_map *htab_map_alloc(union bpf_attr *attr) · 48 unmodified lines
217224 int err, i;
218225 u64 cost;
219226
227+ BUILD_BUG_ON(offsetof(struct htab_elem, htab) !=
228+ offsetof(struct htab_elem, hash_node.pprev));
229+ BUILD_BUG_ON(offsetof(struct htab_elem, fnode.next) !=
230+ offsetof(struct htab_elem, hash_node.pprev));
231+
220232 if (lru && !capable(CAP_SYS_ADMIN))
221233 /* LRU implementation is much complicated than other
222234 * maps. Hence, limit to CAP_SYS_ADMIN for now.
@@ -326,7 +338,7 @@ static struct bpf_map *htab_map_alloc(union bpf_attr *attr) · 103 unmodified lines
326338 goto free_htab;
327339
328340 for (i = 0; i < htab->n_buckets; i++) {
329− INIT_HLIST_HEAD(&htab->buckets[i].head);
341+ INIT_HLIST_NULLS_HEAD(&htab->buckets[i].head, i);
330342 raw_spin_lock_init(&htab->buckets[i].lock);
331343 }
332344
@@ -366,20 +378,44 @@ static inline struct bucket *__select_bucket(struct bpf_htab *htab, u32 hash) · 33 unmodified lines
366378 return &htab->buckets[hash & (htab->n_buckets - 1)];
367379 }
368380
369−static inline struct hlist_head *select_bucket(struct bpf_htab *htab, u32 hash)
381+static inline struct hlist_nulls_head *select_bucket(struct bpf_htab *htab, u32 hash)
370382 {
371383 return &__select_bucket(htab, hash)->head;
372384 }
373385
374−static struct htab_elem *lookup_elem_raw(struct hlist_head *head, u32 hash,
386+/* this lookup function can only be called with bucket lock taken */
387+static struct htab_elem *lookup_elem_raw(struct hlist_nulls_head *head, u32 hash,
375388 void *key, u32 key_size)
376389 {
390+ struct hlist_nulls_node *n;
391+ struct htab_elem *l;
392+
393+ hlist_nulls_for_each_entry_rcu(l, n, head, hash_node)
394+ if (l->hash == hash && !memcmp(&l->key, key, key_size))
395+ return l;
396+
397+ return NULL;
398+}
399+
400+/* can be called without bucket lock. it will repeat the loop in
401+ * the unlikely event when elements moved from one bucket into another
402+ * while link list is being walked
403+ */
404+static struct htab_elem *lookup_nulls_elem_raw(struct hlist_nulls_head *head,
405+ u32 hash, void *key,
406+ u32 key_size, u32 n_buckets)
407+{
408+ struct hlist_nulls_node *n;
377409 struct htab_elem *l;
378410
379− hlist_for_each_entry_rcu(l, head, hash_node)
411+again:
412+ hlist_nulls_for_each_entry_rcu(l, n, head, hash_node)
380413 if (l->hash == hash && !memcmp(&l->key, key, key_size))
381414 return l;
382415
416+ if (unlikely(get_nulls_value(n) != (hash & (n_buckets - 1))))
417+ goto again;
418+
383419 return NULL;
384420 }
385421
@@ -387,7 +423,7 @@ static struct htab_elem *lookup_elem_raw(struct hlist_head *head, u32 hash, · 1 unmodified line
387423 static void *__htab_map_lookup_elem(struct bpf_map *map, void *key)
388424 {
389425 struct bpf_htab *htab = container_of(map, struct bpf_htab, map);
390− struct hlist_head *head;
426+ struct hlist_nulls_head *head;
391427 struct htab_elem *l;
392428 u32 hash, key_size;
393429
@@ -400,7 +436,7 @@ static void *__htab_map_lookup_elem(struct bpf_map *map, void *key) · 6 unmodified lines
400436
401437 head = select_bucket(htab, hash);
402438
403− l = lookup_elem_raw(head, hash, key, key_size);
439+ l = lookup_nulls_elem_raw(head, hash, key, key_size, htab->n_buckets);
404440
405441 return l;
406442 }
@@ -433,8 +469,9 @@ static void *htab_lru_map_lookup_elem(struct bpf_map *map, void *key) · 26 unmodified lines
433469 static bool htab_lru_map_delete_node(void *arg, struct bpf_lru_node *node)
434470 {
435471 struct bpf_htab *htab = (struct bpf_htab *)arg;
436− struct htab_elem *l, *tgt_l;
437− struct hlist_head *head;
472+ struct htab_elem *l = NULL, *tgt_l;
473+ struct hlist_nulls_head *head;
474+ struct hlist_nulls_node *n;
438475 unsigned long flags;
439476 struct bucket *b;
440477
@@ -444,9 +481,9 @@ static bool htab_lru_map_delete_node(void *arg, struct bpf_lru_node *node) · 3 unmodified lines
444481
445482 raw_spin_lock_irqsave(&b->lock, flags);
446483
447− hlist_for_each_entry_rcu(l, head, hash_node)
484+ hlist_nulls_for_each_entry_rcu(l, n, head, hash_node)
448485 if (l == tgt_l) {
449− hlist_del_rcu(&l->hash_node);
486+ hlist_nulls_del_rcu(&l->hash_node);
450487 break;
451488 }
452489
@@ -459,7 +496,7 @@ static bool htab_lru_map_delete_node(void *arg, struct bpf_lru_node *node) · 6 unmodified lines
459496 static int htab_map_get_next_key(struct bpf_map *map, void *key, void *next_key)
460497 {
461498 struct bpf_htab *htab = container_of(map, struct bpf_htab, map);
462− struct hlist_head *head;
499+ struct hlist_nulls_head *head;
463500 struct htab_elem *l, *next_l;
464501 u32 hash, key_size;
465502 int i;
@@ -473,7 +510,7 @@ static int htab_map_get_next_key(struct bpf_map *map, void *key, void *next_key) · 7 unmodified lines
473510 head = select_bucket(htab, hash);
474511
475512 /* lookup the key */
476− l = lookup_elem_raw(head, hash, key, key_size);
513+ l = lookup_nulls_elem_raw(head, hash, key, key_size, htab->n_buckets);
477514
478515 if (!l) {
479516 i = 0;
@@ -481,7 +518,7 @@ static int htab_map_get_next_key(struct bpf_map *map, void *key, void *next_key) · 1 unmodified line
481518 }
482519
483520 /* key was found, get next key in the same bucket */
484− next_l = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu(&l->hash_node)),
521+ next_l = hlist_nulls_entry_safe(rcu_dereference_raw(hlist_nulls_next_rcu(&l->hash_node)),
485522 struct htab_elem, hash_node);
486523
487524 if (next_l) {
@@ -500,7 +537,7 @@ find_first_elem: · 12 unmodified lines
500537 head = select_bucket(htab, i);
501538
502539 /* pick first element in the bucket */
503− next_l = hlist_entry_safe(rcu_dereference_raw(hlist_first_rcu(head)),
540+ next_l = hlist_nulls_entry_safe(rcu_dereference_raw(hlist_nulls_first_rcu(head)),
504541 struct htab_elem, hash_node);
505542 if (next_l) {
506543 /* if it's not empty, just return it */
@@ -582,9 +619,13 @@ static struct htab_elem *alloc_htab_elem(struct bpf_htab *htab, void *key, · 75 unmodified lines
582619 int err = 0;
583620
584621 if (prealloc) {
585− l_new = (struct htab_elem *)pcpu_freelist_pop(&htab->freelist);
586− if (!l_new)
622+ struct pcpu_freelist_node *l;
623+
624+ l = pcpu_freelist_pop(&htab->freelist);
625+ if (!l)
587626 err = -E2BIG;
627+ else
628+ l_new = container_of(l, struct htab_elem, fnode);
588629 } else {
589630 if (atomic_inc_return(&htab->count) > htab->map.max_entries) {
590631 atomic_dec(&htab->count);
@@ -661,7 +702,7 @@ static int htab_map_update_elem(struct bpf_map *map, void *key, void *value, · 70 unmodified lines
661702 {
662703 struct bpf_htab *htab = container_of(map, struct bpf_htab, map);
663704 struct htab_elem *l_new = NULL, *l_old;
664− struct hlist_head *head;
705+ struct hlist_nulls_head *head;
665706 unsigned long flags;
666707 struct bucket *b;
667708 u32 key_size, hash;
@@ -700,9 +741,9 @@ static int htab_map_update_elem(struct bpf_map *map, void *key, void *value, · 32 unmodified lines
700741 /* add new element to the head of the list, so that
701742 * concurrent search will find it before old elem
702743 */
703− hlist_add_head_rcu(&l_new->hash_node, head);
744+ hlist_nulls_add_head_rcu(&l_new->hash_node, head);
704745 if (l_old) {
705− hlist_del_rcu(&l_old->hash_node);
746+ hlist_nulls_del_rcu(&l_old->hash_node);
706747 free_htab_elem(htab, l_old);
707748 }
708749 ret = 0;
@@ -716,7 +757,7 @@ static int htab_lru_map_update_elem(struct bpf_map *map, void *key, void *value, · 7 unmodified lines
716757 {
717758 struct bpf_htab *htab = container_of(map, struct bpf_htab, map);
718759 struct htab_elem *l_new, *l_old = NULL;
719− struct hlist_head *head;
760+ struct hlist_nulls_head *head;
720761 unsigned long flags;
721762 struct bucket *b;
722763 u32 key_size, hash;
@@ -757,10 +798,10 @@ static int htab_lru_map_update_elem(struct bpf_map *map, void *key, void *value, · 34 unmodified lines
757798 /* add new element to the head of the list, so that
758799 * concurrent search will find it before old elem
759800 */
760− hlist_add_head_rcu(&l_new->hash_node, head);
801+ hlist_nulls_add_head_rcu(&l_new->hash_node, head);
761802 if (l_old) {
762803 bpf_lru_node_set_ref(&l_new->lru_node);
763− hlist_del_rcu(&l_old->hash_node);
804+ hlist_nulls_del_rcu(&l_old->hash_node);
764805 }
765806 ret = 0;
766807
@@ -781,7 +822,7 @@ static int __htab_percpu_map_update_elem(struct bpf_map *map, void *key, · 14 unmodified lines
781822 {
782823 struct bpf_htab *htab = container_of(map, struct bpf_htab, map);
783824 struct htab_elem *l_new = NULL, *l_old;
784− struct hlist_head *head;
825+ struct hlist_nulls_head *head;
785826 unsigned long flags;
786827 struct bucket *b;
787828 u32 key_size, hash;
@@ -820,7 +861,7 @@ static int __htab_percpu_map_update_elem(struct bpf_map *map, void *key, · 32 unmodified lines
820861 ret = PTR_ERR(l_new);
821862 goto err;
822863 }
823− hlist_add_head_rcu(&l_new->hash_node, head);
864+ hlist_nulls_add_head_rcu(&l_new->hash_node, head);
824865 }
825866 ret = 0;
826867 err:
@@ -834,7 +875,7 @@ static int __htab_lru_percpu_map_update_elem(struct bpf_map *map, void *key, · 7 unmodified lines
834875 {
835876 struct bpf_htab *htab = container_of(map, struct bpf_htab, map);
836877 struct htab_elem *l_new = NULL, *l_old;
837− struct hlist_head *head;
878+ struct hlist_nulls_head *head;
838879 unsigned long flags;
839880 struct bucket *b;
840881 u32 key_size, hash;
@@ -882,7 +923,7 @@ static int __htab_lru_percpu_map_update_elem(struct bpf_map *map, void *key, · 41 unmodified lines
882923 } else {
883924 pcpu_copy_value(htab, htab_elem_get_ptr(l_new, key_size),
884925 value, onallcpus);
885− hlist_add_head_rcu(&l_new->hash_node, head);
926+ hlist_nulls_add_head_rcu(&l_new->hash_node, head);
886927 l_new = NULL;
887928 }
888929 ret = 0;
@@ -910,7 +951,7 @@ static int htab_lru_percpu_map_update_elem(struct bpf_map *map, void *key, · 21 unmodified lines
910951 static int htab_map_delete_elem(struct bpf_map *map, void *key)
911952 {
912953 struct bpf_htab *htab = container_of(map, struct bpf_htab, map);
913− struct hlist_head *head;
954+ struct hlist_nulls_head *head;
914955 struct bucket *b;
915956 struct htab_elem *l;
916957 unsigned long flags;
@@ -930,7 +971,7 @@ static int htab_map_delete_elem(struct bpf_map *map, void *key) · 13 unmodified lines
930971 l = lookup_elem_raw(head, hash, key, key_size);
931972
932973 if (l) {
933− hlist_del_rcu(&l->hash_node);
974+ hlist_nulls_del_rcu(&l->hash_node);
934975 free_htab_elem(htab, l);
935976 ret = 0;
936977 }
@@ -942,7 +983,7 @@ static int htab_map_delete_elem(struct bpf_map *map, void *key) · 5 unmodified lines
942983 static int htab_lru_map_delete_elem(struct bpf_map *map, void *key)
943984 {
944985 struct bpf_htab *htab = container_of(map, struct bpf_htab, map);
945− struct hlist_head *head;
986+ struct hlist_nulls_head *head;
946987 struct bucket *b;
947988 struct htab_elem *l;
948989 unsigned long flags;
@@ -962,7 +1003,7 @@ static int htab_lru_map_delete_elem(struct bpf_map *map, void *key) · 13 unmodified lines
9621003 l = lookup_elem_raw(head, hash, key, key_size);
9631004
9641005 if (l) {
965− hlist_del_rcu(&l->hash_node);
1006+ hlist_nulls_del_rcu(&l->hash_node);
9661007 ret = 0;
9671008 }
9681009
@@ -977,12 +1018,12 @@ static void delete_all_elements(struct bpf_htab *htab) · 8 unmodified lines
9771018 int i;
9781019
9791020 for (i = 0; i < htab->n_buckets; i++) {
980− struct hlist_head *head = select_bucket(htab, i);
981− struct hlist_node *n;
1021+ struct hlist_nulls_head *head = select_bucket(htab, i);
1022+ struct hlist_nulls_node *n;
9821023 struct htab_elem *l;
9831024
984− hlist_for_each_entry_safe(l, n, head, hash_node) {
985− hlist_del_rcu(&l->hash_node);
1025+ hlist_nulls_for_each_entry_safe(l, n, head, hash_node) {
1026+ hlist_nulls_del_rcu(&l->hash_node);
9861027 if (l->state != HTAB_EXTRA_ELEM_USED)
9871028 htab_elem_free(htab, l);
9881029 }
kernel/bpf/lpm_trie.c+6−0
@@ -500,9 +500,15 @@ unlock: · 499 unmodified lines
500500 raw_spin_unlock(&trie->lock);
501501 }
502502
503+static int trie_get_next_key(struct bpf_map *map, void *key, void *next_key)
504+{
505+ return -ENOTSUPP;
506+}
507+
503508 static const struct bpf_map_ops trie_ops = {
504509 .map_alloc = trie_alloc,
505510 .map_free = trie_free,
511+ .map_get_next_key = trie_get_next_key,
506512 .map_lookup_elem = trie_lookup_elem,
507513 .map_update_elem = trie_update_elem,
508514 .map_delete_elem = trie_delete_elem,
kernel/cgroup/cgroup-v1.c+1−1
@@ -1329,7 +1329,7 @@ static int cgroup_css_links_read(struct seq_file *seq, void *v) · 1328 unmodified lines
13291329 struct task_struct *task;
13301330 int count = 0;
13311331
1332− seq_printf(seq, "css_set %p\n", cset);
1332+ seq_printf(seq, "css_set %pK\n", cset);
13331333
13341334 list_for_each_entry(task, &cset->tasks, cg_list) {
13351335 if (count++ > MAX_TASKS_SHOWN_PER_CSS)
kernel/cgroup/cgroup.c+1−1
@@ -2669,7 +2669,7 @@ static bool css_visible(struct cgroup_subsys_state *css) · 2668 unmodified lines
26692669 *
26702670 * Returns 0 on success, -errno on failure. On failure, csses which have
26712671 * been processed already aren't cleaned up. The caller is responsible for
2672− * cleaning up with cgroup_apply_control_disble().
2672+ * cleaning up with cgroup_apply_control_disable().
26732673 */
26742674 static int cgroup_apply_control_enable(struct cgroup *cgrp)
26752675 {
kernel/cgroup/pids.c+1−1
@@ -229,7 +229,7 @@ static int pids_can_fork(struct task_struct *task) · 228 unmodified lines
229229 /* Only log the first time events_limit is incremented. */
230230 if (atomic64_inc_return(&pids->events_limit) == 1) {
231231 pr_info("cgroup: fork rejected by pids controller in ");
232− pr_cont_cgroup_path(task_cgroup(current, pids_cgrp_id));
232+ pr_cont_cgroup_path(css->cgroup);
233233 pr_cont("\n");
234234 }
235235 cgroup_file_notify(&pids->events_file);
kernel/events/core.c+1−1
@@ -1001,7 +1001,7 @@ list_update_cgroup_event(struct perf_event *event, · 1000 unmodified lines
10011001 */
10021002 #define PERF_CPU_HRTIMER (1000 / HZ)
10031003 /*
1004− * function must be called with interrupts disbled
1004+ * function must be called with interrupts disabled
10051005 */
10061006 static enum hrtimer_restart perf_mux_hrtimer_handler(struct hrtimer *hr)
10071007 {
kernel/exit.c+0−1
@@ -554,7 +554,6 @@ static void exit_mm(void) · 553 unmodified lines
554554 enter_lazy_tlb(mm, current);
555555 task_unlock(current);
556556 mm_update_next_owner(mm);
557− userfaultfd_exit(mm);
558557 mmput(mm);
559558 if (test_thread_flag(TIF_MEMDIE))
560559 exit_oom_victim();
kernel/kexec_file.c+4−4
@@ -614,13 +614,13 @@ static int kexec_calculate_store_digests(struct kimage *image) · 613 unmodified lines
614614 ret = crypto_shash_final(desc, digest);
615615 if (ret)
616616 goto out_free_digest;
617− ret = kexec_purgatory_get_set_symbol(image, "sha_regions",
618− sha_regions, sha_region_sz, 0);
617+ ret = kexec_purgatory_get_set_symbol(image, "purgatory_sha_regions",
618+ sha_regions, sha_region_sz, 0);
619619 if (ret)
620620 goto out_free_digest;
621621
622− ret = kexec_purgatory_get_set_symbol(image, "sha256_digest",
623− digest, SHA256_DIGEST_SIZE, 0);
622+ ret = kexec_purgatory_get_set_symbol(image, "purgatory_sha256_digest",
623+ digest, SHA256_DIGEST_SIZE, 0);
624624 if (ret)
625625 goto out_free_digest;
626626 }
kernel/kexec_internal.h+1−5
@@ -15,11 +15,7 @@ int kimage_is_destination_range(struct kimage *image, · 14 unmodified lines
1515 extern struct mutex kexec_mutex;
1616
1717 #ifdef CONFIG_KEXEC_FILE
18−struct kexec_sha_region {
19− unsigned long start;
20− unsigned long len;
21−};
22−
18+#include <linux/purgatory.h>
2319 void kimage_file_post_load_cleanup(struct kimage *image);
2420 #else /* CONFIG_KEXEC_FILE */
2521 static inline void kimage_file_post_load_cleanup(struct kimage *image) { }
kernel/locking/lockdep.c+9−2
@@ -3262,10 +3262,17 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass, · 3261 unmodified lines
32623262 if (depth) {
32633263 hlock = curr->held_locks + depth - 1;
32643264 if (hlock->class_idx == class_idx && nest_lock) {
3265− if (hlock->references)
3265+ if (hlock->references) {
3266+ /*
3267+ * Check: unsigned int references:12, overflow.
3268+ */
3269+ if (DEBUG_LOCKS_WARN_ON(hlock->references == (1 << 12)-1))
3270+ return 0;
3271+
32663272 hlock->references++;
3267− else
3273+ } else {
32683274 hlock->references = 2;
3275+ }
32693276
32703277 return 1;
32713278 }
kernel/locking/test-ww_mutex.c+3−3
@@ -50,7 +50,7 @@ static void test_mutex_work(struct work_struct *work) · 49 unmodified lines
5050
5151 if (mtx->flags & TEST_MTX_TRY) {
5252 while (!ww_mutex_trylock(&mtx->mutex))
53− cpu_relax();
53+ cond_resched();
5454 } else {
5555 ww_mutex_lock(&mtx->mutex, NULL);
5656 }
@@ -88,7 +88,7 @@ static int __test_mutex(unsigned int flags) · 31 unmodified lines
8888 ret = -EINVAL;
8989 break;
9090 }
91− cpu_relax();
91+ cond_resched();
9292 } while (time_before(jiffies, timeout));
9393 } else {
9494 ret = wait_for_completion_timeout(&mtx.done, TIMEOUT);
@@ -627,7 +627,7 @@ static int __init test_ww_mutex_init(void) · 532 unmodified lines
627627 if (ret)
628628 return ret;
629629
630− ret = stress(4096, hweight32(STRESS_ALL)*ncpus, 1<<12, STRESS_ALL);
630+ ret = stress(4095, hweight32(STRESS_ALL)*ncpus, 1<<12, STRESS_ALL);
631631 if (ret)
632632 return ret;
633633
kernel/sched/core.c+8−3
@@ -3287,10 +3287,15 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) · 3286 unmodified lines
32873287 struct task_struct *p;
32883288
32893289 /*
3290− * Optimization: we know that if all tasks are in
3291− * the fair class we can call that function directly:
3290+ * Optimization: we know that if all tasks are in the fair class we can
3291+ * call that function directly, but only if the @prev task wasn't of a
3292+ * higher scheduling class, because otherwise those loose the
3293+ * opportunity to pull in more work from other CPUs.
32923294 */
3293− if (likely(rq->nr_running == rq->cfs.h_nr_running)) {
3295+ if (likely((prev->sched_class == &idle_sched_class ||
3296+ prev->sched_class == &fair_sched_class) &&
3297+ rq->nr_running == rq->cfs.h_nr_running)) {
3298+
32943299 p = fair_sched_class.pick_next_task(rq, prev, rf);
32953300 if (unlikely(p == RETRY_TASK))
32963301 goto again;
kernel/sched/cpufreq_schedutil.c+9−10
@@ -36,6 +36,7 @@ struct sugov_policy { · 35 unmodified lines
3636 u64 last_freq_update_time;
3737 s64 freq_update_delay_ns;
3838 unsigned int next_freq;
39+ unsigned int cached_raw_freq;
3940
4041 /* The next fields are only needed if fast switch cannot be used. */
4142 struct irq_work irq_work;
@@ -52,7 +53,6 @@ struct sugov_cpu { · 10 unmodified lines
5253 struct update_util_data update_util;
5354 struct sugov_policy *sg_policy;
5455
55− unsigned int cached_raw_freq;
5656 unsigned long iowait_boost;
5757 unsigned long iowait_boost_max;
5858 u64 last_update;
@@ -116,7 +116,7 @@ static void sugov_update_commit(struct sugov_policy *sg_policy, u64 time, · 57 unmodified lines
116116
117117 /**
118118 * get_next_freq - Compute a new frequency for a given cpufreq policy.
119− * @sg_cpu: schedutil cpu object to compute the new frequency for.
119+ * @sg_policy: schedutil policy object to compute the new frequency for.
120120 * @util: Current CPU utilization.
121121 * @max: CPU capacity.
122122 *
@@ -136,19 +136,18 @@ static void sugov_update_commit(struct sugov_policy *sg_policy, u64 time, · 13 unmodified lines
136136 * next_freq (as calculated above) is returned, subject to policy min/max and
137137 * cpufreq driver limitations.
138138 */
139−static unsigned int get_next_freq(struct sugov_cpu *sg_cpu, unsigned long util,
140− unsigned long max)
139+static unsigned int get_next_freq(struct sugov_policy *sg_policy,
140+ unsigned long util, unsigned long max)
141141 {
142− struct sugov_policy *sg_policy = sg_cpu->sg_policy;
143142 struct cpufreq_policy *policy = sg_policy->policy;
144143 unsigned int freq = arch_scale_freq_invariant() ?
145144 policy->cpuinfo.max_freq : policy->cur;
146145
147146 freq = (freq + (freq >> 2)) * util / max;
148147
149− if (freq == sg_cpu->cached_raw_freq && sg_policy->next_freq != UINT_MAX)
148+ if (freq == sg_policy->cached_raw_freq && sg_policy->next_freq != UINT_MAX)
150149 return sg_policy->next_freq;
151− sg_cpu->cached_raw_freq = freq;
150+ sg_policy->cached_raw_freq = freq;
152151 return cpufreq_driver_resolve_freq(policy, freq);
153152 }
154153
@@ -213,7 +212,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, · 58 unmodified lines
213212 } else {
214213 sugov_get_util(&util, &max);
215214 sugov_iowait_boost(sg_cpu, &util, &max);
216− next_f = get_next_freq(sg_cpu, util, max);
215+ next_f = get_next_freq(sg_policy, util, max);
217216 }
218217 sugov_update_commit(sg_policy, time, next_f);
219218 }
@@ -267,7 +266,7 @@ static unsigned int sugov_next_freq_shared(struct sugov_cpu *sg_cpu, · 47 unmodified lines
267266 sugov_iowait_boost(j_sg_cpu, &util, &max);
268267 }
269268
270− return get_next_freq(sg_cpu, util, max);
269+ return get_next_freq(sg_policy, util, max);
271270 }
272271
273272 static void sugov_update_shared(struct update_util_data *hook, u64 time,
@@ -580,6 +579,7 @@ static int sugov_start(struct cpufreq_policy *policy) · 306 unmodified lines
580579 sg_policy->next_freq = UINT_MAX;
581580 sg_policy->work_in_progress = false;
582581 sg_policy->need_freq_update = false;
582+ sg_policy->cached_raw_freq = 0;
583583
584584 for_each_cpu(cpu, policy->cpus) {
585585 struct sugov_cpu *sg_cpu = &per_cpu(sugov_cpu, cpu);
@@ -590,7 +590,6 @@ static int sugov_start(struct cpufreq_policy *policy) · 4 unmodified lines
590590 sg_cpu->max = 0;
591591 sg_cpu->flags = SCHED_CPUFREQ_RT;
592592 sg_cpu->last_update = 0;
593− sg_cpu->cached_raw_freq = 0;
594593 sg_cpu->iowait_boost = 0;
595594 sg_cpu->iowait_boost_max = policy->cpuinfo.max_freq;
596595 cpufreq_add_update_util_hook(cpu, &sg_cpu->update_util,
kernel/sched/fair.c+1−1
@@ -5799,7 +5799,7 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t · 5798 unmodified lines
57995799 * Due to large variance we need a large fuzz factor; hackbench in
58005800 * particularly is sensitive here.
58015801 */
5802− if ((avg_idle / 512) < avg_cost)
5802+ if (sched_feat(SIS_AVG_CPU) && (avg_idle / 512) < avg_cost)
58035803 return -1;
58045804
58055805 time = local_clock();
kernel/sched/features.h+5−0
@@ -51,6 +51,11 @@ SCHED_FEAT(NONTASK_CAPACITY, true) · 50 unmodified lines
5151 */
5252 SCHED_FEAT(TTWU_QUEUE, true)
5353
54+/*
55+ * When doing wakeups, attempt to limit superfluous scans of the LLC domain.
56+ */
57+SCHED_FEAT(SIS_AVG_CPU, false)
58+
5459 #ifdef HAVE_RT_PUSH_IPI
5560 /*
5661 * In order to avoid a thundering herd attack of CPUs that are
kernel/sched/wait.c+39−0
@@ -242,6 +242,45 @@ long prepare_to_wait_event(wait_queue_head_t *q, wait_queue_t *wait, int state) · 241 unmodified lines
242242 }
243243 EXPORT_SYMBOL(prepare_to_wait_event);
244244
245+/*
246+ * Note! These two wait functions are entered with the
247+ * wait-queue lock held (and interrupts off in the _irq
248+ * case), so there is no race with testing the wakeup
249+ * condition in the caller before they add the wait
250+ * entry to the wake queue.
251+ */
252+int do_wait_intr(wait_queue_head_t *wq, wait_queue_t *wait)
253+{
254+ if (likely(list_empty(&wait->task_list)))
255+ __add_wait_queue_tail(wq, wait);
256+
257+ set_current_state(TASK_INTERRUPTIBLE);
258+ if (signal_pending(current))
259+ return -ERESTARTSYS;
260+
261+ spin_unlock(&wq->lock);
262+ schedule();
263+ spin_lock(&wq->lock);
264+ return 0;
265+}
266+EXPORT_SYMBOL(do_wait_intr);
267+
268+int do_wait_intr_irq(wait_queue_head_t *wq, wait_queue_t *wait)
269+{
270+ if (likely(list_empty(&wait->task_list)))
271+ __add_wait_queue_tail(wq, wait);
272+
273+ set_current_state(TASK_INTERRUPTIBLE);
274+ if (signal_pending(current))
275+ return -ERESTARTSYS;
276+
277+ spin_unlock_irq(&wq->lock);
278+ schedule();
279+ spin_lock_irq(&wq->lock);
280+ return 0;
281+}
282+EXPORT_SYMBOL(do_wait_intr_irq);
283+
245284 /**
246285 * finish_wait - clean up after waiting in a queue
247286 * @q: waitqueue waited on
kernel/time/jiffies.c+1−1
@@ -125,7 +125,7 @@ int register_refined_jiffies(long cycles_per_second) · 124 unmodified lines
125125 shift_hz += cycles_per_tick/2;
126126 do_div(shift_hz, cycles_per_tick);
127127 /* Calculate nsec_per_tick using shift_hz */
128− nsec_per_tick = (u64)TICK_NSEC << 8;
128+ nsec_per_tick = (u64)NSEC_PER_SEC << 8;
129129 nsec_per_tick += (u32)shift_hz/2;
130130 do_div(nsec_per_tick, (u32)shift_hz);
131131
kernel/trace/ftrace.c+18−5
@@ -4416,16 +4416,24 @@ static int __init set_graph_notrace_function(char *str) · 4415 unmodified lines
44164416 }
44174417 __setup("ftrace_graph_notrace=", set_graph_notrace_function);
44184418
4419+static int __init set_graph_max_depth_function(char *str)
4420+{
4421+ if (!str)
4422+ return 0;
4423+ fgraph_max_depth = simple_strtoul(str, NULL, 0);
4424+ return 1;
4425+}
4426+__setup("ftrace_graph_max_depth=", set_graph_max_depth_function);
4427+
44194428 static void __init set_ftrace_early_graph(char *buf, int enable)
44204429 {
44214430 int ret;
44224431 char *func;
44234432 struct ftrace_hash *hash;
44244433
4425− if (enable)
4426− hash = ftrace_graph_hash;
4427− else
4428− hash = ftrace_graph_notrace_hash;
4434+ hash = alloc_ftrace_hash(FTRACE_HASH_DEFAULT_BITS);
4435+ if (WARN_ON(!hash))
4436+ return;
44294437
44304438 while (buf) {
44314439 func = strsep(&buf, ",");
@@ -4435,6 +4443,11 @@ static void __init set_ftrace_early_graph(char *buf, int enable) · 3 unmodified lines
44354443 printk(KERN_DEBUG "ftrace: function %s not "
44364444 "traceable\n", func);
44374445 }
4446+
4447+ if (enable)
4448+ ftrace_graph_hash = hash;
4449+ else
4450+ ftrace_graph_notrace_hash = hash;
44384451 }
44394452 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
44404453
@@ -5488,7 +5501,7 @@ static void ftrace_ops_assist_func(unsigned long ip, unsigned long parent_ip, · 1047 unmodified lines
54885501 * Normally the mcount trampoline will call the ops->func, but there
54895502 * are times that it should not. For example, if the ops does not
54905503 * have its own recursion protection, then it should call the
5491− * ftrace_ops_recurs_func() instead.
5504+ * ftrace_ops_assist_func() instead.
54925505 *
54935506 * Returns the function that the trampoline should call for @ops.
54945507 */
kernel/trace/trace_stack.c+1−1
@@ -65,7 +65,7 @@ void stack_trace_print(void) · 64 unmodified lines
6565 }
6666
6767 /*
68− * When arch-specific code overides this function, the following
68+ * When arch-specific code overrides this function, the following
6969 * data should be filled up, assuming stack_trace_max_lock is held to
7070 * prevent concurrent updates.
7171 * stack_trace_index[]
kernel/ucount.c+11−7
@@ -144,7 +144,7 @@ static struct ucounts *get_ucounts(struct user_namespace *ns, kuid_t uid) · 143 unmodified lines
144144
145145 new->ns = ns;
146146 new->uid = uid;
147− atomic_set(&new->count, 0);
147+ new->count = 0;
148148
149149 spin_lock_irq(&ucounts_lock);
150150 ucounts = find_ucounts(ns, uid, hashent);
@@ -155,8 +155,10 @@ static struct ucounts *get_ucounts(struct user_namespace *ns, kuid_t uid) · 4 unmodified lines
155155 ucounts = new;
156156 }
157157 }
158− if (!atomic_add_unless(&ucounts->count, 1, INT_MAX))
158+ if (ucounts->count == INT_MAX)
159159 ucounts = NULL;
160+ else
161+ ucounts->count += 1;
160162 spin_unlock_irq(&ucounts_lock);
161163 return ucounts;
162164 }
@@ -165,13 +167,15 @@ static void put_ucounts(struct ucounts *ucounts) · 2 unmodified lines
165167 {
166168 unsigned long flags;
167169
168− if (atomic_dec_and_test(&ucounts->count)) {
169− spin_lock_irqsave(&ucounts_lock, flags);
170+ spin_lock_irqsave(&ucounts_lock, flags);
171+ ucounts->count -= 1;
172+ if (!ucounts->count)
170173 hlist_del_init(&ucounts->node);
171− spin_unlock_irqrestore(&ucounts_lock, flags);
174+ else
175+ ucounts = NULL;
176+ spin_unlock_irqrestore(&ucounts_lock, flags);
172177
173− kfree(ucounts);
174− }
178+ kfree(ucounts);
175179 }
176180
177181 static inline bool atomic_inc_below(atomic_t *v, int u)
kernel/workqueue.c+1−0
@@ -1507,6 +1507,7 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq, · 1506 unmodified lines
15071507 struct timer_list *timer = &dwork->timer;
15081508 struct work_struct *work = &dwork->work;
15091509
1510+ WARN_ON_ONCE(!wq);
15101511 WARN_ON_ONCE(timer->function != delayed_work_timer_fn ||
15111512 timer->data != (unsigned long)dwork);
15121513 WARN_ON_ONCE(timer_pending(timer));
lib/ioremap.c+36−3
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #include <asm/pgtable.h>
1515
1616 #ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
17+static int __read_mostly ioremap_p4d_capable;
1718 static int __read_mostly ioremap_pud_capable;
1819 static int __read_mostly ioremap_pmd_capable;
1920 static int __read_mostly ioremap_huge_disabled;
@@ -35,6 +36,11 @@ void __init ioremap_huge_init(void) · 15 unmodified lines
3536 }
3637 }
3738
39+static inline int ioremap_p4d_enabled(void)
40+{
41+ return ioremap_p4d_capable;
42+}
43+
3844 static inline int ioremap_pud_enabled(void)
3945 {
4046 return ioremap_pud_capable;
@@ -46,6 +52,7 @@ static inline int ioremap_pmd_enabled(void) · 5 unmodified lines
4652 }
4753
4854 #else /* !CONFIG_HAVE_ARCH_HUGE_VMAP */
55+static inline int ioremap_p4d_enabled(void) { return 0; }
4956 static inline int ioremap_pud_enabled(void) { return 0; }
5057 static inline int ioremap_pmd_enabled(void) { return 0; }
5158 #endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */
@@ -94,14 +101,14 @@ static inline int ioremap_pmd_range(pud_t *pud, unsigned long addr, · 42 unmodified lines
94101 return 0;
95102 }
96103
97−static inline int ioremap_pud_range(pgd_t *pgd, unsigned long addr,
104+static inline int ioremap_pud_range(p4d_t *p4d, unsigned long addr,
98105 unsigned long end, phys_addr_t phys_addr, pgprot_t prot)
99106 {
100107 pud_t *pud;
101108 unsigned long next;
102109
103110 phys_addr -= addr;
104− pud = pud_alloc(&init_mm, pgd, addr);
111+ pud = pud_alloc(&init_mm, p4d, addr);
105112 if (!pud)
106113 return -ENOMEM;
107114 do {
@@ -120,6 +127,32 @@ static inline int ioremap_pud_range(pgd_t *pgd, unsigned long addr, · 12 unmodified lines
120127 return 0;
121128 }
122129
130+static inline int ioremap_p4d_range(pgd_t *pgd, unsigned long addr,
131+ unsigned long end, phys_addr_t phys_addr, pgprot_t prot)
132+{
133+ p4d_t *p4d;
134+ unsigned long next;
135+
136+ phys_addr -= addr;
137+ p4d = p4d_alloc(&init_mm, pgd, addr);
138+ if (!p4d)
139+ return -ENOMEM;
140+ do {
141+ next = p4d_addr_end(addr, end);
142+
143+ if (ioremap_p4d_enabled() &&
144+ ((next - addr) == P4D_SIZE) &&
145+ IS_ALIGNED(phys_addr + addr, P4D_SIZE)) {
146+ if (p4d_set_huge(p4d, phys_addr + addr, prot))
147+ continue;
148+ }
149+
150+ if (ioremap_pud_range(p4d, addr, next, phys_addr + addr, prot))
151+ return -ENOMEM;
152+ } while (p4d++, addr = next, addr != end);
153+ return 0;
154+}
155+
123156 int ioremap_page_range(unsigned long addr,
124157 unsigned long end, phys_addr_t phys_addr, pgprot_t prot)
125158 {
@@ -135,7 +168,7 @@ int ioremap_page_range(unsigned long addr, · 9 unmodified lines
135168 pgd = pgd_offset_k(addr);
136169 do {
137170 next = pgd_addr_end(addr, end);
138− err = ioremap_pud_range(pgd, addr, next, phys_addr+addr, prot);
171+ err = ioremap_p4d_range(pgd, addr, next, phys_addr+addr, prot);
139172 if (err)
140173 break;
141174 } while (pgd++, addr = next, addr != end);
lib/radix-tree.c+2−2
@@ -2129,8 +2129,8 @@ int ida_pre_get(struct ida *ida, gfp_t gfp) · 2128 unmodified lines
21292129 struct ida_bitmap *bitmap = kmalloc(sizeof(*bitmap), gfp);
21302130 if (!bitmap)
21312131 return 0;
2132− bitmap = this_cpu_cmpxchg(ida_bitmap, NULL, bitmap);
2133− kfree(bitmap);
2132+ if (this_cpu_cmpxchg(ida_bitmap, NULL, bitmap))
2133+ kfree(bitmap);
21342134 }
21352135
21362136 return 1;
lib/refcount.c+7−7
@@ -58,7 +58,7 @@ bool refcount_add_not_zero(unsigned int i, refcount_t *r) · 57 unmodified lines
5858 val = old;
5959 }
6060
61− WARN(new == UINT_MAX, "refcount_t: saturated; leaking memory.\n");
61+ WARN_ONCE(new == UINT_MAX, "refcount_t: saturated; leaking memory.\n");
6262
6363 return true;
6464 }
@@ -66,7 +66,7 @@ EXPORT_SYMBOL_GPL(refcount_add_not_zero); · 1 unmodified line
6666
6767 void refcount_add(unsigned int i, refcount_t *r)
6868 {
69− WARN(!refcount_add_not_zero(i, r), "refcount_t: addition on 0; use-after-free.\n");
69+ WARN_ONCE(!refcount_add_not_zero(i, r), "refcount_t: addition on 0; use-after-free.\n");
7070 }
7171 EXPORT_SYMBOL_GPL(refcount_add);
7272
@@ -97,7 +97,7 @@ bool refcount_inc_not_zero(refcount_t *r) · 24 unmodified lines
9797 val = old;
9898 }
9999
100− WARN(new == UINT_MAX, "refcount_t: saturated; leaking memory.\n");
100+ WARN_ONCE(new == UINT_MAX, "refcount_t: saturated; leaking memory.\n");
101101
102102 return true;
103103 }
@@ -111,7 +111,7 @@ EXPORT_SYMBOL_GPL(refcount_inc_not_zero); · 7 unmodified lines
111111 */
112112 void refcount_inc(refcount_t *r)
113113 {
114− WARN(!refcount_inc_not_zero(r), "refcount_t: increment on 0; use-after-free.\n");
114+ WARN_ONCE(!refcount_inc_not_zero(r), "refcount_t: increment on 0; use-after-free.\n");
115115 }
116116 EXPORT_SYMBOL_GPL(refcount_inc);
117117
@@ -125,7 +125,7 @@ bool refcount_sub_and_test(unsigned int i, refcount_t *r) · 7 unmodified lines
125125
126126 new = val - i;
127127 if (new > val) {
128− WARN(new > val, "refcount_t: underflow; use-after-free.\n");
128+ WARN_ONCE(new > val, "refcount_t: underflow; use-after-free.\n");
129129 return false;
130130 }
131131
@@ -164,7 +164,7 @@ EXPORT_SYMBOL_GPL(refcount_dec_and_test); · 32 unmodified lines
164164
165165 void refcount_dec(refcount_t *r)
166166 {
167− WARN(refcount_dec_and_test(r), "refcount_t: decrement hit 0; leaking memory.\n");
167+ WARN_ONCE(refcount_dec_and_test(r), "refcount_t: decrement hit 0; leaking memory.\n");
168168 }
169169 EXPORT_SYMBOL_GPL(refcount_dec);
170170
@@ -204,7 +204,7 @@ bool refcount_dec_not_one(refcount_t *r) · 33 unmodified lines
204204
205205 new = val - 1;
206206 if (new > val) {
207− WARN(new > val, "refcount_t: underflow; use-after-free.\n");
207+ WARN_ONCE(new > val, "refcount_t: underflow; use-after-free.\n");
208208 return true;
209209 }
210210
mm/backing-dev.c+28−15
@@ -683,33 +683,26 @@ static int cgwb_bdi_init(struct backing_dev_info *bdi) · 682 unmodified lines
683683 static void cgwb_bdi_destroy(struct backing_dev_info *bdi)
684684 {
685685 struct radix_tree_iter iter;
686− struct rb_node *rbn;
687686 void **slot;
688687
689688 WARN_ON(test_bit(WB_registered, &bdi->wb.state));
690689
691690 spin_lock_irq(&cgwb_lock);
692−
693691 radix_tree_for_each_slot(slot, &bdi->cgwb_tree, &iter, 0)
694692 cgwb_kill(*slot);
695−
696− while ((rbn = rb_first(&bdi->cgwb_congested_tree))) {
697− struct bdi_writeback_congested *congested =
698− rb_entry(rbn, struct bdi_writeback_congested, rb_node);
699−
700− rb_erase(rbn, &bdi->cgwb_congested_tree);
701− congested->bdi = NULL; /* mark @congested unlinked */
702− }
703−
704693 spin_unlock_irq(&cgwb_lock);
705694
706695 /*
707− * All cgwb's and their congested states must be shutdown and
708− * released before returning. Drain the usage counter to wait for
709− * all cgwb's and cgwb_congested's ever created on @bdi.
696+ * All cgwb's must be shutdown and released before returning. Drain
697+ * the usage counter to wait for all cgwb's ever created on @bdi.
710698 */
711699 atomic_dec(&bdi->usage_cnt);
712700 wait_event(cgwb_release_wait, !atomic_read(&bdi->usage_cnt));
701+ /*
702+ * Grab back our reference so that we hold it when @bdi gets
703+ * re-registered.
704+ */
705+ atomic_inc(&bdi->usage_cnt);
713706 }
714707
715708 /**
@@ -749,6 +742,21 @@ void wb_blkcg_offline(struct blkcg *blkcg) · 33 unmodified lines
749742 spin_unlock_irq(&cgwb_lock);
750743 }
751744
745+static void cgwb_bdi_exit(struct backing_dev_info *bdi)
746+{
747+ struct rb_node *rbn;
748+
749+ spin_lock_irq(&cgwb_lock);
750+ while ((rbn = rb_first(&bdi->cgwb_congested_tree))) {
751+ struct bdi_writeback_congested *congested =
752+ rb_entry(rbn, struct bdi_writeback_congested, rb_node);
753+
754+ rb_erase(rbn, &bdi->cgwb_congested_tree);
755+ congested->bdi = NULL; /* mark @congested unlinked */
756+ }
757+ spin_unlock_irq(&cgwb_lock);
758+}
759+
752760 #else /* CONFIG_CGROUP_WRITEBACK */
753761
754762 static int cgwb_bdi_init(struct backing_dev_info *bdi)
@@ -769,7 +777,9 @@ static int cgwb_bdi_init(struct backing_dev_info *bdi) · 14 unmodified lines
769777 return 0;
770778 }
771779
772−static void cgwb_bdi_destroy(struct backing_dev_info *bdi)
780+static void cgwb_bdi_destroy(struct backing_dev_info *bdi) { }
781+
782+static void cgwb_bdi_exit(struct backing_dev_info *bdi)
773783 {
774784 wb_congested_put(bdi->wb_congested);
775785 }
@@ -857,6 +867,8 @@ int bdi_register_owner(struct backing_dev_info *bdi, struct device *owner) · 81 unmodified lines
857867 MINOR(owner->devt));
858868 if (rc)
859869 return rc;
870+ /* Leaking owner reference... */
871+ WARN_ON(bdi->owner);
860872 bdi->owner = owner;
861873 get_device(owner);
862874 return 0;
@@ -898,6 +910,7 @@ static void bdi_exit(struct backing_dev_info *bdi) · 35 unmodified lines
898910 {
899911 WARN_ON_ONCE(bdi->dev);
900912 wb_exit(&bdi->wb);
913+ cgwb_bdi_exit(bdi);
901914 }
902915
903916 static void release_bdi(struct kref *ref)
mm/gup.c+40−6
@@ -226,6 +226,7 @@ struct page *follow_page_mask(struct vm_area_struct *vma, · 225 unmodified lines
226226 unsigned int *page_mask)
227227 {
228228 pgd_t *pgd;
229+ p4d_t *p4d;
229230 pud_t *pud;
230231 pmd_t *pmd;
231232 spinlock_t *ptl;
@@ -243,8 +244,13 @@ struct page *follow_page_mask(struct vm_area_struct *vma, · 11 unmodified lines
243244 pgd = pgd_offset(mm, address);
244245 if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
245246 return no_page_table(vma, flags);
246−
247− pud = pud_offset(pgd, address);
247+ p4d = p4d_offset(pgd, address);
248+ if (p4d_none(*p4d))
249+ return no_page_table(vma, flags);
250+ BUILD_BUG_ON(p4d_huge(*p4d));
251+ if (unlikely(p4d_bad(*p4d)))
252+ return no_page_table(vma, flags);
253+ pud = pud_offset(p4d, address);
248254 if (pud_none(*pud))
249255 return no_page_table(vma, flags);
250256 if (pud_huge(*pud) && vma->vm_flags & VM_HUGETLB) {
@@ -325,6 +331,7 @@ static int get_gate_page(struct mm_struct *mm, unsigned long address, · 74 unmodified lines
325331 struct page **page)
326332 {
327333 pgd_t *pgd;
334+ p4d_t *p4d;
328335 pud_t *pud;
329336 pmd_t *pmd;
330337 pte_t *pte;
@@ -338,7 +345,9 @@ static int get_gate_page(struct mm_struct *mm, unsigned long address, · 7 unmodified lines
338345 else
339346 pgd = pgd_offset_gate(mm, address);
340347 BUG_ON(pgd_none(*pgd));
341− pud = pud_offset(pgd, address);
348+ p4d = p4d_offset(pgd, address);
349+ BUG_ON(p4d_none(*p4d));
350+ pud = pud_offset(p4d, address);
342351 BUG_ON(pud_none(*pud));
343352 pmd = pmd_offset(pud, address);
344353 if (pmd_none(*pmd))
@@ -1400,13 +1409,13 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end, · 1055 unmodified lines
14001409 return 1;
14011410 }
14021411
1403−static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end,
1412+static int gup_pud_range(p4d_t p4d, unsigned long addr, unsigned long end,
14041413 int write, struct page **pages, int *nr)
14051414 {
14061415 unsigned long next;
14071416 pud_t *pudp;
14081417
1409− pudp = pud_offset(&pgd, addr);
1418+ pudp = pud_offset(&p4d, addr);
14101419 do {
14111420 pud_t pud = READ_ONCE(*pudp);
14121421
@@ -1428,6 +1437,31 @@ static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end, · 15 unmodified lines
14281437 return 1;
14291438 }
14301439
1440+static int gup_p4d_range(pgd_t pgd, unsigned long addr, unsigned long end,
1441+ int write, struct page **pages, int *nr)
1442+{
1443+ unsigned long next;
1444+ p4d_t *p4dp;
1445+
1446+ p4dp = p4d_offset(&pgd, addr);
1447+ do {
1448+ p4d_t p4d = READ_ONCE(*p4dp);
1449+
1450+ next = p4d_addr_end(addr, end);
1451+ if (p4d_none(p4d))
1452+ return 0;
1453+ BUILD_BUG_ON(p4d_huge(p4d));
1454+ if (unlikely(is_hugepd(__hugepd(p4d_val(p4d))))) {
1455+ if (!gup_huge_pd(__hugepd(p4d_val(p4d)), addr,
1456+ P4D_SHIFT, next, write, pages, nr))
1457+ return 0;
1458+ } else if (!gup_pud_range(p4d, addr, next, write, pages, nr))
1459+ return 0;
1460+ } while (p4dp++, addr = next, addr != end);
1461+
1462+ return 1;
1463+}
1464+
14311465 /*
14321466 * Like get_user_pages_fast() except it's IRQ-safe in that it won't fall back to
14331467 * the regular GUP. It will only return non-negative values.
@@ -1478,7 +1512,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write, · 44 unmodified lines
14781512 if (!gup_huge_pd(__hugepd(pgd_val(pgd)), addr,
14791513 PGDIR_SHIFT, next, write, pages, &nr))
14801514 break;
1481− } else if (!gup_pud_range(pgd, addr, next, write, pages, &nr))
1515+ } else if (!gup_p4d_range(pgd, addr, next, write, pages, &nr))
14821516 break;
14831517 } while (pgdp++, addr = next, addr != end);
14841518 local_irq_restore(flags);
mm/huge_memory.c+7−2
@@ -1828,7 +1828,7 @@ static void __split_huge_pud_locked(struct vm_area_struct *vma, pud_t *pud, · 1827 unmodified lines
18281828 VM_BUG_ON_VMA(vma->vm_end < haddr + HPAGE_PUD_SIZE, vma);
18291829 VM_BUG_ON(!pud_trans_huge(*pud) && !pud_devmap(*pud));
18301830
1831− count_vm_event(THP_SPLIT_PMD);
1831+ count_vm_event(THP_SPLIT_PUD);
18321832
18331833 pudp_huge_clear_flush_notify(vma, haddr, pud);
18341834 }
@@ -2048,6 +2048,7 @@ void split_huge_pmd_address(struct vm_area_struct *vma, unsigned long address, · 213 unmodified lines
20482048 bool freeze, struct page *page)
20492049 {
20502050 pgd_t *pgd;
2051+ p4d_t *p4d;
20512052 pud_t *pud;
20522053 pmd_t *pmd;
20532054
@@ -2055,7 +2056,11 @@ void split_huge_pmd_address(struct vm_area_struct *vma, unsigned long address, · 1 unmodified line
20552056 if (!pgd_present(*pgd))
20562057 return;
20572058
2058− pud = pud_offset(pgd, address);
2059+ p4d = p4d_offset(pgd, address);
2060+ if (!p4d_present(*p4d))
2061+ return;
2062+
2063+ pud = pud_offset(p4d, address);
20592064 if (!pud_present(*pud))
20602065 return;
20612066
mm/hugetlb.c+18−11
@@ -4555,7 +4555,8 @@ out: · 4554 unmodified lines
45554555 int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
45564556 {
45574557 pgd_t *pgd = pgd_offset(mm, *addr);
4558− pud_t *pud = pud_offset(pgd, *addr);
4558+ p4d_t *p4d = p4d_offset(pgd, *addr);
4559+ pud_t *pud = pud_offset(p4d, *addr);
45594560
45604561 BUG_ON(page_count(virt_to_page(ptep)) == 0);
45614562 if (page_count(virt_to_page(ptep)) == 1)
@@ -4586,11 +4587,13 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, · 24 unmodified lines
45864587 unsigned long addr, unsigned long sz)
45874588 {
45884589 pgd_t *pgd;
4590+ p4d_t *p4d;
45894591 pud_t *pud;
45904592 pte_t *pte = NULL;
45914593
45924594 pgd = pgd_offset(mm, addr);
4593− pud = pud_alloc(mm, pgd, addr);
4595+ p4d = p4d_offset(pgd, addr);
4596+ pud = pud_alloc(mm, p4d, addr);
45944597 if (pud) {
45954598 if (sz == PUD_SIZE) {
45964599 pte = (pte_t *)pud;
@@ -4610,18 +4613,22 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, · 13 unmodified lines
46104613 pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
46114614 {
46124615 pgd_t *pgd;
4616+ p4d_t *p4d;
46134617 pud_t *pud;
4614− pmd_t *pmd = NULL;
4618+ pmd_t *pmd;
46154619
46164620 pgd = pgd_offset(mm, addr);
4617− if (pgd_present(*pgd)) {
4618− pud = pud_offset(pgd, addr);
4619− if (pud_present(*pud)) {
4620− if (pud_huge(*pud))
4621− return (pte_t *)pud;
4622− pmd = pmd_offset(pud, addr);
4623− }
4624− }
4621+ if (!pgd_present(*pgd))
4622+ return NULL;
4623+ p4d = p4d_offset(pgd, addr);
4624+ if (!p4d_present(*p4d))
4625+ return NULL;
4626+ pud = pud_offset(p4d, addr);
4627+ if (!pud_present(*pud))
4628+ return NULL;
4629+ if (pud_huge(*pud))
4630+ return (pte_t *)pud;
4631+ pmd = pmd_offset(pud, addr);
46254632 return (pte_t *) pmd;
46264633 }
46274634
mm/kasan/kasan_init.c+39−5
@@ -30,6 +30,9 @@ · 29 unmodified lines
3030 */
3131 unsigned char kasan_zero_page[PAGE_SIZE] __page_aligned_bss;
3232
33+#if CONFIG_PGTABLE_LEVELS > 4
34+p4d_t kasan_zero_p4d[PTRS_PER_P4D] __page_aligned_bss;
35+#endif
3336 #if CONFIG_PGTABLE_LEVELS > 3
3437 pud_t kasan_zero_pud[PTRS_PER_PUD] __page_aligned_bss;
3538 #endif
@@ -82,10 +85,10 @@ static void __init zero_pmd_populate(pud_t *pud, unsigned long addr, · 46 unmodified lines
8285 } while (pmd++, addr = next, addr != end);
8386 }
8487
85−static void __init zero_pud_populate(pgd_t *pgd, unsigned long addr,
88+static void __init zero_pud_populate(p4d_t *p4d, unsigned long addr,
8689 unsigned long end)
8790 {
88− pud_t *pud = pud_offset(pgd, addr);
91+ pud_t *pud = pud_offset(p4d, addr);
8992 unsigned long next;
9093
9194 do {
@@ -107,6 +110,23 @@ static void __init zero_pud_populate(pgd_t *pgd, unsigned long addr, · 15 unmodified lines
107110 } while (pud++, addr = next, addr != end);
108111 }
109112
113+static void __init zero_p4d_populate(pgd_t *pgd, unsigned long addr,
114+ unsigned long end)
115+{
116+ p4d_t *p4d = p4d_offset(pgd, addr);
117+ unsigned long next;
118+
119+ do {
120+ next = p4d_addr_end(addr, end);
121+
122+ if (p4d_none(*p4d)) {
123+ p4d_populate(&init_mm, p4d,
124+ early_alloc(PAGE_SIZE, NUMA_NO_NODE));
125+ }
126+ zero_pud_populate(p4d, addr, next);
127+ } while (p4d++, addr = next, addr != end);
128+}
129+
110130 /**
111131 * kasan_populate_zero_shadow - populate shadow memory region with
112132 * kasan_zero_page
@@ -125,6 +145,7 @@ void __init kasan_populate_zero_shadow(const void *shadow_start, · 12 unmodified lines
125145 next = pgd_addr_end(addr, end);
126146
127147 if (IS_ALIGNED(addr, PGDIR_SIZE) && end - addr >= PGDIR_SIZE) {
148+ p4d_t *p4d;
128149 pud_t *pud;
129150 pmd_t *pmd;
130151
@@ -135,9 +156,22 @@ void __init kasan_populate_zero_shadow(const void *shadow_start, · 4 unmodified lines
135156 * 3,2 - level page tables where we don't have
136157 * puds,pmds, so pgd_populate(), pud_populate()
137158 * is noops.
159+ *
160+ * The ifndef is required to avoid build breakage.
161+ *
162+ * With 5level-fixup.h, pgd_populate() is not nop and
163+ * we reference kasan_zero_p4d. It's not defined
164+ * unless 5-level paging enabled.
165+ *
166+ * The ifndef can be dropped once all KASAN-enabled
167+ * architectures will switch to pgtable-nop4d.h.
138168 */
139− pgd_populate(&init_mm, pgd, lm_alias(kasan_zero_pud));
140− pud = pud_offset(pgd, addr);
169+#ifndef __ARCH_HAS_5LEVEL_HACK
170+ pgd_populate(&init_mm, pgd, lm_alias(kasan_zero_p4d));
171+#endif
172+ p4d = p4d_offset(pgd, addr);
173+ p4d_populate(&init_mm, p4d, lm_alias(kasan_zero_pud));
174+ pud = pud_offset(p4d, addr);
141175 pud_populate(&init_mm, pud, lm_alias(kasan_zero_pmd));
142176 pmd = pmd_offset(pud, addr);
143177 pmd_populate_kernel(&init_mm, pmd, lm_alias(kasan_zero_pte));
@@ -148,6 +182,6 @@ void __init kasan_populate_zero_shadow(const void *shadow_start, · 4 unmodified lines
148182 pgd_populate(&init_mm, pgd,
149183 early_alloc(PAGE_SIZE, NUMA_NO_NODE));
150184 }
151− zero_pud_populate(pgd, addr, next);
185+ zero_p4d_populate(pgd, addr, next);
152186 } while (pgd++, addr = next, addr != end);
153187 }
mm/kasan/quarantine.c+44−7
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525 #include <linux/printk.h>
2626 #include <linux/shrinker.h>
2727 #include <linux/slab.h>
28+#include <linux/srcu.h>
2829 #include <linux/string.h>
2930 #include <linux/types.h>
3031
@@ -103,6 +104,7 @@ static int quarantine_tail; · 72 unmodified lines
103104 /* Total size of all objects in global_quarantine across all batches. */
104105 static unsigned long quarantine_size;
105106 static DEFINE_SPINLOCK(quarantine_lock);
107+DEFINE_STATIC_SRCU(remove_cache_srcu);
106108
107109 /* Maximum size of the global queue. */
108110 static unsigned long quarantine_max_size;
@@ -173,17 +175,22 @@ void quarantine_put(struct kasan_free_meta *info, struct kmem_cache *cache) · 64 unmodified lines
173175 struct qlist_head *q;
174176 struct qlist_head temp = QLIST_INIT;
175177
178+ /*
179+ * Note: irq must be disabled until after we move the batch to the
180+ * global quarantine. Otherwise quarantine_remove_cache() can miss
181+ * some objects belonging to the cache if they are in our local temp
182+ * list. quarantine_remove_cache() executes on_each_cpu() at the
183+ * beginning which ensures that it either sees the objects in per-cpu
184+ * lists or in the global quarantine.
185+ */
176186 local_irq_save(flags);
177187
178188 q = this_cpu_ptr(&cpu_quarantine);
179189 qlist_put(q, &info->quarantine_link, cache->size);
180− if (unlikely(q->bytes > QUARANTINE_PERCPU_SIZE))
190+ if (unlikely(q->bytes > QUARANTINE_PERCPU_SIZE)) {
181191 qlist_move_all(q, &temp);
182192
183− local_irq_restore(flags);
184−
185− if (unlikely(!qlist_empty(&temp))) {
186− spin_lock_irqsave(&quarantine_lock, flags);
193+ spin_lock(&quarantine_lock);
187194 WRITE_ONCE(quarantine_size, quarantine_size + temp.bytes);
188195 qlist_move_all(&temp, &global_quarantine[quarantine_tail]);
189196 if (global_quarantine[quarantine_tail].bytes >=
@@ -196,20 +203,33 @@ void quarantine_put(struct kasan_free_meta *info, struct kmem_cache *cache) · 6 unmodified lines
196203 if (new_tail != quarantine_head)
197204 quarantine_tail = new_tail;
198205 }
199− spin_unlock_irqrestore(&quarantine_lock, flags);
206+ spin_unlock(&quarantine_lock);
200207 }
208+
209+ local_irq_restore(flags);
201210 }
202211
203212 void quarantine_reduce(void)
204213 {
205214 size_t total_size, new_quarantine_size, percpu_quarantines;
206215 unsigned long flags;
216+ int srcu_idx;
207217 struct qlist_head to_free = QLIST_INIT;
208218
209219 if (likely(READ_ONCE(quarantine_size) <=
210220 READ_ONCE(quarantine_max_size)))
211221 return;
212222
223+ /*
224+ * srcu critical section ensures that quarantine_remove_cache()
225+ * will not miss objects belonging to the cache while they are in our
226+ * local to_free list. srcu is chosen because (1) it gives us private
227+ * grace period domain that does not interfere with anything else,
228+ * and (2) it allows synchronize_srcu() to return without waiting
229+ * if there are no pending read critical sections (which is the
230+ * expected case).
231+ */
232+ srcu_idx = srcu_read_lock(&remove_cache_srcu);
213233 spin_lock_irqsave(&quarantine_lock, flags);
214234
215235 /*
@@ -237,6 +257,7 @@ void quarantine_reduce(void) · 21 unmodified lines
237257 spin_unlock_irqrestore(&quarantine_lock, flags);
238258
239259 qlist_free_all(&to_free, NULL);
260+ srcu_read_unlock(&remove_cache_srcu, srcu_idx);
240261 }
241262
242263 static void qlist_move_cache(struct qlist_head *from,
@@ -280,12 +301,28 @@ void quarantine_remove_cache(struct kmem_cache *cache) · 37 unmodified lines
280301 unsigned long flags, i;
281302 struct qlist_head to_free = QLIST_INIT;
282303
304+ /*
305+ * Must be careful to not miss any objects that are being moved from
306+ * per-cpu list to the global quarantine in quarantine_put(),
307+ * nor objects being freed in quarantine_reduce(). on_each_cpu()
308+ * achieves the first goal, while synchronize_srcu() achieves the
309+ * second.
310+ */
283311 on_each_cpu(per_cpu_remove_cache, cache, 1);
284312
285313 spin_lock_irqsave(&quarantine_lock, flags);
286− for (i = 0; i < QUARANTINE_BATCHES; i++)
314+ for (i = 0; i < QUARANTINE_BATCHES; i++) {
315+ if (qlist_empty(&global_quarantine[i]))
316+ continue;
287317 qlist_move_cache(&global_quarantine[i], &to_free, cache);
318+ /* Scanning whole quarantine can take a while. */
319+ spin_unlock_irqrestore(&quarantine_lock, flags);
320+ cond_resched();
321+ spin_lock_irqsave(&quarantine_lock, flags);
322+ }
288323 spin_unlock_irqrestore(&quarantine_lock, flags);
289324
290325 qlist_free_all(&to_free, cache);
326+
327+ synchronize_srcu(&remove_cache_srcu);
291328 }
mm/madvise.c+41−3
@@ -513,7 +513,43 @@ static long madvise_dontneed(struct vm_area_struct *vma, · 512 unmodified lines
513513 if (!can_madv_dontneed_vma(vma))
514514 return -EINVAL;
515515
516− userfaultfd_remove(vma, prev, start, end);
516+ if (!userfaultfd_remove(vma, start, end)) {
517+ *prev = NULL; /* mmap_sem has been dropped, prev is stale */
518+
519+ down_read(&current->mm->mmap_sem);
520+ vma = find_vma(current->mm, start);
521+ if (!vma)
522+ return -ENOMEM;
523+ if (start < vma->vm_start) {
524+ /*
525+ * This "vma" under revalidation is the one
526+ * with the lowest vma->vm_start where start
527+ * is also < vma->vm_end. If start <
528+ * vma->vm_start it means an hole materialized
529+ * in the user address space within the
530+ * virtual range passed to MADV_DONTNEED.
531+ */
532+ return -ENOMEM;
533+ }
534+ if (!can_madv_dontneed_vma(vma))
535+ return -EINVAL;
536+ if (end > vma->vm_end) {
537+ /*
538+ * Don't fail if end > vma->vm_end. If the old
539+ * vma was splitted while the mmap_sem was
540+ * released the effect of the concurrent
541+ * operation may not cause MADV_DONTNEED to
542+ * have an undefined result. There may be an
543+ * adjacent next vma that we'll walk
544+ * next. userfaultfd_remove() will generate an
545+ * UFFD_EVENT_REMOVE repetition on the
546+ * end-vma->vm_end range, but the manager can
547+ * handle a repetition fine.
548+ */
549+ end = vma->vm_end;
550+ }
551+ VM_WARN_ON(start >= end);
552+ }
517553 zap_page_range(vma, start, end - start);
518554 return 0;
519555 }
@@ -554,8 +590,10 @@ static long madvise_remove(struct vm_area_struct *vma, · 34 unmodified lines
554590 * mmap_sem.
555591 */
556592 get_file(f);
557− userfaultfd_remove(vma, prev, start, end);
558− up_read(&current->mm->mmap_sem);
593+ if (userfaultfd_remove(vma, start, end)) {
594+ /* mmap_sem was not released by userfaultfd_remove() */
595+ up_read(&current->mm->mmap_sem);
596+ }
559597 error = vfs_fallocate(f,
560598 FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
561599 offset, end - start);
mm/memblock.c+4−1
@@ -1118,7 +1118,10 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn, · 1117 unmodified lines
11181118 }
11191119 } while (left < right);
11201120
1121− return min(PHYS_PFN(type->regions[right].base), max_pfn);
1121+ if (right == type->cnt)
1122+ return max_pfn;
1123+ else
1124+ return min(PHYS_PFN(type->regions[right].base), max_pfn);
11221125 }
11231126
11241127 /**
mm/memcontrol.c+13−5
@@ -466,6 +466,8 @@ static void mem_cgroup_update_tree(struct mem_cgroup *memcg, struct page *page) · 465 unmodified lines
466466 struct mem_cgroup_tree_per_node *mctz;
467467
468468 mctz = soft_limit_tree_from_page(page);
469+ if (!mctz)
470+ return;
469471 /*
470472 * Necessary to update all ancestors when hierarchy is used.
471473 * because their event counter is not touched.
@@ -503,7 +505,8 @@ static void mem_cgroup_remove_from_trees(struct mem_cgroup *memcg) · 31 unmodified lines
503505 for_each_node(nid) {
504506 mz = mem_cgroup_nodeinfo(memcg, nid);
505507 mctz = soft_limit_tree_node(nid);
506− mem_cgroup_remove_exceeded(mz, mctz);
508+ if (mctz)
509+ mem_cgroup_remove_exceeded(mz, mctz);
507510 }
508511 }
509512
@@ -2558,7 +2561,7 @@ unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order, · 2048 unmodified lines
25582561 * is empty. Do it lockless to prevent lock bouncing. Races
25592562 * are acceptable as soft limit is best effort anyway.
25602563 */
2561− if (RB_EMPTY_ROOT(&mctz->rb_root))
2564+ if (!mctz || RB_EMPTY_ROOT(&mctz->rb_root))
25622565 return 0;
25632566
25642567 /*
@@ -4135,17 +4138,22 @@ static void free_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node) · 1570 unmodified lines
41354138 kfree(memcg->nodeinfo[node]);
41364139 }
41374140
4138−static void mem_cgroup_free(struct mem_cgroup *memcg)
4141+static void __mem_cgroup_free(struct mem_cgroup *memcg)
41394142 {
41404143 int node;
41414144
4142− memcg_wb_domain_exit(memcg);
41434145 for_each_node(node)
41444146 free_mem_cgroup_per_node_info(memcg, node);
41454147 free_percpu(memcg->stat);
41464148 kfree(memcg);
41474149 }
41484150
4151+static void mem_cgroup_free(struct mem_cgroup *memcg)
4152+{
4153+ memcg_wb_domain_exit(memcg);
4154+ __mem_cgroup_free(memcg);
4155+}
4156+
41494157 static struct mem_cgroup *mem_cgroup_alloc(void)
41504158 {
41514159 struct mem_cgroup *memcg;
@@ -4196,7 +4204,7 @@ static struct mem_cgroup *mem_cgroup_alloc(void) · 44 unmodified lines
41964204 fail:
41974205 if (memcg->id.id > 0)
41984206 idr_remove(&mem_cgroup_idr, memcg->id.id);
4199− mem_cgroup_free(memcg);
4207+ __mem_cgroup_free(memcg);
42004208 return NULL;
42014209 }
42024210
mm/memory.c+196−34
@@ -445,7 +445,7 @@ static inline void free_pmd_range(struct mmu_gather *tlb, pud_t *pud, · 444 unmodified lines
445445 mm_dec_nr_pmds(tlb->mm);
446446 }
447447
448−static inline void free_pud_range(struct mmu_gather *tlb, pgd_t *pgd,
448+static inline void free_pud_range(struct mmu_gather *tlb, p4d_t *p4d,
449449 unsigned long addr, unsigned long end,
450450 unsigned long floor, unsigned long ceiling)
451451 {
@@ -454,7 +454,7 @@ static inline void free_pud_range(struct mmu_gather *tlb, pgd_t *pgd, · 2 unmodified lines
454454 unsigned long start;
455455
456456 start = addr;
457− pud = pud_offset(pgd, addr);
457+ pud = pud_offset(p4d, addr);
458458 do {
459459 next = pud_addr_end(addr, end);
460460 if (pud_none_or_clear_bad(pud))
@@ -462,6 +462,39 @@ static inline void free_pud_range(struct mmu_gather *tlb, pgd_t *pgd, · 1 unmodified line
462462 free_pmd_range(tlb, pud, addr, next, floor, ceiling);
463463 } while (pud++, addr = next, addr != end);
464464
465+ start &= P4D_MASK;
466+ if (start < floor)
467+ return;
468+ if (ceiling) {
469+ ceiling &= P4D_MASK;
470+ if (!ceiling)
471+ return;
472+ }
473+ if (end - 1 > ceiling - 1)
474+ return;
475+
476+ pud = pud_offset(p4d, start);
477+ p4d_clear(p4d);
478+ pud_free_tlb(tlb, pud, start);
479+}
480+
481+static inline void free_p4d_range(struct mmu_gather *tlb, pgd_t *pgd,
482+ unsigned long addr, unsigned long end,
483+ unsigned long floor, unsigned long ceiling)
484+{
485+ p4d_t *p4d;
486+ unsigned long next;
487+ unsigned long start;
488+
489+ start = addr;
490+ p4d = p4d_offset(pgd, addr);
491+ do {
492+ next = p4d_addr_end(addr, end);
493+ if (p4d_none_or_clear_bad(p4d))
494+ continue;
495+ free_pud_range(tlb, p4d, addr, next, floor, ceiling);
496+ } while (p4d++, addr = next, addr != end);
497+
465498 start &= PGDIR_MASK;
466499 if (start < floor)
467500 return;
@@ -473,9 +506,9 @@ static inline void free_pud_range(struct mmu_gather *tlb, pgd_t *pgd, · 5 unmodified lines
473506 if (end - 1 > ceiling - 1)
474507 return;
475508
476− pud = pud_offset(pgd, start);
509+ p4d = p4d_offset(pgd, start);
477510 pgd_clear(pgd);
478− pud_free_tlb(tlb, pud, start);
511+ p4d_free_tlb(tlb, p4d, start);
479512 }
480513
481514 /*
@@ -539,7 +572,7 @@ void free_pgd_range(struct mmu_gather *tlb, · 57 unmodified lines
539572 next = pgd_addr_end(addr, end);
540573 if (pgd_none_or_clear_bad(pgd))
541574 continue;
542− free_pud_range(tlb, pgd, addr, next, floor, ceiling);
575+ free_p4d_range(tlb, pgd, addr, next, floor, ceiling);
543576 } while (pgd++, addr = next, addr != end);
544577 }
545578
@@ -658,7 +691,8 @@ static void print_bad_pte(struct vm_area_struct *vma, unsigned long addr, · 112 unmodified lines
658691 pte_t pte, struct page *page)
659692 {
660693 pgd_t *pgd = pgd_offset(vma->vm_mm, addr);
661− pud_t *pud = pud_offset(pgd, addr);
694+ p4d_t *p4d = p4d_offset(pgd, addr);
695+ pud_t *pud = pud_offset(p4d, addr);
662696 pmd_t *pmd = pmd_offset(pud, addr);
663697 struct address_space *mapping;
664698 pgoff_t index;
@@ -1023,16 +1057,16 @@ static inline int copy_pmd_range(struct mm_struct *dst_mm, struct mm_struct *src · 358 unmodified lines
10231057 }
10241058
10251059 static inline int copy_pud_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
1026− pgd_t *dst_pgd, pgd_t *src_pgd, struct vm_area_struct *vma,
1060+ p4d_t *dst_p4d, p4d_t *src_p4d, struct vm_area_struct *vma,
10271061 unsigned long addr, unsigned long end)
10281062 {
10291063 pud_t *src_pud, *dst_pud;
10301064 unsigned long next;
10311065
1032− dst_pud = pud_alloc(dst_mm, dst_pgd, addr);
1066+ dst_pud = pud_alloc(dst_mm, dst_p4d, addr);
10331067 if (!dst_pud)
10341068 return -ENOMEM;
1035− src_pud = pud_offset(src_pgd, addr);
1069+ src_pud = pud_offset(src_p4d, addr);
10361070 do {
10371071 next = pud_addr_end(addr, end);
10381072 if (pud_trans_huge(*src_pud) || pud_devmap(*src_pud)) {
@@ -1056,6 +1090,28 @@ static inline int copy_pud_range(struct mm_struct *dst_mm, struct mm_struct *src · 17 unmodified lines
10561090 return 0;
10571091 }
10581092
1093+static inline int copy_p4d_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
1094+ pgd_t *dst_pgd, pgd_t *src_pgd, struct vm_area_struct *vma,
1095+ unsigned long addr, unsigned long end)
1096+{
1097+ p4d_t *src_p4d, *dst_p4d;
1098+ unsigned long next;
1099+
1100+ dst_p4d = p4d_alloc(dst_mm, dst_pgd, addr);
1101+ if (!dst_p4d)
1102+ return -ENOMEM;
1103+ src_p4d = p4d_offset(src_pgd, addr);
1104+ do {
1105+ next = p4d_addr_end(addr, end);
1106+ if (p4d_none_or_clear_bad(src_p4d))
1107+ continue;
1108+ if (copy_pud_range(dst_mm, src_mm, dst_p4d, src_p4d,
1109+ vma, addr, next))
1110+ return -ENOMEM;
1111+ } while (dst_p4d++, src_p4d++, addr = next, addr != end);
1112+ return 0;
1113+}
1114+
10591115 int copy_page_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
10601116 struct vm_area_struct *vma)
10611117 {
@@ -1111,7 +1167,7 @@ int copy_page_range(struct mm_struct *dst_mm, struct mm_struct *src_mm, · 49 unmodified lines
11111167 next = pgd_addr_end(addr, end);
11121168 if (pgd_none_or_clear_bad(src_pgd))
11131169 continue;
1114− if (unlikely(copy_pud_range(dst_mm, src_mm, dst_pgd, src_pgd,
1170+ if (unlikely(copy_p4d_range(dst_mm, src_mm, dst_pgd, src_pgd,
11151171 vma, addr, next))) {
11161172 ret = -ENOMEM;
11171173 break;
@@ -1267,14 +1323,14 @@ next: · 149 unmodified lines
12671323 }
12681324
12691325 static inline unsigned long zap_pud_range(struct mmu_gather *tlb,
1270− struct vm_area_struct *vma, pgd_t *pgd,
1326+ struct vm_area_struct *vma, p4d_t *p4d,
12711327 unsigned long addr, unsigned long end,
12721328 struct zap_details *details)
12731329 {
12741330 pud_t *pud;
12751331 unsigned long next;
12761332
1277− pud = pud_offset(pgd, addr);
1333+ pud = pud_offset(p4d, addr);
12781334 do {
12791335 next = pud_addr_end(addr, end);
12801336 if (pud_trans_huge(*pud) || pud_devmap(*pud)) {
@@ -1295,6 +1351,25 @@ next: · 14 unmodified lines
12951351 return addr;
12961352 }
12971353
1354+static inline unsigned long zap_p4d_range(struct mmu_gather *tlb,
1355+ struct vm_area_struct *vma, pgd_t *pgd,
1356+ unsigned long addr, unsigned long end,
1357+ struct zap_details *details)
1358+{
1359+ p4d_t *p4d;
1360+ unsigned long next;
1361+
1362+ p4d = p4d_offset(pgd, addr);
1363+ do {
1364+ next = p4d_addr_end(addr, end);
1365+ if (p4d_none_or_clear_bad(p4d))
1366+ continue;
1367+ next = zap_pud_range(tlb, vma, p4d, addr, next, details);
1368+ } while (p4d++, addr = next, addr != end);
1369+
1370+ return addr;
1371+}
1372+
12981373 void unmap_page_range(struct mmu_gather *tlb,
12991374 struct vm_area_struct *vma,
13001375 unsigned long addr, unsigned long end,
@@ -1310,7 +1385,7 @@ void unmap_page_range(struct mmu_gather *tlb, · 9 unmodified lines
13101385 next = pgd_addr_end(addr, end);
13111386 if (pgd_none_or_clear_bad(pgd))
13121387 continue;
1313− next = zap_pud_range(tlb, vma, pgd, addr, next, details);
1388+ next = zap_p4d_range(tlb, vma, pgd, addr, next, details);
13141389 } while (pgd++, addr = next, addr != end);
13151390 tlb_end_vma(tlb, vma);
13161391 }
@@ -1465,16 +1540,24 @@ EXPORT_SYMBOL_GPL(zap_vma_ptes); · 148 unmodified lines
14651540 pte_t *__get_locked_pte(struct mm_struct *mm, unsigned long addr,
14661541 spinlock_t **ptl)
14671542 {
1468− pgd_t *pgd = pgd_offset(mm, addr);
1469− pud_t *pud = pud_alloc(mm, pgd, addr);
1470− if (pud) {
1471− pmd_t *pmd = pmd_alloc(mm, pud, addr);
1472− if (pmd) {
1473− VM_BUG_ON(pmd_trans_huge(*pmd));
1474− return pte_alloc_map_lock(mm, pmd, addr, ptl);
1475− }
1476− }
1477− return NULL;
1543+ pgd_t *pgd;
1544+ p4d_t *p4d;
1545+ pud_t *pud;
1546+ pmd_t *pmd;
1547+
1548+ pgd = pgd_offset(mm, addr);
1549+ p4d = p4d_alloc(mm, pgd, addr);
1550+ if (!p4d)
1551+ return NULL;
1552+ pud = pud_alloc(mm, p4d, addr);
1553+ if (!pud)
1554+ return NULL;
1555+ pmd = pmd_alloc(mm, pud, addr);
1556+ if (!pmd)
1557+ return NULL;
1558+
1559+ VM_BUG_ON(pmd_trans_huge(*pmd));
1560+ return pte_alloc_map_lock(mm, pmd, addr, ptl);
14781561 }
14791562
14801563 /*
@@ -1740,7 +1823,7 @@ static inline int remap_pmd_range(struct mm_struct *mm, pud_t *pud, · 259 unmodified lines
17401823 return 0;
17411824 }
17421825
1743−static inline int remap_pud_range(struct mm_struct *mm, pgd_t *pgd,
1826+static inline int remap_pud_range(struct mm_struct *mm, p4d_t *p4d,
17441827 unsigned long addr, unsigned long end,
17451828 unsigned long pfn, pgprot_t prot)
17461829 {
@@ -1748,7 +1831,7 @@ static inline int remap_pud_range(struct mm_struct *mm, pgd_t *pgd, · 1 unmodified line
17481831 unsigned long next;
17491832
17501833 pfn -= addr >> PAGE_SHIFT;
1751− pud = pud_alloc(mm, pgd, addr);
1834+ pud = pud_alloc(mm, p4d, addr);
17521835 if (!pud)
17531836 return -ENOMEM;
17541837 do {
@@ -1760,6 +1843,26 @@ static inline int remap_pud_range(struct mm_struct *mm, pgd_t *pgd, · 5 unmodified lines
17601843 return 0;
17611844 }
17621845
1846+static inline int remap_p4d_range(struct mm_struct *mm, pgd_t *pgd,
1847+ unsigned long addr, unsigned long end,
1848+ unsigned long pfn, pgprot_t prot)
1849+{
1850+ p4d_t *p4d;
1851+ unsigned long next;
1852+
1853+ pfn -= addr >> PAGE_SHIFT;
1854+ p4d = p4d_alloc(mm, pgd, addr);
1855+ if (!p4d)
1856+ return -ENOMEM;
1857+ do {
1858+ next = p4d_addr_end(addr, end);
1859+ if (remap_pud_range(mm, p4d, addr, next,
1860+ pfn + (addr >> PAGE_SHIFT), prot))
1861+ return -ENOMEM;
1862+ } while (p4d++, addr = next, addr != end);
1863+ return 0;
1864+}
1865+
17631866 /**
17641867 * remap_pfn_range - remap kernel memory to userspace
17651868 * @vma: user vma to map to
@@ -1816,7 +1919,7 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr, · 50 unmodified lines
18161919 flush_cache_range(vma, addr, end);
18171920 do {
18181921 next = pgd_addr_end(addr, end);
1819− err = remap_pud_range(mm, pgd, addr, next,
1922+ err = remap_p4d_range(mm, pgd, addr, next,
18201923 pfn + (addr >> PAGE_SHIFT), prot);
18211924 if (err)
18221925 break;
@@ -1932,7 +2035,7 @@ static int apply_to_pmd_range(struct mm_struct *mm, pud_t *pud, · 109 unmodified lines
19322035 return err;
19332036 }
19342037
1935−static int apply_to_pud_range(struct mm_struct *mm, pgd_t *pgd,
2038+static int apply_to_pud_range(struct mm_struct *mm, p4d_t *p4d,
19362039 unsigned long addr, unsigned long end,
19372040 pte_fn_t fn, void *data)
19382041 {
@@ -1940,7 +2043,7 @@ static int apply_to_pud_range(struct mm_struct *mm, pgd_t *pgd, · 1 unmodified line
19402043 unsigned long next;
19412044 int err;
19422045
1943− pud = pud_alloc(mm, pgd, addr);
2046+ pud = pud_alloc(mm, p4d, addr);
19442047 if (!pud)
19452048 return -ENOMEM;
19462049 do {
@@ -1952,6 +2055,26 @@ static int apply_to_pud_range(struct mm_struct *mm, pgd_t *pgd, · 5 unmodified lines
19522055 return err;
19532056 }
19542057
2058+static int apply_to_p4d_range(struct mm_struct *mm, pgd_t *pgd,
2059+ unsigned long addr, unsigned long end,
2060+ pte_fn_t fn, void *data)
2061+{
2062+ p4d_t *p4d;
2063+ unsigned long next;
2064+ int err;
2065+
2066+ p4d = p4d_alloc(mm, pgd, addr);
2067+ if (!p4d)
2068+ return -ENOMEM;
2069+ do {
2070+ next = p4d_addr_end(addr, end);
2071+ err = apply_to_pud_range(mm, p4d, addr, next, fn, data);
2072+ if (err)
2073+ break;
2074+ } while (p4d++, addr = next, addr != end);
2075+ return err;
2076+}
2077+
19552078 /*
19562079 * Scan a region of virtual memory, filling in page tables as necessary
19572080 * and calling a provided function on each leaf page table.
@@ -1970,7 +2093,7 @@ int apply_to_page_range(struct mm_struct *mm, unsigned long addr, · 12 unmodified lines
19702093 pgd = pgd_offset(mm, addr);
19712094 do {
19722095 next = pgd_addr_end(addr, end);
1973− err = apply_to_pud_range(mm, pgd, addr, next, fn, data);
2096+ err = apply_to_p4d_range(mm, pgd, addr, next, fn, data);
19742097 if (err)
19752098 break;
19762099 } while (pgd++, addr = next, addr != end);
@@ -3653,11 +3776,15 @@ static int __handle_mm_fault(struct vm_area_struct *vma, unsigned long address, · 1676 unmodified lines
36533776 };
36543777 struct mm_struct *mm = vma->vm_mm;
36553778 pgd_t *pgd;
3779+ p4d_t *p4d;
36563780 int ret;
36573781
36583782 pgd = pgd_offset(mm, address);
3783+ p4d = p4d_alloc(mm, pgd, address);
3784+ if (!p4d)
3785+ return VM_FAULT_OOM;
36593786
3660− vmf.pud = pud_alloc(mm, pgd, address);
3787+ vmf.pud = pud_alloc(mm, p4d, address);
36613788 if (!vmf.pud)
36623789 return VM_FAULT_OOM;
36633790 if (pud_none(*vmf.pud) && transparent_hugepage_enabled(vma)) {
@@ -3779,12 +3906,35 @@ int handle_mm_fault(struct vm_area_struct *vma, unsigned long address, · 115 unmodified lines
37793906 }
37803907 EXPORT_SYMBOL_GPL(handle_mm_fault);
37813908
3909+#ifndef __PAGETABLE_P4D_FOLDED
3910+/*
3911+ * Allocate p4d page table.
3912+ * We've already handled the fast-path in-line.
3913+ */
3914+int __p4d_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
3915+{
3916+ p4d_t *new = p4d_alloc_one(mm, address);
3917+ if (!new)
3918+ return -ENOMEM;
3919+
3920+ smp_wmb(); /* See comment in __pte_alloc */
3921+
3922+ spin_lock(&mm->page_table_lock);
3923+ if (pgd_present(*pgd)) /* Another has populated it */
3924+ p4d_free(mm, new);
3925+ else
3926+ pgd_populate(mm, pgd, new);
3927+ spin_unlock(&mm->page_table_lock);
3928+ return 0;
3929+}
3930+#endif /* __PAGETABLE_P4D_FOLDED */
3931+
37823932 #ifndef __PAGETABLE_PUD_FOLDED
37833933 /*
37843934 * Allocate page upper directory.
37853935 * We've already handled the fast-path in-line.
37863936 */
3787−int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
3937+int __pud_alloc(struct mm_struct *mm, p4d_t *p4d, unsigned long address)
37883938 {
37893939 pud_t *new = pud_alloc_one(mm, address);
37903940 if (!new)
@@ -3793,10 +3943,17 @@ int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address) · 2 unmodified lines
37933943 smp_wmb(); /* See comment in __pte_alloc */
37943944
37953945 spin_lock(&mm->page_table_lock);
3796− if (pgd_present(*pgd)) /* Another has populated it */
3946+#ifndef __ARCH_HAS_5LEVEL_HACK
3947+ if (p4d_present(*p4d)) /* Another has populated it */
37973948 pud_free(mm, new);
37983949 else
3799− pgd_populate(mm, pgd, new);
3950+ p4d_populate(mm, p4d, new);
3951+#else
3952+ if (pgd_present(*p4d)) /* Another has populated it */
3953+ pud_free(mm, new);
3954+ else
3955+ pgd_populate(mm, p4d, new);
3956+#endif /* __ARCH_HAS_5LEVEL_HACK */
38003957 spin_unlock(&mm->page_table_lock);
38013958 return 0;
38023959 }
@@ -3839,6 +3996,7 @@ static int __follow_pte_pmd(struct mm_struct *mm, unsigned long address, · 36 unmodified lines
38393996 pte_t **ptepp, pmd_t **pmdpp, spinlock_t **ptlp)
38403997 {
38413998 pgd_t *pgd;
3999+ p4d_t *p4d;
38424000 pud_t *pud;
38434001 pmd_t *pmd;
38444002 pte_t *ptep;
@@ -3847,7 +4005,11 @@ static int __follow_pte_pmd(struct mm_struct *mm, unsigned long address, · 2 unmodified lines
38474005 if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
38484006 goto out;
38494007
3850− pud = pud_offset(pgd, address);
4008+ p4d = p4d_offset(pgd, address);
4009+ if (p4d_none(*p4d) || unlikely(p4d_bad(*p4d)))
4010+ goto out;
4011+

4 more lines aren’t shown here.

mm/mlock.c+5−5

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

mm/mprotect.c+23−3

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

mm/mremap.c+11−2

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

mm/page_alloc.c+2−1

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

mm/page_vma_mapped.c+5−1

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

mm/pagewalk.c+29−3

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

mm/percpu-vm.c+3−4

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

mm/percpu.c+4−1

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

mm/pgtable-generic.c+6−0

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

mm/rmap.c+13−7

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

mm/sparse-vmemmap.c+19−3

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

mm/swapfile.c+23−3

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

mm/userfaultfd.c+13−10

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

mm/vmalloc.c+60−21

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

mm/vmstat.c+3−0

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

net/atm/svc.c+3−2

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

net/ax25/af_ax25.c+2−1

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

net/bluetooth/l2cap_sock.c+1−1

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

net/bluetooth/rfcomm/sock.c+2−1

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

net/bluetooth/sco.c+1−1

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

net/bridge/br_input.c+1−0

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

net/bridge/br_netfilter_hooks.c+0−21

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

net/ceph/ceph_common.c+15−0

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

net/ceph/osd_client.c+35−1

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

net/ceph/osdmap.c+1−3

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

net/core/dev.c+1−0

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

net/core/net-sysfs.c+3−3

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

net/core/skbuff.c+16−14

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

net/core/sock.c+57−49

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

net/dccp/ccids/ccid2.c+1−0

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

net/dccp/ipv4.c+2−1

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

net/dccp/ipv6.c+5−3

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

net/dccp/minisocks.c+16−8

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

net/decnet/af_decnet.c+3−2

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

net/ipv4/af_inet.c+6−3

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

net/ipv4/inet_connection_sock.c+1−1

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

net/ipv4/ip_output.c+1−1

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

net/ipv4/tcp_ipv4.c+7−3

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

net/ipv4/tcp_timer.c+4−2

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

net/ipv6/af_inet6.c+5−5

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

net/ipv6/ip6_fib.c+2−0

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

net/ipv6/ip6_offload.c+3−1

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

net/ipv6/ip6_output.c+7−2

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

net/ipv6/ip6_vti.c+6−2

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

net/ipv6/route.c+6−5

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

net/ipv6/tcp_ipv6.c+5−3

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

net/irda/af_irda.c+3−2

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

net/iucv/af_iucv.c+1−1

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

net/llc/af_llc.c+3−1

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

net/mpls/af_mpls.c+3−1

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

net/netrom/af_netrom.c+2−1

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

net/nfc/llcp_sock.c+1−1

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

net/phonet/pep.c+4−2

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

net/phonet/socket.c+2−2

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

net/rds/connection.c+1−0

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

net/rds/ib_cm.c+36−11

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

net/rds/rds.h+3−3

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

net/rds/tcp.c+21−17

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

net/rds/tcp.h+1−1

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

net/rds/tcp_listen.c+8−3

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

net/rose/af_rose.c+2−1

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

net/rxrpc/input.c+19−8

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

net/rxrpc/recvmsg.c+2−2

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

net/rxrpc/sendmsg.c+31−18

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

net/sched/act_connmark.c+3−0

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

net/sched/act_skbmod.c+0−1

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

net/sctp/ipv6.c+3−2

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

net/sctp/protocol.c+3−2

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

net/sctp/socket.c+2−2

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

net/smc/af_smc.c+1−1

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

net/socket.c+3−2

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

net/tipc/socket.c+5−3

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

net/unix/af_unix.c+3−2

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

net/vmw_vsock/af_vsock.c+2−1

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

net/x25/af_x25.c+2−1

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

net/xfrm/xfrm_policy.c+9−10

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

scripts/gcc-plugins/sancov_plugin.c+1−1

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

scripts/module-common.lds+2−0

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

scripts/spelling.txt+3−0

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

sound/soc/amd/acp-pcm-dma.c+1−1

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

tools/include/uapi/linux/bpf_perf_event.h+18−0

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

tools/lguest/lguest.c+1−1

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

tools/lib/bpf/Makefile+1−1

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

tools/lib/traceevent/Makefile+1−1

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

tools/lib/traceevent/event-parse.h+1−1

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

tools/objtool/builtin-check.c+12−3

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

tools/objtool/elf.c+12−0

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

tools/objtool/elf.h+1−0

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

tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c+1−1

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

tools/testing/ktest/ktest.pl+13−8

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

tools/testing/radix-tree/Makefile+9−6

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

tools/testing/radix-tree/benchmark.c+166−7

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

tools/testing/radix-tree/idr-test.c+75−3

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

tools/testing/radix-tree/main.c+1−0

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

tools/testing/radix-tree/tag_check.c+29−0

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

tools/testing/radix-tree/test.h+1−0

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

tools/testing/selftests/bpf/Makefile+3−1

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

tools/testing/selftests/bpf/test_verifier.c+4−0

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

tools/testing/selftests/powerpc/harness.c+4−2

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

tools/testing/selftests/powerpc/include/vsx_asm.h+24−24

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

tools/testing/selftests/vm/Makefile+4−0

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

tools/testing/selftests/x86/fsgsbase.c+1−1

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

tools/testing/selftests/x86/ldt_gdt.c+11−5

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

tools/testing/selftests/x86/ptrace_syscall.c+2−1

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

tools/testing/selftests/x86/single_step_syscall.c+4−1

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

virt/kvm/arm/vgic/vgic-its.c+65−44

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

virt/kvm/arm/vgic/vgic-mmio.c+24−8

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

virt/kvm/arm/vgic/vgic-v3.c+4−1

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