History

Merge branch 'jejb-scsi' into misc

James Bottomley committed 10 years ago

Commit abaee092 parents a2746fb 3f8d6f2822 files · +11490 −5873Browse files

Unified · Split

822 files
  1. Documentation/IPMI.txt +5 −2
  2. Documentation/arm/keystone/Overview.txt +0 −18
  3. Documentation/block/null_blk.txt +3 −0
  4. Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt +6 −0
  5. Documentation/devicetree/bindings/thermal/rockchip-thermal.txt +3 −1
  6. Documentation/i2c/busses/i2c-i801 +1 −0
  7. Documentation/kernel-parameters.txt +0 −3
  8. MAINTAINERS +27 −10
  9. Makefile +1 −1
  10. arch/arc/configs/axs101_defconfig +1 −1
  11. arch/arc/configs/axs103_defconfig +1 −1
  12. arch/arc/configs/axs103_smp_defconfig +1 −1
  13. arch/arc/configs/nsim_hs_defconfig +1 −1
  14. arch/arc/configs/nsim_hs_smp_defconfig +1 −1
  15. arch/arc/configs/nsimosci_hs_defconfig +1 −1
  16. arch/arc/configs/nsimosci_hs_smp_defconfig +1 −1
  17. arch/arc/configs/vdk_hs38_defconfig +1 −1
  18. arch/arc/configs/vdk_hs38_smp_defconfig +1 −1
  19. arch/arc/include/asm/irqflags-arcv2.h +3 −0
  20. arch/arc/include/asm/irqflags-compact.h +2 −0
  21. arch/arc/kernel/ctx_sw.c +0 −2
  22. arch/arc/kernel/ctx_sw_asm.S +0 −3
  23. arch/arc/kernel/process.c +4 −5
  24. arch/arc/kernel/unwind.c +4 −33
  25. arch/arc/mm/tlb.c +2 −2
  26. arch/arm/Kconfig +2 −2
  27. arch/arm/boot/dts/am57xx-beagle-x15.dts +1 −0
  28. arch/arm/boot/dts/animeo_ip.dts +3 −3
  29. arch/arm/boot/dts/armada-38x.dtsi +1 −0
  30. arch/arm/boot/dts/at91-foxg20.dts +1 −1
  31. arch/arm/boot/dts/at91-kizbox.dts +2 −11
  32. arch/arm/boot/dts/at91-kizbox2.dts +3 −3
  33. arch/arm/boot/dts/at91-kizboxmini.dts +2 −2
  34. arch/arm/boot/dts/at91-qil_a9260.dts +1 −1
  35. arch/arm/boot/dts/at91-sama5d2_xplained.dts +106 −9
  36. arch/arm/boot/dts/at91-sama5d3_xplained.dts +1 −1
  37. arch/arm/boot/dts/at91-sama5d4_xplained.dts +1 −11
  38. arch/arm/boot/dts/at91-sama5d4ek.dts +1 −11
  39. arch/arm/boot/dts/at91rm9200ek.dts +0 −9
  40. arch/arm/boot/dts/at91sam9261ek.dts +5 −14
  41. arch/arm/boot/dts/at91sam9263ek.dts +2 −11
  42. arch/arm/boot/dts/at91sam9g20ek_common.dtsi +2 −11
  43. arch/arm/boot/dts/at91sam9m10g45ek.dts +2 −11
  44. arch/arm/boot/dts/at91sam9n12ek.dts +1 −10
  45. arch/arm/boot/dts/at91sam9rlek.dts +2 −11
  46. arch/arm/boot/dts/at91sam9x5cm.dtsi +0 −11
  47. arch/arm/boot/dts/dra7.dtsi +2 −2
  48. arch/arm/boot/dts/imx27.dtsi +12 −4
  49. arch/arm/boot/dts/k2l-netcp.dtsi +1 −1
  50. arch/arm/boot/dts/kirkwood-ts219.dtsi +1 −1
  51. arch/arm/boot/dts/rk3288-veyron-minnie.dts +4 −0
  52. arch/arm/boot/dts/rk3288.dtsi +8 −2
  53. arch/arm/boot/dts/sama5d35ek.dts +1 −1
  54. arch/arm/boot/dts/sama5d4.dtsi +1 −1
  55. arch/arm/boot/dts/usb_a9260_common.dtsi +1 −1
  56. arch/arm/boot/dts/usb_a9263.dts +1 −1
  57. arch/arm/boot/dts/vfxxx.dtsi +4 −4
  58. arch/arm/configs/at91_dt_defconfig +0 −1
  59. arch/arm/configs/sama5_defconfig +0 −1
  60. arch/arm/include/asm/irq.h +5 −0
  61. arch/arm/include/asm/kvm_emulate.h +12 −0
  62. arch/arm/include/uapi/asm/unistd.h +1 −0
  63. arch/arm/kernel/bios32.c +11 −8
  64. arch/arm/kernel/calls.S +1 −0
  65. arch/arm/kvm/arm.c +1 −6
  66. arch/arm/kvm/mmio.c +3 −2
  67. arch/arm/kvm/mmu.c +7 −8
  68. arch/arm/kvm/psci.c +10 −10
  69. arch/arm/mach-dove/include/mach/entry-macro.S +2 −2
  70. arch/arm/mach-imx/gpc.c +1 −0
  71. arch/arm/mach-omap2/omap-smp.c +3 −3
  72. arch/arm/mach-omap2/omap_hwmod.c +36 −30
  73. arch/arm/mach-omap2/omap_hwmod.h +3 −0
  74. arch/arm/mach-omap2/omap_hwmod_7xx_data.c +56 −0
  75. arch/arm/mach-omap2/omap_hwmod_81xx_data.c +3 −0
  76. arch/arm/mach-omap2/pdata-quirks.c +0 −29
  77. arch/arm/mach-omap2/pm34xx.c +2 −2
  78. arch/arm/mach-orion5x/include/mach/entry-macro.S +1 −1
  79. arch/arm/mach-pxa/palm27x.c +1 −1
  80. arch/arm/mach-pxa/palmtc.c +1 −1
  81. arch/arm/mach-shmobile/setup-r8a7793.c +1 −1
  82. arch/arm/mach-zx/Kconfig +1 −1
  83. arch/arm64/Kconfig +22 −1
  84. arch/arm64/crypto/aes-ce-cipher.c +1 −1
  85. arch/arm64/include/asm/barrier.h +10 −6
  86. arch/arm64/include/asm/compat.h +1 −2
  87. arch/arm64/include/asm/cpufeature.h +22 −3
  88. arch/arm64/include/asm/dma-mapping.h +3 −10
  89. arch/arm64/include/asm/hw_breakpoint.h +4 −2
  90. arch/arm64/include/asm/irq.h +5 −0
  91. arch/arm64/include/asm/kvm_emulate.h +14 −4
  92. arch/arm64/include/asm/mmu_context.h +1 −1
  93. arch/arm64/include/asm/pgtable.h +1 −0
  94. arch/arm64/kernel/cpu_errata.c +9 −0
  95. arch/arm64/kernel/cpufeature.c +23 −14
  96. arch/arm64/kernel/cpuinfo.c +5 −0
  97. arch/arm64/kernel/efi.c +24 −21
  98. arch/arm64/kernel/suspend.c +10 −0
  99. arch/arm64/kvm/handle_exit.c +1 −1
  100. arch/arm64/kvm/hyp.S +12 −2
  101. arch/arm64/kvm/inject_fault.c +1 −1
  102. arch/arm64/kvm/sys_regs.c +60 −63
  103. arch/arm64/kvm/sys_regs.h +4 −4
  104. arch/arm64/kvm/sys_regs_generic_v8.c +2 −2
  105. arch/arm64/mm/context.c +26 −12
  106. arch/arm64/mm/dma-mapping.c +17 −18
  107. arch/arm64/mm/fault.c +14 −14
  108. arch/arm64/mm/mmu.c +21 −70
  109. arch/arm64/net/bpf_jit_comp.c +32 −15
  110. arch/m68k/coldfire/m54xx.c +1 −1
  111. arch/m68k/include/asm/unistd.h +1 −1
  112. arch/m68k/include/uapi/asm/unistd.h +1 −0
  113. arch/m68k/kernel/setup_no.c +6 −3
  114. arch/m68k/kernel/syscalltable.S +1 −0
  115. arch/m68k/mm/motorola.c +1 −1
  116. arch/m68k/sun3/config.c +2 −2
  117. arch/mips/ath79/setup.c +6 −1
  118. arch/mips/boot/dts/qca/ar9132.dtsi +1 −1
  119. arch/mips/include/asm/page.h +2 −1
  120. arch/mips/kvm/emulate.c +1 −1
  121. arch/mips/kvm/locore.S +10 −6
  122. arch/mips/kvm/mips.c +4 −1
  123. arch/mips/pci/pci-rt2880.c +2 −2
  124. arch/mips/pmcs-msp71xx/msp_setup.c +3 −1
  125. arch/mips/sni/reset.c +4 −2
  126. arch/mn10300/Kconfig +1 −3
  127. arch/nios2/mm/cacheflush.c +4 −20
  128. arch/parisc/Kconfig +3 −0
  129. arch/parisc/include/asm/hugetlb.h +85 −0
  130. arch/parisc/include/asm/page.h +12 −1
  131. arch/parisc/include/asm/pgalloc.h +1 −1
  132. arch/parisc/include/asm/pgtable.h +22 −4
  133. arch/parisc/include/asm/processor.h +0 −27
  134. arch/parisc/include/uapi/asm/mman.h +0 −10
  135. arch/parisc/kernel/asm-offsets.c +8 −0
  136. arch/parisc/kernel/entry.S +34 −22
  137. arch/parisc/kernel/head.S +2 −2
  138. arch/parisc/kernel/setup.c +13 −1
  139. arch/parisc/kernel/syscall.S +2 −2
  140. arch/parisc/kernel/traps.c +15 −20
  141. arch/parisc/kernel/vmlinux.lds.S +6 −3
  142. arch/parisc/mm/Makefile +1 −0
  143. arch/parisc/mm/hugetlbpage.c +161 −0
  144. arch/parisc/mm/init.c +17 −23
  145. arch/powerpc/include/asm/reg.h +1 −0
  146. arch/powerpc/include/asm/systbl.h +1 −0
  147. arch/powerpc/include/asm/unistd.h +1 −1
  148. arch/powerpc/include/uapi/asm/unistd.h +1 −0
  149. arch/powerpc/kernel/process.c +18 −0
  150. arch/powerpc/kernel/signal_32.c +9 −5
  151. arch/powerpc/kernel/signal_64.c +4 −0
  152. arch/s390/include/asm/cio.h +1 −0
  153. arch/s390/include/asm/elf.h +10 −3
  154. arch/s390/include/asm/ipl.h +2 −1
  155. arch/s390/include/asm/pci_dma.h +3 −1
  156. arch/s390/include/asm/trace/diag.h +3 −3
  157. arch/s390/include/uapi/asm/unistd.h +10 −9
  158. arch/s390/kernel/compat_wrapper.c +1 −0
  159. arch/s390/kernel/diag.c +2 −2
  160. arch/s390/kernel/head.S +12 −83
  161. arch/s390/kernel/ipl.c +42 −23
  162. arch/s390/kernel/process.c +1 −5
  163. arch/s390/kernel/sclp.c +1 −1
  164. arch/s390/kernel/setup.c +0 −3
  165. arch/s390/kernel/syscalls.S +1 −0
  166. arch/s390/kernel/trace.c +3 −3
  167. arch/s390/kvm/interrupt.c +5 −2
  168. arch/s390/kvm/kvm-s390.c +5 −1
  169. arch/s390/kvm/priv.c +1 −1
  170. arch/s390/kvm/sigp.c +2 −6
  171. arch/s390/mm/init.c +3 −27
  172. arch/s390/mm/mmap.c +9 −51
  173. arch/s390/pci/pci_dma.c +56 −28
  174. arch/x86/boot/boot.h +0 −1
  175. arch/x86/boot/video-mode.c +2 −0
  176. arch/x86/boot/video.c +2 −0
  177. arch/x86/entry/entry_64.S +18 −1
  178. arch/x86/include/asm/msr-index.h +1 −2
  179. arch/x86/include/asm/page_types.h +9 −7
  180. arch/x86/include/asm/pgtable_types.h +4 −10
  181. arch/x86/include/asm/x86_init.h +0 −1
  182. arch/x86/kernel/cpu/common.c +1 −2
  183. arch/x86/kernel/cpu/microcode/core.c +1 −0
  184. arch/x86/kernel/fpu/signal.c +5 −6
  185. arch/x86/kernel/fpu/xstate.c +0 −1
  186. arch/x86/kernel/mcount_64.S +6 −0
  187. arch/x86/kernel/pmem.c +12 −0
  188. arch/x86/kernel/setup.c +0 −2
  189. arch/x86/kernel/signal.c +10 −7
  190. arch/x86/kernel/smpboot.c +5 −4
  191. arch/x86/kvm/vmx.c +0 −5
  192. arch/x86/kvm/x86.c +32 −29
  193. arch/x86/mm/mpx.c +44 −9
  194. arch/x86/pci/bus_numa.c +2 −11
  195. block/blk-core.c +7 −14
  196. block/blk-merge.c +30 −5
  197. block/blk-mq.c +9 −5
  198. block/blk-settings.c +16 −20
  199. block/blk-sysfs.c +3 −0
  200. block/blk-timeout.c +5 −3
  201. block/blk.h +0 −2
  202. block/noop-iosched.c +5 −5
  203. block/partition-generic.c +1 −1
  204. block/partitions/mac.c +7 −3
  205. crypto/algif_aead.c +2 −2
  206. crypto/algif_skcipher.c +3 −3
  207. drivers/Makefile +1 −1
  208. drivers/acpi/Kconfig +2 −2
  209. drivers/acpi/cppc_acpi.c +1 −1
  210. drivers/acpi/ec.c +1 −1
  211. drivers/acpi/nfit.c +47 −18
  212. drivers/acpi/nfit.h +2 −1
  213. drivers/acpi/pci_root.c +7 −0
  214. drivers/acpi/sbshc.c +7 −41
  215. drivers/base/power/domain.c +1 −2
  216. drivers/base/power/domain_governor.c +0 −3
  217. drivers/base/power/wakeirq.c +6 −0
  218. drivers/block/mtip32xx/mtip32xx.c +2 −4
  219. drivers/block/null_blk.c +231 −70
  220. drivers/block/rbd.c +1 −0
  221. drivers/bus/omap-ocp2scp.c +1 −1
  222. drivers/char/ipmi/ipmi_si_intf.c +52 −30
  223. drivers/char/ipmi/ipmi_watchdog.c +7 −1
  224. drivers/clocksource/Kconfig +1 −0
  225. drivers/clocksource/fsl_ftm_timer.c +2 −2
  226. drivers/cpufreq/Kconfig.arm +2 −1
  227. drivers/cpufreq/Kconfig.x86 +0 −1
  228. drivers/cpufreq/cppc_cpufreq.c +2 −1
  229. drivers/cpufreq/cpufreq.c +12 −9
  230. drivers/cpufreq/intel_pstate.c +77 −245
  231. drivers/crypto/nx/nx-aes-ccm.c +1 −1
  232. drivers/crypto/nx/nx-aes-gcm.c +2 −1
  233. drivers/crypto/talitos.c +1 −1
  234. drivers/dma/at_hdmac.c +10 −10
  235. drivers/dma/at_hdmac_regs.h +3 −3
  236. drivers/dma/at_xdmac.c +10 −10
  237. drivers/dma/edma.c +2 −2
  238. drivers/dma/imx-sdma.c +1 −1
  239. drivers/dma/sh/usb-dmac.c +8 −3
  240. drivers/gpio/gpio-74xx-mmio.c +5 −2
  241. drivers/gpio/gpio-omap.c +0 −2
  242. drivers/gpio/gpio-palmas.c +2 −0
  243. drivers/gpio/gpio-syscon.c +5 −1
  244. drivers/gpio/gpio-tegra.c +56 −49
  245. drivers/gpio/gpiolib.c +1 −1
  246. drivers/gpu/drm/amd/amdgpu/amdgpu.h +62 −64
  247. drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +75 −110
  248. drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +79 −29
  249. drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +54 −47
  250. drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +26 −17
  251. drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +2 −2
  252. drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +47 −1
  253. drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +5 −0
  254. drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 −0
  255. drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +3 −4
  256. drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c +1 −2
  257. drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c +12 −18
  258. drivers/gpu/drm/amd/amdgpu/amdgpu_semaphore.c +1 −1
  259. drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +8 −2
  260. drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +51 −43
  261. drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +14 −9
  262. drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +10 −1
  263. drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +103 −69
  264. drivers/gpu/drm/amd/amdgpu/ci_dpm.c +4 −4
  265. drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +4 −1
  266. drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +4 −1
  267. drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +4 −1
  268. drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +295 −7
  269. drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +5 −8
  270. drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +4 −7
  271. drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +19 −5
  272. drivers/gpu/drm/amd/scheduler/gpu_sched_trace.h +21 −3
  273. drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +99 −52
  274. drivers/gpu/drm/amd/scheduler/gpu_scheduler.h +8 −3
  275. drivers/gpu/drm/amd/scheduler/sched_fence.c +21 −2
  276. drivers/gpu/drm/drm_atomic.c +42 −19
  277. drivers/gpu/drm/drm_atomic_helper.c +20 −9
  278. drivers/gpu/drm/drm_drv.c +5 −0
  279. drivers/gpu/drm/drm_fb_helper.c +14 −37
  280. drivers/gpu/drm/drm_fops.c +56 −28
  281. drivers/gpu/drm/drm_irq.c +53 −1
  282. drivers/gpu/drm/i915/i915_debugfs.c +2 −0
  283. drivers/gpu/drm/i915/i915_drv.h +5 −0
  284. drivers/gpu/drm/i915/i915_gem.c +17 −3
  285. drivers/gpu/drm/i915/i915_gem_fence.c +27 −9
  286. drivers/gpu/drm/i915/i915_params.c +5 −0
  287. drivers/gpu/drm/i915/intel_crt.c +4 −27
  288. drivers/gpu/drm/i915/intel_ddi.c +65 −10
  289. drivers/gpu/drm/i915/intel_display.c +78 −12
  290. drivers/gpu/drm/i915/intel_dp.c +16 −35
  291. drivers/gpu/drm/i915/intel_drv.h +2 −2
  292. drivers/gpu/drm/i915/intel_hdmi.c +6 −6
  293. drivers/gpu/drm/i915/intel_i2c.c +4 −2
  294. drivers/gpu/drm/i915/intel_pm.c +6 −4
  295. drivers/gpu/drm/i915/intel_runtime_pm.c +4 −30
  296. drivers/gpu/drm/imx/imx-drm-core.c +3 −4
  297. drivers/gpu/drm/imx/imx-drm.h +2 −1
  298. drivers/gpu/drm/imx/imx-tve.c +1 −0
  299. drivers/gpu/drm/imx/ipuv3-crtc.c +17 −46
  300. drivers/gpu/drm/imx/ipuv3-plane.c +4 −5
  301. drivers/gpu/drm/imx/ipuv3-plane.h +1 −1
  302. drivers/gpu/drm/imx/parallel-display.c +4 −0
  303. drivers/gpu/drm/mgag200/mgag200_cursor.c +5 −6
  304. drivers/gpu/drm/nouveau/include/nvkm/subdev/instmem.h +1 −0
  305. drivers/gpu/drm/nouveau/nouveau_acpi.c +1 −0
  306. drivers/gpu/drm/nouveau/nouveau_display.c +11 −8
  307. drivers/gpu/drm/nouveau/nouveau_drm.h +3 −1
  308. drivers/gpu/drm/nouveau/nouveau_usif.c +4 −1
  309. drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c +14 −2
  310. drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf117.c +2 −0
  311. drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpc.fuc +5 −3
  312. drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf117.fuc3.h +172 −172
  313. drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk104.fuc3.h +172 −172
  314. drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk110.fuc3.h +172 −172
  315. drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk208.fuc5.h +154 −154
  316. drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgm107.fuc5.h +237 −237
  317. drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c +4 −2
  318. drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h +1 −0
  319. drivers/gpu/drm/nouveau/nvkm/subdev/instmem/base.c +5 −0
  320. drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk104.c +1 −1
  321. drivers/gpu/drm/radeon/cik.c +4 −1
  322. drivers/gpu/drm/radeon/evergreen.c +4 −1
  323. drivers/gpu/drm/radeon/r100.c +11 −1
  324. drivers/gpu/drm/radeon/r600.c +1 −1
  325. drivers/gpu/drm/radeon/radeon.h +1 −1
  326. drivers/gpu/drm/radeon/radeon_agp.c +3 −0
  327. drivers/gpu/drm/radeon/radeon_connectors.c +20 −1
  328. drivers/gpu/drm/radeon/radeon_display.c +79 −27
  329. drivers/gpu/drm/radeon/radeon_irq_kms.c +4 −4
  330. drivers/gpu/drm/radeon/radeon_kms.c +49 −1
  331. drivers/gpu/drm/radeon/radeon_mode.h +5 −0
  332. drivers/gpu/drm/radeon/radeon_object.c +11 −4
  333. drivers/gpu/drm/radeon/radeon_pm.c +4 −3
  334. drivers/gpu/drm/radeon/rs600.c +1 −1
  335. drivers/gpu/drm/radeon/rs690.c +10 −0
  336. drivers/gpu/drm/radeon/rv730_dpm.c +1 −1
  337. drivers/gpu/drm/radeon/rv770_dpm.c +2 −2
  338. drivers/gpu/drm/radeon/si.c +4 −1
  339. drivers/gpu/drm/radeon/si_dpm.c +1 −1
  340. drivers/gpu/drm/rockchip/rockchip_drm_gem.c +1 −0
  341. drivers/gpu/drm/rockchip/rockchip_drm_vop.c +18 −25
  342. drivers/gpu/drm/vc4/vc4_crtc.c +5 −4
  343. drivers/gpu/drm/vc4/vc4_drv.c +0 −1
  344. drivers/gpu/drm/vc4/vc4_hvs.c +4 −4
  345. drivers/gpu/drm/vc4/vc4_plane.c +14 −4
  346. drivers/gpu/drm/virtio/virtgpu_display.c +1 −1
  347. drivers/gpu/ipu-v3/ipu-common.c +38 −31
  348. drivers/hid/hid-ids.h +1 −0
  349. drivers/hid/hid-lg.c +3 −2
  350. drivers/hid/usbhid/hid-quirks.c +1 −0
  351. drivers/hid/wacom_wac.c +3 −2
  352. drivers/hwmon/Kconfig +2 −0
  353. drivers/hwmon/applesmc.c +1 −1
  354. drivers/hwmon/scpi-hwmon.c +11 −10
  355. drivers/i2c/busses/Kconfig +1 −0
  356. drivers/i2c/busses/i2c-i801.c +6 −0
  357. drivers/i2c/busses/i2c-imx.c +1 −0
  358. drivers/i2c/busses/i2c-xiic.c +3 −1
  359. drivers/i2c/i2c-core.c +1 −1
  360. drivers/iio/adc/ad7793.c +1 −1
  361. drivers/iio/adc/vf610_adc.c +16 −6
  362. drivers/iio/adc/xilinx-xadc-core.c +1 −0
  363. drivers/iio/dac/ad5064.c +64 −27
  364. drivers/iio/humidity/si7020.c +4 −4
  365. drivers/iommu/s390-iommu.c +21 −2
  366. drivers/irqchip/irq-gic-common.c +9 −4
  367. drivers/irqchip/irq-gic.c +36 −2
  368. drivers/isdn/hisax/config.c +1 −1
  369. drivers/isdn/hisax/hfc_pci.c +1 −1
  370. drivers/isdn/hisax/hfc_sx.c +1 −1
  371. drivers/isdn/hisax/q931.c +3 −3
  372. drivers/lightnvm/core.c +79 −60
  373. drivers/lightnvm/gennvm.c +62 −25
  374. drivers/lightnvm/gennvm.h +2 −0
  375. drivers/lightnvm/rrpc.c +31 −1
  376. drivers/md/dm-crypt.c +13 −9
  377. drivers/md/dm-mpath.c +16 −14
  378. drivers/md/dm-thin.c +3 −3
  379. drivers/md/dm.c +4 −3
  380. drivers/media/pci/cx23885/cx23885-core.c +2 −2
  381. drivers/media/pci/cx25821/cx25821-core.c +2 −1
  382. drivers/media/pci/cx88/cx88-alsa.c +2 −2
  383. drivers/media/pci/cx88/cx88-mpeg.c +2 −1
  384. drivers/media/pci/cx88/cx88-video.c +2 −2
  385. drivers/media/pci/netup_unidvb/netup_unidvb_core.c +1 −1
  386. drivers/media/pci/saa7134/saa7134-core.c +2 −2
  387. drivers/media/pci/saa7164/saa7164-core.c +2 −2
  388. drivers/media/pci/tw68/tw68-core.c +2 −2
  389. drivers/mmc/card/block.c +3 −8
  390. drivers/mmc/core/mmc.c +69 −24
  391. drivers/mmc/host/Kconfig +1 −0
  392. drivers/mmc/host/mtk-sd.c +1 −1
  393. drivers/mmc/host/pxamci.c +1 −1
  394. drivers/mtd/nand/jz4740_nand.c +1 −0
  395. drivers/mtd/nand/nand_base.c +1 −1
  396. drivers/net/can/bfin_can.c +0 −2
  397. drivers/net/can/c_can/c_can.c +2 −5
  398. drivers/net/can/cc770/cc770.c +1 −1
  399. drivers/net/can/flexcan.c +2 −2
  400. drivers/net/can/janz-ican3.c +0 −1
  401. drivers/net/can/m_can/m_can.c +2 −5
  402. drivers/net/can/pch_can.c +1 −2
  403. drivers/net/can/rcar_can.c +5 −6
  404. drivers/net/can/sja1000/sja1000.c +3 −1
  405. drivers/net/can/sun4i_can.c +0 −1
  406. drivers/net/can/ti_hecc.c +2 −5
  407. drivers/net/can/usb/ems_usb.c +0 −1
  408. drivers/net/can/usb/esd_usb2.c +0 −1
  409. drivers/net/can/usb/kvaser_usb.c +2 −3
  410. drivers/net/can/usb/usb_8dev.c +1 −3
  411. drivers/net/can/xilinx_can.c +3 −6
  412. drivers/net/ethernet/Kconfig +1 −0
  413. drivers/net/ethernet/Makefile +1 −0
  414. drivers/net/ethernet/amd/pcnet32.c +3 −2
  415. drivers/net/ethernet/apm/xgene/xgene_enet_main.c +17 −14
  416. drivers/net/ethernet/atheros/alx/main.c +2 −0
  417. drivers/net/ethernet/atheros/alx/reg.h +1 −0
  418. drivers/net/ethernet/aurora/Kconfig +20 −0
  419. drivers/net/ethernet/aurora/Makefile +1 −0
  420. drivers/net/ethernet/aurora/nb8800.c +1552 −0
  421. drivers/net/ethernet/aurora/nb8800.h +316 −0
  422. drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +2 −2
  423. drivers/net/ethernet/broadcom/bnxt/bnxt.c +31 −13
  424. drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c +3 −4
  425. drivers/net/ethernet/cadence/macb.c +4 −0
  426. drivers/net/ethernet/cadence/macb.h +5 −0
  427. drivers/net/ethernet/cavium/thunder/nic.h +2 −3
  428. drivers/net/ethernet/cavium/thunder/nic_main.c +20 −3
  429. drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c +15 −1
  430. drivers/net/ethernet/cavium/thunder/nicvf_main.c +1 −3
  431. drivers/net/ethernet/cavium/thunder/nicvf_queues.c +1 −1
  432. drivers/net/ethernet/cavium/thunder/nicvf_queues.h +1 −1
  433. drivers/net/ethernet/cavium/thunder/thunder_bgx.c +24 −4
  434. drivers/net/ethernet/cavium/thunder/thunder_bgx.h +2 −0
  435. drivers/net/ethernet/dec/tulip/tulip_core.c +7 −2
  436. drivers/net/ethernet/dec/tulip/winbond-840.c +1 −1
  437. drivers/net/ethernet/freescale/Kconfig +2 −1
  438. drivers/net/ethernet/freescale/gianfar.c +3 −3
  439. drivers/net/ethernet/freescale/gianfar_ptp.c +1 −1
  440. drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +3 −1
  441. drivers/net/ethernet/marvell/mvneta.c +27 −6
  442. drivers/net/ethernet/nxp/lpc_eth.c +1 −1
  443. drivers/net/ethernet/renesas/ravb_main.c +4 −2
  444. drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c +7 −6
  445. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +8 −1
  446. drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +13 −15
  447. drivers/net/ethernet/ti/cpsw-common.c +3 −0
  448. drivers/net/macvtap.c +2 −2
  449. drivers/net/phy/broadcom.c +1 −1
  450. drivers/net/phy/phy.c +2 −1
  451. drivers/net/tun.c +2 −2
  452. drivers/net/usb/cdc_ncm.c +4 −4
  453. drivers/net/usb/qmi_wwan.c +1 −0
  454. drivers/net/vmxnet3/vmxnet3_drv.c +60 −11
  455. drivers/net/vrf.c +1 −10
  456. drivers/net/wan/hdlc_fr.c +5 −5
  457. drivers/net/wan/x25_asy.c +1 −5
  458. drivers/net/wireless/ath/ath10k/core.c +47 −2
  459. drivers/net/wireless/ath/ath10k/core.h +1 −0
  460. drivers/net/wireless/ath/ath10k/hw.h +15 −2
  461. drivers/net/wireless/ath/ath10k/mac.c +1 −1
  462. drivers/net/wireless/ath/ath10k/pci.c +43 −10
  463. drivers/net/wireless/iwlwifi/iwl-7000.c +1 −1
  464. drivers/net/wireless/iwlwifi/iwl-8000.c +1 −1
  465. drivers/net/wireless/iwlwifi/mvm/d3.c +2 −6
  466. drivers/net/wireless/iwlwifi/mvm/mac80211.c +8 −3
  467. drivers/net/wireless/iwlwifi/mvm/sta.c +47 −41
  468. drivers/net/wireless/iwlwifi/mvm/sta.h +2 −2
  469. drivers/net/wireless/iwlwifi/pcie/drv.c +18 −1
  470. drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c +1 −1
  471. drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c +1 −1
  472. drivers/nvme/host/Makefile +2 −1
  473. drivers/nvme/host/lightnvm.c +118 −47
  474. drivers/nvme/host/nvme.h +14 −0
  475. drivers/nvme/host/pci.c +37 −14
  476. drivers/pci/host/pcie-designware.c +0 −1
  477. drivers/pci/host/pcie-hisi.c +2 −2
  478. drivers/pci/pci-driver.c +14 −2
  479. drivers/pci/pci-sysfs.c +4 −1
  480. drivers/pci/pci.h +0 −2
  481. drivers/pci/probe.c +2 −2
  482. drivers/pinctrl/Kconfig +0 −4
  483. drivers/pinctrl/freescale/pinctrl-imx1-core.c +6 −2
  484. drivers/pinctrl/mediatek/pinctrl-mtk-common.c +4 −7
  485. drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c +1 −1
  486. drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c +1 −1
  487. drivers/pinctrl/sh-pfc/pfc-sh7734.c +3 −3
  488. drivers/remoteproc/remoteproc_core.c +2 −0
  489. drivers/remoteproc/remoteproc_debugfs.c +1 −1
  490. drivers/rtc/rtc-ds1307.c +8 −36
  491. drivers/s390/cio/chsc.c +17 −20
  492. drivers/s390/cio/chsc.h +15 −0
  493. drivers/s390/cio/cio.c +14 −0
  494. drivers/s390/cio/css.c +0 −5
  495. drivers/s390/crypto/Makefile +5 −2
  496. drivers/s390/crypto/ap_bus.c +6 −0
  497. drivers/s390/crypto/zcrypt_api.c +4 −6
  498. drivers/s390/crypto/zcrypt_api.h +1 −0
  499. drivers/s390/crypto/zcrypt_msgtype50.c +1 −0
  500. drivers/s390/crypto/zcrypt_msgtype6.c +3 −0
  501. drivers/scsi/Kconfig +3 −0
  502. drivers/scsi/advansys.c +1 −1
  503. drivers/scsi/hosts.c +11 −0
  504. drivers/scsi/hpsa.c +1 −1
  505. drivers/scsi/mpt3sas/Kconfig +9 −0
  506. drivers/scsi/mpt3sas/mpt3sas_scsih.c +1 −2
  507. drivers/scsi/mvsas/mv_init.c +2 −2
  508. drivers/scsi/qla2xxx/qla_nx.c +2 −1
  509. drivers/scsi/qla2xxx/tcm_qla2xxx.c +1 −1
  510. drivers/scsi/scsi_debug.c +5 −4
  511. drivers/scsi/scsi_pm.c +10 −10
  512. drivers/scsi/scsi_scan.c +6 −3
  513. drivers/scsi/scsi_sysfs.c +11 −11
  514. drivers/scsi/scsi_transport_sas.c +30 −0
  515. drivers/scsi/sd.c +48 −21
  516. drivers/scsi/sd.h +1 −0
  517. drivers/scsi/ses.c +32 −26
  518. drivers/scsi/st.c +3 −2
  519. drivers/sh/pm_runtime.c +1 −1
  520. drivers/soc/mediatek/Kconfig +1 −0
  521. drivers/soc/ti/knav_qmss_queue.c +4 −4
  522. drivers/spi/spi-bcm63xx.c +2 −2
  523. drivers/spi/spi-mt65xx.c +18 −8
  524. drivers/spi/spi-pl022.c +22 −6
  525. drivers/spi/spi.c +2 −0
  526. drivers/staging/iio/Kconfig +2 −1
  527. drivers/staging/iio/adc/lpc32xx_adc.c +2 −2
  528. drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h +0 −1
  529. drivers/staging/lustre/lustre/libcfs/module.c +0 −17
  530. drivers/staging/wilc1000/coreconfigurator.c +25 −23
  531. drivers/target/iscsi/iscsi_target.c +12 −1
  532. drivers/target/iscsi/iscsi_target_nego.c +1 −0
  533. drivers/target/iscsi/iscsi_target_parameters.c +5 −5
  534. drivers/target/target_core_sbc.c +11 −6
  535. drivers/target/target_core_stat.c +1 −1
  536. drivers/target/target_core_tmr.c +6 −1
  537. drivers/target/target_core_transport.c +14 −12
  538. drivers/target/target_core_user.c +1 −3
  539. drivers/thermal/Kconfig +1 −1
  540. drivers/thermal/imx_thermal.c +41 −15
  541. drivers/thermal/of-thermal.c +1 −1
  542. drivers/thermal/power_allocator.c +7 −17
  543. drivers/thermal/rcar_thermal.c +21 −28
  544. drivers/thermal/rockchip_thermal.c +240 −88
  545. drivers/tty/n_tty.c +1 −1
  546. drivers/tty/serial/8250/8250_fsl.c +1 −0
  547. drivers/tty/serial/8250/Kconfig +1 −0
  548. drivers/tty/serial/Kconfig +1 −1
  549. drivers/tty/serial/bcm63xx_uart.c +1 −1
  550. drivers/tty/serial/etraxfs-uart.c +1 −1
  551. drivers/tty/tty_audit.c +1 −1
  552. drivers/tty/tty_io.c +4 −0
  553. drivers/tty/tty_ioctl.c +0 −4
  554. drivers/tty/tty_ldisc.c +1 −1
  555. drivers/usb/chipidea/ci_hdrc_imx.c +121 −21
  556. drivers/usb/chipidea/debug.c +2 −0
  557. drivers/usb/chipidea/udc.c +17 −0
  558. drivers/usb/chipidea/usbmisc_imx.c +6 −4
  559. drivers/usb/class/usblp.c +1 −1
  560. drivers/usb/core/Kconfig +1 −2
  561. drivers/usb/dwc2/hcd.c +5 −4
  562. drivers/usb/dwc2/platform.c +2 −1
  563. drivers/usb/dwc3/dwc3-pci.c +4 −0
  564. drivers/usb/dwc3/gadget.c +23 −1
  565. drivers/usb/gadget/function/f_loopback.c +1 −1
  566. drivers/usb/gadget/udc/atmel_usba_udc.c +1 −1
  567. drivers/usb/host/xhci-hub.c +9 −6
  568. drivers/usb/host/xhci-ring.c +6 −26
  569. drivers/usb/host/xhci.c +10 −0
  570. drivers/usb/musb/musb_core.c +6 −6
  571. drivers/usb/musb/musb_host.c +16 −6
  572. drivers/usb/phy/Kconfig +1 −3
  573. drivers/usb/phy/phy-mxs-usb.c +5 −2
  574. drivers/usb/phy/phy-omap-otg.c +1 −1
  575. drivers/usb/serial/option.c +11 −0
  576. drivers/usb/serial/qcserial.c +74 −20
  577. drivers/usb/serial/ti_usb_3410_5052.c +2 −0
  578. drivers/usb/serial/ti_usb_3410_5052.h +4 −0
  579. drivers/watchdog/Kconfig +1 −1
  580. drivers/watchdog/mtk_wdt.c +1 −0
  581. drivers/watchdog/omap_wdt.c +1 −1
  582. drivers/watchdog/pnx4008_wdt.c +4 −4
  583. drivers/watchdog/tegra_wdt.c +3 −1
  584. drivers/watchdog/w83977f_wdt.c +1 −1
  585. drivers/xen/events/events_base.c +3 −2
  586. drivers/xen/evtchn.c +107 −16
  587. drivers/xen/gntdev.c +1 −1
  588. fs/Kconfig +6 −0
  589. fs/block_dev.c +16 −2
  590. fs/btrfs/backref.c +1 −1
  591. fs/btrfs/ctree.h +4 −0
  592. fs/btrfs/extent-tree.c +100 −23
  593. fs/btrfs/file.c +7 −3
  594. fs/btrfs/inode.c +1 −23
  595. fs/btrfs/qgroup.c +4 −1
  596. fs/btrfs/scrub.c +56 −6
  597. fs/btrfs/tests/free-space-tests.c +3 −1
  598. fs/btrfs/transaction.c +32 −0
  599. fs/btrfs/transaction.h +4 −0
  600. fs/btrfs/volumes.c +6 −7
  601. fs/btrfs/volumes.h +1 −1
  602. fs/configfs/dir.c +110 −0
  603. fs/dax.c +4 −0
  604. fs/direct-io.c +9 −1
  605. fs/dlm/lowcomms.c +2 −2
  606. fs/ext2/super.c +2 −0
  607. fs/ext4/super.c +5 −1
  608. fs/fat/dir.c +11 −5
  609. fs/hugetlbfs/inode.c +32 −33
  610. fs/namei.c +0 −1
  611. fs/ncpfs/ioctl.c +2 −0
  612. fs/nfs/callback_xdr.c +5 −2
  613. fs/nfs/inode.c +9 −2
  614. fs/nfs/nfs42proc.c +2 −1
  615. fs/nfs/nfs4client.c +1 −1
  616. fs/nfs/nfs4file.c +27 −32
  617. fs/nfs/nfs4proc.c +1 −1
  618. fs/nfs/nfs4xdr.c +1 −0
  619. fs/nfs/pnfs.c +31 −25
  620. fs/ocfs2/namei.c +2 −0
  621. fs/overlayfs/copy_up.c +6 −17
  622. fs/overlayfs/inode.c +8 −11
  623. fs/overlayfs/overlayfs.h +1 −2
  624. fs/splice.c +8 −0
  625. fs/sysv/inode.c +2 −9
  626. include/drm/drmP.h +10 −0
  627. include/drm/drm_atomic.h +3 −0
  628. include/kvm/arm_vgic.h +1 −1
  629. include/linux/acpi.h +2 −2
  630. include/linux/blkdev.h +3 −2
  631. include/linux/bpf.h +4 −1
  632. include/linux/configfs.h +10 −0
  633. include/linux/cpufreq.h +1 −0
  634. include/linux/dns_resolver.h +1 −1
  635. include/linux/enclosure.h +4 −0
  636. include/linux/gfp.h +1 −1
  637. include/linux/ipv6.h +1 −1
  638. include/linux/kref.h +0 −33
  639. include/linux/kvm_host.h +11 −0
  640. include/linux/lightnvm.h +44 −132
  641. include/linux/net.h +9 −4
  642. include/linux/netdevice.h +2 −1
  643. include/linux/nfs_xdr.h +1 −0
  644. include/linux/of_dma.h +1 −1
  645. include/linux/pci.h +9 −0
  646. include/linux/scpi_protocol.h +1 −1
  647. include/linux/signal.h +0 −1
  648. include/linux/slab.h +27 −18
  649. include/linux/syscalls.h +1 −1
  650. include/linux/thermal.h +2 −1
  651. include/linux/tty.h +3 −3
  652. include/linux/types.h +1 −1
  653. include/net/af_unix.h +1 −0
  654. include/net/ip6_route.h +4 −13
  655. include/net/ipv6.h +21 −1
  656. include/net/mac80211.h +4 −2
  657. include/net/ndisc.h +1 −2
  658. include/net/sch_generic.h +3 −0
  659. include/net/sctp/structs.h +8 −8
  660. include/net/sock.h +25 −7
  661. include/scsi/scsi_host.h +3 −0
  662. include/scsi/scsi_transport_sas.h +10 −0
  663. include/sound/soc-dapm.h +1 −0
  664. include/target/target_core_base.h +1 −1
  665. include/uapi/linux/nfs.h +0 −11
  666. include/video/imx-ipu-v3.h +0 −1
  667. kernel/bpf/arraymap.c +8 −2
  668. kernel/bpf/hashtab.c +25 −9
  669. kernel/bpf/inode.c +3 −3
  670. kernel/bpf/syscall.c +27 −13
  671. kernel/bpf/verifier.c +1 −2
  672. kernel/livepatch/core.c +6 −0
  673. kernel/panic.c +4 −1
  674. kernel/pid.c +2 −2
  675. kernel/sched/core.c +30 −6
  676. kernel/sched/cputime.c +3 −0
  677. kernel/sched/rt.c +1 −1
  678. kernel/sched/sched.h +3 −0
  679. kernel/sched/wait.c +8 −8
  680. kernel/signal.c +1 −1
  681. kernel/trace/ring_buffer.c +9 −8
  682. kernel/trace/trace_events.c +16 −0
  683. mm/huge_memory.c +2 −2
  684. mm/kasan/kasan.c +2 −0
  685. mm/memory.c +4 −4
  686. mm/page-writeback.c +3 −1
  687. mm/slab.c +1 −1
  688. mm/slab.h +1 −1
  689. mm/slab_common.c +3 −3
  690. mm/slob.c +1 −1
  691. mm/slub.c +211 −93
  692. mm/vmalloc.c +2 −3
  693. net/bluetooth/af_bluetooth.c +3 −3
  694. net/bluetooth/smp.c +6 −1
  695. net/caif/caif_socket.c +2 −2
  696. net/core/datagram.c +1 −1
  697. net/core/neighbour.c +2 −2
  698. net/core/netclassid_cgroup.c +18 −8
  699. net/core/scm.c +2 −0
  700. net/core/sock.c +5 −7
  701. net/core/stream.c +3 −3
  702. net/dccp/ipv6.c +23 −14
  703. net/dccp/proto.c +1 −2
  704. net/decnet/af_decnet.c +4 −4
  705. net/dns_resolver/dns_query.c +1 −1
  706. net/hsr/hsr_device.c +1 −1
  707. net/ipv4/igmp.c +3 −2
  708. net/ipv4/ipmr.c +8 −15
  709. net/ipv4/tcp.c +3 −4
  710. net/ipv4/tcp_input.c +20 −3
  711. net/ipv4/tcp_ipv4.c +2 −1
  712. net/ipv4/tcp_timer.c +13 −1
  713. net/ipv4/udp.c +0 −1
  714. net/ipv6/addrconf.c +1 −1
  715. net/ipv6/af_inet6.c +10 −5
  716. net/ipv6/datagram.c +3 −1
  717. net/ipv6/exthdrs.c +2 −1
  718. net/ipv6/icmp.c +0 −14
  719. net/ipv6/inet6_connection_sock.c +9 −12
  720. net/ipv6/ip6_tunnel.c +1 −1
  721. net/ipv6/ip6mr.c +8 −11
  722. net/ipv6/ipv6_sockglue.c +22 −11
  723. net/ipv6/ndisc.c +3 −7
  724. net/ipv6/netfilter/nf_conntrack_reasm.c +3 −2
  725. net/ipv6/raw.c +6 −2
  726. net/ipv6/reassembly.c +7 −3
  727. net/ipv6/route.c +1 −1
  728. net/ipv6/syncookies.c +1 −1
  729. net/ipv6/tcp_ipv6.c +19 −13
  730. net/ipv6/udp.c +6 −2
  731. net/iucv/af_iucv.c +1 −1
  732. net/l2tp/l2tp_ip6.c +6 −2
  733. net/mac80211/agg-tx.c +2 −1
  734. net/mac80211/cfg.c +6 −2
  735. net/mac80211/iface.c +3 −2
  736. net/mac80211/main.c +1 −2
  737. net/mac80211/mesh_pathtbl.c +4 −4
  738. net/mac80211/scan.c +5 −4
  739. net/nfc/llcp_sock.c +1 −1
  740. net/openvswitch/dp_notify.c +1 −1
  741. net/openvswitch/vport-geneve.c +0 −1
  742. net/openvswitch/vport-gre.c +0 −1
  743. net/openvswitch/vport-netdev.c +6 −2
  744. net/openvswitch/vport.c +4 −4
  745. net/openvswitch/vport.h +7 −1
  746. net/packet/af_packet.c +2 −2
  747. net/rds/connection.c +0 −6
  748. net/rds/send.c +3 −1
  749. net/rxrpc/ar-ack.c +3 −1
  750. net/rxrpc/ar-output.c +1 −1
  751. net/sched/sch_api.c +18 −9
  752. net/sched/sch_generic.c +1 −1
  753. net/sched/sch_mq.c +2 −2
  754. net/sched/sch_mqprio.c +2 −2
  755. net/sctp/ipv6.c +10 −3
  756. net/sctp/socket.c +25 −14
  757. net/socket.c +7 −14
  758. net/sunrpc/backchannel_rqst.c +8 −0
  759. net/sunrpc/svc.c +1 −0
  760. net/sunrpc/xprtsock.c +7 −7
  761. net/tipc/link.c +2 −0
  762. net/tipc/socket.c +7 −3
  763. net/tipc/udp_media.c +5 −2
  764. net/unix/af_unix.c +231 −37
  765. scripts/kernel-doc +1 −1
  766. security/keys/encrypted-keys/encrypted.c +2 −0
  767. security/keys/trusted.c +4 −1
  768. security/keys/user_defined.c +4 −1
  769. security/selinux/ss/conditional.c +2 −2
  770. sound/firewire/dice/dice.c +4 −0
  771. sound/pci/hda/hda_intel.c +7 −0
  772. sound/pci/hda/patch_conexant.c +3 −2
  773. sound/pci/hda/patch_hdmi.c +8 −1
  774. sound/pci/hda/patch_realtek.c +23 −0
  775. sound/pci/hda/patch_sigmatel.c +29 −16
  776. sound/soc/codecs/arizona.c +5 −11
  777. sound/soc/codecs/es8328.c +8 −8
  778. sound/soc/codecs/nau8825.c +31 −0
  779. sound/soc/codecs/rl6231.c +4 −2
  780. sound/soc/codecs/rt5645.c +57 −4
  781. sound/soc/codecs/rt5670.h +6 −6
  782. sound/soc/codecs/rt5677.c +61 −39
  783. sound/soc/codecs/wm8960.c +1 −1
  784. sound/soc/codecs/wm8962.c +2 −2
  785. sound/soc/davinci/davinci-mcasp.c +10 −2
  786. sound/soc/fsl/Kconfig +2 −0
  787. sound/soc/fsl/fsl_sai.c +2 −1
  788. sound/soc/intel/Kconfig +1 −1
  789. sound/soc/intel/skylake/skl-topology.c +1 −0
  790. sound/soc/rockchip/rockchip_spdif.c +1 −1
  791. sound/soc/rockchip/rockchip_spdif.h +3 −3
  792. sound/soc/sh/rcar/gen.c +1 −1
  793. sound/soc/sh/rcar/src.c +7 −0
  794. sound/soc/soc-core.c +3 −3
  795. sound/soc/soc-dapm.c +7 −0
  796. sound/soc/soc-ops.c +1 −1
  797. sound/soc/soc-topology.c +2 −1
  798. sound/soc/sti/uniperif_player.c +6 −3
  799. sound/soc/sti/uniperif_reader.c +1 −2
  800. sound/soc/sunxi/sun4i-codec.c +14 −13
  801. sound/usb/midi.c +46 −0
  802. sound/usb/quirks-table.h +11 −0
  803. sound/usb/quirks.c +1 −0
  804. sound/usb/usbaudio.h +1 −0
  805. tools/Makefile +10 −1
  806. tools/perf/builtin-inject.c +1 −0
  807. tools/perf/builtin-report.c +3 −3
  808. tools/perf/ui/browsers/hists.c +1 −6
  809. tools/perf/util/build-id.c +1 −0
  810. tools/perf/util/dso.c +17 −0
  811. tools/perf/util/dso.h +1 −0
  812. tools/perf/util/machine.c +1 −0
  813. tools/perf/util/probe-finder.c +17 −7
  814. tools/perf/util/symbol.c +16 −18
  815. tools/perf/util/symbol.h +1 −0
  816. tools/power/x86/turbostat/turbostat.c +4 −4
  817. tools/testing/nvdimm/test/nfit.c +15 −34
  818. tools/testing/selftests/futex/README +1 −1
  819. tools/testing/selftests/seccomp/seccomp_bpf.c +7 −4
  820. tools/vm/page-types.c +1 −0
  821. virt/kvm/arm/arch_timer.c +17 −11
  822. virt/kvm/arm/vgic.c +24 −26
Documentation/IPMI.txt+5−2
@@ -587,7 +587,7 @@ used to control it: · 586 unmodified lines
587587
588588 modprobe ipmi_watchdog timeout=<t> pretimeout=<t> action=<action type>
589589 preaction=<preaction type> preop=<preop type> start_now=x
590− nowayout=x ifnum_to_use=n
590+ nowayout=x ifnum_to_use=n panic_wdt_timeout=<t>
591591
592592 ifnum_to_use specifies which interface the watchdog timer should use.
593593 The default is -1, which means to pick the first one registered.
@@ -597,7 +597,9 @@ is the amount of seconds before the reset that the pre-timeout panic will · 3 unmodified lines
597597 occur (if pretimeout is zero, then pretimeout will not be enabled). Note
598598 that the pretimeout is the time before the final timeout. So if the
599599 timeout is 50 seconds and the pretimeout is 10 seconds, then the pretimeout
600−will occur in 40 second (10 seconds before the timeout).
600+will occur in 40 second (10 seconds before the timeout). The panic_wdt_timeout
601+is the value of timeout which is set on kernel panic, in order to let actions
602+such as kdump to occur during panic.
601603
602604 The action may be "reset", "power_cycle", or "power_off", and
603605 specifies what to do when the timer times out, and defaults to
@@ -634,6 +636,7 @@ for configuring the watchdog: · 30 unmodified lines
634636 ipmi_watchdog.preop=<preop type>
635637 ipmi_watchdog.start_now=x
636638 ipmi_watchdog.nowayout=x
639+ ipmi_watchdog.panic_wdt_timeout=<t>
637640
638641 The options are the same as the module parameter options.
639642
Documentation/arm/keystone/Overview.txt+0−18
@@ -49,24 +49,6 @@ specified through DTS. Following are the DTS used:- · 48 unmodified lines
4949 The device tree documentation for the keystone machines are located at
5050 Documentation/devicetree/bindings/arm/keystone/keystone.txt
5151
52−Known issues & workaround
53−-------------------------
54−
55−Some of the device drivers used on keystone are re-used from that from
56−DaVinci and other TI SoCs. These device drivers may use clock APIs directly.
57−Some of the keystone specific drivers such as netcp uses run time power
58−management API instead to enable clock. As this API has limitations on
59−keystone, following workaround is needed to boot Linux.
60−
61− Add 'clk_ignore_unused' to the bootargs env variable in u-boot. Otherwise
62− clock frameworks will try to disable clocks that are unused and disable
63− the hardware. This is because netcp related power domain and clock
64− domains are enabled in u-boot as run time power management API currently
65− doesn't enable clocks for netcp due to a limitation. This workaround is
66− expected to be removed in the future when proper API support becomes
67− available. Until then, this work around is needed.
68−
69−
7052 Document Author
7153 ---------------
7254 Murali Karicheri <m-karicheri2@ti.com>
Documentation/block/null_blk.txt+3−0
@@ -70,3 +70,6 @@ use_per_node_hctx=[0/1]: Default: 0 · 69 unmodified lines
7070 parameter.
7171 1: The multi-queue block layer is instantiated with a hardware dispatch
7272 queue for each CPU node in the system.
73+
74+use_lightnvm=[0/1]: Default: 0
75+ Register device with LightNVM. Requires blk-mq to be used.
Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt+6−0
@@ -8,6 +8,11 @@ Required properties: · 7 unmodified lines
88 - phy-mode: See ethernet.txt file in the same directory
99 - clocks: a pointer to the reference clock for this device.
1010
11+Optional properties:
12+- tx-csum-limit: maximum mtu supported by port that allow TX checksum.
13+ Value is presented in bytes. If not used, by default 1600B is set for
14+ "marvell,armada-370-neta" and 9800B for others.
15+
1116 Example:
1217
1318 ethernet@d0070000 {
@@ -15,6 +20,7 @@ ethernet@d0070000 { · 1 unmodified line
1520 reg = <0xd0070000 0x2500>;
1621 interrupts = <8>;
1722 clocks = <&gate_clk 4>;
23+ tx-csum-limit = <9800>
1824 status = "okay";
1925 phy = <&phy0>;
2026 phy-mode = "rgmii-id";
Documentation/devicetree/bindings/thermal/rockchip-thermal.txt+3−1
@@ -1,7 +1,9 @@
11 * Temperature Sensor ADC (TSADC) on rockchip SoCs
22
33 Required properties:
4−- compatible : "rockchip,rk3288-tsadc"
4+- compatible : should be "rockchip,<name>-tsadc"
5+ "rockchip,rk3288-tsadc": found on RK3288 SoCs
6+ "rockchip,rk3368-tsadc": found on RK3368 SoCs
57 - reg : physical base address of the controller and length of memory mapped
68 region.
79 - interrupts : The interrupt number to the cpu. The interrupt specifier format
Documentation/i2c/busses/i2c-i801+1−0
@@ -32,6 +32,7 @@ Supported adapters: · 31 unmodified lines
3232 * Intel Sunrise Point-LP (PCH)
3333 * Intel DNV (SOC)
3434 * Intel Broxton (SOC)
35+ * Intel Lewisburg (PCH)
3536 Datasheets: Publicly available at the Intel website
3637
3738 On Intel Patsburg and later chipsets, both the normal host SMBus controller
Documentation/kernel-parameters.txt+0−3
@@ -1583,9 +1583,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted. · 1582 unmodified lines
15831583 hwp_only
15841584 Only load intel_pstate on systems which support
15851585 hardware P state control (HWP) if available.
1586− no_acpi
1587− Don't use ACPI processor performance control objects
1588− _PSS and _PPC specified limits.
15891586
15901587 intremap= [X86-64, Intel-IOMMU]
15911588 on enable Interrupt Remapping (default)
MAINTAINERS+27−10
@@ -318,7 +318,7 @@ M: Zhang Rui <rui.zhang@intel.com> · 317 unmodified lines
318318 L: linux-acpi@vger.kernel.org
319319 W: https://01.org/linux-acpi
320320 S: Supported
321−F: drivers/acpi/video.c
321+F: drivers/acpi/acpi_video.c
322322
323323 ACPI WMI DRIVER
324324 L: platform-driver-x86@vger.kernel.org
@@ -1847,7 +1847,7 @@ S: Supported · 1522 unmodified lines
18471847 F: drivers/net/wireless/ath/ath6kl/
18481848
18491849 WILOCITY WIL6210 WIRELESS DRIVER
1850−M: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
1850+M: Maya Erez <qca_merez@qca.qualcomm.com>
18511851 L: linux-wireless@vger.kernel.org
18521852 L: wil6210@qca.qualcomm.com
18531853 S: Supported
@@ -1931,7 +1931,7 @@ S: Supported · 77 unmodified lines
19311931 F: drivers/i2c/busses/i2c-at91.c
19321932
19331933 ATMEL ISI DRIVER
1934−M: Josh Wu <josh.wu@atmel.com>
1934+M: Ludovic Desroches <ludovic.desroches@atmel.com>
19351935 L: linux-media@vger.kernel.org
19361936 S: Supported
19371937 F: drivers/media/platform/soc_camera/atmel-isi.c
@@ -1950,7 +1950,8 @@ S: Supported · 12 unmodified lines
19501950 F: drivers/net/ethernet/cadence/
19511951
19521952 ATMEL NAND DRIVER
1953−M: Josh Wu <josh.wu@atmel.com>
1953+M: Wenyou Yang <wenyou.yang@atmel.com>
1954+M: Josh Wu <rainyfeeling@outlook.com>
19541955 L: linux-mtd@lists.infradead.org
19551956 S: Supported
19561957 F: drivers/mtd/nand/atmel_nand*
@@ -2449,7 +2450,9 @@ F: drivers/firmware/broadcom/* · 492 unmodified lines
24492450
24502451 BROADCOM STB NAND FLASH DRIVER
24512452 M: Brian Norris <computersforpeace@gmail.com>
2453+M: Kamal Dasu <kdasu.kdev@gmail.com>
24522454 L: linux-mtd@lists.infradead.org
2455+L: bcm-kernel-feedback-list@broadcom.com
24532456 S: Maintained
24542457 F: drivers/mtd/nand/brcmnand/
24552458
@@ -2929,10 +2932,9 @@ S: Maintained · 473 unmodified lines
29292932 F: drivers/platform/x86/compal-laptop.c
29302933
29312934 CONEXANT ACCESSRUNNER USB DRIVER
2932−M: Simon Arlott <cxacru@fire.lp0.eu>
29332935 L: accessrunner-general@lists.sourceforge.net
29342936 W: http://accessrunner.sourceforge.net/
2935−S: Maintained
2937+S: Orphan
29362938 F: drivers/usb/atm/cxacru.c
29372939
29382940 CONFIGFS
@@ -4409,6 +4411,7 @@ K: fmc_d.*register · 1470 unmodified lines
44094411
44104412 FPGA MANAGER FRAMEWORK
44114413 M: Alan Tull <atull@opensource.altera.com>
4414+R: Moritz Fischer <moritz.fischer@ettus.com>
44124415 S: Maintained
44134416 F: drivers/fpga/
44144417 F: include/linux/fpga/fpga-mgr.h
@@ -6371,6 +6374,7 @@ F: arch/*/include/asm/pmem.h · 1956 unmodified lines
63716374 LIGHTNVM PLATFORM SUPPORT
63726375 M: Matias Bjorling <mb@lightnvm.io>
63736376 W: http://github/OpenChannelSSD
6377+L: linux-block@vger.kernel.org
63746378 S: Maintained
63756379 F: drivers/lightnvm/
63766380 F: include/linux/lightnvm.h
@@ -7909,6 +7913,18 @@ S: Maintained · 1532 unmodified lines
79097913 F: net/openvswitch/
79107914 F: include/uapi/linux/openvswitch.h
79117915
7916+OPERATING PERFORMANCE POINTS (OPP)
7917+M: Viresh Kumar <vireshk@kernel.org>
7918+M: Nishanth Menon <nm@ti.com>
7919+M: Stephen Boyd <sboyd@codeaurora.org>
7920+L: linux-pm@vger.kernel.org
7921+S: Maintained
7922+T: git git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm.git
7923+F: drivers/base/power/opp/
7924+F: include/linux/pm_opp.h
7925+F: Documentation/power/opp.txt
7926+F: Documentation/devicetree/bindings/opp/
7927+
79127928 OPL4 DRIVER
79137929 M: Clemens Ladisch <clemens@ladisch.de>
79147930 L: alsa-devel@alsa-project.org (moderated for non-subscribers)
@@ -9322,7 +9338,6 @@ F: drivers/i2c/busses/i2c-designware-* · 1407 unmodified lines
93229338 F: include/linux/platform_data/i2c-designware.h
93239339
93249340 SYNOPSYS DESIGNWARE MMC/SD/SDIO DRIVER
9325−M: Seungwon Jeon <tgih.jun@samsung.com>
93269341 M: Jaehoon Chung <jh80.chung@samsung.com>
93279342 L: linux-mmc@vger.kernel.org
93289343 S: Maintained
@@ -9419,8 +9434,10 @@ F: include/scsi/sg.h · 90 unmodified lines
94199434
94209435 SCSI SUBSYSTEM
94219436 M: "James E.J. Bottomley" <JBottomley@odin.com>
9422−L: linux-scsi@vger.kernel.org
94239437 T: git git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git
9438+M: "Martin K. Petersen" <martin.petersen@oracle.com>
9439+T: git git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git
9440+L: linux-scsi@vger.kernel.org
94249441 S: Maintained
94259442 F: drivers/scsi/
94269443 F: include/scsi/
@@ -10895,9 +10912,9 @@ S: Maintained · 1468 unmodified lines
1089510912 F: drivers/media/tuners/tua9001*
1089610913
1089710914 TULIP NETWORK DRIVERS
10898−M: Grant Grundler <grundler@parisc-linux.org>
1089910915 L: netdev@vger.kernel.org
10900−S: Maintained
10916+L: linux-parisc@vger.kernel.org
10917+S: Orphan
1090110918 F: drivers/net/ethernet/dec/tulip/
1090210919
1090310920 TUN/TAP driver
Makefile+1−1
@@ -1,7 +1,7 @@
11 VERSION = 4
22 PATCHLEVEL = 4
33 SUBLEVEL = 0
4−EXTRAVERSION = -rc1
4+EXTRAVERSION = -rc4
55 NAME = Blurry Fish Butt
66
77 # *DOCUMENTATION*
arch/arc/configs/axs101_defconfig+1−1
@@ -1,4 +1,4 @@
1−CONFIG_CROSS_COMPILE="arc-linux-uclibc-"
1+CONFIG_CROSS_COMPILE="arc-linux-"
22 CONFIG_DEFAULT_HOSTNAME="ARCLinux"
33 # CONFIG_SWAP is not set
44 CONFIG_SYSVIPC=y
arch/arc/configs/axs103_defconfig+1−1
@@ -1,4 +1,4 @@
1−CONFIG_CROSS_COMPILE="arc-linux-uclibc-"
1+CONFIG_CROSS_COMPILE="arc-linux-"
22 CONFIG_DEFAULT_HOSTNAME="ARCLinux"
33 # CONFIG_SWAP is not set
44 CONFIG_SYSVIPC=y
arch/arc/configs/axs103_smp_defconfig+1−1
@@ -1,4 +1,4 @@
1−CONFIG_CROSS_COMPILE="arc-linux-uclibc-"
1+CONFIG_CROSS_COMPILE="arc-linux-"
22 CONFIG_DEFAULT_HOSTNAME="ARCLinux"
33 # CONFIG_SWAP is not set
44 CONFIG_SYSVIPC=y
arch/arc/configs/nsim_hs_defconfig+1−1
@@ -1,4 +1,4 @@
1−CONFIG_CROSS_COMPILE="arc-linux-uclibc-"
1+CONFIG_CROSS_COMPILE="arc-linux-"
22 # CONFIG_LOCALVERSION_AUTO is not set
33 CONFIG_DEFAULT_HOSTNAME="ARCLinux"
44 # CONFIG_SWAP is not set
arch/arc/configs/nsim_hs_smp_defconfig+1−1
@@ -1,4 +1,4 @@
1−CONFIG_CROSS_COMPILE="arc-linux-uclibc-"
1+CONFIG_CROSS_COMPILE="arc-linux-"
22 # CONFIG_LOCALVERSION_AUTO is not set
33 CONFIG_DEFAULT_HOSTNAME="ARCLinux"
44 # CONFIG_SWAP is not set
arch/arc/configs/nsimosci_hs_defconfig+1−1
@@ -1,4 +1,4 @@
1−CONFIG_CROSS_COMPILE="arc-linux-uclibc-"
1+CONFIG_CROSS_COMPILE="arc-linux-"
22 # CONFIG_LOCALVERSION_AUTO is not set
33 CONFIG_DEFAULT_HOSTNAME="ARCLinux"
44 # CONFIG_SWAP is not set
arch/arc/configs/nsimosci_hs_smp_defconfig+1−1
@@ -1,4 +1,4 @@
1−CONFIG_CROSS_COMPILE="arc-linux-uclibc-"
1+CONFIG_CROSS_COMPILE="arc-linux-"
22 CONFIG_DEFAULT_HOSTNAME="ARCLinux"
33 # CONFIG_SWAP is not set
44 CONFIG_SYSVIPC=y
arch/arc/configs/vdk_hs38_defconfig+1−1
@@ -1,4 +1,4 @@
1−CONFIG_CROSS_COMPILE="arc-linux-uclibc-"
1+CONFIG_CROSS_COMPILE="arc-linux-"
22 # CONFIG_LOCALVERSION_AUTO is not set
33 CONFIG_DEFAULT_HOSTNAME="ARCLinux"
44 # CONFIG_CROSS_MEMORY_ATTACH is not set
arch/arc/configs/vdk_hs38_smp_defconfig+1−1
@@ -1,4 +1,4 @@
1−CONFIG_CROSS_COMPILE="arc-linux-uclibc-"
1+CONFIG_CROSS_COMPILE="arc-linux-"
22 # CONFIG_LOCALVERSION_AUTO is not set
33 CONFIG_DEFAULT_HOSTNAME="ARCLinux"
44 # CONFIG_CROSS_MEMORY_ATTACH is not set
arch/arc/include/asm/irqflags-arcv2.h+3−0
@@ -37,6 +37,9 @@ · 36 unmodified lines
3737 #define ISA_INIT_STATUS_BITS (STATUS_IE_MASK | STATUS_AD_MASK | \
3838 (ARCV2_IRQ_DEF_PRIO << 1))
3939
40+/* SLEEP needs default irq priority (<=) which can interrupt the doze */
41+#define ISA_SLEEP_ARG (0x10 | ARCV2_IRQ_DEF_PRIO)
42+
4043 #ifndef __ASSEMBLY__
4144
4245 /*
arch/arc/include/asm/irqflags-compact.h+2−0
@@ -43,6 +43,8 @@ · 42 unmodified lines
4343
4444 #define ISA_INIT_STATUS_BITS STATUS_IE_MASK
4545
46+#define ISA_SLEEP_ARG 0x3
47+
4648 #ifndef __ASSEMBLY__
4749
4850 /******************************************************************
arch/arc/kernel/ctx_sw.c+0−2
@@ -58,8 +58,6 @@ __switch_to(struct task_struct *prev_task, struct task_struct *next_task) · 57 unmodified lines
5858 "st sp, [r24] \n\t"
5959 #endif
6060
61− "sync \n\t"
62−
6361 /*
6462 * setup _current_task with incoming tsk.
6563 * optionally, set r25 to that as well
arch/arc/kernel/ctx_sw_asm.S+0−3
@@ -44,9 +44,6 @@ __switch_to: · 43 unmodified lines
4444 * don't need to do anything special to return it
4545 */
4646
47− /* hardware memory barrier */
48− sync
49−
5047 /*
5148 * switch to new task, contained in r1
5249 * Temp reg r3 is required to get the ptr to store val
arch/arc/kernel/process.c+4−5
@@ -44,11 +44,10 @@ SYSCALL_DEFINE0(arc_gettls) · 43 unmodified lines
4444 void arch_cpu_idle(void)
4545 {
4646 /* sleep, but enable all interrupts before committing */
47− if (is_isa_arcompact()) {
48− __asm__("sleep 0x3");
49− } else {
50− __asm__("sleep 0x10");
51− }
47+ __asm__ __volatile__(
48+ "sleep %0 \n"
49+ :
50+ :"I"(ISA_SLEEP_ARG)); /* can't be "r" has to be embedded const */
5251 }
5352
5453 asmlinkage void ret_from_fork(void);
arch/arc/kernel/unwind.c+4−33
@@ -986,42 +986,13 @@ int arc_unwind(struct unwind_frame_info *frame) · 985 unmodified lines
986986 (const u8 *)(fde +
987987 1) +
988988 *fde, ptrType);
989− if (pc >= endLoc)
989+ if (pc >= endLoc) {
990990 fde = NULL;
991− } else
992− fde = NULL;
993− }
994− if (fde == NULL) {
995− for (fde = table->address, tableSize = table->size;
996− cie = NULL, tableSize > sizeof(*fde)
997− && tableSize - sizeof(*fde) >= *fde;
998− tableSize -= sizeof(*fde) + *fde,
999− fde += 1 + *fde / sizeof(*fde)) {
1000− cie = cie_for_fde(fde, table);
1001− if (cie == &bad_cie) {
1002991 cie = NULL;
1003− break;
1004992 }
1005− if (cie == NULL
1006− || cie == &not_fde
1007− || (ptrType = fde_pointer_type(cie)) < 0)
1008− continue;
1009− ptr = (const u8 *)(fde + 2);
1010− startLoc = read_pointer(&ptr,
1011− (const u8 *)(fde + 1) +
1012− *fde, ptrType);
1013− if (!startLoc)
1014− continue;
1015− if (!(ptrType & DW_EH_PE_indirect))
1016− ptrType &=
1017− DW_EH_PE_FORM | DW_EH_PE_signed;
1018− endLoc =
1019− startLoc + read_pointer(&ptr,
1020− (const u8 *)(fde +
1021− 1) +
1022− *fde, ptrType);
1023− if (pc >= startLoc && pc < endLoc)
1024− break;
993+ } else {
994+ fde = NULL;
995+ cie = NULL;
1025996 }
1026997 }
1027998 }
arch/arc/mm/tlb.c+2−2
@@ -619,10 +619,10 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long vaddr_unaligned, · 618 unmodified lines
619619
620620 int dirty = !test_and_set_bit(PG_dc_clean, &page->flags);
621621 if (dirty) {
622− /* wback + inv dcache lines */
622+ /* wback + inv dcache lines (K-mapping) */
623623 __flush_dcache_page(paddr, paddr);
624624
625− /* invalidate any existing icache lines */
625+ /* invalidate any existing icache lines (U-mapping) */
626626 if (vma->vm_flags & VM_EXEC)
627627 __inv_icache_page(paddr, vaddr);
628628 }
arch/arm/Kconfig+2−2
@@ -76,6 +76,8 @@ config ARM · 75 unmodified lines
7676 select IRQ_FORCED_THREADING
7777 select MODULES_USE_ELF_REL
7878 select NO_BOOTMEM
79+ select OF_EARLY_FLATTREE if OF
80+ select OF_RESERVED_MEM if OF
7981 select OLD_SIGACTION
8082 select OLD_SIGSUSPEND3
8183 select PERF_USE_VMALLOC
@@ -1822,8 +1824,6 @@ config USE_OF · 1740 unmodified lines
18221824 bool "Flattened Device Tree support"
18231825 select IRQ_DOMAIN
18241826 select OF
1825− select OF_EARLY_FLATTREE
1826− select OF_RESERVED_MEM
18271827 help
18281828 Include support for flattened device tree machine descriptions.
18291829
arch/arm/boot/dts/am57xx-beagle-x15.dts+1−0
@@ -604,6 +604,7 @@ · 603 unmodified lines
604604 reg = <0x6f>;
605605 interrupts-extended = <&crossbar_mpu GIC_SPI 2 IRQ_TYPE_EDGE_RISING>,
606606 <&dra7_pmx_core 0x424>;
607+ interrupt-names = "irq", "wakeup";
607608
608609 pinctrl-names = "default";
609610 pinctrl-0 = <&mcp79410_pins_default>;
arch/arm/boot/dts/animeo_ip.dts+3−3
@@ -155,21 +155,21 @@ · 154 unmodified lines
155155 label = "keyswitch_in";
156156 gpios = <&pioB 1 GPIO_ACTIVE_HIGH>;
157157 linux,code = <28>;
158− gpio-key,wakeup;
158+ wakeup-source;
159159 };
160160
161161 error_in {
162162 label = "error_in";
163163 gpios = <&pioB 2 GPIO_ACTIVE_HIGH>;
164164 linux,code = <29>;
165− gpio-key,wakeup;
165+ wakeup-source;
166166 };
167167
168168 btn {
169169 label = "btn";
170170 gpios = <&pioC 23 GPIO_ACTIVE_HIGH>;
171171 linux,code = <31>;
172− gpio-key,wakeup;
172+ wakeup-source;
173173 };
174174 };
175175 };
arch/arm/boot/dts/armada-38x.dtsi+1−0
@@ -498,6 +498,7 @@ · 497 unmodified lines
498498 reg = <0x70000 0x4000>;
499499 interrupts-extended = <&mpic 8>;
500500 clocks = <&gateclk 4>;
501+ tx-csum-limit = <9800>;
501502 status = "disabled";
502503 };
503504
arch/arm/boot/dts/at91-foxg20.dts+1−1
@@ -159,7 +159,7 @@ · 158 unmodified lines
159159 label = "Button";
160160 gpios = <&pioC 4 GPIO_ACTIVE_LOW>;
161161 linux,code = <0x103>;
162− gpio-key,wakeup;
162+ wakeup-source;
163163 };
164164 };
165165 };
arch/arm/boot/dts/at91-kizbox.dts+2−11
@@ -24,15 +24,6 @@ · 23 unmodified lines
2424 };
2525
2626 clocks {
27− #address-cells = <1>;
28− #size-cells = <1>;
29− ranges;
30−
31− main_clock: clock@0 {
32− compatible = "atmel,osc", "fixed-clock";
33− clock-frequency = <18432000>;
34− };
35−
3627 main_xtal {
3728 clock-frequency = <18432000>;
3829 };
@@ -94,14 +85,14 @@ · 55 unmodified lines
9485 label = "PB_RST";
9586 gpios = <&pioB 30 GPIO_ACTIVE_HIGH>;
9687 linux,code = <0x100>;
97− gpio-key,wakeup;
88+ wakeup-source;
9889 };
9990
10091 user {
10192 label = "PB_USER";
10293 gpios = <&pioB 31 GPIO_ACTIVE_HIGH>;
10394 linux,code = <0x101>;
104− gpio-key,wakeup;
95+ wakeup-source;
10596 };
10697 };
10798
arch/arm/boot/dts/at91-kizbox2.dts+3−3
@@ -171,21 +171,21 @@ · 170 unmodified lines
171171 label = "PB_PROG";
172172 gpios = <&pioE 27 GPIO_ACTIVE_LOW>;
173173 linux,code = <0x102>;
174− gpio-key,wakeup;
174+ wakeup-source;
175175 };
176176
177177 reset {
178178 label = "PB_RST";
179179 gpios = <&pioE 29 GPIO_ACTIVE_LOW>;
180180 linux,code = <0x100>;
181− gpio-key,wakeup;
181+ wakeup-source;
182182 };
183183
184184 user {
185185 label = "PB_USER";
186186 gpios = <&pioE 31 GPIO_ACTIVE_HIGH>;
187187 linux,code = <0x101>;
188− gpio-key,wakeup;
188+ wakeup-source;
189189 };
190190 };
191191
arch/arm/boot/dts/at91-kizboxmini.dts+2−2
@@ -98,14 +98,14 @@ · 97 unmodified lines
9898 label = "PB_PROG";
9999 gpios = <&pioC 17 GPIO_ACTIVE_LOW>;
100100 linux,code = <0x102>;
101− gpio-key,wakeup;
101+ wakeup-source;
102102 };
103103
104104 reset {
105105 label = "PB_RST";
106106 gpios = <&pioC 16 GPIO_ACTIVE_LOW>;
107107 linux,code = <0x100>;
108− gpio-key,wakeup;
108+ wakeup-source;
109109 };
110110 };
111111
arch/arm/boot/dts/at91-qil_a9260.dts+1−1
@@ -183,7 +183,7 @@ · 182 unmodified lines
183183 label = "user_pb";
184184 gpios = <&pioB 10 GPIO_ACTIVE_LOW>;
185185 linux,code = <28>;
186− gpio-key,wakeup;
186+ wakeup-source;
187187 };
188188 };
189189
arch/arm/boot/dts/at91-sama5d2_xplained.dts+106−9
@@ -45,6 +45,7 @@ · 44 unmodified lines
4545 /dts-v1/;
4646 #include "sama5d2.dtsi"
4747 #include "sama5d2-pinfunc.h"
48+#include <dt-bindings/mfd/atmel-flexcom.h>
4849
4950 / {
5051 model = "Atmel SAMA5D2 Xplained";
@@ -59,15 +60,6 @@ · 8 unmodified lines
5960 };
6061
6162 clocks {
62− #address-cells = <1>;
63− #size-cells = <1>;
64− ranges;
65−
66− main_clock: clock@0 {
67− compatible = "atmel,osc", "fixed-clock";
68− clock-frequency = <12000000>;
69− };
70−
7163 slow_xtal {
7264 clock-frequency = <32768>;
7365 };
@@ -91,6 +83,22 @@ · 17 unmodified lines
9183 status = "okay";
9284 };
9385
86+ sdmmc0: sdio-host@a0000000 {
87+ bus-width = <8>;
88+ pinctrl-names = "default";
89+ pinctrl-0 = <&pinctrl_sdmmc0_default>;
90+ non-removable;
91+ mmc-ddr-1_8v;
92+ status = "okay";
93+ };
94+
95+ sdmmc1: sdio-host@b0000000 {
96+ bus-width = <4>;
97+ pinctrl-names = "default";
98+ pinctrl-0 = <&pinctrl_sdmmc1_default>;
99+ status = "okay"; /* conflict with qspi0 */
100+ };
101+
94102 apb {
95103 spi0: spi@f8000000 {
96104 pinctrl-names = "default";
@@ -181,12 +189,49 @@ · 84 unmodified lines
181189 };
182190 };
183191
192+ flx0: flexcom@f8034000 {
193+ atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;
194+ status = "disabled"; /* conflict with ISC_D2 & ISC_D3 data pins */
195+
196+ uart5: serial@200 {
197+ compatible = "atmel,at91sam9260-usart";
198+ reg = <0x200 0x200>;
199+ interrupts = <19 IRQ_TYPE_LEVEL_HIGH 7>;
200+ clocks = <&flx0_clk>;
201+ clock-names = "usart";
202+ pinctrl-names = "default";
203+ pinctrl-0 = <&pinctrl_flx0_default>;
204+ atmel,fifo-size = <32>;
205+ status = "okay";
206+ };
207+ };
208+
184209 uart3: serial@fc008000 {
185210 pinctrl-names = "default";
186211 pinctrl-0 = <&pinctrl_uart3_default>;
187212 status = "okay";
188213 };
189214
215+ flx4: flexcom@fc018000 {
216+ atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>;
217+ status = "okay";
218+
219+ i2c2: i2c@600 {
220+ compatible = "atmel,sama5d2-i2c";
221+ reg = <0x600 0x200>;
222+ interrupts = <23 IRQ_TYPE_LEVEL_HIGH 7>;
223+ dmas = <0>, <0>;
224+ dma-names = "tx", "rx";
225+ #address-cells = <1>;
226+ #size-cells = <0>;
227+ clocks = <&flx4_clk>;
228+ pinctrl-names = "default";
229+ pinctrl-0 = <&pinctrl_flx4_default>;
230+ atmel,fifo-size = <16>;
231+ status = "okay";
232+ };
233+ };
234+
190235 i2c1: i2c@fc028000 {
191236 dmas = <0>, <0>;
192237 pinctrl-names = "default";
@@ -201,6 +246,18 @@ · 8 unmodified lines
201246 };
202247
203248 pinctrl@fc038000 {
249+ pinctrl_flx0_default: flx0_default {
250+ pinmux = <PIN_PB28__FLEXCOM0_IO0>,
251+ <PIN_PB29__FLEXCOM0_IO1>;
252+ bias-disable;
253+ };
254+
255+ pinctrl_flx4_default: flx4_default {
256+ pinmux = <PIN_PD12__FLEXCOM4_IO0>,
257+ <PIN_PD13__FLEXCOM4_IO1>;
258+ bias-disable;
259+ };
260+
204261 pinctrl_i2c0_default: i2c0_default {
205262 pinmux = <PIN_PD21__TWD0>,
206263 <PIN_PD22__TWCK0>;
@@ -227,6 +284,46 @@ · 20 unmodified lines
227284 bias-disable;
228285 };
229286
287+ pinctrl_sdmmc0_default: sdmmc0_default {
288+ cmd_data {
289+ pinmux = <PIN_PA1__SDMMC0_CMD>,
290+ <PIN_PA2__SDMMC0_DAT0>,
291+ <PIN_PA3__SDMMC0_DAT1>,
292+ <PIN_PA4__SDMMC0_DAT2>,
293+ <PIN_PA5__SDMMC0_DAT3>,
294+ <PIN_PA6__SDMMC0_DAT4>,
295+ <PIN_PA7__SDMMC0_DAT5>,
296+ <PIN_PA8__SDMMC0_DAT6>,
297+ <PIN_PA9__SDMMC0_DAT7>;
298+ bias-pull-up;
299+ };
300+
301+ ck_cd_rstn_vddsel {
302+ pinmux = <PIN_PA0__SDMMC0_CK>,
303+ <PIN_PA10__SDMMC0_RSTN>,
304+ <PIN_PA11__SDMMC0_VDDSEL>,
305+ <PIN_PA13__SDMMC0_CD>;
306+ bias-disable;
307+ };
308+ };
309+
310+ pinctrl_sdmmc1_default: sdmmc1_default {
311+ cmd_data {
312+ pinmux = <PIN_PA28__SDMMC1_CMD>,
313+ <PIN_PA18__SDMMC1_DAT0>,
314+ <PIN_PA19__SDMMC1_DAT1>,
315+ <PIN_PA20__SDMMC1_DAT2>,
316+ <PIN_PA21__SDMMC1_DAT3>;
317+ bias-pull-up;
318+ };
319+
320+ conf-ck_cd {
321+ pinmux = <PIN_PA22__SDMMC1_CK>,
322+ <PIN_PA30__SDMMC1_CD>;
323+ bias-disable;
324+ };
325+ };
326+
230327 pinctrl_spi0_default: spi0_default {
231328 pinmux = <PIN_PA14__SPI0_SPCK>,
232329 <PIN_PA15__SPI0_MOSI>,
arch/arm/boot/dts/at91-sama5d3_xplained.dts+1−1
@@ -315,7 +315,7 @@ · 314 unmodified lines
315315 label = "PB_USER";
316316 gpios = <&pioE 29 GPIO_ACTIVE_LOW>;
317317 linux,code = <0x104>;
318− gpio-key,wakeup;
318+ wakeup-source;
319319 };
320320 };
321321
arch/arm/boot/dts/at91-sama5d4_xplained.dts+1−11
@@ -50,7 +50,6 @@ · 49 unmodified lines
5050 compatible = "atmel,sama5d4-xplained", "atmel,sama5d4", "atmel,sama5";
5151
5252 chosen {
53− bootargs = "ignore_loglevel earlyprintk";
5453 stdout-path = "serial0:115200n8";
5554 };
5655
@@ -59,15 +58,6 @@ · 2 unmodified lines
5958 };
6059
6160 clocks {
62− #address-cells = <1>;
63− #size-cells = <1>;
64− ranges;
65−
66− main_clock: clock@0 {
67− compatible = "atmel,osc", "fixed-clock";
68− clock-frequency = <12000000>;
69− };
70−
7161 slow_xtal {
7262 clock-frequency = <32768>;
7363 };
@@ -235,7 +225,7 @@ · 161 unmodified lines
235225 label = "pb_user1";
236226 gpios = <&pioE 8 GPIO_ACTIVE_HIGH>;
237227 linux,code = <0x100>;
238− gpio-key,wakeup;
228+ wakeup-source;
239229 };
240230 };
241231
arch/arm/boot/dts/at91-sama5d4ek.dts+1−11
@@ -50,7 +50,6 @@ · 49 unmodified lines
5050 compatible = "atmel,sama5d4ek", "atmel,sama5d4", "atmel,sama5";
5151
5252 chosen {
53− bootargs = "ignore_loglevel earlyprintk";
5453 stdout-path = "serial0:115200n8";
5554 };
5655
@@ -59,15 +58,6 @@ · 2 unmodified lines
5958 };
6059
6160 clocks {
62− #address-cells = <1>;
63− #size-cells = <1>;
64− ranges;
65−
66− main_clock: clock@0 {
67− compatible = "atmel,osc", "fixed-clock";
68− clock-frequency = <12000000>;
69− };
70−
7161 slow_xtal {
7262 clock-frequency = <32768>;
7363 };
@@ -304,7 +294,7 @@ · 230 unmodified lines
304294 label = "pb_user1";
305295 gpios = <&pioE 13 GPIO_ACTIVE_HIGH>;
306296 linux,code = <0x100>;
307− gpio-key,wakeup;
297+ wakeup-source;
308298 };
309299 };
310300
arch/arm/boot/dts/at91rm9200ek.dts+0−9
@@ -21,15 +21,6 @@ · 20 unmodified lines
2121 };
2222
2323 clocks {
24− #address-cells = <1>;
25− #size-cells = <1>;
26− ranges;
27−
28− main_clock: clock@0 {
29− compatible = "atmel,osc", "fixed-clock";
30− clock-frequency = <18432000>;
31− };
32−
3324 slow_xtal {
3425 clock-frequency = <32768>;
3526 };
arch/arm/boot/dts/at91sam9261ek.dts+5−14
@@ -22,15 +22,6 @@ · 21 unmodified lines
2222 };
2323
2424 clocks {
25− #address-cells = <1>;
26− #size-cells = <1>;
27− ranges;
28−
29− main_clock: clock@0 {
30− compatible = "atmel,osc", "fixed-clock";
31− clock-frequency = <18432000>;
32− };
33−
3425 slow_xtal {
3526 clock-frequency = <32768>;
3627 };
@@ -149,7 +140,7 @@ · 112 unmodified lines
149140 ti,debounce-tol = /bits/ 16 <65535>;
150141 ti,debounce-max = /bits/ 16 <1>;
151142
152− linux,wakeup;
143+ wakeup-source;
153144 };
154145 };
155146
@@ -193,28 +184,28 @@ · 37 unmodified lines
193184 label = "button_0";
194185 gpios = <&pioA 27 GPIO_ACTIVE_LOW>;
195186 linux,code = <256>;
196− gpio-key,wakeup;
187+ wakeup-source;
197188 };
198189
199190 button_1 {
200191 label = "button_1";
201192 gpios = <&pioA 26 GPIO_ACTIVE_LOW>;
202193 linux,code = <257>;
203− gpio-key,wakeup;
194+ wakeup-source;
204195 };
205196
206197 button_2 {
207198 label = "button_2";
208199 gpios = <&pioA 25 GPIO_ACTIVE_LOW>;
209200 linux,code = <258>;
210− gpio-key,wakeup;
201+ wakeup-source;
211202 };
212203
213204 button_3 {
214205 label = "button_3";
215206 gpios = <&pioA 24 GPIO_ACTIVE_LOW>;
216207 linux,code = <259>;
217− gpio-key,wakeup;
208+ wakeup-source;
218209 };
219210 };
220211 };
arch/arm/boot/dts/at91sam9263ek.dts+2−11
@@ -22,15 +22,6 @@ · 21 unmodified lines
2222 };
2323
2424 clocks {
25− #address-cells = <1>;
26− #size-cells = <1>;
27− ranges;
28−
29− main_clock: clock@0 {
30− compatible = "atmel,osc", "fixed-clock";
31− clock-frequency = <16367660>;
32− };
33−
3425 slow_xtal {
3526 clock-frequency = <32768>;
3627 };
@@ -213,14 +204,14 @@ · 176 unmodified lines
213204 label = "left_click";
214205 gpios = <&pioC 5 GPIO_ACTIVE_LOW>;
215206 linux,code = <272>;
216− gpio-key,wakeup;
207+ wakeup-source;
217208 };
218209
219210 right_click {
220211 label = "right_click";
221212 gpios = <&pioC 4 GPIO_ACTIVE_LOW>;
222213 linux,code = <273>;
223− gpio-key,wakeup;
214+ wakeup-source;
224215 };
225216 };
226217
arch/arm/boot/dts/at91sam9g20ek_common.dtsi+2−11
@@ -19,15 +19,6 @@ · 18 unmodified lines
1919 };
2020
2121 clocks {
22− #address-cells = <1>;
23− #size-cells = <1>;
24− ranges;
25−
26− main_clock: clock@0 {
27− compatible = "atmel,osc", "fixed-clock";
28− clock-frequency = <18432000>;
29− };
30−
3122 slow_xtal {
3223 clock-frequency = <32768>;
3324 };
@@ -206,14 +197,14 @@ · 172 unmodified lines
206197 label = "Button 3";
207198 gpios = <&pioA 30 GPIO_ACTIVE_LOW>;
208199 linux,code = <0x103>;
209− gpio-key,wakeup;
200+ wakeup-source;
210201 };
211202
212203 btn4 {
213204 label = "Button 4";
214205 gpios = <&pioA 31 GPIO_ACTIVE_LOW>;
215206 linux,code = <0x104>;
216− gpio-key,wakeup;
207+ wakeup-source;
217208 };
218209 };
219210
arch/arm/boot/dts/at91sam9m10g45ek.dts+2−11
@@ -24,15 +24,6 @@ · 23 unmodified lines
2424 };
2525
2626 clocks {
27− #address-cells = <1>;
28− #size-cells = <1>;
29− ranges;
30−
31− main_clock: clock@0 {
32− compatible = "atmel,osc", "fixed-clock";
33− clock-frequency = <12000000>;
34− };
35−
3627 slow_xtal {
3728 clock-frequency = <32768>;
3829 };
@@ -323,14 +314,14 @@ · 284 unmodified lines
323314 label = "left_click";
324315 gpios = <&pioB 6 GPIO_ACTIVE_LOW>;
325316 linux,code = <272>;
326− gpio-key,wakeup;
317+ wakeup-source;
327318 };
328319
329320 right_click {
330321 label = "right_click";
331322 gpios = <&pioB 7 GPIO_ACTIVE_LOW>;
332323 linux,code = <273>;
333− gpio-key,wakeup;
324+ wakeup-source;
334325 };
335326
336327 left {
arch/arm/boot/dts/at91sam9n12ek.dts+1−10
@@ -23,15 +23,6 @@ · 22 unmodified lines
2323 };
2424
2525 clocks {
26− #address-cells = <1>;
27− #size-cells = <1>;
28− ranges;
29−
30− main_clock: clock@0 {
31− compatible = "atmel,osc", "fixed-clock";
32− clock-frequency = <16000000>;
33− };
34−
3526 slow_xtal {
3627 clock-frequency = <32768>;
3728 };
@@ -219,7 +210,7 @@ · 181 unmodified lines
219210 label = "Enter";
220211 gpios = <&pioB 3 GPIO_ACTIVE_LOW>;
221212 linux,code = <28>;
222− gpio-key,wakeup;
213+ wakeup-source;
223214 };
224215 };
225216
arch/arm/boot/dts/at91sam9rlek.dts+2−11
@@ -22,15 +22,6 @@ · 21 unmodified lines
2222 };
2323
2424 clocks {
25− #address-cells = <1>;
26− #size-cells = <1>;
27− ranges;
28−
29− main_clock: clock {
30− compatible = "atmel,osc", "fixed-clock";
31− clock-frequency = <12000000>;
32− };
33−
3425 slow_xtal {
3526 clock-frequency = <32768>;
3627 };
@@ -225,14 +216,14 @@ · 188 unmodified lines
225216 label = "right_click";
226217 gpios = <&pioB 0 GPIO_ACTIVE_LOW>;
227218 linux,code = <273>;
228− gpio-key,wakeup;
219+ wakeup-source;
229220 };
230221
231222 left_click {
232223 label = "left_click";
233224 gpios = <&pioB 1 GPIO_ACTIVE_LOW>;
234225 linux,code = <272>;
235− gpio-key,wakeup;
226+ wakeup-source;
236227 };
237228 };
238229
arch/arm/boot/dts/at91sam9x5cm.dtsi+0−11
@@ -12,17 +12,6 @@ · 11 unmodified lines
1212 reg = <0x20000000 0x8000000>;
1313 };
1414
15− clocks {
16− #address-cells = <1>;
17− #size-cells = <1>;
18− ranges;
19−
20− main_clock: clock@0 {
21− compatible = "atmel,osc", "fixed-clock";
22− clock-frequency = <12000000>;
23− };
24− };
25−
2615 clocks {
2716 slow_xtal {
2817 clock-frequency = <32768>;
arch/arm/boot/dts/dra7.dtsi+2−2
@@ -1459,8 +1459,8 @@ · 1458 unmodified lines
14591459 interrupt-names = "tx", "rx";
14601460 dmas = <&sdma_xbar 133>, <&sdma_xbar 132>;
14611461 dma-names = "tx", "rx";
1462− clocks = <&mcasp3_ahclkx_mux>;
1463− clock-names = "fck";
1462+ clocks = <&mcasp3_aux_gfclk_mux>, <&mcasp3_ahclkx_mux>;
1463+ clock-names = "fck", "ahclkx";
14641464 status = "disabled";
14651465 };
14661466
arch/arm/boot/dts/imx27.dtsi+12−4
@@ -486,7 +486,10 @@ · 485 unmodified lines
486486 compatible = "fsl,imx27-usb";
487487 reg = <0x10024000 0x200>;
488488 interrupts = <56>;
489− clocks = <&clks IMX27_CLK_USB_IPG_GATE>;
489+ clocks = <&clks IMX27_CLK_USB_IPG_GATE>,
490+ <&clks IMX27_CLK_USB_AHB_GATE>,
491+ <&clks IMX27_CLK_USB_DIV>;
492+ clock-names = "ipg", "ahb", "per";
490493 fsl,usbmisc = <&usbmisc 0>;
491494 status = "disabled";
492495 };
@@ -495,7 +498,10 @@ · 2 unmodified lines
495498 compatible = "fsl,imx27-usb";
496499 reg = <0x10024200 0x200>;
497500 interrupts = <54>;
498− clocks = <&clks IMX27_CLK_USB_IPG_GATE>;
501+ clocks = <&clks IMX27_CLK_USB_IPG_GATE>,
502+ <&clks IMX27_CLK_USB_AHB_GATE>,
503+ <&clks IMX27_CLK_USB_DIV>;
504+ clock-names = "ipg", "ahb", "per";
499505 fsl,usbmisc = <&usbmisc 1>;
500506 dr_mode = "host";
501507 status = "disabled";
@@ -505,7 +511,10 @@ · 3 unmodified lines
505511 compatible = "fsl,imx27-usb";
506512 reg = <0x10024400 0x200>;
507513 interrupts = <55>;
508− clocks = <&clks IMX27_CLK_USB_IPG_GATE>;
514+ clocks = <&clks IMX27_CLK_USB_IPG_GATE>,
515+ <&clks IMX27_CLK_USB_AHB_GATE>,
516+ <&clks IMX27_CLK_USB_DIV>;
517+ clock-names = "ipg", "ahb", "per";
509518 fsl,usbmisc = <&usbmisc 2>;
510519 dr_mode = "host";
511520 status = "disabled";
@@ -515,7 +524,6 @@ · 3 unmodified lines
515524 #index-cells = <1>;
516525 compatible = "fsl,imx27-usbmisc";
517526 reg = <0x10024600 0x200>;
518− clocks = <&clks IMX27_CLK_USB_AHB_GATE>;
519527 };
520528
521529 sahara2: sahara@10025000 {
arch/arm/boot/dts/k2l-netcp.dtsi+1−1
@@ -137,7 +137,7 @@ netcp: netcp@26000000 { · 136 unmodified lines
137137 /* NetCP address range */
138138 ranges = <0 0x26000000 0x1000000>;
139139
140− clocks = <&papllclk>, <&clkcpgmac>, <&chipclk12>;
140+ clocks = <&clkosr>, <&papllclk>, <&clkcpgmac>, <&chipclk12>;
141141 dma-coherent;
142142
143143 ti,navigator-dmas = <&dma_gbe 0>,
arch/arm/boot/dts/kirkwood-ts219.dtsi+1−1
@@ -40,7 +40,7 @@ · 39 unmodified lines
4040 };
4141 poweroff@12100 {
4242 compatible = "qnap,power-off";
43− reg = <0x12000 0x100>;
43+ reg = <0x12100 0x100>;
4444 clocks = <&gate_clk 7>;
4545 };
4646 spi@10600 {
arch/arm/boot/dts/rk3288-veyron-minnie.dts+4−0
@@ -86,6 +86,10 @@ · 85 unmodified lines
8686 };
8787 };
8888
89+&emmc {
90+ /delete-property/mmc-hs200-1_8v;
91+};
92+
8993 &gpio_keys {
9094 pinctrl-0 = <&pwr_key_l &ap_lid_int_l &volum_down_l &volum_up_l>;
9195
arch/arm/boot/dts/rk3288.dtsi+8−2
@@ -452,8 +452,10 @@ · 451 unmodified lines
452452 clock-names = "tsadc", "apb_pclk";
453453 resets = <&cru SRST_TSADC>;
454454 reset-names = "tsadc-apb";
455− pinctrl-names = "default";
456− pinctrl-0 = <&otp_out>;
455+ pinctrl-names = "init", "default", "sleep";
456+ pinctrl-0 = <&otp_gpio>;
457+ pinctrl-1 = <&otp_out>;
458+ pinctrl-2 = <&otp_gpio>;
457459 #thermal-sensor-cells = <1>;
458460 rockchip,hw-tshut-temp = <95000>;
459461 status = "disabled";
@@ -1395,6 +1397,10 @@ · 935 unmodified lines
13951397 };
13961398
13971399 tsadc {
1400+ otp_gpio: otp-gpio {
1401+ rockchip,pins = <0 10 RK_FUNC_GPIO &pcfg_pull_none>;
1402+ };
1403+
13981404 otp_out: otp-out {
13991405 rockchip,pins = <0 10 RK_FUNC_1 &pcfg_pull_none>;
14001406 };
arch/arm/boot/dts/sama5d35ek.dts+1−1
@@ -49,7 +49,7 @@ · 48 unmodified lines
4949 label = "pb_user1";
5050 gpios = <&pioE 27 GPIO_ACTIVE_HIGH>;
5151 linux,code = <0x100>;
52− gpio-key,wakeup;
52+ wakeup-source;
5353 };
5454 };
5555 };
arch/arm/boot/dts/sama5d4.dtsi+1−1
@@ -1300,7 +1300,7 @@ · 1299 unmodified lines
13001300 };
13011301
13021302 watchdog@fc068640 {
1303− compatible = "atmel,at91sam9260-wdt";
1303+ compatible = "atmel,sama5d4-wdt";
13041304 reg = <0xfc068640 0x10>;
13051305 clocks = <&clk32k>;
13061306 status = "disabled";
arch/arm/boot/dts/usb_a9260_common.dtsi+1−1
@@ -115,7 +115,7 @@ · 114 unmodified lines
115115 label = "user_pb";
116116 gpios = <&pioB 10 GPIO_ACTIVE_LOW>;
117117 linux,code = <28>;
118− gpio-key,wakeup;
118+ wakeup-source;
119119 };
120120 };
121121
arch/arm/boot/dts/usb_a9263.dts+1−1
@@ -143,7 +143,7 @@ · 142 unmodified lines
143143 label = "user_pb";
144144 gpios = <&pioB 10 GPIO_ACTIVE_LOW>;
145145 linux,code = <28>;
146− gpio-key,wakeup;
146+ wakeup-source;
147147 };
148148 };
149149
arch/arm/boot/dts/vfxxx.dtsi+4−4
@@ -158,7 +158,7 @@ · 157 unmodified lines
158158 interrupts = <67 IRQ_TYPE_LEVEL_HIGH>;
159159 clocks = <&clks VF610_CLK_DSPI0>;
160160 clock-names = "dspi";
161− spi-num-chipselects = <5>;
161+ spi-num-chipselects = <6>;
162162 status = "disabled";
163163 };
164164
@@ -170,7 +170,7 @@ · 5 unmodified lines
170170 interrupts = <68 IRQ_TYPE_LEVEL_HIGH>;
171171 clocks = <&clks VF610_CLK_DSPI1>;
172172 clock-names = "dspi";
173− spi-num-chipselects = <5>;
173+ spi-num-chipselects = <4>;
174174 status = "disabled";
175175 };
176176
@@ -461,6 +461,8 @@ · 284 unmodified lines
461461 clock-names = "adc";
462462 #io-channel-cells = <1>;
463463 status = "disabled";
464+ fsl,adck-max-frequency = <30000000>, <40000000>,
465+ <20000000>;
464466 };
465467
466468 esdhc0: esdhc@400b1000 {
@@ -472,8 +474,6 @@ · 5 unmodified lines
472474 <&clks VF610_CLK_ESDHC0>;
473475 clock-names = "ipg", "ahb", "per";
474476 status = "disabled";
475− fsl,adck-max-frequency = <30000000>, <40000000>,
476− <20000000>;
477477 };
478478
479479 esdhc1: esdhc@400b2000 {
arch/arm/configs/at91_dt_defconfig+0−1
@@ -125,7 +125,6 @@ CONFIG_POWER_RESET=y · 124 unmodified lines
125125 # CONFIG_HWMON is not set
126126 CONFIG_WATCHDOG=y
127127 CONFIG_AT91SAM9X_WATCHDOG=y
128−CONFIG_SSB=m
129128 CONFIG_MFD_ATMEL_HLCDC=y
130129 CONFIG_REGULATOR=y
131130 CONFIG_REGULATOR_FIXED_VOLTAGE=y
arch/arm/configs/sama5_defconfig+0−1
@@ -129,7 +129,6 @@ CONFIG_GPIO_SYSFS=y · 128 unmodified lines
129129 CONFIG_POWER_SUPPLY=y
130130 CONFIG_POWER_RESET=y
131131 # CONFIG_HWMON is not set
132−CONFIG_SSB=m
133132 CONFIG_MFD_ATMEL_FLEXCOM=y
134133 CONFIG_REGULATOR=y
135134 CONFIG_REGULATOR_FIXED_VOLTAGE=y
arch/arm/include/asm/irq.h+5−0
@@ -40,6 +40,11 @@ extern void arch_trigger_all_cpu_backtrace(bool); · 39 unmodified lines
4040 #define arch_trigger_all_cpu_backtrace(x) arch_trigger_all_cpu_backtrace(x)
4141 #endif
4242
43+static inline int nr_legacy_irqs(void)
44+{
45+ return NR_IRQS_LEGACY;
46+}
47+
4348 #endif
4449
4550 #endif
arch/arm/include/asm/kvm_emulate.h+12−0
@@ -28,6 +28,18 @@ · 27 unmodified lines
2828 unsigned long *vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num);
2929 unsigned long *vcpu_spsr(struct kvm_vcpu *vcpu);
3030
31+static inline unsigned long vcpu_get_reg(struct kvm_vcpu *vcpu,
32+ u8 reg_num)
33+{
34+ return *vcpu_reg(vcpu, reg_num);
35+}
36+
37+static inline void vcpu_set_reg(struct kvm_vcpu *vcpu, u8 reg_num,
38+ unsigned long val)
39+{
40+ *vcpu_reg(vcpu, reg_num) = val;
41+}
42+
3143 bool kvm_condition_valid(struct kvm_vcpu *vcpu);
3244 void kvm_skip_instr(struct kvm_vcpu *vcpu, bool is_wide_instr);
3345 void kvm_inject_undefined(struct kvm_vcpu *vcpu);
arch/arm/include/uapi/asm/unistd.h+1−0
@@ -416,6 +416,7 @@ · 415 unmodified lines
416416 #define __NR_execveat (__NR_SYSCALL_BASE+387)
417417 #define __NR_userfaultfd (__NR_SYSCALL_BASE+388)
418418 #define __NR_membarrier (__NR_SYSCALL_BASE+389)
419+#define __NR_mlock2 (__NR_SYSCALL_BASE+390)
419420
420421 /*
421422 * The following SWIs are ARM private.
arch/arm/kernel/bios32.c+11−8
@@ -17,11 +17,6 @@ · 16 unmodified lines
1717 #include <asm/mach/pci.h>
1818
1919 static int debug_pci;
20−static resource_size_t (*align_resource)(struct pci_dev *dev,
21− const struct resource *res,
22− resource_size_t start,
23− resource_size_t size,
24− resource_size_t align) = NULL;
2520
2621 /*
2722 * We can't use pci_get_device() here since we are
@@ -461,7 +456,6 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw, · 433 unmodified lines
461456 sys->busnr = busnr;
462457 sys->swizzle = hw->swizzle;
463458 sys->map_irq = hw->map_irq;
464− align_resource = hw->align_resource;
465459 INIT_LIST_HEAD(&sys->resources);
466460
467461 if (hw->private_data)
@@ -470,6 +464,8 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw, · 2 unmodified lines
470464 ret = hw->setup(nr, sys);
471465
472466 if (ret > 0) {
467+ struct pci_host_bridge *host_bridge;
468+
473469 ret = pcibios_init_resources(nr, sys);
474470 if (ret) {
475471 kfree(sys);
@@ -491,6 +487,9 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw, · 15 unmodified lines
491487 busnr = sys->bus->busn_res.end + 1;
492488
493489 list_add(&sys->node, head);
490+
491+ host_bridge = pci_find_host_bridge(sys->bus);
492+ host_bridge->align_resource = hw->align_resource;
494493 } else {
495494 kfree(sys);
496495 if (ret < 0)
@@ -578,14 +577,18 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res, · 81 unmodified lines
578577 {
579578 struct pci_dev *dev = data;
580579 resource_size_t start = res->start;
580+ struct pci_host_bridge *host_bridge;
581581
582582 if (res->flags & IORESOURCE_IO && start & 0x300)
583583 start = (start + 0x3ff) & ~0x3ff;
584584
585585 start = (start + align - 1) & ~(align - 1);
586586
587− if (align_resource)
588− return align_resource(dev, res, start, size, align);
587+ host_bridge = pci_find_host_bridge(dev->bus);
588+
589+ if (host_bridge->align_resource)
590+ return host_bridge->align_resource(dev, res,
591+ start, size, align);
589592
590593 return start;
591594 }
arch/arm/kernel/calls.S+1−0
@@ -399,6 +399,7 @@ · 398 unmodified lines
399399 CALL(sys_execveat)
400400 CALL(sys_userfaultfd)
401401 CALL(sys_membarrier)
402+ CALL(sys_mlock2)
402403 #ifndef syscalls_counted
403404 .equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls
404405 #define syscalls_counted
arch/arm/kvm/arm.c+1−6
@@ -563,18 +563,13 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) · 562 unmodified lines
563563 if (vcpu->arch.power_off || vcpu->arch.pause)
564564 vcpu_sleep(vcpu);
565565
566− /*
567− * Disarming the background timer must be done in a
568− * preemptible context, as this call may sleep.
569− */
570− kvm_timer_flush_hwstate(vcpu);
571−
572566 /*
573567 * Preparing the interrupts to be injected also
574568 * involves poking the GIC, which must be done in a
575569 * non-preemptible context.
576570 */
577571 preempt_disable();
572+ kvm_timer_flush_hwstate(vcpu);
578573 kvm_vgic_flush_hwstate(vcpu);
579574
580575 local_irq_disable();
arch/arm/kvm/mmio.c+3−2
@@ -115,7 +115,7 @@ int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run) · 114 unmodified lines
115115 trace_kvm_mmio(KVM_TRACE_MMIO_READ, len, run->mmio.phys_addr,
116116 data);
117117 data = vcpu_data_host_to_guest(vcpu, data, len);
118− *vcpu_reg(vcpu, vcpu->arch.mmio_decode.rt) = data;
118+ vcpu_set_reg(vcpu, vcpu->arch.mmio_decode.rt, data);
119119 }
120120
121121 return 0;
@@ -186,7 +186,8 @@ int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run, · 64 unmodified lines
186186 rt = vcpu->arch.mmio_decode.rt;
187187
188188 if (is_write) {
189− data = vcpu_data_guest_to_host(vcpu, *vcpu_reg(vcpu, rt), len);
189+ data = vcpu_data_guest_to_host(vcpu, vcpu_get_reg(vcpu, rt),
190+ len);
190191
191192 trace_kvm_mmio(KVM_TRACE_MMIO_WRITE, len, fault_ipa, data);
192193 mmio_write_buf(data_buf, len, data);
arch/arm/kvm/mmu.c+7−8
@@ -98,6 +98,11 @@ static void kvm_flush_dcache_pud(pud_t pud) · 97 unmodified lines
9898 __kvm_flush_dcache_pud(pud);
9999 }
100100
101+static bool kvm_is_device_pfn(unsigned long pfn)
102+{
103+ return !pfn_valid(pfn);
104+}
105+
101106 /**
102107 * stage2_dissolve_pmd() - clear and flush huge PMD entry
103108 * @kvm: pointer to kvm structure.
@@ -213,7 +218,7 @@ static void unmap_ptes(struct kvm *kvm, pmd_t *pmd, · 109 unmodified lines
213218 kvm_tlb_flush_vmid_ipa(kvm, addr);
214219
215220 /* No need to invalidate the cache for device mappings */
216− if ((pte_val(old_pte) & PAGE_S2_DEVICE) != PAGE_S2_DEVICE)
221+ if (!kvm_is_device_pfn(pte_pfn(old_pte)))
217222 kvm_flush_dcache_pte(old_pte);
218223
219224 put_page(virt_to_page(pte));
@@ -305,8 +310,7 @@ static void stage2_flush_ptes(struct kvm *kvm, pmd_t *pmd, · 85 unmodified lines
305310
306311 pte = pte_offset_kernel(pmd, addr);
307312 do {
308− if (!pte_none(*pte) &&
309− (pte_val(*pte) & PAGE_S2_DEVICE) != PAGE_S2_DEVICE)
313+ if (!pte_none(*pte) && !kvm_is_device_pfn(pte_pfn(*pte)))
310314 kvm_flush_dcache_pte(*pte);
311315 } while (pte++, addr += PAGE_SIZE, addr != end);
312316 }
@@ -1037,11 +1041,6 @@ static bool kvm_is_write_fault(struct kvm_vcpu *vcpu) · 724 unmodified lines
10371041 return kvm_vcpu_dabt_iswrite(vcpu);
10381042 }
10391043
1040−static bool kvm_is_device_pfn(unsigned long pfn)
1041−{
1042− return !pfn_valid(pfn);
1043−}
1044−
10451044 /**
10461045 * stage2_wp_ptes - write protect PMD range
10471046 * @pmd: pointer to pmd entry
arch/arm/kvm/psci.c+10−10
@@ -75,7 +75,7 @@ static unsigned long kvm_psci_vcpu_on(struct kvm_vcpu *source_vcpu) · 74 unmodified lines
7575 unsigned long context_id;
7676 phys_addr_t target_pc;
7777
78− cpu_id = *vcpu_reg(source_vcpu, 1) & MPIDR_HWID_BITMASK;
78+ cpu_id = vcpu_get_reg(source_vcpu, 1) & MPIDR_HWID_BITMASK;
7979 if (vcpu_mode_is_32bit(source_vcpu))
8080 cpu_id &= ~((u32) 0);
8181
@@ -94,8 +94,8 @@ static unsigned long kvm_psci_vcpu_on(struct kvm_vcpu *source_vcpu) · 12 unmodified lines
9494 return PSCI_RET_INVALID_PARAMS;
9595 }
9696
97− target_pc = *vcpu_reg(source_vcpu, 2);
98− context_id = *vcpu_reg(source_vcpu, 3);
97+ target_pc = vcpu_get_reg(source_vcpu, 2);
98+ context_id = vcpu_get_reg(source_vcpu, 3);
9999
100100 kvm_reset_vcpu(vcpu);
101101
@@ -114,7 +114,7 @@ static unsigned long kvm_psci_vcpu_on(struct kvm_vcpu *source_vcpu) · 12 unmodified lines
114114 * NOTE: We always update r0 (or x0) because for PSCI v0.1
115115 * the general puspose registers are undefined upon CPU_ON.
116116 */
117− *vcpu_reg(vcpu, 0) = context_id;
117+ vcpu_set_reg(vcpu, 0, context_id);
118118 vcpu->arch.power_off = false;
119119 smp_mb(); /* Make sure the above is visible */
120120
@@ -134,8 +134,8 @@ static unsigned long kvm_psci_vcpu_affinity_info(struct kvm_vcpu *vcpu) · 13 unmodified lines
134134 struct kvm *kvm = vcpu->kvm;
135135 struct kvm_vcpu *tmp;
136136
137− target_affinity = *vcpu_reg(vcpu, 1);
138− lowest_affinity_level = *vcpu_reg(vcpu, 2);
137+ target_affinity = vcpu_get_reg(vcpu, 1);
138+ lowest_affinity_level = vcpu_get_reg(vcpu, 2);
139139
140140 /* Determine target affinity mask */
141141 target_affinity_mask = psci_affinity_mask(lowest_affinity_level);
@@ -209,7 +209,7 @@ int kvm_psci_version(struct kvm_vcpu *vcpu) · 67 unmodified lines
209209 static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu)
210210 {
211211 int ret = 1;
212− unsigned long psci_fn = *vcpu_reg(vcpu, 0) & ~((u32) 0);
212+ unsigned long psci_fn = vcpu_get_reg(vcpu, 0) & ~((u32) 0);
213213 unsigned long val;
214214
215215 switch (psci_fn) {
@@ -273,13 +273,13 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu) · 57 unmodified lines
273273 break;
274274 }
275275
276− *vcpu_reg(vcpu, 0) = val;
276+ vcpu_set_reg(vcpu, 0, val);
277277 return ret;
278278 }
279279
280280 static int kvm_psci_0_1_call(struct kvm_vcpu *vcpu)
281281 {
282− unsigned long psci_fn = *vcpu_reg(vcpu, 0) & ~((u32) 0);
282+ unsigned long psci_fn = vcpu_get_reg(vcpu, 0) & ~((u32) 0);
283283 unsigned long val;
284284
285285 switch (psci_fn) {
@@ -295,7 +295,7 @@ static int kvm_psci_0_1_call(struct kvm_vcpu *vcpu) · 9 unmodified lines
295295 break;
296296 }
297297
298− *vcpu_reg(vcpu, 0) = val;
298+ vcpu_set_reg(vcpu, 0, val);
299299 return 1;
300300 }
301301
arch/arm/mach-dove/include/mach/entry-macro.S+2−2
@@ -18,13 +18,13 @@ · 17 unmodified lines
1818 @ check low interrupts
1919 ldr \irqstat, [\base, #IRQ_CAUSE_LOW_OFF]
2020 ldr \tmp, [\base, #IRQ_MASK_LOW_OFF]
21− mov \irqnr, #31
21+ mov \irqnr, #32
2222 ands \irqstat, \irqstat, \tmp
2323
2424 @ if no low interrupts set, check high interrupts
2525 ldreq \irqstat, [\base, #IRQ_CAUSE_HIGH_OFF]
2626 ldreq \tmp, [\base, #IRQ_MASK_HIGH_OFF]
27− moveq \irqnr, #63
27+ moveq \irqnr, #64
2828 andeqs \irqstat, \irqstat, \tmp
2929
3030 @ find first active interrupt source
arch/arm/mach-imx/gpc.c+1−0
@@ -177,6 +177,7 @@ static struct irq_chip imx_gpc_chip = { · 176 unmodified lines
177177 .irq_unmask = imx_gpc_irq_unmask,
178178 .irq_retrigger = irq_chip_retrigger_hierarchy,
179179 .irq_set_wake = imx_gpc_irq_set_wake,
180+ .irq_set_type = irq_chip_set_type_parent,
180181 #ifdef CONFIG_SMP
181182 .irq_set_affinity = irq_chip_set_affinity_parent,
182183 #endif
arch/arm/mach-omap2/omap-smp.c+3−3
@@ -143,9 +143,9 @@ static int omap4_boot_secondary(unsigned int cpu, struct task_struct *idle) · 142 unmodified lines
143143 * Ensure that CPU power state is set to ON to avoid CPU
144144 * powerdomain transition on wfi
145145 */
146− clkdm_wakeup(cpu1_clkdm);
147− omap_set_pwrdm_state(cpu1_pwrdm, PWRDM_POWER_ON);
148− clkdm_allow_idle(cpu1_clkdm);
146+ clkdm_wakeup_nolock(cpu1_clkdm);
147+ pwrdm_set_next_pwrst(cpu1_pwrdm, PWRDM_POWER_ON);
148+ clkdm_allow_idle_nolock(cpu1_clkdm);
149149
150150 if (IS_PM44XX_ERRATUM(PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD)) {
151151 while (gic_dist_disabled()) {
arch/arm/mach-omap2/omap_hwmod.c+36−30
@@ -890,6 +890,36 @@ static int _init_opt_clks(struct omap_hwmod *oh) · 889 unmodified lines
890890 return ret;
891891 }
892892
893+static void _enable_optional_clocks(struct omap_hwmod *oh)
894+{
895+ struct omap_hwmod_opt_clk *oc;
896+ int i;
897+
898+ pr_debug("omap_hwmod: %s: enabling optional clocks\n", oh->name);
899+
900+ for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++)
901+ if (oc->_clk) {
902+ pr_debug("omap_hwmod: enable %s:%s\n", oc->role,
903+ __clk_get_name(oc->_clk));
904+ clk_enable(oc->_clk);
905+ }
906+}
907+
908+static void _disable_optional_clocks(struct omap_hwmod *oh)
909+{
910+ struct omap_hwmod_opt_clk *oc;
911+ int i;
912+
913+ pr_debug("omap_hwmod: %s: disabling optional clocks\n", oh->name);
914+
915+ for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++)
916+ if (oc->_clk) {
917+ pr_debug("omap_hwmod: disable %s:%s\n", oc->role,
918+ __clk_get_name(oc->_clk));
919+ clk_disable(oc->_clk);
920+ }
921+}
922+
893923 /**
894924 * _enable_clocks - enable hwmod main clock and interface clocks
895925 * @oh: struct omap_hwmod *
@@ -917,6 +947,9 @@ static int _enable_clocks(struct omap_hwmod *oh) · 21 unmodified lines
917947 clk_enable(os->_clk);
918948 }
919949
950+ if (oh->flags & HWMOD_OPT_CLKS_NEEDED)
951+ _enable_optional_clocks(oh);
952+
920953 /* The opt clocks are controlled by the device driver. */
921954
922955 return 0;
@@ -948,41 +981,14 @@ static int _disable_clocks(struct omap_hwmod *oh) · 25 unmodified lines
948981 clk_disable(os->_clk);
949982 }
950983
984+ if (oh->flags & HWMOD_OPT_CLKS_NEEDED)
985+ _disable_optional_clocks(oh);
986+
951987 /* The opt clocks are controlled by the device driver. */
952988
953989 return 0;
954990 }
955991
956−static void _enable_optional_clocks(struct omap_hwmod *oh)
957−{
958− struct omap_hwmod_opt_clk *oc;
959− int i;
960−
961− pr_debug("omap_hwmod: %s: enabling optional clocks\n", oh->name);
962−
963− for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++)
964− if (oc->_clk) {
965− pr_debug("omap_hwmod: enable %s:%s\n", oc->role,
966− __clk_get_name(oc->_clk));
967− clk_enable(oc->_clk);
968− }
969−}
970−
971−static void _disable_optional_clocks(struct omap_hwmod *oh)
972−{
973− struct omap_hwmod_opt_clk *oc;
974− int i;
975−
976− pr_debug("omap_hwmod: %s: disabling optional clocks\n", oh->name);
977−
978− for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++)
979− if (oc->_clk) {
980− pr_debug("omap_hwmod: disable %s:%s\n", oc->role,
981− __clk_get_name(oc->_clk));
982− clk_disable(oc->_clk);
983− }
984−}
985−
986992 /**
987993 * _omap4_enable_module - enable CLKCTRL modulemode on OMAP4
988994 * @oh: struct omap_hwmod *
arch/arm/mach-omap2/omap_hwmod.h+3−0
@@ -523,6 +523,8 @@ struct omap_hwmod_omap4_prcm { · 522 unmodified lines
523523 * HWMOD_RECONFIG_IO_CHAIN: omap_hwmod code needs to reconfigure wake-up
524524 * events by calling _reconfigure_io_chain() when a device is enabled
525525 * or idled.
526+ * HWMOD_OPT_CLKS_NEEDED: The optional clocks are needed for the module to
527+ * operate and they need to be handled at the same time as the main_clk.
526528 */
527529 #define HWMOD_SWSUP_SIDLE (1 << 0)
528530 #define HWMOD_SWSUP_MSTANDBY (1 << 1)
@@ -538,6 +540,7 @@ struct omap_hwmod_omap4_prcm { · 9 unmodified lines
538540 #define HWMOD_FORCE_MSTANDBY (1 << 11)
539541 #define HWMOD_SWSUP_SIDLE_ACT (1 << 12)
540542 #define HWMOD_RECONFIG_IO_CHAIN (1 << 13)
543+#define HWMOD_OPT_CLKS_NEEDED (1 << 14)
541544
542545 /*
543546 * omap_hwmod._int_flags definitions
arch/arm/mach-omap2/omap_hwmod_7xx_data.c+56−0
@@ -1297,6 +1297,44 @@ static struct omap_hwmod dra7xx_mcspi4_hwmod = { · 1296 unmodified lines
12971297 .dev_attr = &mcspi4_dev_attr,
12981298 };
12991299
1300+/*
1301+ * 'mcasp' class
1302+ *
1303+ */
1304+static struct omap_hwmod_class_sysconfig dra7xx_mcasp_sysc = {
1305+ .sysc_offs = 0x0004,
1306+ .sysc_flags = SYSC_HAS_SIDLEMODE,
1307+ .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
1308+ .sysc_fields = &omap_hwmod_sysc_type3,
1309+};
1310+
1311+static struct omap_hwmod_class dra7xx_mcasp_hwmod_class = {
1312+ .name = "mcasp",
1313+ .sysc = &dra7xx_mcasp_sysc,
1314+};
1315+
1316+/* mcasp3 */
1317+static struct omap_hwmod_opt_clk mcasp3_opt_clks[] = {
1318+ { .role = "ahclkx", .clk = "mcasp3_ahclkx_mux" },
1319+};
1320+
1321+static struct omap_hwmod dra7xx_mcasp3_hwmod = {
1322+ .name = "mcasp3",
1323+ .class = &dra7xx_mcasp_hwmod_class,
1324+ .clkdm_name = "l4per2_clkdm",
1325+ .main_clk = "mcasp3_aux_gfclk_mux",
1326+ .flags = HWMOD_OPT_CLKS_NEEDED,
1327+ .prcm = {
1328+ .omap4 = {
1329+ .clkctrl_offs = DRA7XX_CM_L4PER2_MCASP3_CLKCTRL_OFFSET,
1330+ .context_offs = DRA7XX_RM_L4PER2_MCASP3_CONTEXT_OFFSET,
1331+ .modulemode = MODULEMODE_SWCTRL,
1332+ },
1333+ },
1334+ .opt_clks = mcasp3_opt_clks,
1335+ .opt_clks_cnt = ARRAY_SIZE(mcasp3_opt_clks),
1336+};
1337+
13001338 /*
13011339 * 'mmc' class
13021340 *
@@ -2566,6 +2604,22 @@ static struct omap_hwmod_ocp_if dra7xx_l3_main_1__hdmi = { · 1263 unmodified lines
25662604 .user = OCP_USER_MPU | OCP_USER_SDMA,
25672605 };
25682606
2607+/* l4_per2 -> mcasp3 */
2608+static struct omap_hwmod_ocp_if dra7xx_l4_per2__mcasp3 = {
2609+ .master = &dra7xx_l4_per2_hwmod,
2610+ .slave = &dra7xx_mcasp3_hwmod,
2611+ .clk = "l4_root_clk_div",
2612+ .user = OCP_USER_MPU | OCP_USER_SDMA,
2613+};
2614+
2615+/* l3_main_1 -> mcasp3 */
2616+static struct omap_hwmod_ocp_if dra7xx_l3_main_1__mcasp3 = {
2617+ .master = &dra7xx_l3_main_1_hwmod,
2618+ .slave = &dra7xx_mcasp3_hwmod,
2619+ .clk = "l3_iclk_div",
2620+ .user = OCP_USER_MPU | OCP_USER_SDMA,
2621+};
2622+
25692623 /* l4_per1 -> elm */
25702624 static struct omap_hwmod_ocp_if dra7xx_l4_per1__elm = {
25712625 .master = &dra7xx_l4_per1_hwmod,
@@ -3308,6 +3362,8 @@ static struct omap_hwmod_ocp_if *dra7xx_hwmod_ocp_ifs[] __initdata = { · 736 unmodified lines
33083362 &dra7xx_l4_wkup__dcan1,
33093363 &dra7xx_l4_per2__dcan2,
33103364 &dra7xx_l4_per2__cpgmac0,
3365+ &dra7xx_l4_per2__mcasp3,
3366+ &dra7xx_l3_main_1__mcasp3,
33113367 &dra7xx_gmac__mdio,
33123368 &dra7xx_l4_cfg__dma_system,
33133369 &dra7xx_l3_main_1__dss,
arch/arm/mach-omap2/omap_hwmod_81xx_data.c+3−0
@@ -144,6 +144,7 @@ static struct omap_hwmod dm81xx_l4_ls_hwmod = { · 143 unmodified lines
144144 .name = "l4_ls",
145145 .clkdm_name = "alwon_l3s_clkdm",
146146 .class = &l4_hwmod_class,
147+ .flags = HWMOD_NO_IDLEST,
147148 };
148149
149150 /*
@@ -155,6 +156,7 @@ static struct omap_hwmod dm81xx_l4_hs_hwmod = { · 5 unmodified lines
155156 .name = "l4_hs",
156157 .clkdm_name = "alwon_l3_med_clkdm",
157158 .class = &l4_hwmod_class,
159+ .flags = HWMOD_NO_IDLEST,
158160 };
159161
160162 /* L3 slow -> L4 ls peripheral interface running at 125MHz */
@@ -850,6 +852,7 @@ static struct omap_hwmod dm816x_emac0_hwmod = { · 689 unmodified lines
850852 .name = "emac0",
851853 .clkdm_name = "alwon_ethernet_clkdm",
852854 .class = &dm816x_emac_hwmod_class,
855+ .flags = HWMOD_NO_IDLEST,
853856 };
854857
855858 static struct omap_hwmod_ocp_if dm81xx_l4_hs__emac0 = {
arch/arm/mach-omap2/pdata-quirks.c+0−29
@@ -24,9 +24,6 @@ · 23 unmodified lines
2424 #include <linux/platform_data/iommu-omap.h>
2525 #include <linux/platform_data/wkup_m3.h>
2626
27−#include <asm/siginfo.h>
28−#include <asm/signal.h>
29−
3027 #include "common.h"
3128 #include "common-board-devices.h"
3229 #include "dss-common.h"
@@ -385,29 +382,6 @@ static void __init omap3_pandora_legacy_init(void) · 352 unmodified lines
385382 }
386383 #endif /* CONFIG_ARCH_OMAP3 */
387384
388−#ifdef CONFIG_SOC_TI81XX
389−static int fault_fixed_up;
390−
391−static int t410_abort_handler(unsigned long addr, unsigned int fsr,
392− struct pt_regs *regs)
393−{
394− if ((fsr == 0x406 || fsr == 0xc06) && !fault_fixed_up) {
395− pr_warn("External imprecise Data abort at addr=%#lx, fsr=%#x ignored.\n",
396− addr, fsr);
397− fault_fixed_up = 1;
398− return 0;
399− }
400−
401− return 1;
402−}
403−
404−static void __init t410_abort_init(void)
405−{
406− hook_fault_code(16 + 6, t410_abort_handler, SIGBUS, BUS_OBJERR,
407− "imprecise external abort");
408−}
409−#endif
410−
411385 #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
412386 static struct iommu_platform_data omap4_iommu_pdata = {
413387 .reset_name = "mmu_cache",
@@ -536,9 +510,6 @@ static struct pdata_init pdata_quirks[] __initdata = { · 122 unmodified lines
536510 { "openpandora,omap3-pandora-600mhz", omap3_pandora_legacy_init, },
537511 { "openpandora,omap3-pandora-1ghz", omap3_pandora_legacy_init, },
538512 #endif
539−#ifdef CONFIG_SOC_TI81XX
540− { "hp,t410", t410_abort_init, },
541−#endif
542513 #ifdef CONFIG_SOC_OMAP5
543514 { "ti,omap5-uevm", omap5_uevm_legacy_init, },
544515 #endif
arch/arm/mach-omap2/pm34xx.c+2−2
@@ -301,11 +301,11 @@ static void omap3_pm_idle(void) · 300 unmodified lines
301301 if (omap_irq_pending())
302302 return;
303303
304− trace_cpu_idle(1, smp_processor_id());
304+ trace_cpu_idle_rcuidle(1, smp_processor_id());
305305
306306 omap_sram_idle();
307307
308− trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
308+ trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
309309 }
310310
311311 #ifdef CONFIG_SUSPEND
arch/arm/mach-orion5x/include/mach/entry-macro.S+1−1
@@ -21,5 +21,5 @@ · 20 unmodified lines
2121 @ find cause bits that are unmasked
2222 ands \irqstat, \irqstat, \tmp @ clear Z flag if any
2323 clzne \irqnr, \irqstat @ calc irqnr
24− rsbne \irqnr, \irqnr, #31
24+ rsbne \irqnr, \irqnr, #32
2525 .endm
arch/arm/mach-pxa/palm27x.c+1−1
@@ -344,7 +344,7 @@ void __init palm27x_pwm_init(int bl, int lcd) · 343 unmodified lines
344344 {
345345 palm_bl_power = bl;
346346 palm_lcd_power = lcd;
347− pwm_add_lookup(palm27x_pwm_lookup, ARRAY_SIZE(palm27x_pwm_lookup));
347+ pwm_add_table(palm27x_pwm_lookup, ARRAY_SIZE(palm27x_pwm_lookup));
348348 platform_device_register(&palm27x_backlight);
349349 }
350350 #endif
arch/arm/mach-pxa/palmtc.c+1−1
@@ -169,7 +169,7 @@ static inline void palmtc_keys_init(void) {} · 168 unmodified lines
169169 #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
170170 static struct pwm_lookup palmtc_pwm_lookup[] = {
171171 PWM_LOOKUP("pxa25x-pwm.1", 0, "pwm-backlight.0", NULL, PALMTC_PERIOD_NS,
172− PWM_PERIOD_NORMAL),
172+ PWM_POLARITY_NORMAL),
173173 };
174174
175175 static struct platform_pwm_backlight_data palmtc_backlight_data = {
arch/arm/mach-shmobile/setup-r8a7793.c+1−1
@@ -19,7 +19,7 @@ · 18 unmodified lines
1919 #include "common.h"
2020 #include "rcar-gen2.h"
2121
22−static const char *r8a7793_boards_compat_dt[] __initconst = {
22+static const char * const r8a7793_boards_compat_dt[] __initconst = {
2323 "renesas,r8a7793",
2424 NULL,
2525 };
arch/arm/mach-zx/Kconfig+1−1
@@ -13,7 +13,7 @@ config SOC_ZX296702 · 12 unmodified lines
1313 select ARM_GLOBAL_TIMER
1414 select HAVE_ARM_SCU if SMP
1515 select HAVE_ARM_TWD if SMP
16− select PM_GENERIC_DOMAINS
16+ select PM_GENERIC_DOMAINS if PM
1717 help
1818 Support for ZTE ZX296702 SoC which is a dual core CortexA9MP
1919 endif
arch/arm64/Kconfig+22−1
@@ -49,7 +49,7 @@ config ARM64 · 48 unmodified lines
4949 select HAVE_ARCH_AUDITSYSCALL
5050 select HAVE_ARCH_BITREVERSE
5151 select HAVE_ARCH_JUMP_LABEL
52− select HAVE_ARCH_KASAN if SPARSEMEM_VMEMMAP
52+ select HAVE_ARCH_KASAN if SPARSEMEM_VMEMMAP && !(ARM64_16K_PAGES && ARM64_VA_BITS_48)
5353 select HAVE_ARCH_KGDB
5454 select HAVE_ARCH_SECCOMP_FILTER
5555 select HAVE_ARCH_TRACEHOOK
@@ -316,6 +316,27 @@ config ARM64_ERRATUM_832075 · 260 unmodified lines
316316
317317 If unsure, say Y.
318318
319+config ARM64_ERRATUM_834220
320+ bool "Cortex-A57: 834220: Stage 2 translation fault might be incorrectly reported in presence of a Stage 1 fault"
321+ depends on KVM
322+ default y
323+ help
324+ This option adds an alternative code sequence to work around ARM
325+ erratum 834220 on Cortex-A57 parts up to r1p2.
326+
327+ Affected Cortex-A57 parts might report a Stage 2 translation
328+ fault as the result of a Stage 1 fault for load crossing a
329+ page boundary when there is a permission or device memory
330+ alignment fault at Stage 1 and a translation fault at Stage 2.
331+
332+ The workaround is to verify that the Stage 1 translation
333+ doesn't generate a fault before handling the Stage 2 fault.
334+ Please note that this does not necessarily enable the workaround,
335+ as it depends on the alternative framework, which will only patch
336+ the kernel if an affected CPU is detected.
337+
338+ If unsure, say Y.
339+
319340 config ARM64_ERRATUM_845719
320341 bool "Cortex-A53: 845719: a load might read incorrect data"
321342 depends on COMPAT
arch/arm64/crypto/aes-ce-cipher.c+1−1
@@ -237,7 +237,7 @@ EXPORT_SYMBOL(ce_aes_setkey); · 236 unmodified lines
237237 static struct crypto_alg aes_alg = {
238238 .cra_name = "aes",
239239 .cra_driver_name = "aes-ce",
240− .cra_priority = 300,
240+ .cra_priority = 250,
241241 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
242242 .cra_blocksize = AES_BLOCK_SIZE,
243243 .cra_ctxsize = sizeof(struct crypto_aes_ctx),
arch/arm64/include/asm/barrier.h+10−6
@@ -64,27 +64,31 @@ do { \ · 63 unmodified lines
6464
6565 #define smp_load_acquire(p) \
6666 ({ \
67− typeof(*p) ___p1; \
67+ union { typeof(*p) __val; char __c[1]; } __u; \
6868 compiletime_assert_atomic_type(*p); \
6969 switch (sizeof(*p)) { \
7070 case 1: \
7171 asm volatile ("ldarb %w0, %1" \
72− : "=r" (___p1) : "Q" (*p) : "memory"); \
72+ : "=r" (*(__u8 *)__u.__c) \
73+ : "Q" (*p) : "memory"); \
7374 break; \
7475 case 2: \
7576 asm volatile ("ldarh %w0, %1" \
76− : "=r" (___p1) : "Q" (*p) : "memory"); \
77+ : "=r" (*(__u16 *)__u.__c) \
78+ : "Q" (*p) : "memory"); \
7779 break; \
7880 case 4: \
7981 asm volatile ("ldar %w0, %1" \
80− : "=r" (___p1) : "Q" (*p) : "memory"); \
82+ : "=r" (*(__u32 *)__u.__c) \
83+ : "Q" (*p) : "memory"); \
8184 break; \
8285 case 8: \
8386 asm volatile ("ldar %0, %1" \
84− : "=r" (___p1) : "Q" (*p) : "memory"); \
87+ : "=r" (*(__u64 *)__u.__c) \
88+ : "Q" (*p) : "memory"); \
8589 break; \
8690 } \
87− ___p1; \
91+ __u.__val; \
8892 })
8993
9094 #define read_barrier_depends() do { } while(0)
arch/arm64/include/asm/compat.h+1−2
@@ -23,7 +23,6 @@ · 22 unmodified lines
2323 */
2424 #include <linux/types.h>
2525 #include <linux/sched.h>
26−#include <linux/ptrace.h>
2726
2827 #define COMPAT_USER_HZ 100
2928 #ifdef __AARCH64EB__
@@ -234,7 +233,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr) · 204 unmodified lines
234233 return (u32)(unsigned long)uptr;
235234 }
236235
237−#define compat_user_stack_pointer() (user_stack_pointer(current_pt_regs()))
236+#define compat_user_stack_pointer() (user_stack_pointer(task_pt_regs(current)))
238237
239238 static inline void __user *arch_compat_alloc_user_space(long len)
240239 {
arch/arm64/include/asm/cpufeature.h+22−3
@@ -29,8 +29,9 @@ · 28 unmodified lines
2929 #define ARM64_HAS_PAN 4
3030 #define ARM64_HAS_LSE_ATOMICS 5
3131 #define ARM64_WORKAROUND_CAVIUM_23154 6
32+#define ARM64_WORKAROUND_834220 7
3233
33−#define ARM64_NCAPS 7
34+#define ARM64_NCAPS 8
3435
3536 #ifndef __ASSEMBLY__
3637
@@ -46,8 +47,12 @@ enum ftr_type { · 9 unmodified lines
4647 #define FTR_STRICT true /* SANITY check strict matching required */
4748 #define FTR_NONSTRICT false /* SANITY check ignored */
4849
50+#define FTR_SIGNED true /* Value should be treated as signed */
51+#define FTR_UNSIGNED false /* Value should be treated as unsigned */
52+
4953 struct arm64_ftr_bits {
50− bool strict; /* CPU Sanity check: strict matching required ? */
54+ bool sign; /* Value is signed ? */
55+ bool strict; /* CPU Sanity check: strict matching required ? */
5156 enum ftr_type type;
5257 u8 shift;
5358 u8 width;
@@ -123,6 +128,18 @@ cpuid_feature_extract_field(u64 features, int field) · 69 unmodified lines
123128 return cpuid_feature_extract_field_width(features, field, 4);
124129 }
125130
131+static inline unsigned int __attribute_const__
132+cpuid_feature_extract_unsigned_field_width(u64 features, int field, int width)
133+{
134+ return (u64)(features << (64 - width - field)) >> (64 - width);
135+}
136+
137+static inline unsigned int __attribute_const__
138+cpuid_feature_extract_unsigned_field(u64 features, int field)
139+{
140+ return cpuid_feature_extract_unsigned_field_width(features, field, 4);
141+}
142+
126143 static inline u64 arm64_ftr_mask(struct arm64_ftr_bits *ftrp)
127144 {
128145 return (u64)GENMASK(ftrp->shift + ftrp->width - 1, ftrp->shift);
@@ -130,7 +147,9 @@ static inline u64 arm64_ftr_mask(struct arm64_ftr_bits *ftrp) · 1 unmodified line
130147
131148 static inline s64 arm64_ftr_value(struct arm64_ftr_bits *ftrp, u64 val)
132149 {
133− return cpuid_feature_extract_field_width(val, ftrp->shift, ftrp->width);
150+ return ftrp->sign ?
151+ cpuid_feature_extract_field_width(val, ftrp->shift, ftrp->width) :
152+ cpuid_feature_extract_unsigned_field_width(val, ftrp->shift, ftrp->width);
134153 }
135154
136155 static inline bool id_aa64mmfr0_mixed_endian_el0(u64 mmfr0)
arch/arm64/include/asm/dma-mapping.h+3−10
@@ -18,7 +18,6 @@ · 17 unmodified lines
1818
1919 #ifdef __KERNEL__
2020
21−#include <linux/acpi.h>
2221 #include <linux/types.h>
2322 #include <linux/vmalloc.h>
2423
@@ -26,22 +25,16 @@ · 1 unmodified line
2625 #include <asm/xen/hypervisor.h>
2726
2827 #define DMA_ERROR_CODE (~(dma_addr_t)0)
29−extern struct dma_map_ops *dma_ops;
3028 extern struct dma_map_ops dummy_dma_ops;
3129
3230 static inline struct dma_map_ops *__generic_dma_ops(struct device *dev)
3331 {
34− if (unlikely(!dev))
35− return dma_ops;
36− else if (dev->archdata.dma_ops)
32+ if (dev && dev->archdata.dma_ops)
3733 return dev->archdata.dma_ops;
38− else if (acpi_disabled)
39− return dma_ops;
4034
4135 /*
42− * When ACPI is enabled, if arch_set_dma_ops is not called,
43− * we will disable device DMA capability by setting it
44− * to dummy_dma_ops.
36+ * We expect no ISA devices, and all other DMA masters are expected to
37+ * have someone call arch_setup_dma_ops at device creation time.
4538 */
4639 return &dummy_dma_ops;
4740 }
arch/arm64/include/asm/hw_breakpoint.h+4−2
@@ -138,16 +138,18 @@ extern struct pmu perf_ops_bp; · 137 unmodified lines
138138 /* Determine number of BRP registers available. */
139139 static inline int get_num_brps(void)
140140 {
141+ u64 dfr0 = read_system_reg(SYS_ID_AA64DFR0_EL1);
141142 return 1 +
142− cpuid_feature_extract_field(read_system_reg(SYS_ID_AA64DFR0_EL1),
143+ cpuid_feature_extract_unsigned_field(dfr0,
143144 ID_AA64DFR0_BRPS_SHIFT);
144145 }
145146
146147 /* Determine number of WRP registers available. */
147148 static inline int get_num_wrps(void)
148149 {
150+ u64 dfr0 = read_system_reg(SYS_ID_AA64DFR0_EL1);
149151 return 1 +
150− cpuid_feature_extract_field(read_system_reg(SYS_ID_AA64DFR0_EL1),
152+ cpuid_feature_extract_unsigned_field(dfr0,
151153 ID_AA64DFR0_WRPS_SHIFT);
152154 }
153155
arch/arm64/include/asm/irq.h+5−0
@@ -7,4 +7,9 @@ struct pt_regs; · 6 unmodified lines
77
88 extern void set_handle_irq(void (*handle_irq)(struct pt_regs *));
99
10+static inline int nr_legacy_irqs(void)
11+{
12+ return 0;
13+}
14+
1015 #endif
arch/arm64/include/asm/kvm_emulate.h+14−4
@@ -99,12 +99,22 @@ static inline void vcpu_set_thumb(struct kvm_vcpu *vcpu) · 98 unmodified lines
9999 *vcpu_cpsr(vcpu) |= COMPAT_PSR_T_BIT;
100100 }
101101
102−static inline unsigned long *vcpu_reg(const struct kvm_vcpu *vcpu, u8 reg_num)
102+/*
103+ * vcpu_get_reg and vcpu_set_reg should always be passed a register number
104+ * coming from a read of ESR_EL2. Otherwise, it may give the wrong result on
105+ * AArch32 with banked registers.
106+ */
107+static inline unsigned long vcpu_get_reg(const struct kvm_vcpu *vcpu,
108+ u8 reg_num)
103109 {
104− if (vcpu_mode_is_32bit(vcpu))
105− return vcpu_reg32(vcpu, reg_num);
110+ return (reg_num == 31) ? 0 : vcpu_gp_regs(vcpu)->regs.regs[reg_num];
111+}
106112
107− return (unsigned long *)&vcpu_gp_regs(vcpu)->regs.regs[reg_num];
113+static inline void vcpu_set_reg(struct kvm_vcpu *vcpu, u8 reg_num,
114+ unsigned long val)
115+{
116+ if (reg_num != 31)
117+ vcpu_gp_regs(vcpu)->regs.regs[reg_num] = val;
108118 }
109119
110120 /* Get vcpu SPSR for current mode */
arch/arm64/include/asm/mmu_context.h+1−1
@@ -101,7 +101,7 @@ static inline void cpu_set_default_tcr_t0sz(void) · 100 unmodified lines
101101 #define destroy_context(mm) do { } while(0)
102102 void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
103103
104−#define init_new_context(tsk,mm) ({ atomic64_set(&mm->context.id, 0); 0; })
104+#define init_new_context(tsk,mm) ({ atomic64_set(&(mm)->context.id, 0); 0; })
105105
106106 /*
107107 * This is called when "tsk" is about to enter lazy TLB mode.
arch/arm64/include/asm/pgtable.h+1−0
@@ -81,6 +81,7 @@ extern void __pgd_error(const char *file, int line, unsigned long val); · 80 unmodified lines
8181
8282 #define PAGE_KERNEL __pgprot(_PAGE_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE)
8383 #define PAGE_KERNEL_RO __pgprot(_PAGE_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_RDONLY)
84+#define PAGE_KERNEL_ROX __pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_RDONLY)
8485 #define PAGE_KERNEL_EXEC __pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_WRITE)
8586 #define PAGE_KERNEL_EXEC_CONT __pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_CONT)
8687
arch/arm64/kernel/cpu_errata.c+9−0
@@ -75,6 +75,15 @@ const struct arm64_cpu_capabilities arm64_errata[] = { · 74 unmodified lines
7575 (1 << MIDR_VARIANT_SHIFT) | 2),
7676 },
7777 #endif
78+#ifdef CONFIG_ARM64_ERRATUM_834220
79+ {
80+ /* Cortex-A57 r0p0 - r1p2 */
81+ .desc = "ARM erratum 834220",
82+ .capability = ARM64_WORKAROUND_834220,
83+ MIDR_RANGE(MIDR_CORTEX_A57, 0x00,
84+ (1 << MIDR_VARIANT_SHIFT) | 2),
85+ },
86+#endif
7887 #ifdef CONFIG_ARM64_ERRATUM_845719
7988 {
8089 /* Cortex-A53 r0p[01234] */
arch/arm64/kernel/cpufeature.c+23−14
@@ -44,8 +44,9 @@ unsigned int compat_elf_hwcap2 __read_mostly; · 43 unmodified lines
4444
4545 DECLARE_BITMAP(cpu_hwcaps, ARM64_NCAPS);
4646
47−#define ARM64_FTR_BITS(STRICT, TYPE, SHIFT, WIDTH, SAFE_VAL) \
47+#define __ARM64_FTR_BITS(SIGNED, STRICT, TYPE, SHIFT, WIDTH, SAFE_VAL) \
4848 { \
49+ .sign = SIGNED, \
4950 .strict = STRICT, \
5051 .type = TYPE, \
5152 .shift = SHIFT, \
@@ -53,6 +54,14 @@ DECLARE_BITMAP(cpu_hwcaps, ARM64_NCAPS); · 1 unmodified line
5354 .safe_val = SAFE_VAL, \
5455 }
5556
57+/* Define a feature with signed values */
58+#define ARM64_FTR_BITS(STRICT, TYPE, SHIFT, WIDTH, SAFE_VAL) \
59+ __ARM64_FTR_BITS(FTR_SIGNED, STRICT, TYPE, SHIFT, WIDTH, SAFE_VAL)
60+
61+/* Define a feature with unsigned value */
62+#define U_ARM64_FTR_BITS(STRICT, TYPE, SHIFT, WIDTH, SAFE_VAL) \
63+ __ARM64_FTR_BITS(FTR_UNSIGNED, STRICT, TYPE, SHIFT, WIDTH, SAFE_VAL)
64+
5665 #define ARM64_FTR_END \
5766 { \
5867 .width = 0, \
@@ -99,7 +108,7 @@ static struct arm64_ftr_bits ftr_id_aa64mmfr0[] = { · 40 unmodified lines
99108 * Differing PARange is fine as long as all peripherals and memory are mapped
100109 * within the minimum PARange of all CPUs
101110 */
102− ARM64_FTR_BITS(FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_PARANGE_SHIFT, 4, 0),
111+ U_ARM64_FTR_BITS(FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_PARANGE_SHIFT, 4, 0),
103112 ARM64_FTR_END,
104113 };
105114
@@ -115,18 +124,18 @@ static struct arm64_ftr_bits ftr_id_aa64mmfr1[] = { · 9 unmodified lines
115124 };
116125
117126 static struct arm64_ftr_bits ftr_ctr[] = {
118− ARM64_FTR_BITS(FTR_STRICT, FTR_EXACT, 31, 1, 1), /* RAO */
127+ U_ARM64_FTR_BITS(FTR_STRICT, FTR_EXACT, 31, 1, 1), /* RAO */
119128 ARM64_FTR_BITS(FTR_STRICT, FTR_EXACT, 28, 3, 0),
120− ARM64_FTR_BITS(FTR_STRICT, FTR_HIGHER_SAFE, 24, 4, 0), /* CWG */
121− ARM64_FTR_BITS(FTR_STRICT, FTR_LOWER_SAFE, 20, 4, 0), /* ERG */
122− ARM64_FTR_BITS(FTR_STRICT, FTR_LOWER_SAFE, 16, 4, 1), /* DminLine */
129+ U_ARM64_FTR_BITS(FTR_STRICT, FTR_HIGHER_SAFE, 24, 4, 0), /* CWG */
130+ U_ARM64_FTR_BITS(FTR_STRICT, FTR_LOWER_SAFE, 20, 4, 0), /* ERG */
131+ U_ARM64_FTR_BITS(FTR_STRICT, FTR_LOWER_SAFE, 16, 4, 1), /* DminLine */
123132 /*
124133 * Linux can handle differing I-cache policies. Userspace JITs will
125134 * make use of *minLine
126135 */
127− ARM64_FTR_BITS(FTR_NONSTRICT, FTR_EXACT, 14, 2, 0), /* L1Ip */
136+ U_ARM64_FTR_BITS(FTR_NONSTRICT, FTR_EXACT, 14, 2, 0), /* L1Ip */
128137 ARM64_FTR_BITS(FTR_STRICT, FTR_EXACT, 4, 10, 0), /* RAZ */
129− ARM64_FTR_BITS(FTR_STRICT, FTR_LOWER_SAFE, 0, 4, 0), /* IminLine */
138+ U_ARM64_FTR_BITS(FTR_STRICT, FTR_LOWER_SAFE, 0, 4, 0), /* IminLine */
130139 ARM64_FTR_END,
131140 };
132141
@@ -144,12 +153,12 @@ static struct arm64_ftr_bits ftr_id_mmfr0[] = { · 11 unmodified lines
144153
145154 static struct arm64_ftr_bits ftr_id_aa64dfr0[] = {
146155 ARM64_FTR_BITS(FTR_STRICT, FTR_EXACT, 32, 32, 0),
147− ARM64_FTR_BITS(FTR_STRICT, FTR_LOWER_SAFE, ID_AA64DFR0_CTX_CMPS_SHIFT, 4, 0),
148− ARM64_FTR_BITS(FTR_STRICT, FTR_LOWER_SAFE, ID_AA64DFR0_WRPS_SHIFT, 4, 0),
149− ARM64_FTR_BITS(FTR_STRICT, FTR_LOWER_SAFE, ID_AA64DFR0_BRPS_SHIFT, 4, 0),
150− ARM64_FTR_BITS(FTR_STRICT, FTR_EXACT, ID_AA64DFR0_PMUVER_SHIFT, 4, 0),
151− ARM64_FTR_BITS(FTR_STRICT, FTR_EXACT, ID_AA64DFR0_TRACEVER_SHIFT, 4, 0),
152− ARM64_FTR_BITS(FTR_STRICT, FTR_EXACT, ID_AA64DFR0_DEBUGVER_SHIFT, 4, 0x6),
156+ U_ARM64_FTR_BITS(FTR_STRICT, FTR_LOWER_SAFE, ID_AA64DFR0_CTX_CMPS_SHIFT, 4, 0),
157+ U_ARM64_FTR_BITS(FTR_STRICT, FTR_LOWER_SAFE, ID_AA64DFR0_WRPS_SHIFT, 4, 0),
158+ U_ARM64_FTR_BITS(FTR_STRICT, FTR_LOWER_SAFE, ID_AA64DFR0_BRPS_SHIFT, 4, 0),
159+ U_ARM64_FTR_BITS(FTR_STRICT, FTR_EXACT, ID_AA64DFR0_PMUVER_SHIFT, 4, 0),
160+ U_ARM64_FTR_BITS(FTR_STRICT, FTR_EXACT, ID_AA64DFR0_TRACEVER_SHIFT, 4, 0),
161+ U_ARM64_FTR_BITS(FTR_STRICT, FTR_EXACT, ID_AA64DFR0_DEBUGVER_SHIFT, 4, 0x6),
153162 ARM64_FTR_END,
154163 };
155164
arch/arm64/kernel/cpuinfo.c+5−0
@@ -30,6 +30,7 @@ · 29 unmodified lines
3030 #include <linux/seq_file.h>
3131 #include <linux/sched.h>
3232 #include <linux/smp.h>
33+#include <linux/delay.h>
3334
3435 /*
3536 * In case the boot CPU is hotpluggable, we record its initial state and
@@ -112,6 +113,10 @@ static int c_show(struct seq_file *m, void *v) · 76 unmodified lines
112113 */
113114 seq_printf(m, "processor\t: %d\n", i);
114115
116+ seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
117+ loops_per_jiffy / (500000UL/HZ),
118+ loops_per_jiffy / (5000UL/HZ) % 100);
119+
115120 /*
116121 * Dump out the common processor features in a single line.
117122 * Userspace should read the hwcaps with getauxval(AT_HWCAP)
arch/arm64/kernel/efi.c+24−21
@@ -127,7 +127,11 @@ static int __init uefi_init(void) · 126 unmodified lines
127127 table_size = sizeof(efi_config_table_64_t) * efi.systab->nr_tables;
128128 config_tables = early_memremap(efi_to_phys(efi.systab->tables),
129129 table_size);
130−
130+ if (config_tables == NULL) {
131+ pr_warn("Unable to map EFI config table array.\n");
132+ retval = -ENOMEM;
133+ goto out;
134+ }
131135 retval = efi_config_parse_tables(config_tables, efi.systab->nr_tables,
132136 sizeof(efi_config_table_64_t), NULL);
133137
@@ -209,6 +213,14 @@ void __init efi_init(void) · 75 unmodified lines
209213 PAGE_ALIGN(params.mmap_size + (params.mmap & ~PAGE_MASK)));
210214 memmap.phys_map = params.mmap;
211215 memmap.map = early_memremap(params.mmap, params.mmap_size);
216+ if (memmap.map == NULL) {
217+ /*
218+ * If we are booting via UEFI, the UEFI memory map is the only
219+ * description of memory we have, so there is little point in
220+ * proceeding if we cannot access it.
221+ */
222+ panic("Unable to map EFI memory map.\n");
223+ }
212224 memmap.map_end = memmap.map + params.mmap_size;
213225 memmap.desc_size = params.desc_size;
214226 memmap.desc_version = params.desc_ver;
@@ -224,8 +236,9 @@ static bool __init efi_virtmap_init(void) · 9 unmodified lines
224236 {
225237 efi_memory_desc_t *md;
226238
239+ init_new_context(NULL, &efi_mm);
240+
227241 for_each_efi_memory_desc(&memmap, md) {
228− u64 paddr, npages, size;
229242 pgprot_t prot;
230243
231244 if (!(md->attribute & EFI_MEMORY_RUNTIME))
@@ -233,11 +246,6 @@ static bool __init efi_virtmap_init(void) · 1 unmodified line
233246 if (md->virt_addr == 0)
234247 return false;
235248
236− paddr = md->phys_addr;
237− npages = md->num_pages;
238− memrange_efi_to_native(&paddr, &npages);
239− size = npages << PAGE_SHIFT;
240−
241249 pr_info(" EFI remap 0x%016llx => %p\n",
242250 md->phys_addr, (void *)md->virt_addr);
243251
@@ -254,7 +262,9 @@ static bool __init efi_virtmap_init(void) · 10 unmodified lines
254262 else
255263 prot = PAGE_KERNEL;
256264
257− create_pgd_mapping(&efi_mm, paddr, md->virt_addr, size, prot);
265+ create_pgd_mapping(&efi_mm, md->phys_addr, md->virt_addr,
266+ md->num_pages << EFI_PAGE_SHIFT,
267+ __pgprot(pgprot_val(prot) | PTE_NG));
258268 }
259269 return true;
260270 }
@@ -270,12 +280,12 @@ static int __init arm64_enable_runtime_services(void) · 9 unmodified lines
270280
271281 if (!efi_enabled(EFI_BOOT)) {
272282 pr_info("EFI services will not be available.\n");
273− return -1;
283+ return 0;
274284 }
275285
276286 if (efi_runtime_disabled()) {
277287 pr_info("EFI runtime services will be disabled.\n");
278− return -1;
288+ return 0;
279289 }
280290
281291 pr_info("Remapping and enabling EFI services.\n");
@@ -285,7 +295,7 @@ static int __init arm64_enable_runtime_services(void) · 3 unmodified lines
285295 mapsize);
286296 if (!memmap.map) {
287297 pr_err("Failed to remap EFI memory map\n");
288− return -1;
298+ return -ENOMEM;
289299 }
290300 memmap.map_end = memmap.map + mapsize;
291301 efi.memmap = &memmap;
@@ -294,13 +304,13 @@ static int __init arm64_enable_runtime_services(void) · 2 unmodified lines
294304 sizeof(efi_system_table_t));
295305 if (!efi.systab) {
296306 pr_err("Failed to remap EFI System Table\n");
297− return -1;
307+ return -ENOMEM;
298308 }
299309 set_bit(EFI_SYSTEM_TABLES, &efi.flags);
300310
301311 if (!efi_virtmap_init()) {
302312 pr_err("No UEFI virtual mapping was installed -- runtime services will not be available\n");
303− return -1;
313+ return -ENOMEM;
304314 }
305315
306316 /* Set up runtime services function pointers */
@@ -329,14 +339,7 @@ core_initcall(arm64_dmi_init); · 22 unmodified lines
329339
330340 static void efi_set_pgd(struct mm_struct *mm)
331341 {
332− if (mm == &init_mm)
333− cpu_set_reserved_ttbr0();
334− else
335− cpu_switch_mm(mm->pgd, mm);
336−
337− local_flush_tlb_all();
338− if (icache_is_aivivt())
339− __local_flush_icache_all();
342+ switch_mm(NULL, mm, NULL);
340343 }
341344
342345 void efi_virtmap_load(void)
arch/arm64/kernel/suspend.c+10−0
@@ -1,3 +1,4 @@
1+#include <linux/ftrace.h>
12 #include <linux/percpu.h>
23 #include <linux/slab.h>
34 #include <asm/cacheflush.h>
@@ -70,6 +71,13 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long)) · 66 unmodified lines
7071 */
7172 local_dbg_save(flags);
7273
74+ /*
75+ * Function graph tracer state gets incosistent when the kernel
76+ * calls functions that never return (aka suspend finishers) hence
77+ * disable graph tracing during their execution.
78+ */
79+ pause_graph_tracing();
80+
7381 /*
7482 * mm context saved on the stack, it will be restored when
7583 * the cpu comes out of reset through the identity mapped
@@ -111,6 +119,8 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long)) · 35 unmodified lines
111119 hw_breakpoint_restore(NULL);
112120 }
113121
122+ unpause_graph_tracing();
123+
114124 /*
115125 * Restore pstate flags. OS lock and mdscr have been already
116126 * restored, so from this point onwards, debugging is fully
arch/arm64/kvm/handle_exit.c+1−1
@@ -37,7 +37,7 @@ static int handle_hvc(struct kvm_vcpu *vcpu, struct kvm_run *run) · 36 unmodified lines
3737 {
3838 int ret;
3939
40− trace_kvm_hvc_arm64(*vcpu_pc(vcpu), *vcpu_reg(vcpu, 0),
40+ trace_kvm_hvc_arm64(*vcpu_pc(vcpu), vcpu_get_reg(vcpu, 0),
4141 kvm_vcpu_hvc_get_imm(vcpu));
4242
4343 ret = kvm_psci_call(vcpu);
arch/arm64/kvm/hyp.S+12−2
@@ -864,6 +864,10 @@ ENTRY(__kvm_flush_vm_context) · 863 unmodified lines
864864 ENDPROC(__kvm_flush_vm_context)
865865
866866 __kvm_hyp_panic:
867+ // Stash PAR_EL1 before corrupting it in __restore_sysregs
868+ mrs x0, par_el1
869+ push x0, xzr
870+
867871 // Guess the context by looking at VTTBR:
868872 // If zero, then we're already a host.
869873 // Otherwise restore a minimal host context before panicing.
@@ -898,7 +902,7 @@ __kvm_hyp_panic: · 28 unmodified lines
898902 mrs x3, esr_el2
899903 mrs x4, far_el2
900904 mrs x5, hpfar_el2
901− mrs x6, par_el1
905+ pop x6, xzr // active context PAR_EL1
902906 mrs x7, tpidr_el2
903907
904908 mov lr, #(PSR_F_BIT | PSR_I_BIT | PSR_A_BIT | PSR_D_BIT |\
@@ -914,7 +918,7 @@ __kvm_hyp_panic: · 9 unmodified lines
914918 ENDPROC(__kvm_hyp_panic)
915919
916920 __hyp_panic_str:
917− .ascii "HYP panic:\nPS:%08x PC:%p ESR:%p\nFAR:%p HPFAR:%p PAR:%p\nVCPU:%p\n\0"
921+ .ascii "HYP panic:\nPS:%08x PC:%016x ESR:%08x\nFAR:%016x HPFAR:%016x PAR:%016x\nVCPU:%p\n\0"
918922
919923 .align 2
920924
@@ -1015,9 +1019,15 @@ el1_trap: · 94 unmodified lines
10151019 b.ne 1f // Not an abort we care about
10161020
10171021 /* This is an abort. Check for permission fault */
1022+alternative_if_not ARM64_WORKAROUND_834220
10181023 and x2, x1, #ESR_ELx_FSC_TYPE
10191024 cmp x2, #FSC_PERM
10201025 b.ne 1f // Not a permission fault
1026+alternative_else
1027+ nop // Use the permission fault path to
1028+ nop // check for a valid S1 translation,
1029+ nop // regardless of the ESR value.
1030+alternative_endif
10211031
10221032 /*
10231033 * Check for Stage-1 page table walk, which is guaranteed
arch/arm64/kvm/inject_fault.c+1−1
@@ -48,7 +48,7 @@ static void prepare_fault32(struct kvm_vcpu *vcpu, u32 mode, u32 vect_offset) · 47 unmodified lines
4848
4949 /* Note: These now point to the banked copies */
5050 *vcpu_spsr(vcpu) = new_spsr_value;
51− *vcpu_reg(vcpu, 14) = *vcpu_pc(vcpu) + return_offset;
51+ *vcpu_reg32(vcpu, 14) = *vcpu_pc(vcpu) + return_offset;
5252
5353 /* Branch to exception vector */
5454 if (sctlr & (1 << 13))
arch/arm64/kvm/sys_regs.c+60−63
@@ -78,7 +78,7 @@ static u32 get_ccsidr(u32 csselr) · 77 unmodified lines
7878 * See note at ARMv7 ARM B1.14.4 (TL;DR: S/W ops are not easily virtualized).
7979 */
8080 static bool access_dcsw(struct kvm_vcpu *vcpu,
81− const struct sys_reg_params *p,
81+ struct sys_reg_params *p,
8282 const struct sys_reg_desc *r)
8383 {
8484 if (!p->is_write)
@@ -94,21 +94,19 @@ static bool access_dcsw(struct kvm_vcpu *vcpu, · 9 unmodified lines
9494 * sys_regs and leave it in complete control of the caches.
9595 */
9696 static bool access_vm_reg(struct kvm_vcpu *vcpu,
97− const struct sys_reg_params *p,
97+ struct sys_reg_params *p,
9898 const struct sys_reg_desc *r)
9999 {
100− unsigned long val;
101100 bool was_enabled = vcpu_has_cache_enabled(vcpu);
102101
103102 BUG_ON(!p->is_write);
104103
105− val = *vcpu_reg(vcpu, p->Rt);
106104 if (!p->is_aarch32) {
107− vcpu_sys_reg(vcpu, r->reg) = val;
105+ vcpu_sys_reg(vcpu, r->reg) = p->regval;
108106 } else {
109107 if (!p->is_32bit)
110− vcpu_cp15_64_high(vcpu, r->reg) = val >> 32;
111− vcpu_cp15_64_low(vcpu, r->reg) = val & 0xffffffffUL;
108+ vcpu_cp15_64_high(vcpu, r->reg) = upper_32_bits(p->regval);
109+ vcpu_cp15_64_low(vcpu, r->reg) = lower_32_bits(p->regval);
112110 }
113111
114112 kvm_toggle_cache(vcpu, was_enabled);
@@ -122,22 +120,19 @@ static bool access_vm_reg(struct kvm_vcpu *vcpu, · 7 unmodified lines
122120 * for both AArch64 and AArch32 accesses.
123121 */
124122 static bool access_gic_sgi(struct kvm_vcpu *vcpu,
125− const struct sys_reg_params *p,
123+ struct sys_reg_params *p,
126124 const struct sys_reg_desc *r)
127125 {
128− u64 val;
129−
130126 if (!p->is_write)
131127 return read_from_write_only(vcpu, p);
132128
133− val = *vcpu_reg(vcpu, p->Rt);
134− vgic_v3_dispatch_sgi(vcpu, val);
129+ vgic_v3_dispatch_sgi(vcpu, p->regval);
135130
136131 return true;
137132 }
138133
139134 static bool trap_raz_wi(struct kvm_vcpu *vcpu,
140− const struct sys_reg_params *p,
135+ struct sys_reg_params *p,
141136 const struct sys_reg_desc *r)
142137 {
143138 if (p->is_write)
@@ -147,19 +142,19 @@ static bool trap_raz_wi(struct kvm_vcpu *vcpu, · 3 unmodified lines
147142 }
148143
149144 static bool trap_oslsr_el1(struct kvm_vcpu *vcpu,
150− const struct sys_reg_params *p,
145+ struct sys_reg_params *p,
151146 const struct sys_reg_desc *r)
152147 {
153148 if (p->is_write) {
154149 return ignore_write(vcpu, p);
155150 } else {
156− *vcpu_reg(vcpu, p->Rt) = (1 << 3);
151+ p->regval = (1 << 3);
157152 return true;
158153 }
159154 }
160155
161156 static bool trap_dbgauthstatus_el1(struct kvm_vcpu *vcpu,
162− const struct sys_reg_params *p,
157+ struct sys_reg_params *p,
163158 const struct sys_reg_desc *r)
164159 {
165160 if (p->is_write) {
@@ -167,7 +162,7 @@ static bool trap_dbgauthstatus_el1(struct kvm_vcpu *vcpu, · 1 unmodified line
167162 } else {
168163 u32 val;
169164 asm volatile("mrs %0, dbgauthstatus_el1" : "=r" (val));
170− *vcpu_reg(vcpu, p->Rt) = val;
165+ p->regval = val;
171166 return true;
172167 }
173168 }
@@ -200,17 +195,17 @@ static bool trap_dbgauthstatus_el1(struct kvm_vcpu *vcpu, · 26 unmodified lines
200195 * now use the debug registers.
201196 */
202197 static bool trap_debug_regs(struct kvm_vcpu *vcpu,
203− const struct sys_reg_params *p,
198+ struct sys_reg_params *p,
204199 const struct sys_reg_desc *r)
205200 {
206201 if (p->is_write) {
207− vcpu_sys_reg(vcpu, r->reg) = *vcpu_reg(vcpu, p->Rt);
202+ vcpu_sys_reg(vcpu, r->reg) = p->regval;
208203 vcpu->arch.debug_flags |= KVM_ARM64_DEBUG_DIRTY;
209204 } else {
210− *vcpu_reg(vcpu, p->Rt) = vcpu_sys_reg(vcpu, r->reg);
205+ p->regval = vcpu_sys_reg(vcpu, r->reg);
211206 }
212207
213− trace_trap_reg(__func__, r->reg, p->is_write, *vcpu_reg(vcpu, p->Rt));
208+ trace_trap_reg(__func__, r->reg, p->is_write, p->regval);
214209
215210 return true;
216211 }
@@ -225,10 +220,10 @@ static bool trap_debug_regs(struct kvm_vcpu *vcpu, · 8 unmodified lines
225220 * hyp.S code switches between host and guest values in future.
226221 */
227222 static inline void reg_to_dbg(struct kvm_vcpu *vcpu,
228− const struct sys_reg_params *p,
223+ struct sys_reg_params *p,
229224 u64 *dbg_reg)
230225 {
231− u64 val = *vcpu_reg(vcpu, p->Rt);
226+ u64 val = p->regval;
232227
233228 if (p->is_32bit) {
234229 val &= 0xffffffffUL;
@@ -240,19 +235,16 @@ static inline void reg_to_dbg(struct kvm_vcpu *vcpu, · 5 unmodified lines
240235 }
241236
242237 static inline void dbg_to_reg(struct kvm_vcpu *vcpu,
243− const struct sys_reg_params *p,
238+ struct sys_reg_params *p,
244239 u64 *dbg_reg)
245240 {
246− u64 val = *dbg_reg;
247−
241+ p->regval = *dbg_reg;
248242 if (p->is_32bit)
249− val &= 0xffffffffUL;
250−
251− *vcpu_reg(vcpu, p->Rt) = val;
243+ p->regval &= 0xffffffffUL;
252244 }
253245
254246 static inline bool trap_bvr(struct kvm_vcpu *vcpu,
255− const struct sys_reg_params *p,
247+ struct sys_reg_params *p,
256248 const struct sys_reg_desc *rd)
257249 {
258250 u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_bvr[rd->reg];
@@ -294,7 +286,7 @@ static inline void reset_bvr(struct kvm_vcpu *vcpu, · 35 unmodified lines
294286 }
295287
296288 static inline bool trap_bcr(struct kvm_vcpu *vcpu,
297− const struct sys_reg_params *p,
289+ struct sys_reg_params *p,
298290 const struct sys_reg_desc *rd)
299291 {
300292 u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_bcr[rd->reg];
@@ -337,7 +329,7 @@ static inline void reset_bcr(struct kvm_vcpu *vcpu, · 36 unmodified lines
337329 }
338330
339331 static inline bool trap_wvr(struct kvm_vcpu *vcpu,
340− const struct sys_reg_params *p,
332+ struct sys_reg_params *p,
341333 const struct sys_reg_desc *rd)
342334 {
343335 u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_wvr[rd->reg];
@@ -380,7 +372,7 @@ static inline void reset_wvr(struct kvm_vcpu *vcpu, · 36 unmodified lines
380372 }
381373
382374 static inline bool trap_wcr(struct kvm_vcpu *vcpu,
383− const struct sys_reg_params *p,
375+ struct sys_reg_params *p,
384376 const struct sys_reg_desc *rd)
385377 {
386378 u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_wcr[rd->reg];
@@ -687,7 +679,7 @@ static const struct sys_reg_desc sys_reg_descs[] = { · 300 unmodified lines
687679 };
688680
689681 static bool trap_dbgidr(struct kvm_vcpu *vcpu,
690− const struct sys_reg_params *p,
682+ struct sys_reg_params *p,
691683 const struct sys_reg_desc *r)
692684 {
693685 if (p->is_write) {
@@ -697,23 +689,23 @@ static bool trap_dbgidr(struct kvm_vcpu *vcpu, · 3 unmodified lines
697689 u64 pfr = read_system_reg(SYS_ID_AA64PFR0_EL1);
698690 u32 el3 = !!cpuid_feature_extract_field(pfr, ID_AA64PFR0_EL3_SHIFT);
699691
700− *vcpu_reg(vcpu, p->Rt) = ((((dfr >> ID_AA64DFR0_WRPS_SHIFT) & 0xf) << 28) |
701− (((dfr >> ID_AA64DFR0_BRPS_SHIFT) & 0xf) << 24) |
702− (((dfr >> ID_AA64DFR0_CTX_CMPS_SHIFT) & 0xf) << 20) |
703− (6 << 16) | (el3 << 14) | (el3 << 12));
692+ p->regval = ((((dfr >> ID_AA64DFR0_WRPS_SHIFT) & 0xf) << 28) |
693+ (((dfr >> ID_AA64DFR0_BRPS_SHIFT) & 0xf) << 24) |
694+ (((dfr >> ID_AA64DFR0_CTX_CMPS_SHIFT) & 0xf) << 20)
695+ | (6 << 16) | (el3 << 14) | (el3 << 12));
704696 return true;
705697 }
706698 }
707699
708700 static bool trap_debug32(struct kvm_vcpu *vcpu,
709− const struct sys_reg_params *p,
701+ struct sys_reg_params *p,
710702 const struct sys_reg_desc *r)
711703 {
712704 if (p->is_write) {
713− vcpu_cp14(vcpu, r->reg) = *vcpu_reg(vcpu, p->Rt);
705+ vcpu_cp14(vcpu, r->reg) = p->regval;
714706 vcpu->arch.debug_flags |= KVM_ARM64_DEBUG_DIRTY;
715707 } else {
716− *vcpu_reg(vcpu, p->Rt) = vcpu_cp14(vcpu, r->reg);
708+ p->regval = vcpu_cp14(vcpu, r->reg);
717709 }
718710
719711 return true;
@@ -731,7 +723,7 @@ static bool trap_debug32(struct kvm_vcpu *vcpu, · 11 unmodified lines
731723 */
732724
733725 static inline bool trap_xvr(struct kvm_vcpu *vcpu,
734− const struct sys_reg_params *p,
726+ struct sys_reg_params *p,
735727 const struct sys_reg_desc *rd)
736728 {
737729 u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_bvr[rd->reg];
@@ -740,12 +732,12 @@ static inline bool trap_xvr(struct kvm_vcpu *vcpu, · 2 unmodified lines
740732 u64 val = *dbg_reg;
741733
742734 val &= 0xffffffffUL;
743− val |= *vcpu_reg(vcpu, p->Rt) << 32;
735+ val |= p->regval << 32;
744736 *dbg_reg = val;
745737
746738 vcpu->arch.debug_flags |= KVM_ARM64_DEBUG_DIRTY;
747739 } else {
748− *vcpu_reg(vcpu, p->Rt) = *dbg_reg >> 32;
740+ p->regval = *dbg_reg >> 32;
749741 }
750742
751743 trace_trap_reg(__func__, rd->reg, p->is_write, *dbg_reg);
@@ -991,7 +983,7 @@ int kvm_handle_cp14_load_store(struct kvm_vcpu *vcpu, struct kvm_run *run) · 239 unmodified lines
991983 * Return 0 if the access has been handled, and -1 if not.
992984 */
993985 static int emulate_cp(struct kvm_vcpu *vcpu,
994− const struct sys_reg_params *params,
986+ struct sys_reg_params *params,
995987 const struct sys_reg_desc *table,
996988 size_t num)
997989 {
@@ -1062,12 +1054,12 @@ static int kvm_handle_cp_64(struct kvm_vcpu *vcpu, · 64 unmodified lines
10621054 {
10631055 struct sys_reg_params params;
10641056 u32 hsr = kvm_vcpu_get_hsr(vcpu);
1057+ int Rt = (hsr >> 5) & 0xf;
10651058 int Rt2 = (hsr >> 10) & 0xf;
10661059
10671060 params.is_aarch32 = true;
10681061 params.is_32bit = false;
10691062 params.CRm = (hsr >> 1) & 0xf;
1070− params.Rt = (hsr >> 5) & 0xf;
10711063 params.is_write = ((hsr & 1) == 0);
10721064
10731065 params.Op0 = 0;
@@ -1076,15 +1068,12 @@ static int kvm_handle_cp_64(struct kvm_vcpu *vcpu, · 2 unmodified lines
10761068 params.CRn = 0;
10771069
10781070 /*
1079− * Massive hack here. Store Rt2 in the top 32bits so we only
1080− * have one register to deal with. As we use the same trap
1071+ * Make a 64-bit value out of Rt and Rt2. As we use the same trap
10811072 * backends between AArch32 and AArch64, we get away with it.
10821073 */
10831074 if (params.is_write) {
1084− u64 val = *vcpu_reg(vcpu, params.Rt);
1085− val &= 0xffffffff;
1086− val |= *vcpu_reg(vcpu, Rt2) << 32;
1087− *vcpu_reg(vcpu, params.Rt) = val;
1075+ params.regval = vcpu_get_reg(vcpu, Rt) & 0xffffffff;
1076+ params.regval |= vcpu_get_reg(vcpu, Rt2) << 32;
10881077 }
10891078
10901079 if (!emulate_cp(vcpu, &params, target_specific, nr_specific))
@@ -1095,11 +1084,10 @@ static int kvm_handle_cp_64(struct kvm_vcpu *vcpu, · 4 unmodified lines
10951084 unhandled_cp_access(vcpu, &params);
10961085
10971086 out:
1098− /* Do the opposite hack for the read side */
1087+ /* Split up the value between registers for the read side */
10991088 if (!params.is_write) {
1100− u64 val = *vcpu_reg(vcpu, params.Rt);
1101− val >>= 32;
1102− *vcpu_reg(vcpu, Rt2) = val;
1089+ vcpu_set_reg(vcpu, Rt, lower_32_bits(params.regval));
1090+ vcpu_set_reg(vcpu, Rt2, upper_32_bits(params.regval));
11031091 }
11041092
11051093 return 1;
@@ -1118,21 +1106,24 @@ static int kvm_handle_cp_32(struct kvm_vcpu *vcpu, · 12 unmodified lines
11181106 {
11191107 struct sys_reg_params params;
11201108 u32 hsr = kvm_vcpu_get_hsr(vcpu);
1109+ int Rt = (hsr >> 5) & 0xf;
11211110
11221111 params.is_aarch32 = true;
11231112 params.is_32bit = true;
11241113 params.CRm = (hsr >> 1) & 0xf;
1125− params.Rt = (hsr >> 5) & 0xf;
1114+ params.regval = vcpu_get_reg(vcpu, Rt);
11261115 params.is_write = ((hsr & 1) == 0);
11271116 params.CRn = (hsr >> 10) & 0xf;
11281117 params.Op0 = 0;
11291118 params.Op1 = (hsr >> 14) & 0x7;
11301119 params.Op2 = (hsr >> 17) & 0x7;
11311120
1132− if (!emulate_cp(vcpu, &params, target_specific, nr_specific))
1133− return 1;
1134− if (!emulate_cp(vcpu, &params, global, nr_global))
1121+ if (!emulate_cp(vcpu, &params, target_specific, nr_specific) ||
1122+ !emulate_cp(vcpu, &params, global, nr_global)) {
1123+ if (!params.is_write)
1124+ vcpu_set_reg(vcpu, Rt, params.regval);
11351125 return 1;
1126+ }
11361127
11371128 unhandled_cp_access(vcpu, &params);
11381129 return 1;
@@ -1175,7 +1166,7 @@ int kvm_handle_cp14_32(struct kvm_vcpu *vcpu, struct kvm_run *run) · 36 unmodified lines
11751166 }
11761167
11771168 static int emulate_sys_reg(struct kvm_vcpu *vcpu,
1178− const struct sys_reg_params *params)
1169+ struct sys_reg_params *params)
11791170 {
11801171 size_t num;
11811172 const struct sys_reg_desc *table, *r;
@@ -1230,6 +1221,8 @@ int kvm_handle_sys_reg(struct kvm_vcpu *vcpu, struct kvm_run *run) · 48 unmodified lines
12301221 {
12311222 struct sys_reg_params params;
12321223 unsigned long esr = kvm_vcpu_get_hsr(vcpu);
1224+ int Rt = (esr >> 5) & 0x1f;
1225+ int ret;
12331226
12341227 trace_kvm_handle_sys_reg(esr);
12351228
@@ -1240,10 +1233,14 @@ int kvm_handle_sys_reg(struct kvm_vcpu *vcpu, struct kvm_run *run) · 4 unmodified lines
12401233 params.CRn = (esr >> 10) & 0xf;
12411234 params.CRm = (esr >> 1) & 0xf;
12421235 params.Op2 = (esr >> 17) & 0x7;
1243− params.Rt = (esr >> 5) & 0x1f;
1236+ params.regval = vcpu_get_reg(vcpu, Rt);
12441237 params.is_write = !(esr & 1);
12451238
1246− return emulate_sys_reg(vcpu, &params);
1239+ ret = emulate_sys_reg(vcpu, &params);
1240+
1241+ if (!params.is_write)
1242+ vcpu_set_reg(vcpu, Rt, params.regval);
1243+ return ret;
12471244 }
12481245
12491246 /******************************************************************************
arch/arm64/kvm/sys_regs.h+4−4
@@ -28,7 +28,7 @@ struct sys_reg_params { · 27 unmodified lines
2828 u8 CRn;
2929 u8 CRm;
3030 u8 Op2;
31− u8 Rt;
31+ u64 regval;
3232 bool is_write;
3333 bool is_aarch32;
3434 bool is_32bit; /* Only valid if is_aarch32 is true */
@@ -44,7 +44,7 @@ struct sys_reg_desc { · 9 unmodified lines
4444
4545 /* Trapped access from guest, if non-NULL. */
4646 bool (*access)(struct kvm_vcpu *,
47− const struct sys_reg_params *,
47+ struct sys_reg_params *,
4848 const struct sys_reg_desc *);
4949
5050 /* Initialization for vcpu. */
@@ -77,9 +77,9 @@ static inline bool ignore_write(struct kvm_vcpu *vcpu, · 26 unmodified lines
7777 }
7878
7979 static inline bool read_zero(struct kvm_vcpu *vcpu,
80− const struct sys_reg_params *p)
80+ struct sys_reg_params *p)
8181 {
82− *vcpu_reg(vcpu, p->Rt) = 0;
82+ p->regval = 0;
8383 return true;
8484 }
8585
arch/arm64/kvm/sys_regs_generic_v8.c+2−2
@@ -31,13 +31,13 @@ · 30 unmodified lines
3131 #include "sys_regs.h"
3232
3333 static bool access_actlr(struct kvm_vcpu *vcpu,
34− const struct sys_reg_params *p,
34+ struct sys_reg_params *p,
3535 const struct sys_reg_desc *r)
3636 {
3737 if (p->is_write)
3838 return ignore_write(vcpu, p);
3939
40− *vcpu_reg(vcpu, p->Rt) = vcpu_sys_reg(vcpu, ACTLR_EL1);
40+ p->regval = vcpu_sys_reg(vcpu, ACTLR_EL1);
4141 return true;
4242 }
4343
arch/arm64/mm/context.c+26−12
@@ -76,13 +76,28 @@ static void flush_context(unsigned int cpu) · 75 unmodified lines
7676 __flush_icache_all();
7777 }
7878
79−static int is_reserved_asid(u64 asid)
79+static bool check_update_reserved_asid(u64 asid, u64 newasid)
8080 {
8181 int cpu;
82− for_each_possible_cpu(cpu)
83− if (per_cpu(reserved_asids, cpu) == asid)
84− return 1;
85− return 0;
82+ bool hit = false;
83+
84+ /*
85+ * Iterate over the set of reserved ASIDs looking for a match.
86+ * If we find one, then we can update our mm to use newasid
87+ * (i.e. the same ASID in the current generation) but we can't
88+ * exit the loop early, since we need to ensure that all copies
89+ * of the old ASID are updated to reflect the mm. Failure to do
90+ * so could result in us missing the reserved ASID in a future
91+ * generation.
92+ */
93+ for_each_possible_cpu(cpu) {
94+ if (per_cpu(reserved_asids, cpu) == asid) {
95+ hit = true;
96+ per_cpu(reserved_asids, cpu) = newasid;
97+ }
98+ }
99+
100+ return hit;
86101 }
87102
88103 static u64 new_context(struct mm_struct *mm, unsigned int cpu)
@@ -92,12 +107,14 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu) · 3 unmodified lines
92107 u64 generation = atomic64_read(&asid_generation);
93108
94109 if (asid != 0) {
110+ u64 newasid = generation | (asid & ~ASID_MASK);
111+
95112 /*
96113 * If our current ASID was active during a rollover, we
97114 * can continue to use it and this was just a false alarm.
98115 */
99− if (is_reserved_asid(asid))
100− return generation | (asid & ~ASID_MASK);
116+ if (check_update_reserved_asid(asid, newasid))
117+ return newasid;
101118
102119 /*
103120 * We had a valid ASID in a previous life, so try to re-use
@@ -105,7 +122,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu) · 1 unmodified line
105122 */
106123 asid &= ~ASID_MASK;
107124 if (!__test_and_set_bit(asid, asid_map))
108− goto bump_gen;
125+ return newasid;
109126 }
110127
111128 /*
@@ -129,10 +146,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu) · 17 unmodified lines
129146 set_asid:
130147 __set_bit(asid, asid_map);
131148 cur_idx = asid;
132−
133−bump_gen:
134− asid |= generation;
135− return asid;
149+ return asid | generation;
136150 }
137151
138152 void check_and_switch_context(struct mm_struct *mm, unsigned int cpu)
arch/arm64/mm/dma-mapping.c+17−18
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 */
1919
2020 #include <linux/gfp.h>
21+#include <linux/acpi.h>
2122 #include <linux/export.h>
2223 #include <linux/slab.h>
2324 #include <linux/genalloc.h>
@@ -28,9 +29,6 @@ · 4 unmodified lines
2829
2930 #include <asm/cacheflush.h>
3031
31−struct dma_map_ops *dma_ops;
32−EXPORT_SYMBOL(dma_ops);
33−
3432 static pgprot_t __get_dma_pgprot(struct dma_attrs *attrs, pgprot_t prot,
3533 bool coherent)
3634 {
@@ -515,13 +513,7 @@ EXPORT_SYMBOL(dummy_dma_ops); · 478 unmodified lines
515513
516514 static int __init arm64_dma_init(void)
517515 {
518− int ret;
519−
520− dma_ops = &swiotlb_dma_ops;
521−
522− ret = atomic_pool_init();
523−
524− return ret;
516+ return atomic_pool_init();
525517 }
526518 arch_initcall(arm64_dma_init);
527519
@@ -552,10 +544,14 @@ static void *__iommu_alloc_attrs(struct device *dev, size_t size, · 24 unmodified lines
552544 {
553545 bool coherent = is_device_dma_coherent(dev);
554546 int ioprot = dma_direction_to_prot(DMA_BIDIRECTIONAL, coherent);
547+ size_t iosize = size;
555548 void *addr;
556549
557550 if (WARN(!dev, "cannot create IOMMU mapping for unknown device\n"))
558551 return NULL;
552+
553+ size = PAGE_ALIGN(size);
554+
559555 /*
560556 * Some drivers rely on this, and we probably don't want the
561557 * possibility of stale kernel data being read by devices anyway.
@@ -566,7 +562,7 @@ static void *__iommu_alloc_attrs(struct device *dev, size_t size, · 4 unmodified lines
566562 struct page **pages;
567563 pgprot_t prot = __get_dma_pgprot(attrs, PAGE_KERNEL, coherent);
568564
569− pages = iommu_dma_alloc(dev, size, gfp, ioprot, handle,
565+ pages = iommu_dma_alloc(dev, iosize, gfp, ioprot, handle,
570566 flush_page);
571567 if (!pages)
572568 return NULL;
@@ -574,7 +570,7 @@ static void *__iommu_alloc_attrs(struct device *dev, size_t size, · 1 unmodified line
574570 addr = dma_common_pages_remap(pages, size, VM_USERMAP, prot,
575571 __builtin_return_address(0));
576572 if (!addr)
577− iommu_dma_free(dev, pages, size, handle);
573+ iommu_dma_free(dev, pages, iosize, handle);
578574 } else {
579575 struct page *page;
580576 /*
@@ -591,7 +587,7 @@ static void *__iommu_alloc_attrs(struct device *dev, size_t size, · 10 unmodified lines
591587 if (!addr)
592588 return NULL;
593589
594− *handle = iommu_dma_map_page(dev, page, 0, size, ioprot);
590+ *handle = iommu_dma_map_page(dev, page, 0, iosize, ioprot);
595591 if (iommu_dma_mapping_error(dev, *handle)) {
596592 if (coherent)
597593 __free_pages(page, get_order(size));
@@ -606,6 +602,9 @@ static void *__iommu_alloc_attrs(struct device *dev, size_t size, · 8 unmodified lines
606602 static void __iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr,
607603 dma_addr_t handle, struct dma_attrs *attrs)
608604 {
605+ size_t iosize = size;
606+
607+ size = PAGE_ALIGN(size);
609608 /*
610609 * @cpu_addr will be one of 3 things depending on how it was allocated:
611610 * - A remapped array of pages from iommu_dma_alloc(), for all
@@ -617,17 +616,17 @@ static void __iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr, · 5 unmodified lines
617616 * Hence how dodgy the below logic looks...
618617 */
619618 if (__in_atomic_pool(cpu_addr, size)) {
620− iommu_dma_unmap_page(dev, handle, size, 0, NULL);
619+ iommu_dma_unmap_page(dev, handle, iosize, 0, NULL);
621620 __free_from_pool(cpu_addr, size);
622621 } else if (is_vmalloc_addr(cpu_addr)){
623622 struct vm_struct *area = find_vm_area(cpu_addr);
624623
625624 if (WARN_ON(!area || !area->pages))
626625 return;
627− iommu_dma_free(dev, area->pages, size, &handle);
626+ iommu_dma_free(dev, area->pages, iosize, &handle);
628627 dma_common_free_remap(cpu_addr, size, VM_USERMAP);
629628 } else {
630− iommu_dma_unmap_page(dev, handle, size, 0, NULL);
629+ iommu_dma_unmap_page(dev, handle, iosize, 0, NULL);
631630 __free_pages(virt_to_page(cpu_addr), get_order(size));
632631 }
633632 }
@@ -984,8 +983,8 @@ static void __iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, · 350 unmodified lines
984983 void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
985984 struct iommu_ops *iommu, bool coherent)
986985 {
987− if (!acpi_disabled && !dev->archdata.dma_ops)
988− dev->archdata.dma_ops = dma_ops;
986+ if (!dev->archdata.dma_ops)
987+ dev->archdata.dma_ops = &swiotlb_dma_ops;
989988
990989 dev->archdata.dma_coherent = coherent;
991990 __iommu_setup_dma_ops(dev, dma_base, size, iommu);
arch/arm64/mm/fault.c+14−14
@@ -393,16 +393,16 @@ static struct fault_info { · 392 unmodified lines
393393 { do_translation_fault, SIGSEGV, SEGV_MAPERR, "level 1 translation fault" },
394394 { do_translation_fault, SIGSEGV, SEGV_MAPERR, "level 2 translation fault" },
395395 { do_page_fault, SIGSEGV, SEGV_MAPERR, "level 3 translation fault" },
396− { do_bad, SIGBUS, 0, "reserved access flag fault" },
396+ { do_bad, SIGBUS, 0, "unknown 8" },
397397 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 1 access flag fault" },
398398 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 2 access flag fault" },
399399 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 3 access flag fault" },
400− { do_bad, SIGBUS, 0, "reserved permission fault" },
400+ { do_bad, SIGBUS, 0, "unknown 12" },
401401 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 1 permission fault" },
402402 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 2 permission fault" },
403403 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 3 permission fault" },
404404 { do_bad, SIGBUS, 0, "synchronous external abort" },
405− { do_bad, SIGBUS, 0, "asynchronous external abort" },
405+ { do_bad, SIGBUS, 0, "unknown 17" },
406406 { do_bad, SIGBUS, 0, "unknown 18" },
407407 { do_bad, SIGBUS, 0, "unknown 19" },
408408 { do_bad, SIGBUS, 0, "synchronous abort (translation table walk)" },
@@ -410,16 +410,16 @@ static struct fault_info { · 1 unmodified line
410410 { do_bad, SIGBUS, 0, "synchronous abort (translation table walk)" },
411411 { do_bad, SIGBUS, 0, "synchronous abort (translation table walk)" },
412412 { do_bad, SIGBUS, 0, "synchronous parity error" },
413− { do_bad, SIGBUS, 0, "asynchronous parity error" },
413+ { do_bad, SIGBUS, 0, "unknown 25" },
414414 { do_bad, SIGBUS, 0, "unknown 26" },
415415 { do_bad, SIGBUS, 0, "unknown 27" },
416− { do_bad, SIGBUS, 0, "synchronous parity error (translation table walk" },
417− { do_bad, SIGBUS, 0, "synchronous parity error (translation table walk" },
418− { do_bad, SIGBUS, 0, "synchronous parity error (translation table walk" },
419− { do_bad, SIGBUS, 0, "synchronous parity error (translation table walk" },
416+ { do_bad, SIGBUS, 0, "synchronous parity error (translation table walk)" },
417+ { do_bad, SIGBUS, 0, "synchronous parity error (translation table walk)" },
418+ { do_bad, SIGBUS, 0, "synchronous parity error (translation table walk)" },
419+ { do_bad, SIGBUS, 0, "synchronous parity error (translation table walk)" },
420420 { do_bad, SIGBUS, 0, "unknown 32" },
421421 { do_bad, SIGBUS, BUS_ADRALN, "alignment fault" },
422− { do_bad, SIGBUS, 0, "debug event" },
422+ { do_bad, SIGBUS, 0, "unknown 34" },
423423 { do_bad, SIGBUS, 0, "unknown 35" },
424424 { do_bad, SIGBUS, 0, "unknown 36" },
425425 { do_bad, SIGBUS, 0, "unknown 37" },
@@ -433,21 +433,21 @@ static struct fault_info { · 7 unmodified lines
433433 { do_bad, SIGBUS, 0, "unknown 45" },
434434 { do_bad, SIGBUS, 0, "unknown 46" },
435435 { do_bad, SIGBUS, 0, "unknown 47" },
436− { do_bad, SIGBUS, 0, "unknown 48" },
436+ { do_bad, SIGBUS, 0, "TLB conflict abort" },
437437 { do_bad, SIGBUS, 0, "unknown 49" },
438438 { do_bad, SIGBUS, 0, "unknown 50" },
439439 { do_bad, SIGBUS, 0, "unknown 51" },
440440 { do_bad, SIGBUS, 0, "implementation fault (lockdown abort)" },
441− { do_bad, SIGBUS, 0, "unknown 53" },
441+ { do_bad, SIGBUS, 0, "implementation fault (unsupported exclusive)" },
442442 { do_bad, SIGBUS, 0, "unknown 54" },
443443 { do_bad, SIGBUS, 0, "unknown 55" },
444444 { do_bad, SIGBUS, 0, "unknown 56" },
445445 { do_bad, SIGBUS, 0, "unknown 57" },
446− { do_bad, SIGBUS, 0, "implementation fault (coprocessor abort)" },
446+ { do_bad, SIGBUS, 0, "unknown 58" },
447447 { do_bad, SIGBUS, 0, "unknown 59" },
448448 { do_bad, SIGBUS, 0, "unknown 60" },
449− { do_bad, SIGBUS, 0, "unknown 61" },
450− { do_bad, SIGBUS, 0, "unknown 62" },
449+ { do_bad, SIGBUS, 0, "section domain fault" },
450+ { do_bad, SIGBUS, 0, "page domain fault" },
451451 { do_bad, SIGBUS, 0, "unknown 63" },
452452 };
453453
arch/arm64/mm/mmu.c+21−70
@@ -64,8 +64,12 @@ EXPORT_SYMBOL(phys_mem_access_prot); · 63 unmodified lines
6464
6565 static void __init *early_alloc(unsigned long sz)
6666 {
67− void *ptr = __va(memblock_alloc(sz, sz));
68− BUG_ON(!ptr);
67+ phys_addr_t phys;
68+ void *ptr;
69+
70+ phys = memblock_alloc(sz, sz);
71+ BUG_ON(!phys);
72+ ptr = __va(phys);
6973 memset(ptr, 0, sz);
7074 return ptr;
7175 }
@@ -81,55 +85,19 @@ static void split_pmd(pmd_t *pmd, pte_t *pte) · 9 unmodified lines
8185 do {
8286 /*
8387 * Need to have the least restrictive permissions available
84− * permissions will be fixed up later. Default the new page
85− * range as contiguous ptes.
88+ * permissions will be fixed up later
8689 */
87− set_pte(pte, pfn_pte(pfn, PAGE_KERNEL_EXEC_CONT));
90+ set_pte(pte, pfn_pte(pfn, PAGE_KERNEL_EXEC));
8891 pfn++;
8992 } while (pte++, i++, i < PTRS_PER_PTE);
9093 }
9194
92−/*
93− * Given a PTE with the CONT bit set, determine where the CONT range
94− * starts, and clear the entire range of PTE CONT bits.
95− */
96−static void clear_cont_pte_range(pte_t *pte, unsigned long addr)
97−{
98− int i;
99−
100− pte -= CONT_RANGE_OFFSET(addr);
101− for (i = 0; i < CONT_PTES; i++) {
102− set_pte(pte, pte_mknoncont(*pte));
103− pte++;
104− }
105− flush_tlb_all();
106−}
107−
108−/*
109− * Given a range of PTEs set the pfn and provided page protection flags
110− */
111−static void __populate_init_pte(pte_t *pte, unsigned long addr,
112− unsigned long end, phys_addr_t phys,
113− pgprot_t prot)
114−{
115− unsigned long pfn = __phys_to_pfn(phys);
116−
117− do {
118− /* clear all the bits except the pfn, then apply the prot */
119− set_pte(pte, pfn_pte(pfn, prot));
120− pte++;
121− pfn++;
122− addr += PAGE_SIZE;
123− } while (addr != end);
124−}
125−
12695 static void alloc_init_pte(pmd_t *pmd, unsigned long addr,
127− unsigned long end, phys_addr_t phys,
96+ unsigned long end, unsigned long pfn,
12897 pgprot_t prot,
12998 void *(*alloc)(unsigned long size))
13099 {
131100 pte_t *pte;
132− unsigned long next;
133101
134102 if (pmd_none(*pmd) || pmd_sect(*pmd)) {
135103 pte = alloc(PTRS_PER_PTE * sizeof(pte_t));
@@ -142,27 +110,9 @@ static void alloc_init_pte(pmd_t *pmd, unsigned long addr, · 6 unmodified lines
142110
143111 pte = pte_offset_kernel(pmd, addr);
144112 do {
145− next = min(end, (addr + CONT_SIZE) & CONT_MASK);
146− if (((addr | next | phys) & ~CONT_MASK) == 0) {
147− /* a block of CONT_PTES */
148− __populate_init_pte(pte, addr, next, phys,
149− __pgprot(pgprot_val(prot) | PTE_CONT));
150− } else {
151− /*
152− * If the range being split is already inside of a
153− * contiguous range but this PTE isn't going to be
154− * contiguous, then we want to unmark the adjacent
155− * ranges, then update the portion of the range we
156− * are interrested in.
157− */
158− clear_cont_pte_range(pte, addr);
159− __populate_init_pte(pte, addr, next, phys, prot);
160− }
161−
162− pte += (next - addr) >> PAGE_SHIFT;
163− phys += next - addr;
164− addr = next;
165− } while (addr != end);
113+ set_pte(pte, pfn_pte(pfn, prot));
114+ pfn++;
115+ } while (pte++, addr += PAGE_SIZE, addr != end);
166116 }
167117
168118 static void split_pud(pud_t *old_pud, pmd_t *pmd)
@@ -223,7 +173,8 @@ static void alloc_init_pmd(struct mm_struct *mm, pud_t *pud, · 54 unmodified lines
223173 }
224174 }
225175 } else {
226− alloc_init_pte(pmd, addr, next, phys, prot, alloc);
176+ alloc_init_pte(pmd, addr, next, __phys_to_pfn(phys),
177+ prot, alloc);
227178 }
228179 phys += next - addr;
229180 } while (pmd++, addr = next, addr != end);
@@ -362,8 +313,8 @@ static void __init __map_memblock(phys_addr_t start, phys_addr_t end) · 132 unmodified lines
362313 * for now. This will get more fine grained later once all memory
363314 * is mapped
364315 */
365− unsigned long kernel_x_start = round_down(__pa(_stext), SECTION_SIZE);
366− unsigned long kernel_x_end = round_up(__pa(__init_end), SECTION_SIZE);
316+ unsigned long kernel_x_start = round_down(__pa(_stext), SWAPPER_BLOCK_SIZE);
317+ unsigned long kernel_x_end = round_up(__pa(__init_end), SWAPPER_BLOCK_SIZE);
367318
368319 if (end < kernel_x_start) {
369320 create_mapping(start, __phys_to_virt(start),
@@ -451,18 +402,18 @@ static void __init fixup_executable(void) · 81 unmodified lines
451402 {
452403 #ifdef CONFIG_DEBUG_RODATA
453404 /* now that we are actually fully mapped, make the start/end more fine grained */
454− if (!IS_ALIGNED((unsigned long)_stext, SECTION_SIZE)) {
405+ if (!IS_ALIGNED((unsigned long)_stext, SWAPPER_BLOCK_SIZE)) {
455406 unsigned long aligned_start = round_down(__pa(_stext),
456− SECTION_SIZE);
407+ SWAPPER_BLOCK_SIZE);
457408
458409 create_mapping(aligned_start, __phys_to_virt(aligned_start),
459410 __pa(_stext) - aligned_start,
460411 PAGE_KERNEL);
461412 }
462413
463− if (!IS_ALIGNED((unsigned long)__init_end, SECTION_SIZE)) {
414+ if (!IS_ALIGNED((unsigned long)__init_end, SWAPPER_BLOCK_SIZE)) {
464415 unsigned long aligned_end = round_up(__pa(__init_end),
465− SECTION_SIZE);
416+ SWAPPER_BLOCK_SIZE);
466417 create_mapping(__pa(__init_end), (unsigned long)__init_end,
467418 aligned_end - __pa(__init_end),
468419 PAGE_KERNEL);
@@ -475,7 +426,7 @@ void mark_rodata_ro(void) · 6 unmodified lines
475426 {
476427 create_mapping_late(__pa(_stext), (unsigned long)_stext,
477428 (unsigned long)_etext - (unsigned long)_stext,
478− PAGE_KERNEL_EXEC | PTE_RDONLY);
429+ PAGE_KERNEL_ROX);
479430
480431 }
481432 #endif
arch/arm64/net/bpf_jit_comp.c+32−15
@@ -139,6 +139,12 @@ static inline int epilogue_offset(const struct jit_ctx *ctx) · 138 unmodified lines
139139 /* Stack must be multiples of 16B */
140140 #define STACK_ALIGN(sz) (((sz) + 15) & ~15)
141141
142+#define _STACK_SIZE \
143+ (MAX_BPF_STACK \
144+ + 4 /* extra for skb_copy_bits buffer */)
145+
146+#define STACK_SIZE STACK_ALIGN(_STACK_SIZE)
147+
142148 static void build_prologue(struct jit_ctx *ctx)
143149 {
144150 const u8 r6 = bpf2a64[BPF_REG_6];
@@ -150,10 +156,6 @@ static void build_prologue(struct jit_ctx *ctx) · 5 unmodified lines
150156 const u8 rx = bpf2a64[BPF_REG_X];
151157 const u8 tmp1 = bpf2a64[TMP_REG_1];
152158 const u8 tmp2 = bpf2a64[TMP_REG_2];
153− int stack_size = MAX_BPF_STACK;
154−
155− stack_size += 4; /* extra for skb_copy_bits buffer */
156− stack_size = STACK_ALIGN(stack_size);
157159
158160 /*
159161 * BPF prog stack layout
@@ -165,12 +167,13 @@ static void build_prologue(struct jit_ctx *ctx) · 5 unmodified lines
165167 * | ... | callee saved registers
166168 * +-----+
167169 * | | x25/x26
168− * BPF fp register => -80:+-----+
170+ * BPF fp register => -80:+-----+ <= (BPF_FP)
169171 * | |
170172 * | ... | BPF prog stack
171173 * | |
172− * | |
173− * current A64_SP => +-----+
174+ * +-----+ <= (BPF_FP - MAX_BPF_STACK)
175+ * |RSVD | JIT scratchpad
176+ * current A64_SP => +-----+ <= (BPF_FP - STACK_SIZE)
174177 * | |
175178 * | ... | Function call stack
176179 * | |
@@ -196,7 +199,7 @@ static void build_prologue(struct jit_ctx *ctx) · 19 unmodified lines
196199 emit(A64_MOV(1, fp, A64_SP), ctx);
197200
198201 /* Set up function call stack */
199− emit(A64_SUB_I(1, A64_SP, A64_SP, stack_size), ctx);
202+ emit(A64_SUB_I(1, A64_SP, A64_SP, STACK_SIZE), ctx);
200203
201204 /* Clear registers A and X */
202205 emit_a64_mov_i64(ra, 0, ctx);
@@ -213,13 +216,9 @@ static void build_epilogue(struct jit_ctx *ctx) · 10 unmodified lines
213216 const u8 fp = bpf2a64[BPF_REG_FP];
214217 const u8 tmp1 = bpf2a64[TMP_REG_1];
215218 const u8 tmp2 = bpf2a64[TMP_REG_2];
216− int stack_size = MAX_BPF_STACK;
217−
218− stack_size += 4; /* extra for skb_copy_bits buffer */
219− stack_size = STACK_ALIGN(stack_size);
220219
221220 /* We're done with BPF stack */
222− emit(A64_ADD_I(1, A64_SP, A64_SP, stack_size), ctx);
221+ emit(A64_ADD_I(1, A64_SP, A64_SP, STACK_SIZE), ctx);
223222
224223 /* Restore fs (x25) and x26 */
225224 emit(A64_POP(fp, A64_R(26), A64_SP), ctx);
@@ -591,7 +590,25 @@ emit_cond_jmp: · 365 unmodified lines
591590 case BPF_ST | BPF_MEM | BPF_H:
592591 case BPF_ST | BPF_MEM | BPF_B:
593592 case BPF_ST | BPF_MEM | BPF_DW:
594− goto notyet;
593+ /* Load imm to a register then store it */
594+ ctx->tmp_used = 1;
595+ emit_a64_mov_i(1, tmp2, off, ctx);
596+ emit_a64_mov_i(1, tmp, imm, ctx);
597+ switch (BPF_SIZE(code)) {
598+ case BPF_W:
599+ emit(A64_STR32(tmp, dst, tmp2), ctx);
600+ break;
601+ case BPF_H:
602+ emit(A64_STRH(tmp, dst, tmp2), ctx);
603+ break;
604+ case BPF_B:
605+ emit(A64_STRB(tmp, dst, tmp2), ctx);
606+ break;
607+ case BPF_DW:
608+ emit(A64_STR64(tmp, dst, tmp2), ctx);
609+ break;
610+ }
611+ break;
595612
596613 /* STX: *(size *)(dst + off) = src */
597614 case BPF_STX | BPF_MEM | BPF_W:
@@ -658,7 +675,7 @@ emit_cond_jmp: · 60 unmodified lines
658675 return -EINVAL;
659676 }
660677 emit_a64_mov_i64(r3, size, ctx);
661− emit(A64_ADD_I(1, r4, fp, MAX_BPF_STACK), ctx);
678+ emit(A64_SUB_I(1, r4, fp, STACK_SIZE), ctx);
662679 emit_a64_mov_i64(r5, (unsigned long)bpf_load_pointer, ctx);
663680 emit(A64_PUSH(A64_FP, A64_LR, A64_SP), ctx);
664681 emit(A64_MOV(1, A64_FP, A64_SP), ctx);
arch/m68k/coldfire/m54xx.c+1−1
@@ -98,7 +98,7 @@ static void __init mcf54xx_bootmem_alloc(void) · 97 unmodified lines
9898 memstart = PAGE_ALIGN(_ramstart);
9999 min_low_pfn = PFN_DOWN(_rambase);
100100 start_pfn = PFN_DOWN(memstart);
101− max_low_pfn = PFN_DOWN(_ramend);
101+ max_pfn = max_low_pfn = PFN_DOWN(_ramend);
102102 high_memory = (void *)_ramend;
103103
104104 m68k_virt_to_node_shift = fls(_ramend - _rambase - 1) - 6;
arch/m68k/include/asm/unistd.h+1−1
@@ -4,7 +4,7 @@ · 3 unmodified lines
44 #include <uapi/asm/unistd.h>
55
66
7−#define NR_syscalls 375
7+#define NR_syscalls 376
88
99 #define __ARCH_WANT_OLD_READDIR
1010 #define __ARCH_WANT_OLD_STAT
arch/m68k/include/uapi/asm/unistd.h+1−0
@@ -380,5 +380,6 @@ · 379 unmodified lines
380380 #define __NR_sendmmsg 372
381381 #define __NR_userfaultfd 373
382382 #define __NR_membarrier 374
383+#define __NR_mlock2 375
383384
384385 #endif /* _UAPI_ASM_M68K_UNISTD_H_ */
arch/m68k/kernel/setup_no.c+6−3
@@ -238,11 +238,14 @@ void __init setup_arch(char **cmdline_p) · 237 unmodified lines
238238 * Give all the memory to the bootmap allocator, tell it to put the
239239 * boot mem_map at the start of memory.
240240 */
241+ min_low_pfn = PFN_DOWN(memory_start);
242+ max_pfn = max_low_pfn = PFN_DOWN(memory_end);
243+
241244 bootmap_size = init_bootmem_node(
242245 NODE_DATA(0),
243− memory_start >> PAGE_SHIFT, /* map goes here */
244− PAGE_OFFSET >> PAGE_SHIFT, /* 0 on coldfire */
245− memory_end >> PAGE_SHIFT);
246+ min_low_pfn, /* map goes here */
247+ PFN_DOWN(PAGE_OFFSET),
248+ max_pfn);
246249 /*
247250 * Free the usable memory, we have to make sure we do not free
248251 * the bootmem bitmap so we then reserve it after freeing it :-)
arch/m68k/kernel/syscalltable.S+1−0
@@ -395,3 +395,4 @@ ENTRY(sys_call_table) · 394 unmodified lines
395395 .long sys_sendmmsg
396396 .long sys_userfaultfd
397397 .long sys_membarrier
398+ .long sys_mlock2 /* 375 */
arch/m68k/mm/motorola.c+1−1
@@ -250,7 +250,7 @@ void __init paging_init(void) · 249 unmodified lines
250250 high_memory = phys_to_virt(max_addr);
251251
252252 min_low_pfn = availmem >> PAGE_SHIFT;
253− max_low_pfn = max_addr >> PAGE_SHIFT;
253+ max_pfn = max_low_pfn = max_addr >> PAGE_SHIFT;
254254
255255 for (i = 0; i < m68k_num_memory; i++) {
256256 addr = m68k_memory[i].addr;
arch/m68k/sun3/config.c+2−2
@@ -118,13 +118,13 @@ static void __init sun3_bootmem_alloc(unsigned long memory_start, · 117 unmodified lines
118118 memory_end = memory_end & PAGE_MASK;
119119
120120 start_page = __pa(memory_start) >> PAGE_SHIFT;
121− num_pages = __pa(memory_end) >> PAGE_SHIFT;
121+ max_pfn = num_pages = __pa(memory_end) >> PAGE_SHIFT;
122122
123123 high_memory = (void *)memory_end;
124124 availmem = memory_start;
125125
126126 m68k_setup_node(0);
127− availmem += init_bootmem_node(NODE_DATA(0), start_page, 0, num_pages);
127+ availmem += init_bootmem(start_page, num_pages);
128128 availmem = (availmem + (PAGE_SIZE-1)) & PAGE_MASK;
129129
130130 free_bootmem(__pa(availmem), memory_end - (availmem));
arch/mips/ath79/setup.c+6−1
@@ -216,9 +216,9 @@ void __init plat_mem_setup(void) · 215 unmodified lines
216216 AR71XX_RESET_SIZE);
217217 ath79_pll_base = ioremap_nocache(AR71XX_PLL_BASE,
218218 AR71XX_PLL_SIZE);
219+ ath79_detect_sys_type();
219220 ath79_ddr_ctrl_init();
220221
221− ath79_detect_sys_type();
222222 if (mips_machtype != ATH79_MACH_GENERIC_OF)
223223 detect_memory_region(0, ATH79_MEM_SIZE_MIN, ATH79_MEM_SIZE_MAX);
224224
@@ -281,3 +281,8 @@ MIPS_MACHINE(ATH79_MACH_GENERIC, · 56 unmodified lines
281281 "Generic",
282282 "Generic AR71XX/AR724X/AR913X based board",
283283 ath79_generic_init);
284+
285+MIPS_MACHINE(ATH79_MACH_GENERIC_OF,
286+ "DTB",
287+ "Generic AR71XX/AR724X/AR913X based board (DT)",
288+ NULL);
arch/mips/boot/dts/qca/ar9132.dtsi+1−1
@@ -107,7 +107,7 @@ · 106 unmodified lines
107107 miscintc: interrupt-controller@18060010 {
108108 compatible = "qca,ar9132-misc-intc",
109109 "qca,ar7100-misc-intc";
110− reg = <0x18060010 0x4>;
110+ reg = <0x18060010 0x8>;
111111
112112 interrupt-parent = <&cpuintc>;
113113 interrupts = <6>;
arch/mips/include/asm/page.h+2−1
@@ -200,8 +200,9 @@ static inline int pfn_valid(unsigned long pfn) · 199 unmodified lines
200200 {
201201 /* avoid <linux/mm.h> include hell */
202202 extern unsigned long max_mapnr;
203+ unsigned long pfn_offset = ARCH_PFN_OFFSET;
203204
204− return pfn >= ARCH_PFN_OFFSET && pfn < max_mapnr;
205+ return pfn >= pfn_offset && pfn < max_mapnr;
205206 }
206207
207208 #elif defined(CONFIG_SPARSEMEM)
arch/mips/kvm/emulate.c+1−1
@@ -1581,7 +1581,7 @@ enum emulation_result kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, · 1580 unmodified lines
15811581
15821582 base = (inst >> 21) & 0x1f;
15831583 op_inst = (inst >> 16) & 0x1f;
1584− offset = inst & 0xffff;
1584+ offset = (int16_t)inst;
15851585 cache = (inst >> 16) & 0x3;
15861586 op = (inst >> 18) & 0x7;
15871587
arch/mips/kvm/locore.S+10−6
@@ -157,9 +157,11 @@ FEXPORT(__kvm_mips_vcpu_run) · 156 unmodified lines
157157
158158 FEXPORT(__kvm_mips_load_asid)
159159 /* Set the ASID for the Guest Kernel */
160− INT_SLL t0, t0, 1 /* with kseg0 @ 0x40000000, kernel */
161− /* addresses shift to 0x80000000 */
162− bltz t0, 1f /* If kernel */
160+ PTR_L t0, VCPU_COP0(k1)
161+ LONG_L t0, COP0_STATUS(t0)
162+ andi t0, KSU_USER | ST0_ERL | ST0_EXL
163+ xori t0, KSU_USER
164+ bnez t0, 1f /* If kernel */
163165 INT_ADDIU t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */
164166 INT_ADDIU t1, k1, VCPU_GUEST_USER_ASID /* else user */
165167 1:
@@ -474,9 +476,11 @@ __kvm_mips_return_to_guest: · 308 unmodified lines
474476 mtc0 t0, CP0_EPC
475477
476478 /* Set the ASID for the Guest Kernel */
477− INT_SLL t0, t0, 1 /* with kseg0 @ 0x40000000, kernel */
478− /* addresses shift to 0x80000000 */
479− bltz t0, 1f /* If kernel */
479+ PTR_L t0, VCPU_COP0(k1)
480+ LONG_L t0, COP0_STATUS(t0)
481+ andi t0, KSU_USER | ST0_ERL | ST0_EXL
482+ xori t0, KSU_USER
483+ bnez t0, 1f /* If kernel */
480484 INT_ADDIU t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */
481485 INT_ADDIU t1, k1, VCPU_GUEST_USER_ASID /* else user */
482486 1:
arch/mips/kvm/mips.c+4−1
@@ -279,7 +279,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) · 278 unmodified lines
279279
280280 if (!gebase) {
281281 err = -ENOMEM;
282− goto out_free_cpu;
282+ goto out_uninit_cpu;
283283 }
284284 kvm_debug("Allocated %d bytes for KVM Exception Handlers @ %p\n",
285285 ALIGN(size, PAGE_SIZE), gebase);
@@ -343,6 +343,9 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) · 57 unmodified lines
343343 out_free_gebase:
344344 kfree(gebase);
345345
346+out_uninit_cpu:
347+ kvm_vcpu_uninit(vcpu);
348+
346349 out_free_cpu:
347350 kfree(vcpu);
348351
arch/mips/pci/pci-rt2880.c+2−2
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 * by the Free Software Foundation.
1212 */
1313
14+#include <linux/delay.h>
1415 #include <linux/types.h>
1516 #include <linux/pci.h>
1617 #include <linux/io.h>
@@ -232,8 +233,7 @@ static int rt288x_pci_probe(struct platform_device *pdev) · 215 unmodified lines
232233 ioport_resource.end = RT2880_PCI_IO_BASE + RT2880_PCI_IO_SIZE - 1;
233234
234235 rt2880_pci_reg_write(0, RT2880_PCI_REG_PCICFG_ADDR);
235− for (i = 0; i < 0xfffff; i++)
236− ;
236+ udelay(1);
237237
238238 rt2880_pci_reg_write(0x79, RT2880_PCI_REG_ARBCTL);
239239 rt2880_pci_reg_write(0x07FF0001, RT2880_PCI_REG_BAR0SETUP_ADDR);
arch/mips/pmcs-msp71xx/msp_setup.c+3−1
@@ -10,6 +10,8 @@ · 9 unmodified lines
1010 * option) any later version.
1111 */
1212
13+#include <linux/delay.h>
14+
1315 #include <asm/bootinfo.h>
1416 #include <asm/cacheflush.h>
1517 #include <asm/idle.h>
@@ -77,7 +79,7 @@ void msp7120_reset(void) · 61 unmodified lines
7779 */
7880
7981 /* Wait a bit for the DDRC to settle */
80− for (i = 0; i < 100000000; i++);
82+ mdelay(125);
8183
8284 #if defined(CONFIG_PMC_MSP7120_GW)
8385 /*
arch/mips/sni/reset.c+4−2
@@ -3,6 +3,8 @@ · 2 unmodified lines
33 *
44 * Reset a SNI machine.
55 */
6+#include <linux/delay.h>
7+
68 #include <asm/io.h>
79 #include <asm/reboot.h>
810 #include <asm/sni.h>
@@ -32,9 +34,9 @@ void sni_machine_restart(char *command) · 23 unmodified lines
3234 for (;;) {
3335 for (i = 0; i < 100; i++) {
3436 kb_wait();
35− for (j = 0; j < 100000 ; j++)
36− /* nothing */;
37+ udelay(50);
3738 outb_p(0xfe, 0x64); /* pulse reset low */
39+ udelay(50);
3840 }
3941 }
4042 }
arch/mn10300/Kconfig+1−3
@@ -1,6 +1,7 @@
11 config MN10300
22 def_bool y
33 select HAVE_OPROFILE
4+ select HAVE_UID16
45 select GENERIC_IRQ_SHOW
56 select ARCH_WANT_IPC_PARSE_VERSION
67 select HAVE_ARCH_TRACEHOOK
@@ -37,9 +38,6 @@ config HIGHMEM · 30 unmodified lines
3738 config NUMA
3839 def_bool n
3940
40−config UID16
41− def_bool y
42−
4341 config RWSEM_GENERIC_SPINLOCK
4442 def_bool y
4543
arch/nios2/mm/cacheflush.c+4−20
@@ -23,22 +23,6 @@ static void __flush_dcache(unsigned long start, unsigned long end) · 22 unmodified lines
2323 end += (cpuinfo.dcache_line_size - 1);
2424 end &= ~(cpuinfo.dcache_line_size - 1);
2525
26− for (addr = start; addr < end; addr += cpuinfo.dcache_line_size) {
27− __asm__ __volatile__ (" flushda 0(%0)\n"
28− : /* Outputs */
29− : /* Inputs */ "r"(addr)
30− /* : No clobber */);
31− }
32−}
33−
34−static void __flush_dcache_all(unsigned long start, unsigned long end)
35−{
36− unsigned long addr;
37−
38− start &= ~(cpuinfo.dcache_line_size - 1);
39− end += (cpuinfo.dcache_line_size - 1);
40− end &= ~(cpuinfo.dcache_line_size - 1);
41−
4226 if (end > start + cpuinfo.dcache_size)
4327 end = start + cpuinfo.dcache_size;
4428
@@ -112,7 +96,7 @@ static void flush_aliases(struct address_space *mapping, struct page *page) · 67 unmodified lines
11296
11397 void flush_cache_all(void)
11498 {
115− __flush_dcache_all(0, cpuinfo.dcache_size);
99+ __flush_dcache(0, cpuinfo.dcache_size);
116100 __flush_icache(0, cpuinfo.icache_size);
117101 }
118102
@@ -182,7 +166,7 @@ void __flush_dcache_page(struct address_space *mapping, struct page *page) · 63 unmodified lines
182166 */
183167 unsigned long start = (unsigned long)page_address(page);
184168
185− __flush_dcache_all(start, start + PAGE_SIZE);
169+ __flush_dcache(start, start + PAGE_SIZE);
186170 }
187171
188172 void flush_dcache_page(struct page *page)
@@ -268,7 +252,7 @@ void copy_from_user_page(struct vm_area_struct *vma, struct page *page, · 79 unmodified lines
268252 {
269253 flush_cache_page(vma, user_vaddr, page_to_pfn(page));
270254 memcpy(dst, src, len);
271− __flush_dcache_all((unsigned long)src, (unsigned long)src + len);
255+ __flush_dcache((unsigned long)src, (unsigned long)src + len);
272256 if (vma->vm_flags & VM_EXEC)
273257 __flush_icache((unsigned long)src, (unsigned long)src + len);
274258 }
@@ -279,7 +263,7 @@ void copy_to_user_page(struct vm_area_struct *vma, struct page *page, · 4 unmodified lines
279263 {
280264 flush_cache_page(vma, user_vaddr, page_to_pfn(page));
281265 memcpy(dst, src, len);
282− __flush_dcache_all((unsigned long)dst, (unsigned long)dst + len);
266+ __flush_dcache((unsigned long)dst, (unsigned long)dst + len);
283267 if (vma->vm_flags & VM_EXEC)
284268 __flush_icache((unsigned long)dst, (unsigned long)dst + len);
285269 }
arch/parisc/Kconfig+3−0
@@ -108,6 +108,9 @@ config PGTABLE_LEVELS · 107 unmodified lines
108108 default 3 if 64BIT && PARISC_PAGE_SIZE_4KB
109109 default 2
110110
111+config SYS_SUPPORTS_HUGETLBFS
112+ def_bool y if PA20
113+
111114 source "init/Kconfig"
112115
113116 source "kernel/Kconfig.freezer"
arch/parisc/include/asm/hugetlb.h+85−0
@@ -0,0 +1,85 @@
1+#ifndef _ASM_PARISC64_HUGETLB_H
2+#define _ASM_PARISC64_HUGETLB_H
3+
4+#include <asm/page.h>
5+#include <asm-generic/hugetlb.h>
6+
7+
8+void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
9+ pte_t *ptep, pte_t pte);
10+
11+pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
12+ pte_t *ptep);
13+
14+static inline int is_hugepage_only_range(struct mm_struct *mm,
15+ unsigned long addr,
16+ unsigned long len) {
17+ return 0;
18+}
19+
20+/*
21+ * If the arch doesn't supply something else, assume that hugepage
22+ * size aligned regions are ok without further preparation.
23+ */
24+static inline int prepare_hugepage_range(struct file *file,
25+ unsigned long addr, unsigned long len)
26+{
27+ if (len & ~HPAGE_MASK)
28+ return -EINVAL;
29+ if (addr & ~HPAGE_MASK)
30+ return -EINVAL;
31+ return 0;
32+}
33+
34+static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb,
35+ unsigned long addr, unsigned long end,
36+ unsigned long floor,
37+ unsigned long ceiling)
38+{
39+ free_pgd_range(tlb, addr, end, floor, ceiling);
40+}
41+
42+static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
43+ unsigned long addr, pte_t *ptep)
44+{
45+}
46+
47+static inline int huge_pte_none(pte_t pte)
48+{
49+ return pte_none(pte);
50+}
51+
52+static inline pte_t huge_pte_wrprotect(pte_t pte)
53+{
54+ return pte_wrprotect(pte);
55+}
56+
57+static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
58+ unsigned long addr, pte_t *ptep)
59+{
60+ pte_t old_pte = *ptep;
61+ set_huge_pte_at(mm, addr, ptep, pte_wrprotect(old_pte));
62+}
63+
64+static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
65+ unsigned long addr, pte_t *ptep,
66+ pte_t pte, int dirty)
67+{
68+ int changed = !pte_same(*ptep, pte);
69+ if (changed) {
70+ set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
71+ flush_tlb_page(vma, addr);
72+ }
73+ return changed;
74+}
75+
76+static inline pte_t huge_ptep_get(pte_t *ptep)
77+{
78+ return *ptep;
79+}
80+
81+static inline void arch_clear_hugepage_flags(struct page *page)
82+{
83+}
84+
85+#endif /* _ASM_PARISC64_HUGETLB_H */
arch/parisc/include/asm/page.h+12−1
@@ -145,11 +145,22 @@ extern int npmem_ranges; · 144 unmodified lines
145145 #endif /* CONFIG_DISCONTIGMEM */
146146
147147 #ifdef CONFIG_HUGETLB_PAGE
148−#define HPAGE_SHIFT 22 /* 4MB (is this fixed?) */
148+#define HPAGE_SHIFT PMD_SHIFT /* fixed for transparent huge pages */
149149 #define HPAGE_SIZE ((1UL) << HPAGE_SHIFT)
150150 #define HPAGE_MASK (~(HPAGE_SIZE - 1))
151151 #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
152+
153+#if defined(CONFIG_64BIT) && defined(CONFIG_PARISC_PAGE_SIZE_4KB)
154+# define REAL_HPAGE_SHIFT 20 /* 20 = 1MB */
155+# define _HUGE_PAGE_SIZE_ENCODING_DEFAULT _PAGE_SIZE_ENCODING_1M
156+#elif !defined(CONFIG_64BIT) && defined(CONFIG_PARISC_PAGE_SIZE_4KB)
157+# define REAL_HPAGE_SHIFT 22 /* 22 = 4MB */
158+# define _HUGE_PAGE_SIZE_ENCODING_DEFAULT _PAGE_SIZE_ENCODING_4M
159+#else
160+# define REAL_HPAGE_SHIFT 24 /* 24 = 16MB */
161+# define _HUGE_PAGE_SIZE_ENCODING_DEFAULT _PAGE_SIZE_ENCODING_16M
152162 #endif
163+#endif /* CONFIG_HUGETLB_PAGE */
153164
154165 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
155166
arch/parisc/include/asm/pgalloc.h+1−1
@@ -35,7 +35,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm) · 34 unmodified lines
3535 PxD_FLAG_VALID |
3636 PxD_FLAG_ATTACHED)
3737 + (__u32)(__pa((unsigned long)pgd) >> PxD_VALUE_SHIFT));
38− /* The first pmd entry also is marked with _PAGE_GATEWAY as
38+ /* The first pmd entry also is marked with PxD_FLAG_ATTACHED as
3939 * a signal that this pmd may not be freed */
4040 __pgd_val_set(*pgd, PxD_FLAG_ATTACHED);
4141 #endif
arch/parisc/include/asm/pgtable.h+22−4
@@ -83,7 +83,11 @@ static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr) · 82 unmodified lines
8383 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, (unsigned long)pgd_val(e))
8484
8585 /* This is the size of the initially mapped kernel memory */
86−#define KERNEL_INITIAL_ORDER 24 /* 0 to 1<<24 = 16MB */
86+#ifdef CONFIG_64BIT
87+#define KERNEL_INITIAL_ORDER 25 /* 1<<25 = 32MB */
88+#else
89+#define KERNEL_INITIAL_ORDER 24 /* 1<<24 = 16MB */
90+#endif
8791 #define KERNEL_INITIAL_SIZE (1 << KERNEL_INITIAL_ORDER)
8892
8993 #if CONFIG_PGTABLE_LEVELS == 3
@@ -167,7 +171,7 @@ static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr) · 77 unmodified lines
167171 #define _PAGE_NO_CACHE_BIT 24 /* (0x080) Uncached Page (U bit) */
168172 #define _PAGE_ACCESSED_BIT 23 /* (0x100) Software: Page Accessed */
169173 #define _PAGE_PRESENT_BIT 22 /* (0x200) Software: translation valid */
170−/* bit 21 was formerly the FLUSH bit but is now unused */
174+#define _PAGE_HPAGE_BIT 21 /* (0x400) Software: Huge Page */
171175 #define _PAGE_USER_BIT 20 /* (0x800) Software: User accessible page */
172176
173177 /* N.B. The bits are defined in terms of a 32 bit word above, so the */
@@ -194,6 +198,7 @@ static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr) · 20 unmodified lines
194198 #define _PAGE_NO_CACHE (1 << xlate_pabit(_PAGE_NO_CACHE_BIT))
195199 #define _PAGE_ACCESSED (1 << xlate_pabit(_PAGE_ACCESSED_BIT))
196200 #define _PAGE_PRESENT (1 << xlate_pabit(_PAGE_PRESENT_BIT))
201+#define _PAGE_HUGE (1 << xlate_pabit(_PAGE_HPAGE_BIT))
197202 #define _PAGE_USER (1 << xlate_pabit(_PAGE_USER_BIT))
198203
199204 #define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | _PAGE_DIRTY | _PAGE_ACCESSED)
@@ -217,7 +222,7 @@ static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr) · 17 unmodified lines
217222 #define PxD_FLAG_VALID (1 << xlate_pabit(_PxD_VALID_BIT))
218223 #define PxD_FLAG_MASK (0xf)
219224 #define PxD_FLAG_SHIFT (4)
220−#define PxD_VALUE_SHIFT (8) /* (PAGE_SHIFT-PxD_FLAG_SHIFT) */
225+#define PxD_VALUE_SHIFT (PFN_PTE_SHIFT-PxD_FLAG_SHIFT)
221226
222227 #ifndef __ASSEMBLY__
223228
@@ -362,6 +367,18 @@ static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; ret · 138 unmodified lines
362367 static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_WRITE; return pte; }
363368 static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
364369
370+/*
371+ * Huge pte definitions.
372+ */
373+#ifdef CONFIG_HUGETLB_PAGE
374+#define pte_huge(pte) (pte_val(pte) & _PAGE_HUGE)
375+#define pte_mkhuge(pte) (__pte(pte_val(pte) | _PAGE_HUGE))
376+#else
377+#define pte_huge(pte) (0)
378+#define pte_mkhuge(pte) (pte)
379+#endif
380+
381+
365382 /*
366383 * Conversion functions: convert a page and protection to a page entry,
367384 * and a page entry and page directory to the page they refer to.
@@ -410,8 +427,9 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) · 42 unmodified lines
410427 /* Find an entry in the second-level page table.. */
411428
412429 #if CONFIG_PGTABLE_LEVELS == 3
430+#define pmd_index(addr) (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))
413431 #define pmd_offset(dir,address) \
414−((pmd_t *) pgd_page_vaddr(*(dir)) + (((address)>>PMD_SHIFT) & (PTRS_PER_PMD-1)))
432+((pmd_t *) pgd_page_vaddr(*(dir)) + pmd_index(address))
415433 #else
416434 #define pmd_offset(dir,addr) ((pmd_t *) dir)
417435 #endif
arch/parisc/include/asm/processor.h+0−27
@@ -192,33 +192,6 @@ void show_trace(struct task_struct *task, unsigned long *stack); · 191 unmodified lines
192192 */
193193 typedef unsigned int elf_caddr_t;
194194
195−#define start_thread_som(regs, new_pc, new_sp) do { \
196− unsigned long *sp = (unsigned long *)new_sp; \
197− __u32 spaceid = (__u32)current->mm->context; \
198− unsigned long pc = (unsigned long)new_pc; \
199− /* offset pc for priv. level */ \
200− pc |= 3; \
201− \
202− regs->iasq[0] = spaceid; \
203− regs->iasq[1] = spaceid; \
204− regs->iaoq[0] = pc; \
205− regs->iaoq[1] = pc + 4; \
206− regs->sr[2] = LINUX_GATEWAY_SPACE; \
207− regs->sr[3] = 0xffff; \
208− regs->sr[4] = spaceid; \
209− regs->sr[5] = spaceid; \
210− regs->sr[6] = spaceid; \
211− regs->sr[7] = spaceid; \
212− regs->gr[ 0] = USER_PSW; \
213− regs->gr[30] = ((new_sp)+63)&~63; \
214− regs->gr[31] = pc; \
215− \
216− get_user(regs->gr[26],&sp[0]); \
217− get_user(regs->gr[25],&sp[-1]); \
218− get_user(regs->gr[24],&sp[-2]); \
219− get_user(regs->gr[23],&sp[-3]); \
220−} while(0)
221−
222195 /* The ELF abi wants things done a "wee bit" differently than
223196 * som does. Supporting this behavior here avoids
224197 * having our own version of create_elf_tables.
arch/parisc/include/uapi/asm/mman.h+0−10
@@ -49,16 +49,6 @@ · 48 unmodified lines
4949 #define MADV_DONTFORK 10 /* don't inherit across fork */
5050 #define MADV_DOFORK 11 /* do inherit across fork */
5151
52−/* The range 12-64 is reserved for page size specification. */
53−#define MADV_4K_PAGES 12 /* Use 4K pages */
54−#define MADV_16K_PAGES 14 /* Use 16K pages */
55−#define MADV_64K_PAGES 16 /* Use 64K pages */
56−#define MADV_256K_PAGES 18 /* Use 256K pages */
57−#define MADV_1M_PAGES 20 /* Use 1 Megabyte pages */
58−#define MADV_4M_PAGES 22 /* Use 4 Megabyte pages */
59−#define MADV_16M_PAGES 24 /* Use 16 Megabyte pages */
60−#define MADV_64M_PAGES 26 /* Use 64 Megabyte pages */
61−
6252 #define MADV_MERGEABLE 65 /* KSM may merge identical pages */
6353 #define MADV_UNMERGEABLE 66 /* KSM may not merge identical pages */
6454
arch/parisc/kernel/asm-offsets.c+8−0
@@ -289,6 +289,14 @@ int main(void) · 288 unmodified lines
289289 DEFINE(ASM_PTE_ENTRY_SIZE, PTE_ENTRY_SIZE);
290290 DEFINE(ASM_PFN_PTE_SHIFT, PFN_PTE_SHIFT);
291291 DEFINE(ASM_PT_INITIAL, PT_INITIAL);
292+ BLANK();
293+ /* HUGEPAGE_SIZE is only used in vmlinux.lds.S to align kernel text
294+ * and kernel data on physical huge pages */
295+#ifdef CONFIG_HUGETLB_PAGE
296+ DEFINE(HUGEPAGE_SIZE, 1UL << REAL_HPAGE_SHIFT);
297+#else
298+ DEFINE(HUGEPAGE_SIZE, PAGE_SIZE);
299+#endif
292300 BLANK();
293301 DEFINE(EXCDATA_IP, offsetof(struct exception_data, fault_ip));
294302 DEFINE(EXCDATA_SPACE, offsetof(struct exception_data, fault_space));
arch/parisc/kernel/entry.S+34−22
@@ -502,21 +502,38 @@ · 501 unmodified lines
502502 STREG \pte,0(\ptp)
503503 .endm
504504
505+ /* We have (depending on the page size):
506+ * - 38 to 52-bit Physical Page Number
507+ * - 12 to 26-bit page offset
508+ */
505509 /* bitshift difference between a PFN (based on kernel's PAGE_SIZE)
506510 * to a CPU TLB 4k PFN (4k => 12 bits to shift) */
507− #define PAGE_ADD_SHIFT (PAGE_SHIFT-12)
511+ #define PAGE_ADD_SHIFT (PAGE_SHIFT-12)
512+ #define PAGE_ADD_HUGE_SHIFT (REAL_HPAGE_SHIFT-12)
508513
509514 /* Drop prot bits and convert to page addr for iitlbt and idtlbt */
510− .macro convert_for_tlb_insert20 pte
515+ .macro convert_for_tlb_insert20 pte,tmp
516+#ifdef CONFIG_HUGETLB_PAGE
517+ copy \pte,\tmp
518+ extrd,u \tmp,(63-ASM_PFN_PTE_SHIFT)+(63-58)+PAGE_ADD_SHIFT,\
519+ 64-PAGE_SHIFT-PAGE_ADD_SHIFT,\pte
520+
521+ depdi _PAGE_SIZE_ENCODING_DEFAULT,63,\
522+ (63-58)+PAGE_ADD_SHIFT,\pte
523+ extrd,u,*= \tmp,_PAGE_HPAGE_BIT+32,1,%r0
524+ depdi _HUGE_PAGE_SIZE_ENCODING_DEFAULT,63,\
525+ (63-58)+PAGE_ADD_HUGE_SHIFT,\pte
526+#else /* Huge pages disabled */
511527 extrd,u \pte,(63-ASM_PFN_PTE_SHIFT)+(63-58)+PAGE_ADD_SHIFT,\
512528 64-PAGE_SHIFT-PAGE_ADD_SHIFT,\pte
513529 depdi _PAGE_SIZE_ENCODING_DEFAULT,63,\
514530 (63-58)+PAGE_ADD_SHIFT,\pte
531+#endif
515532 .endm
516533
517534 /* Convert the pte and prot to tlb insertion values. How
518535 * this happens is quite subtle, read below */
519− .macro make_insert_tlb spc,pte,prot
536+ .macro make_insert_tlb spc,pte,prot,tmp
520537 space_to_prot \spc \prot /* create prot id from space */
521538 /* The following is the real subtlety. This is depositing
522539 * T <-> _PAGE_REFTRAP
@@ -553,7 +570,7 @@ · 30 unmodified lines
553570 depdi 1,12,1,\prot
554571
555572 /* Drop prot bits and convert to page addr for iitlbt and idtlbt */
556− convert_for_tlb_insert20 \pte
573+ convert_for_tlb_insert20 \pte \tmp
557574 .endm
558575
559576 /* Identical macro to make_insert_tlb above, except it
@@ -646,17 +663,12 @@ · 86 unmodified lines
646663
647664
648665 /*
649− * Align fault_vector_20 on 4K boundary so that both
650− * fault_vector_11 and fault_vector_20 are on the
651− * same page. This is only necessary as long as we
652− * write protect the kernel text, which we may stop
653− * doing once we use large page translations to cover
654− * the static part of the kernel address space.
666+ * Fault_vectors are architecturally required to be aligned on a 2K
667+ * boundary
655668 */
656669
657670 .text
658−
659− .align 4096
671+ .align 2048
660672
661673 ENTRY(fault_vector_20)
662674 /* First vector is invalid (0) */
@@ -1147,7 +1159,7 @@ dtlb_miss_20w: · 484 unmodified lines
11471159 tlb_lock spc,ptp,pte,t0,t1,dtlb_check_alias_20w
11481160 update_accessed ptp,pte,t0,t1
11491161
1150− make_insert_tlb spc,pte,prot
1162+ make_insert_tlb spc,pte,prot,t1
11511163
11521164 idtlbt pte,prot
11531165
@@ -1173,7 +1185,7 @@ nadtlb_miss_20w: · 19 unmodified lines
11731185 tlb_lock spc,ptp,pte,t0,t1,nadtlb_check_alias_20w
11741186 update_accessed ptp,pte,t0,t1
11751187
1176− make_insert_tlb spc,pte,prot
1188+ make_insert_tlb spc,pte,prot,t1
11771189
11781190 idtlbt pte,prot
11791191
@@ -1267,7 +1279,7 @@ dtlb_miss_20: · 87 unmodified lines
12671279 tlb_lock spc,ptp,pte,t0,t1,dtlb_check_alias_20
12681280 update_accessed ptp,pte,t0,t1
12691281
1270− make_insert_tlb spc,pte,prot
1282+ make_insert_tlb spc,pte,prot,t1
12711283
12721284 f_extend pte,t1
12731285
@@ -1295,7 +1307,7 @@ nadtlb_miss_20: · 21 unmodified lines
12951307 tlb_lock spc,ptp,pte,t0,t1,nadtlb_check_alias_20
12961308 update_accessed ptp,pte,t0,t1
12971309
1298− make_insert_tlb spc,pte,prot
1310+ make_insert_tlb spc,pte,prot,t1
12991311
13001312 f_extend pte,t1
13011313
@@ -1404,7 +1416,7 @@ itlb_miss_20w: · 102 unmodified lines
14041416 tlb_lock spc,ptp,pte,t0,t1,itlb_fault
14051417 update_accessed ptp,pte,t0,t1
14061418
1407− make_insert_tlb spc,pte,prot
1419+ make_insert_tlb spc,pte,prot,t1
14081420
14091421 iitlbt pte,prot
14101422
@@ -1428,7 +1440,7 @@ naitlb_miss_20w: · 17 unmodified lines
14281440 tlb_lock spc,ptp,pte,t0,t1,naitlb_check_alias_20w
14291441 update_accessed ptp,pte,t0,t1
14301442
1431− make_insert_tlb spc,pte,prot
1443+ make_insert_tlb spc,pte,prot,t1
14321444
14331445 iitlbt pte,prot
14341446
@@ -1514,7 +1526,7 @@ itlb_miss_20: · 79 unmodified lines
15141526 tlb_lock spc,ptp,pte,t0,t1,itlb_fault
15151527 update_accessed ptp,pte,t0,t1
15161528
1517− make_insert_tlb spc,pte,prot
1529+ make_insert_tlb spc,pte,prot,t1
15181530
15191531 f_extend pte,t1
15201532
@@ -1534,7 +1546,7 @@ naitlb_miss_20: · 13 unmodified lines
15341546 tlb_lock spc,ptp,pte,t0,t1,naitlb_check_alias_20
15351547 update_accessed ptp,pte,t0,t1
15361548
1537− make_insert_tlb spc,pte,prot
1549+ make_insert_tlb spc,pte,prot,t1
15381550
15391551 f_extend pte,t1
15401552
@@ -1566,7 +1578,7 @@ dbit_trap_20w: · 25 unmodified lines
15661578 tlb_lock spc,ptp,pte,t0,t1,dbit_fault
15671579 update_dirty ptp,pte,t1
15681580
1569− make_insert_tlb spc,pte,prot
1581+ make_insert_tlb spc,pte,prot,t1
15701582
15711583 idtlbt pte,prot
15721584
@@ -1610,7 +1622,7 @@ dbit_trap_20: · 37 unmodified lines
16101622 tlb_lock spc,ptp,pte,t0,t1,dbit_fault
16111623 update_dirty ptp,pte,t1
16121624
1613− make_insert_tlb spc,pte,prot
1625+ make_insert_tlb spc,pte,prot,t1
16141626
16151627 f_extend pte,t1
16161628
arch/parisc/kernel/head.S+2−2
@@ -69,7 +69,7 @@ $bss_loop: · 68 unmodified lines
6969 stw,ma %arg2,4(%r1)
7070 stw,ma %arg3,4(%r1)
7171
72− /* Initialize startup VM. Just map first 8/16 MB of memory */
72+ /* Initialize startup VM. Just map first 16/32 MB of memory */
7373 load32 PA(swapper_pg_dir),%r4
7474 mtctl %r4,%cr24 /* Initialize kernel root pointer */
7575 mtctl %r4,%cr25 /* Initialize user root pointer */
@@ -107,7 +107,7 @@ $bss_loop: · 31 unmodified lines
107107 /* Now initialize the PTEs themselves. We use RWX for
108108 * everything ... it will get remapped correctly later */
109109 ldo 0+_PAGE_KERNEL_RWX(%r0),%r3 /* Hardwired 0 phys addr start */
110− ldi (1<<(KERNEL_INITIAL_ORDER-PAGE_SHIFT)),%r11 /* PFN count */
110+ load32 (1<<(KERNEL_INITIAL_ORDER-PAGE_SHIFT)),%r11 /* PFN count */
111111 load32 PA(pg0),%r1
112112
113113 $pgt_fill_loop:
arch/parisc/kernel/setup.c+13−1
@@ -130,7 +130,16 @@ void __init setup_arch(char **cmdline_p) · 129 unmodified lines
130130 printk(KERN_INFO "The 32-bit Kernel has started...\n");
131131 #endif
132132
133− printk(KERN_INFO "Default page size is %dKB.\n", (int)(PAGE_SIZE / 1024));
133+ printk(KERN_INFO "Kernel default page size is %d KB. Huge pages ",
134+ (int)(PAGE_SIZE / 1024));
135+#ifdef CONFIG_HUGETLB_PAGE
136+ printk(KERN_CONT "enabled with %d MB physical and %d MB virtual size",
137+ 1 << (REAL_HPAGE_SHIFT - 20), 1 << (HPAGE_SHIFT - 20));
138+#else
139+ printk(KERN_CONT "disabled");
140+#endif
141+ printk(KERN_CONT ".\n");
142+
134143
135144 pdc_console_init();
136145
@@ -377,6 +386,7 @@ arch_initcall(parisc_init); · 240 unmodified lines
377386 void start_parisc(void)
378387 {
379388 extern void start_kernel(void);
389+ extern void early_trap_init(void);
380390
381391 int ret, cpunum;
382392 struct pdc_coproc_cfg coproc_cfg;
@@ -397,6 +407,8 @@ void start_parisc(void) · 14 unmodified lines
397407 panic("must have an fpu to boot linux");
398408 }
399409
410+ early_trap_init(); /* initialize checksum of fault_vector */
411+
400412 start_kernel();
401413 // not reached
402414 }
arch/parisc/kernel/syscall.S+2−2
@@ -369,7 +369,7 @@ tracesys_exit: · 368 unmodified lines
369369 ldo -16(%r30),%r29 /* Reference param save area */
370370 #endif
371371 ldo TASK_REGS(%r1),%r26
372− bl do_syscall_trace_exit,%r2
372+ BL do_syscall_trace_exit,%r2
373373 STREG %r28,TASK_PT_GR28(%r1) /* save return value now */
374374 ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */
375375 LDREG TI_TASK(%r1), %r1
@@ -390,7 +390,7 @@ tracesys_sigexit: · 14 unmodified lines
390390 #ifdef CONFIG_64BIT
391391 ldo -16(%r30),%r29 /* Reference param save area */
392392 #endif
393− bl do_syscall_trace_exit,%r2
393+ BL do_syscall_trace_exit,%r2
394394 ldo TASK_REGS(%r1),%r26
395395
396396 ldil L%syscall_exit_rfi,%r1
arch/parisc/kernel/traps.c+15−20
@@ -807,7 +807,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs) · 806 unmodified lines
807807 }
808808
809809
810−int __init check_ivt(void *iva)
810+void __init initialize_ivt(const void *iva)
811811 {
812812 extern u32 os_hpmc_size;
813813 extern const u32 os_hpmc[];
@@ -818,8 +818,8 @@ int __init check_ivt(void *iva) · 4 unmodified lines
818818 u32 *hpmcp;
819819 u32 length;
820820
821− if (strcmp((char *)iva, "cows can fly"))
822− return -1;
821+ if (strcmp((const char *)iva, "cows can fly"))
822+ panic("IVT invalid");
823823
824824 ivap = (u32 *)iva;
825825
@@ -839,28 +839,23 @@ int __init check_ivt(void *iva) · 13 unmodified lines
839839 check += ivap[i];
840840
841841 ivap[5] = -check;
842−
843− return 0;
844842 }
845843
846−#ifndef CONFIG_64BIT
847−extern const void fault_vector_11;
848−#endif
849−extern const void fault_vector_20;
850844
851−void __init trap_init(void)
845+/* early_trap_init() is called before we set up kernel mappings and
846+ * write-protect the kernel */
847+void __init early_trap_init(void)
852848 {
853− void *iva;
849+ extern const void fault_vector_20;
854850
855− if (boot_cpu_data.cpu_type >= pcxu)
856− iva = (void *) &fault_vector_20;
857− else
858−#ifdef CONFIG_64BIT
859− panic("Can't boot 64-bit OS on PA1.1 processor!");
860−#else
861− iva = (void *) &fault_vector_11;
851+#ifndef CONFIG_64BIT
852+ extern const void fault_vector_11;
853+ initialize_ivt(&fault_vector_11);
862854 #endif
863855
864− if (check_ivt(iva))
865− panic("IVT invalid");
856+ initialize_ivt(&fault_vector_20);
857+}
858+
859+void __init trap_init(void)
860+{
866861 }
arch/parisc/kernel/vmlinux.lds.S+6−3
@@ -60,7 +60,7 @@ SECTIONS · 59 unmodified lines
6060 EXIT_DATA
6161 }
6262 PERCPU_SECTION(8)
63− . = ALIGN(PAGE_SIZE);
63+ . = ALIGN(HUGEPAGE_SIZE);
6464 __init_end = .;
6565 /* freed after init ends here */
6666
@@ -116,7 +116,7 @@ SECTIONS · 49 unmodified lines
116116 * that we can properly leave these
117117 * as writable
118118 */
119− . = ALIGN(PAGE_SIZE);
119+ . = ALIGN(HUGEPAGE_SIZE);
120120 data_start = .;
121121
122122 EXCEPTION_TABLE(8)
@@ -135,8 +135,11 @@ SECTIONS · 12 unmodified lines
135135 _edata = .;
136136
137137 /* BSS */
138− BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 8)
138+ BSS_SECTION(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE)
139+
140+ /* bootmap is allocated in setup_bootmem() directly behind bss. */
139141
142+ . = ALIGN(HUGEPAGE_SIZE);
140143 _end = . ;
141144
142145 STABS_DEBUG
arch/parisc/mm/Makefile+1−0
@@ -3,3 +3,4 @@ · 2 unmodified lines
33 #
44
55 obj-y := init.o fault.o ioremap.o
6+obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
arch/parisc/mm/hugetlbpage.c+161−0
@@ -0,0 +1,161 @@
1+/*
2+ * PARISC64 Huge TLB page support.
3+ *
4+ * This parisc implementation is heavily based on the SPARC and x86 code.
5+ *
6+ * Copyright (C) 2015 Helge Deller <deller@gmx.de>
7+ */
8+
9+#include <linux/fs.h>
10+#include <linux/mm.h>
11+#include <linux/hugetlb.h>
12+#include <linux/pagemap.h>
13+#include <linux/sysctl.h>
14+
15+#include <asm/mman.h>
16+#include <asm/pgalloc.h>
17+#include <asm/tlb.h>
18+#include <asm/tlbflush.h>
19+#include <asm/cacheflush.h>
20+#include <asm/mmu_context.h>
21+
22+
23+unsigned long
24+hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
25+ unsigned long len, unsigned long pgoff, unsigned long flags)
26+{
27+ struct hstate *h = hstate_file(file);
28+
29+ if (len & ~huge_page_mask(h))
30+ return -EINVAL;
31+ if (len > TASK_SIZE)
32+ return -ENOMEM;
33+
34+ if (flags & MAP_FIXED)
35+ if (prepare_hugepage_range(file, addr, len))
36+ return -EINVAL;
37+
38+ if (addr)
39+ addr = ALIGN(addr, huge_page_size(h));
40+
41+ /* we need to make sure the colouring is OK */
42+ return arch_get_unmapped_area(file, addr, len, pgoff, flags);
43+}
44+
45+
46+pte_t *huge_pte_alloc(struct mm_struct *mm,
47+ unsigned long addr, unsigned long sz)
48+{
49+ pgd_t *pgd;
50+ pud_t *pud;
51+ pmd_t *pmd;
52+ pte_t *pte = NULL;
53+
54+ /* We must align the address, because our caller will run
55+ * set_huge_pte_at() on whatever we return, which writes out
56+ * all of the sub-ptes for the hugepage range. So we have
57+ * to give it the first such sub-pte.
58+ */
59+ addr &= HPAGE_MASK;
60+
61+ pgd = pgd_offset(mm, addr);
62+ pud = pud_alloc(mm, pgd, addr);
63+ if (pud) {
64+ pmd = pmd_alloc(mm, pud, addr);
65+ if (pmd)
66+ pte = pte_alloc_map(mm, NULL, pmd, addr);
67+ }
68+ return pte;
69+}
70+
71+pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
72+{
73+ pgd_t *pgd;
74+ pud_t *pud;
75+ pmd_t *pmd;
76+ pte_t *pte = NULL;
77+
78+ addr &= HPAGE_MASK;
79+
80+ pgd = pgd_offset(mm, addr);
81+ if (!pgd_none(*pgd)) {
82+ pud = pud_offset(pgd, addr);
83+ if (!pud_none(*pud)) {
84+ pmd = pmd_offset(pud, addr);
85+ if (!pmd_none(*pmd))
86+ pte = pte_offset_map(pmd, addr);
87+ }
88+ }
89+ return pte;
90+}
91+
92+/* Purge data and instruction TLB entries. Must be called holding
93+ * the pa_tlb_lock. The TLB purge instructions are slow on SMP
94+ * machines since the purge must be broadcast to all CPUs.
95+ */
96+static inline void purge_tlb_entries_huge(struct mm_struct *mm, unsigned long addr)
97+{
98+ int i;
99+
100+ /* We may use multiple physical huge pages (e.g. 2x1 MB) to emulate
101+ * Linux standard huge pages (e.g. 2 MB) */
102+ BUILD_BUG_ON(REAL_HPAGE_SHIFT > HPAGE_SHIFT);
103+
104+ addr &= HPAGE_MASK;
105+ addr |= _HUGE_PAGE_SIZE_ENCODING_DEFAULT;
106+
107+ for (i = 0; i < (1 << (HPAGE_SHIFT-REAL_HPAGE_SHIFT)); i++) {
108+ mtsp(mm->context, 1);
109+ pdtlb(addr);
110+ if (unlikely(split_tlb))
111+ pitlb(addr);
112+ addr += (1UL << REAL_HPAGE_SHIFT);
113+ }
114+}
115+
116+void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
117+ pte_t *ptep, pte_t entry)
118+{
119+ unsigned long addr_start;
120+ int i;
121+
122+ addr &= HPAGE_MASK;
123+ addr_start = addr;
124+
125+ for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
126+ /* Directly write pte entry. We could call set_pte_at(mm, addr, ptep, entry)
127+ * instead, but then we get double locking on pa_tlb_lock. */
128+ *ptep = entry;
129+ ptep++;
130+
131+ /* Drop the PAGE_SIZE/non-huge tlb entry */
132+ purge_tlb_entries(mm, addr);
133+
134+ addr += PAGE_SIZE;
135+ pte_val(entry) += PAGE_SIZE;
136+ }
137+
138+ purge_tlb_entries_huge(mm, addr_start);
139+}
140+
141+
142+pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
143+ pte_t *ptep)
144+{
145+ pte_t entry;
146+
147+ entry = *ptep;
148+ set_huge_pte_at(mm, addr, ptep, __pte(0));
149+
150+ return entry;
151+}
152+
153+int pmd_huge(pmd_t pmd)
154+{
155+ return 0;
156+}
157+
158+int pud_huge(pud_t pud)
159+{
160+ return 0;
161+}
arch/parisc/mm/init.c+17−23
@@ -409,15 +409,11 @@ static void __init map_pages(unsigned long start_vaddr, · 408 unmodified lines
409409 unsigned long vaddr;
410410 unsigned long ro_start;
411411 unsigned long ro_end;
412− unsigned long fv_addr;
413− unsigned long gw_addr;
414− extern const unsigned long fault_vector_20;
415− extern void * const linux_gateway_page;
412+ unsigned long kernel_end;
416413
417414 ro_start = __pa((unsigned long)_text);
418415 ro_end = __pa((unsigned long)&data_start);
419− fv_addr = __pa((unsigned long)&fault_vector_20) & PAGE_MASK;
420− gw_addr = __pa((unsigned long)&linux_gateway_page) & PAGE_MASK;
416+ kernel_end = __pa((unsigned long)&_end);
421417
422418 end_paddr = start_paddr + size;
423419
@@ -475,24 +471,25 @@ static void __init map_pages(unsigned long start_vaddr, · 51 unmodified lines
475471 for (tmp2 = start_pte; tmp2 < PTRS_PER_PTE; tmp2++, pg_table++) {
476472 pte_t pte;
477473
478− /*
479− * Map the fault vector writable so we can
480− * write the HPMC checksum.
481− */
482474 if (force)
483475 pte = __mk_pte(address, pgprot);
484− else if (parisc_text_address(vaddr) &&
485− address != fv_addr)
476+ else if (parisc_text_address(vaddr)) {
486477 pte = __mk_pte(address, PAGE_KERNEL_EXEC);
478+ if (address >= ro_start && address < kernel_end)
479+ pte = pte_mkhuge(pte);
480+ }
487481 else
488482 #if defined(CONFIG_PARISC_PAGE_SIZE_4KB)
489− if (address >= ro_start && address < ro_end
490− && address != fv_addr
491− && address != gw_addr)
492− pte = __mk_pte(address, PAGE_KERNEL_RO);
493− else
483+ if (address >= ro_start && address < ro_end) {
484+ pte = __mk_pte(address, PAGE_KERNEL_EXEC);
485+ pte = pte_mkhuge(pte);
486+ } else
494487 #endif
488+ {
495489 pte = __mk_pte(address, pgprot);
490+ if (address >= ro_start && address < kernel_end)
491+ pte = pte_mkhuge(pte);
492+ }
496493
497494 if (address >= end_paddr) {
498495 if (force)
@@ -536,15 +533,12 @@ void free_initmem(void) · 37 unmodified lines
536533
537534 /* force the kernel to see the new TLB entries */
538535 __flush_tlb_range(0, init_begin, init_end);
539− /* Attempt to catch anyone trying to execute code here
540− * by filling the page with BRK insns.
541− */
542− memset((void *)init_begin, 0x00, init_end - init_begin);
536+
543537 /* finally dump all the instructions which were cached, since the
544538 * pages are no-longer executable */
545539 flush_icache_range(init_begin, init_end);
546540
547− free_initmem_default(-1);
541+ free_initmem_default(POISON_FREE_INITMEM);
548542
549543 /* set up a new led state on systems shipped LED State panel */
550544 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BCOMPLETE);
@@ -728,8 +722,8 @@ static void __init pagetable_init(void) · 177 unmodified lines
728722 unsigned long size;
729723
730724 start_paddr = pmem_ranges[range].start_pfn << PAGE_SHIFT;
731− end_paddr = start_paddr + (pmem_ranges[range].pages << PAGE_SHIFT);
732725 size = pmem_ranges[range].pages << PAGE_SHIFT;
726+ end_paddr = start_paddr + size;
733727
734728 map_pages((unsigned long)__va(start_paddr), start_paddr,
735729 size, PAGE_KERNEL, 0);
arch/powerpc/include/asm/reg.h+1−0
@@ -108,6 +108,7 @@ · 107 unmodified lines
108108 #define MSR_TS_T __MASK(MSR_TS_T_LG) /* Transaction Transactional */
109109 #define MSR_TS_MASK (MSR_TS_T | MSR_TS_S) /* Transaction State bits */
110110 #define MSR_TM_ACTIVE(x) (((x) & MSR_TS_MASK) != 0) /* Transaction active? */
111+#define MSR_TM_RESV(x) (((x) & MSR_TS_MASK) == MSR_TS_MASK) /* Reserved */
111112 #define MSR_TM_TRANSACTIONAL(x) (((x) & MSR_TS_MASK) == MSR_TS_T)
112113 #define MSR_TM_SUSPENDED(x) (((x) & MSR_TS_MASK) == MSR_TS_S)
113114
arch/powerpc/include/asm/systbl.h+1−0
@@ -382,3 +382,4 @@ COMPAT_SYS(shmat) · 381 unmodified lines
382382 SYSCALL(shmdt)
383383 SYSCALL(shmget)
384384 COMPAT_SYS(shmctl)
385+SYSCALL(mlock2)
arch/powerpc/include/asm/unistd.h+1−1
@@ -12,7 +12,7 @@ · 11 unmodified lines
1212 #include <uapi/asm/unistd.h>
1313
1414
15−#define __NR_syscalls 378
15+#define __NR_syscalls 379
1616
1717 #define __NR__exit __NR_exit
1818 #define NR_syscalls __NR_syscalls
arch/powerpc/include/uapi/asm/unistd.h+1−0
@@ -400,5 +400,6 @@ · 399 unmodified lines
400400 #define __NR_shmdt 375
401401 #define __NR_shmget 376
402402 #define __NR_shmctl 377
403+#define __NR_mlock2 378
403404
404405 #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */
arch/powerpc/kernel/process.c+18−0
@@ -551,6 +551,24 @@ static void tm_reclaim_thread(struct thread_struct *thr, · 550 unmodified lines
551551 msr_diff &= MSR_FP | MSR_VEC | MSR_VSX | MSR_FE0 | MSR_FE1;
552552 }
553553
554+ /*
555+ * Use the current MSR TM suspended bit to track if we have
556+ * checkpointed state outstanding.
557+ * On signal delivery, we'd normally reclaim the checkpointed
558+ * state to obtain stack pointer (see:get_tm_stackpointer()).
559+ * This will then directly return to userspace without going
560+ * through __switch_to(). However, if the stack frame is bad,
561+ * we need to exit this thread which calls __switch_to() which
562+ * will again attempt to reclaim the already saved tm state.
563+ * Hence we need to check that we've not already reclaimed
564+ * this state.
565+ * We do this using the current MSR, rather tracking it in
566+ * some specific thread_struct bit, as it has the additional
567+ * benifit of checking for a potential TM bad thing exception.
568+ */
569+ if (!MSR_TM_SUSPENDED(mfmsr()))
570+ return;
571+
554572 tm_reclaim(thr, thr->regs->msr, cause);
555573
556574 /* Having done the reclaim, we now have the checkpointed
arch/powerpc/kernel/signal_32.c+9−5
@@ -875,6 +875,15 @@ static long restore_tm_user_regs(struct pt_regs *regs, · 874 unmodified lines
875875 return 1;
876876 #endif /* CONFIG_SPE */
877877
878+ /* Get the top half of the MSR from the user context */
879+ if (__get_user(msr_hi, &tm_sr->mc_gregs[PT_MSR]))
880+ return 1;
881+ msr_hi <<= 32;
882+ /* If TM bits are set to the reserved value, it's an invalid context */
883+ if (MSR_TM_RESV(msr_hi))
884+ return 1;
885+ /* Pull in the MSR TM bits from the user context */
886+ regs->msr = (regs->msr & ~MSR_TS_MASK) | (msr_hi & MSR_TS_MASK);
878887 /* Now, recheckpoint. This loads up all of the checkpointed (older)
879888 * registers, including FP and V[S]Rs. After recheckpointing, the
880889 * transactional versions should be loaded.
@@ -884,11 +893,6 @@ static long restore_tm_user_regs(struct pt_regs *regs, · 3 unmodified lines
884893 current->thread.tm_texasr |= TEXASR_FS;
885894 /* This loads the checkpointed FP/VEC state, if used */
886895 tm_recheckpoint(&current->thread, msr);
887− /* Get the top half of the MSR */
888− if (__get_user(msr_hi, &tm_sr->mc_gregs[PT_MSR]))
889− return 1;
890− /* Pull in MSR TM from user context */
891− regs->msr = (regs->msr & ~MSR_TS_MASK) | ((msr_hi<<32) & MSR_TS_MASK);
892896
893897 /* This loads the speculative FP/VEC state, if used */
894898 if (msr & MSR_FP) {
arch/powerpc/kernel/signal_64.c+4−0
@@ -438,6 +438,10 @@ static long restore_tm_sigcontexts(struct pt_regs *regs, · 437 unmodified lines
438438
439439 /* get MSR separately, transfer the LE bit if doing signal return */
440440 err |= __get_user(msr, &sc->gp_regs[PT_MSR]);
441+ /* Don't allow reserved mode. */
442+ if (MSR_TM_RESV(msr))
443+ return -EINVAL;
444+
441445 /* pull in MSR TM from user context */
442446 regs->msr = (regs->msr & ~MSR_TS_MASK) | (msr & MSR_TS_MASK);
443447
arch/s390/include/asm/cio.h+1−0
@@ -312,6 +312,7 @@ extern void css_schedule_reprobe(void); · 311 unmodified lines
312312 extern void reipl_ccw_dev(struct ccw_dev_id *id);
313313
314314 struct cio_iplinfo {
315+ u8 ssid;
315316 u16 devno;
316317 int is_qdio;
317318 };
arch/s390/include/asm/elf.h+10−3
@@ -206,9 +206,16 @@ do { \ · 205 unmodified lines
206206 } while (0)
207207 #endif /* CONFIG_COMPAT */
208208
209−extern unsigned long mmap_rnd_mask;
210−
211−#define STACK_RND_MASK (test_thread_flag(TIF_31BIT) ? 0x7ff : mmap_rnd_mask)
209+/*
210+ * Cache aliasing on the latest machines calls for a mapping granularity
211+ * of 512KB. For 64-bit processes use a 512KB alignment and a randomization
212+ * of up to 1GB. For 31-bit processes the virtual address space is limited,
213+ * use no alignment and limit the randomization to 8MB.
214+ */
215+#define BRK_RND_MASK (is_32bit_task() ? 0x7ffUL : 0x3ffffUL)
216+#define MMAP_RND_MASK (is_32bit_task() ? 0x7ffUL : 0x3ff80UL)
217+#define MMAP_ALIGN_MASK (is_32bit_task() ? 0 : 0x7fUL)
218+#define STACK_RND_MASK MMAP_RND_MASK
212219
213220 #define ARCH_DLINFO \
214221 do { \
arch/s390/include/asm/ipl.h+2−1
@@ -64,7 +64,8 @@ struct ipl_block_fcp { · 63 unmodified lines
6464
6565 struct ipl_block_ccw {
6666 u8 reserved1[84];
67− u8 reserved2[2];
67+ u16 reserved2 : 13;
68+ u8 ssid : 3;
6869 u16 devno;
6970 u8 vm_flags;
7071 u8 reserved3[3];
arch/s390/include/asm/pci_dma.h+3−1
@@ -195,5 +195,7 @@ void zpci_dma_exit_device(struct zpci_dev *); · 194 unmodified lines
195195 void dma_free_seg_table(unsigned long);
196196 unsigned long *dma_alloc_cpu_table(void);
197197 void dma_cleanup_tables(unsigned long *);
198−void dma_update_cpu_trans(unsigned long *, void *, dma_addr_t, int);
198+unsigned long *dma_walk_cpu_trans(unsigned long *rto, dma_addr_t dma_addr);
199+void dma_update_cpu_trans(unsigned long *entry, void *page_addr, int flags);
200+
199201 #endif
arch/s390/include/asm/trace/diag.h+3−3
@@ -19,7 +19,7 @@ · 18 unmodified lines
1919 #define TRACE_INCLUDE_PATH asm/trace
2020 #define TRACE_INCLUDE_FILE diag
2121
22−TRACE_EVENT(diagnose,
22+TRACE_EVENT(s390_diagnose,
2323 TP_PROTO(unsigned short nr),
2424 TP_ARGS(nr),
2525 TP_STRUCT__entry(
@@ -32,9 +32,9 @@ TRACE_EVENT(diagnose, · 6 unmodified lines
3232 );
3333
3434 #ifdef CONFIG_TRACEPOINTS
35−void trace_diagnose_norecursion(int diag_nr);
35+void trace_s390_diagnose_norecursion(int diag_nr);
3636 #else
37−static inline void trace_diagnose_norecursion(int diag_nr) { }
37+static inline void trace_s390_diagnose_norecursion(int diag_nr) { }
3838 #endif
3939
4040 #endif /* _TRACE_S390_DIAG_H */
arch/s390/include/uapi/asm/unistd.h+10−9
@@ -192,14 +192,14 @@ · 191 unmodified lines
192192 #define __NR_set_tid_address 252
193193 #define __NR_fadvise64 253
194194 #define __NR_timer_create 254
195−#define __NR_timer_settime (__NR_timer_create+1)
196−#define __NR_timer_gettime (__NR_timer_create+2)
197−#define __NR_timer_getoverrun (__NR_timer_create+3)
198−#define __NR_timer_delete (__NR_timer_create+4)
199−#define __NR_clock_settime (__NR_timer_create+5)
200−#define __NR_clock_gettime (__NR_timer_create+6)
201−#define __NR_clock_getres (__NR_timer_create+7)
202−#define __NR_clock_nanosleep (__NR_timer_create+8)
195+#define __NR_timer_settime 255
196+#define __NR_timer_gettime 256
197+#define __NR_timer_getoverrun 257
198+#define __NR_timer_delete 258
199+#define __NR_clock_settime 259
200+#define __NR_clock_gettime 260
201+#define __NR_clock_getres 261
202+#define __NR_clock_nanosleep 262
203203 /* Number 263 is reserved for vserver */
204204 #define __NR_statfs64 265
205205 #define __NR_fstatfs64 266
@@ -309,7 +309,8 @@ · 103 unmodified lines
309309 #define __NR_recvfrom 371
310310 #define __NR_recvmsg 372
311311 #define __NR_shutdown 373
312−#define NR_syscalls 374
312+#define __NR_mlock2 374
313+#define NR_syscalls 375
313314
314315 /*
315316 * There are some system calls that are not present on 64 bit, some
arch/s390/kernel/compat_wrapper.c+1−0
@@ -176,3 +176,4 @@ COMPAT_SYSCALL_WRAP4(accept4, int, fd, struct sockaddr __user *, upeer_sockaddr, · 175 unmodified lines
176176 COMPAT_SYSCALL_WRAP3(getsockname, int, fd, struct sockaddr __user *, usockaddr, int __user *, usockaddr_len);
177177 COMPAT_SYSCALL_WRAP3(getpeername, int, fd, struct sockaddr __user *, usockaddr, int __user *, usockaddr_len);
178178 COMPAT_SYSCALL_WRAP6(sendto, int, fd, void __user *, buff, size_t, len, unsigned int, flags, struct sockaddr __user *, addr, int, addr_len);
179+COMPAT_SYSCALL_WRAP3(mlock2, unsigned long, start, size_t, len, int, flags);
arch/s390/kernel/diag.c+2−2
@@ -121,14 +121,14 @@ device_initcall(show_diag_stat_init); · 120 unmodified lines
121121 void diag_stat_inc(enum diag_stat_enum nr)
122122 {
123123 this_cpu_inc(diag_stat.counter[nr]);
124− trace_diagnose(diag_map[nr].code);
124+ trace_s390_diagnose(diag_map[nr].code);
125125 }
126126 EXPORT_SYMBOL(diag_stat_inc);
127127
128128 void diag_stat_inc_norecursion(enum diag_stat_enum nr)
129129 {
130130 this_cpu_inc(diag_stat.counter[nr]);
131− trace_diagnose_norecursion(diag_map[nr].code);
131+ trace_s390_diagnose_norecursion(diag_map[nr].code);
132132 }
133133 EXPORT_SYMBOL(diag_stat_inc_norecursion);
134134
arch/s390/kernel/head.S+12−83
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 #include <asm/asm-offsets.h>
2727 #include <asm/thread_info.h>
2828 #include <asm/page.h>
29+#include <asm/ptrace.h>
2930
3031 #define ARCH_OFFSET 4
3132
@@ -59,19 +60,6 @@ __HEAD · 27 unmodified lines
5960 .long 0x020006e0,0x20000050
6061
6162 .org 0x200
62−#
63−# subroutine to set architecture mode
64−#
65−.Lsetmode:
66− mvi __LC_AR_MODE_ID,1 # set esame flag
67− slr %r0,%r0 # set cpuid to zero
68− lhi %r1,2 # mode 2 = esame (dump)
69− sigp %r1,%r0,0x12 # switch to esame mode
70− bras %r13,0f
71− .fill 16,4,0x0
72−0: lmh %r0,%r15,0(%r13) # clear high-order half of gprs
73− sam31 # switch to 31 bit addressing mode
74− br %r14
7563
7664 #
7765 # subroutine to wait for end I/O
@@ -159,7 +147,14 @@ __HEAD · 81 unmodified lines
159147 .long 0x02200050,0x00000000
160148
161149 iplstart:
162− bas %r14,.Lsetmode # Immediately switch to 64 bit mode
150+ mvi __LC_AR_MODE_ID,1 # set esame flag
151+ slr %r0,%r0 # set cpuid to zero
152+ lhi %r1,2 # mode 2 = esame (dump)
153+ sigp %r1,%r0,0x12 # switch to esame mode
154+ bras %r13,0f
155+ .fill 16,4,0x0
156+0: lmh %r0,%r15,0(%r13) # clear high-order half of gprs
157+ sam31 # switch to 31 bit addressing mode
163158 lh %r1,0xb8 # test if subchannel number
164159 bct %r1,.Lnoload # is valid
165160 l %r1,0xb8 # load ipl subchannel number
@@ -268,71 +263,6 @@ iplstart: · 102 unmodified lines
268263 .align 8
269264 .Lcpuid:.fill 8,1,0
270265
271−#
272−# SALIPL loader support. Based on a patch by Rob van der Heij.
273−# This entry point is called directly from the SALIPL loader and
274−# doesn't need a builtin ipl record.
275−#
276− .org 0x800
277−ENTRY(start)
278− stm %r0,%r15,0x07b0 # store registers
279− bas %r14,.Lsetmode # Immediately switch to 64 bit mode
280− basr %r12,%r0
281−.base:
282− l %r11,.parm
283− l %r8,.cmd # pointer to command buffer
284−
285− ltr %r9,%r9 # do we have SALIPL parameters?
286− bp .sk8x8
287−
288− mvc 0(64,%r8),0x00b0 # copy saved registers
289− xc 64(240-64,%r8),0(%r8) # remainder of buffer
290− tr 0(64,%r8),.lowcase
291− b .gotr
292−.sk8x8:
293− mvc 0(240,%r8),0(%r9) # copy iplparms into buffer
294−.gotr:
295− slr %r0,%r0
296− st %r0,INITRD_SIZE+ARCH_OFFSET-PARMAREA(%r11)
297− st %r0,INITRD_START+ARCH_OFFSET-PARMAREA(%r11)
298− j startup # continue with startup
299−.cmd: .long COMMAND_LINE # address of command line buffer
300−.parm: .long PARMAREA
301−.lowcase:
302− .byte 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07
303− .byte 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f
304− .byte 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17
305− .byte 0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f
306− .byte 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27
307− .byte 0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f
308− .byte 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37
309− .byte 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f
310− .byte 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47
311− .byte 0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f
312− .byte 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57
313− .byte 0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f
314− .byte 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67
315− .byte 0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f
316− .byte 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77
317− .byte 0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f
318−
319− .byte 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87
320− .byte 0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f
321− .byte 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97
322− .byte 0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f
323− .byte 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7
324− .byte 0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf
325− .byte 0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7
326− .byte 0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf
327− .byte 0xc0,0x81,0x82,0x83,0x84,0x85,0x86,0x87 # .abcdefg
328− .byte 0x88,0x89,0xca,0xcb,0xcc,0xcd,0xce,0xcf # hi
329− .byte 0xd0,0x91,0x92,0x93,0x94,0x95,0x96,0x97 # .jklmnop
330− .byte 0x98,0x99,0xda,0xdb,0xdc,0xdd,0xde,0xdf # qr
331− .byte 0xe0,0xe1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7 # ..stuvwx
332− .byte 0xa8,0xa9,0xea,0xeb,0xec,0xed,0xee,0xef # yz
333− .byte 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7
334− .byte 0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff
335−
336266 #
337267 # startup-code at 0x10000, running in absolute addressing mode
338268 # this is called either by the ipl loader or directly by PSW restart
@@ -364,7 +294,7 @@ ENTRY(startup_kdump) · 25 unmodified lines
364294 bras %r13,0f
365295 .fill 16,4,0x0
366296 0: lmh %r0,%r15,0(%r13) # clear high-order half of gprs
367− sam31 # switch to 31 bit addressing mode
297+ sam64 # switch to 64 bit addressing mode
368298 basr %r13,0 # get base
369299 .LPG0:
370300 xc 0x200(256),0x200 # partially clear lowcore
@@ -395,7 +325,7 @@ ENTRY(startup_kdump) · 24 unmodified lines
395325 jnz 1b
396326 j 4f
397327 2: l %r15,.Lstack-.LPG0(%r13)
398− ahi %r15,-96
328+ ahi %r15,-STACK_FRAME_OVERHEAD
399329 la %r2,.Lals_string-.LPG0(%r13)
400330 l %r3,.Lsclp_print-.LPG0(%r13)
401331 basr %r14,%r3
@@ -429,8 +359,7 @@ ENTRY(startup_kdump) · 27 unmodified lines
429359 .long 1, 0xc0000000
430360 #endif
431361 4:
432− /* Continue with 64bit startup code in head64.S */
433− sam64 # switch to 64 bit mode
362+ /* Continue with startup code in head64.S */
434363 jg startup_continue
435364
436365 .align 8
arch/s390/kernel/ipl.c+42−23
@@ -121,6 +121,7 @@ static char *dump_type_str(enum dump_type type) · 120 unmodified lines
121121 * Must be in data section since the bss section
122122 * is not cleared when these are accessed.
123123 */
124+static u8 ipl_ssid __attribute__((__section__(".data"))) = 0;
124125 static u16 ipl_devno __attribute__((__section__(".data"))) = 0;
125126 u32 ipl_flags __attribute__((__section__(".data"))) = 0;
126127
@@ -197,6 +198,33 @@ static ssize_t sys_##_prefix##_##_name##_show(struct kobject *kobj, \ · 70 unmodified lines
197198 return snprintf(page, PAGE_SIZE, _format, ##args); \
198199 }
199200
201+#define IPL_ATTR_CCW_STORE_FN(_prefix, _name, _ipl_blk) \
202+static ssize_t sys_##_prefix##_##_name##_store(struct kobject *kobj, \
203+ struct kobj_attribute *attr, \
204+ const char *buf, size_t len) \
205+{ \
206+ unsigned long long ssid, devno; \
207+ \
208+ if (sscanf(buf, "0.%llx.%llx\n", &ssid, &devno) != 2) \
209+ return -EINVAL; \
210+ \
211+ if (ssid > __MAX_SSID || devno > __MAX_SUBCHANNEL) \
212+ return -EINVAL; \
213+ \
214+ _ipl_blk.ssid = ssid; \
215+ _ipl_blk.devno = devno; \
216+ return len; \
217+}
218+
219+#define DEFINE_IPL_CCW_ATTR_RW(_prefix, _name, _ipl_blk) \
220+IPL_ATTR_SHOW_FN(_prefix, _name, "0.%x.%04x\n", \
221+ _ipl_blk.ssid, _ipl_blk.devno); \
222+IPL_ATTR_CCW_STORE_FN(_prefix, _name, _ipl_blk); \
223+static struct kobj_attribute sys_##_prefix##_##_name##_attr = \
224+ __ATTR(_name, (S_IRUGO | S_IWUSR), \
225+ sys_##_prefix##_##_name##_show, \
226+ sys_##_prefix##_##_name##_store) \
227+
200228 #define DEFINE_IPL_ATTR_RO(_prefix, _name, _format, _value) \
201229 IPL_ATTR_SHOW_FN(_prefix, _name, _format, _value) \
202230 static struct kobj_attribute sys_##_prefix##_##_name##_attr = \
@@ -395,7 +423,7 @@ static ssize_t sys_ipl_device_show(struct kobject *kobj, · 192 unmodified lines
395423
396424 switch (ipl_info.type) {
397425 case IPL_TYPE_CCW:
398− return sprintf(page, "0.0.%04x\n", ipl_devno);
426+ return sprintf(page, "0.%x.%04x\n", ipl_ssid, ipl_devno);
399427 case IPL_TYPE_FCP:
400428 case IPL_TYPE_FCP_DUMP:
401429 return sprintf(page, "0.0.%04x\n", ipl->ipl_info.fcp.devno);
@@ -687,21 +715,14 @@ static ssize_t reipl_fcp_scpdata_write(struct file *filp, struct kobject *kobj, · 285 unmodified lines
687715 struct bin_attribute *attr,
688716 char *buf, loff_t off, size_t count)
689717 {
718+ size_t scpdata_len = count;
690719 size_t padding;
691− size_t scpdata_len;
692−
693− if (off < 0)
694− return -EINVAL;
695720
696− if (off >= DIAG308_SCPDATA_SIZE)
697− return -ENOSPC;
698721
699− if (count > DIAG308_SCPDATA_SIZE - off)
700− count = DIAG308_SCPDATA_SIZE - off;
701−
702− memcpy(reipl_block_fcp->ipl_info.fcp.scp_data, buf + off, count);
703− scpdata_len = off + count;
722+ if (off)
723+ return -EINVAL;
704724
725+ memcpy(reipl_block_fcp->ipl_info.fcp.scp_data, buf, count);
705726 if (scpdata_len % 8) {
706727 padding = 8 - (scpdata_len % 8);
707728 memset(reipl_block_fcp->ipl_info.fcp.scp_data + scpdata_len,
@@ -717,7 +738,7 @@ static ssize_t reipl_fcp_scpdata_write(struct file *filp, struct kobject *kobj, · 9 unmodified lines
717738 }
718739 static struct bin_attribute sys_reipl_fcp_scp_data_attr =
719740 __BIN_ATTR(scp_data, (S_IRUGO | S_IWUSR), reipl_fcp_scpdata_read,
720− reipl_fcp_scpdata_write, PAGE_SIZE);
741+ reipl_fcp_scpdata_write, DIAG308_SCPDATA_SIZE);
721742
722743 static struct bin_attribute *reipl_fcp_bin_attrs[] = {
723744 &sys_reipl_fcp_scp_data_attr,
@@ -814,9 +835,7 @@ static struct attribute_group reipl_fcp_attr_group = { · 90 unmodified lines
814835 };
815836
816837 /* CCW reipl device attributes */
817−
818−DEFINE_IPL_ATTR_RW(reipl_ccw, device, "0.0.%04llx\n", "0.0.%llx\n",
819− reipl_block_ccw->ipl_info.ccw.devno);
838+DEFINE_IPL_CCW_ATTR_RW(reipl_ccw, device, reipl_block_ccw->ipl_info.ccw);
820839
821840 /* NSS wrapper */
822841 static ssize_t reipl_nss_loadparm_show(struct kobject *kobj,
@@ -1056,8 +1075,8 @@ static void __reipl_run(void *unused) · 233 unmodified lines
10561075
10571076 switch (reipl_method) {
10581077 case REIPL_METHOD_CCW_CIO:
1078+ devid.ssid = reipl_block_ccw->ipl_info.ccw.ssid;
10591079 devid.devno = reipl_block_ccw->ipl_info.ccw.devno;
1060− devid.ssid = 0;
10611080 reipl_ccw_dev(&devid);
10621081 break;
10631082 case REIPL_METHOD_CCW_VM:
@@ -1192,6 +1211,7 @@ static int __init reipl_ccw_init(void) · 128 unmodified lines
11921211
11931212 reipl_block_ccw_init(reipl_block_ccw);
11941213 if (ipl_info.type == IPL_TYPE_CCW) {
1214+ reipl_block_ccw->ipl_info.ccw.ssid = ipl_ssid;
11951215 reipl_block_ccw->ipl_info.ccw.devno = ipl_devno;
11961216 reipl_block_ccw_fill_parms(reipl_block_ccw);
11971217 }
@@ -1336,9 +1356,7 @@ static struct attribute_group dump_fcp_attr_group = { · 138 unmodified lines
13361356 };
13371357
13381358 /* CCW dump device attributes */
1339−
1340−DEFINE_IPL_ATTR_RW(dump_ccw, device, "0.0.%04llx\n", "0.0.%llx\n",
1341− dump_block_ccw->ipl_info.ccw.devno);
1359+DEFINE_IPL_CCW_ATTR_RW(dump_ccw, device, dump_block_ccw->ipl_info.ccw);
13421360
13431361 static struct attribute *dump_ccw_attrs[] = {
13441362 &sys_dump_ccw_device_attr.attr,
@@ -1418,8 +1436,8 @@ static void __dump_run(void *unused) · 73 unmodified lines
14181436
14191437 switch (dump_method) {
14201438 case DUMP_METHOD_CCW_CIO:
1439+ devid.ssid = dump_block_ccw->ipl_info.ccw.ssid;
14211440 devid.devno = dump_block_ccw->ipl_info.ccw.devno;
1422− devid.ssid = 0;
14231441 reipl_ccw_dev(&devid);
14241442 break;
14251443 case DUMP_METHOD_CCW_VM:
@@ -1939,14 +1957,14 @@ void __init setup_ipl(void) · 513 unmodified lines
19391957 ipl_info.type = get_ipl_type();
19401958 switch (ipl_info.type) {
19411959 case IPL_TYPE_CCW:
1960+ ipl_info.data.ccw.dev_id.ssid = ipl_ssid;
19421961 ipl_info.data.ccw.dev_id.devno = ipl_devno;
1943− ipl_info.data.ccw.dev_id.ssid = 0;
19441962 break;
19451963 case IPL_TYPE_FCP:
19461964 case IPL_TYPE_FCP_DUMP:
1965+ ipl_info.data.fcp.dev_id.ssid = 0;
19471966 ipl_info.data.fcp.dev_id.devno =
19481967 IPL_PARMBLOCK_START->ipl_info.fcp.devno;
1949− ipl_info.data.fcp.dev_id.ssid = 0;
19501968 ipl_info.data.fcp.wwpn = IPL_PARMBLOCK_START->ipl_info.fcp.wwpn;
19511969 ipl_info.data.fcp.lun = IPL_PARMBLOCK_START->ipl_info.fcp.lun;
19521970 break;
@@ -1978,6 +1996,7 @@ void __init ipl_save_parameters(void) · 25 unmodified lines
19781996 if (cio_get_iplinfo(&iplinfo))
19791997 return;
19801998
1999+ ipl_ssid = iplinfo.ssid;
19812000 ipl_devno = iplinfo.devno;
19822001 ipl_flags |= IPL_DEVNO_VALID;
19832002 if (!iplinfo.is_qdio)
arch/s390/kernel/process.c+1−5
@@ -243,11 +243,7 @@ unsigned long arch_align_stack(unsigned long sp) · 242 unmodified lines
243243
244244 static inline unsigned long brk_rnd(void)
245245 {
246− /* 8MB for 32bit, 1GB for 64bit */
247− if (is_32bit_task())
248− return (get_random_int() & 0x7ffUL) << PAGE_SHIFT;
249− else
250− return (get_random_int() & 0x3ffffUL) << PAGE_SHIFT;
246+ return (get_random_int() & BRK_RND_MASK) << PAGE_SHIFT;
251247 }
252248
253249 unsigned long arch_randomize_brk(struct mm_struct *mm)
arch/s390/kernel/sclp.c+1−1
@@ -21,7 +21,7 @@ static void _sclp_wait_int(void) · 20 unmodified lines
2121 __ctl_load(cr0_new, 0, 0);
2222
2323 psw_ext_save = S390_lowcore.external_new_psw;
24− psw_mask = __extract_psw() & (PSW_MASK_EA | PSW_MASK_BA);
24+ psw_mask = __extract_psw();
2525 S390_lowcore.external_new_psw.mask = psw_mask;
2626 psw_wait.mask = psw_mask | PSW_MASK_EXT | PSW_MASK_WAIT;
2727 S390_lowcore.ext_int_code = 0;
arch/s390/kernel/setup.c+0−3
@@ -764,9 +764,6 @@ static int __init setup_hwcaps(void) · 763 unmodified lines
764764 get_cpu_id(&cpu_id);
765765 add_device_randomness(&cpu_id, sizeof(cpu_id));
766766 switch (cpu_id.machine) {
767− case 0x9672:
768− strcpy(elf_platform, "g5");
769− break;
770767 case 0x2064:
771768 case 0x2066:
772769 default: /* Use "z900" as default for 64 bit kernels. */
arch/s390/kernel/syscalls.S+1−0
@@ -382,3 +382,4 @@ SYSCALL(sys_sendmsg,compat_sys_sendmsg) /* 370 */ · 381 unmodified lines
382382 SYSCALL(sys_recvfrom,compat_sys_recvfrom)
383383 SYSCALL(sys_recvmsg,compat_sys_recvmsg)
384384 SYSCALL(sys_shutdown,sys_shutdown)
385+SYSCALL(sys_mlock2,compat_sys_mlock2)
arch/s390/kernel/trace.c+3−3
@@ -9,11 +9,11 @@ · 8 unmodified lines
99 #define CREATE_TRACE_POINTS
1010 #include <asm/trace/diag.h>
1111
12−EXPORT_TRACEPOINT_SYMBOL(diagnose);
12+EXPORT_TRACEPOINT_SYMBOL(s390_diagnose);
1313
1414 static DEFINE_PER_CPU(unsigned int, diagnose_trace_depth);
1515
16−void trace_diagnose_norecursion(int diag_nr)
16+void trace_s390_diagnose_norecursion(int diag_nr)
1717 {
1818 unsigned long flags;
1919 unsigned int *depth;
@@ -22,7 +22,7 @@ void trace_diagnose_norecursion(int diag_nr) · 2 unmodified lines
2222 depth = this_cpu_ptr(&diagnose_trace_depth);
2323 if (*depth == 0) {
2424 (*depth)++;
25− trace_diagnose(diag_nr);
25+ trace_s390_diagnose(diag_nr);
2626 (*depth)--;
2727 }
2828 local_irq_restore(flags);
arch/s390/kvm/interrupt.c+5−2
@@ -1030,8 +1030,7 @@ static int __inject_extcall(struct kvm_vcpu *vcpu, struct kvm_s390_irq *irq) · 1029 unmodified lines
10301030 src_id, 0);
10311031
10321032 /* sending vcpu invalid */
1033− if (src_id >= KVM_MAX_VCPUS ||
1034− kvm_get_vcpu(vcpu->kvm, src_id) == NULL)
1033+ if (kvm_get_vcpu_by_id(vcpu->kvm, src_id) == NULL)
10351034 return -EINVAL;
10361035
10371036 if (sclp.has_sigpif)
@@ -1110,6 +1109,10 @@ static int __inject_sigp_emergency(struct kvm_vcpu *vcpu, · 72 unmodified lines
11101109 trace_kvm_s390_inject_vcpu(vcpu->vcpu_id, KVM_S390_INT_EMERGENCY,
11111110 irq->u.emerg.code, 0);
11121111
1112+ /* sending vcpu invalid */
1113+ if (kvm_get_vcpu_by_id(vcpu->kvm, irq->u.emerg.code) == NULL)
1114+ return -EINVAL;
1115+
11131116 set_bit(irq->u.emerg.code, li->sigp_emerg_pending);
11141117 set_bit(IRQ_PEND_EXT_EMERGENCY, &li->pending_irqs);
11151118 atomic_or(CPUSTAT_EXT_INT, li->cpuflags);
arch/s390/kvm/kvm-s390.c+5−1
@@ -342,12 +342,16 @@ static int kvm_vm_ioctl_enable_cap(struct kvm *kvm, struct kvm_enable_cap *cap) · 341 unmodified lines
342342 r = 0;
343343 break;
344344 case KVM_CAP_S390_VECTOR_REGISTERS:
345− if (MACHINE_HAS_VX) {
345+ mutex_lock(&kvm->lock);
346+ if (atomic_read(&kvm->online_vcpus)) {
347+ r = -EBUSY;
348+ } else if (MACHINE_HAS_VX) {
346349 set_kvm_facility(kvm->arch.model.fac->mask, 129);
347350 set_kvm_facility(kvm->arch.model.fac->list, 129);
348351 r = 0;
349352 } else
350353 r = -EINVAL;
354+ mutex_unlock(&kvm->lock);
351355 VM_EVENT(kvm, 3, "ENABLE: CAP_S390_VECTOR_REGISTERS %s",
352356 r ? "(not available)" : "(success)");
353357 break;
arch/s390/kvm/priv.c+1−1
@@ -660,7 +660,7 @@ static int handle_pfmf(struct kvm_vcpu *vcpu) · 659 unmodified lines
660660
661661 kvm_s390_get_regs_rre(vcpu, &reg1, &reg2);
662662
663− if (!MACHINE_HAS_PFMF)
663+ if (!test_kvm_facility(vcpu->kvm, 8))
664664 return kvm_s390_inject_program_int(vcpu, PGM_OPERATION);
665665
666666 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
arch/s390/kvm/sigp.c+2−6
@@ -291,12 +291,8 @@ static int handle_sigp_dst(struct kvm_vcpu *vcpu, u8 order_code, · 290 unmodified lines
291291 u16 cpu_addr, u32 parameter, u64 *status_reg)
292292 {
293293 int rc;
294− struct kvm_vcpu *dst_vcpu;
294+ struct kvm_vcpu *dst_vcpu = kvm_get_vcpu_by_id(vcpu->kvm, cpu_addr);
295295
296− if (cpu_addr >= KVM_MAX_VCPUS)
297− return SIGP_CC_NOT_OPERATIONAL;
298−
299− dst_vcpu = kvm_get_vcpu(vcpu->kvm, cpu_addr);
300296 if (!dst_vcpu)
301297 return SIGP_CC_NOT_OPERATIONAL;
302298
@@ -478,7 +474,7 @@ int kvm_s390_handle_sigp_pei(struct kvm_vcpu *vcpu) · 175 unmodified lines
478474 trace_kvm_s390_handle_sigp_pei(vcpu, order_code, cpu_addr);
479475
480476 if (order_code == SIGP_EXTERNAL_CALL) {
481− dest_vcpu = kvm_get_vcpu(vcpu->kvm, cpu_addr);
477+ dest_vcpu = kvm_get_vcpu_by_id(vcpu->kvm, cpu_addr);
482478 BUG_ON(dest_vcpu == NULL);
483479
484480 kvm_s390_vcpu_wakeup(dest_vcpu);
arch/s390/mm/init.c+3−27
@@ -48,37 +48,13 @@ EXPORT_SYMBOL(zero_page_mask); · 47 unmodified lines
4848
4949 static void __init setup_zero_pages(void)
5050 {
51− struct cpuid cpu_id;
5251 unsigned int order;
5352 struct page *page;
5453 int i;
5554
56− get_cpu_id(&cpu_id);
57− switch (cpu_id.machine) {
58− case 0x9672: /* g5 */
59− case 0x2064: /* z900 */
60− case 0x2066: /* z900 */
61− case 0x2084: /* z990 */
62− case 0x2086: /* z990 */
63− case 0x2094: /* z9-109 */
64− case 0x2096: /* z9-109 */
65− order = 0;
66− break;
67− case 0x2097: /* z10 */
68− case 0x2098: /* z10 */
69− case 0x2817: /* z196 */
70− case 0x2818: /* z196 */
71− order = 2;
72− break;
73− case 0x2827: /* zEC12 */
74− case 0x2828: /* zEC12 */
75− order = 5;
76− break;
77− case 0x2964: /* z13 */
78− default:
79− order = 7;
80− break;
81− }
55+ /* Latest machines require a mapping granularity of 512KB */
56+ order = 7;
57+
8258 /* Limit number of empty zero pages for small memory sizes */
8359 while (order > 2 && (totalram_pages >> 10) < (1UL << order))
8460 order--;
arch/s390/mm/mmap.c+9−51
@@ -31,9 +31,6 @@ · 30 unmodified lines
3131 #include <linux/security.h>
3232 #include <asm/pgalloc.h>
3333
34−unsigned long mmap_rnd_mask;
35−static unsigned long mmap_align_mask;
36−
3734 static unsigned long stack_maxrandom_size(void)
3835 {
3936 if (!(current->flags & PF_RANDOMIZE))
@@ -62,10 +59,7 @@ static inline int mmap_is_legacy(void) · 22 unmodified lines
6259
6360 unsigned long arch_mmap_rnd(void)
6461 {
65− if (is_32bit_task())
66− return (get_random_int() & 0x7ff) << PAGE_SHIFT;
67− else
68− return (get_random_int() & mmap_rnd_mask) << PAGE_SHIFT;
62+ return (get_random_int() & MMAP_RND_MASK) << PAGE_SHIFT;
6963 }
7064
7165 static unsigned long mmap_base_legacy(unsigned long rnd)
@@ -92,7 +86,6 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, · 20 unmodified lines
9286 struct mm_struct *mm = current->mm;
9387 struct vm_area_struct *vma;
9488 struct vm_unmapped_area_info info;
95− int do_color_align;
9689
9790 if (len > TASK_SIZE - mmap_min_addr)
9891 return -ENOMEM;
@@ -108,15 +101,14 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, · 9 unmodified lines
108101 return addr;
109102 }
110103
111− do_color_align = 0;
112− if (filp || (flags & MAP_SHARED))
113− do_color_align = !is_32bit_task();
114−
115104 info.flags = 0;
116105 info.length = len;
117106 info.low_limit = mm->mmap_base;
118107 info.high_limit = TASK_SIZE;
119− info.align_mask = do_color_align ? (mmap_align_mask << PAGE_SHIFT) : 0;
108+ if (filp || (flags & MAP_SHARED))
109+ info.align_mask = MMAP_ALIGN_MASK << PAGE_SHIFT;
110+ else
111+ info.align_mask = 0;
120112 info.align_offset = pgoff << PAGE_SHIFT;
121113 return vm_unmapped_area(&info);
122114 }
@@ -130,7 +122,6 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, · 7 unmodified lines
130122 struct mm_struct *mm = current->mm;
131123 unsigned long addr = addr0;
132124 struct vm_unmapped_area_info info;
133− int do_color_align;
134125
135126 /* requested length too big for entire address space */
136127 if (len > TASK_SIZE - mmap_min_addr)
@@ -148,15 +139,14 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, · 11 unmodified lines
148139 return addr;
149140 }
150141
151− do_color_align = 0;
152− if (filp || (flags & MAP_SHARED))
153− do_color_align = !is_32bit_task();
154−
155142 info.flags = VM_UNMAPPED_AREA_TOPDOWN;
156143 info.length = len;
157144 info.low_limit = max(PAGE_SIZE, mmap_min_addr);
158145 info.high_limit = mm->mmap_base;
159− info.align_mask = do_color_align ? (mmap_align_mask << PAGE_SHIFT) : 0;
146+ if (filp || (flags & MAP_SHARED))
147+ info.align_mask = MMAP_ALIGN_MASK << PAGE_SHIFT;
148+ else
149+ info.align_mask = 0;
160150 info.align_offset = pgoff << PAGE_SHIFT;
161151 addr = vm_unmapped_area(&info);
162152
@@ -254,35 +244,3 @@ void arch_pick_mmap_layout(struct mm_struct *mm) · 91 unmodified lines
254244 mm->get_unmapped_area = s390_get_unmapped_area_topdown;
255245 }
256246 }
257−
258−static int __init setup_mmap_rnd(void)
259−{
260− struct cpuid cpu_id;
261−
262− get_cpu_id(&cpu_id);
263− switch (cpu_id.machine) {
264− case 0x9672:
265− case 0x2064:
266− case 0x2066:
267− case 0x2084:
268− case 0x2086:
269− case 0x2094:
270− case 0x2096:
271− case 0x2097:
272− case 0x2098:
273− case 0x2817:
274− case 0x2818:
275− case 0x2827:
276− case 0x2828:
277− mmap_rnd_mask = 0x7ffUL;
278− mmap_align_mask = 0UL;
279− break;
280− case 0x2964: /* z13 */
281− default:
282− mmap_rnd_mask = 0x3ff80UL;
283− mmap_align_mask = 0x7fUL;
284− break;
285− }
286− return 0;
287−}
288−early_initcall(setup_mmap_rnd);
arch/s390/pci/pci_dma.c+56−28
@@ -33,7 +33,7 @@ unsigned long *dma_alloc_cpu_table(void) · 32 unmodified lines
3333 return NULL;
3434
3535 for (entry = table; entry < table + ZPCI_TABLE_ENTRIES; entry++)
36− *entry = ZPCI_TABLE_INVALID | ZPCI_TABLE_PROTECTED;
36+ *entry = ZPCI_TABLE_INVALID;
3737 return table;
3838 }
3939
@@ -51,7 +51,7 @@ static unsigned long *dma_alloc_page_table(void) · 11 unmodified lines
5151 return NULL;
5252
5353 for (entry = table; entry < table + ZPCI_PT_ENTRIES; entry++)
54− *entry = ZPCI_PTE_INVALID | ZPCI_TABLE_PROTECTED;
54+ *entry = ZPCI_PTE_INVALID;
5555 return table;
5656 }
5757
@@ -95,7 +95,7 @@ static unsigned long *dma_get_page_table_origin(unsigned long *entry) · 37 unmodified lines
9595 return pto;
9696 }
9797
98−static unsigned long *dma_walk_cpu_trans(unsigned long *rto, dma_addr_t dma_addr)
98+unsigned long *dma_walk_cpu_trans(unsigned long *rto, dma_addr_t dma_addr)
9999 {
100100 unsigned long *sto, *pto;
101101 unsigned int rtx, sx, px;
@@ -114,20 +114,10 @@ static unsigned long *dma_walk_cpu_trans(unsigned long *rto, dma_addr_t dma_addr · 12 unmodified lines
114114 return &pto[px];
115115 }
116116
117−void dma_update_cpu_trans(unsigned long *dma_table, void *page_addr,
118− dma_addr_t dma_addr, int flags)
117+void dma_update_cpu_trans(unsigned long *entry, void *page_addr, int flags)
119118 {
120− unsigned long *entry;
121−
122− entry = dma_walk_cpu_trans(dma_table, dma_addr);
123− if (!entry) {
124− WARN_ON_ONCE(1);
125− return;
126− }
127−
128119 if (flags & ZPCI_PTE_INVALID) {
129120 invalidate_pt_entry(entry);
130− return;
131121 } else {
132122 set_pt_pfaa(entry, page_addr);
133123 validate_pt_entry(entry);
@@ -146,18 +136,25 @@ static int dma_update_trans(struct zpci_dev *zdev, unsigned long pa, · 12 unmodified lines
146136 u8 *page_addr = (u8 *) (pa & PAGE_MASK);
147137 dma_addr_t start_dma_addr = dma_addr;
148138 unsigned long irq_flags;
139+ unsigned long *entry;
149140 int i, rc = 0;
150141
151142 if (!nr_pages)
152143 return -EINVAL;
153144
154145 spin_lock_irqsave(&zdev->dma_table_lock, irq_flags);
155− if (!zdev->dma_table)
146+ if (!zdev->dma_table) {
147+ rc = -EINVAL;
156148 goto no_refresh;
149+ }
157150
158151 for (i = 0; i < nr_pages; i++) {
159− dma_update_cpu_trans(zdev->dma_table, page_addr, dma_addr,
160− flags);
152+ entry = dma_walk_cpu_trans(zdev->dma_table, dma_addr);
153+ if (!entry) {
154+ rc = -ENOMEM;
155+ goto undo_cpu_trans;
156+ }
157+ dma_update_cpu_trans(entry, page_addr, flags);
161158 page_addr += PAGE_SIZE;
162159 dma_addr += PAGE_SIZE;
163160 }
@@ -176,6 +173,18 @@ static int dma_update_trans(struct zpci_dev *zdev, unsigned long pa, · 12 unmodified lines
176173
177174 rc = zpci_refresh_trans((u64) zdev->fh << 32, start_dma_addr,
178175 nr_pages * PAGE_SIZE);
176+undo_cpu_trans:
177+ if (rc && ((flags & ZPCI_PTE_VALID_MASK) == ZPCI_PTE_VALID)) {
178+ flags = ZPCI_PTE_INVALID;
179+ while (i-- > 0) {
180+ page_addr -= PAGE_SIZE;
181+ dma_addr -= PAGE_SIZE;
182+ entry = dma_walk_cpu_trans(zdev->dma_table, dma_addr);
183+ if (!entry)
184+ break;
185+ dma_update_cpu_trans(entry, page_addr, flags);
186+ }
187+ }
179188
180189 no_refresh:
181190 spin_unlock_irqrestore(&zdev->dma_table_lock, irq_flags);
@@ -260,6 +269,16 @@ out: · 78 unmodified lines
260269 spin_unlock_irqrestore(&zdev->iommu_bitmap_lock, flags);
261270 }
262271
272+static inline void zpci_err_dma(unsigned long rc, unsigned long addr)
273+{
274+ struct {
275+ unsigned long rc;
276+ unsigned long addr;
277+ } __packed data = {rc, addr};
278+
279+ zpci_err_hex(&data, sizeof(data));
280+}
281+
263282 static dma_addr_t s390_dma_map_pages(struct device *dev, struct page *page,
264283 unsigned long offset, size_t size,
265284 enum dma_data_direction direction,
@@ -270,33 +289,40 @@ static dma_addr_t s390_dma_map_pages(struct device *dev, struct page *page, · 4 unmodified lines
270289 unsigned long pa = page_to_phys(page) + offset;
271290 int flags = ZPCI_PTE_VALID;
272291 dma_addr_t dma_addr;
292+ int ret;
273293
274294 /* This rounds up number of pages based on size and offset */
275295 nr_pages = iommu_num_pages(pa, size, PAGE_SIZE);
276296 iommu_page_index = dma_alloc_iommu(zdev, nr_pages);
277− if (iommu_page_index == -1)
297+ if (iommu_page_index == -1) {
298+ ret = -ENOSPC;
278299 goto out_err;
300+ }
279301
280302 /* Use rounded up size */
281303 size = nr_pages * PAGE_SIZE;
282304
283305 dma_addr = zdev->start_dma + iommu_page_index * PAGE_SIZE;
284− if (dma_addr + size > zdev->end_dma)
306+ if (dma_addr + size > zdev->end_dma) {
307+ ret = -ERANGE;
285308 goto out_free;
309+ }
286310
287311 if (direction == DMA_NONE || direction == DMA_TO_DEVICE)
288312 flags |= ZPCI_TABLE_PROTECTED;
289313
290− if (!dma_update_trans(zdev, pa, dma_addr, size, flags)) {
291− atomic64_add(nr_pages, &zdev->mapped_pages);
292− return dma_addr + (offset & ~PAGE_MASK);
293− }
314+ ret = dma_update_trans(zdev, pa, dma_addr, size, flags);
315+ if (ret)
316+ goto out_free;
317+
318+ atomic64_add(nr_pages, &zdev->mapped_pages);
319+ return dma_addr + (offset & ~PAGE_MASK);
294320
295321 out_free:
296322 dma_free_iommu(zdev, iommu_page_index, nr_pages);
297323 out_err:
298324 zpci_err("map error:\n");
299− zpci_err_hex(&pa, sizeof(pa));
325+ zpci_err_dma(ret, pa);
300326 return DMA_ERROR_CODE;
301327 }
302328
@@ -306,14 +332,16 @@ static void s390_dma_unmap_pages(struct device *dev, dma_addr_t dma_addr, · 3 unmodified lines
306332 {
307333 struct zpci_dev *zdev = to_zpci(to_pci_dev(dev));
308334 unsigned long iommu_page_index;
309− int npages;
335+ int npages, ret;
310336
311337 npages = iommu_num_pages(dma_addr, size, PAGE_SIZE);
312338 dma_addr = dma_addr & PAGE_MASK;
313− if (dma_update_trans(zdev, 0, dma_addr, npages * PAGE_SIZE,
314− ZPCI_TABLE_PROTECTED | ZPCI_PTE_INVALID)) {
339+ ret = dma_update_trans(zdev, 0, dma_addr, npages * PAGE_SIZE,
340+ ZPCI_PTE_INVALID);
341+ if (ret) {
315342 zpci_err("unmap error:\n");
316− zpci_err_hex(&dma_addr, sizeof(dma_addr));
343+ zpci_err_dma(ret, dma_addr);
344+ return;
317345 }
318346
319347 atomic64_add(npages, &zdev->unmapped_pages);
arch/x86/boot/boot.h+0−1
@@ -23,7 +23,6 @@ · 22 unmodified lines
2323 #include <stdarg.h>
2424 #include <linux/types.h>
2525 #include <linux/edd.h>
26−#include <asm/boot.h>
2726 #include <asm/setup.h>
2827 #include "bitops.h"
2928 #include "ctype.h"
arch/x86/boot/video-mode.c+2−0
@@ -19,6 +19,8 @@ · 18 unmodified lines
1919 #include "video.h"
2020 #include "vesa.h"
2121
22+#include <uapi/asm/boot.h>
23+
2224 /*
2325 * Common variables
2426 */
arch/x86/boot/video.c+2−0
@@ -13,6 +13,8 @@ · 12 unmodified lines
1313 * Select video mode
1414 */
1515
16+#include <uapi/asm/boot.h>
17+
1618 #include "boot.h"
1719 #include "video.h"
1820 #include "vesa.h"
arch/x86/entry/entry_64.S+18−1
@@ -509,6 +509,17 @@ END(irq_entries_start) · 508 unmodified lines
509509 * tracking that we're in kernel mode.
510510 */
511511 SWAPGS
512+
513+ /*
514+ * We need to tell lockdep that IRQs are off. We can't do this until
515+ * we fix gsbase, and we should do it before enter_from_user_mode
516+ * (which can take locks). Since TRACE_IRQS_OFF idempotent,
517+ * the simplest way to handle it is to just call it twice if
518+ * we enter from user mode. There's no reason to optimize this since
519+ * TRACE_IRQS_OFF is a no-op if lockdep is off.
520+ */
521+ TRACE_IRQS_OFF
522+
512523 #ifdef CONFIG_CONTEXT_TRACKING
513524 call enter_from_user_mode
514525 #endif
@@ -1049,12 +1060,18 @@ ENTRY(error_entry) · 534 unmodified lines
10491060 SWAPGS
10501061
10511062 .Lerror_entry_from_usermode_after_swapgs:
1063+ /*
1064+ * We need to tell lockdep that IRQs are off. We can't do this until
1065+ * we fix gsbase, and we should do it before enter_from_user_mode
1066+ * (which can take locks).
1067+ */
1068+ TRACE_IRQS_OFF
10521069 #ifdef CONFIG_CONTEXT_TRACKING
10531070 call enter_from_user_mode
10541071 #endif
1072+ ret
10551073
10561074 .Lerror_entry_done:
1057−
10581075 TRACE_IRQS_OFF
10591076 ret
10601077
arch/x86/include/asm/msr-index.h+1−2
@@ -35,7 +35,7 @@ · 34 unmodified lines
3535 #define MSR_IA32_PERFCTR0 0x000000c1
3636 #define MSR_IA32_PERFCTR1 0x000000c2
3737 #define MSR_FSB_FREQ 0x000000cd
38−#define MSR_NHM_PLATFORM_INFO 0x000000ce
38+#define MSR_PLATFORM_INFO 0x000000ce
3939
4040 #define MSR_NHM_SNB_PKG_CST_CFG_CTL 0x000000e2
4141 #define NHM_C3_AUTO_DEMOTE (1UL << 25)
@@ -44,7 +44,6 @@ · 2 unmodified lines
4444 #define SNB_C1_AUTO_UNDEMOTE (1UL << 27)
4545 #define SNB_C3_AUTO_UNDEMOTE (1UL << 28)
4646
47−#define MSR_PLATFORM_INFO 0x000000ce
4847 #define MSR_MTRRcap 0x000000fe
4948 #define MSR_IA32_BBL_CR_CTL 0x00000119
5049 #define MSR_IA32_BBL_CR_CTL3 0x0000011e
arch/x86/include/asm/page_types.h+9−7
@@ -9,19 +9,21 @@ · 8 unmodified lines
99 #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
1010 #define PAGE_MASK (~(PAGE_SIZE-1))
1111
12+#define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT)
13+#define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1))
14+
15+#define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT)
16+#define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1))
17+
1218 #define __PHYSICAL_MASK ((phys_addr_t)((1ULL << __PHYSICAL_MASK_SHIFT) - 1))
1319 #define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1)
1420
15−/* Cast PAGE_MASK to a signed type so that it is sign-extended if
21+/* Cast *PAGE_MASK to a signed type so that it is sign-extended if
1622 virtual addresses are 32-bits but physical addresses are larger
1723 (ie, 32-bit PAE). */
1824 #define PHYSICAL_PAGE_MASK (((signed long)PAGE_MASK) & __PHYSICAL_MASK)
19−
20−#define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT)
21−#define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1))
22−
23−#define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT)
24−#define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1))
25+#define PHYSICAL_PMD_PAGE_MASK (((signed long)PMD_PAGE_MASK) & __PHYSICAL_MASK)
26+#define PHYSICAL_PUD_PAGE_MASK (((signed long)PUD_PAGE_MASK) & __PHYSICAL_MASK)
2527
2628 #define HPAGE_SHIFT PMD_SHIFT
2729 #define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
arch/x86/include/asm/pgtable_types.h+4−10
@@ -279,17 +279,14 @@ static inline pmdval_t native_pmd_val(pmd_t pmd) · 278 unmodified lines
279279 static inline pudval_t pud_pfn_mask(pud_t pud)
280280 {
281281 if (native_pud_val(pud) & _PAGE_PSE)
282− return PUD_PAGE_MASK & PHYSICAL_PAGE_MASK;
282+ return PHYSICAL_PUD_PAGE_MASK;
283283 else
284284 return PTE_PFN_MASK;
285285 }
286286
287287 static inline pudval_t pud_flags_mask(pud_t pud)
288288 {
289− if (native_pud_val(pud) & _PAGE_PSE)
290− return ~(PUD_PAGE_MASK & (pudval_t)PHYSICAL_PAGE_MASK);
291− else
292− return ~PTE_PFN_MASK;
289+ return ~pud_pfn_mask(pud);
293290 }
294291
295292 static inline pudval_t pud_flags(pud_t pud)
@@ -300,17 +297,14 @@ static inline pudval_t pud_flags(pud_t pud) · 4 unmodified lines
300297 static inline pmdval_t pmd_pfn_mask(pmd_t pmd)
301298 {
302299 if (native_pmd_val(pmd) & _PAGE_PSE)
303− return PMD_PAGE_MASK & PHYSICAL_PAGE_MASK;
300+ return PHYSICAL_PMD_PAGE_MASK;
304301 else
305302 return PTE_PFN_MASK;
306303 }
307304
308305 static inline pmdval_t pmd_flags_mask(pmd_t pmd)
309306 {
310− if (native_pmd_val(pmd) & _PAGE_PSE)
311− return ~(PMD_PAGE_MASK & (pmdval_t)PHYSICAL_PAGE_MASK);
312− else
313− return ~PTE_PFN_MASK;
307+ return ~pmd_pfn_mask(pmd);
314308 }
315309
316310 static inline pmdval_t pmd_flags(pmd_t pmd)
arch/x86/include/asm/x86_init.h+0−1
@@ -1,7 +1,6 @@
11 #ifndef _ASM_X86_PLATFORM_H
22 #define _ASM_X86_PLATFORM_H
33
4−#include <asm/pgtable_types.h>
54 #include <asm/bootparam.h>
65
76 struct mpc_bus;
arch/x86/kernel/cpu/common.c+1−2
@@ -273,10 +273,9 @@ __setup("nosmap", setup_disable_smap); · 272 unmodified lines
273273
274274 static __always_inline void setup_smap(struct cpuinfo_x86 *c)
275275 {
276− unsigned long eflags;
276+ unsigned long eflags = native_save_fl();
277277
278278 /* This should have been cleared long ago */
279− raw_local_save_flags(eflags);
280279 BUG_ON(eflags & X86_EFLAGS_AC);
281280
282281 if (cpu_has(c, X86_FEATURE_SMAP)) {
arch/x86/kernel/cpu/microcode/core.c+1−0
@@ -698,3 +698,4 @@ int __init microcode_init(void) · 697 unmodified lines
698698 return error;
699699
700700 }
701+late_initcall(microcode_init);
arch/x86/kernel/fpu/signal.c+5−6
@@ -385,20 +385,19 @@ fpu__alloc_mathframe(unsigned long sp, int ia32_frame, · 384 unmodified lines
385385 */
386386 void fpu__init_prepare_fx_sw_frame(void)
387387 {
388− int fsave_header_size = sizeof(struct fregs_state);
389388 int size = xstate_size + FP_XSTATE_MAGIC2_SIZE;
390389
391− if (config_enabled(CONFIG_X86_32))
392− size += fsave_header_size;
393−
394390 fx_sw_reserved.magic1 = FP_XSTATE_MAGIC1;
395391 fx_sw_reserved.extended_size = size;
396392 fx_sw_reserved.xfeatures = xfeatures_mask;
397393 fx_sw_reserved.xstate_size = xstate_size;
398394
399− if (config_enabled(CONFIG_IA32_EMULATION)) {
395+ if (config_enabled(CONFIG_IA32_EMULATION) ||
396+ config_enabled(CONFIG_X86_32)) {
397+ int fsave_header_size = sizeof(struct fregs_state);
398+
400399 fx_sw_reserved_ia32 = fx_sw_reserved;
401− fx_sw_reserved_ia32.extended_size += fsave_header_size;
400+ fx_sw_reserved_ia32.extended_size = size + fsave_header_size;
402401 }
403402 }
404403
arch/x86/kernel/fpu/xstate.c+0−1
@@ -694,7 +694,6 @@ void *get_xsave_addr(struct xregs_state *xsave, int xstate_feature) · 693 unmodified lines
694694 if (!boot_cpu_has(X86_FEATURE_XSAVE))
695695 return NULL;
696696
697− xsave = &current->thread.fpu.state.xsave;
698697 /*
699698 * We should not ever be requesting features that we
700699 * have not enabled. Remember that pcntxt_mask is
arch/x86/kernel/mcount_64.S+6−0
@@ -278,6 +278,12 @@ trace: · 277 unmodified lines
278278 /* save_mcount_regs fills in first two parameters */
279279 save_mcount_regs
280280
281+ /*
282+ * When DYNAMIC_FTRACE is not defined, ARCH_SUPPORTS_FTRACE_OPS is not
283+ * set (see include/asm/ftrace.h and include/linux/ftrace.h). Only the
284+ * ip and parent ip are used and the list function is called when
285+ * function tracing is enabled.
286+ */
281287 call *ftrace_trace_function
282288
283289 restore_mcount_regs
arch/x86/kernel/pmem.c+12−0
@@ -4,10 +4,22 @@ · 3 unmodified lines
44 */
55 #include <linux/platform_device.h>
66 #include <linux/module.h>
7+#include <linux/ioport.h>
8+
9+static int found(u64 start, u64 end, void *data)
10+{
11+ return 1;
12+}
713
814 static __init int register_e820_pmem(void)
915 {
16+ char *pmem = "Persistent Memory (legacy)";
1017 struct platform_device *pdev;
18+ int rc;
19+
20+ rc = walk_iomem_res(pmem, IORESOURCE_MEM, 0, -1, NULL, found);
21+ if (rc <= 0)
22+ return 0;
1123
1224 /*
1325 * See drivers/nvdimm/e820.c for the implementation, this is
arch/x86/kernel/setup.c+0−2
@@ -1250,8 +1250,6 @@ void __init setup_arch(char **cmdline_p) · 1249 unmodified lines
12501250 if (efi_enabled(EFI_BOOT))
12511251 efi_apply_memmap_quirks();
12521252 #endif
1253−
1254− microcode_init();
12551253 }
12561254
12571255 #ifdef CONFIG_X86_32
arch/x86/kernel/signal.c+10−7
@@ -690,12 +690,15 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs) · 689 unmodified lines
690690 signal_setup_done(failed, ksig, stepping);
691691 }
692692
693−#ifdef CONFIG_X86_32
694−#define NR_restart_syscall __NR_restart_syscall
695−#else /* !CONFIG_X86_32 */
696−#define NR_restart_syscall \
697− test_thread_flag(TIF_IA32) ? __NR_ia32_restart_syscall : __NR_restart_syscall
698−#endif /* CONFIG_X86_32 */
693+static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs)
694+{
695+#if defined(CONFIG_X86_32) || !defined(CONFIG_X86_64)
696+ return __NR_restart_syscall;
697+#else /* !CONFIG_X86_32 && CONFIG_X86_64 */
698+ return test_thread_flag(TIF_IA32) ? __NR_ia32_restart_syscall :
699+ __NR_restart_syscall | (regs->orig_ax & __X32_SYSCALL_BIT);
700+#endif /* CONFIG_X86_32 || !CONFIG_X86_64 */
701+}
699702
700703 /*
701704 * Note that 'init' is a special process: it doesn't get signals it doesn't
@@ -724,7 +727,7 @@ void do_signal(struct pt_regs *regs) · 22 unmodified lines
724727 break;
725728
726729 case -ERESTART_RESTARTBLOCK:
727− regs->ax = NR_restart_syscall;
730+ regs->ax = get_nr_restart_syscall(regs);
728731 regs->ip -= 2;
729732 break;
730733 }
arch/x86/kernel/smpboot.c+5−4
@@ -509,7 +509,7 @@ void __inquire_remote_apic(int apicid) · 508 unmodified lines
509509 */
510510 #define UDELAY_10MS_DEFAULT 10000
511511
512−static unsigned int init_udelay = INT_MAX;
512+static unsigned int init_udelay = UINT_MAX;
513513
514514 static int __init cpu_init_udelay(char *str)
515515 {
@@ -522,14 +522,15 @@ early_param("cpu_init_udelay", cpu_init_udelay); · 6 unmodified lines
522522 static void __init smp_quirk_init_udelay(void)
523523 {
524524 /* if cmdline changed it from default, leave it alone */
525− if (init_udelay != INT_MAX)
525+ if (init_udelay != UINT_MAX)
526526 return;
527527
528528 /* if modern processor, use no delay */
529529 if (((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && (boot_cpu_data.x86 == 6)) ||
530− ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) && (boot_cpu_data.x86 >= 0xF)))
530+ ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) && (boot_cpu_data.x86 >= 0xF))) {
531531 init_udelay = 0;
532−
532+ return;
533+ }
533534 /* else, use legacy delay */
534535 init_udelay = UDELAY_10MS_DEFAULT;
535536 }
arch/x86/kvm/vmx.c+0−5
@@ -7394,11 +7394,6 @@ static int handle_invvpid(struct kvm_vcpu *vcpu) · 7393 unmodified lines
73947394
73957395 switch (type) {
73967396 case VMX_VPID_EXTENT_ALL_CONTEXT:
7397− if (get_vmcs12(vcpu)->virtual_processor_id == 0) {
7398− nested_vmx_failValid(vcpu,
7399− VMXERR_INVALID_OPERAND_TO_INVEPT_INVVPID);
7400− return 1;
7401− }
74027397 __vmx_flush_tlb(vcpu, to_vmx(vcpu)->nested.vpid02);
74037398 nested_vmx_succeed(vcpu);
74047399 break;
arch/x86/kvm/x86.c+32−29
@@ -2763,6 +2763,26 @@ static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu, · 2762 unmodified lines
27632763 return 0;
27642764 }
27652765
2766+static int kvm_cpu_accept_dm_intr(struct kvm_vcpu *vcpu)
2767+{
2768+ return (!lapic_in_kernel(vcpu) ||
2769+ kvm_apic_accept_pic_intr(vcpu));
2770+}
2771+
2772+/*
2773+ * if userspace requested an interrupt window, check that the
2774+ * interrupt window is open.
2775+ *
2776+ * No need to exit to userspace if we already have an interrupt queued.
2777+ */
2778+static int kvm_vcpu_ready_for_interrupt_injection(struct kvm_vcpu *vcpu)
2779+{
2780+ return kvm_arch_interrupt_allowed(vcpu) &&
2781+ !kvm_cpu_has_interrupt(vcpu) &&
2782+ !kvm_event_needs_reinjection(vcpu) &&
2783+ kvm_cpu_accept_dm_intr(vcpu);
2784+}
2785+
27662786 static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu,
27672787 struct kvm_interrupt *irq)
27682788 {
@@ -2786,6 +2806,7 @@ static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, · 17 unmodified lines
27862806 return -EEXIST;
27872807
27882808 vcpu->arch.pending_external_vector = irq->irq;
2809+ kvm_make_request(KVM_REQ_EVENT, vcpu);
27892810 return 0;
27902811 }
27912812
@@ -5910,23 +5931,10 @@ static int emulator_fix_hypercall(struct x86_emulate_ctxt *ctxt) · 3118 unmodified lines
59105931 return emulator_write_emulated(ctxt, rip, instruction, 3, NULL);
59115932 }
59125933
5913−/*
5914− * Check if userspace requested an interrupt window, and that the
5915− * interrupt window is open.
5916− *
5917− * No need to exit to userspace if we already have an interrupt queued.
5918− */
59195934 static int dm_request_for_irq_injection(struct kvm_vcpu *vcpu)
59205935 {
5921− if (!vcpu->run->request_interrupt_window || pic_in_kernel(vcpu->kvm))
5922− return false;
5923−
5924− if (kvm_cpu_has_interrupt(vcpu))
5925− return false;
5926−
5927− return (irqchip_split(vcpu->kvm)
5928− ? kvm_apic_accept_pic_intr(vcpu)
5929− : kvm_arch_interrupt_allowed(vcpu));
5936+ return vcpu->run->request_interrupt_window &&
5937+ likely(!pic_in_kernel(vcpu->kvm));
59305938 }
59315939
59325940 static void post_kvm_run_save(struct kvm_vcpu *vcpu)
@@ -5937,17 +5945,9 @@ static void post_kvm_run_save(struct kvm_vcpu *vcpu) · 4 unmodified lines
59375945 kvm_run->flags = is_smm(vcpu) ? KVM_RUN_X86_SMM : 0;
59385946 kvm_run->cr8 = kvm_get_cr8(vcpu);
59395947 kvm_run->apic_base = kvm_get_apic_base(vcpu);
5940− if (!irqchip_in_kernel(vcpu->kvm))
5941− kvm_run->ready_for_interrupt_injection =
5942− kvm_arch_interrupt_allowed(vcpu) &&
5943− !kvm_cpu_has_interrupt(vcpu) &&
5944− !kvm_event_needs_reinjection(vcpu);
5945− else if (!pic_in_kernel(vcpu->kvm))
5946− kvm_run->ready_for_interrupt_injection =
5947− kvm_apic_accept_pic_intr(vcpu) &&
5948− !kvm_cpu_has_interrupt(vcpu);
5949− else
5950− kvm_run->ready_for_interrupt_injection = 1;
5948+ kvm_run->ready_for_interrupt_injection =
5949+ pic_in_kernel(vcpu->kvm) ||
5950+ kvm_vcpu_ready_for_interrupt_injection(vcpu);
59515951 }
59525952
59535953 static void update_cr8_intercept(struct kvm_vcpu *vcpu)
@@ -6360,8 +6360,10 @@ void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm, · 406 unmodified lines
63606360 static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
63616361 {
63626362 int r;
6363− bool req_int_win = !lapic_in_kernel(vcpu) &&
6364− vcpu->run->request_interrupt_window;
6363+ bool req_int_win =
6364+ dm_request_for_irq_injection(vcpu) &&
6365+ kvm_cpu_accept_dm_intr(vcpu);
6366+
63656367 bool req_immediate_exit = false;
63666368
63676369 if (vcpu->requests) {
@@ -6663,7 +6665,8 @@ static int vcpu_run(struct kvm_vcpu *vcpu) · 295 unmodified lines
66636665 if (kvm_cpu_has_pending_timer(vcpu))
66646666 kvm_inject_pending_timer_irqs(vcpu);
66656667
6666− if (dm_request_for_irq_injection(vcpu)) {
6668+ if (dm_request_for_irq_injection(vcpu) &&
6669+ kvm_vcpu_ready_for_interrupt_injection(vcpu)) {
66676670 r = 0;
66686671 vcpu->run->exit_reason = KVM_EXIT_IRQ_WINDOW_OPEN;
66696672 ++vcpu->stat.request_irq_exits;
arch/x86/mm/mpx.c+44−9
@@ -101,19 +101,19 @@ static int get_reg_offset(struct insn *insn, struct pt_regs *regs, · 100 unmodified lines
101101 switch (type) {
102102 case REG_TYPE_RM:
103103 regno = X86_MODRM_RM(insn->modrm.value);
104− if (X86_REX_B(insn->rex_prefix.value) == 1)
104+ if (X86_REX_B(insn->rex_prefix.value))
105105 regno += 8;
106106 break;
107107
108108 case REG_TYPE_INDEX:
109109 regno = X86_SIB_INDEX(insn->sib.value);
110− if (X86_REX_X(insn->rex_prefix.value) == 1)
110+ if (X86_REX_X(insn->rex_prefix.value))
111111 regno += 8;
112112 break;
113113
114114 case REG_TYPE_BASE:
115115 regno = X86_SIB_BASE(insn->sib.value);
116− if (X86_REX_B(insn->rex_prefix.value) == 1)
116+ if (X86_REX_B(insn->rex_prefix.value))
117117 regno += 8;
118118 break;
119119
@@ -585,6 +585,29 @@ static unsigned long mpx_bd_entry_to_bt_addr(struct mm_struct *mm, · 465 unmodified lines
585585 return bt_addr;
586586 }
587587
588+/*
589+ * We only want to do a 4-byte get_user() on 32-bit. Otherwise,
590+ * we might run off the end of the bounds table if we are on
591+ * a 64-bit kernel and try to get 8 bytes.
592+ */
593+int get_user_bd_entry(struct mm_struct *mm, unsigned long *bd_entry_ret,
594+ long __user *bd_entry_ptr)
595+{
596+ u32 bd_entry_32;
597+ int ret;
598+
599+ if (is_64bit_mm(mm))
600+ return get_user(*bd_entry_ret, bd_entry_ptr);
601+
602+ /*
603+ * Note that get_user() uses the type of the *pointer* to
604+ * establish the size of the get, not the destination.
605+ */
606+ ret = get_user(bd_entry_32, (u32 __user *)bd_entry_ptr);
607+ *bd_entry_ret = bd_entry_32;
608+ return ret;
609+}
610+
588611 /*
589612 * Get the base of bounds tables pointed by specific bounds
590613 * directory entry.
@@ -605,7 +628,7 @@ static int get_bt_addr(struct mm_struct *mm, · 14 unmodified lines
605628 int need_write = 0;
606629
607630 pagefault_disable();
608− ret = get_user(bd_entry, bd_entry_ptr);
631+ ret = get_user_bd_entry(mm, &bd_entry, bd_entry_ptr);
609632 pagefault_enable();
610633 if (!ret)
611634 break;
@@ -700,11 +723,23 @@ static unsigned long mpx_get_bt_entry_offset_bytes(struct mm_struct *mm, · 88 unmodified lines
700723 */
701724 static inline unsigned long bd_entry_virt_space(struct mm_struct *mm)
702725 {
703− unsigned long long virt_space = (1ULL << boot_cpu_data.x86_virt_bits);
704− if (is_64bit_mm(mm))
705− return virt_space / MPX_BD_NR_ENTRIES_64;
706− else
707− return virt_space / MPX_BD_NR_ENTRIES_32;
726+ unsigned long long virt_space;
727+ unsigned long long GB = (1ULL << 30);
728+
729+ /*
730+ * This covers 32-bit emulation as well as 32-bit kernels
731+ * running on 64-bit harware.
732+ */
733+ if (!is_64bit_mm(mm))
734+ return (4ULL * GB) / MPX_BD_NR_ENTRIES_32;
735+
736+ /*
737+ * 'x86_virt_bits' returns what the hardware is capable
738+ * of, and returns the full >32-bit adddress space when
739+ * running 32-bit kernels on 64-bit hardware.
740+ */
741+ virt_space = (1ULL << boot_cpu_data.x86_virt_bits);
742+ return virt_space / MPX_BD_NR_ENTRIES_64;
708743 }
709744
710745 /*
arch/x86/pci/bus_numa.c+2−11
@@ -50,18 +50,9 @@ void x86_pci_root_bus_resources(int bus, struct list_head *resources) · 49 unmodified lines
5050 if (!found)
5151 pci_add_resource(resources, &info->busn);
5252
53− list_for_each_entry(root_res, &info->resources, list) {
54− struct resource *res;
55− struct resource *root;
53+ list_for_each_entry(root_res, &info->resources, list)
54+ pci_add_resource(resources, &root_res->res);
5655
57− res = &root_res->res;
58− pci_add_resource(resources, res);
59− if (res->flags & IORESOURCE_IO)
60− root = &ioport_resource;
61− else
62− root = &iomem_resource;
63− insert_resource(root, res);
64− }
6556 return;
6657
6758 default_resources:
block/blk-core.c+7−14
@@ -2114,7 +2114,8 @@ blk_qc_t submit_bio(int rw, struct bio *bio) · 2113 unmodified lines
21142114 EXPORT_SYMBOL(submit_bio);
21152115
21162116 /**
2117− * blk_rq_check_limits - Helper function to check a request for the queue limit
2117+ * blk_cloned_rq_check_limits - Helper function to check a cloned request
2118+ * for new the queue limits
21182119 * @q: the queue
21192120 * @rq: the request being checked
21202121 *
@@ -2125,20 +2126,13 @@ EXPORT_SYMBOL(submit_bio); · 4 unmodified lines
21252126 * after it is inserted to @q, it should be checked against @q before
21262127 * the insertion using this generic function.
21272128 *
2128− * This function should also be useful for request stacking drivers
2129− * in some cases below, so export this function.
21302129 * Request stacking drivers like request-based dm may change the queue
2131− * limits while requests are in the queue (e.g. dm's table swapping).
2132− * Such request stacking drivers should check those requests against
2133− * the new queue limits again when they dispatch those requests,
2134− * although such checkings are also done against the old queue limits
2135− * when submitting requests.
2130+ * limits when retrying requests on other queues. Those requests need
2131+ * to be checked against the new queue limits again during dispatch.
21362132 */
2137−int blk_rq_check_limits(struct request_queue *q, struct request *rq)
2133+static int blk_cloned_rq_check_limits(struct request_queue *q,
2134+ struct request *rq)
21382135 {
2139− if (!rq_mergeable(rq))
2140− return 0;
2141−
21422136 if (blk_rq_sectors(rq) > blk_queue_get_max_sectors(q, rq->cmd_flags)) {
21432137 printk(KERN_ERR "%s: over max size limit.\n", __func__);
21442138 return -EIO;
@@ -2158,7 +2152,6 @@ int blk_rq_check_limits(struct request_queue *q, struct request *rq) · 13 unmodified lines
21582152
21592153 return 0;
21602154 }
2161−EXPORT_SYMBOL_GPL(blk_rq_check_limits);
21622155
21632156 /**
21642157 * blk_insert_cloned_request - Helper for stacking drivers to submit a request
@@ -2170,7 +2163,7 @@ int blk_insert_cloned_request(struct request_queue *q, struct request *rq) · 5 unmodified lines
21702163 unsigned long flags;
21712164 int where = ELEVATOR_INSERT_BACK;
21722165
2173− if (blk_rq_check_limits(q, rq))
2166+ if (blk_cloned_rq_check_limits(q, rq))
21742167 return -EIO;
21752168
21762169 if (rq->rq_disk &&
block/blk-merge.c+30−5
@@ -76,6 +76,9 @@ static struct bio *blk_bio_segment_split(struct request_queue *q, · 75 unmodified lines
7676 struct bio_vec bv, bvprv, *bvprvp = NULL;
7777 struct bvec_iter iter;
7878 unsigned seg_size = 0, nsegs = 0, sectors = 0;
79+ unsigned front_seg_size = bio->bi_seg_front_size;
80+ bool do_split = true;
81+ struct bio *new = NULL;
7982
8083 bio_for_each_segment(bv, bio, iter) {
8184 if (sectors + (bv.bv_len >> 9) > queue_max_sectors(q))
@@ -98,8 +101,11 @@ static struct bio *blk_bio_segment_split(struct request_queue *q, · 16 unmodified lines
98101
99102 seg_size += bv.bv_len;
100103 bvprv = bv;
101− bvprvp = &bv;
104+ bvprvp = &bvprv;
102105 sectors += bv.bv_len >> 9;
106+
107+ if (nsegs == 1 && seg_size > front_seg_size)
108+ front_seg_size = seg_size;
103109 continue;
104110 }
105111 new_segment:
@@ -108,16 +114,29 @@ new_segment: · 2 unmodified lines
108114
109115 nsegs++;
110116 bvprv = bv;
111− bvprvp = &bv;
117+ bvprvp = &bvprv;
112118 seg_size = bv.bv_len;
113119 sectors += bv.bv_len >> 9;
120+
121+ if (nsegs == 1 && seg_size > front_seg_size)
122+ front_seg_size = seg_size;
114123 }
115124
116− *segs = nsegs;
117− return NULL;
125+ do_split = false;
118126 split:
119127 *segs = nsegs;
120− return bio_split(bio, sectors, GFP_NOIO, bs);
128+
129+ if (do_split) {
130+ new = bio_split(bio, sectors, GFP_NOIO, bs);
131+ if (new)
132+ bio = new;
133+ }
134+
135+ bio->bi_seg_front_size = front_seg_size;
136+ if (seg_size > bio->bi_seg_back_size)
137+ bio->bi_seg_back_size = seg_size;
138+
139+ return do_split ? new : NULL;
121140 }
122141
123142 void blk_queue_split(struct request_queue *q, struct bio **bio,
@@ -412,6 +431,12 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq, · 288 unmodified lines
412431 if (sg)
413432 sg_mark_end(sg);
414433
434+ /*
435+ * Something must have been wrong if the figured number of
436+ * segment is bigger than number of req's physical segments
437+ */
438+ WARN_ON(nsegs > rq->nr_phys_segments);
439+
415440 return nsegs;
416441 }
417442 EXPORT_SYMBOL(blk_rq_map_sg);
block/blk-mq.c+9−5
@@ -1291,15 +1291,16 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) · 1290 unmodified lines
12911291 blk_mq_bio_to_request(rq, bio);
12921292
12931293 /*
1294− * we do limited pluging. If bio can be merged, do merge.
1294+ * We do limited pluging. If the bio can be merged, do that.
12951295 * Otherwise the existing request in the plug list will be
12961296 * issued. So the plug list will have one request at most
12971297 */
12981298 if (plug) {
12991299 /*
13001300 * The plug list might get flushed before this. If that
1301− * happens, same_queue_rq is invalid and plug list is empty
1302− **/
1301+ * happens, same_queue_rq is invalid and plug list is
1302+ * empty
1303+ */
13031304 if (same_queue_rq && !list_empty(&plug->mq_list)) {
13041305 old_rq = same_queue_rq;
13051306 list_del_init(&old_rq->queuelist);
@@ -1380,12 +1381,15 @@ static blk_qc_t blk_sq_make_request(struct request_queue *q, struct bio *bio) · 74 unmodified lines
13801381 blk_mq_bio_to_request(rq, bio);
13811382 if (!request_count)
13821383 trace_block_plug(q);
1383− else if (request_count >= BLK_MAX_REQUEST_COUNT) {
1384+
1385+ blk_mq_put_ctx(data.ctx);
1386+
1387+ if (request_count >= BLK_MAX_REQUEST_COUNT) {
13841388 blk_flush_plug_list(plug, false);
13851389 trace_block_plug(q);
13861390 }
1391+
13871392 list_add_tail(&rq->queuelist, &plug->mq_list);
1388− blk_mq_put_ctx(data.ctx);
13891393 return cookie;
13901394 }
13911395
block/blk-settings.c+16−20
@@ -91,7 +91,8 @@ void blk_set_default_limits(struct queue_limits *lim) · 90 unmodified lines
9191 lim->seg_boundary_mask = BLK_SEG_BOUNDARY_MASK;
9292 lim->virt_boundary_mask = 0;
9393 lim->max_segment_size = BLK_MAX_SEGMENT_SIZE;
94− lim->max_sectors = lim->max_hw_sectors = BLK_SAFE_MAX_SECTORS;
94+ lim->max_sectors = lim->max_dev_sectors = lim->max_hw_sectors =
95+ BLK_SAFE_MAX_SECTORS;
9596 lim->chunk_sectors = 0;
9697 lim->max_write_same_sectors = 0;
9798 lim->max_discard_sectors = 0;
@@ -127,6 +128,7 @@ void blk_set_stacking_limits(struct queue_limits *lim) · 29 unmodified lines
127128 lim->max_hw_sectors = UINT_MAX;
128129 lim->max_segment_size = UINT_MAX;
129130 lim->max_sectors = UINT_MAX;
131+ lim->max_dev_sectors = UINT_MAX;
130132 lim->max_write_same_sectors = UINT_MAX;
131133 }
132134 EXPORT_SYMBOL(blk_set_stacking_limits);
@@ -214,8 +216,8 @@ void blk_queue_bounce_limit(struct request_queue *q, u64 max_addr) · 81 unmodified lines
214216 EXPORT_SYMBOL(blk_queue_bounce_limit);
215217
216218 /**
217− * blk_limits_max_hw_sectors - set hard and soft limit of max sectors for request
218− * @limits: the queue limits
219+ * blk_queue_max_hw_sectors - set max sectors for a request for this queue
220+ * @q: the request queue for the device
219221 * @max_hw_sectors: max hardware sectors in the usual 512b unit
220222 *
221223 * Description:
@@ -224,13 +226,19 @@ EXPORT_SYMBOL(blk_queue_bounce_limit); · 2 unmodified lines
224226 * the device driver based upon the capabilities of the I/O
225227 * controller.
226228 *
229+ * max_dev_sectors is a hard limit imposed by the storage device for
230+ * READ/WRITE requests. It is set by the disk driver.
231+ *
227232 * max_sectors is a soft limit imposed by the block layer for
228233 * filesystem type requests. This value can be overridden on a
229234 * per-device basis in /sys/block/<device>/queue/max_sectors_kb.
230235 * The soft limit can not exceed max_hw_sectors.
231236 **/
232−void blk_limits_max_hw_sectors(struct queue_limits *limits, unsigned int max_hw_sectors)
237+void blk_queue_max_hw_sectors(struct request_queue *q, unsigned int max_hw_sectors)
233238 {
239+ struct queue_limits *limits = &q->limits;
240+ unsigned int max_sectors;
241+
234242 if ((max_hw_sectors << 9) < PAGE_CACHE_SIZE) {
235243 max_hw_sectors = 1 << (PAGE_CACHE_SHIFT - 9);
236244 printk(KERN_INFO "%s: set to minimum %d\n",
@@ -238,22 +246,9 @@ void blk_limits_max_hw_sectors(struct queue_limits *limits, unsigned int max_hw_ · 1 unmodified line
238246 }
239247
240248 limits->max_hw_sectors = max_hw_sectors;
241− limits->max_sectors = min_t(unsigned int, max_hw_sectors,
242− BLK_DEF_MAX_SECTORS);
243−}
244−EXPORT_SYMBOL(blk_limits_max_hw_sectors);
245−
246−/**
247− * blk_queue_max_hw_sectors - set max sectors for a request for this queue
248− * @q: the request queue for the device
249− * @max_hw_sectors: max hardware sectors in the usual 512b unit
250− *
251− * Description:
252− * See description for blk_limits_max_hw_sectors().
253− **/
254−void blk_queue_max_hw_sectors(struct request_queue *q, unsigned int max_hw_sectors)
255−{
256− blk_limits_max_hw_sectors(&q->limits, max_hw_sectors);
249+ max_sectors = min_not_zero(max_hw_sectors, limits->max_dev_sectors);
250+ max_sectors = min_t(unsigned int, max_sectors, BLK_DEF_MAX_SECTORS);
251+ limits->max_sectors = max_sectors;
257252 }
258253 EXPORT_SYMBOL(blk_queue_max_hw_sectors);
259254
@@ -527,6 +522,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, · 267 unmodified lines
527522
528523 t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors);
529524 t->max_hw_sectors = min_not_zero(t->max_hw_sectors, b->max_hw_sectors);
525+ t->max_dev_sectors = min_not_zero(t->max_dev_sectors, b->max_dev_sectors);
530526 t->max_write_same_sectors = min(t->max_write_same_sectors,
531527 b->max_write_same_sectors);
532528 t->bounce_pfn = min_not_zero(t->bounce_pfn, b->bounce_pfn);
block/blk-sysfs.c+3−0
@@ -205,6 +205,9 @@ queue_max_sectors_store(struct request_queue *q, const char *page, size_t count) · 204 unmodified lines
205205 if (ret < 0)
206206 return ret;
207207
208+ max_hw_sectors_kb = min_not_zero(max_hw_sectors_kb, (unsigned long)
209+ q->limits.max_dev_sectors >> 1);
210+
208211 if (max_sectors_kb > max_hw_sectors_kb || max_sectors_kb < page_kb)
209212 return -EINVAL;
210213
block/blk-timeout.c+5−3
@@ -158,11 +158,13 @@ void blk_abort_request(struct request *req) · 157 unmodified lines
158158 {
159159 if (blk_mark_rq_complete(req))
160160 return;
161− blk_delete_timer(req);
162− if (req->q->mq_ops)
161+
162+ if (req->q->mq_ops) {
163163 blk_mq_rq_timed_out(req, false);
164− else
164+ } else {
165+ blk_delete_timer(req);
165166 blk_rq_timed_out(req);
167+ }
166168 }
167169 EXPORT_SYMBOL_GPL(blk_abort_request);
168170
block/blk.h+0−2
@@ -72,8 +72,6 @@ void blk_dequeue_request(struct request *rq); · 71 unmodified lines
7272 void __blk_queue_free_tags(struct request_queue *q);
7373 bool __blk_end_bidi_request(struct request *rq, int error,
7474 unsigned int nr_bytes, unsigned int bidi_bytes);
75−int blk_queue_enter(struct request_queue *q, gfp_t gfp);
76−void blk_queue_exit(struct request_queue *q);
7775 void blk_freeze_queue(struct request_queue *q);
7876
7977 static inline void blk_queue_enter_live(struct request_queue *q)
block/noop-iosched.c+5−5
@@ -21,10 +21,10 @@ static void noop_merged_requests(struct request_queue *q, struct request *rq, · 20 unmodified lines
2121 static int noop_dispatch(struct request_queue *q, int force)
2222 {
2323 struct noop_data *nd = q->elevator->elevator_data;
24+ struct request *rq;
2425
25− if (!list_empty(&nd->queue)) {
26− struct request *rq;
27− rq = list_entry(nd->queue.next, struct request, queuelist);
26+ rq = list_first_entry_or_null(&nd->queue, struct request, queuelist);
27+ if (rq) {
2828 list_del_init(&rq->queuelist);
2929 elv_dispatch_sort(q, rq);
3030 return 1;
@@ -46,7 +46,7 @@ noop_former_request(struct request_queue *q, struct request *rq) · 15 unmodified lines
4646
4747 if (rq->queuelist.prev == &nd->queue)
4848 return NULL;
49− return list_entry(rq->queuelist.prev, struct request, queuelist);
49+ return list_prev_entry(rq, queuelist);
5050 }
5151
5252 static struct request *
@@ -56,7 +56,7 @@ noop_latter_request(struct request_queue *q, struct request *rq) · 3 unmodified lines
5656
5757 if (rq->queuelist.next == &nd->queue)
5858 return NULL;
59− return list_entry(rq->queuelist.next, struct request, queuelist);
59+ return list_next_entry(rq, queuelist);
6060 }
6161
6262 static int noop_init_queue(struct request_queue *q, struct elevator_type *e)
block/partition-generic.c+1−1
@@ -397,7 +397,7 @@ static int drop_partitions(struct gendisk *disk, struct block_device *bdev) · 396 unmodified lines
397397 struct hd_struct *part;
398398 int res;
399399
400− if (bdev->bd_part_count)
400+ if (bdev->bd_part_count || bdev->bd_super)
401401 return -EBUSY;
402402 res = invalidate_partition(disk, 0);
403403 if (res)
block/partitions/mac.c+7−3
@@ -32,7 +32,7 @@ int mac_partition(struct parsed_partitions *state) · 31 unmodified lines
3232 Sector sect;
3333 unsigned char *data;
3434 int slot, blocks_in_map;
35− unsigned secsize;
35+ unsigned secsize, datasize, partoffset;
3636 #ifdef CONFIG_PPC_PMAC
3737 int found_root = 0;
3838 int found_root_goodness = 0;
@@ -50,10 +50,14 @@ int mac_partition(struct parsed_partitions *state) · 11 unmodified lines
5050 }
5151 secsize = be16_to_cpu(md->block_size);
5252 put_dev_sector(sect);
53− data = read_part_sector(state, secsize/512, &sect);
53+ datasize = round_down(secsize, 512);
54+ data = read_part_sector(state, datasize / 512, &sect);
5455 if (!data)
5556 return -1;
56− part = (struct mac_partition *) (data + secsize%512);
57+ partoffset = secsize % 512;
58+ if (partoffset + sizeof(*part) > datasize)
59+ return -1;
60+ part = (struct mac_partition *) (data + partoffset);
5761 if (be16_to_cpu(part->signature) != MAC_PARTITION_MAGIC) {
5862 put_dev_sector(sect);
5963 return 0; /* not a MacOS disk */
crypto/algif_aead.c+2−2
@@ -125,7 +125,7 @@ static int aead_wait_for_data(struct sock *sk, unsigned flags) · 124 unmodified lines
125125 if (flags & MSG_DONTWAIT)
126126 return -EAGAIN;
127127
128− set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
128+ sk_set_bit(SOCKWQ_ASYNC_WAITDATA, sk);
129129
130130 for (;;) {
131131 if (signal_pending(current))
@@ -139,7 +139,7 @@ static int aead_wait_for_data(struct sock *sk, unsigned flags) · 7 unmodified lines
139139 }
140140 finish_wait(sk_sleep(sk), &wait);
141141
142− clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
142+ sk_clear_bit(SOCKWQ_ASYNC_WAITDATA, sk);
143143
144144 return err;
145145 }
crypto/algif_skcipher.c+3−3
@@ -212,7 +212,7 @@ static int skcipher_wait_for_wmem(struct sock *sk, unsigned flags) · 211 unmodified lines
212212 if (flags & MSG_DONTWAIT)
213213 return -EAGAIN;
214214
215− set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
215+ sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk);
216216
217217 for (;;) {
218218 if (signal_pending(current))
@@ -258,7 +258,7 @@ static int skcipher_wait_for_data(struct sock *sk, unsigned flags) · 39 unmodified lines
258258 return -EAGAIN;
259259 }
260260
261− set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
261+ sk_set_bit(SOCKWQ_ASYNC_WAITDATA, sk);
262262
263263 for (;;) {
264264 if (signal_pending(current))
@@ -272,7 +272,7 @@ static int skcipher_wait_for_data(struct sock *sk, unsigned flags) · 7 unmodified lines
272272 }
273273 finish_wait(sk_sleep(sk), &wait);
274274
275− clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
275+ sk_clear_bit(SOCKWQ_ASYNC_WAITDATA, sk);
276276
277277 return err;
278278 }
drivers/Makefile+1−1
@@ -63,6 +63,7 @@ obj-$(CONFIG_FB_I810) += video/fbdev/i810/ · 62 unmodified lines
6363 obj-$(CONFIG_FB_INTEL) += video/fbdev/intelfb/
6464
6565 obj-$(CONFIG_PARPORT) += parport/
66+obj-$(CONFIG_NVM) += lightnvm/
6667 obj-y += base/ block/ misc/ mfd/ nfc/
6768 obj-$(CONFIG_LIBNVDIMM) += nvdimm/
6869 obj-$(CONFIG_DMA_SHARED_BUFFER) += dma-buf/
@@ -70,7 +71,6 @@ obj-$(CONFIG_NUBUS) += nubus/ · 1 unmodified line
7071 obj-y += macintosh/
7172 obj-$(CONFIG_IDE) += ide/
7273 obj-$(CONFIG_SCSI) += scsi/
73−obj-$(CONFIG_NVM) += lightnvm/
7474 obj-y += nvme/
7575 obj-$(CONFIG_ATA) += ata/
7676 obj-$(CONFIG_TARGET_CORE) += target/
drivers/acpi/Kconfig+2−2
@@ -58,10 +58,10 @@ config ACPI_CCA_REQUIRED · 57 unmodified lines
5858 bool
5959
6060 config ACPI_DEBUGGER
61− bool "In-kernel debugger (EXPERIMENTAL)"
61+ bool "AML debugger interface (EXPERIMENTAL)"
6262 select ACPI_DEBUG
6363 help
64− Enable in-kernel debugging facilities: statistics, internal
64+ Enable in-kernel debugging of AML facilities: statistics, internal
6565 object dump, single step control method execution.
6666 This is still under development, currently enabling this only
6767 results in the compilation of the ACPICA debugger files.
drivers/acpi/cppc_acpi.c+1−1
@@ -304,7 +304,7 @@ EXPORT_SYMBOL_GPL(acpi_get_psd_map); · 303 unmodified lines
304304
305305 static int register_pcc_channel(int pcc_subspace_idx)
306306 {
307− struct acpi_pcct_subspace *cppc_ss;
307+ struct acpi_pcct_hw_reduced *cppc_ss;
308308 unsigned int len;
309309
310310 if (pcc_subspace_idx >= 0) {
drivers/acpi/ec.c+1−1
@@ -1103,7 +1103,7 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 *data) · 1102 unmodified lines
11031103 }
11041104
11051105 err_exit:
1106− if (result && q)
1106+ if (result)
11071107 acpi_ec_delete_query(q);
11081108 if (data)
11091109 *data = value;
drivers/acpi/nfit.c+47−18
@@ -233,11 +233,12 @@ static bool add_spa(struct acpi_nfit_desc *acpi_desc, · 232 unmodified lines
233233 struct nfit_table_prev *prev,
234234 struct acpi_nfit_system_address *spa)
235235 {
236+ size_t length = min_t(size_t, sizeof(*spa), spa->header.length);
236237 struct device *dev = acpi_desc->dev;
237238 struct nfit_spa *nfit_spa;
238239
239240 list_for_each_entry(nfit_spa, &prev->spas, list) {
240− if (memcmp(nfit_spa->spa, spa, sizeof(*spa)) == 0) {
241+ if (memcmp(nfit_spa->spa, spa, length) == 0) {
241242 list_move_tail(&nfit_spa->list, &acpi_desc->spas);
242243 return true;
243244 }
@@ -259,11 +260,12 @@ static bool add_memdev(struct acpi_nfit_desc *acpi_desc, · 15 unmodified lines
259260 struct nfit_table_prev *prev,
260261 struct acpi_nfit_memory_map *memdev)
261262 {
263+ size_t length = min_t(size_t, sizeof(*memdev), memdev->header.length);
262264 struct device *dev = acpi_desc->dev;
263265 struct nfit_memdev *nfit_memdev;
264266
265267 list_for_each_entry(nfit_memdev, &prev->memdevs, list)
266− if (memcmp(nfit_memdev->memdev, memdev, sizeof(*memdev)) == 0) {
268+ if (memcmp(nfit_memdev->memdev, memdev, length) == 0) {
267269 list_move_tail(&nfit_memdev->list, &acpi_desc->memdevs);
268270 return true;
269271 }
@@ -284,11 +286,12 @@ static bool add_dcr(struct acpi_nfit_desc *acpi_desc, · 14 unmodified lines
284286 struct nfit_table_prev *prev,
285287 struct acpi_nfit_control_region *dcr)
286288 {
289+ size_t length = min_t(size_t, sizeof(*dcr), dcr->header.length);
287290 struct device *dev = acpi_desc->dev;
288291 struct nfit_dcr *nfit_dcr;
289292
290293 list_for_each_entry(nfit_dcr, &prev->dcrs, list)
291− if (memcmp(nfit_dcr->dcr, dcr, sizeof(*dcr)) == 0) {
294+ if (memcmp(nfit_dcr->dcr, dcr, length) == 0) {
292295 list_move_tail(&nfit_dcr->list, &acpi_desc->dcrs);
293296 return true;
294297 }
@@ -308,11 +311,12 @@ static bool add_bdw(struct acpi_nfit_desc *acpi_desc, · 13 unmodified lines
308311 struct nfit_table_prev *prev,
309312 struct acpi_nfit_data_region *bdw)
310313 {
314+ size_t length = min_t(size_t, sizeof(*bdw), bdw->header.length);
311315 struct device *dev = acpi_desc->dev;
312316 struct nfit_bdw *nfit_bdw;
313317
314318 list_for_each_entry(nfit_bdw, &prev->bdws, list)
315− if (memcmp(nfit_bdw->bdw, bdw, sizeof(*bdw)) == 0) {
319+ if (memcmp(nfit_bdw->bdw, bdw, length) == 0) {
316320 list_move_tail(&nfit_bdw->list, &acpi_desc->bdws);
317321 return true;
318322 }
@@ -332,11 +336,12 @@ static bool add_idt(struct acpi_nfit_desc *acpi_desc, · 13 unmodified lines
332336 struct nfit_table_prev *prev,
333337 struct acpi_nfit_interleave *idt)
334338 {
339+ size_t length = min_t(size_t, sizeof(*idt), idt->header.length);
335340 struct device *dev = acpi_desc->dev;
336341 struct nfit_idt *nfit_idt;
337342
338343 list_for_each_entry(nfit_idt, &prev->idts, list)
339− if (memcmp(nfit_idt->idt, idt, sizeof(*idt)) == 0) {
344+ if (memcmp(nfit_idt->idt, idt, length) == 0) {
340345 list_move_tail(&nfit_idt->list, &acpi_desc->idts);
341346 return true;
342347 }
@@ -356,11 +361,12 @@ static bool add_flush(struct acpi_nfit_desc *acpi_desc, · 13 unmodified lines
356361 struct nfit_table_prev *prev,
357362 struct acpi_nfit_flush_address *flush)
358363 {
364+ size_t length = min_t(size_t, sizeof(*flush), flush->header.length);
359365 struct device *dev = acpi_desc->dev;
360366 struct nfit_flush *nfit_flush;
361367
362368 list_for_each_entry(nfit_flush, &prev->flushes, list)
363− if (memcmp(nfit_flush->flush, flush, sizeof(*flush)) == 0) {
369+ if (memcmp(nfit_flush->flush, flush, length) == 0) {
364370 list_move_tail(&nfit_flush->list, &acpi_desc->flushes);
365371 return true;
366372 }
@@ -655,7 +661,7 @@ static ssize_t revision_show(struct device *dev, · 288 unmodified lines
655661 struct nvdimm_bus_descriptor *nd_desc = to_nd_desc(nvdimm_bus);
656662 struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc);
657663
658− return sprintf(buf, "%d\n", acpi_desc->nfit->header.revision);
664+ return sprintf(buf, "%d\n", acpi_desc->acpi_header.revision);
659665 }
660666 static DEVICE_ATTR_RO(revision);
661667
@@ -1652,7 +1658,6 @@ int acpi_nfit_init(struct acpi_nfit_desc *acpi_desc, acpi_size sz) · 990 unmodified lines
16521658
16531659 data = (u8 *) acpi_desc->nfit;
16541660 end = data + sz;
1655− data += sizeof(struct acpi_table_nfit);
16561661 while (!IS_ERR_OR_NULL(data))
16571662 data = add_table(acpi_desc, &prev, data, end);
16581663
@@ -1748,13 +1753,29 @@ static int acpi_nfit_add(struct acpi_device *adev) · 89 unmodified lines
17481753 return PTR_ERR(acpi_desc);
17491754 }
17501755
1751− acpi_desc->nfit = (struct acpi_table_nfit *) tbl;
1756+ /*
1757+ * Save the acpi header for later and then skip it,
1758+ * making nfit point to the first nfit table header.
1759+ */
1760+ acpi_desc->acpi_header = *tbl;
1761+ acpi_desc->nfit = (void *) tbl + sizeof(struct acpi_table_nfit);
1762+ sz -= sizeof(struct acpi_table_nfit);
17521763
17531764 /* Evaluate _FIT and override with that if present */
17541765 status = acpi_evaluate_object(adev->handle, "_FIT", NULL, &buf);
17551766 if (ACPI_SUCCESS(status) && buf.length > 0) {
1756− acpi_desc->nfit = (struct acpi_table_nfit *)buf.pointer;
1757− sz = buf.length;
1767+ union acpi_object *obj;
1768+ /*
1769+ * Adjust for the acpi_object header of the _FIT
1770+ */
1771+ obj = buf.pointer;
1772+ if (obj->type == ACPI_TYPE_BUFFER) {
1773+ acpi_desc->nfit =
1774+ (struct acpi_nfit_header *)obj->buffer.pointer;
1775+ sz = obj->buffer.length;
1776+ } else
1777+ dev_dbg(dev, "%s invalid type %d, ignoring _FIT\n",
1778+ __func__, (int) obj->type);
17581779 }
17591780
17601781 rc = acpi_nfit_init(acpi_desc, sz);
@@ -1777,7 +1798,8 @@ static void acpi_nfit_notify(struct acpi_device *adev, u32 event) · 16 unmodified lines
17771798 {
17781799 struct acpi_nfit_desc *acpi_desc = dev_get_drvdata(&adev->dev);
17791800 struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL };
1780− struct acpi_table_nfit *nfit_saved;
1801+ struct acpi_nfit_header *nfit_saved;
1802+ union acpi_object *obj;
17811803 struct device *dev = &adev->dev;
17821804 acpi_status status;
17831805 int ret;
@@ -1808,12 +1830,19 @@ static void acpi_nfit_notify(struct acpi_device *adev, u32 event) · 24 unmodified lines
18081830 }
18091831
18101832 nfit_saved = acpi_desc->nfit;
1811− acpi_desc->nfit = (struct acpi_table_nfit *)buf.pointer;
1812− ret = acpi_nfit_init(acpi_desc, buf.length);
1813− if (!ret) {
1814− /* Merge failed, restore old nfit, and exit */
1815− acpi_desc->nfit = nfit_saved;
1816− dev_err(dev, "failed to merge updated NFIT\n");
1833+ obj = buf.pointer;
1834+ if (obj->type == ACPI_TYPE_BUFFER) {
1835+ acpi_desc->nfit =
1836+ (struct acpi_nfit_header *)obj->buffer.pointer;
1837+ ret = acpi_nfit_init(acpi_desc, obj->buffer.length);
1838+ if (ret) {
1839+ /* Merge failed, restore old nfit, and exit */
1840+ acpi_desc->nfit = nfit_saved;
1841+ dev_err(dev, "failed to merge updated NFIT\n");
1842+ }
1843+ } else {
1844+ /* Bad _FIT, restore old nfit */
1845+ dev_err(dev, "Invalid _FIT\n");
18171846 }
18181847 kfree(buf.pointer);
18191848
drivers/acpi/nfit.h+2−1
@@ -96,7 +96,8 @@ struct nfit_mem { · 95 unmodified lines
9696
9797 struct acpi_nfit_desc {
9898 struct nvdimm_bus_descriptor nd_desc;
99− struct acpi_table_nfit *nfit;
99+ struct acpi_table_header acpi_header;
100+ struct acpi_nfit_header *nfit;
100101 struct mutex spa_map_mutex;
101102 struct mutex init_mutex;
102103 struct list_head spa_maps;
drivers/acpi/pci_root.c+7−0
@@ -768,6 +768,13 @@ static void pci_acpi_root_add_resources(struct acpi_pci_root_info *info) · 767 unmodified lines
768768 else
769769 continue;
770770
771+ /*
772+ * Some legacy x86 host bridge drivers use iomem_resource and
773+ * ioport_resource as default resource pool, skip it.
774+ */
775+ if (res == root)
776+ continue;
777+
771778 conflict = insert_resource_conflict(root, res);
772779 if (conflict) {
773780 dev_info(&info->bridge->dev,
drivers/acpi/sbshc.c+7−41
@@ -14,7 +14,6 @@ · 13 unmodified lines
1414 #include <linux/delay.h>
1515 #include <linux/module.h>
1616 #include <linux/interrupt.h>
17−#include <linux/dmi.h>
1817 #include "sbshc.h"
1918
2019 #define PREFIX "ACPI: "
@@ -30,6 +29,7 @@ struct acpi_smb_hc { · 9 unmodified lines
3029 u8 query_bit;
3130 smbus_alarm_callback callback;
3231 void *context;
32+ bool done;
3333 };
3434
3535 static int acpi_smbus_hc_add(struct acpi_device *device);
@@ -88,8 +88,6 @@ enum acpi_smb_offset { · 52 unmodified lines
8888 ACPI_SMB_ALARM_DATA = 0x26, /* 2 bytes alarm data */
8989 };
9090
91−static bool macbook;
92−
9391 static inline int smb_hc_read(struct acpi_smb_hc *hc, u8 address, u8 *data)
9492 {
9593 return ec_read(hc->offset + address, data);
@@ -100,27 +98,11 @@ static inline int smb_hc_write(struct acpi_smb_hc *hc, u8 address, u8 data) · 4 unmodified lines
10098 return ec_write(hc->offset + address, data);
10199 }
102100
103−static inline int smb_check_done(struct acpi_smb_hc *hc)
104−{
105− union acpi_smb_status status = {.raw = 0};
106− smb_hc_read(hc, ACPI_SMB_STATUS, &status.raw);
107− return status.fields.done && (status.fields.status == SMBUS_OK);
108−}
109−
110101 static int wait_transaction_complete(struct acpi_smb_hc *hc, int timeout)
111102 {
112− if (wait_event_timeout(hc->wait, smb_check_done(hc),
113− msecs_to_jiffies(timeout)))
103+ if (wait_event_timeout(hc->wait, hc->done, msecs_to_jiffies(timeout)))
114104 return 0;
115− /*
116− * After the timeout happens, OS will try to check the status of SMbus.
117− * If the status is what OS expected, it will be regarded as the bogus
118− * timeout.
119− */
120− if (smb_check_done(hc))
121− return 0;
122− else
123− return -ETIME;
105+ return -ETIME;
124106 }
125107
126108 static int acpi_smbus_transaction(struct acpi_smb_hc *hc, u8 protocol,
@@ -135,8 +117,7 @@ static int acpi_smbus_transaction(struct acpi_smb_hc *hc, u8 protocol, · 8 unmodified lines
135117 }
136118
137119 mutex_lock(&hc->lock);
138− if (macbook)
139− udelay(5);
120+ hc->done = false;
140121 if (smb_hc_read(hc, ACPI_SMB_PROTOCOL, &temp))
141122 goto end;
142123 if (temp) {
@@ -235,8 +216,10 @@ static int smbus_alarm(void *context) · 92 unmodified lines
235216 if (smb_hc_read(hc, ACPI_SMB_STATUS, &status.raw))
236217 return 0;
237218 /* Check if it is only a completion notify */
238− if (status.fields.done)
219+ if (status.fields.done && status.fields.status == SMBUS_OK) {
220+ hc->done = true;
239221 wake_up(&hc->wait);
222+ }
240223 if (!status.fields.alarm)
241224 return 0;
242225 mutex_lock(&hc->lock);
@@ -262,29 +245,12 @@ extern int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit, · 19 unmodified lines
262245 acpi_handle handle, acpi_ec_query_func func,
263246 void *data);
264247
265−static int macbook_dmi_match(const struct dmi_system_id *d)
266−{
267− pr_debug("Detected MacBook, enabling workaround\n");
268− macbook = true;
269− return 0;
270−}
271−
272−static struct dmi_system_id acpi_smbus_dmi_table[] = {
273− { macbook_dmi_match, "Apple MacBook", {
274− DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
275− DMI_MATCH(DMI_PRODUCT_NAME, "MacBook") },
276− },
277− { },
278−};
279−
280248 static int acpi_smbus_hc_add(struct acpi_device *device)
281249 {
282250 int status;
283251 unsigned long long val;
284252 struct acpi_smb_hc *hc;
285253
286− dmi_check_system(acpi_smbus_dmi_table);
287−
288254 if (!device)
289255 return -EINVAL;
290256
drivers/base/power/domain.c+1−2
@@ -1775,10 +1775,10 @@ int genpd_dev_pm_attach(struct device *dev) · 1774 unmodified lines
17751775 }
17761776
17771777 pd = of_genpd_get_from_provider(&pd_args);
1778+ of_node_put(pd_args.np);
17781779 if (IS_ERR(pd)) {
17791780 dev_dbg(dev, "%s() failed to find PM domain: %ld\n",
17801781 __func__, PTR_ERR(pd));
1781− of_node_put(dev->of_node);
17821782 return -EPROBE_DEFER;
17831783 }
17841784
@@ -1796,7 +1796,6 @@ int genpd_dev_pm_attach(struct device *dev) · 11 unmodified lines
17961796 if (ret < 0) {
17971797 dev_err(dev, "failed to add to PM domain %s: %d",
17981798 pd->name, ret);
1799− of_node_put(dev->of_node);
18001799 goto out;
18011800 }
18021801
drivers/base/power/domain_governor.c+0−3
@@ -160,9 +160,6 @@ static bool default_power_down_ok(struct dev_pm_domain *pd) · 159 unmodified lines
160160 struct gpd_timing_data *td;
161161 s64 constraint_ns;
162162
163− if (!pdd->dev->driver)
164− continue;
165−
166163 /*
167164 * Check if the device is allowed to be off long enough for the
168165 * domain to turn off and on (that's how much time it will
drivers/base/power/wakeirq.c+6−0
@@ -68,6 +68,9 @@ int dev_pm_set_wake_irq(struct device *dev, int irq) · 67 unmodified lines
6868 struct wake_irq *wirq;
6969 int err;
7070
71+ if (irq < 0)
72+ return -EINVAL;
73+
7174 wirq = kzalloc(sizeof(*wirq), GFP_KERNEL);
7275 if (!wirq)
7376 return -ENOMEM;
@@ -167,6 +170,9 @@ int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq) · 93 unmodified lines
167170 struct wake_irq *wirq;
168171 int err;
169172
173+ if (irq < 0)
174+ return -EINVAL;
175+
170176 wirq = kzalloc(sizeof(*wirq), GFP_KERNEL);
171177 if (!wirq)
172178 return -ENOMEM;
drivers/block/mtip32xx/mtip32xx.c+2−4
@@ -3810,7 +3810,6 @@ static int mtip_block_initialize(struct driver_data *dd) · 3809 unmodified lines
38103810 sector_t capacity;
38113811 unsigned int index = 0;
38123812 struct kobject *kobj;
3813− unsigned char thd_name[16];
38143813
38153814 if (dd->disk)
38163815 goto skip_create_disk; /* hw init done, before rebuild */
@@ -3958,10 +3957,9 @@ skip_create_disk: · 141 unmodified lines
39583957 }
39593958
39603959 start_service_thread:
3961− sprintf(thd_name, "mtip_svc_thd_%02d", index);
39623960 dd->mtip_svc_handler = kthread_create_on_node(mtip_service_thread,
3963− dd, dd->numa_node, "%s",
3964− thd_name);
3961+ dd, dd->numa_node,
3962+ "mtip_svc_thd_%02d", index);
39653963
39663964 if (IS_ERR(dd->mtip_svc_handler)) {
39673965 dev_err(&dd->pdev->dev, "service thread failed to start\n");
drivers/block/null_blk.c+231−70
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #include <linux/slab.h>
99 #include <linux/blk-mq.h>
1010 #include <linux/hrtimer.h>
11+#include <linux/lightnvm.h>
1112
1213 struct nullb_cmd {
1314 struct list_head list;
@@ -17,6 +18,7 @@ struct nullb_cmd { · 3 unmodified lines
1718 struct bio *bio;
1819 unsigned int tag;
1920 struct nullb_queue *nq;
21+ struct hrtimer timer;
2022 };
2123
2224 struct nullb_queue {
@@ -39,23 +41,14 @@ struct nullb { · 16 unmodified lines
3941
4042 struct nullb_queue *queues;
4143 unsigned int nr_queues;
44+ char disk_name[DISK_NAME_LEN];
4245 };
4346
4447 static LIST_HEAD(nullb_list);
4548 static struct mutex lock;
4649 static int null_major;
4750 static int nullb_indexes;
48−
49−struct completion_queue {
50− struct llist_head list;
51− struct hrtimer timer;
52−};
53−
54−/*
55− * These are per-cpu for now, they will need to be configured by the
56− * complete_queues parameter and appropriately mapped.
57− */
58−static DEFINE_PER_CPU(struct completion_queue, completion_queues);
51+static struct kmem_cache *ppa_cache;
5952
6053 enum {
6154 NULL_IRQ_NONE = 0,
@@ -119,6 +112,10 @@ static int nr_devices = 2; · 57 unmodified lines
119112 module_param(nr_devices, int, S_IRUGO);
120113 MODULE_PARM_DESC(nr_devices, "Number of devices to register");
121114
115+static bool use_lightnvm;
116+module_param(use_lightnvm, bool, S_IRUGO);
117+MODULE_PARM_DESC(use_lightnvm, "Register as a LightNVM device");
118+
122119 static int irqmode = NULL_IRQ_SOFTIRQ;
123120
124121 static int null_set_irqmode(const char *str, const struct kernel_param *kp)
@@ -135,8 +132,8 @@ static const struct kernel_param_ops null_irqmode_param_ops = { · 10 unmodified lines
135132 device_param_cb(irqmode, &null_irqmode_param_ops, &irqmode, S_IRUGO);
136133 MODULE_PARM_DESC(irqmode, "IRQ completion handler. 0-none, 1-softirq, 2-timer");
137134
138−static int completion_nsec = 10000;
139−module_param(completion_nsec, int, S_IRUGO);
135+static unsigned long completion_nsec = 10000;
136+module_param(completion_nsec, ulong, S_IRUGO);
140137 MODULE_PARM_DESC(completion_nsec, "Time in ns to complete a request in hardware. Default: 10,000ns");
141138
142139 static int hw_queue_depth = 64;
@@ -173,6 +170,8 @@ static void free_cmd(struct nullb_cmd *cmd) · 30 unmodified lines
173170 put_tag(cmd->nq, cmd->tag);
174171 }
175172
173+static enum hrtimer_restart null_cmd_timer_expired(struct hrtimer *timer);
174+
176175 static struct nullb_cmd *__alloc_cmd(struct nullb_queue *nq)
177176 {
178177 struct nullb_cmd *cmd;
@@ -183,6 +182,11 @@ static struct nullb_cmd *__alloc_cmd(struct nullb_queue *nq) · 4 unmodified lines
183182 cmd = &nq->cmds[tag];
184183 cmd->tag = tag;
185184 cmd->nq = nq;
185+ if (irqmode == NULL_IRQ_TIMER) {
186+ hrtimer_init(&cmd->timer, CLOCK_MONOTONIC,
187+ HRTIMER_MODE_REL);
188+ cmd->timer.function = null_cmd_timer_expired;
189+ }
186190 return cmd;
187191 }
188192
@@ -213,6 +217,8 @@ static struct nullb_cmd *alloc_cmd(struct nullb_queue *nq, int can_wait) · 24 unmodified lines
213217
214218 static void end_cmd(struct nullb_cmd *cmd)
215219 {
220+ struct request_queue *q = NULL;
221+
216222 switch (queue_mode) {
217223 case NULL_Q_MQ:
218224 blk_mq_end_request(cmd->rq, 0);
@@ -223,55 +229,37 @@ static void end_cmd(struct nullb_cmd *cmd) · 4 unmodified lines
223229 break;
224230 case NULL_Q_BIO:
225231 bio_endio(cmd->bio);
226− break;
232+ goto free_cmd;
227233 }
228234
235+ if (cmd->rq)
236+ q = cmd->rq->q;
237+
238+ /* Restart queue if needed, as we are freeing a tag */
239+ if (q && !q->mq_ops && blk_queue_stopped(q)) {
240+ unsigned long flags;
241+
242+ spin_lock_irqsave(q->queue_lock, flags);
243+ if (blk_queue_stopped(q))
244+ blk_start_queue(q);
245+ spin_unlock_irqrestore(q->queue_lock, flags);
246+ }
247+free_cmd:
229248 free_cmd(cmd);
230249 }
231250
232251 static enum hrtimer_restart null_cmd_timer_expired(struct hrtimer *timer)
233252 {
234− struct completion_queue *cq;
235− struct llist_node *entry;
236− struct nullb_cmd *cmd;
237−
238− cq = &per_cpu(completion_queues, smp_processor_id());
239−
240− while ((entry = llist_del_all(&cq->list)) != NULL) {
241− entry = llist_reverse_order(entry);
242− do {
243− struct request_queue *q = NULL;
244−
245− cmd = container_of(entry, struct nullb_cmd, ll_list);
246− entry = entry->next;
247− if (cmd->rq)
248− q = cmd->rq->q;
249− end_cmd(cmd);
250−
251− if (q && !q->mq_ops && blk_queue_stopped(q)) {
252− spin_lock(q->queue_lock);
253− if (blk_queue_stopped(q))
254− blk_start_queue(q);
255− spin_unlock(q->queue_lock);
256− }
257− } while (entry);
258− }
253+ end_cmd(container_of(timer, struct nullb_cmd, timer));
259254
260255 return HRTIMER_NORESTART;
261256 }
262257
263258 static void null_cmd_end_timer(struct nullb_cmd *cmd)
264259 {
265− struct completion_queue *cq = &per_cpu(completion_queues, get_cpu());
266−
267− cmd->ll_list.next = NULL;
268− if (llist_add(&cmd->ll_list, &cq->list)) {
269− ktime_t kt = ktime_set(0, completion_nsec);
260+ ktime_t kt = ktime_set(0, completion_nsec);
270261
271− hrtimer_start(&cq->timer, kt, HRTIMER_MODE_REL_PINNED);
272− }
273−
274− put_cpu();
262+ hrtimer_start(&cmd->timer, kt, HRTIMER_MODE_REL);
275263 }
276264
277265 static void null_softirq_done_fn(struct request *rq)
@@ -369,6 +357,10 @@ static int null_queue_rq(struct blk_mq_hw_ctx *hctx, · 91 unmodified lines
369357 {
370358 struct nullb_cmd *cmd = blk_mq_rq_to_pdu(bd->rq);
371359
360+ if (irqmode == NULL_IRQ_TIMER) {
361+ hrtimer_init(&cmd->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
362+ cmd->timer.function = null_cmd_timer_expired;
363+ }
372364 cmd->rq = bd->rq;
373365 cmd->nq = hctx->driver_data;
374366
@@ -427,15 +419,156 @@ static void null_del_dev(struct nullb *nullb) · 52 unmodified lines
427419 {
428420 list_del_init(&nullb->list);
429421
430− del_gendisk(nullb->disk);
422+ if (use_lightnvm)
423+ nvm_unregister(nullb->disk_name);
424+ else
425+ del_gendisk(nullb->disk);
431426 blk_cleanup_queue(nullb->q);
432427 if (queue_mode == NULL_Q_MQ)
433428 blk_mq_free_tag_set(&nullb->tag_set);
434− put_disk(nullb->disk);
429+ if (!use_lightnvm)
430+ put_disk(nullb->disk);
435431 cleanup_queues(nullb);
436432 kfree(nullb);
437433 }
438434
435+#ifdef CONFIG_NVM
436+
437+static void null_lnvm_end_io(struct request *rq, int error)
438+{
439+ struct nvm_rq *rqd = rq->end_io_data;
440+ struct nvm_dev *dev = rqd->dev;
441+
442+ dev->mt->end_io(rqd, error);
443+
444+ blk_put_request(rq);
445+}
446+
447+static int null_lnvm_submit_io(struct request_queue *q, struct nvm_rq *rqd)
448+{
449+ struct request *rq;
450+ struct bio *bio = rqd->bio;
451+
452+ rq = blk_mq_alloc_request(q, bio_rw(bio), GFP_KERNEL, 0);
453+ if (IS_ERR(rq))
454+ return -ENOMEM;
455+
456+ rq->cmd_type = REQ_TYPE_DRV_PRIV;
457+ rq->__sector = bio->bi_iter.bi_sector;
458+ rq->ioprio = bio_prio(bio);
459+
460+ if (bio_has_data(bio))
461+ rq->nr_phys_segments = bio_phys_segments(q, bio);
462+
463+ rq->__data_len = bio->bi_iter.bi_size;
464+ rq->bio = rq->biotail = bio;
465+
466+ rq->end_io_data = rqd;
467+
468+ blk_execute_rq_nowait(q, NULL, rq, 0, null_lnvm_end_io);
469+
470+ return 0;
471+}
472+
473+static int null_lnvm_id(struct request_queue *q, struct nvm_id *id)
474+{
475+ sector_t size = gb * 1024 * 1024 * 1024ULL;
476+ sector_t blksize;
477+ struct nvm_id_group *grp;
478+
479+ id->ver_id = 0x1;
480+ id->vmnt = 0;
481+ id->cgrps = 1;
482+ id->cap = 0x3;
483+ id->dom = 0x1;
484+
485+ id->ppaf.blk_offset = 0;
486+ id->ppaf.blk_len = 16;
487+ id->ppaf.pg_offset = 16;
488+ id->ppaf.pg_len = 16;
489+ id->ppaf.sect_offset = 32;
490+ id->ppaf.sect_len = 8;
491+ id->ppaf.pln_offset = 40;
492+ id->ppaf.pln_len = 8;
493+ id->ppaf.lun_offset = 48;
494+ id->ppaf.lun_len = 8;
495+ id->ppaf.ch_offset = 56;
496+ id->ppaf.ch_len = 8;
497+
498+ do_div(size, bs); /* convert size to pages */
499+ do_div(size, 256); /* concert size to pgs pr blk */
500+ grp = &id->groups[0];
501+ grp->mtype = 0;
502+ grp->fmtype = 0;
503+ grp->num_ch = 1;
504+ grp->num_pg = 256;
505+ blksize = size;
506+ do_div(size, (1 << 16));
507+ grp->num_lun = size + 1;
508+ do_div(blksize, grp->num_lun);
509+ grp->num_blk = blksize;
510+ grp->num_pln = 1;
511+
512+ grp->fpg_sz = bs;
513+ grp->csecs = bs;
514+ grp->trdt = 25000;
515+ grp->trdm = 25000;
516+ grp->tprt = 500000;
517+ grp->tprm = 500000;
518+ grp->tbet = 1500000;
519+ grp->tbem = 1500000;
520+ grp->mpos = 0x010101; /* single plane rwe */
521+ grp->cpar = hw_queue_depth;
522+
523+ return 0;
524+}
525+
526+static void *null_lnvm_create_dma_pool(struct request_queue *q, char *name)
527+{
528+ mempool_t *virtmem_pool;
529+
530+ virtmem_pool = mempool_create_slab_pool(64, ppa_cache);
531+ if (!virtmem_pool) {
532+ pr_err("null_blk: Unable to create virtual memory pool\n");
533+ return NULL;
534+ }
535+
536+ return virtmem_pool;
537+}
538+
539+static void null_lnvm_destroy_dma_pool(void *pool)
540+{
541+ mempool_destroy(pool);
542+}
543+
544+static void *null_lnvm_dev_dma_alloc(struct request_queue *q, void *pool,
545+ gfp_t mem_flags, dma_addr_t *dma_handler)
546+{
547+ return mempool_alloc(pool, mem_flags);
548+}
549+
550+static void null_lnvm_dev_dma_free(void *pool, void *entry,
551+ dma_addr_t dma_handler)
552+{
553+ mempool_free(entry, pool);
554+}
555+
556+static struct nvm_dev_ops null_lnvm_dev_ops = {
557+ .identity = null_lnvm_id,
558+ .submit_io = null_lnvm_submit_io,
559+
560+ .create_dma_pool = null_lnvm_create_dma_pool,
561+ .destroy_dma_pool = null_lnvm_destroy_dma_pool,
562+ .dev_dma_alloc = null_lnvm_dev_dma_alloc,
563+ .dev_dma_free = null_lnvm_dev_dma_free,
564+
565+ /* Simulate nvme protocol restriction */
566+ .max_phys_sect = 64,
567+};
568+#else
569+static struct nvm_dev_ops null_lnvm_dev_ops;
570+#endif /* CONFIG_NVM */
571+
439572 static int null_open(struct block_device *bdev, fmode_t mode)
440573 {
441574 return 0;
@@ -575,11 +708,6 @@ static int null_add_dev(void) · 133 unmodified lines
575708 queue_flag_set_unlocked(QUEUE_FLAG_NONROT, nullb->q);
576709 queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, nullb->q);
577710
578− disk = nullb->disk = alloc_disk_node(1, home_node);
579− if (!disk) {
580− rv = -ENOMEM;
581− goto out_cleanup_blk_queue;
582− }
583711
584712 mutex_lock(&lock);
585713 list_add_tail(&nullb->list, &nullb_list);
@@ -589,6 +717,21 @@ static int null_add_dev(void) · 3 unmodified lines
589717 blk_queue_logical_block_size(nullb->q, bs);
590718 blk_queue_physical_block_size(nullb->q, bs);
591719
720+ sprintf(nullb->disk_name, "nullb%d", nullb->index);
721+
722+ if (use_lightnvm) {
723+ rv = nvm_register(nullb->q, nullb->disk_name,
724+ &null_lnvm_dev_ops);
725+ if (rv)
726+ goto out_cleanup_blk_queue;
727+ goto done;
728+ }
729+
730+ disk = nullb->disk = alloc_disk_node(1, home_node);
731+ if (!disk) {
732+ rv = -ENOMEM;
733+ goto out_cleanup_lightnvm;
734+ }
592735 size = gb * 1024 * 1024 * 1024ULL;
593736 set_capacity(disk, size >> 9);
594737
@@ -598,10 +741,15 @@ static int null_add_dev(void) · 3 unmodified lines
598741 disk->fops = &null_fops;
599742 disk->private_data = nullb;
600743 disk->queue = nullb->q;
601− sprintf(disk->disk_name, "nullb%d", nullb->index);
744+ strncpy(disk->disk_name, nullb->disk_name, DISK_NAME_LEN);
745+
602746 add_disk(disk);
747+done:
603748 return 0;
604749
750+out_cleanup_lightnvm:
751+ if (use_lightnvm)
752+ nvm_unregister(nullb->disk_name);
605753 out_cleanup_blk_queue:
606754 blk_cleanup_queue(nullb->q);
607755 out_cleanup_tags:
@@ -625,6 +773,18 @@ static int __init null_init(void) · 17 unmodified lines
625773 bs = PAGE_SIZE;
626774 }
627775
776+ if (use_lightnvm && bs != 4096) {
777+ pr_warn("null_blk: LightNVM only supports 4k block size\n");
778+ pr_warn("null_blk: defaults block size to 4k\n");
779+ bs = 4096;
780+ }
781+
782+ if (use_lightnvm && queue_mode != NULL_Q_MQ) {
783+ pr_warn("null_blk: LightNVM only supported for blk-mq\n");
784+ pr_warn("null_blk: defaults queue mode to blk-mq\n");
785+ queue_mode = NULL_Q_MQ;
786+ }
787+
628788 if (queue_mode == NULL_Q_MQ && use_per_node_hctx) {
629789 if (submit_queues < nr_online_nodes) {
630790 pr_warn("null_blk: submit_queues param is set to %u.",
@@ -638,32 +798,31 @@ static int __init null_init(void) · 7 unmodified lines
638798
639799 mutex_init(&lock);
640800
641− /* Initialize a separate list for each CPU for issuing softirqs */
642− for_each_possible_cpu(i) {
643− struct completion_queue *cq = &per_cpu(completion_queues, i);
644−
645− init_llist_head(&cq->list);
646−
647− if (irqmode != NULL_IRQ_TIMER)
648− continue;
649−
650− hrtimer_init(&cq->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
651− cq->timer.function = null_cmd_timer_expired;
652− }
653−
654801 null_major = register_blkdev(0, "nullb");
655802 if (null_major < 0)
656803 return null_major;
657804
805+ if (use_lightnvm) {
806+ ppa_cache = kmem_cache_create("ppa_cache", 64 * sizeof(u64),
807+ 0, 0, NULL);
808+ if (!ppa_cache) {
809+ pr_err("null_blk: unable to create ppa cache\n");
810+ return -ENOMEM;
811+ }
812+ }
813+
658814 for (i = 0; i < nr_devices; i++) {
659815 if (null_add_dev()) {
660816 unregister_blkdev(null_major, "nullb");
661− return -EINVAL;
817+ goto err_ppa;
662818 }
663819 }
664820
665821 pr_info("null: module loaded\n");
666822 return 0;
823+err_ppa:
824+ kmem_cache_destroy(ppa_cache);
825+ return -EINVAL;
667826 }
668827
669828 static void __exit null_exit(void)
@@ -678,6 +837,8 @@ static void __exit null_exit(void) · 8 unmodified lines
678837 null_del_dev(nullb);
679838 }
680839 mutex_unlock(&lock);
840+
841+ kmem_cache_destroy(ppa_cache);
681842 }
682843
683844 module_init(null_init);
drivers/block/rbd.c+1−0
@@ -3442,6 +3442,7 @@ static void rbd_queue_workfn(struct work_struct *work) · 3441 unmodified lines
34423442 goto err_rq;
34433443 }
34443444 img_request->rq = rq;
3445+ snapc = NULL; /* img_request consumes a ref */
34453446
34463447 if (op_type == OBJ_OP_DISCARD)
34473448 result = rbd_img_request_fill(img_request, OBJ_REQUEST_NODATA,
drivers/bus/omap-ocp2scp.c+1−1
@@ -117,7 +117,7 @@ static struct platform_driver omap_ocp2scp_driver = { · 116 unmodified lines
117117
118118 module_platform_driver(omap_ocp2scp_driver);
119119
120−MODULE_ALIAS("platform: omap-ocp2scp");
120+MODULE_ALIAS("platform:omap-ocp2scp");
121121 MODULE_AUTHOR("Texas Instruments Inc.");
122122 MODULE_DESCRIPTION("OMAP OCP2SCP driver");
123123 MODULE_LICENSE("GPL v2");
drivers/char/ipmi/ipmi_si_intf.c+52−30
@@ -412,18 +412,42 @@ static enum si_sm_result start_next_msg(struct smi_info *smi_info) · 411 unmodified lines
412412 return rv;
413413 }
414414
415−static void start_check_enables(struct smi_info *smi_info)
415+static void smi_mod_timer(struct smi_info *smi_info, unsigned long new_val)
416+{
417+ smi_info->last_timeout_jiffies = jiffies;
418+ mod_timer(&smi_info->si_timer, new_val);
419+ smi_info->timer_running = true;
420+}
421+
422+/*
423+ * Start a new message and (re)start the timer and thread.
424+ */
425+static void start_new_msg(struct smi_info *smi_info, unsigned char *msg,
426+ unsigned int size)
427+{
428+ smi_mod_timer(smi_info, jiffies + SI_TIMEOUT_JIFFIES);
429+
430+ if (smi_info->thread)
431+ wake_up_process(smi_info->thread);
432+
433+ smi_info->handlers->start_transaction(smi_info->si_sm, msg, size);
434+}
435+
436+static void start_check_enables(struct smi_info *smi_info, bool start_timer)
416437 {
417438 unsigned char msg[2];
418439
419440 msg[0] = (IPMI_NETFN_APP_REQUEST << 2);
420441 msg[1] = IPMI_GET_BMC_GLOBAL_ENABLES_CMD;
421442
422− smi_info->handlers->start_transaction(smi_info->si_sm, msg, 2);
443+ if (start_timer)
444+ start_new_msg(smi_info, msg, 2);
445+ else
446+ smi_info->handlers->start_transaction(smi_info->si_sm, msg, 2);
423447 smi_info->si_state = SI_CHECKING_ENABLES;
424448 }
425449
426−static void start_clear_flags(struct smi_info *smi_info)
450+static void start_clear_flags(struct smi_info *smi_info, bool start_timer)
427451 {
428452 unsigned char msg[3];
429453
@@ -432,7 +456,10 @@ static void start_clear_flags(struct smi_info *smi_info) · 2 unmodified lines
432456 msg[1] = IPMI_CLEAR_MSG_FLAGS_CMD;
433457 msg[2] = WDT_PRE_TIMEOUT_INT;
434458
435− smi_info->handlers->start_transaction(smi_info->si_sm, msg, 3);
459+ if (start_timer)
460+ start_new_msg(smi_info, msg, 3);
461+ else
462+ smi_info->handlers->start_transaction(smi_info->si_sm, msg, 3);
436463 smi_info->si_state = SI_CLEARING_FLAGS;
437464 }
438465
@@ -442,10 +469,8 @@ static void start_getting_msg_queue(struct smi_info *smi_info) · 3 unmodified lines
442469 smi_info->curr_msg->data[1] = IPMI_GET_MSG_CMD;
443470 smi_info->curr_msg->data_size = 2;
444471
445− smi_info->handlers->start_transaction(
446− smi_info->si_sm,
447− smi_info->curr_msg->data,
448− smi_info->curr_msg->data_size);
472+ start_new_msg(smi_info, smi_info->curr_msg->data,
473+ smi_info->curr_msg->data_size);
449474 smi_info->si_state = SI_GETTING_MESSAGES;
450475 }
451476
@@ -455,20 +480,11 @@ static void start_getting_events(struct smi_info *smi_info) · 3 unmodified lines
455480 smi_info->curr_msg->data[1] = IPMI_READ_EVENT_MSG_BUFFER_CMD;
456481 smi_info->curr_msg->data_size = 2;
457482
458− smi_info->handlers->start_transaction(
459− smi_info->si_sm,
460− smi_info->curr_msg->data,
461− smi_info->curr_msg->data_size);
483+ start_new_msg(smi_info, smi_info->curr_msg->data,
484+ smi_info->curr_msg->data_size);
462485 smi_info->si_state = SI_GETTING_EVENTS;
463486 }
464487
465−static void smi_mod_timer(struct smi_info *smi_info, unsigned long new_val)
466−{
467− smi_info->last_timeout_jiffies = jiffies;
468− mod_timer(&smi_info->si_timer, new_val);
469− smi_info->timer_running = true;
470−}
471−
472488 /*
473489 * When we have a situtaion where we run out of memory and cannot
474490 * allocate messages, we just leave them in the BMC and run the system
@@ -478,11 +494,11 @@ static void smi_mod_timer(struct smi_info *smi_info, unsigned long new_val) · 3 unmodified lines
478494 * Note that we cannot just use disable_irq(), since the interrupt may
479495 * be shared.
480496 */
481−static inline bool disable_si_irq(struct smi_info *smi_info)
497+static inline bool disable_si_irq(struct smi_info *smi_info, bool start_timer)
482498 {
483499 if ((smi_info->irq) && (!smi_info->interrupt_disabled)) {
484500 smi_info->interrupt_disabled = true;
485− start_check_enables(smi_info);
501+ start_check_enables(smi_info, start_timer);
486502 return true;
487503 }
488504 return false;
@@ -492,7 +508,7 @@ static inline bool enable_si_irq(struct smi_info *smi_info) · 3 unmodified lines
492508 {
493509 if ((smi_info->irq) && (smi_info->interrupt_disabled)) {
494510 smi_info->interrupt_disabled = false;
495− start_check_enables(smi_info);
511+ start_check_enables(smi_info, true);
496512 return true;
497513 }
498514 return false;
@@ -510,7 +526,7 @@ static struct ipmi_smi_msg *alloc_msg_handle_irq(struct smi_info *smi_info) · 11 unmodified lines
510526
511527 msg = ipmi_alloc_smi_msg();
512528 if (!msg) {
513− if (!disable_si_irq(smi_info))
529+ if (!disable_si_irq(smi_info, true))
514530 smi_info->si_state = SI_NORMAL;
515531 } else if (enable_si_irq(smi_info)) {
516532 ipmi_free_smi_msg(msg);
@@ -526,7 +542,7 @@ static void handle_flags(struct smi_info *smi_info) · 9 unmodified lines
526542 /* Watchdog pre-timeout */
527543 smi_inc_stat(smi_info, watchdog_pretimeouts);
528544
529− start_clear_flags(smi_info);
545+ start_clear_flags(smi_info, true);
530546 smi_info->msg_flags &= ~WDT_PRE_TIMEOUT_INT;
531547 if (smi_info->intf)
532548 ipmi_smi_watchdog_pretimeout(smi_info->intf);
@@ -879,8 +895,7 @@ static enum si_sm_result smi_event_handler(struct smi_info *smi_info, · 346 unmodified lines
879895 msg[0] = (IPMI_NETFN_APP_REQUEST << 2);
880896 msg[1] = IPMI_GET_MSG_FLAGS_CMD;
881897
882− smi_info->handlers->start_transaction(
883− smi_info->si_sm, msg, 2);
898+ start_new_msg(smi_info, msg, 2);
884899 smi_info->si_state = SI_GETTING_FLAGS;
885900 goto restart;
886901 }
@@ -910,7 +925,7 @@ static enum si_sm_result smi_event_handler(struct smi_info *smi_info, · 23 unmodified lines
910925 * disable and messages disabled.
911926 */
912927 if (smi_info->supports_event_msg_buff || smi_info->irq) {
913− start_check_enables(smi_info);
928+ start_check_enables(smi_info, true);
914929 } else {
915930 smi_info->curr_msg = alloc_msg_handle_irq(smi_info);
916931 if (!smi_info->curr_msg)
@@ -920,6 +935,13 @@ static enum si_sm_result smi_event_handler(struct smi_info *smi_info, · 3 unmodified lines
920935 }
921936 goto restart;
922937 }
938+
939+ if (si_sm_result == SI_SM_IDLE && smi_info->timer_running) {
940+ /* Ok it if fails, the timer will just go off. */
941+ if (del_timer(&smi_info->si_timer))
942+ smi_info->timer_running = false;
943+ }
944+
923945 out:
924946 return si_sm_result;
925947 }
@@ -2560,6 +2582,7 @@ static const struct of_device_id of_ipmi_match[] = { · 1634 unmodified lines
25602582 .data = (void *)(unsigned long) SI_BT },
25612583 {},
25622584 };
2585+MODULE_DEVICE_TABLE(of, of_ipmi_match);
25632586
25642587 static int of_ipmi_probe(struct platform_device *dev)
25652588 {
@@ -2646,7 +2669,6 @@ static int of_ipmi_probe(struct platform_device *dev) · 80 unmodified lines
26462669 }
26472670 return 0;
26482671 }
2649−MODULE_DEVICE_TABLE(of, of_ipmi_match);
26502672 #else
26512673 #define of_ipmi_match NULL
26522674 static int of_ipmi_probe(struct platform_device *dev)
@@ -3613,7 +3635,7 @@ static int try_smi_init(struct smi_info *new_smi) · 960 unmodified lines
36133635 * Start clearing the flags before we enable interrupts or the
36143636 * timer to avoid racing with the timer.
36153637 */
3616− start_clear_flags(new_smi);
3638+ start_clear_flags(new_smi, false);
36173639
36183640 /*
36193641 * IRQ is defined to be set when non-zero. req_events will
@@ -3908,7 +3930,7 @@ static void cleanup_one_si(struct smi_info *to_clean) · 288 unmodified lines
39083930 poll(to_clean);
39093931 schedule_timeout_uninterruptible(1);
39103932 }
3911− disable_si_irq(to_clean);
3933+ disable_si_irq(to_clean, false);
39123934 while (to_clean->curr_msg || (to_clean->si_state != SI_NORMAL)) {
39133935 poll(to_clean);
39143936 schedule_timeout_uninterruptible(1);
drivers/char/ipmi/ipmi_watchdog.c+7−1
@@ -153,6 +153,9 @@ static int timeout = 10; · 152 unmodified lines
153153 /* The pre-timeout is disabled by default. */
154154 static int pretimeout;
155155
156+/* Default timeout to set on panic */
157+static int panic_wdt_timeout = 255;
158+
156159 /* Default action is to reset the board on a timeout. */
157160 static unsigned char action_val = WDOG_TIMEOUT_RESET;
158161
@@ -293,6 +296,9 @@ MODULE_PARM_DESC(timeout, "Timeout value in seconds."); · 134 unmodified lines
293296 module_param(pretimeout, timeout, 0644);
294297 MODULE_PARM_DESC(pretimeout, "Pretimeout value in seconds.");
295298
299+module_param(panic_wdt_timeout, timeout, 0644);
300+MODULE_PARM_DESC(timeout, "Timeout value on kernel panic in seconds.");
301+
296302 module_param_cb(action, &param_ops_str, action_op, 0644);
297303 MODULE_PARM_DESC(action, "Timeout action. One of: "
298304 "reset, none, power_cycle, power_off.");
@@ -1189,7 +1195,7 @@ static int wdog_panic_handler(struct notifier_block *this, · 890 unmodified lines
11891195 /* Make sure we do this only once. */
11901196 panic_event_handled = 1;
11911197
1192− timeout = 255;
1198+ timeout = panic_wdt_timeout;
11931199 pretimeout = 0;
11941200 panic_halt_ipmi_set_timeout();
11951201 }
drivers/clocksource/Kconfig+1−0
@@ -1,4 +1,5 @@
11 menu "Clock Source drivers"
2+ depends on !ARCH_USES_GETTIMEOFFSET
23
34 config CLKSRC_OF
45 bool
drivers/clocksource/fsl_ftm_timer.c+2−2
@@ -203,7 +203,7 @@ static int __init ftm_clockevent_init(unsigned long freq, int irq) · 202 unmodified lines
203203 int err;
204204
205205 ftm_writel(0x00, priv->clkevt_base + FTM_CNTIN);
206− ftm_writel(~0UL, priv->clkevt_base + FTM_MOD);
206+ ftm_writel(~0u, priv->clkevt_base + FTM_MOD);
207207
208208 ftm_reset_counter(priv->clkevt_base);
209209
@@ -230,7 +230,7 @@ static int __init ftm_clocksource_init(unsigned long freq) · 20 unmodified lines
230230 int err;
231231
232232 ftm_writel(0x00, priv->clksrc_base + FTM_CNTIN);
233− ftm_writel(~0UL, priv->clksrc_base + FTM_MOD);
233+ ftm_writel(~0u, priv->clksrc_base + FTM_MOD);
234234
235235 ftm_reset_counter(priv->clksrc_base);
236236
drivers/cpufreq/Kconfig.arm+2−1
@@ -84,6 +84,7 @@ config ARM_KIRKWOOD_CPUFREQ · 83 unmodified lines
8484 config ARM_MT8173_CPUFREQ
8585 bool "Mediatek MT8173 CPUFreq support"
8686 depends on ARCH_MEDIATEK && REGULATOR
87+ depends on ARM64 || (ARM_CPU_TOPOLOGY && COMPILE_TEST)
8788 depends on !CPU_THERMAL || THERMAL=y
8889 select PM_OPP
8990 help
@@ -201,7 +202,7 @@ config ARM_SA1110_CPUFREQ · 111 unmodified lines
201202
202203 config ARM_SCPI_CPUFREQ
203204 tristate "SCPI based CPUfreq driver"
204− depends on ARM_BIG_LITTLE_CPUFREQ && ARM_SCPI_PROTOCOL
205+ depends on ARM_BIG_LITTLE_CPUFREQ && ARM_SCPI_PROTOCOL && COMMON_CLK_SCPI
205206 help
206207 This adds the CPUfreq driver support for ARM big.LITTLE platforms
207208 using SCPI protocol for CPU power management.
drivers/cpufreq/Kconfig.x86+0−1
@@ -5,7 +5,6 @@ · 4 unmodified lines
55 config X86_INTEL_PSTATE
66 bool "Intel P state control"
77 depends on X86
8− select ACPI_PROCESSOR if ACPI
98 help
109 This driver provides a P state for Intel core processors.
1110 The driver implements an internal governor and will become
drivers/cpufreq/cppc_cpufreq.c+2−1
@@ -98,10 +98,11 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy) · 97 unmodified lines
9898 policy->max = cpu->perf_caps.highest_perf;
9999 policy->cpuinfo.min_freq = policy->min;
100100 policy->cpuinfo.max_freq = policy->max;
101+ policy->shared_type = cpu->shared_type;
101102
102103 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
103104 cpumask_copy(policy->cpus, cpu->shared_cpu_map);
104− else {
105+ else if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL) {
105106 /* Support only SW_ANY for now. */
106107 pr_debug("Unsupported CPU co-ord type\n");
107108 return -EFAULT;
drivers/cpufreq/cpufreq.c+12−9
@@ -976,10 +976,14 @@ static int cpufreq_init_policy(struct cpufreq_policy *policy) · 975 unmodified lines
976976
977977 new_policy.governor = gov;
978978
979− /* Use the default policy if its valid. */
980− if (cpufreq_driver->setpolicy)
981− cpufreq_parse_governor(gov->name, &new_policy.policy, NULL);
982−
979+ /* Use the default policy if there is no last_policy. */
980+ if (cpufreq_driver->setpolicy) {
981+ if (policy->last_policy)
982+ new_policy.policy = policy->last_policy;
983+ else
984+ cpufreq_parse_governor(gov->name, &new_policy.policy,
985+ NULL);
986+ }
983987 /* set default policy */
984988 return cpufreq_set_policy(policy, &new_policy);
985989 }
@@ -1330,6 +1334,8 @@ static void cpufreq_offline_prepare(unsigned int cpu) · 344 unmodified lines
13301334 if (has_target())
13311335 strncpy(policy->last_governor, policy->governor->name,
13321336 CPUFREQ_NAME_LEN);
1337+ else
1338+ policy->last_policy = policy->policy;
13331339 } else if (cpu == policy->cpu) {
13341340 /* Nominate new CPU */
13351341 policy->cpu = cpumask_any(policy->cpus);
@@ -1401,13 +1407,10 @@ static void cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif) · 65 unmodified lines
14011407 }
14021408
14031409 cpumask_clear_cpu(cpu, policy->real_cpus);
1410+ remove_cpu_dev_symlink(policy, cpu);
14041411
1405− if (cpumask_empty(policy->real_cpus)) {
1412+ if (cpumask_empty(policy->real_cpus))
14061413 cpufreq_policy_free(policy, true);
1407− return;
1408− }
1409−
1410− remove_cpu_dev_symlink(policy, cpu);
14111414 }
14121415
14131416 static void handle_update(struct work_struct *work)
drivers/cpufreq/intel_pstate.c+77−245
@@ -34,14 +34,10 @@ · 33 unmodified lines
3434 #include <asm/cpu_device_id.h>
3535 #include <asm/cpufeature.h>
3636
37−#if IS_ENABLED(CONFIG_ACPI)
38−#include <acpi/processor.h>
39−#endif
40−
41−#define BYT_RATIOS 0x66a
42−#define BYT_VIDS 0x66b
43−#define BYT_TURBO_RATIOS 0x66c
44−#define BYT_TURBO_VIDS 0x66d
37+#define ATOM_RATIOS 0x66a
38+#define ATOM_VIDS 0x66b
39+#define ATOM_TURBO_RATIOS 0x66c
40+#define ATOM_TURBO_VIDS 0x66d
4541
4642 #define FRAC_BITS 8
4743 #define int_tofp(X) ((int64_t)(X) << FRAC_BITS)
@@ -117,9 +113,6 @@ struct cpudata { · 69 unmodified lines
117113 u64 prev_mperf;
118114 u64 prev_tsc;
119115 struct sample sample;
120−#if IS_ENABLED(CONFIG_ACPI)
121− struct acpi_processor_performance acpi_perf_data;
122−#endif
123116 };
124117
125118 static struct cpudata **all_cpu_data;
@@ -150,7 +143,6 @@ struct cpu_defaults { · 24 unmodified lines
150143 static struct pstate_adjust_policy pid_params;
151144 static struct pstate_funcs pstate_funcs;
152145 static int hwp_active;
153−static int no_acpi_perf;
154146
155147 struct perf_limits {
156148 int no_turbo;
@@ -163,8 +155,6 @@ struct perf_limits { · 6 unmodified lines
163155 int max_sysfs_pct;
164156 int min_policy_pct;
165157 int min_sysfs_pct;
166− int max_perf_ctl;
167− int min_perf_ctl;
168158 };
169159
170160 static struct perf_limits performance_limits = {
@@ -191,8 +181,6 @@ static struct perf_limits powersave_limits = { · 20 unmodified lines
191181 .max_sysfs_pct = 100,
192182 .min_policy_pct = 0,
193183 .min_sysfs_pct = 0,
194− .max_perf_ctl = 0,
195− .min_perf_ctl = 0,
196184 };
197185
198186 #ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE
@@ -201,153 +189,6 @@ static struct perf_limits *limits = &performance_limits; · 2 unmodified lines
201189 static struct perf_limits *limits = &powersave_limits;
202190 #endif
203191
204−#if IS_ENABLED(CONFIG_ACPI)
205−/*
206− * The max target pstate ratio is a 8 bit value in both PLATFORM_INFO MSR and
207− * in TURBO_RATIO_LIMIT MSR, which pstate driver stores in max_pstate and
208− * max_turbo_pstate fields. The PERF_CTL MSR contains 16 bit value for P state
209− * ratio, out of it only high 8 bits are used. For example 0x1700 is setting
210− * target ratio 0x17. The _PSS control value stores in a format which can be
211− * directly written to PERF_CTL MSR. But in intel_pstate driver this shift
212− * occurs during write to PERF_CTL (E.g. for cores core_set_pstate()).
213− * This function converts the _PSS control value to intel pstate driver format
214− * for comparison and assignment.
215− */
216−static int convert_to_native_pstate_format(struct cpudata *cpu, int index)
217−{
218− return cpu->acpi_perf_data.states[index].control >> 8;
219−}
220−
221−static int intel_pstate_init_perf_limits(struct cpufreq_policy *policy)
222−{
223− struct cpudata *cpu;
224− int ret;
225− bool turbo_absent = false;
226− int max_pstate_index;
227− int min_pss_ctl, max_pss_ctl, turbo_pss_ctl;
228− int i;
229−
230− cpu = all_cpu_data[policy->cpu];
231−
232− pr_debug("intel_pstate: default limits 0x%x 0x%x 0x%x\n",
233− cpu->pstate.min_pstate, cpu->pstate.max_pstate,
234− cpu->pstate.turbo_pstate);
235−
236− if (!cpu->acpi_perf_data.shared_cpu_map &&
237− zalloc_cpumask_var_node(&cpu->acpi_perf_data.shared_cpu_map,
238− GFP_KERNEL, cpu_to_node(policy->cpu))) {
239− return -ENOMEM;
240− }
241−
242− ret = acpi_processor_register_performance(&cpu->acpi_perf_data,
243− policy->cpu);
244− if (ret)
245− return ret;
246−
247− /*
248− * Check if the control value in _PSS is for PERF_CTL MSR, which should
249− * guarantee that the states returned by it map to the states in our
250− * list directly.
251− */
252− if (cpu->acpi_perf_data.control_register.space_id !=
253− ACPI_ADR_SPACE_FIXED_HARDWARE)
254− return -EIO;
255−
256− pr_debug("intel_pstate: CPU%u - ACPI _PSS perf data\n", policy->cpu);
257− for (i = 0; i < cpu->acpi_perf_data.state_count; i++)
258− pr_debug(" %cP%d: %u MHz, %u mW, 0x%x\n",
259− (i == cpu->acpi_perf_data.state ? '*' : ' '), i,
260− (u32) cpu->acpi_perf_data.states[i].core_frequency,
261− (u32) cpu->acpi_perf_data.states[i].power,
262− (u32) cpu->acpi_perf_data.states[i].control);
263−
264− /*
265− * If there is only one entry _PSS, simply ignore _PSS and continue as
266− * usual without taking _PSS into account
267− */
268− if (cpu->acpi_perf_data.state_count < 2)
269− return 0;
270−
271− turbo_pss_ctl = convert_to_native_pstate_format(cpu, 0);
272− min_pss_ctl = convert_to_native_pstate_format(cpu,
273− cpu->acpi_perf_data.state_count - 1);
274− /* Check if there is a turbo freq in _PSS */
275− if (turbo_pss_ctl <= cpu->pstate.max_pstate &&
276− turbo_pss_ctl > cpu->pstate.min_pstate) {
277− pr_debug("intel_pstate: no turbo range exists in _PSS\n");
278− limits->no_turbo = limits->turbo_disabled = 1;
279− cpu->pstate.turbo_pstate = cpu->pstate.max_pstate;
280− turbo_absent = true;
281− }
282−
283− /* Check if the max non turbo p state < Intel P state max */
284− max_pstate_index = turbo_absent ? 0 : 1;
285− max_pss_ctl = convert_to_native_pstate_format(cpu, max_pstate_index);
286− if (max_pss_ctl < cpu->pstate.max_pstate &&
287− max_pss_ctl > cpu->pstate.min_pstate)
288− cpu->pstate.max_pstate = max_pss_ctl;
289−
290− /* check If min perf > Intel P State min */
291− if (min_pss_ctl > cpu->pstate.min_pstate &&
292− min_pss_ctl < cpu->pstate.max_pstate) {
293− cpu->pstate.min_pstate = min_pss_ctl;
294− policy->cpuinfo.min_freq = min_pss_ctl * cpu->pstate.scaling;
295− }
296−
297− if (turbo_absent)
298− policy->cpuinfo.max_freq = cpu->pstate.max_pstate *
299− cpu->pstate.scaling;
300− else {
301− policy->cpuinfo.max_freq = cpu->pstate.turbo_pstate *
302− cpu->pstate.scaling;
303− /*
304− * The _PSS table doesn't contain whole turbo frequency range.
305− * This just contains +1 MHZ above the max non turbo frequency,
306− * with control value corresponding to max turbo ratio. But
307− * when cpufreq set policy is called, it will call with this
308− * max frequency, which will cause a reduced performance as
309− * this driver uses real max turbo frequency as the max
310− * frequeny. So correct this frequency in _PSS table to
311− * correct max turbo frequency based on the turbo ratio.
312− * Also need to convert to MHz as _PSS freq is in MHz.
313− */
314− cpu->acpi_perf_data.states[0].core_frequency =
315− turbo_pss_ctl * 100;
316− }
317−
318− pr_debug("intel_pstate: Updated limits using _PSS 0x%x 0x%x 0x%x\n",
319− cpu->pstate.min_pstate, cpu->pstate.max_pstate,
320− cpu->pstate.turbo_pstate);
321− pr_debug("intel_pstate: policy max_freq=%d Khz min_freq = %d KHz\n",
322− policy->cpuinfo.max_freq, policy->cpuinfo.min_freq);
323−
324− return 0;
325−}
326−
327−static int intel_pstate_exit_perf_limits(struct cpufreq_policy *policy)
328−{
329− struct cpudata *cpu;
330−
331− if (!no_acpi_perf)
332− return 0;
333−
334− cpu = all_cpu_data[policy->cpu];
335− acpi_processor_unregister_performance(policy->cpu);
336− return 0;
337−}
338−
339−#else
340−static int intel_pstate_init_perf_limits(struct cpufreq_policy *policy)
341−{
342− return 0;
343−}
344−
345−static int intel_pstate_exit_perf_limits(struct cpufreq_policy *policy)
346−{
347− return 0;
348−}
349−#endif
350−
351192 static inline void pid_reset(struct _pid *pid, int setpoint, int busy,
352193 int deadband, int integral) {
353194 pid->setpoint = setpoint;
@@ -687,31 +528,31 @@ static void intel_pstate_hwp_enable(struct cpudata *cpudata) · 333 unmodified lines
687528 wrmsrl_on_cpu(cpudata->cpu, MSR_PM_ENABLE, 0x1);
688529 }
689530
690−static int byt_get_min_pstate(void)
531+static int atom_get_min_pstate(void)
691532 {
692533 u64 value;
693534
694− rdmsrl(BYT_RATIOS, value);
535+ rdmsrl(ATOM_RATIOS, value);
695536 return (value >> 8) & 0x7F;
696537 }
697538
698−static int byt_get_max_pstate(void)
539+static int atom_get_max_pstate(void)
699540 {
700541 u64 value;
701542
702− rdmsrl(BYT_RATIOS, value);
543+ rdmsrl(ATOM_RATIOS, value);
703544 return (value >> 16) & 0x7F;
704545 }
705546
706−static int byt_get_turbo_pstate(void)
547+static int atom_get_turbo_pstate(void)
707548 {
708549 u64 value;
709550
710− rdmsrl(BYT_TURBO_RATIOS, value);
551+ rdmsrl(ATOM_TURBO_RATIOS, value);
711552 return value & 0x7F;
712553 }
713554
714−static void byt_set_pstate(struct cpudata *cpudata, int pstate)
555+static void atom_set_pstate(struct cpudata *cpudata, int pstate)
715556 {
716557 u64 val;
717558 int32_t vid_fp;
@@ -736,27 +577,42 @@ static void byt_set_pstate(struct cpudata *cpudata, int pstate) · 18 unmodified lines
736577 wrmsrl_on_cpu(cpudata->cpu, MSR_IA32_PERF_CTL, val);
737578 }
738579
739−#define BYT_BCLK_FREQS 5
740−static int byt_freq_table[BYT_BCLK_FREQS] = { 833, 1000, 1333, 1167, 800};
741−
742−static int byt_get_scaling(void)
580+static int silvermont_get_scaling(void)
743581 {
744582 u64 value;
745583 int i;
584+ /* Defined in Table 35-6 from SDM (Sept 2015) */
585+ static int silvermont_freq_table[] = {
586+ 83300, 100000, 133300, 116700, 80000};
746587
747588 rdmsrl(MSR_FSB_FREQ, value);
748− i = value & 0x3;
589+ i = value & 0x7;
590+ WARN_ON(i > 4);
749591
750− BUG_ON(i > BYT_BCLK_FREQS);
592+ return silvermont_freq_table[i];
593+}
751594
752− return byt_freq_table[i] * 100;
595+static int airmont_get_scaling(void)
596+{
597+ u64 value;
598+ int i;
599+ /* Defined in Table 35-10 from SDM (Sept 2015) */
600+ static int airmont_freq_table[] = {
601+ 83300, 100000, 133300, 116700, 80000,
602+ 93300, 90000, 88900, 87500};
603+
604+ rdmsrl(MSR_FSB_FREQ, value);
605+ i = value & 0xF;
606+ WARN_ON(i > 8);
607+
608+ return airmont_freq_table[i];
753609 }
754610
755−static void byt_get_vid(struct cpudata *cpudata)
611+static void atom_get_vid(struct cpudata *cpudata)
756612 {
757613 u64 value;
758614
759− rdmsrl(BYT_VIDS, value);
615+ rdmsrl(ATOM_VIDS, value);
760616 cpudata->vid.min = int_tofp((value >> 8) & 0x7f);
761617 cpudata->vid.max = int_tofp((value >> 16) & 0x7f);
762618 cpudata->vid.ratio = div_fp(
@@ -764,7 +620,7 @@ static void byt_get_vid(struct cpudata *cpudata) · 1 unmodified line
764620 int_tofp(cpudata->pstate.max_pstate -
765621 cpudata->pstate.min_pstate));
766622
767− rdmsrl(BYT_TURBO_VIDS, value);
623+ rdmsrl(ATOM_TURBO_VIDS, value);
768624 cpudata->vid.turbo = value & 0x7f;
769625 }
770626
@@ -885,7 +741,7 @@ static struct cpu_defaults core_params = { · 114 unmodified lines
885741 },
886742 };
887743
888−static struct cpu_defaults byt_params = {
744+static struct cpu_defaults silvermont_params = {
889745 .pid_policy = {
890746 .sample_rate_ms = 10,
891747 .deadband = 0,
@@ -895,13 +751,33 @@ static struct cpu_defaults byt_params = { · 3 unmodified lines
895751 .i_gain_pct = 4,
896752 },
897753 .funcs = {
898− .get_max = byt_get_max_pstate,
899− .get_max_physical = byt_get_max_pstate,
900− .get_min = byt_get_min_pstate,
901− .get_turbo = byt_get_turbo_pstate,
902− .set = byt_set_pstate,
903− .get_scaling = byt_get_scaling,
904− .get_vid = byt_get_vid,
754+ .get_max = atom_get_max_pstate,
755+ .get_max_physical = atom_get_max_pstate,
756+ .get_min = atom_get_min_pstate,
757+ .get_turbo = atom_get_turbo_pstate,
758+ .set = atom_set_pstate,
759+ .get_scaling = silvermont_get_scaling,
760+ .get_vid = atom_get_vid,
761+ },
762+};
763+
764+static struct cpu_defaults airmont_params = {
765+ .pid_policy = {
766+ .sample_rate_ms = 10,
767+ .deadband = 0,
768+ .setpoint = 60,
769+ .p_gain_pct = 14,
770+ .d_gain_pct = 0,
771+ .i_gain_pct = 4,
772+ },
773+ .funcs = {
774+ .get_max = atom_get_max_pstate,
775+ .get_max_physical = atom_get_max_pstate,
776+ .get_min = atom_get_min_pstate,
777+ .get_turbo = atom_get_turbo_pstate,
778+ .set = atom_set_pstate,
779+ .get_scaling = airmont_get_scaling,
780+ .get_vid = atom_get_vid,
905781 },
906782 };
907783
@@ -938,23 +814,12 @@ static void intel_pstate_get_min_max(struct cpudata *cpu, int *min, int *max) · 30 unmodified lines
938814 * policy, or by cpu specific default values determined through
939815 * experimentation.
940816 */
941− if (limits->max_perf_ctl && limits->max_sysfs_pct >=
942− limits->max_policy_pct) {
943− *max = limits->max_perf_ctl;
944− } else {
945− max_perf_adj = fp_toint(mul_fp(int_tofp(max_perf),
946− limits->max_perf));
947− *max = clamp_t(int, max_perf_adj, cpu->pstate.min_pstate,
948− cpu->pstate.turbo_pstate);
949− }
817+ max_perf_adj = fp_toint(mul_fp(int_tofp(max_perf), limits->max_perf));
818+ *max = clamp_t(int, max_perf_adj,
819+ cpu->pstate.min_pstate, cpu->pstate.turbo_pstate);
950820
951− if (limits->min_perf_ctl) {
952− *min = limits->min_perf_ctl;
953− } else {
954− min_perf = fp_toint(mul_fp(int_tofp(max_perf),
955− limits->min_perf));
956− *min = clamp_t(int, min_perf, cpu->pstate.min_pstate, max_perf);
957− }
821+ min_perf = fp_toint(mul_fp(int_tofp(max_perf), limits->min_perf));
822+ *min = clamp_t(int, min_perf, cpu->pstate.min_pstate, max_perf);
958823 }
959824
960825 static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate, bool force)
@@ -1153,7 +1018,7 @@ static void intel_pstate_timer_func(unsigned long __data) · 192 unmodified lines
11531018 static const struct x86_cpu_id intel_pstate_cpu_ids[] = {
11541019 ICPU(0x2a, core_params),
11551020 ICPU(0x2d, core_params),
1156− ICPU(0x37, byt_params),
1021+ ICPU(0x37, silvermont_params),
11571022 ICPU(0x3a, core_params),
11581023 ICPU(0x3c, core_params),
11591024 ICPU(0x3d, core_params),
@@ -1162,7 +1027,7 @@ static const struct x86_cpu_id intel_pstate_cpu_ids[] = { · 2 unmodified lines
11621027 ICPU(0x45, core_params),
11631028 ICPU(0x46, core_params),
11641029 ICPU(0x47, core_params),
1165− ICPU(0x4c, byt_params),
1030+ ICPU(0x4c, airmont_params),
11661031 ICPU(0x4e, core_params),
11671032 ICPU(0x4f, core_params),
11681033 ICPU(0x5e, core_params),
@@ -1229,12 +1094,6 @@ static unsigned int intel_pstate_get(unsigned int cpu_num) · 60 unmodified lines
12291094
12301095 static int intel_pstate_set_policy(struct cpufreq_policy *policy)
12311096 {
1232−#if IS_ENABLED(CONFIG_ACPI)
1233− struct cpudata *cpu;
1234− int i;
1235−#endif
1236− pr_debug("intel_pstate: %s max %u policy->max %u\n", __func__,
1237− policy->cpuinfo.max_freq, policy->max);
12381097 if (!policy->cpuinfo.max_freq)
12391098 return -ENODEV;
12401099
@@ -1242,6 +1101,8 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) · 1 unmodified line
12421101 policy->max >= policy->cpuinfo.max_freq) {
12431102 pr_debug("intel_pstate: set performance\n");
12441103 limits = &performance_limits;
1104+ if (hwp_active)
1105+ intel_pstate_hwp_set();
12451106 return 0;
12461107 }
12471108
@@ -1249,7 +1110,8 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) · 1 unmodified line
12491110 limits = &powersave_limits;
12501111 limits->min_policy_pct = (policy->min * 100) / policy->cpuinfo.max_freq;
12511112 limits->min_policy_pct = clamp_t(int, limits->min_policy_pct, 0 , 100);
1252− limits->max_policy_pct = (policy->max * 100) / policy->cpuinfo.max_freq;
1113+ limits->max_policy_pct = DIV_ROUND_UP(policy->max * 100,
1114+ policy->cpuinfo.max_freq);
12531115 limits->max_policy_pct = clamp_t(int, limits->max_policy_pct, 0 , 100);
12541116
12551117 /* Normalize user input to [min_policy_pct, max_policy_pct] */
@@ -1261,6 +1123,7 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) · 5 unmodified lines
12611123 limits->max_sysfs_pct);
12621124 limits->max_perf_pct = max(limits->min_policy_pct,
12631125 limits->max_perf_pct);
1126+ limits->max_perf = round_up(limits->max_perf, 8);
12641127
12651128 /* Make sure min_perf_pct <= max_perf_pct */
12661129 limits->min_perf_pct = min(limits->max_perf_pct, limits->min_perf_pct);
@@ -1270,23 +1133,6 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) · 3 unmodified lines
12701133 limits->max_perf = div_fp(int_tofp(limits->max_perf_pct),
12711134 int_tofp(100));
12721135
1273−#if IS_ENABLED(CONFIG_ACPI)
1274− cpu = all_cpu_data[policy->cpu];
1275− for (i = 0; i < cpu->acpi_perf_data.state_count; i++) {
1276− int control;
1277−
1278− control = convert_to_native_pstate_format(cpu, i);
1279− if (control * cpu->pstate.scaling == policy->max)
1280− limits->max_perf_ctl = control;
1281− if (control * cpu->pstate.scaling == policy->min)
1282− limits->min_perf_ctl = control;
1283− }
1284−
1285− pr_debug("intel_pstate: max %u policy_max %u perf_ctl [0x%x-0x%x]\n",
1286− policy->cpuinfo.max_freq, policy->max, limits->min_perf_ctl,
1287− limits->max_perf_ctl);
1288−#endif
1289−
12901136 if (hwp_active)
12911137 intel_pstate_hwp_set();
12921138
@@ -1341,30 +1187,18 @@ static int intel_pstate_cpu_init(struct cpufreq_policy *policy) · 48 unmodified lines
13411187 policy->cpuinfo.min_freq = cpu->pstate.min_pstate * cpu->pstate.scaling;
13421188 policy->cpuinfo.max_freq =
13431189 cpu->pstate.turbo_pstate * cpu->pstate.scaling;
1344− if (!no_acpi_perf)
1345− intel_pstate_init_perf_limits(policy);
1346− /*
1347− * If there is no acpi perf data or error, we ignore and use Intel P
1348− * state calculated limits, So this is not fatal error.
1349− */
13501190 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
13511191 cpumask_set_cpu(policy->cpu, policy->cpus);
13521192
13531193 return 0;
13541194 }
13551195
1356−static int intel_pstate_cpu_exit(struct cpufreq_policy *policy)
1357−{
1358− return intel_pstate_exit_perf_limits(policy);
1359−}
1360−
13611196 static struct cpufreq_driver intel_pstate_driver = {
13621197 .flags = CPUFREQ_CONST_LOOPS,
13631198 .verify = intel_pstate_verify_policy,
13641199 .setpolicy = intel_pstate_set_policy,
13651200 .get = intel_pstate_get,
13661201 .init = intel_pstate_cpu_init,
1367− .exit = intel_pstate_cpu_exit,
13681202 .stop_cpu = intel_pstate_stop_cpu,
13691203 .name = "intel_pstate",
13701204 };
@@ -1406,6 +1240,7 @@ static void copy_cpu_funcs(struct pstate_funcs *funcs) · 35 unmodified lines
14061240 }
14071241
14081242 #if IS_ENABLED(CONFIG_ACPI)
1243+#include <acpi/processor.h>
14091244
14101245 static bool intel_pstate_no_acpi_pss(void)
14111246 {
@@ -1601,9 +1436,6 @@ static int __init intel_pstate_setup(char *str) · 189 unmodified lines
16011436 force_load = 1;
16021437 if (!strcmp(str, "hwp_only"))
16031438 hwp_only = 1;
1604− if (!strcmp(str, "no_acpi"))
1605− no_acpi_perf = 1;
1606−
16071439 return 0;
16081440 }
16091441 early_param("intel_pstate", intel_pstate_setup);
drivers/crypto/nx/nx-aes-ccm.c+1−1
@@ -409,7 +409,7 @@ static int ccm_nx_decrypt(struct aead_request *req, · 408 unmodified lines
409409 processed += to_process;
410410 } while (processed < nbytes);
411411
412− rc = memcmp(csbcpb->cpb.aes_ccm.out_pat_or_mac, priv->oauth_tag,
412+ rc = crypto_memneq(csbcpb->cpb.aes_ccm.out_pat_or_mac, priv->oauth_tag,
413413 authsize) ? -EBADMSG : 0;
414414 out:
415415 spin_unlock_irqrestore(&nx_ctx->lock, irq_flags);
drivers/crypto/nx/nx-aes-gcm.c+2−1
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121
2222 #include <crypto/internal/aead.h>
2323 #include <crypto/aes.h>
24+#include <crypto/algapi.h>
2425 #include <crypto/scatterwalk.h>
2526 #include <linux/module.h>
2627 #include <linux/types.h>
@@ -418,7 +419,7 @@ mac: · 391 unmodified lines
418419 itag, req->src, req->assoclen + nbytes,
419420 crypto_aead_authsize(crypto_aead_reqtfm(req)),
420421 SCATTERWALK_FROM_SG);
421− rc = memcmp(itag, otag,
422+ rc = crypto_memneq(itag, otag,
422423 crypto_aead_authsize(crypto_aead_reqtfm(req))) ?
423424 -EBADMSG : 0;
424425 }
drivers/crypto/talitos.c+1−1
@@ -977,7 +977,7 @@ static void ipsec_esp_decrypt_swauth_done(struct device *dev, · 976 unmodified lines
977977 } else
978978 oicv = (char *)&edesc->link_tbl[0];
979979
980− err = memcmp(oicv, icv, authsize) ? -EBADMSG : 0;
980+ err = crypto_memneq(oicv, icv, authsize) ? -EBADMSG : 0;
981981 }
982982
983983 kfree(edesc);
drivers/dma/at_hdmac.c+10−10
@@ -729,8 +729,8 @@ atc_prep_dma_interleaved(struct dma_chan *chan, · 728 unmodified lines
729729 return NULL;
730730
731731 dev_info(chan2dev(chan),
732− "%s: src=0x%08x, dest=0x%08x, numf=%d, frame_size=%d, flags=0x%lx\n",
733− __func__, xt->src_start, xt->dst_start, xt->numf,
732+ "%s: src=%pad, dest=%pad, numf=%d, frame_size=%d, flags=0x%lx\n",
733+ __func__, &xt->src_start, &xt->dst_start, xt->numf,
734734 xt->frame_size, flags);
735735
736736 /*
@@ -824,8 +824,8 @@ atc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src, · 87 unmodified lines
824824 u32 ctrla;
825825 u32 ctrlb;
826826
827− dev_vdbg(chan2dev(chan), "prep_dma_memcpy: d0x%x s0x%x l0x%zx f0x%lx\n",
828− dest, src, len, flags);
827+ dev_vdbg(chan2dev(chan), "prep_dma_memcpy: d%pad s%pad l0x%zx f0x%lx\n",
828+ &dest, &src, len, flags);
829829
830830 if (unlikely(!len)) {
831831 dev_dbg(chan2dev(chan), "prep_dma_memcpy: length is zero!\n");
@@ -938,8 +938,8 @@ atc_prep_dma_memset(struct dma_chan *chan, dma_addr_t dest, int value, · 106 unmodified lines
938938 void __iomem *vaddr;
939939 dma_addr_t paddr;
940940
941− dev_vdbg(chan2dev(chan), "%s: d0x%x v0x%x l0x%zx f0x%lx\n", __func__,
942− dest, value, len, flags);
941+ dev_vdbg(chan2dev(chan), "%s: d%pad v0x%x l0x%zx f0x%lx\n", __func__,
942+ &dest, value, len, flags);
943943
944944 if (unlikely(!len)) {
945945 dev_dbg(chan2dev(chan), "%s: length is zero!\n", __func__);
@@ -1022,8 +1022,8 @@ atc_prep_dma_memset_sg(struct dma_chan *chan, · 76 unmodified lines
10221022 dma_addr_t dest = sg_dma_address(sg);
10231023 size_t len = sg_dma_len(sg);
10241024
1025− dev_vdbg(chan2dev(chan), "%s: d0x%08x, l0x%zx\n",
1026− __func__, dest, len);
1025+ dev_vdbg(chan2dev(chan), "%s: d%pad, l0x%zx\n",
1026+ __func__, &dest, len);
10271027
10281028 if (!is_dma_fill_aligned(chan->device, dest, 0, len)) {
10291029 dev_err(chan2dev(chan), "%s: buffer is not aligned\n",
@@ -1439,9 +1439,9 @@ atc_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, · 409 unmodified lines
14391439 unsigned int periods = buf_len / period_len;
14401440 unsigned int i;
14411441
1442− dev_vdbg(chan2dev(chan), "prep_dma_cyclic: %s buf@0x%08x - %d (%d/%d)\n",
1442+ dev_vdbg(chan2dev(chan), "prep_dma_cyclic: %s buf@%pad - %d (%d/%d)\n",
14431443 direction == DMA_MEM_TO_DEV ? "TO DEVICE" : "FROM DEVICE",
1444− buf_addr,
1444+ &buf_addr,
14451445 periods, buf_len, period_len);
14461446
14471447 if (unlikely(!atslave || !buf_len || !period_len)) {
drivers/dma/at_hdmac_regs.h+3−3
@@ -385,9 +385,9 @@ static void vdbg_dump_regs(struct at_dma_chan *atchan) {} · 384 unmodified lines
385385 static void atc_dump_lli(struct at_dma_chan *atchan, struct at_lli *lli)
386386 {
387387 dev_crit(chan2dev(&atchan->chan_common),
388− " desc: s0x%x d0x%x ctrl0x%x:0x%x l0x%x\n",
389− lli->saddr, lli->daddr,
390− lli->ctrla, lli->ctrlb, lli->dscr);
388+ " desc: s%pad d%pad ctrl0x%x:0x%x l0x%pad\n",
389+ &lli->saddr, &lli->daddr,
390+ lli->ctrla, lli->ctrlb, &lli->dscr);
391391 }
392392
393393
drivers/dma/at_xdmac.c+10−10
@@ -920,8 +920,8 @@ at_xdmac_interleaved_queue_desc(struct dma_chan *chan, · 919 unmodified lines
920920 desc->lld.mbr_cfg = chan_cc;
921921
922922 dev_dbg(chan2dev(chan),
923− "%s: lld: mbr_sa=0x%08x, mbr_da=0x%08x, mbr_ubc=0x%08x, mbr_cfg=0x%08x\n",
924− __func__, desc->lld.mbr_sa, desc->lld.mbr_da,
923+ "%s: lld: mbr_sa=%pad, mbr_da=%pad, mbr_ubc=0x%08x, mbr_cfg=0x%08x\n",
924+ __func__, &desc->lld.mbr_sa, &desc->lld.mbr_da,
925925 desc->lld.mbr_ubc, desc->lld.mbr_cfg);
926926
927927 /* Chain lld. */
@@ -953,8 +953,8 @@ at_xdmac_prep_interleaved(struct dma_chan *chan, · 25 unmodified lines
953953 if ((xt->numf > 1) && (xt->frame_size > 1))
954954 return NULL;
955955
956− dev_dbg(chan2dev(chan), "%s: src=0x%08x, dest=0x%08x, numf=%d, frame_size=%d, flags=0x%lx\n",
957− __func__, xt->src_start, xt->dst_start, xt->numf,
956+ dev_dbg(chan2dev(chan), "%s: src=%pad, dest=%pad, numf=%d, frame_size=%d, flags=0x%lx\n",
957+ __func__, &xt->src_start, &xt->dst_start, xt->numf,
958958 xt->frame_size, flags);
959959
960960 src_addr = xt->src_start;
@@ -1179,8 +1179,8 @@ static struct at_xdmac_desc *at_xdmac_memset_create_desc(struct dma_chan *chan, · 218 unmodified lines
11791179 desc->lld.mbr_cfg = chan_cc;
11801180
11811181 dev_dbg(chan2dev(chan),
1182− "%s: lld: mbr_da=0x%08x, mbr_ds=0x%08x, mbr_ubc=0x%08x, mbr_cfg=0x%08x\n",
1183− __func__, desc->lld.mbr_da, desc->lld.mbr_ds, desc->lld.mbr_ubc,
1182+ "%s: lld: mbr_da=%pad, mbr_ds=%pad, mbr_ubc=0x%08x, mbr_cfg=0x%08x\n",
1183+ __func__, &desc->lld.mbr_da, &desc->lld.mbr_ds, desc->lld.mbr_ubc,
11841184 desc->lld.mbr_cfg);
11851185
11861186 return desc;
@@ -1193,8 +1193,8 @@ at_xdmac_prep_dma_memset(struct dma_chan *chan, dma_addr_t dest, int value, · 6 unmodified lines
11931193 struct at_xdmac_chan *atchan = to_at_xdmac_chan(chan);
11941194 struct at_xdmac_desc *desc;
11951195
1196− dev_dbg(chan2dev(chan), "%s: dest=0x%08x, len=%d, pattern=0x%x, flags=0x%lx\n",
1197− __func__, dest, len, value, flags);
1196+ dev_dbg(chan2dev(chan), "%s: dest=%pad, len=%d, pattern=0x%x, flags=0x%lx\n",
1197+ __func__, &dest, len, value, flags);
11981198
11991199 if (unlikely(!len))
12001200 return NULL;
@@ -1229,8 +1229,8 @@ at_xdmac_prep_dma_memset_sg(struct dma_chan *chan, struct scatterlist *sgl, · 28 unmodified lines
12291229
12301230 /* Prepare descriptors. */
12311231 for_each_sg(sgl, sg, sg_len, i) {
1232− dev_dbg(chan2dev(chan), "%s: dest=0x%08x, len=%d, pattern=0x%x, flags=0x%lx\n",
1233− __func__, sg_dma_address(sg), sg_dma_len(sg),
1232+ dev_dbg(chan2dev(chan), "%s: dest=%pad, len=%d, pattern=0x%x, flags=0x%lx\n",
1233+ __func__, &sg_dma_address(sg), sg_dma_len(sg),
12341234 value, flags);
12351235 desc = at_xdmac_memset_create_desc(chan, atchan,
12361236 sg_dma_address(sg),
drivers/dma/edma.c+2−2
@@ -107,7 +107,7 @@ · 106 unmodified lines
107107
108108 /* CCCFG register */
109109 #define GET_NUM_DMACH(x) (x & 0x7) /* bits 0-2 */
110−#define GET_NUM_QDMACH(x) (x & 0x70 >> 4) /* bits 4-6 */
110+#define GET_NUM_QDMACH(x) ((x & 0x70) >> 4) /* bits 4-6 */
111111 #define GET_NUM_PAENTRY(x) ((x & 0x7000) >> 12) /* bits 12-14 */
112112 #define GET_NUM_EVQUE(x) ((x & 0x70000) >> 16) /* bits 16-18 */
113113 #define GET_NUM_REGN(x) ((x & 0x300000) >> 20) /* bits 20-21 */
@@ -1565,7 +1565,7 @@ static void edma_tc_set_pm_state(struct edma_tc *tc, bool enable) · 1451 unmodified lines
15651565 struct platform_device *tc_pdev;
15661566 int ret;
15671567
1568− if (!tc)
1568+ if (!IS_ENABLED(CONFIG_OF) || !tc)
15691569 return;
15701570
15711571 tc_pdev = of_find_device_by_node(tc->node);
drivers/dma/imx-sdma.c+1−1
@@ -1462,7 +1462,7 @@ err_firmware: · 1461 unmodified lines
14621462
14631463 #define EVENT_REMAP_CELLS 3
14641464
1465−static int __init sdma_event_remap(struct sdma_engine *sdma)
1465+static int sdma_event_remap(struct sdma_engine *sdma)
14661466 {
14671467 struct device_node *np = sdma->dev->of_node;
14681468 struct device_node *gpr_np = of_parse_phandle(np, "gpr", 0);
drivers/dma/sh/usb-dmac.c+8−3
@@ -679,8 +679,11 @@ static int usb_dmac_runtime_suspend(struct device *dev) · 678 unmodified lines
679679 struct usb_dmac *dmac = dev_get_drvdata(dev);
680680 int i;
681681
682− for (i = 0; i < dmac->n_channels; ++i)
682+ for (i = 0; i < dmac->n_channels; ++i) {
683+ if (!dmac->channels[i].iomem)
684+ break;
683685 usb_dmac_chan_halt(&dmac->channels[i]);
686+ }
684687
685688 return 0;
686689 }
@@ -799,11 +802,10 @@ static int usb_dmac_probe(struct platform_device *pdev) · 112 unmodified lines
799802 ret = pm_runtime_get_sync(&pdev->dev);
800803 if (ret < 0) {
801804 dev_err(&pdev->dev, "runtime PM get sync failed (%d)\n", ret);
802− return ret;
805+ goto error_pm;
803806 }
804807
805808 ret = usb_dmac_init(dmac);
806− pm_runtime_put(&pdev->dev);
807809
808810 if (ret) {
809811 dev_err(&pdev->dev, "failed to reset device\n");
@@ -851,10 +853,13 @@ static int usb_dmac_probe(struct platform_device *pdev) · 41 unmodified lines
851853 if (ret < 0)
852854 goto error;
853855
856+ pm_runtime_put(&pdev->dev);
854857 return 0;
855858
856859 error:
857860 of_dma_controller_free(pdev->dev.of_node);
861+ pm_runtime_put(&pdev->dev);
862+error_pm:
858863 pm_runtime_disable(&pdev->dev);
859864 return ret;
860865 }
drivers/gpio/gpio-74xx-mmio.c+5−2
@@ -113,13 +113,16 @@ static int mmio_74xx_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) · 112 unmodified lines
113113
114114 static int mmio_74xx_gpio_probe(struct platform_device *pdev)
115115 {
116− const struct of_device_id *of_id =
117− of_match_device(mmio_74xx_gpio_ids, &pdev->dev);
116+ const struct of_device_id *of_id;
118117 struct mmio_74xx_gpio_priv *priv;
119118 struct resource *res;
120119 void __iomem *dat;
121120 int err;
122121
122+ of_id = of_match_device(mmio_74xx_gpio_ids, &pdev->dev);
123+ if (!of_id)
124+ return -ENODEV;
125+
123126 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
124127 if (!priv)
125128 return -ENOMEM;
drivers/gpio/gpio-omap.c+0−2
@@ -1122,8 +1122,6 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc) · 1121 unmodified lines
11221122 /* MPUIO is a bit different, reading IRQ status clears it */
11231123 if (bank->is_mpuio) {
11241124 irqc->irq_ack = dummy_irq_chip.irq_ack;
1125− irqc->irq_mask = irq_gc_mask_set_bit;
1126− irqc->irq_unmask = irq_gc_mask_clr_bit;
11271125 if (!bank->regs->wkup_en)
11281126 irqc->irq_set_wake = NULL;
11291127 }
drivers/gpio/gpio-palmas.c+2−0
@@ -167,6 +167,8 @@ static int palmas_gpio_probe(struct platform_device *pdev) · 166 unmodified lines
167167 const struct palmas_device_data *dev_data;
168168
169169 match = of_match_device(of_palmas_gpio_match, &pdev->dev);
170+ if (!match)
171+ return -ENODEV;
170172 dev_data = match->data;
171173 if (!dev_data)
172174 dev_data = &palmas_dev_data;
drivers/gpio/gpio-syscon.c+5−1
@@ -187,11 +187,15 @@ MODULE_DEVICE_TABLE(of, syscon_gpio_ids); · 186 unmodified lines
187187 static int syscon_gpio_probe(struct platform_device *pdev)
188188 {
189189 struct device *dev = &pdev->dev;
190− const struct of_device_id *of_id = of_match_device(syscon_gpio_ids, dev);
190+ const struct of_device_id *of_id;
191191 struct syscon_gpio_priv *priv;
192192 struct device_node *np = dev->of_node;
193193 int ret;
194194
195+ of_id = of_match_device(syscon_gpio_ids, dev);
196+ if (!of_id)
197+ return -ENODEV;
198+
195199 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
196200 if (!priv)
197201 return -ENOMEM;
drivers/gpio/gpio-tegra.c+56−49
@@ -375,6 +375,60 @@ static int tegra_gpio_irq_set_wake(struct irq_data *d, unsigned int enable) · 374 unmodified lines
375375 }
376376 #endif
377377
378+#ifdef CONFIG_DEBUG_FS
379+
380+#include <linux/debugfs.h>
381+#include <linux/seq_file.h>
382+
383+static int dbg_gpio_show(struct seq_file *s, void *unused)
384+{
385+ int i;
386+ int j;
387+
388+ for (i = 0; i < tegra_gpio_bank_count; i++) {
389+ for (j = 0; j < 4; j++) {
390+ int gpio = tegra_gpio_compose(i, j, 0);
391+ seq_printf(s,
392+ "%d:%d %02x %02x %02x %02x %02x %02x %06x\n",
393+ i, j,
394+ tegra_gpio_readl(GPIO_CNF(gpio)),
395+ tegra_gpio_readl(GPIO_OE(gpio)),
396+ tegra_gpio_readl(GPIO_OUT(gpio)),
397+ tegra_gpio_readl(GPIO_IN(gpio)),
398+ tegra_gpio_readl(GPIO_INT_STA(gpio)),
399+ tegra_gpio_readl(GPIO_INT_ENB(gpio)),
400+ tegra_gpio_readl(GPIO_INT_LVL(gpio)));
401+ }
402+ }
403+ return 0;
404+}
405+
406+static int dbg_gpio_open(struct inode *inode, struct file *file)
407+{
408+ return single_open(file, dbg_gpio_show, &inode->i_private);
409+}
410+
411+static const struct file_operations debug_fops = {
412+ .open = dbg_gpio_open,
413+ .read = seq_read,
414+ .llseek = seq_lseek,
415+ .release = single_release,
416+};
417+
418+static void tegra_gpio_debuginit(void)
419+{
420+ (void) debugfs_create_file("tegra_gpio", S_IRUGO,
421+ NULL, NULL, &debug_fops);
422+}
423+
424+#else
425+
426+static inline void tegra_gpio_debuginit(void)
427+{
428+}
429+
430+#endif
431+
378432 static struct irq_chip tegra_gpio_irq_chip = {
379433 .name = "GPIO",
380434 .irq_ack = tegra_gpio_irq_ack,
@@ -519,6 +573,8 @@ static int tegra_gpio_probe(struct platform_device *pdev) · 138 unmodified lines
519573 spin_lock_init(&bank->lvl_lock[j]);
520574 }
521575
576+ tegra_gpio_debuginit();
577+
522578 return 0;
523579 }
524580
@@ -536,52 +592,3 @@ static int __init tegra_gpio_init(void) · 11 unmodified lines
536592 return platform_driver_register(&tegra_gpio_driver);
537593 }
538594 postcore_initcall(tegra_gpio_init);
539−
540−#ifdef CONFIG_DEBUG_FS
541−
542−#include <linux/debugfs.h>
543−#include <linux/seq_file.h>
544−
545−static int dbg_gpio_show(struct seq_file *s, void *unused)
546−{
547− int i;
548− int j;
549−
550− for (i = 0; i < tegra_gpio_bank_count; i++) {
551− for (j = 0; j < 4; j++) {
552− int gpio = tegra_gpio_compose(i, j, 0);
553− seq_printf(s,
554− "%d:%d %02x %02x %02x %02x %02x %02x %06x\n",
555− i, j,
556− tegra_gpio_readl(GPIO_CNF(gpio)),
557− tegra_gpio_readl(GPIO_OE(gpio)),
558− tegra_gpio_readl(GPIO_OUT(gpio)),
559− tegra_gpio_readl(GPIO_IN(gpio)),
560− tegra_gpio_readl(GPIO_INT_STA(gpio)),
561− tegra_gpio_readl(GPIO_INT_ENB(gpio)),
562− tegra_gpio_readl(GPIO_INT_LVL(gpio)));
563− }
564− }
565− return 0;
566−}
567−
568−static int dbg_gpio_open(struct inode *inode, struct file *file)
569−{
570− return single_open(file, dbg_gpio_show, &inode->i_private);
571−}
572−
573−static const struct file_operations debug_fops = {
574− .open = dbg_gpio_open,
575− .read = seq_read,
576− .llseek = seq_lseek,
577− .release = single_release,
578−};
579−
580−static int __init tegra_gpio_debuginit(void)
581−{
582− (void) debugfs_create_file("tegra_gpio", S_IRUGO,
583− NULL, NULL, &debug_fops);
584− return 0;
585−}
586−late_initcall(tegra_gpio_debuginit);
587−#endif
drivers/gpio/gpiolib.c+1−1
@@ -233,7 +233,7 @@ static struct gpio_desc *gpio_name_to_desc(const char * const name) · 232 unmodified lines
233233 for (i = 0; i != chip->ngpio; ++i) {
234234 struct gpio_desc *gpio = &chip->desc[i];
235235
236− if (!gpio->name)
236+ if (!gpio->name || !name)
237237 continue;
238238
239239 if (!strcmp(gpio->name, name)) {
drivers/gpu/drm/amd/amdgpu/amdgpu.h+62−64
@@ -389,7 +389,6 @@ struct amdgpu_clock { · 388 unmodified lines
389389 * Fences.
390390 */
391391 struct amdgpu_fence_driver {
392− struct amdgpu_ring *ring;
393392 uint64_t gpu_addr;
394393 volatile uint32_t *cpu_addr;
395394 /* sync_seq is protected by ring emission lock */
@@ -398,7 +397,7 @@ struct amdgpu_fence_driver { · 2 unmodified lines
398397 bool initialized;
399398 struct amdgpu_irq_src *irq_src;
400399 unsigned irq_type;
401− struct delayed_work lockup_work;
400+ struct timer_list fallback_timer;
402401 wait_queue_head_t fence_queue;
403402 };
404403
@@ -497,6 +496,7 @@ struct amdgpu_bo_va_mapping { · 92 unmodified lines
497496
498497 /* bo virtual addresses in a specific vm */
499498 struct amdgpu_bo_va {
499+ struct mutex mutex;
500500 /* protected by bo being reserved */
501501 struct list_head bo_list;
502502 struct fence *last_pt_update;
@@ -539,6 +539,7 @@ struct amdgpu_bo { · 36 unmodified lines
539539 /* Constant after initialization */
540540 struct amdgpu_device *adev;
541541 struct drm_gem_object gem_base;
542+ struct amdgpu_bo *parent;
542543
543544 struct ttm_bo_kmap_obj dma_buf_vmap;
544545 pid_t pid;
@@ -917,8 +918,8 @@ struct amdgpu_ring { · 372 unmodified lines
917918 #define AMDGPU_VM_FAULT_STOP_ALWAYS 2
918919
919920 struct amdgpu_vm_pt {
920− struct amdgpu_bo *bo;
921− uint64_t addr;
921+ struct amdgpu_bo *bo;
922+ uint64_t addr;
922923 };
923924
924925 struct amdgpu_vm_id {
@@ -926,13 +927,9 @@ struct amdgpu_vm_id { · 1 unmodified line
926927 uint64_t pd_gpu_addr;
927928 /* last flushed PD/PT update */
928929 struct fence *flushed_updates;
929− /* last use of vmid */
930− struct fence *last_id_use;
931930 };
932931
933932 struct amdgpu_vm {
934− struct mutex mutex;
935−
936933 struct rb_root va;
937934
938935 /* protecting invalidated */
@@ -957,24 +954,72 @@ struct amdgpu_vm { · 18 unmodified lines
957954
958955 /* for id and flush management per ring */
959956 struct amdgpu_vm_id ids[AMDGPU_MAX_RINGS];
957+ /* for interval tree */
958+ spinlock_t it_lock;
959+ /* protecting freed */
960+ spinlock_t freed_lock;
960961 };
961962
962963 struct amdgpu_vm_manager {
963− struct fence *active[AMDGPU_NUM_VM];
964− uint32_t max_pfn;
964+ struct {
965+ struct fence *active;
966+ atomic_long_t owner;
967+ } ids[AMDGPU_NUM_VM];
968+
969+ uint32_t max_pfn;
965970 /* number of VMIDs */
966− unsigned nvm;
971+ unsigned nvm;
967972 /* vram base address for page table entry */
968− u64 vram_base_offset;
973+ u64 vram_base_offset;
969974 /* is vm enabled? */
970− bool enabled;
971− /* for hw to save the PD addr on suspend/resume */
972− uint32_t saved_table_addr[AMDGPU_NUM_VM];
975+ bool enabled;
973976 /* vm pte handling */
974977 const struct amdgpu_vm_pte_funcs *vm_pte_funcs;
975978 struct amdgpu_ring *vm_pte_funcs_ring;
976979 };
977980
981+void amdgpu_vm_manager_fini(struct amdgpu_device *adev);
982+int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm);
983+void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm);
984+struct amdgpu_bo_list_entry *amdgpu_vm_get_bos(struct amdgpu_device *adev,
985+ struct amdgpu_vm *vm,
986+ struct list_head *head);
987+int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
988+ struct amdgpu_sync *sync);
989+void amdgpu_vm_flush(struct amdgpu_ring *ring,
990+ struct amdgpu_vm *vm,
991+ struct fence *updates);
992+void amdgpu_vm_fence(struct amdgpu_device *adev,
993+ struct amdgpu_vm *vm,
994+ struct fence *fence);
995+uint64_t amdgpu_vm_map_gart(struct amdgpu_device *adev, uint64_t addr);
996+int amdgpu_vm_update_page_directory(struct amdgpu_device *adev,
997+ struct amdgpu_vm *vm);
998+int amdgpu_vm_clear_freed(struct amdgpu_device *adev,
999+ struct amdgpu_vm *vm);
1000+int amdgpu_vm_clear_invalids(struct amdgpu_device *adev, struct amdgpu_vm *vm,
1001+ struct amdgpu_sync *sync);
1002+int amdgpu_vm_bo_update(struct amdgpu_device *adev,
1003+ struct amdgpu_bo_va *bo_va,
1004+ struct ttm_mem_reg *mem);
1005+void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev,
1006+ struct amdgpu_bo *bo);
1007+struct amdgpu_bo_va *amdgpu_vm_bo_find(struct amdgpu_vm *vm,
1008+ struct amdgpu_bo *bo);
1009+struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev,
1010+ struct amdgpu_vm *vm,
1011+ struct amdgpu_bo *bo);
1012+int amdgpu_vm_bo_map(struct amdgpu_device *adev,
1013+ struct amdgpu_bo_va *bo_va,
1014+ uint64_t addr, uint64_t offset,
1015+ uint64_t size, uint32_t flags);
1016+int amdgpu_vm_bo_unmap(struct amdgpu_device *adev,
1017+ struct amdgpu_bo_va *bo_va,
1018+ uint64_t addr);
1019+void amdgpu_vm_bo_rmv(struct amdgpu_device *adev,
1020+ struct amdgpu_bo_va *bo_va);
1021+int amdgpu_vm_free_job(struct amdgpu_job *job);
1022+
9781023 /*
9791024 * context related structures
9801025 */
@@ -1211,6 +1256,7 @@ struct amdgpu_cs_parser { · 230 unmodified lines
12111256 /* relocations */
12121257 struct amdgpu_bo_list_entry *vm_bos;
12131258 struct list_head validated;
1259+ struct fence *fence;
12141260
12151261 struct amdgpu_ib *ibs;
12161262 uint32_t num_ibs;
@@ -1226,7 +1272,7 @@ struct amdgpu_job { · 9 unmodified lines
12261272 struct amdgpu_device *adev;
12271273 struct amdgpu_ib *ibs;
12281274 uint32_t num_ibs;
1229− struct mutex job_lock;
1275+ void *owner;
12301276 struct amdgpu_user_fence uf;
12311277 int (*free_job)(struct amdgpu_job *job);
12321278 };
@@ -2257,11 +2303,6 @@ void amdgpu_pci_config_reset(struct amdgpu_device *adev); · 1024 unmodified lines
22572303 bool amdgpu_card_posted(struct amdgpu_device *adev);
22582304 void amdgpu_update_display_priority(struct amdgpu_device *adev);
22592305 bool amdgpu_boot_test_post_card(struct amdgpu_device *adev);
2260−struct amdgpu_cs_parser *amdgpu_cs_parser_create(struct amdgpu_device *adev,
2261− struct drm_file *filp,
2262− struct amdgpu_ctx *ctx,
2263− struct amdgpu_ib *ibs,
2264− uint32_t num_ibs);
22652306
22662307 int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data);
22672308 int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type,
@@ -2318,49 +2359,6 @@ int amdgpu_get_vblank_timestamp_kms(struct drm_device *dev, unsigned int pipe, · 50 unmodified lines
23182359 long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd,
23192360 unsigned long arg);
23202361
2321−/*
2322− * vm
2323− */
2324−int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm);
2325−void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm);
2326−struct amdgpu_bo_list_entry *amdgpu_vm_get_bos(struct amdgpu_device *adev,
2327− struct amdgpu_vm *vm,
2328− struct list_head *head);
2329−int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
2330− struct amdgpu_sync *sync);
2331−void amdgpu_vm_flush(struct amdgpu_ring *ring,
2332− struct amdgpu_vm *vm,
2333− struct fence *updates);
2334−void amdgpu_vm_fence(struct amdgpu_device *adev,
2335− struct amdgpu_vm *vm,
2336− struct amdgpu_fence *fence);
2337−uint64_t amdgpu_vm_map_gart(struct amdgpu_device *adev, uint64_t addr);
2338−int amdgpu_vm_update_page_directory(struct amdgpu_device *adev,
2339− struct amdgpu_vm *vm);
2340−int amdgpu_vm_clear_freed(struct amdgpu_device *adev,
2341− struct amdgpu_vm *vm);
2342−int amdgpu_vm_clear_invalids(struct amdgpu_device *adev,
2343− struct amdgpu_vm *vm, struct amdgpu_sync *sync);
2344−int amdgpu_vm_bo_update(struct amdgpu_device *adev,
2345− struct amdgpu_bo_va *bo_va,
2346− struct ttm_mem_reg *mem);
2347−void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev,
2348− struct amdgpu_bo *bo);
2349−struct amdgpu_bo_va *amdgpu_vm_bo_find(struct amdgpu_vm *vm,
2350− struct amdgpu_bo *bo);
2351−struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev,
2352− struct amdgpu_vm *vm,
2353− struct amdgpu_bo *bo);
2354−int amdgpu_vm_bo_map(struct amdgpu_device *adev,
2355− struct amdgpu_bo_va *bo_va,
2356− uint64_t addr, uint64_t offset,
2357− uint64_t size, uint32_t flags);
2358−int amdgpu_vm_bo_unmap(struct amdgpu_device *adev,
2359− struct amdgpu_bo_va *bo_va,
2360− uint64_t addr);
2361−void amdgpu_vm_bo_rmv(struct amdgpu_device *adev,
2362− struct amdgpu_bo_va *bo_va);
2363−int amdgpu_vm_free_job(struct amdgpu_job *job);
23642362 /*
23652363 * functions used by amdgpu_encoder.c
23662364 */
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c+75−110
@@ -127,30 +127,6 @@ int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type, · 126 unmodified lines
127127 return 0;
128128 }
129129
130−struct amdgpu_cs_parser *amdgpu_cs_parser_create(struct amdgpu_device *adev,
131− struct drm_file *filp,
132− struct amdgpu_ctx *ctx,
133− struct amdgpu_ib *ibs,
134− uint32_t num_ibs)
135−{
136− struct amdgpu_cs_parser *parser;
137− int i;
138−
139− parser = kzalloc(sizeof(struct amdgpu_cs_parser), GFP_KERNEL);
140− if (!parser)
141− return NULL;
142−
143− parser->adev = adev;
144− parser->filp = filp;
145− parser->ctx = ctx;
146− parser->ibs = ibs;
147− parser->num_ibs = num_ibs;
148− for (i = 0; i < num_ibs; i++)
149− ibs[i].ctx = ctx;
150−
151− return parser;
152−}
153−
154130 int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)
155131 {
156132 union drm_amdgpu_cs *cs = data;
@@ -246,6 +222,8 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data) · 89 unmodified lines
246222 }
247223
248224 p->uf.bo = gem_to_amdgpu_bo(gobj);
225+ amdgpu_bo_ref(p->uf.bo);
226+ drm_gem_object_unreference_unlocked(gobj);
249227 p->uf.offset = fence_data->offset;
250228 } else {
251229 ret = -EINVAL;
@@ -463,8 +441,18 @@ static int cmp_size_smaller_first(void *priv, struct list_head *a, · 211 unmodified lines
463441 return (int)la->robj->tbo.num_pages - (int)lb->robj->tbo.num_pages;
464442 }
465443
466−static void amdgpu_cs_parser_fini_early(struct amdgpu_cs_parser *parser, int error, bool backoff)
444+/**
445+ * cs_parser_fini() - clean parser states
446+ * @parser: parser structure holding parsing context.
447+ * @error: error number
448+ *
449+ * If error is set than unvalidate buffer, otherwise just free memory
450+ * used by parsing context.
451+ **/
452+static void amdgpu_cs_parser_fini(struct amdgpu_cs_parser *parser, int error, bool backoff)
467453 {
454+ unsigned i;
455+
468456 if (!error) {
469457 /* Sort the buffer list from the smallest to largest buffer,
470458 * which affects the order of buffers in the LRU list.
@@ -479,17 +467,14 @@ static void amdgpu_cs_parser_fini_early(struct amdgpu_cs_parser *parser, int err · 8 unmodified lines
479467 list_sort(NULL, &parser->validated, cmp_size_smaller_first);
480468
481469 ttm_eu_fence_buffer_objects(&parser->ticket,
482− &parser->validated,
483− &parser->ibs[parser->num_ibs-1].fence->base);
470+ &parser->validated,
471+ parser->fence);
484472 } else if (backoff) {
485473 ttm_eu_backoff_reservation(&parser->ticket,
486474 &parser->validated);
487475 }
488−}
476+ fence_put(parser->fence);
489477
490−static void amdgpu_cs_parser_fini_late(struct amdgpu_cs_parser *parser)
491−{
492− unsigned i;
493478 if (parser->ctx)
494479 amdgpu_ctx_put(parser->ctx);
495480 if (parser->bo_list)
@@ -499,31 +484,12 @@ static void amdgpu_cs_parser_fini_late(struct amdgpu_cs_parser *parser) · 3 unmodified lines
499484 for (i = 0; i < parser->nchunks; i++)
500485 drm_free_large(parser->chunks[i].kdata);
501486 kfree(parser->chunks);
502− if (!amdgpu_enable_scheduler)
503− {
504− if (parser->ibs)
505− for (i = 0; i < parser->num_ibs; i++)
506− amdgpu_ib_free(parser->adev, &parser->ibs[i]);
507− kfree(parser->ibs);
508− if (parser->uf.bo)
509− drm_gem_object_unreference_unlocked(&parser->uf.bo->gem_base);
510− }
511−
512− kfree(parser);
513−}
514−
515−/**
516− * cs_parser_fini() - clean parser states
517− * @parser: parser structure holding parsing context.
518− * @error: error number
519− *
520− * If error is set than unvalidate buffer, otherwise just free memory
521− * used by parsing context.
522− **/
523−static void amdgpu_cs_parser_fini(struct amdgpu_cs_parser *parser, int error, bool backoff)
524−{
525− amdgpu_cs_parser_fini_early(parser, error, backoff);
526− amdgpu_cs_parser_fini_late(parser);
487+ if (parser->ibs)
488+ for (i = 0; i < parser->num_ibs; i++)
489+ amdgpu_ib_free(parser->adev, &parser->ibs[i]);
490+ kfree(parser->ibs);
491+ if (parser->uf.bo)
492+ amdgpu_bo_unref(&parser->uf.bo);
527493 }
528494
529495 static int amdgpu_bo_vm_update_pte(struct amdgpu_cs_parser *p,
@@ -610,15 +576,9 @@ static int amdgpu_cs_ib_vm_chunk(struct amdgpu_device *adev, · 80 unmodified lines
610576 }
611577
612578 r = amdgpu_bo_vm_update_pte(parser, vm);
613− if (r) {
614− goto out;
615− }
616− amdgpu_cs_sync_rings(parser);
617− if (!amdgpu_enable_scheduler)
618− r = amdgpu_ib_schedule(adev, parser->num_ibs, parser->ibs,
619− parser->filp);
579+ if (!r)
580+ amdgpu_cs_sync_rings(parser);
620581
621−out:
622582 return r;
623583 }
624584
@@ -818,7 +778,7 @@ static int amdgpu_cs_free_job(struct amdgpu_job *job) · 193 unmodified lines
818778 amdgpu_ib_free(job->adev, &job->ibs[i]);
819779 kfree(job->ibs);
820780 if (job->uf.bo)
821− drm_gem_object_unreference_unlocked(&job->uf.bo->gem_base);
781+ amdgpu_bo_unref(&job->uf.bo);
822782 return 0;
823783 }
824784
@@ -826,38 +786,35 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 1 unmodified line
826786 {
827787 struct amdgpu_device *adev = dev->dev_private;
828788 union drm_amdgpu_cs *cs = data;
829− struct amdgpu_fpriv *fpriv = filp->driver_priv;
830− struct amdgpu_vm *vm = &fpriv->vm;
831− struct amdgpu_cs_parser *parser;
789+ struct amdgpu_cs_parser parser = {};
832790 bool reserved_buffers = false;
833791 int i, r;
834792
835793 if (!adev->accel_working)
836794 return -EBUSY;
837795
838− parser = amdgpu_cs_parser_create(adev, filp, NULL, NULL, 0);
839− if (!parser)
840− return -ENOMEM;
841− r = amdgpu_cs_parser_init(parser, data);
796+ parser.adev = adev;
797+ parser.filp = filp;
798+
799+ r = amdgpu_cs_parser_init(&parser, data);
842800 if (r) {
843801 DRM_ERROR("Failed to initialize parser !\n");
844− amdgpu_cs_parser_fini(parser, r, false);
802+ amdgpu_cs_parser_fini(&parser, r, false);
845803 r = amdgpu_cs_handle_lockup(adev, r);
846804 return r;
847805 }
848− mutex_lock(&vm->mutex);
849− r = amdgpu_cs_parser_relocs(parser);
806+ r = amdgpu_cs_parser_relocs(&parser);
850807 if (r == -ENOMEM)
851808 DRM_ERROR("Not enough memory for command submission!\n");
852809 else if (r && r != -ERESTARTSYS)
853810 DRM_ERROR("Failed to process the buffer list %d!\n", r);
854811 else if (!r) {
855812 reserved_buffers = true;
856− r = amdgpu_cs_ib_fill(adev, parser);
813+ r = amdgpu_cs_ib_fill(adev, &parser);
857814 }
858815
859816 if (!r) {
860− r = amdgpu_cs_dependencies(adev, parser);
817+ r = amdgpu_cs_dependencies(adev, &parser);
861818 if (r)
862819 DRM_ERROR("Failed in the dependencies handling %d!\n", r);
863820 }
@@ -865,63 +822,71 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 1 unmodified line
865822 if (r)
866823 goto out;
867824
868− for (i = 0; i < parser->num_ibs; i++)
869− trace_amdgpu_cs(parser, i);
825+ for (i = 0; i < parser.num_ibs; i++)
826+ trace_amdgpu_cs(&parser, i);
870827
871− r = amdgpu_cs_ib_vm_chunk(adev, parser);
828+ r = amdgpu_cs_ib_vm_chunk(adev, &parser);
872829 if (r)
873830 goto out;
874831
875− if (amdgpu_enable_scheduler && parser->num_ibs) {
832+ if (amdgpu_enable_scheduler && parser.num_ibs) {
833+ struct amdgpu_ring * ring = parser.ibs->ring;
834+ struct amd_sched_fence *fence;
876835 struct amdgpu_job *job;
877− struct amdgpu_ring * ring = parser->ibs->ring;
836+
878837 job = kzalloc(sizeof(struct amdgpu_job), GFP_KERNEL);
879838 if (!job) {
880839 r = -ENOMEM;
881840 goto out;
882841 }
842+
883843 job->base.sched = &ring->sched;
884− job->base.s_entity = &parser->ctx->rings[ring->idx].entity;
885− job->adev = parser->adev;
886− job->ibs = parser->ibs;
887− job->num_ibs = parser->num_ibs;
888− job->base.owner = parser->filp;
889− mutex_init(&job->job_lock);
844+ job->base.s_entity = &parser.ctx->rings[ring->idx].entity;
845+ job->adev = parser.adev;
846+ job->owner = parser.filp;
847+ job->free_job = amdgpu_cs_free_job;
848+
849+ job->ibs = parser.ibs;
850+ job->num_ibs = parser.num_ibs;
851+ parser.ibs = NULL;
852+ parser.num_ibs = 0;
853+
890854 if (job->ibs[job->num_ibs - 1].user) {
891− memcpy(&job->uf, &parser->uf,
892− sizeof(struct amdgpu_user_fence));
855+ job->uf = parser.uf;
893856 job->ibs[job->num_ibs - 1].user = &job->uf;
857+ parser.uf.bo = NULL;
894858 }
895859
896− job->free_job = amdgpu_cs_free_job;
897− mutex_lock(&job->job_lock);
898− r = amd_sched_entity_push_job(&job->base);
899− if (r) {
900− mutex_unlock(&job->job_lock);
860+ fence = amd_sched_fence_create(job->base.s_entity,
861+ parser.filp);
862+ if (!fence) {
863+ r = -ENOMEM;
901864 amdgpu_cs_free_job(job);
902865 kfree(job);
903866 goto out;
904867 }
905− cs->out.handle =
906− amdgpu_ctx_add_fence(parser->ctx, ring,
907− &job->base.s_fence->base);
908− parser->ibs[parser->num_ibs - 1].sequence = cs->out.handle;
868+ job->base.s_fence = fence;
869+ parser.fence = fence_get(&fence->base);
909870
910− list_sort(NULL, &parser->validated, cmp_size_smaller_first);
911− ttm_eu_fence_buffer_objects(&parser->ticket,
912− &parser->validated,
913− &job->base.s_fence->base);
871+ cs->out.handle = amdgpu_ctx_add_fence(parser.ctx, ring,
872+ &fence->base);
873+ job->ibs[job->num_ibs - 1].sequence = cs->out.handle;
914874
915− mutex_unlock(&job->job_lock);
916− amdgpu_cs_parser_fini_late(parser);
917− mutex_unlock(&vm->mutex);
918− return 0;
875+ trace_amdgpu_cs_ioctl(job);
876+ amd_sched_entity_push_job(&job->base);
877+
878+ } else {
879+ struct amdgpu_fence *fence;
880+
881+ r = amdgpu_ib_schedule(adev, parser.num_ibs, parser.ibs,
882+ parser.filp);
883+ fence = parser.ibs[parser.num_ibs - 1].fence;
884+ parser.fence = fence_get(&fence->base);
885+ cs->out.handle = parser.ibs[parser.num_ibs - 1].sequence;
919886 }
920887
921− cs->out.handle = parser->ibs[parser->num_ibs - 1].sequence;
922888 out:
923− amdgpu_cs_parser_fini(parser, r, reserved_buffers);
924− mutex_unlock(&vm->mutex);
889+ amdgpu_cs_parser_fini(&parser, r, reserved_buffers);
925890 r = amdgpu_cs_handle_lockup(adev, r);
926891 return r;
927892 }
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c+79−29
@@ -73,6 +73,8 @@ static void amdgpu_flip_work_func(struct work_struct *__work) · 72 unmodified lines
7373 struct drm_crtc *crtc = &amdgpuCrtc->base;
7474 unsigned long flags;
7575 unsigned i;
76+ int vpos, hpos, stat, min_udelay;
77+ struct drm_vblank_crtc *vblank = &crtc->dev->vblank[work->crtc_id];
7678
7779 amdgpu_flip_wait_fence(adev, &work->excl);
7880 for (i = 0; i < work->shared_count; ++i)
@@ -81,6 +83,41 @@ static void amdgpu_flip_work_func(struct work_struct *__work) · 2 unmodified lines
8183 /* We borrow the event spin lock for protecting flip_status */
8284 spin_lock_irqsave(&crtc->dev->event_lock, flags);
8385
86+ /* If this happens to execute within the "virtually extended" vblank
87+ * interval before the start of the real vblank interval then it needs
88+ * to delay programming the mmio flip until the real vblank is entered.
89+ * This prevents completing a flip too early due to the way we fudge
90+ * our vblank counter and vblank timestamps in order to work around the
91+ * problem that the hw fires vblank interrupts before actual start of
92+ * vblank (when line buffer refilling is done for a frame). It
93+ * complements the fudging logic in amdgpu_get_crtc_scanoutpos() for
94+ * timestamping and amdgpu_get_vblank_counter_kms() for vblank counts.
95+ *
96+ * In practice this won't execute very often unless on very fast
97+ * machines because the time window for this to happen is very small.
98+ */
99+ for (;;) {
100+ /* GET_DISTANCE_TO_VBLANKSTART returns distance to real vblank
101+ * start in hpos, and to the "fudged earlier" vblank start in
102+ * vpos.
103+ */
104+ stat = amdgpu_get_crtc_scanoutpos(adev->ddev, work->crtc_id,
105+ GET_DISTANCE_TO_VBLANKSTART,
106+ &vpos, &hpos, NULL, NULL,
107+ &crtc->hwmode);
108+
109+ if ((stat & (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_ACCURATE)) !=
110+ (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_ACCURATE) ||
111+ !(vpos >= 0 && hpos <= 0))
112+ break;
113+
114+ /* Sleep at least until estimated real start of hw vblank */
115+ spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
116+ min_udelay = (-hpos + 1) * max(vblank->linedur_ns / 1000, 5);
117+ usleep_range(min_udelay, 2 * min_udelay);
118+ spin_lock_irqsave(&crtc->dev->event_lock, flags);
119+ };
120+
84121 /* do the flip (mmio) */
85122 adev->mode_info.funcs->page_flip(adev, work->crtc_id, work->base);
86123 /* set the flip status */
@@ -109,7 +146,7 @@ static void amdgpu_unpin_work_func(struct work_struct *__work) · 22 unmodified lines
109146 } else
110147 DRM_ERROR("failed to reserve buffer after flip\n");
111148
112− drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base);
149+ amdgpu_bo_unref(&work->old_rbo);
113150 kfree(work->shared);
114151 kfree(work);
115152 }
@@ -148,8 +185,8 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc, · 32 unmodified lines
148185 obj = old_amdgpu_fb->obj;
149186
150187 /* take a reference to the old object */
151− drm_gem_object_reference(obj);
152188 work->old_rbo = gem_to_amdgpu_bo(obj);
189+ amdgpu_bo_ref(work->old_rbo);
153190
154191 new_amdgpu_fb = to_amdgpu_framebuffer(fb);
155192 obj = new_amdgpu_fb->obj;
@@ -222,7 +259,7 @@ pflip_cleanup: · 66 unmodified lines
222259 amdgpu_bo_unreserve(new_rbo);
223260
224261 cleanup:
225− drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base);
262+ amdgpu_bo_unref(&work->old_rbo);
226263 fence_put(work->excl);
227264 for (i = 0; i < work->shared_count; ++i)
228265 fence_put(work->shared[i]);
@@ -712,6 +749,15 @@ bool amdgpu_crtc_scaling_mode_fixup(struct drm_crtc *crtc, · 483 unmodified lines
712749 * \param dev Device to query.
713750 * \param pipe Crtc to query.
714751 * \param flags Flags from caller (DRM_CALLED_FROM_VBLIRQ or 0).
752+ * For driver internal use only also supports these flags:
753+ *
754+ * USE_REAL_VBLANKSTART to use the real start of vblank instead
755+ * of a fudged earlier start of vblank.
756+ *
757+ * GET_DISTANCE_TO_VBLANKSTART to return distance to the
758+ * fudged earlier start of vblank in *vpos and the distance
759+ * to true start of vblank in *hpos.
760+ *
715761 * \param *vpos Location where vertical scanout position should be stored.
716762 * \param *hpos Location where horizontal scanout position should go.
717763 * \param *stime Target location for timestamp taken immediately before
@@ -776,10 +822,40 @@ int amdgpu_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, · 58 unmodified lines
776822 vbl_end = 0;
777823 }
778824
825+ /* Called from driver internal vblank counter query code? */
826+ if (flags & GET_DISTANCE_TO_VBLANKSTART) {
827+ /* Caller wants distance from real vbl_start in *hpos */
828+ *hpos = *vpos - vbl_start;
829+ }
830+
831+ /* Fudge vblank to start a few scanlines earlier to handle the
832+ * problem that vblank irqs fire a few scanlines before start
833+ * of vblank. Some driver internal callers need the true vblank
834+ * start to be used and signal this via the USE_REAL_VBLANKSTART flag.
835+ *
836+ * The cause of the "early" vblank irq is that the irq is triggered
837+ * by the line buffer logic when the line buffer read position enters
838+ * the vblank, whereas our crtc scanout position naturally lags the
839+ * line buffer read position.
840+ */
841+ if (!(flags & USE_REAL_VBLANKSTART))
842+ vbl_start -= adev->mode_info.crtcs[pipe]->lb_vblank_lead_lines;
843+
779844 /* Test scanout position against vblank region. */
780845 if ((*vpos < vbl_start) && (*vpos >= vbl_end))
781846 in_vbl = false;
782847
848+ /* In vblank? */
849+ if (in_vbl)
850+ ret |= DRM_SCANOUTPOS_IN_VBLANK;
851+
852+ /* Called from driver internal vblank counter query code? */
853+ if (flags & GET_DISTANCE_TO_VBLANKSTART) {
854+ /* Caller wants distance from fudged earlier vbl_start */
855+ *vpos -= vbl_start;
856+ return ret;
857+ }
858+
783859 /* Check if inside vblank area and apply corrective offsets:
784860 * vpos will then be >=0 in video scanout area, but negative
785861 * within vblank area, counting down the number of lines until
@@ -795,32 +871,6 @@ int amdgpu_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, · 9 unmodified lines
795871 /* Correct for shifted end of vbl at vbl_end. */
796872 *vpos = *vpos - vbl_end;
797873
798− /* In vblank? */
799− if (in_vbl)
800− ret |= DRM_SCANOUTPOS_IN_VBLANK;
801−
802− /* Is vpos outside nominal vblank area, but less than
803− * 1/100 of a frame height away from start of vblank?
804− * If so, assume this isn't a massively delayed vblank
805− * interrupt, but a vblank interrupt that fired a few
806− * microseconds before true start of vblank. Compensate
807− * by adding a full frame duration to the final timestamp.
808− * Happens, e.g., on ATI R500, R600.
809− *
810− * We only do this if DRM_CALLED_FROM_VBLIRQ.
811− */
812− if ((flags & DRM_CALLED_FROM_VBLIRQ) && !in_vbl) {
813− vbl_start = mode->crtc_vdisplay;
814− vtotal = mode->crtc_vtotal;
815−
816− if (vbl_start - *vpos < vtotal / 100) {
817− *vpos -= vtotal;
818−
819− /* Signal this correction as "applied". */
820− ret |= 0x8;
821− }
822− }
823−
824874 return ret;
825875 }
826876
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c+54−47
@@ -47,6 +47,9 @@ · 46 unmodified lines
4747 * that the the relevant GPU caches have been flushed.
4848 */
4949
50+static struct kmem_cache *amdgpu_fence_slab;
51+static atomic_t amdgpu_fence_slab_ref = ATOMIC_INIT(0);
52+
5053 /**
5154 * amdgpu_fence_write - write a fence value
5255 *
@@ -84,24 +87,6 @@ static u32 amdgpu_fence_read(struct amdgpu_ring *ring) · 31 unmodified lines
8487 return seq;
8588 }
8689
87−/**
88− * amdgpu_fence_schedule_check - schedule lockup check
89− *
90− * @ring: pointer to struct amdgpu_ring
91− *
92− * Queues a delayed work item to check for lockups.
93− */
94−static void amdgpu_fence_schedule_check(struct amdgpu_ring *ring)
95−{
96− /*
97− * Do not reset the timer here with mod_delayed_work,
98− * this can livelock in an interaction with TTM delayed destroy.
99− */
100− queue_delayed_work(system_power_efficient_wq,
101− &ring->fence_drv.lockup_work,
102− AMDGPU_FENCE_JIFFIES_TIMEOUT);
103−}
104−
10590 /**
10691 * amdgpu_fence_emit - emit a fence on the requested ring
10792 *
@@ -118,7 +103,7 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, void *owner, · 10 unmodified lines
118103 struct amdgpu_device *adev = ring->adev;
119104
120105 /* we are protected by the ring emission mutex */
121− *fence = kmalloc(sizeof(struct amdgpu_fence), GFP_KERNEL);
106+ *fence = kmem_cache_alloc(amdgpu_fence_slab, GFP_KERNEL);
122107 if ((*fence) == NULL) {
123108 return -ENOMEM;
124109 }
@@ -132,10 +117,22 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, void *owner, · 7 unmodified lines
132117 amdgpu_ring_emit_fence(ring, ring->fence_drv.gpu_addr,
133118 (*fence)->seq,
134119 AMDGPU_FENCE_FLAG_INT);
135− trace_amdgpu_fence_emit(ring->adev->ddev, ring->idx, (*fence)->seq);
136120 return 0;
137121 }
138122
123+/**
124+ * amdgpu_fence_schedule_fallback - schedule fallback check
125+ *
126+ * @ring: pointer to struct amdgpu_ring
127+ *
128+ * Start a timer as fallback to our interrupts.
129+ */
130+static void amdgpu_fence_schedule_fallback(struct amdgpu_ring *ring)
131+{
132+ mod_timer(&ring->fence_drv.fallback_timer,
133+ jiffies + AMDGPU_FENCE_JIFFIES_TIMEOUT);
134+}
135+
139136 /**
140137 * amdgpu_fence_activity - check for fence activity
141138 *
@@ -202,45 +199,38 @@ static bool amdgpu_fence_activity(struct amdgpu_ring *ring) · 60 unmodified lines
202199 } while (atomic64_xchg(&ring->fence_drv.last_seq, seq) > seq);
203200
204201 if (seq < last_emitted)
205− amdgpu_fence_schedule_check(ring);
202+ amdgpu_fence_schedule_fallback(ring);
206203
207204 return wake;
208205 }
209206
210207 /**
211− * amdgpu_fence_check_lockup - check for hardware lockup
208+ * amdgpu_fence_process - process a fence
212209 *
213− * @work: delayed work item
210+ * @adev: amdgpu_device pointer
211+ * @ring: ring index the fence is associated with
214212 *
215− * Checks for fence activity and if there is none probe
216− * the hardware if a lockup occured.
213+ * Checks the current fence value and wakes the fence queue
214+ * if the sequence number has increased (all asics).
217215 */
218−static void amdgpu_fence_check_lockup(struct work_struct *work)
216+void amdgpu_fence_process(struct amdgpu_ring *ring)
219217 {
220− struct amdgpu_fence_driver *fence_drv;
221− struct amdgpu_ring *ring;
222−
223− fence_drv = container_of(work, struct amdgpu_fence_driver,
224− lockup_work.work);
225− ring = fence_drv->ring;
226−
227218 if (amdgpu_fence_activity(ring))
228219 wake_up_all(&ring->fence_drv.fence_queue);
229220 }
230221
231222 /**
232− * amdgpu_fence_process - process a fence
223+ * amdgpu_fence_fallback - fallback for hardware interrupts
233224 *
234− * @adev: amdgpu_device pointer
235− * @ring: ring index the fence is associated with
225+ * @work: delayed work item
236226 *
237− * Checks the current fence value and wakes the fence queue
238− * if the sequence number has increased (all asics).
227+ * Checks for fence activity.
239228 */
240−void amdgpu_fence_process(struct amdgpu_ring *ring)
229+static void amdgpu_fence_fallback(unsigned long arg)
241230 {
242− if (amdgpu_fence_activity(ring))
243− wake_up_all(&ring->fence_drv.fence_queue);
231+ struct amdgpu_ring *ring = (void *)arg;
232+
233+ amdgpu_fence_process(ring);
244234 }
245235
246236 /**
@@ -290,7 +280,7 @@ static int amdgpu_fence_ring_wait_seq(struct amdgpu_ring *ring, uint64_t seq) · 43 unmodified lines
290280 if (atomic64_read(&ring->fence_drv.last_seq) >= seq)
291281 return 0;
292282
293− amdgpu_fence_schedule_check(ring);
283+ amdgpu_fence_schedule_fallback(ring);
294284 wait_event(ring->fence_drv.fence_queue, (
295285 (signaled = amdgpu_fence_seq_signaled(ring, seq))));
296286
@@ -491,9 +481,8 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring) · 194 unmodified lines
491481 atomic64_set(&ring->fence_drv.last_seq, 0);
492482 ring->fence_drv.initialized = false;
493483
494− INIT_DELAYED_WORK(&ring->fence_drv.lockup_work,
495− amdgpu_fence_check_lockup);
496− ring->fence_drv.ring = ring;
484+ setup_timer(&ring->fence_drv.fallback_timer, amdgpu_fence_fallback,
485+ (unsigned long)ring);
497486
498487 init_waitqueue_head(&ring->fence_drv.fence_queue);
499488
@@ -536,6 +525,13 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring) · 36 unmodified lines
536525 */
537526 int amdgpu_fence_driver_init(struct amdgpu_device *adev)
538527 {
528+ if (atomic_inc_return(&amdgpu_fence_slab_ref) == 1) {
529+ amdgpu_fence_slab = kmem_cache_create(
530+ "amdgpu_fence", sizeof(struct amdgpu_fence), 0,
531+ SLAB_HWCACHE_ALIGN, NULL);
532+ if (!amdgpu_fence_slab)
533+ return -ENOMEM;
534+ }
539535 if (amdgpu_debugfs_fence_init(adev))
540536 dev_err(adev->dev, "fence debugfs file creation failed\n");
541537
@@ -554,9 +550,12 @@ void amdgpu_fence_driver_fini(struct amdgpu_device *adev) · 12 unmodified lines
554550 {
555551 int i, r;
556552
553+ if (atomic_dec_and_test(&amdgpu_fence_slab_ref))
554+ kmem_cache_destroy(amdgpu_fence_slab);
557555 mutex_lock(&adev->ring_lock);
558556 for (i = 0; i < AMDGPU_MAX_RINGS; i++) {
559557 struct amdgpu_ring *ring = adev->rings[i];
558+
560559 if (!ring || !ring->fence_drv.initialized)
561560 continue;
562561 r = amdgpu_fence_wait_empty(ring);
@@ -568,6 +567,7 @@ void amdgpu_fence_driver_fini(struct amdgpu_device *adev) · 5 unmodified lines
568567 amdgpu_irq_put(adev, ring->fence_drv.irq_src,
569568 ring->fence_drv.irq_type);
570569 amd_sched_fini(&ring->sched);
570+ del_timer_sync(&ring->fence_drv.fallback_timer);
571571 ring->fence_drv.initialized = false;
572572 }
573573 mutex_unlock(&adev->ring_lock);
@@ -751,18 +751,25 @@ static bool amdgpu_fence_enable_signaling(struct fence *f) · 177 unmodified lines
751751 fence->fence_wake.func = amdgpu_fence_check_signaled;
752752 __add_wait_queue(&ring->fence_drv.fence_queue, &fence->fence_wake);
753753 fence_get(f);
754− amdgpu_fence_schedule_check(ring);
754+ if (!timer_pending(&ring->fence_drv.fallback_timer))
755+ amdgpu_fence_schedule_fallback(ring);
755756 FENCE_TRACE(&fence->base, "armed on ring %i!\n", ring->idx);
756757 return true;
757758 }
758759
760+static void amdgpu_fence_release(struct fence *f)
761+{
762+ struct amdgpu_fence *fence = to_amdgpu_fence(f);
763+ kmem_cache_free(amdgpu_fence_slab, fence);
764+}
765+
759766 const struct fence_ops amdgpu_fence_ops = {
760767 .get_driver_name = amdgpu_fence_get_driver_name,
761768 .get_timeline_name = amdgpu_fence_get_timeline_name,
762769 .enable_signaling = amdgpu_fence_enable_signaling,
763770 .signaled = amdgpu_fence_is_signaled,
764771 .wait = fence_default_wait,
765− .release = NULL,
772+ .release = amdgpu_fence_release,
766773 };
767774
768775 /*
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c+26−17
@@ -115,12 +115,9 @@ int amdgpu_gem_object_open(struct drm_gem_object *obj, struct drm_file *file_pri · 114 unmodified lines
115115 struct amdgpu_vm *vm = &fpriv->vm;
116116 struct amdgpu_bo_va *bo_va;
117117 int r;
118− mutex_lock(&vm->mutex);
119118 r = amdgpu_bo_reserve(rbo, false);
120− if (r) {
121− mutex_unlock(&vm->mutex);
119+ if (r)
122120 return r;
123− }
124121
125122 bo_va = amdgpu_vm_bo_find(vm, rbo);
126123 if (!bo_va) {
@@ -129,7 +126,6 @@ int amdgpu_gem_object_open(struct drm_gem_object *obj, struct drm_file *file_pri · 2 unmodified lines
129126 ++bo_va->ref_count;
130127 }
131128 amdgpu_bo_unreserve(rbo);
132− mutex_unlock(&vm->mutex);
133129 return 0;
134130 }
135131
@@ -142,10 +138,8 @@ void amdgpu_gem_object_close(struct drm_gem_object *obj, · 6 unmodified lines
142138 struct amdgpu_vm *vm = &fpriv->vm;
143139 struct amdgpu_bo_va *bo_va;
144140 int r;
145− mutex_lock(&vm->mutex);
146141 r = amdgpu_bo_reserve(rbo, true);
147142 if (r) {
148− mutex_unlock(&vm->mutex);
149143 dev_err(adev->dev, "leaking bo va because "
150144 "we fail to reserve bo (%d)\n", r);
151145 return;
@@ -157,7 +151,6 @@ void amdgpu_gem_object_close(struct drm_gem_object *obj, · 5 unmodified lines
157151 }
158152 }
159153 amdgpu_bo_unreserve(rbo);
160− mutex_unlock(&vm->mutex);
161154 }
162155
163156 static int amdgpu_gem_handle_lockup(struct amdgpu_device *adev, int r)
@@ -242,8 +235,9 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data, · 78 unmodified lines
242235 AMDGPU_GEM_USERPTR_REGISTER))
243236 return -EINVAL;
244237
245− if (!(args->flags & AMDGPU_GEM_USERPTR_ANONONLY) ||
246− !(args->flags & AMDGPU_GEM_USERPTR_REGISTER)) {
238+ if (!(args->flags & AMDGPU_GEM_USERPTR_READONLY) && (
239+ !(args->flags & AMDGPU_GEM_USERPTR_ANONONLY) ||
240+ !(args->flags & AMDGPU_GEM_USERPTR_REGISTER))) {
247241
248242 /* if we want to write to it we must require anonymous
249243 memory and install a MMU notifier */
@@ -483,6 +477,9 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev, · 233 unmodified lines
483477 if (domain == AMDGPU_GEM_DOMAIN_CPU)
484478 goto error_unreserve;
485479 }
480+ r = amdgpu_vm_update_page_directory(adev, bo_va->vm);
481+ if (r)
482+ goto error_unreserve;
486483
487484 r = amdgpu_vm_clear_freed(adev, bo_va->vm);
488485 if (r)
@@ -512,6 +509,9 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data, · 23 unmodified lines
512509 struct amdgpu_fpriv *fpriv = filp->driver_priv;
513510 struct amdgpu_bo *rbo;
514511 struct amdgpu_bo_va *bo_va;
512+ struct ttm_validate_buffer tv, tv_pd;
513+ struct ww_acquire_ctx ticket;
514+ struct list_head list, duplicates;
515515 uint32_t invalid_flags, va_flags = 0;
516516 int r = 0;
517517
@@ -547,19 +547,28 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data, · 29 unmodified lines
547547 gobj = drm_gem_object_lookup(dev, filp, args->handle);
548548 if (gobj == NULL)
549549 return -ENOENT;
550− mutex_lock(&fpriv->vm.mutex);
551550 rbo = gem_to_amdgpu_bo(gobj);
552− r = amdgpu_bo_reserve(rbo, false);
551+ INIT_LIST_HEAD(&list);
552+ INIT_LIST_HEAD(&duplicates);
553+ tv.bo = &rbo->tbo;
554+ tv.shared = true;
555+ list_add(&tv.head, &list);
556+
557+ if (args->operation == AMDGPU_VA_OP_MAP) {
558+ tv_pd.bo = &fpriv->vm.page_directory->tbo;
559+ tv_pd.shared = true;
560+ list_add(&tv_pd.head, &list);
561+ }
562+ r = ttm_eu_reserve_buffers(&ticket, &list, true, &duplicates);
553563 if (r) {
554− mutex_unlock(&fpriv->vm.mutex);
555564 drm_gem_object_unreference_unlocked(gobj);
556565 return r;
557566 }
558567
559568 bo_va = amdgpu_vm_bo_find(&fpriv->vm, rbo);
560569 if (!bo_va) {
561− amdgpu_bo_unreserve(rbo);
562− mutex_unlock(&fpriv->vm.mutex);
570+ ttm_eu_backoff_reservation(&ticket, &list);
571+ drm_gem_object_unreference_unlocked(gobj);
563572 return -ENOENT;
564573 }
565574
@@ -581,10 +590,10 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data, · 15 unmodified lines
581590 default:
582591 break;
583592 }
584−
593+ ttm_eu_backoff_reservation(&ticket, &list);
585594 if (!r && !(args->flags & AMDGPU_VM_DELAY_UPDATE))
586595 amdgpu_gem_va_update_vm(adev, bo_va, args->operation);
587− mutex_unlock(&fpriv->vm.mutex);
596+
588597 drm_gem_object_unreference_unlocked(gobj);
589598 return r;
590599 }
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c+2−2
@@ -62,7 +62,7 @@ int amdgpu_ib_get(struct amdgpu_ring *ring, struct amdgpu_vm *vm, · 61 unmodified lines
6262 int r;
6363
6464 if (size) {
65− r = amdgpu_sa_bo_new(adev, &adev->ring_tmp_bo,
65+ r = amdgpu_sa_bo_new(&adev->ring_tmp_bo,
6666 &ib->sa_bo, size, 256);
6767 if (r) {
6868 dev_err(adev->dev, "failed to get a new IB (%d)\n", r);
@@ -216,7 +216,7 @@ int amdgpu_ib_schedule(struct amdgpu_device *adev, unsigned num_ibs, · 147 unmodified lines
216216 }
217217
218218 if (ib->vm)
219− amdgpu_vm_fence(adev, ib->vm, ib->fence);
219+ amdgpu_vm_fence(adev, ib->vm, &ib->fence->base);
220220
221221 amdgpu_ring_unlock_commit(ring);
222222 return 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c+47−1
@@ -611,13 +611,59 @@ void amdgpu_driver_preclose_kms(struct drm_device *dev, · 610 unmodified lines
611611 u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
612612 {
613613 struct amdgpu_device *adev = dev->dev_private;
614+ int vpos, hpos, stat;
615+ u32 count;
614616
615617 if (pipe >= adev->mode_info.num_crtc) {
616618 DRM_ERROR("Invalid crtc %u\n", pipe);
617619 return -EINVAL;
618620 }
619621
620− return amdgpu_display_vblank_get_counter(adev, pipe);
622+ /* The hw increments its frame counter at start of vsync, not at start
623+ * of vblank, as is required by DRM core vblank counter handling.
624+ * Cook the hw count here to make it appear to the caller as if it
625+ * incremented at start of vblank. We measure distance to start of
626+ * vblank in vpos. vpos therefore will be >= 0 between start of vblank
627+ * and start of vsync, so vpos >= 0 means to bump the hw frame counter
628+ * result by 1 to give the proper appearance to caller.
629+ */
630+ if (adev->mode_info.crtcs[pipe]) {
631+ /* Repeat readout if needed to provide stable result if
632+ * we cross start of vsync during the queries.
633+ */
634+ do {
635+ count = amdgpu_display_vblank_get_counter(adev, pipe);
636+ /* Ask amdgpu_get_crtc_scanoutpos to return vpos as
637+ * distance to start of vblank, instead of regular
638+ * vertical scanout pos.
639+ */
640+ stat = amdgpu_get_crtc_scanoutpos(
641+ dev, pipe, GET_DISTANCE_TO_VBLANKSTART,
642+ &vpos, &hpos, NULL, NULL,
643+ &adev->mode_info.crtcs[pipe]->base.hwmode);
644+ } while (count != amdgpu_display_vblank_get_counter(adev, pipe));
645+
646+ if (((stat & (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_ACCURATE)) !=
647+ (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_ACCURATE))) {
648+ DRM_DEBUG_VBL("Query failed! stat %d\n", stat);
649+ } else {
650+ DRM_DEBUG_VBL("crtc %d: dist from vblank start %d\n",
651+ pipe, vpos);
652+
653+ /* Bump counter if we are at >= leading edge of vblank,
654+ * but before vsync where vpos would turn negative and
655+ * the hw counter really increments.
656+ */
657+ if (vpos >= 0)
658+ count++;
659+ }
660+ } else {
661+ /* Fallback to use value as is. */
662+ count = amdgpu_display_vblank_get_counter(adev, pipe);
663+ DRM_DEBUG_VBL("NULL mode info! Returned count may be wrong.\n");
664+ }
665+
666+ return count;
621667 }
622668
623669 /**
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h+5−0
@@ -407,6 +407,7 @@ struct amdgpu_crtc { · 406 unmodified lines
407407 u32 line_time;
408408 u32 wm_low;
409409 u32 wm_high;
410+ u32 lb_vblank_lead_lines;
410411 struct drm_display_mode hw_mode;
411412 };
412413
@@ -528,6 +529,10 @@ struct amdgpu_framebuffer { · 115 unmodified lines
528529 #define ENCODER_MODE_IS_DP(em) (((em) == ATOM_ENCODER_MODE_DP) || \
529530 ((em) == ATOM_ENCODER_MODE_DP_MST))
530531
532+/* Driver internal use only flags of amdgpu_get_crtc_scanoutpos() */
533+#define USE_REAL_VBLANKSTART (1 << 30)
534+#define GET_DISTANCE_TO_VBLANKSTART (1 << 31)
535+
531536 void amdgpu_link_encoder_connector(struct drm_device *dev);
532537
533538 struct drm_connector *
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c+1−0
@@ -100,6 +100,7 @@ static void amdgpu_ttm_bo_destroy(struct ttm_buffer_object *tbo) · 99 unmodified lines
100100 list_del_init(&bo->list);
101101 mutex_unlock(&bo->adev->gem.mutex);
102102 drm_gem_object_release(&bo->gem_base);
103+ amdgpu_bo_unref(&bo->parent);
103104 kfree(bo->metadata);
104105 kfree(bo);
105106 }
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h+3−4
@@ -189,10 +189,9 @@ int amdgpu_sa_bo_manager_start(struct amdgpu_device *adev, · 188 unmodified lines
189189 struct amdgpu_sa_manager *sa_manager);
190190 int amdgpu_sa_bo_manager_suspend(struct amdgpu_device *adev,
191191 struct amdgpu_sa_manager *sa_manager);
192−int amdgpu_sa_bo_new(struct amdgpu_device *adev,
193− struct amdgpu_sa_manager *sa_manager,
194− struct amdgpu_sa_bo **sa_bo,
195− unsigned size, unsigned align);
192+int amdgpu_sa_bo_new(struct amdgpu_sa_manager *sa_manager,
193+ struct amdgpu_sa_bo **sa_bo,
194+ unsigned size, unsigned align);
196195 void amdgpu_sa_bo_free(struct amdgpu_device *adev,
197196 struct amdgpu_sa_bo **sa_bo,
198197 struct fence *fence);
drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c+1−2
@@ -311,8 +311,7 @@ static bool amdgpu_sa_bo_next_hole(struct amdgpu_sa_manager *sa_manager, · 310 unmodified lines
311311 return false;
312312 }
313313
314−int amdgpu_sa_bo_new(struct amdgpu_device *adev,
315− struct amdgpu_sa_manager *sa_manager,
314+int amdgpu_sa_bo_new(struct amdgpu_sa_manager *sa_manager,
316315 struct amdgpu_sa_bo **sa_bo,
317316 unsigned size, unsigned align)
318317 {
drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c+12−18
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 #include <linux/sched.h>
2727 #include <drm/drmP.h>
2828 #include "amdgpu.h"
29+#include "amdgpu_trace.h"
2930
3031 static struct fence *amdgpu_sched_dependency(struct amd_sched_job *sched_job)
3132 {
@@ -44,11 +45,8 @@ static struct fence *amdgpu_sched_run_job(struct amd_sched_job *sched_job) · 12 unmodified lines
4445 return NULL;
4546 }
4647 job = to_amdgpu_job(sched_job);
47− mutex_lock(&job->job_lock);
48− r = amdgpu_ib_schedule(job->adev,
49− job->num_ibs,
50− job->ibs,
51− job->base.owner);
48+ trace_amdgpu_sched_run_job(job);
49+ r = amdgpu_ib_schedule(job->adev, job->num_ibs, job->ibs, job->owner);
5250 if (r) {
5351 DRM_ERROR("Error scheduling IBs (%d)\n", r);
5452 goto err;
@@ -61,8 +59,6 @@ err: · 6 unmodified lines
6159 if (job->free_job)
6260 job->free_job(job);
6361
64− mutex_unlock(&job->job_lock);
65− fence_put(&job->base.s_fence->base);
6662 kfree(job);
6763 return fence ? &fence->base : NULL;
6864 }
@@ -88,21 +84,19 @@ int amdgpu_sched_ib_submit_kernel_helper(struct amdgpu_device *adev, · 19 unmodified lines
8884 return -ENOMEM;
8985 job->base.sched = &ring->sched;
9086 job->base.s_entity = &adev->kernel_ctx.rings[ring->idx].entity;
87+ job->base.s_fence = amd_sched_fence_create(job->base.s_entity, owner);
88+ if (!job->base.s_fence) {
89+ kfree(job);
90+ return -ENOMEM;
91+ }
92+ *f = fence_get(&job->base.s_fence->base);
93+
9194 job->adev = adev;
9295 job->ibs = ibs;
9396 job->num_ibs = num_ibs;
94− job->base.owner = owner;
95− mutex_init(&job->job_lock);
97+ job->owner = owner;
9698 job->free_job = free_job;
97− mutex_lock(&job->job_lock);
98− r = amd_sched_entity_push_job(&job->base);
99− if (r) {
100− mutex_unlock(&job->job_lock);
101− kfree(job);
102− return r;
103− }
104− *f = fence_get(&job->base.s_fence->base);
105− mutex_unlock(&job->job_lock);
99+ amd_sched_entity_push_job(&job->base);
106100 } else {
107101 r = amdgpu_ib_schedule(adev, num_ibs, ibs, owner);
108102 if (r)
drivers/gpu/drm/amd/amdgpu/amdgpu_semaphore.c+1−1
@@ -40,7 +40,7 @@ int amdgpu_semaphore_create(struct amdgpu_device *adev, · 39 unmodified lines
4040 if (*semaphore == NULL) {
4141 return -ENOMEM;
4242 }
43− r = amdgpu_sa_bo_new(adev, &adev->ring_tmp_bo,
43+ r = amdgpu_sa_bo_new(&adev->ring_tmp_bo,
4444 &(*semaphore)->sa_bo, 8, 8);
4545 if (r) {
4646 kfree(*semaphore);
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c+8−2
@@ -302,8 +302,14 @@ int amdgpu_sync_rings(struct amdgpu_sync *sync, · 301 unmodified lines
302302 return -EINVAL;
303303 }
304304
305− if (amdgpu_enable_scheduler || !amdgpu_enable_semaphores ||
306− (count >= AMDGPU_NUM_SYNCS)) {
305+ if (amdgpu_enable_scheduler || !amdgpu_enable_semaphores) {
306+ r = fence_wait(&fence->base, true);
307+ if (r)
308+ return r;
309+ continue;
310+ }
311+
312+ if (count >= AMDGPU_NUM_SYNCS) {
307313 /* not enough room, wait manually */
308314 r = fence_wait(&fence->base, false);
309315 if (r)
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h+51−43
@@ -48,6 +48,57 @@ TRACE_EVENT(amdgpu_cs, · 47 unmodified lines
4848 __entry->fences)
4949 );
5050
51+TRACE_EVENT(amdgpu_cs_ioctl,
52+ TP_PROTO(struct amdgpu_job *job),
53+ TP_ARGS(job),
54+ TP_STRUCT__entry(
55+ __field(struct amdgpu_device *, adev)
56+ __field(struct amd_sched_job *, sched_job)
57+ __field(struct amdgpu_ib *, ib)
58+ __field(struct fence *, fence)
59+ __field(char *, ring_name)
60+ __field(u32, num_ibs)
61+ ),
62+
63+ TP_fast_assign(
64+ __entry->adev = job->adev;
65+ __entry->sched_job = &job->base;
66+ __entry->ib = job->ibs;
67+ __entry->fence = &job->base.s_fence->base;
68+ __entry->ring_name = job->ibs[0].ring->name;
69+ __entry->num_ibs = job->num_ibs;
70+ ),
71+ TP_printk("adev=%p, sched_job=%p, first ib=%p, sched fence=%p, ring name:%s, num_ibs:%u",
72+ __entry->adev, __entry->sched_job, __entry->ib,
73+ __entry->fence, __entry->ring_name, __entry->num_ibs)
74+);
75+
76+TRACE_EVENT(amdgpu_sched_run_job,
77+ TP_PROTO(struct amdgpu_job *job),
78+ TP_ARGS(job),
79+ TP_STRUCT__entry(
80+ __field(struct amdgpu_device *, adev)
81+ __field(struct amd_sched_job *, sched_job)
82+ __field(struct amdgpu_ib *, ib)
83+ __field(struct fence *, fence)
84+ __field(char *, ring_name)
85+ __field(u32, num_ibs)
86+ ),
87+
88+ TP_fast_assign(
89+ __entry->adev = job->adev;
90+ __entry->sched_job = &job->base;
91+ __entry->ib = job->ibs;
92+ __entry->fence = &job->base.s_fence->base;
93+ __entry->ring_name = job->ibs[0].ring->name;
94+ __entry->num_ibs = job->num_ibs;
95+ ),
96+ TP_printk("adev=%p, sched_job=%p, first ib=%p, sched fence=%p, ring name:%s, num_ibs:%u",
97+ __entry->adev, __entry->sched_job, __entry->ib,
98+ __entry->fence, __entry->ring_name, __entry->num_ibs)
99+);
100+
101+
51102 TRACE_EVENT(amdgpu_vm_grab_id,
52103 TP_PROTO(unsigned vmid, int ring),
53104 TP_ARGS(vmid, ring),
@@ -196,49 +247,6 @@ TRACE_EVENT(amdgpu_bo_list_set, · 142 unmodified lines
196247 TP_printk("list=%p, bo=%p", __entry->list, __entry->bo)
197248 );
198249
199−DECLARE_EVENT_CLASS(amdgpu_fence_request,
200−
201− TP_PROTO(struct drm_device *dev, int ring, u32 seqno),
202−
203− TP_ARGS(dev, ring, seqno),
204−
205− TP_STRUCT__entry(
206− __field(u32, dev)
207− __field(int, ring)
208− __field(u32, seqno)
209− ),
210−
211− TP_fast_assign(
212− __entry->dev = dev->primary->index;
213− __entry->ring = ring;
214− __entry->seqno = seqno;
215− ),
216−
217− TP_printk("dev=%u, ring=%d, seqno=%u",
218− __entry->dev, __entry->ring, __entry->seqno)
219−);
220−
221−DEFINE_EVENT(amdgpu_fence_request, amdgpu_fence_emit,
222−
223− TP_PROTO(struct drm_device *dev, int ring, u32 seqno),
224−
225− TP_ARGS(dev, ring, seqno)
226−);
227−
228−DEFINE_EVENT(amdgpu_fence_request, amdgpu_fence_wait_begin,
229−
230− TP_PROTO(struct drm_device *dev, int ring, u32 seqno),
231−
232− TP_ARGS(dev, ring, seqno)
233−);
234−
235−DEFINE_EVENT(amdgpu_fence_request, amdgpu_fence_wait_end,
236−
237− TP_PROTO(struct drm_device *dev, int ring, u32 seqno),
238−
239− TP_ARGS(dev, ring, seqno)
240−);
241−
242250 DECLARE_EVENT_CLASS(amdgpu_semaphore_request,
243251
244252 TP_PROTO(int ring, struct amdgpu_semaphore *sem),
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c+14−9
@@ -587,9 +587,13 @@ static int amdgpu_ttm_backend_bind(struct ttm_tt *ttm, · 586 unmodified lines
587587 uint32_t flags = amdgpu_ttm_tt_pte_flags(gtt->adev, ttm, bo_mem);
588588 int r;
589589
590− if (gtt->userptr)
591− amdgpu_ttm_tt_pin_userptr(ttm);
592−
590+ if (gtt->userptr) {
591+ r = amdgpu_ttm_tt_pin_userptr(ttm);
592+ if (r) {
593+ DRM_ERROR("failed to pin userptr\n");
594+ return r;
595+ }
596+ }
593597 gtt->offset = (unsigned long)(bo_mem->start << PAGE_SHIFT);
594598 if (!ttm->num_pages) {
595599 WARN(1, "nothing to bind %lu pages for mreg %p back %p!\n",
@@ -797,11 +801,12 @@ uint32_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm, · 201 unmodified lines
797801 if (mem && mem->mem_type != TTM_PL_SYSTEM)
798802 flags |= AMDGPU_PTE_VALID;
799803
800− if (mem && mem->mem_type == TTM_PL_TT)
804+ if (mem && mem->mem_type == TTM_PL_TT) {
801805 flags |= AMDGPU_PTE_SYSTEM;
802806
803− if (!ttm || ttm->caching_state == tt_cached)
804− flags |= AMDGPU_PTE_SNOOPED;
807+ if (ttm->caching_state == tt_cached)
808+ flags |= AMDGPU_PTE_SNOOPED;
809+ }
805810
806811 if (adev->asic_type >= CHIP_TOPAZ)
807812 flags |= AMDGPU_PTE_EXECUTABLE;
@@ -1073,10 +1078,10 @@ static int amdgpu_mm_dump_table(struct seq_file *m, void *data) · 265 unmodified lines
10731078 ret = drm_mm_dump_table(m, mm);
10741079 spin_unlock(&glob->lru_lock);
10751080 if (ttm_pl == TTM_PL_VRAM)
1076− seq_printf(m, "man size:%llu pages, ram usage:%luMB, vis usage:%luMB\n",
1081+ seq_printf(m, "man size:%llu pages, ram usage:%lluMB, vis usage:%lluMB\n",
10771082 adev->mman.bdev.man[ttm_pl].size,
1078− atomic64_read(&adev->vram_usage) >> 20,
1079− atomic64_read(&adev->vram_vis_usage) >> 20);
1083+ (u64)atomic64_read(&adev->vram_usage) >> 20,
1084+ (u64)atomic64_read(&adev->vram_vis_usage) >> 20);
10801085 return ret;
10811086 }
10821087
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c+10−1
@@ -392,7 +392,10 @@ int amdgpu_vce_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, · 391 unmodified lines
392392 ib->ptr[ib->length_dw++] = 0x00000001; /* session cmd */
393393 ib->ptr[ib->length_dw++] = handle;
394394
395− ib->ptr[ib->length_dw++] = 0x00000030; /* len */
395+ if ((ring->adev->vce.fw_version >> 24) >= 52)
396+ ib->ptr[ib->length_dw++] = 0x00000040; /* len */
397+ else
398+ ib->ptr[ib->length_dw++] = 0x00000030; /* len */
396399 ib->ptr[ib->length_dw++] = 0x01000001; /* create cmd */
397400 ib->ptr[ib->length_dw++] = 0x00000000;
398401 ib->ptr[ib->length_dw++] = 0x00000042;
@@ -404,6 +407,12 @@ int amdgpu_vce_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, · 5 unmodified lines
404407 ib->ptr[ib->length_dw++] = 0x00000100;
405408 ib->ptr[ib->length_dw++] = 0x0000000c;
406409 ib->ptr[ib->length_dw++] = 0x00000000;
410+ if ((ring->adev->vce.fw_version >> 24) >= 52) {
411+ ib->ptr[ib->length_dw++] = 0x00000000;
412+ ib->ptr[ib->length_dw++] = 0x00000000;
413+ ib->ptr[ib->length_dw++] = 0x00000000;
414+ ib->ptr[ib->length_dw++] = 0x00000000;
415+ }
407416
408417 ib->ptr[ib->length_dw++] = 0x00000014; /* len */
409418 ib->ptr[ib->length_dw++] = 0x05000005; /* feedback buffer */
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c+103−69
@@ -143,10 +143,15 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, · 142 unmodified lines
143143 unsigned i;
144144
145145 /* check if the id is still valid */
146− if (vm_id->id && vm_id->last_id_use &&
147− vm_id->last_id_use == adev->vm_manager.active[vm_id->id]) {
148− trace_amdgpu_vm_grab_id(vm_id->id, ring->idx);
149− return 0;
146+ if (vm_id->id) {
147+ unsigned id = vm_id->id;
148+ long owner;
149+
150+ owner = atomic_long_read(&adev->vm_manager.ids[id].owner);
151+ if (owner == (long)vm) {
152+ trace_amdgpu_vm_grab_id(vm_id->id, ring->idx);
153+ return 0;
154+ }
150155 }
151156
152157 /* we definately need to flush */
@@ -154,7 +159,7 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, · 1 unmodified line
154159
155160 /* skip over VMID 0, since it is the system VM */
156161 for (i = 1; i < adev->vm_manager.nvm; ++i) {
157− struct fence *fence = adev->vm_manager.active[i];
162+ struct fence *fence = adev->vm_manager.ids[i].active;
158163 struct amdgpu_ring *fring;
159164
160165 if (fence == NULL) {
@@ -176,7 +181,7 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, · 15 unmodified lines
176181 if (choices[i]) {
177182 struct fence *fence;
178183
179− fence = adev->vm_manager.active[choices[i]];
184+ fence = adev->vm_manager.ids[choices[i]].active;
180185 vm_id->id = choices[i];
181186
182187 trace_amdgpu_vm_grab_id(choices[i], ring->idx);
@@ -207,24 +212,21 @@ void amdgpu_vm_flush(struct amdgpu_ring *ring, · 24 unmodified lines
207212 uint64_t pd_addr = amdgpu_bo_gpu_offset(vm->page_directory);
208213 struct amdgpu_vm_id *vm_id = &vm->ids[ring->idx];
209214 struct fence *flushed_updates = vm_id->flushed_updates;
210− bool is_earlier = false;
215+ bool is_later;
211216
212− if (flushed_updates && updates) {
213− BUG_ON(flushed_updates->context != updates->context);
214− is_earlier = (updates->seqno - flushed_updates->seqno <=
215− INT_MAX) ? true : false;
216− }
217−
218− if (pd_addr != vm_id->pd_gpu_addr || !flushed_updates ||
219− is_earlier) {
217+ if (!flushed_updates)
218+ is_later = true;
219+ else if (!updates)
220+ is_later = false;
221+ else
222+ is_later = fence_is_later(updates, flushed_updates);
220223
224+ if (pd_addr != vm_id->pd_gpu_addr || is_later) {
221225 trace_amdgpu_vm_flush(pd_addr, ring->idx, vm_id->id);
222− if (is_earlier) {
226+ if (is_later) {
223227 vm_id->flushed_updates = fence_get(updates);
224228 fence_put(flushed_updates);
225229 }
226− if (!flushed_updates)
227− vm_id->flushed_updates = fence_get(updates);
228230 vm_id->pd_gpu_addr = pd_addr;
229231 amdgpu_ring_emit_vm_flush(ring, vm_id->id, vm_id->pd_gpu_addr);
230232 }
@@ -244,16 +246,14 @@ void amdgpu_vm_flush(struct amdgpu_ring *ring, · 13 unmodified lines
244246 */
245247 void amdgpu_vm_fence(struct amdgpu_device *adev,
246248 struct amdgpu_vm *vm,
247− struct amdgpu_fence *fence)
249+ struct fence *fence)
248250 {
249− unsigned ridx = fence->ring->idx;
250− unsigned vm_id = vm->ids[ridx].id;
251−
252− fence_put(adev->vm_manager.active[vm_id]);
253− adev->vm_manager.active[vm_id] = fence_get(&fence->base);
251+ struct amdgpu_ring *ring = amdgpu_ring_from_fence(fence);
252+ unsigned vm_id = vm->ids[ring->idx].id;
254253
255− fence_put(vm->ids[ridx].last_id_use);
256− vm->ids[ridx].last_id_use = fence_get(&fence->base);
254+ fence_put(adev->vm_manager.ids[vm_id].active);
255+ adev->vm_manager.ids[vm_id].active = fence_get(fence);
256+ atomic_long_set(&adev->vm_manager.ids[vm_id].owner, (long)vm);
257257 }
258258
259259 /**
@@ -332,6 +332,8 @@ int amdgpu_vm_free_job(struct amdgpu_job *job) · 72 unmodified lines
332332 *
333333 * @adev: amdgpu_device pointer
334334 * @bo: bo to clear
335+ *
336+ * need to reserve bo first before calling it.
335337 */
336338 static int amdgpu_vm_clear_bo(struct amdgpu_device *adev,
337339 struct amdgpu_bo *bo)
@@ -343,24 +345,20 @@ static int amdgpu_vm_clear_bo(struct amdgpu_device *adev, · 5 unmodified lines
343345 uint64_t addr;
344346 int r;
345347
346− r = amdgpu_bo_reserve(bo, false);
347− if (r)
348− return r;
349−
350348 r = reservation_object_reserve_shared(bo->tbo.resv);
351349 if (r)
352350 return r;
353351
354352 r = ttm_bo_validate(&bo->tbo, &bo->placement, true, false);
355353 if (r)
356− goto error_unreserve;
354+ goto error;
357355
358356 addr = amdgpu_bo_gpu_offset(bo);
359357 entries = amdgpu_bo_size(bo) / 8;
360358
361359 ib = kzalloc(sizeof(struct amdgpu_ib), GFP_KERNEL);
362360 if (!ib)
363− goto error_unreserve;
361+ goto error;
364362
365363 r = amdgpu_ib_get(ring, NULL, entries * 2 + 64, ib);
366364 if (r)
@@ -378,16 +376,14 @@ static int amdgpu_vm_clear_bo(struct amdgpu_device *adev, · 11 unmodified lines
378376 if (!r)
379377 amdgpu_bo_fence(bo, fence, true);
380378 fence_put(fence);
381− if (amdgpu_enable_scheduler) {
382− amdgpu_bo_unreserve(bo);
379+ if (amdgpu_enable_scheduler)
383380 return 0;
384− }
381+
385382 error_free:
386383 amdgpu_ib_free(adev, ib);
387384 kfree(ib);
388385
389−error_unreserve:
390− amdgpu_bo_unreserve(bo);
386+error:
391387 return r;
392388 }
393389
@@ -889,17 +885,21 @@ int amdgpu_vm_clear_freed(struct amdgpu_device *adev, · 495 unmodified lines
889885 struct amdgpu_bo_va_mapping *mapping;
890886 int r;
891887
888+ spin_lock(&vm->freed_lock);
892889 while (!list_empty(&vm->freed)) {
893890 mapping = list_first_entry(&vm->freed,
894891 struct amdgpu_bo_va_mapping, list);
895892 list_del(&mapping->list);
896−
893+ spin_unlock(&vm->freed_lock);
897894 r = amdgpu_vm_bo_update_mapping(adev, vm, mapping, 0, 0, NULL);
898895 kfree(mapping);
899896 if (r)
900897 return r;
901898
899+ spin_lock(&vm->freed_lock);
902900 }
901+ spin_unlock(&vm->freed_lock);
902+
903903 return 0;
904904
905905 }
@@ -926,8 +926,9 @@ int amdgpu_vm_clear_invalids(struct amdgpu_device *adev, · 20 unmodified lines
926926 bo_va = list_first_entry(&vm->invalidated,
927927 struct amdgpu_bo_va, vm_status);
928928 spin_unlock(&vm->status_lock);
929−
929+ mutex_lock(&bo_va->mutex);
930930 r = amdgpu_vm_bo_update(adev, bo_va, NULL);
931+ mutex_unlock(&bo_va->mutex);
931932 if (r)
932933 return r;
933934
@@ -971,7 +972,7 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev, · 37 unmodified lines
971972 INIT_LIST_HEAD(&bo_va->valids);
972973 INIT_LIST_HEAD(&bo_va->invalids);
973974 INIT_LIST_HEAD(&bo_va->vm_status);
974−
975+ mutex_init(&bo_va->mutex);
975976 list_add_tail(&bo_va->bo_list, &bo->va);
976977
977978 return bo_va;
@@ -989,7 +990,7 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev, · 11 unmodified lines
989990 * Add a mapping of the BO at the specefied addr into the VM.
990991 * Returns 0 for success, error for failure.
991992 *
992− * Object has to be reserved and gets unreserved by this function!
993+ * Object has to be reserved and unreserved outside!
993994 */
994995 int amdgpu_vm_bo_map(struct amdgpu_device *adev,
995996 struct amdgpu_bo_va *bo_va,
@@ -1005,30 +1006,27 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev, · 9 unmodified lines
10051006
10061007 /* validate the parameters */
10071008 if (saddr & AMDGPU_GPU_PAGE_MASK || offset & AMDGPU_GPU_PAGE_MASK ||
1008− size == 0 || size & AMDGPU_GPU_PAGE_MASK) {
1009− amdgpu_bo_unreserve(bo_va->bo);
1009+ size == 0 || size & AMDGPU_GPU_PAGE_MASK)
10101010 return -EINVAL;
1011− }
10121011
10131012 /* make sure object fit at this offset */
10141013 eaddr = saddr + size;
1015− if ((saddr >= eaddr) || (offset + size > amdgpu_bo_size(bo_va->bo))) {
1016− amdgpu_bo_unreserve(bo_va->bo);
1014+ if ((saddr >= eaddr) || (offset + size > amdgpu_bo_size(bo_va->bo)))
10171015 return -EINVAL;
1018− }
10191016
10201017 last_pfn = eaddr / AMDGPU_GPU_PAGE_SIZE;
10211018 if (last_pfn > adev->vm_manager.max_pfn) {
10221019 dev_err(adev->dev, "va above limit (0x%08X > 0x%08X)\n",
10231020 last_pfn, adev->vm_manager.max_pfn);
1024− amdgpu_bo_unreserve(bo_va->bo);
10251021 return -EINVAL;
10261022 }
10271023
10281024 saddr /= AMDGPU_GPU_PAGE_SIZE;
10291025 eaddr /= AMDGPU_GPU_PAGE_SIZE;
10301026
1027+ spin_lock(&vm->it_lock);
10311028 it = interval_tree_iter_first(&vm->va, saddr, eaddr - 1);
1029+ spin_unlock(&vm->it_lock);
10321030 if (it) {
10331031 struct amdgpu_bo_va_mapping *tmp;
10341032 tmp = container_of(it, struct amdgpu_bo_va_mapping, it);
@@ -1036,14 +1034,12 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev, · 1 unmodified line
10361034 dev_err(adev->dev, "bo %p va 0x%010Lx-0x%010Lx conflict with "
10371035 "0x%010lx-0x%010lx\n", bo_va->bo, saddr, eaddr,
10381036 tmp->it.start, tmp->it.last + 1);
1039− amdgpu_bo_unreserve(bo_va->bo);
10401037 r = -EINVAL;
10411038 goto error;
10421039 }
10431040
10441041 mapping = kmalloc(sizeof(*mapping), GFP_KERNEL);
10451042 if (!mapping) {
1046− amdgpu_bo_unreserve(bo_va->bo);
10471043 r = -ENOMEM;
10481044 goto error;
10491045 }
@@ -1054,8 +1050,12 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev, · 4 unmodified lines
10541050 mapping->offset = offset;
10551051 mapping->flags = flags;
10561052
1053+ mutex_lock(&bo_va->mutex);
10571054 list_add(&mapping->list, &bo_va->invalids);
1055+ mutex_unlock(&bo_va->mutex);
1056+ spin_lock(&vm->it_lock);
10581057 interval_tree_insert(&mapping->it, &vm->va);
1058+ spin_unlock(&vm->it_lock);
10591059 trace_amdgpu_vm_bo_map(bo_va, mapping);
10601060
10611061 /* Make sure the page tables are allocated */
@@ -1067,8 +1067,6 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev, · 5 unmodified lines
10671067 if (eaddr > vm->max_pde_used)
10681068 vm->max_pde_used = eaddr;
10691069
1070− amdgpu_bo_unreserve(bo_va->bo);
1071−
10721070 /* walk over the address space and allocate the page tables */
10731071 for (pt_idx = saddr; pt_idx <= eaddr; ++pt_idx) {
10741072 struct reservation_object *resv = vm->page_directory->tbo.resv;
@@ -1077,16 +1075,19 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev, · 2 unmodified lines
10771075 if (vm->page_tables[pt_idx].bo)
10781076 continue;
10791077
1080− ww_mutex_lock(&resv->lock, NULL);
10811078 r = amdgpu_bo_create(adev, AMDGPU_VM_PTE_COUNT * 8,
10821079 AMDGPU_GPU_PAGE_SIZE, true,
10831080 AMDGPU_GEM_DOMAIN_VRAM,
10841081 AMDGPU_GEM_CREATE_NO_CPU_ACCESS,
10851082 NULL, resv, &pt);
1086− ww_mutex_unlock(&resv->lock);
10871083 if (r)
10881084 goto error_free;
10891085
1086+ /* Keep a reference to the page table to avoid freeing
1087+ * them up in the wrong order.
1088+ */
1089+ pt->parent = amdgpu_bo_ref(vm->page_directory);
1090+
10901091 r = amdgpu_vm_clear_bo(adev, pt);
10911092 if (r) {
10921093 amdgpu_bo_unref(&pt);
@@ -1101,7 +1102,9 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev, · 8 unmodified lines
11011102
11021103 error_free:
11031104 list_del(&mapping->list);
1105+ spin_lock(&vm->it_lock);
11041106 interval_tree_remove(&mapping->it, &vm->va);
1107+ spin_unlock(&vm->it_lock);
11051108 trace_amdgpu_vm_bo_unmap(bo_va, mapping);
11061109 kfree(mapping);
11071110
@@ -1119,7 +1122,7 @@ error: · 11 unmodified lines
11191122 * Remove a mapping of the BO at the specefied addr from the VM.
11201123 * Returns 0 for success, error for failure.
11211124 *
1122− * Object has to be reserved and gets unreserved by this function!
1125+ * Object has to be reserved and unreserved outside!
11231126 */
11241127 int amdgpu_vm_bo_unmap(struct amdgpu_device *adev,
11251128 struct amdgpu_bo_va *bo_va,
@@ -1130,7 +1133,7 @@ int amdgpu_vm_bo_unmap(struct amdgpu_device *adev, · 4 unmodified lines
11301133 bool valid = true;
11311134
11321135 saddr /= AMDGPU_GPU_PAGE_SIZE;
1133−
1136+ mutex_lock(&bo_va->mutex);
11341137 list_for_each_entry(mapping, &bo_va->valids, list) {
11351138 if (mapping->it.start == saddr)
11361139 break;
@@ -1145,20 +1148,24 @@ int amdgpu_vm_bo_unmap(struct amdgpu_device *adev, · 8 unmodified lines
11451148 }
11461149
11471150 if (&mapping->list == &bo_va->invalids) {
1148− amdgpu_bo_unreserve(bo_va->bo);
1151+ mutex_unlock(&bo_va->mutex);
11491152 return -ENOENT;
11501153 }
11511154 }
1152−
1155+ mutex_unlock(&bo_va->mutex);
11531156 list_del(&mapping->list);
1157+ spin_lock(&vm->it_lock);
11541158 interval_tree_remove(&mapping->it, &vm->va);
1159+ spin_unlock(&vm->it_lock);
11551160 trace_amdgpu_vm_bo_unmap(bo_va, mapping);
11561161
1157− if (valid)
1162+ if (valid) {
1163+ spin_lock(&vm->freed_lock);
11581164 list_add(&mapping->list, &vm->freed);
1159− else
1165+ spin_unlock(&vm->freed_lock);
1166+ } else {
11601167 kfree(mapping);
1161− amdgpu_bo_unreserve(bo_va->bo);
1168+ }
11621169
11631170 return 0;
11641171 }
@@ -1187,17 +1194,23 @@ void amdgpu_vm_bo_rmv(struct amdgpu_device *adev, · 22 unmodified lines
11871194
11881195 list_for_each_entry_safe(mapping, next, &bo_va->valids, list) {
11891196 list_del(&mapping->list);
1197+ spin_lock(&vm->it_lock);
11901198 interval_tree_remove(&mapping->it, &vm->va);
1199+ spin_unlock(&vm->it_lock);
11911200 trace_amdgpu_vm_bo_unmap(bo_va, mapping);
1201+ spin_lock(&vm->freed_lock);
11921202 list_add(&mapping->list, &vm->freed);
1203+ spin_unlock(&vm->freed_lock);
11931204 }
11941205 list_for_each_entry_safe(mapping, next, &bo_va->invalids, list) {
11951206 list_del(&mapping->list);
1207+ spin_lock(&vm->it_lock);
11961208 interval_tree_remove(&mapping->it, &vm->va);
1209+ spin_unlock(&vm->it_lock);
11971210 kfree(mapping);
11981211 }
1199−
12001212 fence_put(bo_va->last_pt_update);
1213+ mutex_destroy(&bo_va->mutex);
12011214 kfree(bo_va);
12021215 }
12031216
@@ -1241,15 +1254,14 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) · 37 unmodified lines
12411254 for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
12421255 vm->ids[i].id = 0;
12431256 vm->ids[i].flushed_updates = NULL;
1244− vm->ids[i].last_id_use = NULL;
12451257 }
1246− mutex_init(&vm->mutex);
12471258 vm->va = RB_ROOT;
12481259 spin_lock_init(&vm->status_lock);
12491260 INIT_LIST_HEAD(&vm->invalidated);
12501261 INIT_LIST_HEAD(&vm->cleared);
12511262 INIT_LIST_HEAD(&vm->freed);
1252−
1263+ spin_lock_init(&vm->it_lock);
1264+ spin_lock_init(&vm->freed_lock);
12531265 pd_size = amdgpu_vm_directory_size(adev);
12541266 pd_entries = amdgpu_vm_num_pdes(adev);
12551267
@@ -1269,8 +1281,14 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) · 13 unmodified lines
12691281 NULL, NULL, &vm->page_directory);
12701282 if (r)
12711283 return r;
1272−
1284+ r = amdgpu_bo_reserve(vm->page_directory, false);
1285+ if (r) {
1286+ amdgpu_bo_unref(&vm->page_directory);
1287+ vm->page_directory = NULL;
1288+ return r;
1289+ }
12731290 r = amdgpu_vm_clear_bo(adev, vm->page_directory);
1291+ amdgpu_bo_unreserve(vm->page_directory);
12741292 if (r) {
12751293 amdgpu_bo_unref(&vm->page_directory);
12761294 vm->page_directory = NULL;
@@ -1313,11 +1331,27 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) · 36 unmodified lines
13131331
13141332 amdgpu_bo_unref(&vm->page_directory);
13151333 fence_put(vm->page_directory_fence);
1316−
13171334 for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
1335+ unsigned id = vm->ids[i].id;
1336+
1337+ atomic_long_cmpxchg(&adev->vm_manager.ids[id].owner,
1338+ (long)vm, 0);
13181339 fence_put(vm->ids[i].flushed_updates);
1319− fence_put(vm->ids[i].last_id_use);
13201340 }
13211341
1322− mutex_destroy(&vm->mutex);
1342+}
1343+
1344+/**
1345+ * amdgpu_vm_manager_fini - cleanup VM manager
1346+ *
1347+ * @adev: amdgpu_device pointer
1348+ *
1349+ * Cleanup the VM manager and free resources.
1350+ */
1351+void amdgpu_vm_manager_fini(struct amdgpu_device *adev)
1352+{
1353+ unsigned i;
1354+
1355+ for (i = 0; i < AMDGPU_NUM_VM; ++i)
1356+ fence_put(adev->vm_manager.ids[i].active);
13231357 }
drivers/gpu/drm/amd/amdgpu/ci_dpm.c+4−4
@@ -6569,12 +6569,12 @@ static int ci_dpm_set_interrupt_state(struct amdgpu_device *adev, · 6568 unmodified lines
65696569 switch (state) {
65706570 case AMDGPU_IRQ_STATE_DISABLE:
65716571 cg_thermal_int = RREG32_SMC(ixCG_THERMAL_INT);
6572− cg_thermal_int &= ~CG_THERMAL_INT_CTRL__THERM_INTH_MASK_MASK;
6572+ cg_thermal_int |= CG_THERMAL_INT_CTRL__THERM_INTH_MASK_MASK;
65736573 WREG32_SMC(ixCG_THERMAL_INT, cg_thermal_int);
65746574 break;
65756575 case AMDGPU_IRQ_STATE_ENABLE:
65766576 cg_thermal_int = RREG32_SMC(ixCG_THERMAL_INT);
6577− cg_thermal_int |= CG_THERMAL_INT_CTRL__THERM_INTH_MASK_MASK;
6577+ cg_thermal_int &= ~CG_THERMAL_INT_CTRL__THERM_INTH_MASK_MASK;
65786578 WREG32_SMC(ixCG_THERMAL_INT, cg_thermal_int);
65796579 break;
65806580 default:
@@ -6586,12 +6586,12 @@ static int ci_dpm_set_interrupt_state(struct amdgpu_device *adev, · 5 unmodified lines
65866586 switch (state) {
65876587 case AMDGPU_IRQ_STATE_DISABLE:
65886588 cg_thermal_int = RREG32_SMC(ixCG_THERMAL_INT);
6589− cg_thermal_int &= ~CG_THERMAL_INT_CTRL__THERM_INTL_MASK_MASK;
6589+ cg_thermal_int |= CG_THERMAL_INT_CTRL__THERM_INTL_MASK_MASK;
65906590 WREG32_SMC(ixCG_THERMAL_INT, cg_thermal_int);
65916591 break;
65926592 case AMDGPU_IRQ_STATE_ENABLE:
65936593 cg_thermal_int = RREG32_SMC(ixCG_THERMAL_INT);
6594− cg_thermal_int |= CG_THERMAL_INT_CTRL__THERM_INTL_MASK_MASK;
6594+ cg_thermal_int &= ~CG_THERMAL_INT_CTRL__THERM_INTL_MASK_MASK;
65956595 WREG32_SMC(ixCG_THERMAL_INT, cg_thermal_int);
65966596 break;
65976597 default:
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c+4−1
@@ -1250,7 +1250,7 @@ static void dce_v10_0_program_watermarks(struct amdgpu_device *adev, · 1249 unmodified lines
12501250 u32 pixel_period;
12511251 u32 line_time = 0;
12521252 u32 latency_watermark_a = 0, latency_watermark_b = 0;
1253− u32 tmp, wm_mask;
1253+ u32 tmp, wm_mask, lb_vblank_lead_lines = 0;
12541254
12551255 if (amdgpu_crtc->base.enabled && num_heads && mode) {
12561256 pixel_period = 1000000 / (u32)mode->clock;
@@ -1333,6 +1333,7 @@ static void dce_v10_0_program_watermarks(struct amdgpu_device *adev, · 76 unmodified lines
13331333 (adev->mode_info.disp_priority == 2)) {
13341334 DRM_DEBUG_KMS("force priority to high\n");
13351335 }
1336+ lb_vblank_lead_lines = DIV_ROUND_UP(lb_size, mode->crtc_hdisplay);
13361337 }
13371338
13381339 /* select wm A */
@@ -1357,6 +1358,8 @@ static void dce_v10_0_program_watermarks(struct amdgpu_device *adev, · 18 unmodified lines
13571358 amdgpu_crtc->line_time = line_time;
13581359 amdgpu_crtc->wm_high = latency_watermark_a;
13591360 amdgpu_crtc->wm_low = latency_watermark_b;
1361+ /* Save number of lines the linebuffer leads before the scanout */
1362+ amdgpu_crtc->lb_vblank_lead_lines = lb_vblank_lead_lines;
13601363 }
13611364
13621365 /**
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c+4−1
@@ -1238,7 +1238,7 @@ static void dce_v11_0_program_watermarks(struct amdgpu_device *adev, · 1237 unmodified lines
12381238 u32 pixel_period;
12391239 u32 line_time = 0;
12401240 u32 latency_watermark_a = 0, latency_watermark_b = 0;
1241− u32 tmp, wm_mask;
1241+ u32 tmp, wm_mask, lb_vblank_lead_lines = 0;
12421242
12431243 if (amdgpu_crtc->base.enabled && num_heads && mode) {
12441244 pixel_period = 1000000 / (u32)mode->clock;
@@ -1321,6 +1321,7 @@ static void dce_v11_0_program_watermarks(struct amdgpu_device *adev, · 76 unmodified lines
13211321 (adev->mode_info.disp_priority == 2)) {
13221322 DRM_DEBUG_KMS("force priority to high\n");
13231323 }
1324+ lb_vblank_lead_lines = DIV_ROUND_UP(lb_size, mode->crtc_hdisplay);
13241325 }
13251326
13261327 /* select wm A */
@@ -1345,6 +1346,8 @@ static void dce_v11_0_program_watermarks(struct amdgpu_device *adev, · 18 unmodified lines
13451346 amdgpu_crtc->line_time = line_time;
13461347 amdgpu_crtc->wm_high = latency_watermark_a;
13471348 amdgpu_crtc->wm_low = latency_watermark_b;
1349+ /* Save number of lines the linebuffer leads before the scanout */
1350+ amdgpu_crtc->lb_vblank_lead_lines = lb_vblank_lead_lines;
13481351 }
13491352
13501353 /**
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c+4−1
@@ -1193,7 +1193,7 @@ static void dce_v8_0_program_watermarks(struct amdgpu_device *adev, · 1192 unmodified lines
11931193 u32 pixel_period;
11941194 u32 line_time = 0;
11951195 u32 latency_watermark_a = 0, latency_watermark_b = 0;
1196− u32 tmp, wm_mask;
1196+ u32 tmp, wm_mask, lb_vblank_lead_lines = 0;
11971197
11981198 if (amdgpu_crtc->base.enabled && num_heads && mode) {
11991199 pixel_period = 1000000 / (u32)mode->clock;
@@ -1276,6 +1276,7 @@ static void dce_v8_0_program_watermarks(struct amdgpu_device *adev, · 76 unmodified lines
12761276 (adev->mode_info.disp_priority == 2)) {
12771277 DRM_DEBUG_KMS("force priority to high\n");
12781278 }
1279+ lb_vblank_lead_lines = DIV_ROUND_UP(lb_size, mode->crtc_hdisplay);
12791280 }
12801281
12811282 /* select wm A */
@@ -1302,6 +1303,8 @@ static void dce_v8_0_program_watermarks(struct amdgpu_device *adev, · 20 unmodified lines
13021303 amdgpu_crtc->line_time = line_time;
13031304 amdgpu_crtc->wm_high = latency_watermark_a;
13041305 amdgpu_crtc->wm_low = latency_watermark_b;
1306+ /* Save number of lines the linebuffer leads before the scanout */
1307+ amdgpu_crtc->lb_vblank_lead_lines = lb_vblank_lead_lines;
13051308 }
13061309
13071310 /**
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c+295−7
@@ -268,7 +268,6 @@ static const u32 fiji_mgcg_cgcg_init[] = · 267 unmodified lines
268268 mmCGTT_CP_CLK_CTRL, 0xffffffff, 0x00000100,
269269 mmCGTT_CPC_CLK_CTRL, 0xffffffff, 0x00000100,
270270 mmCGTT_CPF_CLK_CTRL, 0xffffffff, 0x40000100,
271− mmCGTT_DRM_CLK_CTRL0, 0xffffffff, 0x00600100,
272271 mmCGTT_GDS_CLK_CTRL, 0xffffffff, 0x00000100,
273272 mmCGTT_IA_CLK_CTRL, 0xffffffff, 0x06000100,
274273 mmCGTT_PA_CLK_CTRL, 0xffffffff, 0x00000100,
@@ -296,10 +295,6 @@ static const u32 fiji_mgcg_cgcg_init[] = · 21 unmodified lines
296295 mmCGTS_SM_CTRL_REG, 0xffffffff, 0x96e00200,
297296 mmCP_RB_WPTR_POLL_CNTL, 0xffffffff, 0x00900100,
298297 mmRLC_CGCG_CGLS_CTRL, 0xffffffff, 0x0020003c,
299− mmPCIE_INDEX, 0xffffffff, 0x0140001c,
300− mmPCIE_DATA, 0x000f0000, 0x00000000,
301− mmCGTT_DRM_CLK_CTRL0, 0xff000fff, 0x00000100,
302− mmHDP_XDP_CGTT_BLK_CTRL, 0xc0000fff, 0x00000104,
303298 mmCP_MEM_SLP_CNTL, 0x00000001, 0x00000001,
304299 };
305300
@@ -1000,7 +995,7 @@ static void gfx_v8_0_gpu_early_init(struct amdgpu_device *adev) · 694 unmodified lines
1000995 adev->gfx.config.max_cu_per_sh = 16;
1001996 adev->gfx.config.max_sh_per_se = 1;
1002997 adev->gfx.config.max_backends_per_se = 4;
1003− adev->gfx.config.max_texture_channel_caches = 8;
998+ adev->gfx.config.max_texture_channel_caches = 16;
1004999 adev->gfx.config.max_gprs = 256;
10051000 adev->gfx.config.max_gs_threads = 32;
10061001 adev->gfx.config.max_hw_contexts = 8;
@@ -1613,6 +1608,296 @@ static void gfx_v8_0_tiling_mode_table_init(struct amdgpu_device *adev) · 606 unmodified lines
16131608 WREG32(mmGB_MACROTILE_MODE0 + reg_offset, gb_tile_moden);
16141609 }
16151610 case CHIP_FIJI:
1611+ for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) {
1612+ switch (reg_offset) {
1613+ case 0:
1614+ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
1615+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1616+ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) |
1617+ MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING));
1618+ break;
1619+ case 1:
1620+ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
1621+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1622+ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_128B) |
1623+ MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING));
1624+ break;
1625+ case 2:
1626+ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
1627+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1628+ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) |
1629+ MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING));
1630+ break;
1631+ case 3:
1632+ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
1633+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1634+ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B) |
1635+ MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING));
1636+ break;
1637+ case 4:
1638+ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
1639+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1640+ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_2KB) |
1641+ MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING));
1642+ break;
1643+ case 5:
1644+ gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) |
1645+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1646+ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_2KB) |
1647+ MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING));
1648+ break;
1649+ case 6:
1650+ gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) |
1651+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1652+ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_2KB) |
1653+ MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING));
1654+ break;
1655+ case 7:
1656+ gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) |
1657+ PIPE_CONFIG(ADDR_SURF_P4_16x16) |
1658+ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_2KB) |
1659+ MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING));
1660+ break;
1661+ case 8:
1662+ gb_tile_moden = (ARRAY_MODE(ARRAY_LINEAR_ALIGNED) |
1663+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16));
1664+ break;
1665+ case 9:
1666+ gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) |
1667+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1668+ MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) |
1669+ SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2));
1670+ break;
1671+ case 10:
1672+ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
1673+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1674+ MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) |
1675+ SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2));
1676+ break;
1677+ case 11:
1678+ gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) |
1679+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1680+ MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) |
1681+ SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_8));
1682+ break;
1683+ case 12:
1684+ gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) |
1685+ PIPE_CONFIG(ADDR_SURF_P4_16x16) |
1686+ MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) |
1687+ SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_8));
1688+ break;
1689+ case 13:
1690+ gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) |
1691+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1692+ MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) |
1693+ SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2));
1694+ break;
1695+ case 14:
1696+ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
1697+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1698+ MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) |
1699+ SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2));
1700+ break;
1701+ case 15:
1702+ gb_tile_moden = (ARRAY_MODE(ARRAY_3D_TILED_THIN1) |
1703+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1704+ MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) |
1705+ SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2));
1706+ break;
1707+ case 16:
1708+ gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) |
1709+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1710+ MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) |
1711+ SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_8));
1712+ break;
1713+ case 17:
1714+ gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) |
1715+ PIPE_CONFIG(ADDR_SURF_P4_16x16) |
1716+ MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) |
1717+ SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_8));
1718+ break;
1719+ case 18:
1720+ gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THICK) |
1721+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1722+ MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) |
1723+ SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_1));
1724+ break;
1725+ case 19:
1726+ gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THICK) |
1727+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1728+ MICRO_TILE_MODE_NEW(ADDR_SURF_THICK_MICRO_TILING) |
1729+ SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_1));
1730+ break;
1731+ case 20:
1732+ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THICK) |
1733+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1734+ MICRO_TILE_MODE_NEW(ADDR_SURF_THICK_MICRO_TILING) |
1735+ SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_1));
1736+ break;
1737+ case 21:
1738+ gb_tile_moden = (ARRAY_MODE(ARRAY_3D_TILED_THICK) |
1739+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1740+ MICRO_TILE_MODE_NEW(ADDR_SURF_THICK_MICRO_TILING) |
1741+ SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_1));
1742+ break;
1743+ case 22:
1744+ gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THICK) |
1745+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1746+ MICRO_TILE_MODE_NEW(ADDR_SURF_THICK_MICRO_TILING) |
1747+ SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_1));
1748+ break;
1749+ case 23:
1750+ gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THICK) |
1751+ PIPE_CONFIG(ADDR_SURF_P4_16x16) |
1752+ MICRO_TILE_MODE_NEW(ADDR_SURF_THICK_MICRO_TILING) |
1753+ SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_1));
1754+ break;
1755+ case 24:
1756+ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THICK) |
1757+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1758+ MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) |
1759+ SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_1));
1760+ break;
1761+ case 25:
1762+ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_XTHICK) |
1763+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1764+ MICRO_TILE_MODE_NEW(ADDR_SURF_THICK_MICRO_TILING) |
1765+ SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_1));
1766+ break;
1767+ case 26:
1768+ gb_tile_moden = (ARRAY_MODE(ARRAY_3D_TILED_XTHICK) |
1769+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1770+ MICRO_TILE_MODE_NEW(ADDR_SURF_THICK_MICRO_TILING) |
1771+ SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_1));
1772+ break;
1773+ case 27:
1774+ gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) |
1775+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1776+ MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) |
1777+ SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2));
1778+ break;
1779+ case 28:
1780+ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
1781+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1782+ MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) |
1783+ SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2));
1784+ break;
1785+ case 29:
1786+ gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) |
1787+ PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) |
1788+ MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) |
1789+ SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_8));
1790+ break;
1791+ case 30:
1792+ gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) |
1793+ PIPE_CONFIG(ADDR_SURF_P4_16x16) |
1794+ MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) |
1795+ SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_8));
1796+ break;
1797+ default:
1798+ gb_tile_moden = 0;
1799+ break;
1800+ }
1801+ adev->gfx.config.tile_mode_array[reg_offset] = gb_tile_moden;
1802+ WREG32(mmGB_TILE_MODE0 + reg_offset, gb_tile_moden);
1803+ }
1804+ for (reg_offset = 0; reg_offset < num_secondary_tile_mode_states; reg_offset++) {
1805+ switch (reg_offset) {
1806+ case 0:
1807+ gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
1808+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) |
1809+ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) |
1810+ NUM_BANKS(ADDR_SURF_8_BANK));
1811+ break;
1812+ case 1:
1813+ gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
1814+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) |
1815+ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) |
1816+ NUM_BANKS(ADDR_SURF_8_BANK));
1817+ break;
1818+ case 2:
1819+ gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
1820+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) |
1821+ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) |
1822+ NUM_BANKS(ADDR_SURF_8_BANK));
1823+ break;
1824+ case 3:
1825+ gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
1826+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) |
1827+ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) |
1828+ NUM_BANKS(ADDR_SURF_8_BANK));
1829+ break;
1830+ case 4:
1831+ gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
1832+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) |
1833+ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) |
1834+ NUM_BANKS(ADDR_SURF_8_BANK));
1835+ break;
1836+ case 5:
1837+ gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
1838+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) |
1839+ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) |
1840+ NUM_BANKS(ADDR_SURF_8_BANK));
1841+ break;
1842+ case 6:
1843+ gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
1844+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) |
1845+ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) |
1846+ NUM_BANKS(ADDR_SURF_8_BANK));
1847+ break;
1848+ case 8:
1849+ gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
1850+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_8) |
1851+ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) |
1852+ NUM_BANKS(ADDR_SURF_8_BANK));
1853+ break;
1854+ case 9:
1855+ gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
1856+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) |
1857+ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) |
1858+ NUM_BANKS(ADDR_SURF_8_BANK));
1859+ break;
1860+ case 10:
1861+ gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
1862+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) |
1863+ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) |
1864+ NUM_BANKS(ADDR_SURF_8_BANK));
1865+ break;
1866+ case 11:
1867+ gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
1868+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) |
1869+ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) |
1870+ NUM_BANKS(ADDR_SURF_8_BANK));
1871+ break;
1872+ case 12:
1873+ gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
1874+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) |
1875+ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) |
1876+ NUM_BANKS(ADDR_SURF_8_BANK));
1877+ break;
1878+ case 13:
1879+ gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
1880+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) |
1881+ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) |
1882+ NUM_BANKS(ADDR_SURF_8_BANK));
1883+ break;
1884+ case 14:
1885+ gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
1886+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) |
1887+ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) |
1888+ NUM_BANKS(ADDR_SURF_4_BANK));
1889+ break;
1890+ case 7:
1891+ /* unused idx */
1892+ continue;
1893+ default:
1894+ gb_tile_moden = 0;
1895+ break;
1896+ }
1897+ adev->gfx.config.macrotile_mode_array[reg_offset] = gb_tile_moden;
1898+ WREG32(mmGB_MACROTILE_MODE0 + reg_offset, gb_tile_moden);
1899+ }
1900+ break;
16161901 case CHIP_TONGA:
16171902 for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) {
16181903 switch (reg_offset) {
@@ -2971,10 +3256,13 @@ static int gfx_v8_0_cp_gfx_start(struct amdgpu_device *adev) · 1352 unmodified lines
29713256 amdgpu_ring_write(ring, mmPA_SC_RASTER_CONFIG - PACKET3_SET_CONTEXT_REG_START);
29723257 switch (adev->asic_type) {
29733258 case CHIP_TONGA:
2974− case CHIP_FIJI:
29753259 amdgpu_ring_write(ring, 0x16000012);
29763260 amdgpu_ring_write(ring, 0x0000002A);
29773261 break;
3262+ case CHIP_FIJI:
3263+ amdgpu_ring_write(ring, 0x3a00161a);
3264+ amdgpu_ring_write(ring, 0x0000002e);
3265+ break;
29783266 case CHIP_TOPAZ:
29793267 case CHIP_CARRIZO:
29803268 amdgpu_ring_write(ring, 0x00000002);
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c+5−8
@@ -40,7 +40,7 @@ · 39 unmodified lines
4040 static void gmc_v7_0_set_gart_funcs(struct amdgpu_device *adev);
4141 static void gmc_v7_0_set_irq_funcs(struct amdgpu_device *adev);
4242
43−MODULE_FIRMWARE("radeon/boniare_mc.bin");
43+MODULE_FIRMWARE("radeon/bonaire_mc.bin");
4444 MODULE_FIRMWARE("radeon/hawaii_mc.bin");
4545
4646 /**
@@ -501,6 +501,7 @@ static int gmc_v7_0_gart_enable(struct amdgpu_device *adev) · 454 unmodified lines
501501 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_PDE0_CACHE_LRU_UPDATE_BY_WRITE, 1);
502502 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, EFFECTIVE_L2_QUEUE_SIZE, 7);
503503 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, CONTEXT1_IDENTITY_ACCESS_MODE, 1);
504+ tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_DEFAULT_PAGE_OUT_TO_SYSTEM_MEMORY, 1);
504505 WREG32(mmVM_L2_CNTL, tmp);
505506 tmp = REG_SET_FIELD(0, VM_L2_CNTL2, INVALIDATE_ALL_L1_TLBS, 1);
506507 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL2, INVALIDATE_L2_CACHE, 1);
@@ -512,7 +513,7 @@ static int gmc_v7_0_gart_enable(struct amdgpu_device *adev) · 5 unmodified lines
512513 WREG32(mmVM_L2_CNTL3, tmp);
513514 /* setup context0 */
514515 WREG32(mmVM_CONTEXT0_PAGE_TABLE_START_ADDR, adev->mc.gtt_start >> 12);
515− WREG32(mmVM_CONTEXT0_PAGE_TABLE_END_ADDR, (adev->mc.gtt_end >> 12) - 1);
516+ WREG32(mmVM_CONTEXT0_PAGE_TABLE_END_ADDR, adev->mc.gtt_end >> 12);
516517 WREG32(mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR, adev->gart.table_addr >> 12);
517518 WREG32(mmVM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR,
518519 (u32)(adev->dummy_page.addr >> 12));
@@ -960,12 +961,10 @@ static int gmc_v7_0_sw_init(void *handle) · 441 unmodified lines
960961
961962 static int gmc_v7_0_sw_fini(void *handle)
962963 {
963− int i;
964964 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
965965
966966 if (adev->vm_manager.enabled) {
967− for (i = 0; i < AMDGPU_NUM_VM; ++i)
968− fence_put(adev->vm_manager.active[i]);
967+ amdgpu_vm_manager_fini(adev);
969968 gmc_v7_0_vm_fini(adev);
970969 adev->vm_manager.enabled = false;
971970 }
@@ -1010,12 +1009,10 @@ static int gmc_v7_0_hw_fini(void *handle) · 38 unmodified lines
10101009
10111010 static int gmc_v7_0_suspend(void *handle)
10121011 {
1013− int i;
10141012 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
10151013
10161014 if (adev->vm_manager.enabled) {
1017− for (i = 0; i < AMDGPU_NUM_VM; ++i)
1018− fence_put(adev->vm_manager.active[i]);
1015+ amdgpu_vm_manager_fini(adev);
10191016 gmc_v7_0_vm_fini(adev);
10201017 adev->vm_manager.enabled = false;
10211018 }
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c+4−7
@@ -629,6 +629,7 @@ static int gmc_v8_0_gart_enable(struct amdgpu_device *adev) · 628 unmodified lines
629629 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_PDE0_CACHE_LRU_UPDATE_BY_WRITE, 1);
630630 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, EFFECTIVE_L2_QUEUE_SIZE, 7);
631631 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, CONTEXT1_IDENTITY_ACCESS_MODE, 1);
632+ tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_DEFAULT_PAGE_OUT_TO_SYSTEM_MEMORY, 1);
632633 WREG32(mmVM_L2_CNTL, tmp);
633634 tmp = RREG32(mmVM_L2_CNTL2);
634635 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL2, INVALIDATE_ALL_L1_TLBS, 1);
@@ -656,7 +657,7 @@ static int gmc_v8_0_gart_enable(struct amdgpu_device *adev) · 21 unmodified lines
656657 WREG32(mmVM_L2_CNTL4, tmp);
657658 /* setup context0 */
658659 WREG32(mmVM_CONTEXT0_PAGE_TABLE_START_ADDR, adev->mc.gtt_start >> 12);
659− WREG32(mmVM_CONTEXT0_PAGE_TABLE_END_ADDR, (adev->mc.gtt_end >> 12) - 1);
660+ WREG32(mmVM_CONTEXT0_PAGE_TABLE_END_ADDR, adev->mc.gtt_end >> 12);
660661 WREG32(mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR, adev->gart.table_addr >> 12);
661662 WREG32(mmVM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR,
662663 (u32)(adev->dummy_page.addr >> 12));
@@ -979,12 +980,10 @@ static int gmc_v8_0_sw_init(void *handle) · 316 unmodified lines
979980
980981 static int gmc_v8_0_sw_fini(void *handle)
981982 {
982− int i;
983983 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
984984
985985 if (adev->vm_manager.enabled) {
986− for (i = 0; i < AMDGPU_NUM_VM; ++i)
987− fence_put(adev->vm_manager.active[i]);
986+ amdgpu_vm_manager_fini(adev);
988987 gmc_v8_0_vm_fini(adev);
989988 adev->vm_manager.enabled = false;
990989 }
@@ -1031,12 +1030,10 @@ static int gmc_v8_0_hw_fini(void *handle) · 40 unmodified lines
10311030
10321031 static int gmc_v8_0_suspend(void *handle)
10331032 {
1034− int i;
10351033 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
10361034
10371035 if (adev->vm_manager.enabled) {
1038− for (i = 0; i < AMDGPU_NUM_VM; ++i)
1039− fence_put(adev->vm_manager.active[i]);
1036+ amdgpu_vm_manager_fini(adev);
10401037 gmc_v8_0_vm_fini(adev);
10411038 adev->vm_manager.enabled = false;
10421039 }
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c+19−5
@@ -40,6 +40,9 @@ · 39 unmodified lines
4040
4141 #define GRBM_GFX_INDEX__VCE_INSTANCE__SHIFT 0x04
4242 #define GRBM_GFX_INDEX__VCE_INSTANCE_MASK 0x10
43+#define mmVCE_LMI_VCPU_CACHE_40BIT_BAR0 0x8616
44+#define mmVCE_LMI_VCPU_CACHE_40BIT_BAR1 0x8617
45+#define mmVCE_LMI_VCPU_CACHE_40BIT_BAR2 0x8618
4346
4447 #define VCE_V3_0_FW_SIZE (384 * 1024)
4548 #define VCE_V3_0_STACK_SIZE (64 * 1024)
@@ -130,9 +133,11 @@ static int vce_v3_0_start(struct amdgpu_device *adev) · 84 unmodified lines
130133
131134 /* set BUSY flag */
132135 WREG32_P(mmVCE_STATUS, 1, ~1);
133−
134− WREG32_P(mmVCE_VCPU_CNTL, VCE_VCPU_CNTL__CLK_EN_MASK,
135− ~VCE_VCPU_CNTL__CLK_EN_MASK);
136+ if (adev->asic_type >= CHIP_STONEY)
137+ WREG32_P(mmVCE_VCPU_CNTL, 1, ~0x200001);
138+ else
139+ WREG32_P(mmVCE_VCPU_CNTL, VCE_VCPU_CNTL__CLK_EN_MASK,
140+ ~VCE_VCPU_CNTL__CLK_EN_MASK);
136141
137142 WREG32_P(mmVCE_SOFT_RESET,
138143 VCE_SOFT_RESET__ECPU_SOFT_RESET_MASK,
@@ -391,8 +396,12 @@ static void vce_v3_0_mc_resume(struct amdgpu_device *adev, int idx) · 252 unmodified lines
391396 WREG32(mmVCE_LMI_SWAP_CNTL, 0);
392397 WREG32(mmVCE_LMI_SWAP_CNTL1, 0);
393398 WREG32(mmVCE_LMI_VM_CTRL, 0);
394−
395− WREG32(mmVCE_LMI_VCPU_CACHE_40BIT_BAR, (adev->vce.gpu_addr >> 8));
399+ if (adev->asic_type >= CHIP_STONEY) {
400+ WREG32(mmVCE_LMI_VCPU_CACHE_40BIT_BAR0, (adev->vce.gpu_addr >> 8));
401+ WREG32(mmVCE_LMI_VCPU_CACHE_40BIT_BAR1, (adev->vce.gpu_addr >> 8));
402+ WREG32(mmVCE_LMI_VCPU_CACHE_40BIT_BAR2, (adev->vce.gpu_addr >> 8));
403+ } else
404+ WREG32(mmVCE_LMI_VCPU_CACHE_40BIT_BAR, (adev->vce.gpu_addr >> 8));
396405 offset = AMDGPU_VCE_FIRMWARE_OFFSET;
397406 size = VCE_V3_0_FW_SIZE;
398407 WREG32(mmVCE_VCPU_CACHE_OFFSET0, offset & 0x7fffffff);
@@ -576,6 +585,11 @@ static int vce_v3_0_process_interrupt(struct amdgpu_device *adev, · 177 unmodified lines
576585 struct amdgpu_iv_entry *entry)
577586 {
578587 DRM_DEBUG("IH: VCE\n");
588+
589+ WREG32_P(mmVCE_SYS_INT_STATUS,
590+ VCE_SYS_INT_STATUS__VCE_SYS_INT_TRAP_INTERRUPT_INT_MASK,
591+ ~VCE_SYS_INT_STATUS__VCE_SYS_INT_TRAP_INTERRUPT_INT_MASK);
592+
579593 switch (entry->src_data) {
580594 case 0:
581595 amdgpu_fence_process(&adev->vce.ring[0]);
drivers/gpu/drm/amd/scheduler/gpu_sched_trace.h+21−3
@@ -16,6 +16,8 @@ TRACE_EVENT(amd_sched_job, · 15 unmodified lines
1616 TP_ARGS(sched_job),
1717 TP_STRUCT__entry(
1818 __field(struct amd_sched_entity *, entity)
19+ __field(struct amd_sched_job *, sched_job)
20+ __field(struct fence *, fence)
1921 __field(const char *, name)
2022 __field(u32, job_count)
2123 __field(int, hw_job_count)
@@ -23,16 +25,32 @@ TRACE_EVENT(amd_sched_job, · 1 unmodified line
2325
2426 TP_fast_assign(
2527 __entry->entity = sched_job->s_entity;
28+ __entry->sched_job = sched_job;
29+ __entry->fence = &sched_job->s_fence->base;
2630 __entry->name = sched_job->sched->name;
2731 __entry->job_count = kfifo_len(
2832 &sched_job->s_entity->job_queue) / sizeof(sched_job);
2933 __entry->hw_job_count = atomic_read(
3034 &sched_job->sched->hw_rq_count);
3135 ),
32− TP_printk("entity=%p, ring=%s, job count:%u, hw job count:%d",
33− __entry->entity, __entry->name, __entry->job_count,
34− __entry->hw_job_count)
36+ TP_printk("entity=%p, sched job=%p, fence=%p, ring=%s, job count:%u, hw job count:%d",
37+ __entry->entity, __entry->sched_job, __entry->fence, __entry->name,
38+ __entry->job_count, __entry->hw_job_count)
3539 );
40+
41+TRACE_EVENT(amd_sched_process_job,
42+ TP_PROTO(struct amd_sched_fence *fence),
43+ TP_ARGS(fence),
44+ TP_STRUCT__entry(
45+ __field(struct fence *, fence)
46+ ),
47+
48+ TP_fast_assign(
49+ __entry->fence = &fence->base;
50+ ),
51+ TP_printk("fence=%p signaled", __entry->fence)
52+);
53+
3654 #endif
3755
3856 /* This part must be outside protection */
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c+99−52
@@ -30,10 +30,12 @@ · 29 unmodified lines
3030 #define CREATE_TRACE_POINTS
3131 #include "gpu_sched_trace.h"
3232
33−static struct amd_sched_job *
34−amd_sched_entity_pop_job(struct amd_sched_entity *entity);
33+static bool amd_sched_entity_is_ready(struct amd_sched_entity *entity);
3534 static void amd_sched_wakeup(struct amd_gpu_scheduler *sched);
3635
36+struct kmem_cache *sched_fence_slab;
37+atomic_t sched_fence_slab_ref = ATOMIC_INIT(0);
38+
3739 /* Initialize a given run queue struct */
3840 static void amd_sched_rq_init(struct amd_sched_rq *rq)
3941 {
@@ -61,36 +63,36 @@ static void amd_sched_rq_remove_entity(struct amd_sched_rq *rq, · 21 unmodified lines
6163 }
6264
6365 /**
64− * Select next job from a specified run queue with round robin policy.
65− * Return NULL if nothing available.
66+ * Select an entity which could provide a job to run
67+ *
68+ * @rq The run queue to check.
69+ *
70+ * Try to find a ready entity, returns NULL if none found.
6671 */
67−static struct amd_sched_job *
68−amd_sched_rq_select_job(struct amd_sched_rq *rq)
72+static struct amd_sched_entity *
73+amd_sched_rq_select_entity(struct amd_sched_rq *rq)
6974 {
7075 struct amd_sched_entity *entity;
71− struct amd_sched_job *sched_job;
7276
7377 spin_lock(&rq->lock);
7478
7579 entity = rq->current_entity;
7680 if (entity) {
7781 list_for_each_entry_continue(entity, &rq->entities, list) {
78− sched_job = amd_sched_entity_pop_job(entity);
79− if (sched_job) {
82+ if (amd_sched_entity_is_ready(entity)) {
8083 rq->current_entity = entity;
8184 spin_unlock(&rq->lock);
82− return sched_job;
85+ return entity;
8386 }
8487 }
8588 }
8689
8790 list_for_each_entry(entity, &rq->entities, list) {
8891
89− sched_job = amd_sched_entity_pop_job(entity);
90− if (sched_job) {
92+ if (amd_sched_entity_is_ready(entity)) {
9193 rq->current_entity = entity;
9294 spin_unlock(&rq->lock);
93− return sched_job;
95+ return entity;
9496 }
9597
9698 if (entity == rq->current_entity)
@@ -173,6 +175,24 @@ static bool amd_sched_entity_is_idle(struct amd_sched_entity *entity) · 76 unmodified lines
173175 return false;
174176 }
175177
178+/**
179+ * Check if entity is ready
180+ *
181+ * @entity The pointer to a valid scheduler entity
182+ *
183+ * Return true if entity could provide a job.
184+ */
185+static bool amd_sched_entity_is_ready(struct amd_sched_entity *entity)
186+{
187+ if (kfifo_is_empty(&entity->job_queue))
188+ return false;
189+
190+ if (ACCESS_ONCE(entity->dependency))
191+ return false;
192+
193+ return true;
194+}
195+
176196 /**
177197 * Destroy a context entity
178198 *
@@ -208,32 +228,53 @@ static void amd_sched_entity_wakeup(struct fence *f, struct fence_cb *cb) · 29 unmodified lines
208228 amd_sched_wakeup(entity->sched);
209229 }
210230
231+static bool amd_sched_entity_add_dependency_cb(struct amd_sched_entity *entity)
232+{
233+ struct amd_gpu_scheduler *sched = entity->sched;
234+ struct fence * fence = entity->dependency;
235+ struct amd_sched_fence *s_fence;
236+
237+ if (fence->context == entity->fence_context) {
238+ /* We can ignore fences from ourself */
239+ fence_put(entity->dependency);
240+ return false;
241+ }
242+
243+ s_fence = to_amd_sched_fence(fence);
244+ if (s_fence && s_fence->sched == sched) {
245+ /* Fence is from the same scheduler */
246+ if (test_bit(AMD_SCHED_FENCE_SCHEDULED_BIT, &fence->flags)) {
247+ /* Ignore it when it is already scheduled */
248+ fence_put(entity->dependency);
249+ return false;
250+ }
251+
252+ /* Wait for fence to be scheduled */
253+ entity->cb.func = amd_sched_entity_wakeup;
254+ list_add_tail(&entity->cb.node, &s_fence->scheduled_cb);
255+ return true;
256+ }
257+
258+ if (!fence_add_callback(entity->dependency, &entity->cb,
259+ amd_sched_entity_wakeup))
260+ return true;
261+
262+ fence_put(entity->dependency);
263+ return false;
264+}
265+
211266 static struct amd_sched_job *
212267 amd_sched_entity_pop_job(struct amd_sched_entity *entity)
213268 {
214269 struct amd_gpu_scheduler *sched = entity->sched;
215270 struct amd_sched_job *sched_job;
216271
217− if (ACCESS_ONCE(entity->dependency))
218− return NULL;
219−
220272 if (!kfifo_out_peek(&entity->job_queue, &sched_job, sizeof(sched_job)))
221273 return NULL;
222274
223− while ((entity->dependency = sched->ops->dependency(sched_job))) {
224−
225− if (entity->dependency->context == entity->fence_context) {
226− /* We can ignore fences from ourself */
227− fence_put(entity->dependency);
228− continue;
229− }
230−
231− if (fence_add_callback(entity->dependency, &entity->cb,
232− amd_sched_entity_wakeup))
233− fence_put(entity->dependency);
234− else
275+ while ((entity->dependency = sched->ops->dependency(sched_job)))
276+ if (amd_sched_entity_add_dependency_cb(entity))
235277 return NULL;
236− }
237278
238279 return sched_job;
239280 }
@@ -247,6 +288,7 @@ amd_sched_entity_pop_job(struct amd_sched_entity *entity) · 7 unmodified lines
247288 */
248289 static bool amd_sched_entity_in(struct amd_sched_job *sched_job)
249290 {
291+ struct amd_gpu_scheduler *sched = sched_job->sched;
250292 struct amd_sched_entity *entity = sched_job->s_entity;
251293 bool added, first = false;
252294
@@ -261,7 +303,7 @@ static bool amd_sched_entity_in(struct amd_sched_job *sched_job) · 8 unmodified lines
261303
262304 /* first job wakes up scheduler */
263305 if (first)
264− amd_sched_wakeup(sched_job->sched);
306+ amd_sched_wakeup(sched);
265307
266308 return added;
267309 }
@@ -273,22 +315,13 @@ static bool amd_sched_entity_in(struct amd_sched_job *sched_job) · 5 unmodified lines
273315 *
274316 * Returns 0 for success, negative error code otherwise.
275317 */
276−int amd_sched_entity_push_job(struct amd_sched_job *sched_job)
318+void amd_sched_entity_push_job(struct amd_sched_job *sched_job)
277319 {
278320 struct amd_sched_entity *entity = sched_job->s_entity;
279− struct amd_sched_fence *fence = amd_sched_fence_create(
280− entity, sched_job->owner);
281−
282− if (!fence)
283− return -ENOMEM;
284−
285− fence_get(&fence->base);
286− sched_job->s_fence = fence;
287321
322+ trace_amd_sched_job(sched_job);
288323 wait_event(entity->sched->job_scheduled,
289324 amd_sched_entity_in(sched_job));
290− trace_amd_sched_job(sched_job);
291− return 0;
292325 }
293326
294327 /**
@@ -310,22 +343,22 @@ static void amd_sched_wakeup(struct amd_gpu_scheduler *sched) · 15 unmodified lines
310343 }
311344
312345 /**
313− * Select next to run
346+ * Select next entity to process
314347 */
315−static struct amd_sched_job *
316−amd_sched_select_job(struct amd_gpu_scheduler *sched)
348+static struct amd_sched_entity *
349+amd_sched_select_entity(struct amd_gpu_scheduler *sched)
317350 {
318− struct amd_sched_job *sched_job;
351+ struct amd_sched_entity *entity;
319352
320353 if (!amd_sched_ready(sched))
321354 return NULL;
322355
323356 /* Kernel run queue has higher priority than normal run queue*/
324− sched_job = amd_sched_rq_select_job(&sched->kernel_rq);
325− if (sched_job == NULL)
326− sched_job = amd_sched_rq_select_job(&sched->sched_rq);
357+ entity = amd_sched_rq_select_entity(&sched->kernel_rq);
358+ if (entity == NULL)
359+ entity = amd_sched_rq_select_entity(&sched->sched_rq);
327360
328− return sched_job;
361+ return entity;
329362 }
330363
331364 static void amd_sched_process_job(struct fence *f, struct fence_cb *cb)
@@ -343,6 +376,7 @@ static void amd_sched_process_job(struct fence *f, struct fence_cb *cb) · 11 unmodified lines
343376 list_del_init(&s_fence->list);
344377 spin_unlock_irqrestore(&sched->fence_list_lock, flags);
345378 }
379+ trace_amd_sched_process_job(s_fence);
346380 fence_put(&s_fence->base);
347381 wake_up_interruptible(&sched->wake_up_worker);
348382 }
@@ -386,13 +420,16 @@ static int amd_sched_main(void *param) · 37 unmodified lines
386420 unsigned long flags;
387421
388422 wait_event_interruptible(sched->wake_up_worker,
389− kthread_should_stop() ||
390− (sched_job = amd_sched_select_job(sched)));
423+ (entity = amd_sched_select_entity(sched)) ||
424+ kthread_should_stop());
391425
426+ if (!entity)
427+ continue;
428+
429+ sched_job = amd_sched_entity_pop_job(entity);
392430 if (!sched_job)
393431 continue;
394432
395− entity = sched_job->s_entity;
396433 s_fence = sched_job->s_fence;
397434
398435 if (sched->timeout != MAX_SCHEDULE_TIMEOUT) {
@@ -405,6 +442,7 @@ static int amd_sched_main(void *param) · 6 unmodified lines
405442
406443 atomic_inc(&sched->hw_rq_count);
407444 fence = sched->ops->run_job(sched_job);
445+ amd_sched_fence_scheduled(s_fence);
408446 if (fence) {
409447 r = fence_add_callback(fence, &s_fence->cb,
410448 amd_sched_process_job);
@@ -450,6 +488,13 @@ int amd_sched_init(struct amd_gpu_scheduler *sched, · 39 unmodified lines
450488 init_waitqueue_head(&sched->wake_up_worker);
451489 init_waitqueue_head(&sched->job_scheduled);
452490 atomic_set(&sched->hw_rq_count, 0);
491+ if (atomic_inc_return(&sched_fence_slab_ref) == 1) {
492+ sched_fence_slab = kmem_cache_create(
493+ "amd_sched_fence", sizeof(struct amd_sched_fence), 0,
494+ SLAB_HWCACHE_ALIGN, NULL);
495+ if (!sched_fence_slab)
496+ return -ENOMEM;
497+ }
453498
454499 /* Each scheduler will run on a seperate kernel thread */
455500 sched->thread = kthread_run(amd_sched_main, sched, sched->name);
@@ -470,4 +515,6 @@ void amd_sched_fini(struct amd_gpu_scheduler *sched) · 14 unmodified lines
470515 {
471516 if (sched->thread)
472517 kthread_stop(sched->thread);
518+ if (atomic_dec_and_test(&sched_fence_slab_ref))
519+ kmem_cache_destroy(sched_fence_slab);
473520 }
drivers/gpu/drm/amd/scheduler/gpu_scheduler.h+8−3
@@ -27,9 +27,14 @@ · 26 unmodified lines
2727 #include <linux/kfifo.h>
2828 #include <linux/fence.h>
2929
30+#define AMD_SCHED_FENCE_SCHEDULED_BIT FENCE_FLAG_USER_BITS
31+
3032 struct amd_gpu_scheduler;
3133 struct amd_sched_rq;
3234
35+extern struct kmem_cache *sched_fence_slab;
36+extern atomic_t sched_fence_slab_ref;
37+
3338 /**
3439 * A scheduler entity is a wrapper around a job queue or a group
3540 * of other entities. Entities take turns emitting jobs from their
@@ -65,6 +70,7 @@ struct amd_sched_rq { · 29 unmodified lines
6570 struct amd_sched_fence {
6671 struct fence base;
6772 struct fence_cb cb;
73+ struct list_head scheduled_cb;
6874 struct amd_gpu_scheduler *sched;
6975 spinlock_t lock;
7076 void *owner;
@@ -76,7 +82,6 @@ struct amd_sched_job { · 5 unmodified lines
7682 struct amd_gpu_scheduler *sched;
7783 struct amd_sched_entity *s_entity;
7884 struct amd_sched_fence *s_fence;
79− void *owner;
8085 };
8186
8287 extern const struct fence_ops amd_sched_fence_ops;
@@ -128,11 +133,11 @@ int amd_sched_entity_init(struct amd_gpu_scheduler *sched, · 45 unmodified lines
128133 uint32_t jobs);
129134 void amd_sched_entity_fini(struct amd_gpu_scheduler *sched,
130135 struct amd_sched_entity *entity);
131−int amd_sched_entity_push_job(struct amd_sched_job *sched_job);
136+void amd_sched_entity_push_job(struct amd_sched_job *sched_job);
132137
133138 struct amd_sched_fence *amd_sched_fence_create(
134139 struct amd_sched_entity *s_entity, void *owner);
140+void amd_sched_fence_scheduled(struct amd_sched_fence *fence);
135141 void amd_sched_fence_signal(struct amd_sched_fence *fence);
136142
137−
138143 #endif
drivers/gpu/drm/amd/scheduler/sched_fence.c+21−2
@@ -32,9 +32,11 @@ struct amd_sched_fence *amd_sched_fence_create(struct amd_sched_entity *s_entity · 31 unmodified lines
3232 struct amd_sched_fence *fence = NULL;
3333 unsigned seq;
3434
35− fence = kzalloc(sizeof(struct amd_sched_fence), GFP_KERNEL);
35+ fence = kmem_cache_zalloc(sched_fence_slab, GFP_KERNEL);
3636 if (fence == NULL)
3737 return NULL;
38+
39+ INIT_LIST_HEAD(&fence->scheduled_cb);
3840 fence->owner = owner;
3941 fence->sched = s_entity->sched;
4042 spin_lock_init(&fence->lock);
@@ -55,6 +57,17 @@ void amd_sched_fence_signal(struct amd_sched_fence *fence) · 14 unmodified lines
5557 FENCE_TRACE(&fence->base, "was already signaled\n");
5658 }
5759
60+void amd_sched_fence_scheduled(struct amd_sched_fence *s_fence)
61+{
62+ struct fence_cb *cur, *tmp;
63+
64+ set_bit(AMD_SCHED_FENCE_SCHEDULED_BIT, &s_fence->base.flags);
65+ list_for_each_entry_safe(cur, tmp, &s_fence->scheduled_cb, node) {
66+ list_del_init(&cur->node);
67+ cur->func(&s_fence->base, cur);
68+ }
69+}
70+
5871 static const char *amd_sched_fence_get_driver_name(struct fence *fence)
5972 {
6073 return "amd_sched";
@@ -71,11 +84,17 @@ static bool amd_sched_fence_enable_signaling(struct fence *f) · 10 unmodified lines
7184 return true;
7285 }
7386
87+static void amd_sched_fence_release(struct fence *f)
88+{
89+ struct amd_sched_fence *fence = to_amd_sched_fence(f);
90+ kmem_cache_free(sched_fence_slab, fence);
91+}
92+
7493 const struct fence_ops amd_sched_fence_ops = {
7594 .get_driver_name = amd_sched_fence_get_driver_name,
7695 .get_timeline_name = amd_sched_fence_get_timeline_name,
7796 .enable_signaling = amd_sched_fence_enable_signaling,
7897 .signaled = NULL,
7998 .wait = fence_default_wait,
80− .release = NULL,
99+ .release = amd_sched_fence_release,
81100 };
drivers/gpu/drm/drm_atomic.c+42−19
@@ -1432,6 +1432,45 @@ static int atomic_set_prop(struct drm_atomic_state *state, · 1431 unmodified lines
14321432 return ret;
14331433 }
14341434
1435+/**
1436+ * drm_atomic_update_old_fb -- Unset old_fb pointers and set plane->fb pointers.
1437+ *
1438+ * @dev: drm device to check.
1439+ * @plane_mask: plane mask for planes that were updated.
1440+ * @ret: return value, can be -EDEADLK for a retry.
1441+ *
1442+ * Before doing an update plane->old_fb is set to plane->fb,
1443+ * but before dropping the locks old_fb needs to be set to NULL
1444+ * and plane->fb updated. This is a common operation for each
1445+ * atomic update, so this call is split off as a helper.
1446+ */
1447+void drm_atomic_clean_old_fb(struct drm_device *dev,
1448+ unsigned plane_mask,
1449+ int ret)
1450+{
1451+ struct drm_plane *plane;
1452+
1453+ /* if succeeded, fixup legacy plane crtc/fb ptrs before dropping
1454+ * locks (ie. while it is still safe to deref plane->state). We
1455+ * need to do this here because the driver entry points cannot
1456+ * distinguish between legacy and atomic ioctls.
1457+ */
1458+ drm_for_each_plane_mask(plane, dev, plane_mask) {
1459+ if (ret == 0) {
1460+ struct drm_framebuffer *new_fb = plane->state->fb;
1461+ if (new_fb)
1462+ drm_framebuffer_reference(new_fb);
1463+ plane->fb = new_fb;
1464+ plane->crtc = plane->state->crtc;
1465+
1466+ if (plane->old_fb)
1467+ drm_framebuffer_unreference(plane->old_fb);
1468+ }
1469+ plane->old_fb = NULL;
1470+ }
1471+}
1472+EXPORT_SYMBOL(drm_atomic_clean_old_fb);
1473+
14351474 int drm_mode_atomic_ioctl(struct drm_device *dev,
14361475 void *data, struct drm_file *file_priv)
14371476 {
@@ -1446,7 +1485,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, · 8 unmodified lines
14461485 struct drm_plane *plane;
14471486 struct drm_crtc *crtc;
14481487 struct drm_crtc_state *crtc_state;
1449− unsigned plane_mask = 0;
1488+ unsigned plane_mask;
14501489 int ret = 0;
14511490 unsigned int i, j;
14521491
@@ -1486,6 +1525,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, · 33 unmodified lines
14861525 state->allow_modeset = !!(arg->flags & DRM_MODE_ATOMIC_ALLOW_MODESET);
14871526
14881527 retry:
1528+ plane_mask = 0;
14891529 copied_objs = 0;
14901530 copied_props = 0;
14911531
@@ -1576,24 +1616,7 @@ retry: · 84 unmodified lines
15761616 }
15771617
15781618 out:
1579− /* if succeeded, fixup legacy plane crtc/fb ptrs before dropping
1580− * locks (ie. while it is still safe to deref plane->state). We
1581− * need to do this here because the driver entry points cannot
1582− * distinguish between legacy and atomic ioctls.
1583− */
1584− drm_for_each_plane_mask(plane, dev, plane_mask) {
1585− if (ret == 0) {
1586− struct drm_framebuffer *new_fb = plane->state->fb;
1587− if (new_fb)
1588− drm_framebuffer_reference(new_fb);
1589− plane->fb = new_fb;
1590− plane->crtc = plane->state->crtc;
1591−
1592− if (plane->old_fb)
1593− drm_framebuffer_unreference(plane->old_fb);
1594− }
1595− plane->old_fb = NULL;
1596− }
1619+ drm_atomic_clean_old_fb(dev, plane_mask, ret);
15971620
15981621 if (ret && arg->flags & DRM_MODE_PAGE_FLIP_EVENT) {
15991622 /*
drivers/gpu/drm/drm_atomic_helper.c+20−9
@@ -210,6 +210,14 @@ update_connector_routing(struct drm_atomic_state *state, int conn_idx) · 209 unmodified lines
210210 return -EINVAL;
211211 }
212212
213+ if (!drm_encoder_crtc_ok(new_encoder, connector_state->crtc)) {
214+ DRM_DEBUG_ATOMIC("[ENCODER:%d:%s] incompatible with [CRTC:%d]\n",
215+ new_encoder->base.id,
216+ new_encoder->name,
217+ connector_state->crtc->base.id);
218+ return -EINVAL;
219+ }
220+
213221 if (new_encoder == connector_state->best_encoder) {
214222 DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] keeps [ENCODER:%d:%s], now on [CRTC:%d]\n",
215223 connector->base.id,
@@ -1553,6 +1561,9 @@ retry: · 1337 unmodified lines
15531561 goto fail;
15541562 }
15551563
1564+ if (plane_state->crtc && (plane == plane->crtc->cursor))
1565+ plane_state->state->legacy_cursor_update = true;
1566+
15561567 ret = __drm_atomic_helper_disable_plane(plane, plane_state);
15571568 if (ret != 0)
15581569 goto fail;
@@ -1605,9 +1616,6 @@ int __drm_atomic_helper_disable_plane(struct drm_plane *plane, · 46 unmodified lines
16051616 plane_state->src_h = 0;
16061617 plane_state->src_w = 0;
16071618
1608− if (plane->crtc && (plane == plane->crtc->cursor))
1609− plane_state->state->legacy_cursor_update = true;
1610−
16111619 return 0;
16121620 }
16131621
@@ -1741,6 +1749,7 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set, · 127 unmodified lines
17411749 struct drm_crtc_state *crtc_state;
17421750 struct drm_plane_state *primary_state;
17431751 struct drm_crtc *crtc = set->crtc;
1752+ int hdisplay, vdisplay;
17441753 int ret;
17451754
17461755 crtc_state = drm_atomic_get_crtc_state(state, crtc);
@@ -1783,19 +1792,21 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set, · 36 unmodified lines
17831792 if (ret != 0)
17841793 return ret;
17851794
1795+ drm_crtc_get_hv_timing(set->mode, &hdisplay, &vdisplay);
1796+
17861797 drm_atomic_set_fb_for_plane(primary_state, set->fb);
17871798 primary_state->crtc_x = 0;
17881799 primary_state->crtc_y = 0;
1789− primary_state->crtc_h = set->mode->vdisplay;
1790− primary_state->crtc_w = set->mode->hdisplay;
1800+ primary_state->crtc_h = vdisplay;
1801+ primary_state->crtc_w = hdisplay;
17911802 primary_state->src_x = set->x << 16;
17921803 primary_state->src_y = set->y << 16;
17931804 if (primary_state->rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
1794− primary_state->src_h = set->mode->hdisplay << 16;
1795− primary_state->src_w = set->mode->vdisplay << 16;
1805+ primary_state->src_h = hdisplay << 16;
1806+ primary_state->src_w = vdisplay << 16;
17961807 } else {
1797− primary_state->src_h = set->mode->vdisplay << 16;
1798− primary_state->src_w = set->mode->hdisplay << 16;
1808+ primary_state->src_h = vdisplay << 16;
1809+ primary_state->src_w = hdisplay << 16;
17991810 }
18001811
18011812 commit:
drivers/gpu/drm/drm_drv.c+5−0
@@ -160,6 +160,11 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data, · 159 unmodified lines
160160 goto out_unlock;
161161 }
162162
163+ if (!file_priv->allowed_master) {
164+ ret = drm_new_set_master(dev, file_priv);
165+ goto out_unlock;
166+ }
167+
163168 file_priv->minor->master = drm_master_get(file_priv->master);
164169 file_priv->is_master = 1;
165170 if (dev->driver->master_set) {
drivers/gpu/drm/drm_fb_helper.c+14−37
@@ -342,6 +342,7 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper) · 341 unmodified lines
342342 struct drm_plane *plane;
343343 struct drm_atomic_state *state;
344344 int i, ret;
345+ unsigned plane_mask;
345346
346347 state = drm_atomic_state_alloc(dev);
347348 if (!state)
@@ -349,11 +350,10 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper) · 1 unmodified line
349350
350351 state->acquire_ctx = dev->mode_config.acquire_ctx;
351352 retry:
353+ plane_mask = 0;
352354 drm_for_each_plane(plane, dev) {
353355 struct drm_plane_state *plane_state;
354356
355− plane->old_fb = plane->fb;
356−
357357 plane_state = drm_atomic_get_plane_state(state, plane);
358358 if (IS_ERR(plane_state)) {
359359 ret = PTR_ERR(plane_state);
@@ -362,6 +362,9 @@ retry: · 2 unmodified lines
362362
363363 plane_state->rotation = BIT(DRM_ROTATE_0);
364364
365+ plane->old_fb = plane->fb;
366+ plane_mask |= 1 << drm_plane_index(plane);
367+
365368 /* disable non-primary: */
366369 if (plane->type == DRM_PLANE_TYPE_PRIMARY)
367370 continue;
@@ -382,19 +385,7 @@ retry: · 14 unmodified lines
382385 ret = drm_atomic_commit(state);
383386
384387 fail:
385− drm_for_each_plane(plane, dev) {
386− if (ret == 0) {
387− struct drm_framebuffer *new_fb = plane->state->fb;
388− if (new_fb)
389− drm_framebuffer_reference(new_fb);
390− plane->fb = new_fb;
391− plane->crtc = plane->state->crtc;
392−
393− if (plane->old_fb)
394− drm_framebuffer_unreference(plane->old_fb);
395− }
396− plane->old_fb = NULL;
397− }
388+ drm_atomic_clean_old_fb(dev, plane_mask, ret);
398389
399390 if (ret == -EDEADLK)
400391 goto backoff;
@@ -1236,7 +1227,9 @@ static int pan_display_atomic(struct fb_var_screeninfo *var, · 835 unmodified lines
12361227 struct drm_fb_helper *fb_helper = info->par;
12371228 struct drm_device *dev = fb_helper->dev;
12381229 struct drm_atomic_state *state;
1230+ struct drm_plane *plane;
12391231 int i, ret;
1232+ unsigned plane_mask;
12401233
12411234 state = drm_atomic_state_alloc(dev);
12421235 if (!state)
@@ -1244,19 +1237,22 @@ static int pan_display_atomic(struct fb_var_screeninfo *var, · 1 unmodified line
12441237
12451238 state->acquire_ctx = dev->mode_config.acquire_ctx;
12461239 retry:
1240+ plane_mask = 0;
12471241 for(i = 0; i < fb_helper->crtc_count; i++) {
12481242 struct drm_mode_set *mode_set;
12491243
12501244 mode_set = &fb_helper->crtc_info[i].mode_set;
12511245
1252− mode_set->crtc->primary->old_fb = mode_set->crtc->primary->fb;
1253−
12541246 mode_set->x = var->xoffset;
12551247 mode_set->y = var->yoffset;
12561248
12571249 ret = __drm_atomic_helper_set_config(mode_set, state);
12581250 if (ret != 0)
12591251 goto fail;
1252+
1253+ plane = mode_set->crtc->primary;
1254+ plane_mask |= drm_plane_index(plane);
1255+ plane->old_fb = plane->fb;
12601256 }
12611257
12621258 ret = drm_atomic_commit(state);
@@ -1268,26 +1264,7 @@ retry: · 5 unmodified lines
12681264
12691265
12701266 fail:
1271− for(i = 0; i < fb_helper->crtc_count; i++) {
1272− struct drm_mode_set *mode_set;
1273− struct drm_plane *plane;
1274−
1275− mode_set = &fb_helper->crtc_info[i].mode_set;
1276− plane = mode_set->crtc->primary;
1277−
1278− if (ret == 0) {
1279− struct drm_framebuffer *new_fb = plane->state->fb;
1280−
1281− if (new_fb)
1282− drm_framebuffer_reference(new_fb);
1283− plane->fb = new_fb;
1284− plane->crtc = plane->state->crtc;
1285−
1286− if (plane->old_fb)
1287− drm_framebuffer_unreference(plane->old_fb);
1288− }
1289− plane->old_fb = NULL;
1290− }
1267+ drm_atomic_clean_old_fb(dev, plane_mask, ret);
12911268
12921269 if (ret == -EDEADLK)
12931270 goto backoff;
drivers/gpu/drm/drm_fops.c+56−28
@@ -125,6 +125,60 @@ static int drm_cpu_valid(void) · 124 unmodified lines
125125 return 1;
126126 }
127127
128+/**
129+ * drm_new_set_master - Allocate a new master object and become master for the
130+ * associated master realm.
131+ *
132+ * @dev: The associated device.
133+ * @fpriv: File private identifying the client.
134+ *
135+ * This function must be called with dev::struct_mutex held.
136+ * Returns negative error code on failure. Zero on success.
137+ */
138+int drm_new_set_master(struct drm_device *dev, struct drm_file *fpriv)
139+{
140+ struct drm_master *old_master;
141+ int ret;
142+
143+ lockdep_assert_held_once(&dev->master_mutex);
144+
145+ /* create a new master */
146+ fpriv->minor->master = drm_master_create(fpriv->minor);
147+ if (!fpriv->minor->master)
148+ return -ENOMEM;
149+
150+ /* take another reference for the copy in the local file priv */
151+ old_master = fpriv->master;
152+ fpriv->master = drm_master_get(fpriv->minor->master);
153+
154+ if (dev->driver->master_create) {
155+ ret = dev->driver->master_create(dev, fpriv->master);
156+ if (ret)
157+ goto out_err;
158+ }
159+ if (dev->driver->master_set) {
160+ ret = dev->driver->master_set(dev, fpriv, true);
161+ if (ret)
162+ goto out_err;
163+ }
164+
165+ fpriv->is_master = 1;
166+ fpriv->allowed_master = 1;
167+ fpriv->authenticated = 1;
168+ if (old_master)
169+ drm_master_put(&old_master);
170+
171+ return 0;
172+
173+out_err:
174+ /* drop both references and restore old master on failure */
175+ drm_master_put(&fpriv->minor->master);
176+ drm_master_put(&fpriv->master);
177+ fpriv->master = old_master;
178+
179+ return ret;
180+}
181+
128182 /**
129183 * Called whenever a process opens /dev/drm.
130184 *
@@ -189,35 +243,9 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor) · 58 unmodified lines
189243 mutex_lock(&dev->master_mutex);
190244 if (drm_is_primary_client(priv) && !priv->minor->master) {
191245 /* create a new master */
192− priv->minor->master = drm_master_create(priv->minor);
193− if (!priv->minor->master) {
194− ret = -ENOMEM;
246+ ret = drm_new_set_master(dev, priv);
247+ if (ret)
195248 goto out_close;
196− }
197−
198− priv->is_master = 1;
199− /* take another reference for the copy in the local file priv */
200− priv->master = drm_master_get(priv->minor->master);
201− priv->authenticated = 1;
202−
203− if (dev->driver->master_create) {
204− ret = dev->driver->master_create(dev, priv->master);
205− if (ret) {
206− /* drop both references if this fails */
207− drm_master_put(&priv->minor->master);
208− drm_master_put(&priv->master);
209− goto out_close;
210− }
211− }
212− if (dev->driver->master_set) {
213− ret = dev->driver->master_set(dev, priv, true);
214− if (ret) {
215− /* drop both references if this fails */
216− drm_master_put(&priv->minor->master);
217− drm_master_put(&priv->master);
218− goto out_close;
219− }
220− }
221249 } else if (drm_is_primary_client(priv)) {
222250 /* get a reference to the master */
223251 priv->master = drm_master_get(priv->minor->master);
drivers/gpu/drm/drm_irq.c+53−1
@@ -980,7 +980,8 @@ static void send_vblank_event(struct drm_device *dev, · 979 unmodified lines
980980 struct drm_pending_vblank_event *e,
981981 unsigned long seq, struct timeval *now)
982982 {
983− WARN_ON_SMP(!spin_is_locked(&dev->event_lock));
983+ assert_spin_locked(&dev->event_lock);
984+
984985 e->event.sequence = seq;
985986 e->event.tv_sec = now->tv_sec;
986987 e->event.tv_usec = now->tv_usec;
@@ -992,6 +993,57 @@ static void send_vblank_event(struct drm_device *dev, · 5 unmodified lines
992993 e->event.sequence);
993994 }
994995
996+/**
997+ * drm_arm_vblank_event - arm vblank event after pageflip
998+ * @dev: DRM device
999+ * @pipe: CRTC index
1000+ * @e: the event to prepare to send
1001+ *
1002+ * A lot of drivers need to generate vblank events for the very next vblank
1003+ * interrupt. For example when the page flip interrupt happens when the page
1004+ * flip gets armed, but not when it actually executes within the next vblank
1005+ * period. This helper function implements exactly the required vblank arming
1006+ * behaviour.
1007+ *
1008+ * Caller must hold event lock. Caller must also hold a vblank reference for
1009+ * the event @e, which will be dropped when the next vblank arrives.
1010+ *
1011+ * This is the legacy version of drm_crtc_arm_vblank_event().
1012+ */
1013+void drm_arm_vblank_event(struct drm_device *dev, unsigned int pipe,
1014+ struct drm_pending_vblank_event *e)
1015+{
1016+ assert_spin_locked(&dev->event_lock);
1017+
1018+ e->pipe = pipe;
1019+ e->event.sequence = drm_vblank_count(dev, pipe);
1020+ list_add_tail(&e->base.link, &dev->vblank_event_list);
1021+}
1022+EXPORT_SYMBOL(drm_arm_vblank_event);
1023+
1024+/**
1025+ * drm_crtc_arm_vblank_event - arm vblank event after pageflip
1026+ * @crtc: the source CRTC of the vblank event
1027+ * @e: the event to send
1028+ *
1029+ * A lot of drivers need to generate vblank events for the very next vblank
1030+ * interrupt. For example when the page flip interrupt happens when the page
1031+ * flip gets armed, but not when it actually executes within the next vblank
1032+ * period. This helper function implements exactly the required vblank arming
1033+ * behaviour.
1034+ *
1035+ * Caller must hold event lock. Caller must also hold a vblank reference for
1036+ * the event @e, which will be dropped when the next vblank arrives.
1037+ *
1038+ * This is the native KMS version of drm_arm_vblank_event().
1039+ */
1040+void drm_crtc_arm_vblank_event(struct drm_crtc *crtc,
1041+ struct drm_pending_vblank_event *e)
1042+{
1043+ drm_arm_vblank_event(crtc->dev, drm_crtc_index(crtc), e);
1044+}
1045+EXPORT_SYMBOL(drm_crtc_arm_vblank_event);
1046+
9951047 /**
9961048 * drm_send_vblank_event - helper to send vblank event after pageflip
9971049 * @dev: DRM device
drivers/gpu/drm/i915/i915_debugfs.c+2−0
@@ -2734,6 +2734,8 @@ static const char *power_domain_str(enum intel_display_power_domain domain) · 2733 unmodified lines
27342734 return "AUX_C";
27352735 case POWER_DOMAIN_AUX_D:
27362736 return "AUX_D";
2737+ case POWER_DOMAIN_GMBUS:
2738+ return "GMBUS";
27372739 case POWER_DOMAIN_INIT:
27382740 return "INIT";
27392741 default:
drivers/gpu/drm/i915/i915_drv.h+5−0
@@ -199,6 +199,7 @@ enum intel_display_power_domain { · 198 unmodified lines
199199 POWER_DOMAIN_AUX_B,
200200 POWER_DOMAIN_AUX_C,
201201 POWER_DOMAIN_AUX_D,
202+ POWER_DOMAIN_GMBUS,
202203 POWER_DOMAIN_INIT,
203204
204205 POWER_DOMAIN_NUM,
@@ -351,6 +352,8 @@ enum intel_dpll_id { · 146 unmodified lines
351352 /* hsw/bdw */
352353 DPLL_ID_WRPLL1 = 0,
353354 DPLL_ID_WRPLL2 = 1,
355+ DPLL_ID_SPLL = 2,
356+
354357 /* skl */
355358 DPLL_ID_SKL_DPLL1 = 0,
356359 DPLL_ID_SKL_DPLL2 = 1,
@@ -367,6 +370,7 @@ struct intel_dpll_hw_state { · 10 unmodified lines
367370
368371 /* hsw, bdw */
369372 uint32_t wrpll;
373+ uint32_t spll;
370374
371375 /* skl */
372376 /*
@@ -2648,6 +2652,7 @@ struct i915_params { · 2275 unmodified lines
26482652 int enable_cmd_parser;
26492653 /* leave bools at the end to not create holes */
26502654 bool enable_hangcheck;
2655+ bool fastboot;
26512656 bool prefault_disable;
26522657 bool load_detect_test;
26532658 bool reset;
drivers/gpu/drm/i915/i915_gem.c+17−3
@@ -1210,8 +1210,16 @@ int __i915_wait_request(struct drm_i915_gem_request *req, · 1209 unmodified lines
12101210 if (i915_gem_request_completed(req, true))
12111211 return 0;
12121212
1213− timeout_expire = timeout ?
1214− jiffies + nsecs_to_jiffies_timeout((u64)*timeout) : 0;
1213+ timeout_expire = 0;
1214+ if (timeout) {
1215+ if (WARN_ON(*timeout < 0))
1216+ return -EINVAL;
1217+
1218+ if (*timeout == 0)
1219+ return -ETIME;
1220+
1221+ timeout_expire = jiffies + nsecs_to_jiffies_timeout(*timeout);
1222+ }
12151223
12161224 if (INTEL_INFO(dev_priv)->gen >= 6)
12171225 gen6_rps_boost(dev_priv, rps, req->emitted_jiffies);
@@ -3809,6 +3817,7 @@ int i915_gem_get_caching_ioctl(struct drm_device *dev, void *data, · 2591 unmodified lines
38093817 int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,
38103818 struct drm_file *file)
38113819 {
3820+ struct drm_i915_private *dev_priv = dev->dev_private;
38123821 struct drm_i915_gem_caching *args = data;
38133822 struct drm_i915_gem_object *obj;
38143823 enum i915_cache_level level;
@@ -3837,9 +3846,11 @@ int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data, · 22 unmodified lines
38373846 return -EINVAL;
38383847 }
38393848
3849+ intel_runtime_pm_get(dev_priv);
3850+
38403851 ret = i915_mutex_lock_interruptible(dev);
38413852 if (ret)
3842− return ret;
3853+ goto rpm_put;
38433854
38443855 obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle));
38453856 if (&obj->base == NULL) {
@@ -3852,6 +3863,9 @@ int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data, · 6 unmodified lines
38523863 drm_gem_object_unreference(&obj->base);
38533864 unlock:
38543865 mutex_unlock(&dev->struct_mutex);
3866+rpm_put:
3867+ intel_runtime_pm_put(dev_priv);
3868+
38553869 return ret;
38563870 }
38573871
drivers/gpu/drm/i915/i915_gem_fence.c+27−9
@@ -642,11 +642,10 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev) · 641 unmodified lines
642642 }
643643
644644 /* check for L-shaped memory aka modified enhanced addressing */
645− if (IS_GEN4(dev)) {
646− uint32_t ddc2 = I915_READ(DCC2);
647−
648− if (!(ddc2 & DCC2_MODIFIED_ENHANCED_DISABLE))
649− dev_priv->quirks |= QUIRK_PIN_SWIZZLED_PAGES;
645+ if (IS_GEN4(dev) &&
646+ !(I915_READ(DCC2) & DCC2_MODIFIED_ENHANCED_DISABLE)) {
647+ swizzle_x = I915_BIT_6_SWIZZLE_UNKNOWN;
648+ swizzle_y = I915_BIT_6_SWIZZLE_UNKNOWN;
650649 }
651650
652651 if (dcc == 0xffffffff) {
@@ -675,16 +674,35 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev) · 22 unmodified lines
675674 * matching, which was the case for the swizzling required in
676675 * the table above, or from the 1-ch value being less than
677676 * the minimum size of a rank.
677+ *
678+ * Reports indicate that the swizzling actually
679+ * varies depending upon page placement inside the
680+ * channels, i.e. we see swizzled pages where the
681+ * banks of memory are paired and unswizzled on the
682+ * uneven portion, so leave that as unknown.
678683 */
679− if (I915_READ16(C0DRB3) != I915_READ16(C1DRB3)) {
680− swizzle_x = I915_BIT_6_SWIZZLE_NONE;
681− swizzle_y = I915_BIT_6_SWIZZLE_NONE;
682− } else {
684+ if (I915_READ16(C0DRB3) == I915_READ16(C1DRB3)) {
683685 swizzle_x = I915_BIT_6_SWIZZLE_9_10;
684686 swizzle_y = I915_BIT_6_SWIZZLE_9;
685687 }
686688 }
687689
690+ if (swizzle_x == I915_BIT_6_SWIZZLE_UNKNOWN ||
691+ swizzle_y == I915_BIT_6_SWIZZLE_UNKNOWN) {
692+ /* Userspace likes to explode if it sees unknown swizzling,
693+ * so lie. We will finish the lie when reporting through
694+ * the get-tiling-ioctl by reporting the physical swizzle
695+ * mode as unknown instead.
696+ *
697+ * As we don't strictly know what the swizzling is, it may be
698+ * bit17 dependent, and so we need to also prevent the pages
699+ * from being moved.
700+ */
701+ dev_priv->quirks |= QUIRK_PIN_SWIZZLED_PAGES;
702+ swizzle_x = I915_BIT_6_SWIZZLE_NONE;
703+ swizzle_y = I915_BIT_6_SWIZZLE_NONE;
704+ }
705+
688706 dev_priv->mm.bit_6_swizzle_x = swizzle_x;
689707 dev_priv->mm.bit_6_swizzle_y = swizzle_y;
690708 }
drivers/gpu/drm/i915/i915_params.c+5−0
@@ -40,6 +40,7 @@ struct i915_params i915 __read_mostly = { · 39 unmodified lines
4040 .preliminary_hw_support = IS_ENABLED(CONFIG_DRM_I915_PRELIMINARY_HW_SUPPORT),
4141 .disable_power_well = -1,
4242 .enable_ips = 1,
43+ .fastboot = 0,
4344 .prefault_disable = 0,
4445 .load_detect_test = 0,
4546 .reset = true,
@@ -133,6 +134,10 @@ MODULE_PARM_DESC(disable_power_well, · 87 unmodified lines
133134 module_param_named_unsafe(enable_ips, i915.enable_ips, int, 0600);
134135 MODULE_PARM_DESC(enable_ips, "Enable IPS (default: true)");
135136
137+module_param_named(fastboot, i915.fastboot, bool, 0600);
138+MODULE_PARM_DESC(fastboot,
139+ "Try to skip unnecessary mode sets at boot time (default: false)");
140+
136141 module_param_named_unsafe(prefault_disable, i915.prefault_disable, bool, 0600);
137142 MODULE_PARM_DESC(prefault_disable,
138143 "Disable page prefaulting for pread/pwrite/reloc (default:false). "
drivers/gpu/drm/i915/intel_crt.c+4−27
@@ -138,18 +138,6 @@ static void hsw_crt_get_config(struct intel_encoder *encoder, · 137 unmodified lines
138138 pipe_config->base.adjusted_mode.flags |= intel_crt_get_flags(encoder);
139139 }
140140
141−static void hsw_crt_pre_enable(struct intel_encoder *encoder)
142−{
143− struct drm_device *dev = encoder->base.dev;
144− struct drm_i915_private *dev_priv = dev->dev_private;
145−
146− WARN(I915_READ(SPLL_CTL) & SPLL_PLL_ENABLE, "SPLL already enabled\n");
147− I915_WRITE(SPLL_CTL,
148− SPLL_PLL_ENABLE | SPLL_PLL_FREQ_1350MHz | SPLL_PLL_SSC);
149− POSTING_READ(SPLL_CTL);
150− udelay(20);
151−}
152−
153141 /* Note: The caller is required to filter out dpms modes not supported by the
154142 * platform. */
155143 static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode)
@@ -216,19 +204,6 @@ static void pch_post_disable_crt(struct intel_encoder *encoder) · 60 unmodified lines
216204 intel_disable_crt(encoder);
217205 }
218206
219−static void hsw_crt_post_disable(struct intel_encoder *encoder)
220−{
221− struct drm_device *dev = encoder->base.dev;
222− struct drm_i915_private *dev_priv = dev->dev_private;
223− uint32_t val;
224−
225− DRM_DEBUG_KMS("Disabling SPLL\n");
226− val = I915_READ(SPLL_CTL);
227− WARN_ON(!(val & SPLL_PLL_ENABLE));
228− I915_WRITE(SPLL_CTL, val & ~SPLL_PLL_ENABLE);
229− POSTING_READ(SPLL_CTL);
230−}
231−
232207 static void intel_enable_crt(struct intel_encoder *encoder)
233208 {
234209 struct intel_crt *crt = intel_encoder_to_crt(encoder);
@@ -280,6 +255,10 @@ static bool intel_crt_compute_config(struct intel_encoder *encoder, · 45 unmodified lines
280255 if (HAS_DDI(dev)) {
281256 pipe_config->ddi_pll_sel = PORT_CLK_SEL_SPLL;
282257 pipe_config->port_clock = 135000 * 2;
258+
259+ pipe_config->dpll_hw_state.wrpll = 0;
260+ pipe_config->dpll_hw_state.spll =
261+ SPLL_PLL_ENABLE | SPLL_PLL_FREQ_1350MHz | SPLL_PLL_SSC;
283262 }
284263
285264 return true;
@@ -860,8 +839,6 @@ void intel_crt_init(struct drm_device *dev) · 574 unmodified lines
860839 if (HAS_DDI(dev)) {
861840 crt->base.get_config = hsw_crt_get_config;
862841 crt->base.get_hw_state = intel_ddi_get_hw_state;
863− crt->base.pre_enable = hsw_crt_pre_enable;
864− crt->base.post_disable = hsw_crt_post_disable;
865842 } else {
866843 crt->base.get_config = intel_crt_get_config;
867844 crt->base.get_hw_state = intel_crt_get_hw_state;
drivers/gpu/drm/i915/intel_ddi.c+65−10
@@ -1286,6 +1286,18 @@ hsw_ddi_pll_select(struct intel_crtc *intel_crtc, · 1285 unmodified lines
12861286 }
12871287
12881288 crtc_state->ddi_pll_sel = PORT_CLK_SEL_WRPLL(pll->id);
1289+ } else if (crtc_state->ddi_pll_sel == PORT_CLK_SEL_SPLL) {
1290+ struct drm_atomic_state *state = crtc_state->base.state;
1291+ struct intel_shared_dpll_config *spll =
1292+ &intel_atomic_get_shared_dpll_state(state)[DPLL_ID_SPLL];
1293+
1294+ if (spll->crtc_mask &&
1295+ WARN_ON(spll->hw_state.spll != crtc_state->dpll_hw_state.spll))
1296+ return false;
1297+
1298+ crtc_state->shared_dpll = DPLL_ID_SPLL;
1299+ spll->hw_state.spll = crtc_state->dpll_hw_state.spll;
1300+ spll->crtc_mask |= 1 << intel_crtc->pipe;
12891301 }
12901302
12911303 return true;
@@ -2437,7 +2449,7 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder) · 1145 unmodified lines
24372449 }
24382450 }
24392451
2440−static void hsw_ddi_pll_enable(struct drm_i915_private *dev_priv,
2452+static void hsw_ddi_wrpll_enable(struct drm_i915_private *dev_priv,
24412453 struct intel_shared_dpll *pll)
24422454 {
24432455 I915_WRITE(WRPLL_CTL(pll->id), pll->config.hw_state.wrpll);
@@ -2445,8 +2457,16 @@ static void hsw_ddi_pll_enable(struct drm_i915_private *dev_priv, · 1 unmodified line
24452457 udelay(20);
24462458 }
24472459
2448−static void hsw_ddi_pll_disable(struct drm_i915_private *dev_priv,
2460+static void hsw_ddi_spll_enable(struct drm_i915_private *dev_priv,
24492461 struct intel_shared_dpll *pll)
2462+{
2463+ I915_WRITE(SPLL_CTL, pll->config.hw_state.spll);
2464+ POSTING_READ(SPLL_CTL);
2465+ udelay(20);
2466+}
2467+
2468+static void hsw_ddi_wrpll_disable(struct drm_i915_private *dev_priv,
2469+ struct intel_shared_dpll *pll)
24502470 {
24512471 uint32_t val;
24522472
@@ -2455,9 +2475,19 @@ static void hsw_ddi_pll_disable(struct drm_i915_private *dev_priv, · 2 unmodified lines
24552475 POSTING_READ(WRPLL_CTL(pll->id));
24562476 }
24572477
2458−static bool hsw_ddi_pll_get_hw_state(struct drm_i915_private *dev_priv,
2459− struct intel_shared_dpll *pll,
2460− struct intel_dpll_hw_state *hw_state)
2478+static void hsw_ddi_spll_disable(struct drm_i915_private *dev_priv,
2479+ struct intel_shared_dpll *pll)
2480+{
2481+ uint32_t val;
2482+
2483+ val = I915_READ(SPLL_CTL);
2484+ I915_WRITE(SPLL_CTL, val & ~SPLL_PLL_ENABLE);
2485+ POSTING_READ(SPLL_CTL);
2486+}
2487+
2488+static bool hsw_ddi_wrpll_get_hw_state(struct drm_i915_private *dev_priv,
2489+ struct intel_shared_dpll *pll,
2490+ struct intel_dpll_hw_state *hw_state)
24612491 {
24622492 uint32_t val;
24632493
@@ -2470,25 +2500,50 @@ static bool hsw_ddi_pll_get_hw_state(struct drm_i915_private *dev_priv, · 6 unmodified lines
24702500 return val & WRPLL_PLL_ENABLE;
24712501 }
24722502
2503+static bool hsw_ddi_spll_get_hw_state(struct drm_i915_private *dev_priv,
2504+ struct intel_shared_dpll *pll,
2505+ struct intel_dpll_hw_state *hw_state)
2506+{
2507+ uint32_t val;
2508+
2509+ if (!intel_display_power_is_enabled(dev_priv, POWER_DOMAIN_PLLS))
2510+ return false;
2511+
2512+ val = I915_READ(SPLL_CTL);
2513+ hw_state->spll = val;
2514+
2515+ return val & SPLL_PLL_ENABLE;
2516+}
2517+
2518+
24732519 static const char * const hsw_ddi_pll_names[] = {
24742520 "WRPLL 1",
24752521 "WRPLL 2",
2522+ "SPLL"
24762523 };
24772524
24782525 static void hsw_shared_dplls_init(struct drm_i915_private *dev_priv)
24792526 {
24802527 int i;
24812528
2482− dev_priv->num_shared_dpll = 2;
2529+ dev_priv->num_shared_dpll = 3;
24832530
2484− for (i = 0; i < dev_priv->num_shared_dpll; i++) {
2531+ for (i = 0; i < 2; i++) {
24852532 dev_priv->shared_dplls[i].id = i;
24862533 dev_priv->shared_dplls[i].name = hsw_ddi_pll_names[i];
2487− dev_priv->shared_dplls[i].disable = hsw_ddi_pll_disable;
2488− dev_priv->shared_dplls[i].enable = hsw_ddi_pll_enable;
2534+ dev_priv->shared_dplls[i].disable = hsw_ddi_wrpll_disable;
2535+ dev_priv->shared_dplls[i].enable = hsw_ddi_wrpll_enable;
24892536 dev_priv->shared_dplls[i].get_hw_state =
2490− hsw_ddi_pll_get_hw_state;
2537+ hsw_ddi_wrpll_get_hw_state;
24912538 }
2539+
2540+ /* SPLL is special, but needs to be initialized anyway.. */
2541+ dev_priv->shared_dplls[i].id = i;
2542+ dev_priv->shared_dplls[i].name = hsw_ddi_pll_names[i];
2543+ dev_priv->shared_dplls[i].disable = hsw_ddi_spll_disable;
2544+ dev_priv->shared_dplls[i].enable = hsw_ddi_spll_enable;
2545+ dev_priv->shared_dplls[i].get_hw_state = hsw_ddi_spll_get_hw_state;
2546+
24922547 }
24932548
24942549 static const char * const skl_ddi_pll_names[] = {
drivers/gpu/drm/i915/intel_display.c+78−12
@@ -2646,11 +2646,13 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc, · 2645 unmodified lines
26462646 return;
26472647
26482648 valid_fb:
2649− plane_state->src_x = plane_state->src_y = 0;
2649+ plane_state->src_x = 0;
2650+ plane_state->src_y = 0;
26502651 plane_state->src_w = fb->width << 16;
26512652 plane_state->src_h = fb->height << 16;
26522653
2653− plane_state->crtc_x = plane_state->src_y = 0;
2654+ plane_state->crtc_x = 0;
2655+ plane_state->crtc_y = 0;
26542656 plane_state->crtc_w = fb->width;
26552657 plane_state->crtc_h = fb->height;
26562658
@@ -4237,6 +4239,7 @@ struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc, · 1580 unmodified lines
42374239 struct intel_shared_dpll *pll;
42384240 struct intel_shared_dpll_config *shared_dpll;
42394241 enum intel_dpll_id i;
4242+ int max = dev_priv->num_shared_dpll;
42404243
42414244 shared_dpll = intel_atomic_get_shared_dpll_state(crtc_state->base.state);
42424245
@@ -4271,9 +4274,11 @@ struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc, · 28 unmodified lines
42714274 WARN_ON(shared_dpll[i].crtc_mask);
42724275
42734276 goto found;
4274− }
4277+ } else if (INTEL_INFO(dev_priv)->gen < 9 && HAS_DDI(dev_priv))
4278+ /* Do not consider SPLL */
4279+ max = 2;
42754280
4276− for (i = 0; i < dev_priv->num_shared_dpll; i++) {
4281+ for (i = 0; i < max; i++) {
42774282 pll = &dev_priv->shared_dplls[i];
42784283
42794284 /* Only want to check enabled timings first */
@@ -5189,11 +5194,31 @@ static enum intel_display_power_domain port_to_power_domain(enum port port) · 909 unmodified lines
51895194 case PORT_E:
51905195 return POWER_DOMAIN_PORT_DDI_E_2_LANES;
51915196 default:
5192− WARN_ON_ONCE(1);
5197+ MISSING_CASE(port);
51935198 return POWER_DOMAIN_PORT_OTHER;
51945199 }
51955200 }
51965201
5202+static enum intel_display_power_domain port_to_aux_power_domain(enum port port)
5203+{
5204+ switch (port) {
5205+ case PORT_A:
5206+ return POWER_DOMAIN_AUX_A;
5207+ case PORT_B:
5208+ return POWER_DOMAIN_AUX_B;
5209+ case PORT_C:
5210+ return POWER_DOMAIN_AUX_C;
5211+ case PORT_D:
5212+ return POWER_DOMAIN_AUX_D;
5213+ case PORT_E:
5214+ /* FIXME: Check VBT for actual wiring of PORT E */
5215+ return POWER_DOMAIN_AUX_D;
5216+ default:
5217+ MISSING_CASE(port);
5218+ return POWER_DOMAIN_AUX_A;
5219+ }
5220+}
5221+
51975222 #define for_each_power_domain(domain, mask) \
51985223 for ((domain) = 0; (domain) < POWER_DOMAIN_NUM; (domain)++) \
51995224 if ((1 << (domain)) & (mask))
@@ -5225,6 +5250,36 @@ intel_display_port_power_domain(struct intel_encoder *intel_encoder) · 25 unmodified lines
52255250 }
52265251 }
52275252
5253+enum intel_display_power_domain
5254+intel_display_port_aux_power_domain(struct intel_encoder *intel_encoder)
5255+{
5256+ struct drm_device *dev = intel_encoder->base.dev;
5257+ struct intel_digital_port *intel_dig_port;
5258+
5259+ switch (intel_encoder->type) {
5260+ case INTEL_OUTPUT_UNKNOWN:
5261+ case INTEL_OUTPUT_HDMI:
5262+ /*
5263+ * Only DDI platforms should ever use these output types.
5264+ * We can get here after the HDMI detect code has already set
5265+ * the type of the shared encoder. Since we can't be sure
5266+ * what's the status of the given connectors, play safe and
5267+ * run the DP detection too.
5268+ */
5269+ WARN_ON_ONCE(!HAS_DDI(dev));
5270+ case INTEL_OUTPUT_DISPLAYPORT:
5271+ case INTEL_OUTPUT_EDP:
5272+ intel_dig_port = enc_to_dig_port(&intel_encoder->base);
5273+ return port_to_aux_power_domain(intel_dig_port->port);
5274+ case INTEL_OUTPUT_DP_MST:
5275+ intel_dig_port = enc_to_mst(&intel_encoder->base)->primary;
5276+ return port_to_aux_power_domain(intel_dig_port->port);
5277+ default:
5278+ MISSING_CASE(intel_encoder->type);
5279+ return POWER_DOMAIN_AUX_A;
5280+ }
5281+}
5282+
52285283 static unsigned long get_crtc_power_domains(struct drm_crtc *crtc)
52295284 {
52305285 struct drm_device *dev = crtc->dev;
@@ -9723,6 +9778,8 @@ static void haswell_get_ddi_pll(struct drm_i915_private *dev_priv, · 4492 unmodified lines
97239778 case PORT_CLK_SEL_WRPLL2:
97249779 pipe_config->shared_dpll = DPLL_ID_WRPLL2;
97259780 break;
9781+ case PORT_CLK_SEL_SPLL:
9782+ pipe_config->shared_dpll = DPLL_ID_SPLL;
97269783 }
97279784 }
97289785
@@ -12003,9 +12060,10 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc, · 2274 unmodified lines
1200312060 pipe_config->dpll_hw_state.cfgcr1,
1200412061 pipe_config->dpll_hw_state.cfgcr2);
1200512062 } else if (HAS_DDI(dev)) {
12006− DRM_DEBUG_KMS("ddi_pll_sel: %u; dpll_hw_state: wrpll: 0x%x\n",
12063+ DRM_DEBUG_KMS("ddi_pll_sel: %u; dpll_hw_state: wrpll: 0x%x spll: 0x%x\n",
1200712064 pipe_config->ddi_pll_sel,
12008− pipe_config->dpll_hw_state.wrpll);
12065+ pipe_config->dpll_hw_state.wrpll,
12066+ pipe_config->dpll_hw_state.spll);
1200912067 } else {
1201012068 DRM_DEBUG_KMS("dpll_hw_state: dpll: 0x%x, dpll_md: 0x%x, "
1201112069 "fp0: 0x%x, fp1: 0x%x\n",
@@ -12452,7 +12510,6 @@ intel_pipe_config_compare(struct drm_device *dev, · 440 unmodified lines
1245212510 if (INTEL_INFO(dev)->gen < 8) {
1245312511 PIPE_CONF_CHECK_M_N(dp_m_n);
1245412512
12455− PIPE_CONF_CHECK_I(has_drrs);
1245612513 if (current_config->has_drrs)
1245712514 PIPE_CONF_CHECK_M_N(dp_m2_n2);
1245812515 } else
@@ -12528,6 +12585,7 @@ intel_pipe_config_compare(struct drm_device *dev, · 69 unmodified lines
1252812585 PIPE_CONF_CHECK_X(dpll_hw_state.fp0);
1252912586 PIPE_CONF_CHECK_X(dpll_hw_state.fp1);
1253012587 PIPE_CONF_CHECK_X(dpll_hw_state.wrpll);
12588+ PIPE_CONF_CHECK_X(dpll_hw_state.spll);
1253112589 PIPE_CONF_CHECK_X(dpll_hw_state.ctrl1);
1253212590 PIPE_CONF_CHECK_X(dpll_hw_state.cfgcr1);
1253312591 PIPE_CONF_CHECK_X(dpll_hw_state.cfgcr2);
@@ -13032,6 +13090,9 @@ static int intel_atomic_check(struct drm_device *dev, · 498 unmodified lines
1303213090 struct intel_crtc_state *pipe_config =
1303313091 to_intel_crtc_state(crtc_state);
1303413092
13093+ memset(&to_intel_crtc(crtc)->atomic, 0,
13094+ sizeof(struct intel_crtc_atomic_commit));
13095+
1303513096 /* Catch I915_MODE_FLAG_INHERITED */
1303613097 if (crtc_state->mode.private_flags != crtc->state->mode.private_flags)
1303713098 crtc_state->mode_changed = true;
@@ -13056,7 +13117,8 @@ static int intel_atomic_check(struct drm_device *dev, · 18 unmodified lines
1305613117 if (ret)
1305713118 return ret;
1305813119
13059− if (intel_pipe_config_compare(state->dev,
13120+ if (i915.fastboot &&
13121+ intel_pipe_config_compare(state->dev,
1306013122 to_intel_crtc_state(crtc->state),
1306113123 pipe_config, true)) {
1306213124 crtc_state->mode_changed = false;
@@ -14364,16 +14426,17 @@ static int intel_framebuffer_init(struct drm_device *dev, · 1301 unmodified lines
1436414426 static struct drm_framebuffer *
1436514427 intel_user_framebuffer_create(struct drm_device *dev,
1436614428 struct drm_file *filp,
14367− struct drm_mode_fb_cmd2 *mode_cmd)
14429+ struct drm_mode_fb_cmd2 *user_mode_cmd)
1436814430 {
1436914431 struct drm_i915_gem_object *obj;
14432+ struct drm_mode_fb_cmd2 mode_cmd = *user_mode_cmd;
1437014433
1437114434 obj = to_intel_bo(drm_gem_object_lookup(dev, filp,
14372− mode_cmd->handles[0]));
14435+ mode_cmd.handles[0]));
1437314436 if (&obj->base == NULL)
1437414437 return ERR_PTR(-ENOENT);
1437514438
14376− return intel_framebuffer_create(dev, mode_cmd, obj);
14439+ return intel_framebuffer_create(dev, &mode_cmd, obj);
1437714440 }
1437814441
1437914442 #ifndef CONFIG_DRM_FBDEV_EMULATION
@@ -14705,6 +14768,9 @@ static struct intel_quirk intel_quirks[] = { · 325 unmodified lines
1470514768 /* Apple Macbook 2,1 (Core 2 T7400) */
1470614769 { 0x27a2, 0x8086, 0x7270, quirk_backlight_present },
1470714770
14771+ /* Apple Macbook 4,1 */
14772+ { 0x2a02, 0x106b, 0x00a1, quirk_backlight_present },
14773+
1470814774 /* Toshiba CB35 Chromebook (Celeron 2955U) */
1470914775 { 0x0a06, 0x1179, 0x0a88, quirk_backlight_present },
1471014776
drivers/gpu/drm/i915/intel_dp.c+16−35
@@ -277,7 +277,7 @@ static void pps_lock(struct intel_dp *intel_dp) · 276 unmodified lines
277277 * See vlv_power_sequencer_reset() why we need
278278 * a power domain reference here.
279279 */
280− power_domain = intel_display_port_power_domain(encoder);
280+ power_domain = intel_display_port_aux_power_domain(encoder);
281281 intel_display_power_get(dev_priv, power_domain);
282282
283283 mutex_lock(&dev_priv->pps_mutex);
@@ -293,7 +293,7 @@ static void pps_unlock(struct intel_dp *intel_dp) · 9 unmodified lines
293293
294294 mutex_unlock(&dev_priv->pps_mutex);
295295
296− power_domain = intel_display_port_power_domain(encoder);
296+ power_domain = intel_display_port_aux_power_domain(encoder);
297297 intel_display_power_put(dev_priv, power_domain);
298298 }
299299
@@ -816,8 +816,6 @@ intel_dp_aux_ch(struct intel_dp *intel_dp, · 516 unmodified lines
816816
817817 intel_dp_check_edp(intel_dp);
818818
819− intel_aux_display_runtime_get(dev_priv);
820−
821819 /* Try to wait for any previous AUX channel activity */
822820 for (try = 0; try < 3; try++) {
823821 status = I915_READ_NOTRACE(ch_ctl);
@@ -926,7 +924,6 @@ done: · 102 unmodified lines
926924 ret = recv_bytes;
927925 out:
928926 pm_qos_update_request(&dev_priv->pm_qos, PM_QOS_DEFAULT_VALUE);
929− intel_aux_display_runtime_put(dev_priv);
930927
931928 if (vdd)
932929 edp_panel_vdd_off(intel_dp, false);
@@ -1784,7 +1781,7 @@ static bool edp_panel_vdd_on(struct intel_dp *intel_dp) · 851 unmodified lines
17841781 if (edp_have_panel_vdd(intel_dp))
17851782 return need_to_disable;
17861783
1787− power_domain = intel_display_port_power_domain(intel_encoder);
1784+ power_domain = intel_display_port_aux_power_domain(intel_encoder);
17881785 intel_display_power_get(dev_priv, power_domain);
17891786
17901787 DRM_DEBUG_KMS("Turning eDP port %c VDD on\n",
@@ -1874,7 +1871,7 @@ static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp) · 83 unmodified lines
18741871 if ((pp & POWER_TARGET_ON) == 0)
18751872 intel_dp->last_power_cycle = jiffies;
18761873
1877− power_domain = intel_display_port_power_domain(intel_encoder);
1874+ power_domain = intel_display_port_aux_power_domain(intel_encoder);
18781875 intel_display_power_put(dev_priv, power_domain);
18791876 }
18801877
@@ -2025,7 +2022,7 @@ static void edp_panel_off(struct intel_dp *intel_dp) · 144 unmodified lines
20252022 wait_panel_off(intel_dp);
20262023
20272024 /* We got a reference when we enabled the VDD. */
2028− power_domain = intel_display_port_power_domain(intel_encoder);
2025+ power_domain = intel_display_port_aux_power_domain(intel_encoder);
20292026 intel_display_power_put(dev_priv, power_domain);
20302027 }
20312028
@@ -4765,26 +4762,6 @@ intel_dp_unset_edid(struct intel_dp *intel_dp) · 2733 unmodified lines
47654762 intel_dp->has_audio = false;
47664763 }
47674764
4768−static enum intel_display_power_domain
4769−intel_dp_power_get(struct intel_dp *dp)
4770−{
4771− struct intel_encoder *encoder = &dp_to_dig_port(dp)->base;
4772− enum intel_display_power_domain power_domain;
4773−
4774− power_domain = intel_display_port_power_domain(encoder);
4775− intel_display_power_get(to_i915(encoder->base.dev), power_domain);
4776−
4777− return power_domain;
4778−}
4779−
4780−static void
4781−intel_dp_power_put(struct intel_dp *dp,
4782− enum intel_display_power_domain power_domain)
4783−{
4784− struct intel_encoder *encoder = &dp_to_dig_port(dp)->base;
4785− intel_display_power_put(to_i915(encoder->base.dev), power_domain);
4786−}
4787−
47884765 static enum drm_connector_status
47894766 intel_dp_detect(struct drm_connector *connector, bool force)
47904767 {
@@ -4808,7 +4785,8 @@ intel_dp_detect(struct drm_connector *connector, bool force) · 17 unmodified lines
48084785 return connector_status_disconnected;
48094786 }
48104787
4811− power_domain = intel_dp_power_get(intel_dp);
4788+ power_domain = intel_display_port_aux_power_domain(intel_encoder);
4789+ intel_display_power_get(to_i915(dev), power_domain);
48124790
48134791 /* Can't disconnect eDP, but you can close the lid... */
48144792 if (is_edp(intel_dp))
@@ -4853,7 +4831,7 @@ intel_dp_detect(struct drm_connector *connector, bool force) · 38 unmodified lines
48534831 }
48544832
48554833 out:
4856− intel_dp_power_put(intel_dp, power_domain);
4834+ intel_display_power_put(to_i915(dev), power_domain);
48574835 return status;
48584836 }
48594837
@@ -4862,6 +4840,7 @@ intel_dp_force(struct drm_connector *connector) · 2 unmodified lines
48624840 {
48634841 struct intel_dp *intel_dp = intel_attached_dp(connector);
48644842 struct intel_encoder *intel_encoder = &dp_to_dig_port(intel_dp)->base;
4843+ struct drm_i915_private *dev_priv = to_i915(intel_encoder->base.dev);
48654844 enum intel_display_power_domain power_domain;
48664845
48674846 DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
@@ -4871,11 +4850,12 @@ intel_dp_force(struct drm_connector *connector) · 3 unmodified lines
48714850 if (connector->status != connector_status_connected)
48724851 return;
48734852
4874− power_domain = intel_dp_power_get(intel_dp);
4853+ power_domain = intel_display_port_aux_power_domain(intel_encoder);
4854+ intel_display_power_get(dev_priv, power_domain);
48754855
48764856 intel_dp_set_edid(intel_dp);
48774857
4878− intel_dp_power_put(intel_dp, power_domain);
4858+ intel_display_power_put(dev_priv, power_domain);
48794859
48804860 if (intel_encoder->type != INTEL_OUTPUT_EDP)
48814861 intel_encoder->type = INTEL_OUTPUT_DISPLAYPORT;
@@ -5091,7 +5071,7 @@ static void intel_edp_panel_vdd_sanitize(struct intel_dp *intel_dp) · 209 unmodified lines
50915071 * indefinitely.
50925072 */
50935073 DRM_DEBUG_KMS("VDD left on by BIOS, adjusting state tracking\n");
5094− power_domain = intel_display_port_power_domain(&intel_dig_port->base);
5074+ power_domain = intel_display_port_aux_power_domain(&intel_dig_port->base);
50955075 intel_display_power_get(dev_priv, power_domain);
50965076
50975077 edp_panel_vdd_schedule_off(intel_dp);
@@ -5153,7 +5133,8 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) · 55 unmodified lines
51535133 enum intel_display_power_domain power_domain;
51545134 enum irqreturn ret = IRQ_NONE;
51555135
5156− if (intel_dig_port->base.type != INTEL_OUTPUT_EDP)
5136+ if (intel_dig_port->base.type != INTEL_OUTPUT_EDP &&
5137+ intel_dig_port->base.type != INTEL_OUTPUT_HDMI)
51575138 intel_dig_port->base.type = INTEL_OUTPUT_DISPLAYPORT;
51585139
51595140 if (long_hpd && intel_dig_port->base.type == INTEL_OUTPUT_EDP) {
@@ -5172,7 +5153,7 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) · 12 unmodified lines
51725153 port_name(intel_dig_port->port),
51735154 long_hpd ? "long" : "short");
51745155
5175− power_domain = intel_display_port_power_domain(intel_encoder);
5156+ power_domain = intel_display_port_aux_power_domain(intel_encoder);
51765157 intel_display_power_get(dev_priv, power_domain);
51775158
51785159 if (long_hpd) {
drivers/gpu/drm/i915/intel_drv.h+2−2
@@ -1169,6 +1169,8 @@ void hsw_enable_ips(struct intel_crtc *crtc); · 1168 unmodified lines
11691169 void hsw_disable_ips(struct intel_crtc *crtc);
11701170 enum intel_display_power_domain
11711171 intel_display_port_power_domain(struct intel_encoder *intel_encoder);
1172+enum intel_display_power_domain
1173+intel_display_port_aux_power_domain(struct intel_encoder *intel_encoder);
11721174 void intel_mode_from_pipe_config(struct drm_display_mode *mode,
11731175 struct intel_crtc_state *pipe_config);
11741176 void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc);
@@ -1377,8 +1379,6 @@ void intel_display_power_get(struct drm_i915_private *dev_priv, · 202 unmodified lines
13771379 enum intel_display_power_domain domain);
13781380 void intel_display_power_put(struct drm_i915_private *dev_priv,
13791381 enum intel_display_power_domain domain);
1380−void intel_aux_display_runtime_get(struct drm_i915_private *dev_priv);
1381−void intel_aux_display_runtime_put(struct drm_i915_private *dev_priv);
13821382 void intel_runtime_pm_get(struct drm_i915_private *dev_priv);
13831383 void intel_runtime_pm_get_noresume(struct drm_i915_private *dev_priv);
13841384 void intel_runtime_pm_put(struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/intel_hdmi.c+6−6
@@ -1335,21 +1335,17 @@ intel_hdmi_set_edid(struct drm_connector *connector, bool force) · 1334 unmodified lines
13351335 {
13361336 struct drm_i915_private *dev_priv = to_i915(connector->dev);
13371337 struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
1338− struct intel_encoder *intel_encoder =
1339− &hdmi_to_dig_port(intel_hdmi)->base;
1340− enum intel_display_power_domain power_domain;
13411338 struct edid *edid = NULL;
13421339 bool connected = false;
13431340
1344− power_domain = intel_display_port_power_domain(intel_encoder);
1345− intel_display_power_get(dev_priv, power_domain);
1341+ intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
13461342
13471343 if (force)
13481344 edid = drm_get_edid(connector,
13491345 intel_gmbus_get_adapter(dev_priv,
13501346 intel_hdmi->ddc_bus));
13511347
1352− intel_display_power_put(dev_priv, power_domain);
1348+ intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
13531349
13541350 to_intel_connector(connector)->detect_edid = edid;
13551351 if (edid && edid->input & DRM_EDID_INPUT_DIGITAL) {
@@ -1383,6 +1379,8 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) · 27 unmodified lines
13831379 DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
13841380 connector->base.id, connector->name);
13851381
1382+ intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
1383+
13861384 while (!live_status && --retry) {
13871385 live_status = intel_digital_port_connected(dev_priv,
13881386 hdmi_to_dig_port(intel_hdmi));
@@ -1402,6 +1400,8 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) · 13 unmodified lines
14021400 } else
14031401 status = connector_status_disconnected;
14041402
1403+ intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
1404+
14051405 return status;
14061406 }
14071407
drivers/gpu/drm/i915/intel_i2c.c+4−2
@@ -483,7 +483,7 @@ gmbus_xfer(struct i2c_adapter *adapter, · 482 unmodified lines
483483 int i = 0, inc, try = 0;
484484 int ret = 0;
485485
486− intel_aux_display_runtime_get(dev_priv);
486+ intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
487487 mutex_lock(&dev_priv->gmbus_mutex);
488488
489489 if (bus->force_bit) {
@@ -595,7 +595,9 @@ timeout: · 105 unmodified lines
595595
596596 out:
597597 mutex_unlock(&dev_priv->gmbus_mutex);
598− intel_aux_display_runtime_put(dev_priv);
598+
599+ intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
600+
599601 return ret;
600602 }
601603
drivers/gpu/drm/i915/intel_pm.c+6−4
@@ -4449,7 +4449,7 @@ static void gen6_set_rps(struct drm_device *dev, u8 val) · 4448 unmodified lines
44494449 POSTING_READ(GEN6_RPNSWREQ);
44504450
44514451 dev_priv->rps.cur_freq = val;
4452− trace_intel_gpu_freq_change(val * 50);
4452+ trace_intel_gpu_freq_change(intel_gpu_freq(dev_priv, val));
44534453 }
44544454
44554455 static void valleyview_set_rps(struct drm_device *dev, u8 val)
@@ -7255,7 +7255,8 @@ static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val) · 2799 unmodified lines
72557255 int intel_gpu_freq(struct drm_i915_private *dev_priv, int val)
72567256 {
72577257 if (IS_GEN9(dev_priv->dev))
7258− return (val * GT_FREQUENCY_MULTIPLIER) / GEN9_FREQ_SCALER;
7258+ return DIV_ROUND_CLOSEST(val * GT_FREQUENCY_MULTIPLIER,
7259+ GEN9_FREQ_SCALER);
72597260 else if (IS_CHERRYVIEW(dev_priv->dev))
72607261 return chv_gpu_freq(dev_priv, val);
72617262 else if (IS_VALLEYVIEW(dev_priv->dev))
@@ -7267,13 +7268,14 @@ int intel_gpu_freq(struct drm_i915_private *dev_priv, int val) · 5 unmodified lines
72677268 int intel_freq_opcode(struct drm_i915_private *dev_priv, int val)
72687269 {
72697270 if (IS_GEN9(dev_priv->dev))
7270− return (val * GEN9_FREQ_SCALER) / GT_FREQUENCY_MULTIPLIER;
7271+ return DIV_ROUND_CLOSEST(val * GEN9_FREQ_SCALER,
7272+ GT_FREQUENCY_MULTIPLIER);
72717273 else if (IS_CHERRYVIEW(dev_priv->dev))
72727274 return chv_freq_opcode(dev_priv, val);
72737275 else if (IS_VALLEYVIEW(dev_priv->dev))
72747276 return byt_freq_opcode(dev_priv, val);
72757277 else
7276− return val / GT_FREQUENCY_MULTIPLIER;
7278+ return DIV_ROUND_CLOSEST(val, GT_FREQUENCY_MULTIPLIER);
72777279 }
72787280
72797281 struct request_boost {
drivers/gpu/drm/i915/intel_runtime_pm.c+4−30
@@ -362,6 +362,7 @@ static void hsw_set_power_well(struct drm_i915_private *dev_priv, · 361 unmodified lines
362362 BIT(POWER_DOMAIN_AUX_C) | \
363363 BIT(POWER_DOMAIN_AUDIO) | \
364364 BIT(POWER_DOMAIN_VGA) | \
365+ BIT(POWER_DOMAIN_GMBUS) | \
365366 BIT(POWER_DOMAIN_INIT))
366367 #define BXT_DISPLAY_POWERWELL_1_POWER_DOMAINS ( \
367368 BXT_DISPLAY_POWERWELL_2_POWER_DOMAINS | \
@@ -1483,6 +1484,7 @@ void intel_display_power_put(struct drm_i915_private *dev_priv, · 1115 unmodified lines
14831484 BIT(POWER_DOMAIN_AUX_B) | \
14841485 BIT(POWER_DOMAIN_AUX_C) | \
14851486 BIT(POWER_DOMAIN_AUX_D) | \
1487+ BIT(POWER_DOMAIN_GMBUS) | \
14861488 BIT(POWER_DOMAIN_INIT))
14871489 #define HSW_DISPLAY_POWER_DOMAINS ( \
14881490 (POWER_DOMAIN_MASK & ~HSW_ALWAYS_ON_POWER_DOMAINS) | \
@@ -1845,6 +1847,8 @@ int intel_power_domains_init(struct drm_i915_private *dev_priv) · 356 unmodified lines
18451847 i915.disable_power_well = sanitize_disable_power_well_option(dev_priv,
18461848 i915.disable_power_well);
18471849
1850+ BUILD_BUG_ON(POWER_DOMAIN_NUM > 31);
1851+
18481852 mutex_init(&power_domains->lock);
18491853
18501854 /*
@@ -2063,36 +2067,6 @@ void intel_power_domains_init_hw(struct drm_i915_private *dev_priv) · 212 unmodified lines
20632067 power_domains->initializing = false;
20642068 }
20652069
2066−/**
2067− * intel_aux_display_runtime_get - grab an auxiliary power domain reference
2068− * @dev_priv: i915 device instance
2069− *
2070− * This function grabs a power domain reference for the auxiliary power domain
2071− * (for access to the GMBUS and DP AUX blocks) and ensures that it and all its
2072− * parents are powered up. Therefore users should only grab a reference to the
2073− * innermost power domain they need.
2074− *
2075− * Any power domain reference obtained by this function must have a symmetric
2076− * call to intel_aux_display_runtime_put() to release the reference again.
2077− */
2078−void intel_aux_display_runtime_get(struct drm_i915_private *dev_priv)
2079−{
2080− intel_runtime_pm_get(dev_priv);
2081−}
2082−
2083−/**
2084− * intel_aux_display_runtime_put - release an auxiliary power domain reference
2085− * @dev_priv: i915 device instance
2086− *
2087− * This function drops the auxiliary power domain reference obtained by
2088− * intel_aux_display_runtime_get() and might power down the corresponding
2089− * hardware block right away if this is the last reference.
2090− */
2091−void intel_aux_display_runtime_put(struct drm_i915_private *dev_priv)
2092−{
2093− intel_runtime_pm_put(dev_priv);
2094−}
2095−
20962070 /**
20972071 * intel_runtime_pm_get - grab a runtime pm reference
20982072 * @dev_priv: i915 device instance
drivers/gpu/drm/imx/imx-drm-core.c+3−4
@@ -63,8 +63,7 @@ static void imx_drm_driver_lastclose(struct drm_device *drm) · 62 unmodified lines
6363 #if IS_ENABLED(CONFIG_DRM_IMX_FB_HELPER)
6464 struct imx_drm_device *imxdrm = drm->dev_private;
6565
66− if (imxdrm->fbhelper)
67− drm_fbdev_cma_restore_mode(imxdrm->fbhelper);
66+ drm_fbdev_cma_restore_mode(imxdrm->fbhelper);
6867 #endif
6968 }
7069
@@ -340,7 +339,7 @@ err_kms: · 269 unmodified lines
340339 * imx_drm_add_crtc - add a new crtc
341340 */
342341 int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc,
343− struct imx_drm_crtc **new_crtc,
342+ struct imx_drm_crtc **new_crtc, struct drm_plane *primary_plane,
344343 const struct imx_drm_crtc_helper_funcs *imx_drm_helper_funcs,
345344 struct device_node *port)
346345 {
@@ -379,7 +378,7 @@ int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc, · 32 unmodified lines
379378 drm_crtc_helper_add(crtc,
380379 imx_drm_crtc->imx_drm_helper_funcs.crtc_helper_funcs);
381380
382− drm_crtc_init(drm, crtc,
381+ drm_crtc_init_with_planes(drm, crtc, primary_plane, NULL,
383382 imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs);
384383
385384 return 0;
drivers/gpu/drm/imx/imx-drm.h+2−1
@@ -9,6 +9,7 @@ struct drm_display_mode; · 8 unmodified lines
99 struct drm_encoder;
1010 struct drm_fbdev_cma;
1111 struct drm_framebuffer;
12+struct drm_plane;
1213 struct imx_drm_crtc;
1314 struct platform_device;
1415
@@ -24,7 +25,7 @@ struct imx_drm_crtc_helper_funcs { · 9 unmodified lines
2425 };
2526
2627 int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc,
27− struct imx_drm_crtc **new_crtc,
28+ struct imx_drm_crtc **new_crtc, struct drm_plane *primary_plane,
2829 const struct imx_drm_crtc_helper_funcs *imx_helper_funcs,
2930 struct device_node *port);
3031 int imx_drm_remove_crtc(struct imx_drm_crtc *);
drivers/gpu/drm/imx/imx-tve.c+1−0
@@ -721,6 +721,7 @@ static const struct of_device_id imx_tve_dt_ids[] = { · 720 unmodified lines
721721 { .compatible = "fsl,imx53-tve", },
722722 { /* sentinel */ }
723723 };
724+MODULE_DEVICE_TABLE(of, imx_tve_dt_ids);
724725
725726 static struct platform_driver imx_tve_driver = {
726727 .probe = imx_tve_probe,
drivers/gpu/drm/imx/ipuv3-crtc.c+17−46
@@ -212,7 +212,8 @@ static void ipu_crtc_handle_pageflip(struct ipu_crtc *ipu_crtc) · 211 unmodified lines
212212
213213 spin_lock_irqsave(&drm->event_lock, flags);
214214 if (ipu_crtc->page_flip_event)
215− drm_send_vblank_event(drm, -1, ipu_crtc->page_flip_event);
215+ drm_crtc_send_vblank_event(&ipu_crtc->base,
216+ ipu_crtc->page_flip_event);
216217 ipu_crtc->page_flip_event = NULL;
217218 imx_drm_crtc_vblank_put(ipu_crtc->imx_crtc);
218219 spin_unlock_irqrestore(&drm->event_lock, flags);
@@ -349,7 +350,6 @@ static int ipu_crtc_init(struct ipu_crtc *ipu_crtc, · 130 unmodified lines
349350 struct ipu_soc *ipu = dev_get_drvdata(ipu_crtc->dev->parent);
350351 int dp = -EINVAL;
351352 int ret;
352− int id;
353353
354354 ret = ipu_get_resources(ipu_crtc, pdata);
355355 if (ret) {
@@ -358,18 +358,23 @@ static int ipu_crtc_init(struct ipu_crtc *ipu_crtc, · 2 unmodified lines
358358 return ret;
359359 }
360360
361+ if (pdata->dp >= 0)
362+ dp = IPU_DP_FLOW_SYNC_BG;
363+ ipu_crtc->plane[0] = ipu_plane_init(drm, ipu, pdata->dma[0], dp, 0,
364+ DRM_PLANE_TYPE_PRIMARY);
365+ if (IS_ERR(ipu_crtc->plane[0])) {
366+ ret = PTR_ERR(ipu_crtc->plane[0]);
367+ goto err_put_resources;
368+ }
369+
361370 ret = imx_drm_add_crtc(drm, &ipu_crtc->base, &ipu_crtc->imx_crtc,
362− &ipu_crtc_helper_funcs, ipu_crtc->dev->of_node);
371+ &ipu_crtc->plane[0]->base, &ipu_crtc_helper_funcs,
372+ ipu_crtc->dev->of_node);
363373 if (ret) {
364374 dev_err(ipu_crtc->dev, "adding crtc failed with %d.\n", ret);
365375 goto err_put_resources;
366376 }
367377
368− if (pdata->dp >= 0)
369− dp = IPU_DP_FLOW_SYNC_BG;
370− id = imx_drm_crtc_id(ipu_crtc->imx_crtc);
371− ipu_crtc->plane[0] = ipu_plane_init(ipu_crtc->base.dev, ipu,
372− pdata->dma[0], dp, BIT(id), true);
373378 ret = ipu_plane_get_resources(ipu_crtc->plane[0]);
374379 if (ret) {
375380 dev_err(ipu_crtc->dev, "getting plane 0 resources failed with %d.\n",
@@ -379,10 +384,10 @@ static int ipu_crtc_init(struct ipu_crtc *ipu_crtc, · 3 unmodified lines
379384
380385 /* If this crtc is using the DP, add an overlay plane */
381386 if (pdata->dp >= 0 && pdata->dma[1] > 0) {
382− ipu_crtc->plane[1] = ipu_plane_init(ipu_crtc->base.dev, ipu,
383− pdata->dma[1],
384− IPU_DP_FLOW_SYNC_FG,
385− BIT(id), false);
387+ ipu_crtc->plane[1] = ipu_plane_init(drm, ipu, pdata->dma[1],
388+ IPU_DP_FLOW_SYNC_FG,
389+ drm_crtc_mask(&ipu_crtc->base),
390+ DRM_PLANE_TYPE_OVERLAY);
386391 if (IS_ERR(ipu_crtc->plane[1]))
387392 ipu_crtc->plane[1] = NULL;
388393 }
@@ -407,28 +412,6 @@ err_put_resources: · 18 unmodified lines
407412 return ret;
408413 }
409414
410−static struct device_node *ipu_drm_get_port_by_id(struct device_node *parent,
411− int port_id)
412−{
413− struct device_node *port;
414− int id, ret;
415−
416− port = of_get_child_by_name(parent, "port");
417− while (port) {
418− ret = of_property_read_u32(port, "reg", &id);
419− if (!ret && id == port_id)
420− return port;
421−
422− do {
423− port = of_get_next_child(parent, port);
424− if (!port)
425− return NULL;
426− } while (of_node_cmp(port->name, "port"));
427− }
428−
429− return NULL;
430−}
431−
432415 static int ipu_drm_bind(struct device *dev, struct device *master, void *data)
433416 {
434417 struct ipu_client_platformdata *pdata = dev->platform_data;
@@ -470,23 +453,11 @@ static const struct component_ops ipu_crtc_ops = { · 35 unmodified lines
470453 static int ipu_drm_probe(struct platform_device *pdev)
471454 {
472455 struct device *dev = &pdev->dev;
473− struct ipu_client_platformdata *pdata = dev->platform_data;
474456 int ret;
475457
476458 if (!dev->platform_data)
477459 return -EINVAL;
478460
479− if (!dev->of_node) {
480− /* Associate crtc device with the corresponding DI port node */
481− dev->of_node = ipu_drm_get_port_by_id(dev->parent->of_node,
482− pdata->di + 2);
483− if (!dev->of_node) {
484− dev_err(dev, "missing port@%d node in %s\n",
485− pdata->di + 2, dev->parent->of_node->full_name);
486− return -ENODEV;
487− }
488− }
489−
490461 ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
491462 if (ret)
492463 return ret;
drivers/gpu/drm/imx/ipuv3-plane.c+4−5
@@ -381,7 +381,7 @@ static struct drm_plane_funcs ipu_plane_funcs = { · 380 unmodified lines
381381
382382 struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu,
383383 int dma, int dp, unsigned int possible_crtcs,
384− bool priv)
384+ enum drm_plane_type type)
385385 {
386386 struct ipu_plane *ipu_plane;
387387 int ret;
@@ -399,10 +399,9 @@ struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu, · 11 unmodified lines
399399 ipu_plane->dma = dma;
400400 ipu_plane->dp_flow = dp;
401401
402− ret = drm_plane_init(dev, &ipu_plane->base, possible_crtcs,
403− &ipu_plane_funcs, ipu_plane_formats,
404− ARRAY_SIZE(ipu_plane_formats),
405− priv);
402+ ret = drm_universal_plane_init(dev, &ipu_plane->base, possible_crtcs,
403+ &ipu_plane_funcs, ipu_plane_formats,
404+ ARRAY_SIZE(ipu_plane_formats), type);
406405 if (ret) {
407406 DRM_ERROR("failed to initialize plane\n");
408407 kfree(ipu_plane);
drivers/gpu/drm/imx/ipuv3-plane.h+1−1
@@ -34,7 +34,7 @@ struct ipu_plane { · 33 unmodified lines
3434
3535 struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu,
3636 int dma, int dp, unsigned int possible_crtcs,
37− bool priv);
37+ enum drm_plane_type type);
3838
3939 /* Init IDMAC, DMFC, DP */
4040 int ipu_plane_mode_set(struct ipu_plane *plane, struct drm_crtc *crtc,
drivers/gpu/drm/imx/parallel-display.c+4−0
@@ -54,7 +54,11 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector) · 53 unmodified lines
5454
5555 if (imxpd->panel && imxpd->panel->funcs &&
5656 imxpd->panel->funcs->get_modes) {
57+ struct drm_display_info *di = &connector->display_info;
58+
5759 num_modes = imxpd->panel->funcs->get_modes(imxpd->panel);
60+ if (!imxpd->bus_format && di->num_bus_formats)
61+ imxpd->bus_format = di->bus_formats[0];
5862 if (num_modes > 0)
5963 return num_modes;
6064 }
drivers/gpu/drm/mgag200/mgag200_cursor.c+5−6
@@ -70,6 +70,11 @@ int mga_crtc_cursor_set(struct drm_crtc *crtc, · 69 unmodified lines
7070 BUG_ON(pixels_2 != pixels_current && pixels_2 != pixels_prev);
7171 BUG_ON(pixels_current == pixels_prev);
7272
73+ if (!handle || !file_priv) {
74+ mga_hide_cursor(mdev);
75+ return 0;
76+ }
77+
7378 obj = drm_gem_object_lookup(dev, file_priv, handle);
7479 if (!obj)
7580 return -ENOENT;
@@ -88,12 +93,6 @@ int mga_crtc_cursor_set(struct drm_crtc *crtc, · 12 unmodified lines
8893 goto out_unreserve1;
8994 }
9095
91− if (!handle) {
92− mga_hide_cursor(mdev);
93− ret = 0;
94− goto out1;
95− }
96−
9796 /* Move cursor buffers into VRAM if they aren't already */
9897 if (!pixels_1->pin_count) {
9998 ret = mgag200_bo_pin(pixels_1, TTM_PL_FLAG_VRAM,
drivers/gpu/drm/nouveau/include/nvkm/subdev/instmem.h+1−0
@@ -7,6 +7,7 @@ struct nvkm_instmem { · 6 unmodified lines
77 const struct nvkm_instmem_func *func;
88 struct nvkm_subdev subdev;
99
10+ spinlock_t lock;
1011 struct list_head list;
1112 u32 reserved;
1213
drivers/gpu/drm/nouveau/nouveau_acpi.c+1−0
@@ -367,6 +367,7 @@ static int nouveau_rom_call(acpi_handle rom_handle, uint8_t *bios, · 366 unmodified lines
367367 return -ENODEV;
368368 }
369369 obj = (union acpi_object *)buffer.pointer;
370+ len = min(len, (int)obj->buffer.length);
370371 memcpy(bios+offset, obj->buffer.pointer, len);
371372 kfree(buffer.pointer);
372373 return len;
drivers/gpu/drm/nouveau/nouveau_display.c+11−8
@@ -829,7 +829,6 @@ nouveau_finish_page_flip(struct nouveau_channel *chan, · 828 unmodified lines
829829 struct drm_device *dev = drm->dev;
830830 struct nouveau_page_flip_state *s;
831831 unsigned long flags;
832− int crtcid = -1;
833832
834833 spin_lock_irqsave(&dev->event_lock, flags);
835834
@@ -841,15 +840,19 @@ nouveau_finish_page_flip(struct nouveau_channel *chan, · 5 unmodified lines
841840
842841 s = list_first_entry(&fctx->flip, struct nouveau_page_flip_state, head);
843842 if (s->event) {
844− /* Vblank timestamps/counts are only correct on >= NV-50 */
845− if (drm->device.info.family >= NV_DEVICE_INFO_V0_TESLA)
846− crtcid = s->crtc;
843+ if (drm->device.info.family < NV_DEVICE_INFO_V0_TESLA) {
844+ drm_arm_vblank_event(dev, s->crtc, s->event);
845+ } else {
846+ drm_send_vblank_event(dev, s->crtc, s->event);
847847
848− drm_send_vblank_event(dev, crtcid, s->event);
848+ /* Give up ownership of vblank for page-flipped crtc */
849+ drm_vblank_put(dev, s->crtc);
850+ }
851+ }
852+ else {
853+ /* Give up ownership of vblank for page-flipped crtc */
854+ drm_vblank_put(dev, s->crtc);
849855 }
850−
851− /* Give up ownership of vblank for page-flipped crtc */
852− drm_vblank_put(dev, s->crtc);
853856
854857 list_del(&s->head);
855858 if (ps)
drivers/gpu/drm/nouveau/nouveau_drm.h+3−1
@@ -39,6 +39,7 @@ · 38 unmodified lines
3939
4040 #include <nvif/client.h>
4141 #include <nvif/device.h>
42+#include <nvif/ioctl.h>
4243
4344 #include <drmP.h>
4445
@@ -65,9 +66,10 @@ struct nouveau_drm_tile { · 20 unmodified lines
6566 };
6667
6768 enum nouveau_drm_object_route {
68− NVDRM_OBJECT_NVIF = 0,
69+ NVDRM_OBJECT_NVIF = NVIF_IOCTL_V0_OWNER_NVIF,
6970 NVDRM_OBJECT_USIF,
7071 NVDRM_OBJECT_ABI16,
72+ NVDRM_OBJECT_ANY = NVIF_IOCTL_V0_OWNER_ANY,
7173 };
7274
7375 enum nouveau_drm_notify_route {
drivers/gpu/drm/nouveau/nouveau_usif.c+4−1
@@ -313,7 +313,10 @@ usif_ioctl(struct drm_file *filp, void __user *user, u32 argc) · 312 unmodified lines
313313 if (nvif_unpack(argv->v0, 0, 0, true)) {
314314 /* block access to objects not created via this interface */
315315 owner = argv->v0.owner;
316− argv->v0.owner = NVDRM_OBJECT_USIF;
316+ if (argv->v0.object == 0ULL)
317+ argv->v0.owner = NVDRM_OBJECT_ANY; /* except client */
318+ else
319+ argv->v0.owner = NVDRM_OBJECT_USIF;
317320 } else
318321 goto done;
319322
drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c+14−2
@@ -278,6 +278,12 @@ nvkm_device_pci_10de_0fe3[] = { · 277 unmodified lines
278278 {}
279279 };
280280
281+static const struct nvkm_device_pci_vendor
282+nvkm_device_pci_10de_0fe4[] = {
283+ { 0x144d, 0xc740, NULL, { .War00C800_0 = true } },
284+ {}
285+};
286+
281287 static const struct nvkm_device_pci_vendor
282288 nvkm_device_pci_10de_104b[] = {
283289 { 0x1043, 0x844c, "GeForce GT 625" },
@@ -688,6 +694,12 @@ nvkm_device_pci_10de_1199[] = { · 404 unmodified lines
688694 {}
689695 };
690696
697+static const struct nvkm_device_pci_vendor
698+nvkm_device_pci_10de_11e0[] = {
699+ { 0x1558, 0x5106, NULL, { .War00C800_0 = true } },
700+ {}
701+};
702+
691703 static const struct nvkm_device_pci_vendor
692704 nvkm_device_pci_10de_11e3[] = {
693705 { 0x17aa, 0x3683, "GeForce GTX 760A" },
@@ -1370,7 +1382,7 @@ nvkm_device_pci_10de[] = { · 676 unmodified lines
13701382 { 0x0fe1, "GeForce GT 730M" },
13711383 { 0x0fe2, "GeForce GT 745M" },
13721384 { 0x0fe3, "GeForce GT 745M", nvkm_device_pci_10de_0fe3 },
1373− { 0x0fe4, "GeForce GT 750M" },
1385+ { 0x0fe4, "GeForce GT 750M", nvkm_device_pci_10de_0fe4 },
13741386 { 0x0fe9, "GeForce GT 750M" },
13751387 { 0x0fea, "GeForce GT 755M" },
13761388 { 0x0fec, "GeForce 710A" },
@@ -1485,7 +1497,7 @@ nvkm_device_pci_10de[] = { · 108 unmodified lines
14851497 { 0x11c6, "GeForce GTX 650 Ti" },
14861498 { 0x11c8, "GeForce GTX 650" },
14871499 { 0x11cb, "GeForce GT 740" },
1488− { 0x11e0, "GeForce GTX 770M" },
1500+ { 0x11e0, "GeForce GTX 770M", nvkm_device_pci_10de_11e0 },
14891501 { 0x11e1, "GeForce GTX 765M" },
14901502 { 0x11e2, "GeForce GTX 765M" },
14911503 { 0x11e3, "GeForce GTX 760M", nvkm_device_pci_10de_11e3 },
drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf117.c+2−0
@@ -207,6 +207,8 @@ gf117_grctx_generate_attrib(struct gf100_grctx *info) · 206 unmodified lines
207207 const u32 b = beta * gr->ppc_tpc_nr[gpc][ppc];
208208 const u32 t = timeslice_mode;
209209 const u32 o = PPC_UNIT(gpc, ppc, 0);
210+ if (!(gr->ppc_mask[gpc] & (1 << ppc)))
211+ continue;
210212 mmio_skip(info, o + 0xc0, (t << 28) | (b << 16) | ++bo);
211213 mmio_wr32(info, o + 0xc0, (t << 28) | (b << 16) | --bo);
212214 bo += grctx->attrib_nr_max * gr->ppc_tpc_nr[gpc][ppc];
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpc.fuc+5−3
@@ -52,10 +52,12 @@ mmio_list_base: · 51 unmodified lines
5252 #endif
5353
5454 #ifdef INCLUDE_CODE
55+#define gpc_addr(reg,addr) /*
56+*/ imm32(reg,addr) /*
57+*/ or reg NV_PGRAPH_GPCX_GPCCS_MMIO_CTRL_BASE_ENABLE
5558 #define gpc_wr32(addr,reg) /*
59+*/ gpc_addr($r14,addr) /*
5660 */ mov b32 $r15 reg /*
57−*/ imm32($r14, addr) /*
58−*/ or $r14 NV_PGRAPH_GPCX_GPCCS_MMIO_CTRL_BASE_ENABLE /*
5961 */ call(nv_wr32)
6062
6163 // reports an exception to the host
@@ -161,7 +163,7 @@ init: · 99 unmodified lines
161163
162164 #if NV_PGRAPH_GPCX_UNK__SIZE > 0
163165 // figure out which, and how many, UNKs are actually present
164− imm32($r14, 0x500c30)
166+ gpc_addr($r14, 0x500c30)
165167 clear b32 $r2
166168 clear b32 $r3
167169 clear b32 $r4
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf117.fuc3.h+172−172
@@ -314,7 +314,7 @@ uint32_t gf117_grgpc_code[] = { · 313 unmodified lines
314314 0x03f01200,
315315 0x0002d000,
316316 0x17f104bd,
317− 0x10fe0542,
317+ 0x10fe0545,
318318 0x0007f100,
319319 0x0003f007,
320320 0xbd0000d0,
@@ -338,184 +338,184 @@ uint32_t gf117_grgpc_code[] = { · 17 unmodified lines
338338 0x02d00103,
339339 0xf104bd00,
340340 0xf00c30e7,
341− 0x24bd50e3,
342− 0x44bd34bd,
343−/* 0x0430: init_unk_loop */
344− 0xb06821f4,
345− 0x0bf400f6,
346− 0x01f7f00f,
347− 0xfd04f2bb,
348− 0x30b6054f,
349−/* 0x0445: init_unk_next */
350− 0x0120b601,
351− 0xb004e0b6,
352− 0x1bf40126,
353−/* 0x0451: init_unk_done */
354− 0x070380e2,
355− 0xf1080480,
356− 0xf0010027,
357− 0x22cf0223,
358− 0x9534bd00,
359− 0x07f10825,
360− 0x03f0c000,
361− 0x0005d001,
362− 0x07f104bd,
363− 0x03f0c100,
364− 0x0005d001,
365− 0x0e9804bd,
366− 0x010f9800,
367− 0x015021f5,
368− 0xbb002fbb,
369− 0x0e98003f,
370− 0x020f9801,
371− 0x015021f5,
372− 0xfd050e98,
373− 0x2ebb00ef,
374− 0x003ebb00,
375− 0x98020e98,
376− 0x21f5030f,
377− 0x0e980150,
378− 0x00effd07,
379− 0xbb002ebb,
380− 0x35b6003e,
381− 0x0007f102,
382− 0x0103f0d3,
383− 0xbd0003d0,
384− 0x0825b604,
385− 0xb60635b6,
386− 0x30b60120,
387− 0x0824b601,
388− 0xb90834b6,
389− 0x21f5022f,
390− 0x2fbb02d3,
391− 0x003fbb00,
392− 0x010007f1,
393− 0xd00203f0,
341+ 0xe5f050e3,
342+ 0xbd24bd01,
343+/* 0x0433: init_unk_loop */
344+ 0xf444bd34,
345+ 0xf6b06821,
346+ 0x0f0bf400,
347+ 0xbb01f7f0,
348+ 0x4ffd04f2,
349+ 0x0130b605,
350+/* 0x0448: init_unk_next */
351+ 0xb60120b6,
352+ 0x26b004e0,
353+ 0xe21bf401,
354+/* 0x0454: init_unk_done */
355+ 0x80070380,
356+ 0x27f10804,
357+ 0x23f00100,
358+ 0x0022cf02,
359+ 0x259534bd,
360+ 0x0007f108,
361+ 0x0103f0c0,
362+ 0xbd0005d0,
363+ 0x0007f104,
364+ 0x0103f0c1,
365+ 0xbd0005d0,
366+ 0x000e9804,
367+ 0xf5010f98,
368+ 0xbb015021,
369+ 0x3fbb002f,
370+ 0x010e9800,
371+ 0xf5020f98,
372+ 0x98015021,
373+ 0xeffd050e,
374+ 0x002ebb00,
375+ 0x98003ebb,
376+ 0x0f98020e,
377+ 0x5021f503,
378+ 0x070e9801,
379+ 0xbb00effd,
380+ 0x3ebb002e,
381+ 0x0235b600,
382+ 0xd30007f1,
383+ 0xd00103f0,
394384 0x04bd0003,
395− 0x29f024bd,
396− 0x0007f11f,
397− 0x0203f008,
398− 0xbd0002d0,
399−/* 0x0505: main */
400− 0x0031f404,
401− 0xf00028f4,
402− 0x21f424d7,
403− 0xf401f439,
404− 0xf404e4b0,
405− 0x81fe1e18,
406− 0x0627f001,
407− 0x12fd20bd,
408− 0x01e4b604,
409− 0xfe051efd,
410− 0x21f50018,
411− 0x0ef405fa,
412−/* 0x0535: main_not_ctx_xfer */
413− 0x10ef94d3,
414− 0xf501f5f0,
415− 0xf4037e21,
416−/* 0x0542: ih */
417− 0x80f9c60e,
418− 0xf90188fe,
419− 0xf990f980,
420− 0xf9b0f9a0,
421− 0xf9e0f9d0,
422− 0xf104bdf0,
423− 0xf00200a7,
424− 0xaacf00a3,
425− 0x04abc400,
426− 0xf02c0bf4,
427− 0xe7f124d7,
428− 0xe3f01a00,
429− 0x00eecf00,
430− 0x1900f7f1,
431− 0xcf00f3f0,
432− 0x21f400ff,
433− 0x01e7f004,
434− 0x1d0007f1,
435− 0xd00003f0,
436− 0x04bd000e,
437−/* 0x0590: ih_no_fifo */
438− 0x010007f1,
439− 0xd00003f0,
440− 0x04bd000a,
441− 0xe0fcf0fc,
442− 0xb0fcd0fc,
443− 0x90fca0fc,
444− 0x88fe80fc,
445− 0xf480fc00,
446− 0x01f80032,
447−/* 0x05b4: hub_barrier_done */
448− 0x9801f7f0,
449− 0xfebb040e,
450− 0x02ffb904,
451− 0x9418e7f1,
452− 0xf440e3f0,
453− 0x00f89d21,
454−/* 0x05cc: ctx_redswitch */
455− 0xf120f7f0,
385+ 0xb60825b6,
386+ 0x20b60635,
387+ 0x0130b601,
388+ 0xb60824b6,
389+ 0x2fb90834,
390+ 0xd321f502,
391+ 0x002fbb02,
392+ 0xf1003fbb,
393+ 0xf0010007,
394+ 0x03d00203,
395+ 0xbd04bd00,
396+ 0x1f29f024,
397+ 0x080007f1,
398+ 0xd00203f0,
399+ 0x04bd0002,
400+/* 0x0508: main */
401+ 0xf40031f4,
402+ 0xd7f00028,
403+ 0x3921f424,
404+ 0xb0f401f4,
405+ 0x18f404e4,
406+ 0x0181fe1e,
407+ 0xbd0627f0,
408+ 0x0412fd20,
409+ 0xfd01e4b6,
410+ 0x18fe051e,
411+ 0xfd21f500,
412+ 0xd30ef405,
413+/* 0x0538: main_not_ctx_xfer */
414+ 0xf010ef94,
415+ 0x21f501f5,
416+ 0x0ef4037e,
417+/* 0x0545: ih */
418+ 0xfe80f9c6,
419+ 0x80f90188,
420+ 0xa0f990f9,
421+ 0xd0f9b0f9,
422+ 0xf0f9e0f9,
423+ 0xa7f104bd,
424+ 0xa3f00200,
425+ 0x00aacf00,
426+ 0xf404abc4,
427+ 0xd7f02c0b,
428+ 0x00e7f124,
429+ 0x00e3f01a,
430+ 0xf100eecf,
431+ 0xf01900f7,
432+ 0xffcf00f3,
433+ 0x0421f400,
434+ 0xf101e7f0,
435+ 0xf01d0007,
436+ 0x0ed00003,
437+/* 0x0593: ih_no_fifo */
438+ 0xf104bd00,
439+ 0xf0010007,
440+ 0x0ad00003,
441+ 0xfc04bd00,
442+ 0xfce0fcf0,
443+ 0xfcb0fcd0,
444+ 0xfc90fca0,
445+ 0x0088fe80,
446+ 0x32f480fc,
447+/* 0x05b7: hub_barrier_done */
448+ 0xf001f800,
449+ 0x0e9801f7,
450+ 0x04febb04,
451+ 0xf102ffb9,
452+ 0xf09418e7,
453+ 0x21f440e3,
454+/* 0x05cf: ctx_redswitch */
455+ 0xf000f89d,
456+ 0x07f120f7,
457+ 0x03f08500,
458+ 0x000fd001,
459+ 0xe7f004bd,
460+/* 0x05e1: ctx_redswitch_delay */
461+ 0x01e2b608,
462+ 0xf1fd1bf4,
463+ 0xf10800f5,
464+ 0xf10200f5,
456465 0xf0850007,
457466 0x0fd00103,
458− 0xf004bd00,
459−/* 0x05de: ctx_redswitch_delay */
460− 0xe2b608e7,
461− 0xfd1bf401,
462− 0x0800f5f1,
463− 0x0200f5f1,
464− 0x850007f1,
465− 0xd00103f0,
466− 0x04bd000f,
467−/* 0x05fa: ctx_xfer */
468− 0x07f100f8,
469− 0x03f08100,
470− 0x000fd002,
471− 0x11f404bd,
472− 0xcc21f507,
473−/* 0x060d: ctx_xfer_not_load */
474− 0x6a21f505,
475− 0xf124bd02,
476− 0xf047fc07,
477− 0x02d00203,
478− 0xf004bd00,
479− 0x20b6012c,
480− 0xfc07f103,
481− 0x0203f04a,
482− 0xbd0002d0,
483− 0x01acf004,
484− 0xf102a5f0,
485− 0xf00000b7,
486− 0x0c9850b3,
487− 0x0fc4b604,
488− 0x9800bcbb,
489− 0x0d98000c,
490− 0x00e7f001,
491− 0x016f21f5,
492− 0xf101acf0,
493− 0xf04000b7,
494− 0x0c9850b3,
495− 0x0fc4b604,
496− 0x9800bcbb,
497− 0x0d98010c,
498− 0x060f9802,
499− 0x0800e7f1,
500− 0x016f21f5,
467+ 0xf804bd00,
468+/* 0x05fd: ctx_xfer */
469+ 0x0007f100,
470+ 0x0203f081,
471+ 0xbd000fd0,
472+ 0x0711f404,
473+ 0x05cf21f5,
474+/* 0x0610: ctx_xfer_not_load */
475+ 0x026a21f5,
476+ 0x07f124bd,
477+ 0x03f047fc,
478+ 0x0002d002,
479+ 0x2cf004bd,
480+ 0x0320b601,
481+ 0x4afc07f1,
482+ 0xd00203f0,
483+ 0x04bd0002,
501484 0xf001acf0,
502− 0xb7f104a5,
503− 0xb3f03000,
485+ 0xb7f102a5,
486+ 0xb3f00000,
504487 0x040c9850,
505488 0xbb0fc4b6,
506489 0x0c9800bc,
507− 0x030d9802,
508− 0xf1080f98,
509− 0xf50200e7,
510− 0xf5016f21,
511− 0xf4025e21,
512− 0x12f40601,
513−/* 0x06a9: ctx_xfer_post */
514− 0x7f21f507,
515−/* 0x06ad: ctx_xfer_done */
516− 0xb421f502,
517− 0x0000f805,
518− 0x00000000,
490+ 0x010d9800,
491+ 0xf500e7f0,
492+ 0xf0016f21,
493+ 0xb7f101ac,
494+ 0xb3f04000,
495+ 0x040c9850,
496+ 0xbb0fc4b6,
497+ 0x0c9800bc,
498+ 0x020d9801,
499+ 0xf1060f98,
500+ 0xf50800e7,
501+ 0xf0016f21,
502+ 0xa5f001ac,
503+ 0x00b7f104,
504+ 0x50b3f030,
505+ 0xb6040c98,
506+ 0xbcbb0fc4,
507+ 0x020c9800,
508+ 0x98030d98,
509+ 0xe7f1080f,
510+ 0x21f50200,
511+ 0x21f5016f,
512+ 0x01f4025e,
513+ 0x0712f406,
514+/* 0x06ac: ctx_xfer_post */
515+ 0x027f21f5,
516+/* 0x06b0: ctx_xfer_done */
517+ 0x05b721f5,
518+ 0x000000f8,
519519 0x00000000,
520520 0x00000000,
521521 0x00000000,
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk104.fuc3.h+172−172
@@ -314,7 +314,7 @@ uint32_t gk104_grgpc_code[] = { · 313 unmodified lines
314314 0x03f01200,
315315 0x0002d000,
316316 0x17f104bd,
317− 0x10fe0542,
317+ 0x10fe0545,
318318 0x0007f100,
319319 0x0003f007,
320320 0xbd0000d0,
@@ -338,184 +338,184 @@ uint32_t gk104_grgpc_code[] = { · 17 unmodified lines
338338 0x02d00103,
339339 0xf104bd00,
340340 0xf00c30e7,
341− 0x24bd50e3,
342− 0x44bd34bd,
343−/* 0x0430: init_unk_loop */
344− 0xb06821f4,
345− 0x0bf400f6,
346− 0x01f7f00f,
347− 0xfd04f2bb,
348− 0x30b6054f,
349−/* 0x0445: init_unk_next */
350− 0x0120b601,
351− 0xb004e0b6,
352− 0x1bf40126,
353−/* 0x0451: init_unk_done */
354− 0x070380e2,
355− 0xf1080480,
356− 0xf0010027,
357− 0x22cf0223,
358− 0x9534bd00,
359− 0x07f10825,
360− 0x03f0c000,
361− 0x0005d001,
362− 0x07f104bd,
363− 0x03f0c100,
364− 0x0005d001,
365− 0x0e9804bd,
366− 0x010f9800,
367− 0x015021f5,
368− 0xbb002fbb,
369− 0x0e98003f,
370− 0x020f9801,
371− 0x015021f5,
372− 0xfd050e98,
373− 0x2ebb00ef,
374− 0x003ebb00,
375− 0x98020e98,
376− 0x21f5030f,
377− 0x0e980150,
378− 0x00effd07,
379− 0xbb002ebb,
380− 0x35b6003e,
381− 0x0007f102,
382− 0x0103f0d3,
383− 0xbd0003d0,
384− 0x0825b604,
385− 0xb60635b6,
386− 0x30b60120,
387− 0x0824b601,
388− 0xb90834b6,
389− 0x21f5022f,
390− 0x2fbb02d3,
391− 0x003fbb00,
392− 0x010007f1,
393− 0xd00203f0,
341+ 0xe5f050e3,
342+ 0xbd24bd01,
343+/* 0x0433: init_unk_loop */
344+ 0xf444bd34,
345+ 0xf6b06821,
346+ 0x0f0bf400,
347+ 0xbb01f7f0,
348+ 0x4ffd04f2,
349+ 0x0130b605,
350+/* 0x0448: init_unk_next */
351+ 0xb60120b6,
352+ 0x26b004e0,
353+ 0xe21bf401,
354+/* 0x0454: init_unk_done */
355+ 0x80070380,
356+ 0x27f10804,
357+ 0x23f00100,
358+ 0x0022cf02,
359+ 0x259534bd,
360+ 0x0007f108,
361+ 0x0103f0c0,
362+ 0xbd0005d0,
363+ 0x0007f104,
364+ 0x0103f0c1,
365+ 0xbd0005d0,
366+ 0x000e9804,
367+ 0xf5010f98,
368+ 0xbb015021,
369+ 0x3fbb002f,
370+ 0x010e9800,
371+ 0xf5020f98,
372+ 0x98015021,
373+ 0xeffd050e,
374+ 0x002ebb00,
375+ 0x98003ebb,
376+ 0x0f98020e,
377+ 0x5021f503,
378+ 0x070e9801,
379+ 0xbb00effd,
380+ 0x3ebb002e,
381+ 0x0235b600,
382+ 0xd30007f1,
383+ 0xd00103f0,
394384 0x04bd0003,
395− 0x29f024bd,
396− 0x0007f11f,
397− 0x0203f008,
398− 0xbd0002d0,
399−/* 0x0505: main */
400− 0x0031f404,
401− 0xf00028f4,
402− 0x21f424d7,
403− 0xf401f439,
404− 0xf404e4b0,
405− 0x81fe1e18,
406− 0x0627f001,
407− 0x12fd20bd,
408− 0x01e4b604,
409− 0xfe051efd,
410− 0x21f50018,
411− 0x0ef405fa,
412−/* 0x0535: main_not_ctx_xfer */
413− 0x10ef94d3,
414− 0xf501f5f0,
415− 0xf4037e21,
416−/* 0x0542: ih */
417− 0x80f9c60e,
418− 0xf90188fe,
419− 0xf990f980,
420− 0xf9b0f9a0,
421− 0xf9e0f9d0,
422− 0xf104bdf0,
423− 0xf00200a7,
424− 0xaacf00a3,
425− 0x04abc400,
426− 0xf02c0bf4,
427− 0xe7f124d7,
428− 0xe3f01a00,
429− 0x00eecf00,
430− 0x1900f7f1,
431− 0xcf00f3f0,
432− 0x21f400ff,
433− 0x01e7f004,
434− 0x1d0007f1,
435− 0xd00003f0,
436− 0x04bd000e,
437−/* 0x0590: ih_no_fifo */
438− 0x010007f1,
439− 0xd00003f0,
440− 0x04bd000a,
441− 0xe0fcf0fc,
442− 0xb0fcd0fc,
443− 0x90fca0fc,
444− 0x88fe80fc,
445− 0xf480fc00,
446− 0x01f80032,
447−/* 0x05b4: hub_barrier_done */
448− 0x9801f7f0,
449− 0xfebb040e,
450− 0x02ffb904,
451− 0x9418e7f1,
452− 0xf440e3f0,
453− 0x00f89d21,
454−/* 0x05cc: ctx_redswitch */
455− 0xf120f7f0,
385+ 0xb60825b6,
386+ 0x20b60635,
387+ 0x0130b601,
388+ 0xb60824b6,
389+ 0x2fb90834,
390+ 0xd321f502,
391+ 0x002fbb02,
392+ 0xf1003fbb,
393+ 0xf0010007,
394+ 0x03d00203,
395+ 0xbd04bd00,
396+ 0x1f29f024,
397+ 0x080007f1,
398+ 0xd00203f0,
399+ 0x04bd0002,
400+/* 0x0508: main */
401+ 0xf40031f4,
402+ 0xd7f00028,
403+ 0x3921f424,
404+ 0xb0f401f4,
405+ 0x18f404e4,
406+ 0x0181fe1e,
407+ 0xbd0627f0,
408+ 0x0412fd20,
409+ 0xfd01e4b6,
410+ 0x18fe051e,
411+ 0xfd21f500,
412+ 0xd30ef405,
413+/* 0x0538: main_not_ctx_xfer */
414+ 0xf010ef94,
415+ 0x21f501f5,
416+ 0x0ef4037e,
417+/* 0x0545: ih */
418+ 0xfe80f9c6,
419+ 0x80f90188,
420+ 0xa0f990f9,
421+ 0xd0f9b0f9,
422+ 0xf0f9e0f9,
423+ 0xa7f104bd,
424+ 0xa3f00200,
425+ 0x00aacf00,
426+ 0xf404abc4,
427+ 0xd7f02c0b,
428+ 0x00e7f124,
429+ 0x00e3f01a,
430+ 0xf100eecf,
431+ 0xf01900f7,
432+ 0xffcf00f3,
433+ 0x0421f400,
434+ 0xf101e7f0,
435+ 0xf01d0007,
436+ 0x0ed00003,
437+/* 0x0593: ih_no_fifo */
438+ 0xf104bd00,
439+ 0xf0010007,
440+ 0x0ad00003,
441+ 0xfc04bd00,
442+ 0xfce0fcf0,
443+ 0xfcb0fcd0,
444+ 0xfc90fca0,
445+ 0x0088fe80,
446+ 0x32f480fc,
447+/* 0x05b7: hub_barrier_done */
448+ 0xf001f800,
449+ 0x0e9801f7,
450+ 0x04febb04,
451+ 0xf102ffb9,
452+ 0xf09418e7,
453+ 0x21f440e3,
454+/* 0x05cf: ctx_redswitch */
455+ 0xf000f89d,
456+ 0x07f120f7,
457+ 0x03f08500,
458+ 0x000fd001,
459+ 0xe7f004bd,
460+/* 0x05e1: ctx_redswitch_delay */
461+ 0x01e2b608,
462+ 0xf1fd1bf4,
463+ 0xf10800f5,
464+ 0xf10200f5,
456465 0xf0850007,
457466 0x0fd00103,
458− 0xf004bd00,
459−/* 0x05de: ctx_redswitch_delay */
460− 0xe2b608e7,
461− 0xfd1bf401,
462− 0x0800f5f1,
463− 0x0200f5f1,
464− 0x850007f1,
465− 0xd00103f0,
466− 0x04bd000f,
467−/* 0x05fa: ctx_xfer */
468− 0x07f100f8,
469− 0x03f08100,
470− 0x000fd002,
471− 0x11f404bd,
472− 0xcc21f507,
473−/* 0x060d: ctx_xfer_not_load */
474− 0x6a21f505,
475− 0xf124bd02,
476− 0xf047fc07,
477− 0x02d00203,
478− 0xf004bd00,
479− 0x20b6012c,
480− 0xfc07f103,
481− 0x0203f04a,
482− 0xbd0002d0,
483− 0x01acf004,
484− 0xf102a5f0,
485− 0xf00000b7,
486− 0x0c9850b3,
487− 0x0fc4b604,
488− 0x9800bcbb,
489− 0x0d98000c,
490− 0x00e7f001,
491− 0x016f21f5,
492− 0xf101acf0,
493− 0xf04000b7,
494− 0x0c9850b3,
495− 0x0fc4b604,
496− 0x9800bcbb,
497− 0x0d98010c,
498− 0x060f9802,
499− 0x0800e7f1,
500− 0x016f21f5,
467+ 0xf804bd00,
468+/* 0x05fd: ctx_xfer */
469+ 0x0007f100,
470+ 0x0203f081,
471+ 0xbd000fd0,
472+ 0x0711f404,
473+ 0x05cf21f5,
474+/* 0x0610: ctx_xfer_not_load */
475+ 0x026a21f5,
476+ 0x07f124bd,
477+ 0x03f047fc,
478+ 0x0002d002,
479+ 0x2cf004bd,
480+ 0x0320b601,
481+ 0x4afc07f1,
482+ 0xd00203f0,
483+ 0x04bd0002,
501484 0xf001acf0,
502− 0xb7f104a5,
503− 0xb3f03000,
485+ 0xb7f102a5,
486+ 0xb3f00000,
504487 0x040c9850,
505488 0xbb0fc4b6,
506489 0x0c9800bc,
507− 0x030d9802,
508− 0xf1080f98,
509− 0xf50200e7,
510− 0xf5016f21,
511− 0xf4025e21,
512− 0x12f40601,
513−/* 0x06a9: ctx_xfer_post */
514− 0x7f21f507,
515−/* 0x06ad: ctx_xfer_done */
516− 0xb421f502,
517− 0x0000f805,
518− 0x00000000,
490+ 0x010d9800,
491+ 0xf500e7f0,
492+ 0xf0016f21,
493+ 0xb7f101ac,
494+ 0xb3f04000,
495+ 0x040c9850,
496+ 0xbb0fc4b6,
497+ 0x0c9800bc,
498+ 0x020d9801,
499+ 0xf1060f98,
500+ 0xf50800e7,
501+ 0xf0016f21,
502+ 0xa5f001ac,
503+ 0x00b7f104,
504+ 0x50b3f030,
505+ 0xb6040c98,
506+ 0xbcbb0fc4,
507+ 0x020c9800,
508+ 0x98030d98,
509+ 0xe7f1080f,
510+ 0x21f50200,
511+ 0x21f5016f,
512+ 0x01f4025e,
513+ 0x0712f406,
514+/* 0x06ac: ctx_xfer_post */
515+ 0x027f21f5,
516+/* 0x06b0: ctx_xfer_done */
517+ 0x05b721f5,
518+ 0x000000f8,
519519 0x00000000,
520520 0x00000000,
521521 0x00000000,
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk110.fuc3.h+172−172
@@ -314,7 +314,7 @@ uint32_t gk110_grgpc_code[] = { · 313 unmodified lines
314314 0x03f01200,
315315 0x0002d000,
316316 0x17f104bd,
317− 0x10fe0542,
317+ 0x10fe0545,
318318 0x0007f100,
319319 0x0003f007,
320320 0xbd0000d0,
@@ -338,184 +338,184 @@ uint32_t gk110_grgpc_code[] = { · 17 unmodified lines
338338 0x02d00103,
339339 0xf104bd00,
340340 0xf00c30e7,
341− 0x24bd50e3,
342− 0x44bd34bd,
343−/* 0x0430: init_unk_loop */
344− 0xb06821f4,
345− 0x0bf400f6,
346− 0x01f7f00f,
347− 0xfd04f2bb,
348− 0x30b6054f,
349−/* 0x0445: init_unk_next */
350− 0x0120b601,
351− 0xb004e0b6,
352− 0x1bf40226,
353−/* 0x0451: init_unk_done */
354− 0x070380e2,
355− 0xf1080480,
356− 0xf0010027,
357− 0x22cf0223,
358− 0x9534bd00,
359− 0x07f10825,
360− 0x03f0c000,
361− 0x0005d001,
362− 0x07f104bd,
363− 0x03f0c100,
364− 0x0005d001,
365− 0x0e9804bd,
366− 0x010f9800,
367− 0x015021f5,
368− 0xbb002fbb,
369− 0x0e98003f,
370− 0x020f9801,
371− 0x015021f5,
372− 0xfd050e98,
373− 0x2ebb00ef,
374− 0x003ebb00,
375− 0x98020e98,
376− 0x21f5030f,
377− 0x0e980150,
378− 0x00effd07,
379− 0xbb002ebb,
380− 0x35b6003e,
381− 0x0007f102,
382− 0x0103f0d3,
383− 0xbd0003d0,
384− 0x0825b604,
385− 0xb60635b6,
386− 0x30b60120,
387− 0x0824b601,
388− 0xb90834b6,
389− 0x21f5022f,
390− 0x2fbb02d3,
391− 0x003fbb00,
392− 0x010007f1,
393− 0xd00203f0,
341+ 0xe5f050e3,
342+ 0xbd24bd01,
343+/* 0x0433: init_unk_loop */
344+ 0xf444bd34,
345+ 0xf6b06821,
346+ 0x0f0bf400,
347+ 0xbb01f7f0,
348+ 0x4ffd04f2,
349+ 0x0130b605,
350+/* 0x0448: init_unk_next */
351+ 0xb60120b6,
352+ 0x26b004e0,
353+ 0xe21bf402,
354+/* 0x0454: init_unk_done */
355+ 0x80070380,
356+ 0x27f10804,
357+ 0x23f00100,
358+ 0x0022cf02,
359+ 0x259534bd,
360+ 0x0007f108,
361+ 0x0103f0c0,
362+ 0xbd0005d0,
363+ 0x0007f104,
364+ 0x0103f0c1,
365+ 0xbd0005d0,
366+ 0x000e9804,
367+ 0xf5010f98,
368+ 0xbb015021,
369+ 0x3fbb002f,
370+ 0x010e9800,
371+ 0xf5020f98,
372+ 0x98015021,
373+ 0xeffd050e,
374+ 0x002ebb00,
375+ 0x98003ebb,
376+ 0x0f98020e,
377+ 0x5021f503,
378+ 0x070e9801,
379+ 0xbb00effd,
380+ 0x3ebb002e,
381+ 0x0235b600,
382+ 0xd30007f1,
383+ 0xd00103f0,
394384 0x04bd0003,
395− 0x29f024bd,
396− 0x0007f11f,
397− 0x0203f030,
398− 0xbd0002d0,
399−/* 0x0505: main */
400− 0x0031f404,
401− 0xf00028f4,
402− 0x21f424d7,
403− 0xf401f439,
404− 0xf404e4b0,
405− 0x81fe1e18,
406− 0x0627f001,
407− 0x12fd20bd,
408− 0x01e4b604,
409− 0xfe051efd,
410− 0x21f50018,
411− 0x0ef405fa,
412−/* 0x0535: main_not_ctx_xfer */
413− 0x10ef94d3,
414− 0xf501f5f0,
415− 0xf4037e21,
416−/* 0x0542: ih */
417− 0x80f9c60e,
418− 0xf90188fe,
419− 0xf990f980,
420− 0xf9b0f9a0,
421− 0xf9e0f9d0,
422− 0xf104bdf0,
423− 0xf00200a7,
424− 0xaacf00a3,
425− 0x04abc400,
426− 0xf02c0bf4,
427− 0xe7f124d7,
428− 0xe3f01a00,
429− 0x00eecf00,
430− 0x1900f7f1,
431− 0xcf00f3f0,
432− 0x21f400ff,
433− 0x01e7f004,
434− 0x1d0007f1,
435− 0xd00003f0,
436− 0x04bd000e,
437−/* 0x0590: ih_no_fifo */
438− 0x010007f1,
439− 0xd00003f0,
440− 0x04bd000a,
441− 0xe0fcf0fc,
442− 0xb0fcd0fc,
443− 0x90fca0fc,
444− 0x88fe80fc,
445− 0xf480fc00,
446− 0x01f80032,
447−/* 0x05b4: hub_barrier_done */
448− 0x9801f7f0,
449− 0xfebb040e,
450− 0x02ffb904,
451− 0x9418e7f1,
452− 0xf440e3f0,
453− 0x00f89d21,
454−/* 0x05cc: ctx_redswitch */
455− 0xf120f7f0,
385+ 0xb60825b6,
386+ 0x20b60635,
387+ 0x0130b601,
388+ 0xb60824b6,
389+ 0x2fb90834,
390+ 0xd321f502,
391+ 0x002fbb02,
392+ 0xf1003fbb,
393+ 0xf0010007,
394+ 0x03d00203,
395+ 0xbd04bd00,
396+ 0x1f29f024,
397+ 0x300007f1,
398+ 0xd00203f0,
399+ 0x04bd0002,
400+/* 0x0508: main */
401+ 0xf40031f4,
402+ 0xd7f00028,
403+ 0x3921f424,
404+ 0xb0f401f4,
405+ 0x18f404e4,
406+ 0x0181fe1e,
407+ 0xbd0627f0,
408+ 0x0412fd20,
409+ 0xfd01e4b6,
410+ 0x18fe051e,
411+ 0xfd21f500,
412+ 0xd30ef405,
413+/* 0x0538: main_not_ctx_xfer */
414+ 0xf010ef94,
415+ 0x21f501f5,
416+ 0x0ef4037e,
417+/* 0x0545: ih */
418+ 0xfe80f9c6,
419+ 0x80f90188,
420+ 0xa0f990f9,
421+ 0xd0f9b0f9,
422+ 0xf0f9e0f9,
423+ 0xa7f104bd,
424+ 0xa3f00200,
425+ 0x00aacf00,
426+ 0xf404abc4,
427+ 0xd7f02c0b,
428+ 0x00e7f124,
429+ 0x00e3f01a,
430+ 0xf100eecf,
431+ 0xf01900f7,
432+ 0xffcf00f3,
433+ 0x0421f400,
434+ 0xf101e7f0,
435+ 0xf01d0007,
436+ 0x0ed00003,
437+/* 0x0593: ih_no_fifo */
438+ 0xf104bd00,
439+ 0xf0010007,
440+ 0x0ad00003,
441+ 0xfc04bd00,
442+ 0xfce0fcf0,
443+ 0xfcb0fcd0,
444+ 0xfc90fca0,
445+ 0x0088fe80,
446+ 0x32f480fc,
447+/* 0x05b7: hub_barrier_done */
448+ 0xf001f800,
449+ 0x0e9801f7,
450+ 0x04febb04,
451+ 0xf102ffb9,
452+ 0xf09418e7,
453+ 0x21f440e3,
454+/* 0x05cf: ctx_redswitch */
455+ 0xf000f89d,
456+ 0x07f120f7,
457+ 0x03f08500,
458+ 0x000fd001,
459+ 0xe7f004bd,
460+/* 0x05e1: ctx_redswitch_delay */
461+ 0x01e2b608,
462+ 0xf1fd1bf4,
463+ 0xf10800f5,
464+ 0xf10200f5,
456465 0xf0850007,
457466 0x0fd00103,
458− 0xf004bd00,
459−/* 0x05de: ctx_redswitch_delay */
460− 0xe2b608e7,
461− 0xfd1bf401,
462− 0x0800f5f1,
463− 0x0200f5f1,
464− 0x850007f1,
465− 0xd00103f0,
466− 0x04bd000f,
467−/* 0x05fa: ctx_xfer */
468− 0x07f100f8,
469− 0x03f08100,
470− 0x000fd002,
471− 0x11f404bd,
472− 0xcc21f507,
473−/* 0x060d: ctx_xfer_not_load */
474− 0x6a21f505,
475− 0xf124bd02,
476− 0xf047fc07,
477− 0x02d00203,
478− 0xf004bd00,
479− 0x20b6012c,
480− 0xfc07f103,
481− 0x0203f04a,
482− 0xbd0002d0,
483− 0x01acf004,
484− 0xf102a5f0,
485− 0xf00000b7,
486− 0x0c9850b3,
487− 0x0fc4b604,
488− 0x9800bcbb,
489− 0x0d98000c,
490− 0x00e7f001,
491− 0x016f21f5,
492− 0xf101acf0,
493− 0xf04000b7,
494− 0x0c9850b3,
495− 0x0fc4b604,
496− 0x9800bcbb,
497− 0x0d98010c,
498− 0x060f9802,
499− 0x0800e7f1,
500− 0x016f21f5,
467+ 0xf804bd00,
468+/* 0x05fd: ctx_xfer */
469+ 0x0007f100,
470+ 0x0203f081,
471+ 0xbd000fd0,
472+ 0x0711f404,
473+ 0x05cf21f5,
474+/* 0x0610: ctx_xfer_not_load */
475+ 0x026a21f5,
476+ 0x07f124bd,
477+ 0x03f047fc,
478+ 0x0002d002,
479+ 0x2cf004bd,
480+ 0x0320b601,
481+ 0x4afc07f1,
482+ 0xd00203f0,
483+ 0x04bd0002,
501484 0xf001acf0,
502− 0xb7f104a5,
503− 0xb3f03000,
485+ 0xb7f102a5,
486+ 0xb3f00000,
504487 0x040c9850,
505488 0xbb0fc4b6,
506489 0x0c9800bc,
507− 0x030d9802,
508− 0xf1080f98,
509− 0xf50200e7,
510− 0xf5016f21,
511− 0xf4025e21,
512− 0x12f40601,
513−/* 0x06a9: ctx_xfer_post */
514− 0x7f21f507,
515−/* 0x06ad: ctx_xfer_done */
516− 0xb421f502,
517− 0x0000f805,
518− 0x00000000,
490+ 0x010d9800,
491+ 0xf500e7f0,
492+ 0xf0016f21,
493+ 0xb7f101ac,
494+ 0xb3f04000,
495+ 0x040c9850,
496+ 0xbb0fc4b6,
497+ 0x0c9800bc,
498+ 0x020d9801,
499+ 0xf1060f98,
500+ 0xf50800e7,
501+ 0xf0016f21,
502+ 0xa5f001ac,
503+ 0x00b7f104,
504+ 0x50b3f030,
505+ 0xb6040c98,
506+ 0xbcbb0fc4,
507+ 0x020c9800,
508+ 0x98030d98,
509+ 0xe7f1080f,
510+ 0x21f50200,
511+ 0x21f5016f,
512+ 0x01f4025e,
513+ 0x0712f406,
514+/* 0x06ac: ctx_xfer_post */
515+ 0x027f21f5,
516+/* 0x06b0: ctx_xfer_done */
517+ 0x05b721f5,
518+ 0x000000f8,
519519 0x00000000,
520520 0x00000000,
521521 0x00000000,
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk208.fuc5.h+154−154
@@ -276,7 +276,7 @@ uint32_t gk208_grgpc_code[] = { · 275 unmodified lines
276276 0x02020014,
277277 0xf6120040,
278278 0x04bd0002,
279− 0xfe048141,
279+ 0xfe048441,
280280 0x00400010,
281281 0x0000f607,
282282 0x040204bd,
@@ -295,165 +295,165 @@ uint32_t gk208_grgpc_code[] = { · 12 unmodified lines
295295 0x01c90080,
296296 0xbd0002f6,
297297 0x0c308e04,
298− 0xbd24bd50,
299−/* 0x0383: init_unk_loop */
300− 0x7e44bd34,
301− 0xb0000065,
302− 0x0bf400f6,
303− 0xbb010f0e,
304− 0x4ffd04f2,
305− 0x0130b605,
306−/* 0x0398: init_unk_next */
307− 0xb60120b6,
308− 0x26b004e0,
309− 0xe21bf401,
310−/* 0x03a4: init_unk_done */
311− 0xb50703b5,
312− 0x00820804,
313− 0x22cf0201,
314− 0x9534bd00,
315− 0x00800825,
316− 0x05f601c0,
317− 0x8004bd00,
318− 0xf601c100,
319− 0x04bd0005,
320− 0x98000e98,
321− 0x207e010f,
322− 0x2fbb0001,
323− 0x003fbb00,
324− 0x98010e98,
325− 0x207e020f,
326− 0x0e980001,
327− 0x00effd05,
328− 0xbb002ebb,
329− 0x0e98003e,
330− 0x030f9802,
331− 0x0001207e,
332− 0xfd070e98,
333− 0x2ebb00ef,
334− 0x003ebb00,
335− 0x800235b6,
336− 0xf601d300,
337− 0x04bd0003,
338− 0xb60825b6,
339− 0x20b60635,
340− 0x0130b601,
341− 0xb60824b6,
342− 0x2fb20834,
343− 0x0002687e,
344− 0xbb002fbb,
345− 0x0080003f,
346− 0x03f60201,
347− 0xbd04bd00,
348− 0x1f29f024,
349− 0x02300080,
350− 0xbd0002f6,
351−/* 0x0445: main */
352− 0x0031f404,
353− 0x0d0028f4,
354− 0x00377e24,
355− 0xf401f400,
356− 0xf404e4b0,
357− 0x81fe1d18,
358− 0xbd060201,
359− 0x0412fd20,
360− 0xfd01e4b6,
361− 0x18fe051e,
362− 0x05187e00,
363− 0xd40ef400,
364−/* 0x0474: main_not_ctx_xfer */
365− 0xf010ef94,
366− 0xf87e01f5,
367− 0x0ef40002,
368−/* 0x0481: ih */
369− 0xfe80f9c7,
370− 0x80f90188,
371− 0xa0f990f9,
372− 0xd0f9b0f9,
373− 0xf0f9e0f9,
374− 0x004a04bd,
375− 0x00aacf02,
376− 0xf404abc4,
377− 0x240d1f0b,
378− 0xcf1a004e,
379− 0x004f00ee,
380− 0x00ffcf19,
381− 0x0000047e,
382− 0x0040010e,
383− 0x000ef61d,
384−/* 0x04be: ih_no_fifo */
385− 0x004004bd,
386− 0x000af601,
387− 0xf0fc04bd,
388− 0xd0fce0fc,
389− 0xa0fcb0fc,
390− 0x80fc90fc,
391− 0xfc0088fe,
392− 0x0032f480,
393−/* 0x04de: hub_barrier_done */
394− 0x010f01f8,
395− 0xbb040e98,
396− 0xffb204fe,
397− 0x4094188e,
398− 0x00008f7e,
399−/* 0x04f2: ctx_redswitch */
400− 0x200f00f8,
298+ 0x01e5f050,
299+ 0x34bd24bd,
300+/* 0x0386: init_unk_loop */
301+ 0x657e44bd,
302+ 0xf6b00000,
303+ 0x0e0bf400,
304+ 0xf2bb010f,
305+ 0x054ffd04,
306+/* 0x039b: init_unk_next */
307+ 0xb60130b6,
308+ 0xe0b60120,
309+ 0x0126b004,
310+/* 0x03a7: init_unk_done */
311+ 0xb5e21bf4,
312+ 0x04b50703,
313+ 0x01008208,
314+ 0x0022cf02,
315+ 0x259534bd,
316+ 0xc0008008,
317+ 0x0005f601,
318+ 0x008004bd,
319+ 0x05f601c1,
320+ 0x9804bd00,
321+ 0x0f98000e,
322+ 0x01207e01,
323+ 0x002fbb00,
324+ 0x98003fbb,
325+ 0x0f98010e,
326+ 0x01207e02,
327+ 0x050e9800,
328+ 0xbb00effd,
329+ 0x3ebb002e,
330+ 0x020e9800,
331+ 0x7e030f98,
332+ 0x98000120,
333+ 0xeffd070e,
334+ 0x002ebb00,
335+ 0xb6003ebb,
336+ 0x00800235,
337+ 0x03f601d3,
338+ 0xb604bd00,
339+ 0x35b60825,
340+ 0x0120b606,
341+ 0xb60130b6,
342+ 0x34b60824,
343+ 0x7e2fb208,
344+ 0xbb000268,
345+ 0x3fbb002f,
346+ 0x01008000,
347+ 0x0003f602,
348+ 0x24bd04bd,
349+ 0x801f29f0,
350+ 0xf6023000,
351+ 0x04bd0002,
352+/* 0x0448: main */
353+ 0xf40031f4,
354+ 0x240d0028,
355+ 0x0000377e,
356+ 0xb0f401f4,
357+ 0x18f404e4,
358+ 0x0181fe1d,
359+ 0x20bd0602,
360+ 0xb60412fd,
361+ 0x1efd01e4,
362+ 0x0018fe05,
363+ 0x00051b7e,
364+/* 0x0477: main_not_ctx_xfer */
365+ 0x94d40ef4,
366+ 0xf5f010ef,
367+ 0x02f87e01,
368+ 0xc70ef400,
369+/* 0x0484: ih */
370+ 0x88fe80f9,
371+ 0xf980f901,
372+ 0xf9a0f990,
373+ 0xf9d0f9b0,
374+ 0xbdf0f9e0,
375+ 0x02004a04,
376+ 0xc400aacf,
377+ 0x0bf404ab,
378+ 0x4e240d1f,
379+ 0xeecf1a00,
380+ 0x19004f00,
381+ 0x7e00ffcf,
382+ 0x0e000004,
383+ 0x1d004001,
384+ 0xbd000ef6,
385+/* 0x04c1: ih_no_fifo */
386+ 0x01004004,
387+ 0xbd000af6,
388+ 0xfcf0fc04,
389+ 0xfcd0fce0,
390+ 0xfca0fcb0,
391+ 0xfe80fc90,
392+ 0x80fc0088,
393+ 0xf80032f4,
394+/* 0x04e1: hub_barrier_done */
395+ 0x98010f01,
396+ 0xfebb040e,
397+ 0x8effb204,
398+ 0x7e409418,
399+ 0xf800008f,
400+/* 0x04f5: ctx_redswitch */
401+ 0x80200f00,
402+ 0xf6018500,
403+ 0x04bd000f,
404+/* 0x0502: ctx_redswitch_delay */
405+ 0xe2b6080e,
406+ 0xfd1bf401,
407+ 0x0800f5f1,
408+ 0x0200f5f1,
401409 0x01850080,
402410 0xbd000ff6,
403−/* 0x04ff: ctx_redswitch_delay */
404− 0xb6080e04,
405− 0x1bf401e2,
406− 0x00f5f1fd,
407− 0x00f5f108,
408− 0x85008002,
409− 0x000ff601,
410− 0x00f804bd,
411−/* 0x0518: ctx_xfer */
412− 0x02810080,
413− 0xbd000ff6,
414− 0x0711f404,
415− 0x0004f27e,
416−/* 0x0528: ctx_xfer_not_load */
417− 0x0002167e,
418− 0xfc8024bd,
419− 0x02f60247,
420− 0xf004bd00,
421− 0x20b6012c,
422− 0x4afc8003,
411+/* 0x051b: ctx_xfer */
412+ 0x8000f804,
413+ 0xf6028100,
414+ 0x04bd000f,
415+ 0x7e0711f4,
416+/* 0x052b: ctx_xfer_not_load */
417+ 0x7e0004f5,
418+ 0xbd000216,
419+ 0x47fc8024,
423420 0x0002f602,
424− 0xacf004bd,
425− 0x02a5f001,
426− 0x5000008b,
427− 0xb6040c98,
428− 0xbcbb0fc4,
429− 0x000c9800,
430− 0x0e010d98,
431− 0x013d7e00,
432− 0x01acf000,
433− 0x5040008b,
434− 0xb6040c98,
435− 0xbcbb0fc4,
436− 0x010c9800,
437− 0x98020d98,
438− 0x004e060f,
439− 0x013d7e08,
440− 0x01acf000,
441− 0x8b04a5f0,
442− 0x98503000,
421+ 0x2cf004bd,
422+ 0x0320b601,
423+ 0x024afc80,
424+ 0xbd0002f6,
425+ 0x01acf004,
426+ 0x8b02a5f0,
427+ 0x98500000,
443428 0xc4b6040c,
444429 0x00bcbb0f,
445− 0x98020c98,
446− 0x0f98030d,
447− 0x02004e08,
430+ 0x98000c98,
431+ 0x000e010d,
448432 0x00013d7e,
449− 0x00020a7e,
450− 0xf40601f4,
451−/* 0x05b2: ctx_xfer_post */
452− 0x277e0712,
453−/* 0x05b6: ctx_xfer_done */
454− 0xde7e0002,
455− 0x00f80004,
456− 0x00000000,
433+ 0x8b01acf0,
434+ 0x98504000,
435+ 0xc4b6040c,
436+ 0x00bcbb0f,
437+ 0x98010c98,
438+ 0x0f98020d,
439+ 0x08004e06,
440+ 0x00013d7e,
441+ 0xf001acf0,
442+ 0x008b04a5,
443+ 0x0c985030,
444+ 0x0fc4b604,
445+ 0x9800bcbb,
446+ 0x0d98020c,
447+ 0x080f9803,
448+ 0x7e02004e,
449+ 0x7e00013d,
450+ 0xf400020a,
451+ 0x12f40601,
452+/* 0x05b5: ctx_xfer_post */
453+ 0x02277e07,
454+/* 0x05b9: ctx_xfer_done */
455+ 0x04e17e00,
456+ 0x0000f800,
457457 0x00000000,
458458 0x00000000,
459459 0x00000000,
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgm107.fuc5.h+237−237
@@ -289,7 +289,7 @@ uint32_t gm107_grgpc_code[] = { · 288 unmodified lines
289289 0x020014fe,
290290 0x12004002,
291291 0xbd0002f6,
292− 0x05b04104,
292+ 0x05b34104,
293293 0x400010fe,
294294 0x00f60700,
295295 0x0204bd00,
@@ -308,259 +308,259 @@ uint32_t gm107_grgpc_code[] = { · 12 unmodified lines
308308 0xc900800f,
309309 0x0002f601,
310310 0x308e04bd,
311− 0x24bd500c,
312− 0x44bd34bd,
313−/* 0x03b0: init_unk_loop */
314− 0x0000657e,
315− 0xf400f6b0,
316− 0x010f0e0b,
317− 0xfd04f2bb,
318− 0x30b6054f,
319−/* 0x03c5: init_unk_next */
320− 0x0120b601,
321− 0xb004e0b6,
322− 0x1bf40226,
323−/* 0x03d1: init_unk_done */
324− 0x0703b5e2,
325− 0x820804b5,
326− 0xcf020100,
327− 0x34bd0022,
328− 0x80082595,
329− 0xf601c000,
311+ 0xe5f0500c,
312+ 0xbd24bd01,
313+/* 0x03b3: init_unk_loop */
314+ 0x7e44bd34,
315+ 0xb0000065,
316+ 0x0bf400f6,
317+ 0xbb010f0e,
318+ 0x4ffd04f2,
319+ 0x0130b605,
320+/* 0x03c8: init_unk_next */
321+ 0xb60120b6,
322+ 0x26b004e0,
323+ 0xe21bf402,
324+/* 0x03d4: init_unk_done */
325+ 0xb50703b5,
326+ 0x00820804,
327+ 0x22cf0201,
328+ 0x9534bd00,
329+ 0x00800825,
330+ 0x05f601c0,
331+ 0x8004bd00,
332+ 0xf601c100,
330333 0x04bd0005,
331− 0x01c10080,
332− 0xbd0005f6,
333− 0x000e9804,
334− 0x7e010f98,
335− 0xbb000120,
336− 0x3fbb002f,
337− 0x010e9800,
338− 0x7e020f98,
339− 0x98000120,
340− 0xeffd050e,
341− 0x002ebb00,
342− 0x98003ebb,
343− 0x0f98020e,
344− 0x01207e03,
345− 0x070e9800,
346− 0xbb00effd,
347− 0x3ebb002e,
348− 0x0235b600,
349− 0x01d30080,
350− 0xbd0003f6,
351− 0x0825b604,
352− 0xb60635b6,
353− 0x30b60120,
354− 0x0824b601,
355− 0xb20834b6,
356− 0x02687e2f,
357− 0x002fbb00,
358− 0x0f003fbb,
359− 0x8effb23f,
360− 0xf0501d60,
361− 0x8f7e01e5,
362− 0x0c0f0000,
363− 0xa88effb2,
364− 0xe5f0501d,
365− 0x008f7e01,
366− 0x03147e00,
367− 0xb23f0f00,
368− 0x1d608eff,
369− 0x01e5f050,
370− 0x00008f7e,
371− 0xffb2000f,
372− 0x501d9c8e,
373− 0x7e01e5f0,
374− 0x0f00008f,
375− 0x03147e01,
376− 0x8effb200,
334+ 0x98000e98,
335+ 0x207e010f,
336+ 0x2fbb0001,
337+ 0x003fbb00,
338+ 0x98010e98,
339+ 0x207e020f,
340+ 0x0e980001,
341+ 0x00effd05,
342+ 0xbb002ebb,
343+ 0x0e98003e,
344+ 0x030f9802,
345+ 0x0001207e,
346+ 0xfd070e98,
347+ 0x2ebb00ef,
348+ 0x003ebb00,
349+ 0x800235b6,
350+ 0xf601d300,
351+ 0x04bd0003,
352+ 0xb60825b6,
353+ 0x20b60635,
354+ 0x0130b601,
355+ 0xb60824b6,
356+ 0x2fb20834,
357+ 0x0002687e,
358+ 0xbb002fbb,
359+ 0x3f0f003f,
360+ 0x501d608e,
361+ 0xb201e5f0,
362+ 0x008f7eff,
363+ 0x8e0c0f00,
377364 0xf0501da8,
378− 0x8f7e01e5,
379− 0xff0f0000,
380− 0x988effb2,
365+ 0xffb201e5,
366+ 0x00008f7e,
367+ 0x0003147e,
368+ 0x608e3f0f,
381369 0xe5f0501d,
382− 0x008f7e01,
383− 0xb2020f00,
384− 0x1da88eff,
370+ 0x7effb201,
371+ 0x0f00008f,
372+ 0x1d9c8e00,
385373 0x01e5f050,
386− 0x00008f7e,
374+ 0x8f7effb2,
375+ 0x010f0000,
387376 0x0003147e,
388− 0x85050498,
389− 0x98504000,
390− 0x64b60406,
391− 0x0056bb0f,
392−/* 0x04e0: tpc_strand_init_tpc_loop */
393− 0x05705eb8,
394− 0x00657e00,
395− 0xbdf6b200,
396−/* 0x04ed: tpc_strand_init_idx_loop */
397− 0x605eb874,
398− 0x7fb20005,
399− 0x00008f7e,
400− 0x05885eb8,
401− 0x082f9500,
402− 0x00008f7e,
403− 0x058c5eb8,
404− 0x082f9500,
377+ 0x501da88e,
378+ 0xb201e5f0,
379+ 0x008f7eff,
380+ 0x8eff0f00,
381+ 0xf0501d98,
382+ 0xffb201e5,
405383 0x00008f7e,
406− 0x05905eb8,
407− 0x00657e00,
408− 0x06f5b600,
409− 0xb601f0b6,
410− 0x2fbb08f4,
411− 0x003fbb00,
412− 0xb60170b6,
413− 0x1bf40162,
414− 0x0050b7bf,
415− 0x0142b608,
416− 0x0fa81bf4,
417− 0x8effb23f,
418− 0xf0501d60,
419− 0x8f7e01e5,
420− 0x0d0f0000,
421− 0xa88effb2,
384+ 0xa88e020f,
422385 0xe5f0501d,
423− 0x008f7e01,
424− 0x03147e00,
425− 0x01008000,
426− 0x0003f602,
427− 0x24bd04bd,
428− 0x801f29f0,
429− 0xf6023000,
430− 0x04bd0002,
431−/* 0x0574: main */
432− 0xf40031f4,
433− 0x240d0028,
434− 0x0000377e,
435− 0xb0f401f4,
436− 0x18f404e4,
437− 0x0181fe1d,
438− 0x20bd0602,
439− 0xb60412fd,
440− 0x1efd01e4,
441− 0x0018fe05,
442− 0x0006477e,
443−/* 0x05a3: main_not_ctx_xfer */
444− 0x94d40ef4,
445− 0xf5f010ef,
446− 0x02f87e01,
447− 0xc70ef400,
448−/* 0x05b0: ih */
449− 0x88fe80f9,
450− 0xf980f901,
451− 0xf9a0f990,
452− 0xf9d0f9b0,
453− 0xbdf0f9e0,
454− 0x02004a04,
455− 0xc400aacf,
456− 0x0bf404ab,
457− 0x4e240d1f,
458− 0xeecf1a00,
459− 0x19004f00,
460− 0x7e00ffcf,
461− 0x0e000004,
462− 0x1d004001,
463− 0xbd000ef6,
464−/* 0x05ed: ih_no_fifo */
465− 0x01004004,
466− 0xbd000af6,
467− 0xfcf0fc04,
468− 0xfcd0fce0,
469− 0xfca0fcb0,
470− 0xfe80fc90,
471− 0x80fc0088,
472− 0xf80032f4,
473−/* 0x060d: hub_barrier_done */
474− 0x98010f01,
475− 0xfebb040e,
476− 0x8effb204,
477− 0x7e409418,
478− 0xf800008f,
479−/* 0x0621: ctx_redswitch */
480− 0x80200f00,
386+ 0x7effb201,
387+ 0x7e00008f,
388+ 0x98000314,
389+ 0x00850504,
390+ 0x06985040,
391+ 0x0f64b604,
392+/* 0x04e3: tpc_strand_init_tpc_loop */
393+ 0xb80056bb,
394+ 0x0005705e,
395+ 0x0000657e,
396+ 0x74bdf6b2,
397+/* 0x04f0: tpc_strand_init_idx_loop */
398+ 0x05605eb8,
399+ 0x7e7fb200,
400+ 0xb800008f,
401+ 0x0005885e,
402+ 0x7e082f95,
403+ 0xb800008f,
404+ 0x00058c5e,
405+ 0x7e082f95,
406+ 0xb800008f,
407+ 0x0005905e,
408+ 0x0000657e,
409+ 0xb606f5b6,
410+ 0xf4b601f0,
411+ 0x002fbb08,
412+ 0xb6003fbb,
413+ 0x62b60170,
414+ 0xbf1bf401,
415+ 0x080050b7,
416+ 0xf40142b6,
417+ 0x3f0fa81b,
418+ 0x501d608e,
419+ 0xb201e5f0,
420+ 0x008f7eff,
421+ 0x8e0d0f00,
422+ 0xf0501da8,
423+ 0xffb201e5,
424+ 0x00008f7e,
425+ 0x0003147e,
426+ 0x02010080,
427+ 0xbd0003f6,
428+ 0xf024bd04,
429+ 0x00801f29,
430+ 0x02f60230,
431+/* 0x0577: main */
432+ 0xf404bd00,
433+ 0x28f40031,
434+ 0x7e240d00,
435+ 0xf4000037,
436+ 0xe4b0f401,
437+ 0x1d18f404,
438+ 0x020181fe,
439+ 0xfd20bd06,
440+ 0xe4b60412,
441+ 0x051efd01,
442+ 0x7e0018fe,
443+ 0xf400064a,
444+/* 0x05a6: main_not_ctx_xfer */
445+ 0xef94d40e,
446+ 0x01f5f010,
447+ 0x0002f87e,
448+/* 0x05b3: ih */
449+ 0xf9c70ef4,
450+ 0x0188fe80,
451+ 0x90f980f9,
452+ 0xb0f9a0f9,
453+ 0xe0f9d0f9,
454+ 0x04bdf0f9,
455+ 0xcf02004a,
456+ 0xabc400aa,
457+ 0x1f0bf404,
458+ 0x004e240d,
459+ 0x00eecf1a,
460+ 0xcf19004f,
461+ 0x047e00ff,
462+ 0x010e0000,
463+ 0xf61d0040,
464+ 0x04bd000e,
465+/* 0x05f0: ih_no_fifo */
466+ 0xf6010040,
467+ 0x04bd000a,
468+ 0xe0fcf0fc,
469+ 0xb0fcd0fc,
470+ 0x90fca0fc,
471+ 0x88fe80fc,
472+ 0xf480fc00,
473+ 0x01f80032,
474+/* 0x0610: hub_barrier_done */
475+ 0x0e98010f,
476+ 0x04febb04,
477+ 0x188effb2,
478+ 0x8f7e4094,
479+ 0x00f80000,
480+/* 0x0624: ctx_redswitch */
481+ 0x0080200f,
482+ 0x0ff60185,
483+ 0x0e04bd00,
484+/* 0x0631: ctx_redswitch_delay */
485+ 0x01e2b608,
486+ 0xf1fd1bf4,
487+ 0xf10800f5,
488+ 0x800200f5,
481489 0xf6018500,
482490 0x04bd000f,
483−/* 0x062e: ctx_redswitch_delay */
484− 0xe2b6080e,
485− 0xfd1bf401,
486− 0x0800f5f1,
487− 0x0200f5f1,
488− 0x01850080,
489− 0xbd000ff6,
490−/* 0x0647: ctx_xfer */
491− 0x8000f804,
492− 0xf6028100,
493− 0x04bd000f,
494− 0xc48effb2,
495− 0xe5f0501d,
496− 0x008f7e01,
497− 0x0711f400,
498− 0x0006217e,
499−/* 0x0664: ctx_xfer_not_load */
500− 0x0002167e,
501− 0xfc8024bd,
502− 0x02f60247,
503− 0xf004bd00,
504− 0x20b6012c,
505− 0x4afc8003,
491+/* 0x064a: ctx_xfer */
492+ 0x008000f8,
493+ 0x0ff60281,
494+ 0x8e04bd00,
495+ 0xf0501dc4,
496+ 0xffb201e5,
497+ 0x00008f7e,
498+ 0x7e0711f4,
499+/* 0x0667: ctx_xfer_not_load */
500+ 0x7e000624,
501+ 0xbd000216,
502+ 0x47fc8024,
506503 0x0002f602,
507− 0x0c0f04bd,
508− 0xa88effb2,
509− 0xe5f0501d,
510− 0x008f7e01,
511− 0x03147e00,
512− 0xb23f0f00,
513− 0x1d608eff,
514− 0x01e5f050,
504+ 0x2cf004bd,
505+ 0x0320b601,
506+ 0x024afc80,
507+ 0xbd0002f6,
508+ 0x8e0c0f04,
509+ 0xf0501da8,
510+ 0xffb201e5,
515511 0x00008f7e,
516− 0xffb2000f,
517− 0x501d9c8e,
518− 0x7e01e5f0,
512+ 0x0003147e,
513+ 0x608e3f0f,
514+ 0xe5f0501d,
515+ 0x7effb201,
519516 0x0f00008f,
520− 0x03147e01,
521− 0x01fcf000,
522− 0xb203f0b6,
523− 0x1da88eff,
517+ 0x1d9c8e00,
524518 0x01e5f050,
525− 0x00008f7e,
526− 0xf001acf0,
527− 0x008b02a5,
528− 0x0c985000,
529− 0x0fc4b604,
530− 0x9800bcbb,
531− 0x0d98000c,
532− 0x7e000e01,
533− 0xf000013d,
534− 0x008b01ac,
535− 0x0c985040,
536− 0x0fc4b604,
537− 0x9800bcbb,
538− 0x0d98010c,
539− 0x060f9802,
540− 0x7e08004e,
541− 0xf000013d,
519+ 0x8f7effb2,
520+ 0x010f0000,
521+ 0x0003147e,
522+ 0xb601fcf0,
523+ 0xa88e03f0,
524+ 0xe5f0501d,
525+ 0x7effb201,
526+ 0xf000008f,
542527 0xa5f001ac,
543− 0x30008b04,
528+ 0x00008b02,
544529 0x040c9850,
545530 0xbb0fc4b6,
546531 0x0c9800bc,
547− 0x030d9802,
548− 0x4e080f98,
549− 0x3d7e0200,
550− 0x0a7e0001,
551− 0x147e0002,
552− 0x01f40003,
553− 0x1a12f406,
554−/* 0x073c: ctx_xfer_post */
555− 0x0002277e,
556− 0xffb20d0f,
557− 0x501da88e,
558− 0x7e01e5f0,
559− 0x7e00008f,
560−/* 0x0753: ctx_xfer_done */
561− 0x7e000314,
562− 0xf800060d,
563− 0x00000000,
532+ 0x010d9800,
533+ 0x3d7e000e,
534+ 0xacf00001,
535+ 0x40008b01,
536+ 0x040c9850,
537+ 0xbb0fc4b6,
538+ 0x0c9800bc,
539+ 0x020d9801,
540+ 0x4e060f98,
541+ 0x3d7e0800,
542+ 0xacf00001,
543+ 0x04a5f001,
544+ 0x5030008b,
545+ 0xb6040c98,
546+ 0xbcbb0fc4,
547+ 0x020c9800,
548+ 0x98030d98,
549+ 0x004e080f,
550+ 0x013d7e02,
551+ 0x020a7e00,
552+ 0x03147e00,
553+ 0x0601f400,
554+/* 0x073f: ctx_xfer_post */
555+ 0x7e1a12f4,
556+ 0x0f000227,
557+ 0x1da88e0d,
558+ 0x01e5f050,
559+ 0x8f7effb2,
560+ 0x147e0000,
561+/* 0x0756: ctx_xfer_done */
562+ 0x107e0003,
563+ 0x00f80006,
564564 0x00000000,
565565 0x00000000,
566566 0x00000000,
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c+4−2
@@ -143,7 +143,7 @@ gf100_gr_zbc_depth_get(struct gf100_gr *gr, int format, · 142 unmodified lines
143143 static int
144144 gf100_fermi_mthd_zbc_color(struct nvkm_object *object, void *data, u32 size)
145145 {
146− struct gf100_gr *gr = (void *)object->engine;
146+ struct gf100_gr *gr = gf100_gr(nvkm_gr(object->engine));
147147 union {
148148 struct fermi_a_zbc_color_v0 v0;
149149 } *args = data;
@@ -189,7 +189,7 @@ gf100_fermi_mthd_zbc_color(struct nvkm_object *object, void *data, u32 size) · 39 unmodified lines
189189 static int
190190 gf100_fermi_mthd_zbc_depth(struct nvkm_object *object, void *data, u32 size)
191191 {
192− struct gf100_gr *gr = (void *)object->engine;
192+ struct gf100_gr *gr = gf100_gr(nvkm_gr(object->engine));
193193 union {
194194 struct fermi_a_zbc_depth_v0 v0;
195195 } *args = data;
@@ -1530,6 +1530,8 @@ gf100_gr_oneinit(struct nvkm_gr *base) · 1334 unmodified lines
15301530 gr->ppc_nr[i] = gr->func->ppc_nr;
15311531 for (j = 0; j < gr->ppc_nr[i]; j++) {
15321532 u8 mask = nvkm_rd32(device, GPC_UNIT(i, 0x0c30 + (j * 4)));
1533+ if (mask)
1534+ gr->ppc_mask[i] |= (1 << j);
15331535 gr->ppc_tpc_nr[i][j] = hweight8(mask);
15341536 }
15351537 }
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h+1−0
@@ -97,6 +97,7 @@ struct gf100_gr { · 96 unmodified lines
9797 u8 tpc_nr[GPC_MAX];
9898 u8 tpc_total;
9999 u8 ppc_nr[GPC_MAX];
100+ u8 ppc_mask[GPC_MAX];
100101 u8 ppc_tpc_nr[GPC_MAX][4];
101102
102103 struct nvkm_memory *unk4188b4;
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/base.c+5−0
@@ -97,7 +97,9 @@ static void * · 96 unmodified lines
9797 nvkm_instobj_dtor(struct nvkm_memory *memory)
9898 {
9999 struct nvkm_instobj *iobj = nvkm_instobj(memory);
100+ spin_lock(&iobj->imem->lock);
100101 list_del(&iobj->head);
102+ spin_unlock(&iobj->imem->lock);
101103 nvkm_memory_del(&iobj->parent);
102104 return iobj;
103105 }
@@ -190,7 +192,9 @@ nvkm_instobj_new(struct nvkm_instmem *imem, u32 size, u32 align, bool zero, · 86 unmodified lines
190192 nvkm_memory_ctor(&nvkm_instobj_func_slow, &iobj->memory);
191193 iobj->parent = memory;
192194 iobj->imem = imem;
195+ spin_lock(&iobj->imem->lock);
193196 list_add_tail(&iobj->head, &imem->list);
197+ spin_unlock(&iobj->imem->lock);
194198 memory = &iobj->memory;
195199 }
196200
@@ -309,5 +313,6 @@ nvkm_instmem_ctor(const struct nvkm_instmem_func *func, · 112 unmodified lines
309313 {
310314 nvkm_subdev_ctor(&nvkm_instmem, device, index, 0, &imem->subdev);
311315 imem->func = func;
316+ spin_lock_init(&imem->lock);
312317 INIT_LIST_HEAD(&imem->list);
313318 }
drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk104.c+1−1
@@ -59,7 +59,7 @@ gk104_volt_set(struct nvkm_volt *base, u32 uv) · 58 unmodified lines
5959 duty = (uv - bios->base) * div / bios->pwm_range;
6060
6161 nvkm_wr32(device, 0x20340, div);
62− nvkm_wr32(device, 0x20344, 0x8000000 | duty);
62+ nvkm_wr32(device, 0x20344, 0x80000000 | duty);
6363
6464 return 0;
6565 }
drivers/gpu/drm/radeon/cik.c+4−1
@@ -8472,7 +8472,7 @@ restart_ih: · 8471 unmodified lines
84728472 if (queue_dp)
84738473 schedule_work(&rdev->dp_work);
84748474 if (queue_hotplug)
8475− schedule_work(&rdev->hotplug_work);
8475+ schedule_delayed_work(&rdev->hotplug_work, 0);
84768476 if (queue_reset) {
84778477 rdev->needs_reset = true;
84788478 wake_up_all(&rdev->fence_queue);
@@ -9630,6 +9630,9 @@ static void dce8_program_watermarks(struct radeon_device *rdev, · 1151 unmodified lines
96309630 (rdev->disp_priority == 2)) {
96319631 DRM_DEBUG_KMS("force priority to high\n");
96329632 }
9633+
9634+ /* Save number of lines the linebuffer leads before the scanout */
9635+ radeon_crtc->lb_vblank_lead_lines = DIV_ROUND_UP(lb_size, mode->crtc_hdisplay);
96339636 }
96349637
96359638 /* select wm A */
drivers/gpu/drm/radeon/evergreen.c+4−1
@@ -2372,6 +2372,9 @@ static void evergreen_program_watermarks(struct radeon_device *rdev, · 2371 unmodified lines
23722372 c.full = dfixed_div(c, a);
23732373 priority_b_mark = dfixed_trunc(c);
23742374 priority_b_cnt |= priority_b_mark & PRIORITY_MARK_MASK;
2375+
2376+ /* Save number of lines the linebuffer leads before the scanout */
2377+ radeon_crtc->lb_vblank_lead_lines = DIV_ROUND_UP(lb_size, mode->crtc_hdisplay);
23752378 }
23762379
23772380 /* select wm A */
@@ -5344,7 +5347,7 @@ restart_ih: · 2966 unmodified lines
53445347 if (queue_dp)
53455348 schedule_work(&rdev->dp_work);
53465349 if (queue_hotplug)
5347− schedule_work(&rdev->hotplug_work);
5350+ schedule_delayed_work(&rdev->hotplug_work, 0);
53485351 if (queue_hdmi)
53495352 schedule_work(&rdev->audio_work);
53505353 if (queue_thermal && rdev->pm.dpm_enabled)
drivers/gpu/drm/radeon/r100.c+11−1
@@ -806,7 +806,7 @@ int r100_irq_process(struct radeon_device *rdev) · 805 unmodified lines
806806 status = r100_irq_ack(rdev);
807807 }
808808 if (queue_hotplug)
809− schedule_work(&rdev->hotplug_work);
809+ schedule_delayed_work(&rdev->hotplug_work, 0);
810810 if (rdev->msi_enabled) {
811811 switch (rdev->family) {
812812 case CHIP_RS400:
@@ -3217,6 +3217,9 @@ void r100_bandwidth_update(struct radeon_device *rdev) · 2404 unmodified lines
32173217 uint32_t pixel_bytes1 = 0;
32183218 uint32_t pixel_bytes2 = 0;
32193219
3220+ /* Guess line buffer size to be 8192 pixels */
3221+ u32 lb_size = 8192;
3222+
32203223 if (!rdev->mode_info.mode_config_initialized)
32213224 return;
32223225
@@ -3631,6 +3634,13 @@ void r100_bandwidth_update(struct radeon_device *rdev) · 408 unmodified lines
36313634 DRM_DEBUG_KMS("GRPH2_BUFFER_CNTL from to %x\n",
36323635 (unsigned int)RREG32(RADEON_GRPH2_BUFFER_CNTL));
36333636 }
3637+
3638+ /* Save number of lines the linebuffer leads before the scanout */
3639+ if (mode1)
3640+ rdev->mode_info.crtcs[0]->lb_vblank_lead_lines = DIV_ROUND_UP(lb_size, mode1->crtc_hdisplay);
3641+
3642+ if (mode2)
3643+ rdev->mode_info.crtcs[1]->lb_vblank_lead_lines = DIV_ROUND_UP(lb_size, mode2->crtc_hdisplay);
36343644 }
36353645
36363646 int r100_ring_test(struct radeon_device *rdev, struct radeon_ring *ring)
drivers/gpu/drm/radeon/r600.c+1−1
@@ -4276,7 +4276,7 @@ restart_ih: · 4275 unmodified lines
42764276 WREG32(IH_RB_RPTR, rptr);
42774277 }
42784278 if (queue_hotplug)
4279− schedule_work(&rdev->hotplug_work);
4279+ schedule_delayed_work(&rdev->hotplug_work, 0);
42804280 if (queue_hdmi)
42814281 schedule_work(&rdev->audio_work);
42824282 if (queue_thermal && rdev->pm.dpm_enabled)
drivers/gpu/drm/radeon/radeon.h+1−1
@@ -2414,7 +2414,7 @@ struct radeon_device { · 2413 unmodified lines
24142414 struct r600_ih ih; /* r6/700 interrupt ring */
24152415 struct radeon_rlc rlc;
24162416 struct radeon_mec mec;
2417− struct work_struct hotplug_work;
2417+ struct delayed_work hotplug_work;
24182418 struct work_struct dp_work;
24192419 struct work_struct audio_work;
24202420 int num_crtc; /* number of crtcs */
drivers/gpu/drm/radeon/radeon_agp.c+3−0
@@ -54,6 +54,9 @@ static struct radeon_agpmode_quirk radeon_agpmode_quirk_list[] = { · 53 unmodified lines
5454 /* Intel 82855PM host bridge / Mobility 9600 M10 RV350 Needs AGPMode 1 (lp #195051) */
5555 { PCI_VENDOR_ID_INTEL, 0x3340, PCI_VENDOR_ID_ATI, 0x4e50,
5656 PCI_VENDOR_ID_IBM, 0x0550, 1},
57+ /* Intel 82855PM host bridge / RV250/M9 GL [Mobility FireGL 9000/Radeon 9000] needs AGPMode 1 (Thinkpad T40p) */
58+ { PCI_VENDOR_ID_INTEL, 0x3340, PCI_VENDOR_ID_ATI, 0x4c66,
59+ PCI_VENDOR_ID_IBM, 0x054d, 1},
5760 /* Intel 82855PM host bridge / Mobility M7 needs AGPMode 1 */
5861 { PCI_VENDOR_ID_INTEL, 0x3340, PCI_VENDOR_ID_ATI, 0x4c57,
5962 PCI_VENDOR_ID_IBM, 0x0530, 1},
drivers/gpu/drm/radeon/radeon_connectors.c+20−1
@@ -1234,13 +1234,32 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) · 1233 unmodified lines
12341234 if (r < 0)
12351235 return connector_status_disconnected;
12361236
1237+ if (radeon_connector->detected_hpd_without_ddc) {
1238+ force = true;
1239+ radeon_connector->detected_hpd_without_ddc = false;
1240+ }
1241+
12371242 if (!force && radeon_check_hpd_status_unchanged(connector)) {
12381243 ret = connector->status;
12391244 goto exit;
12401245 }
12411246
1242− if (radeon_connector->ddc_bus)
1247+ if (radeon_connector->ddc_bus) {
12431248 dret = radeon_ddc_probe(radeon_connector, false);
1249+
1250+ /* Sometimes the pins required for the DDC probe on DVI
1251+ * connectors don't make contact at the same time that the ones
1252+ * for HPD do. If the DDC probe fails even though we had an HPD
1253+ * signal, try again later */
1254+ if (!dret && !force &&
1255+ connector->status != connector_status_connected) {
1256+ DRM_DEBUG_KMS("hpd detected without ddc, retrying in 1 second\n");
1257+ radeon_connector->detected_hpd_without_ddc = true;
1258+ schedule_delayed_work(&rdev->hotplug_work,
1259+ msecs_to_jiffies(1000));
1260+ goto exit;
1261+ }
1262+ }
12441263 if (dret) {
12451264 radeon_connector->detected_by_load = false;
12461265 radeon_connector_free_edid(connector);
drivers/gpu/drm/radeon/radeon_display.c+79−27
@@ -322,7 +322,9 @@ void radeon_crtc_handle_vblank(struct radeon_device *rdev, int crtc_id) · 321 unmodified lines
322322 * to complete in this vblank?
323323 */
324324 if (update_pending &&
325− (DRM_SCANOUTPOS_VALID & radeon_get_crtc_scanoutpos(rdev->ddev, crtc_id, 0,
325+ (DRM_SCANOUTPOS_VALID & radeon_get_crtc_scanoutpos(rdev->ddev,
326+ crtc_id,
327+ USE_REAL_VBLANKSTART,
326328 &vpos, &hpos, NULL, NULL,
327329 &rdev->mode_info.crtcs[crtc_id]->base.hwmode)) &&
328330 ((vpos >= (99 * rdev->mode_info.crtcs[crtc_id]->base.hwmode.crtc_vdisplay)/100) ||
@@ -401,6 +403,8 @@ static void radeon_flip_work_func(struct work_struct *__work) · 72 unmodified lines
401403 struct drm_crtc *crtc = &radeon_crtc->base;
402404 unsigned long flags;
403405 int r;
406+ int vpos, hpos, stat, min_udelay;
407+ struct drm_vblank_crtc *vblank = &crtc->dev->vblank[work->crtc_id];
404408
405409 down_read(&rdev->exclusive_lock);
406410 if (work->fence) {
@@ -437,6 +441,41 @@ static void radeon_flip_work_func(struct work_struct *__work) · 30 unmodified lines
437441 /* set the proper interrupt */
438442 radeon_irq_kms_pflip_irq_get(rdev, radeon_crtc->crtc_id);
439443
444+ /* If this happens to execute within the "virtually extended" vblank
445+ * interval before the start of the real vblank interval then it needs
446+ * to delay programming the mmio flip until the real vblank is entered.
447+ * This prevents completing a flip too early due to the way we fudge
448+ * our vblank counter and vblank timestamps in order to work around the
449+ * problem that the hw fires vblank interrupts before actual start of
450+ * vblank (when line buffer refilling is done for a frame). It
451+ * complements the fudging logic in radeon_get_crtc_scanoutpos() for
452+ * timestamping and radeon_get_vblank_counter_kms() for vblank counts.
453+ *
454+ * In practice this won't execute very often unless on very fast
455+ * machines because the time window for this to happen is very small.
456+ */
457+ for (;;) {
458+ /* GET_DISTANCE_TO_VBLANKSTART returns distance to real vblank
459+ * start in hpos, and to the "fudged earlier" vblank start in
460+ * vpos.
461+ */
462+ stat = radeon_get_crtc_scanoutpos(rdev->ddev, work->crtc_id,
463+ GET_DISTANCE_TO_VBLANKSTART,
464+ &vpos, &hpos, NULL, NULL,
465+ &crtc->hwmode);
466+
467+ if ((stat & (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_ACCURATE)) !=
468+ (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_ACCURATE) ||
469+ !(vpos >= 0 && hpos <= 0))
470+ break;
471+
472+ /* Sleep at least until estimated real start of hw vblank */
473+ spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
474+ min_udelay = (-hpos + 1) * max(vblank->linedur_ns / 1000, 5);
475+ usleep_range(min_udelay, 2 * min_udelay);
476+ spin_lock_irqsave(&crtc->dev->event_lock, flags);
477+ };
478+
440479 /* do the flip (mmio) */
441480 radeon_page_flip(rdev, radeon_crtc->crtc_id, work->base);
442481
@@ -1768,6 +1807,15 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc, · 1325 unmodified lines
17681807 * \param dev Device to query.
17691808 * \param crtc Crtc to query.
17701809 * \param flags Flags from caller (DRM_CALLED_FROM_VBLIRQ or 0).
1810+ * For driver internal use only also supports these flags:
1811+ *
1812+ * USE_REAL_VBLANKSTART to use the real start of vblank instead
1813+ * of a fudged earlier start of vblank.
1814+ *
1815+ * GET_DISTANCE_TO_VBLANKSTART to return distance to the
1816+ * fudged earlier start of vblank in *vpos and the distance
1817+ * to true start of vblank in *hpos.
1818+ *
17711819 * \param *vpos Location where vertical scanout position should be stored.
17721820 * \param *hpos Location where horizontal scanout position should go.
17731821 * \param *stime Target location for timestamp taken immediately before
@@ -1911,10 +1959,40 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, · 137 unmodified lines
19111959 vbl_end = 0;
19121960 }
19131961
1962+ /* Called from driver internal vblank counter query code? */
1963+ if (flags & GET_DISTANCE_TO_VBLANKSTART) {
1964+ /* Caller wants distance from real vbl_start in *hpos */
1965+ *hpos = *vpos - vbl_start;
1966+ }
1967+
1968+ /* Fudge vblank to start a few scanlines earlier to handle the
1969+ * problem that vblank irqs fire a few scanlines before start
1970+ * of vblank. Some driver internal callers need the true vblank
1971+ * start to be used and signal this via the USE_REAL_VBLANKSTART flag.
1972+ *
1973+ * The cause of the "early" vblank irq is that the irq is triggered
1974+ * by the line buffer logic when the line buffer read position enters
1975+ * the vblank, whereas our crtc scanout position naturally lags the
1976+ * line buffer read position.
1977+ */
1978+ if (!(flags & USE_REAL_VBLANKSTART))
1979+ vbl_start -= rdev->mode_info.crtcs[pipe]->lb_vblank_lead_lines;
1980+
19141981 /* Test scanout position against vblank region. */
19151982 if ((*vpos < vbl_start) && (*vpos >= vbl_end))
19161983 in_vbl = false;
19171984
1985+ /* In vblank? */
1986+ if (in_vbl)
1987+ ret |= DRM_SCANOUTPOS_IN_VBLANK;
1988+
1989+ /* Called from driver internal vblank counter query code? */
1990+ if (flags & GET_DISTANCE_TO_VBLANKSTART) {
1991+ /* Caller wants distance from fudged earlier vbl_start */
1992+ *vpos -= vbl_start;
1993+ return ret;
1994+ }
1995+
19181996 /* Check if inside vblank area and apply corrective offsets:
19191997 * vpos will then be >=0 in video scanout area, but negative
19201998 * within vblank area, counting down the number of lines until
@@ -1930,31 +2008,5 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, · 9 unmodified lines
19302008 /* Correct for shifted end of vbl at vbl_end. */
19312009 *vpos = *vpos - vbl_end;
19322010
1933− /* In vblank? */
1934− if (in_vbl)
1935− ret |= DRM_SCANOUTPOS_IN_VBLANK;
1936−
1937− /* Is vpos outside nominal vblank area, but less than
1938− * 1/100 of a frame height away from start of vblank?
1939− * If so, assume this isn't a massively delayed vblank
1940− * interrupt, but a vblank interrupt that fired a few
1941− * microseconds before true start of vblank. Compensate
1942− * by adding a full frame duration to the final timestamp.
1943− * Happens, e.g., on ATI R500, R600.
1944− *
1945− * We only do this if DRM_CALLED_FROM_VBLIRQ.
1946− */
1947− if ((flags & DRM_CALLED_FROM_VBLIRQ) && !in_vbl) {
1948− vbl_start = mode->crtc_vdisplay;
1949− vtotal = mode->crtc_vtotal;
1950−
1951− if (vbl_start - *vpos < vtotal / 100) {
1952− *vpos -= vtotal;
1953−
1954− /* Signal this correction as "applied". */
1955− ret |= 0x8;
1956− }
1957− }
1958−
19592011 return ret;
19602012 }
drivers/gpu/drm/radeon/radeon_irq_kms.c+4−4
@@ -74,7 +74,7 @@ irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg) · 73 unmodified lines
7474 static void radeon_hotplug_work_func(struct work_struct *work)
7575 {
7676 struct radeon_device *rdev = container_of(work, struct radeon_device,
77− hotplug_work);
77+ hotplug_work.work);
7878 struct drm_device *dev = rdev->ddev;
7979 struct drm_mode_config *mode_config = &dev->mode_config;
8080 struct drm_connector *connector;
@@ -302,7 +302,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev) · 221 unmodified lines
302302 }
303303 }
304304
305− INIT_WORK(&rdev->hotplug_work, radeon_hotplug_work_func);
305+ INIT_DELAYED_WORK(&rdev->hotplug_work, radeon_hotplug_work_func);
306306 INIT_WORK(&rdev->dp_work, radeon_dp_work_func);
307307 INIT_WORK(&rdev->audio_work, r600_audio_update_hdmi);
308308
@@ -310,7 +310,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev) · 1 unmodified line
310310 r = drm_irq_install(rdev->ddev, rdev->ddev->pdev->irq);
311311 if (r) {
312312 rdev->irq.installed = false;
313− flush_work(&rdev->hotplug_work);
313+ flush_delayed_work(&rdev->hotplug_work);
314314 return r;
315315 }
316316
@@ -333,7 +333,7 @@ void radeon_irq_kms_fini(struct radeon_device *rdev) · 16 unmodified lines
333333 rdev->irq.installed = false;
334334 if (rdev->msi_enabled)
335335 pci_disable_msi(rdev->pdev);
336− flush_work(&rdev->hotplug_work);
336+ flush_delayed_work(&rdev->hotplug_work);
337337 }
338338 }
339339
drivers/gpu/drm/radeon/radeon_kms.c+49−1
@@ -755,6 +755,8 @@ void radeon_driver_preclose_kms(struct drm_device *dev, · 754 unmodified lines
755755 */
756756 u32 radeon_get_vblank_counter_kms(struct drm_device *dev, int crtc)
757757 {
758+ int vpos, hpos, stat;
759+ u32 count;
758760 struct radeon_device *rdev = dev->dev_private;
759761
760762 if (crtc < 0 || crtc >= rdev->num_crtc) {
@@ -762,7 +764,53 @@ u32 radeon_get_vblank_counter_kms(struct drm_device *dev, int crtc) · 1 unmodified line
762764 return -EINVAL;
763765 }
764766
765− return radeon_get_vblank_counter(rdev, crtc);
767+ /* The hw increments its frame counter at start of vsync, not at start
768+ * of vblank, as is required by DRM core vblank counter handling.
769+ * Cook the hw count here to make it appear to the caller as if it
770+ * incremented at start of vblank. We measure distance to start of
771+ * vblank in vpos. vpos therefore will be >= 0 between start of vblank
772+ * and start of vsync, so vpos >= 0 means to bump the hw frame counter
773+ * result by 1 to give the proper appearance to caller.
774+ */
775+ if (rdev->mode_info.crtcs[crtc]) {
776+ /* Repeat readout if needed to provide stable result if
777+ * we cross start of vsync during the queries.
778+ */
779+ do {
780+ count = radeon_get_vblank_counter(rdev, crtc);
781+ /* Ask radeon_get_crtc_scanoutpos to return vpos as
782+ * distance to start of vblank, instead of regular
783+ * vertical scanout pos.
784+ */
785+ stat = radeon_get_crtc_scanoutpos(
786+ dev, crtc, GET_DISTANCE_TO_VBLANKSTART,
787+ &vpos, &hpos, NULL, NULL,
788+ &rdev->mode_info.crtcs[crtc]->base.hwmode);
789+ } while (count != radeon_get_vblank_counter(rdev, crtc));
790+
791+ if (((stat & (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_ACCURATE)) !=
792+ (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_ACCURATE))) {
793+ DRM_DEBUG_VBL("Query failed! stat %d\n", stat);
794+ }
795+ else {
796+ DRM_DEBUG_VBL("crtc %d: dist from vblank start %d\n",
797+ crtc, vpos);
798+
799+ /* Bump counter if we are at >= leading edge of vblank,
800+ * but before vsync where vpos would turn negative and
801+ * the hw counter really increments.
802+ */
803+ if (vpos >= 0)
804+ count++;
805+ }
806+ }
807+ else {
808+ /* Fallback to use value as is. */
809+ count = radeon_get_vblank_counter(rdev, crtc);
810+ DRM_DEBUG_VBL("NULL mode info! Returned count may be wrong.\n");
811+ }
812+
813+ return count;
766814 }
767815
768816 /**
drivers/gpu/drm/radeon/radeon_mode.h+5−0
@@ -367,6 +367,7 @@ struct radeon_crtc { · 366 unmodified lines
367367 u32 line_time;
368368 u32 wm_low;
369369 u32 wm_high;
370+ u32 lb_vblank_lead_lines;
370371 struct drm_display_mode hw_mode;
371372 enum radeon_output_csc output_csc;
372373 };
@@ -553,6 +554,7 @@ struct radeon_connector { · 180 unmodified lines
553554 void *con_priv;
554555 bool dac_load_detect;
555556 bool detected_by_load; /* if the connection status was determined by load */
557+ bool detected_hpd_without_ddc; /* if an HPD signal was detected on DVI, but ddc probing failed */
556558 uint16_t connector_object_id;
557559 struct radeon_hpd hpd;
558560 struct radeon_router router;
@@ -686,6 +688,9 @@ struct atom_voltage_table · 127 unmodified lines
686688 struct atom_voltage_table_entry entries[MAX_VOLTAGE_ENTRIES];
687689 };
688690
691+/* Driver internal use only flags of radeon_get_crtc_scanoutpos() */
692+#define USE_REAL_VBLANKSTART (1 << 30)
693+#define GET_DISTANCE_TO_VBLANKSTART (1 << 31)
689694
690695 extern void
691696 radeon_add_atom_connector(struct drm_device *dev,
drivers/gpu/drm/radeon/radeon_object.c+11−4
@@ -221,11 +221,17 @@ int radeon_bo_create(struct radeon_device *rdev, · 220 unmodified lines
221221 if (!(rdev->flags & RADEON_IS_PCIE))
222222 bo->flags &= ~(RADEON_GEM_GTT_WC | RADEON_GEM_GTT_UC);
223223
224+ /* Write-combined CPU mappings of GTT cause GPU hangs with RV6xx
225+ * See https://bugs.freedesktop.org/show_bug.cgi?id=91268
226+ */
227+ if (rdev->family >= CHIP_RV610 && rdev->family <= CHIP_RV635)
228+ bo->flags &= ~(RADEON_GEM_GTT_WC | RADEON_GEM_GTT_UC);
229+
224230 #ifdef CONFIG_X86_32
225231 /* XXX: Write-combined CPU mappings of GTT seem broken on 32-bit
226232 * See https://bugs.freedesktop.org/show_bug.cgi?id=84627
227233 */
228− bo->flags &= ~RADEON_GEM_GTT_WC;
234+ bo->flags &= ~(RADEON_GEM_GTT_WC | RADEON_GEM_GTT_UC);
229235 #elif defined(CONFIG_X86) && !defined(CONFIG_X86_PAT)
230236 /* Don't try to enable write-combining when it can't work, or things
231237 * may be slow
@@ -235,9 +241,10 @@ int radeon_bo_create(struct radeon_device *rdev, · 3 unmodified lines
235241 #warning Please enable CONFIG_MTRR and CONFIG_X86_PAT for better performance \
236242 thanks to write-combining
237243
238− DRM_INFO_ONCE("Please enable CONFIG_MTRR and CONFIG_X86_PAT for "
239− "better performance thanks to write-combining\n");
240− bo->flags &= ~RADEON_GEM_GTT_WC;
244+ if (bo->flags & RADEON_GEM_GTT_WC)
245+ DRM_INFO_ONCE("Please enable CONFIG_MTRR and CONFIG_X86_PAT for "
246+ "better performance thanks to write-combining\n");
247+ bo->flags &= ~(RADEON_GEM_GTT_WC | RADEON_GEM_GTT_UC);
241248 #endif
242249
243250 radeon_ttm_placement_from_domain(bo, domain);
drivers/gpu/drm/radeon/radeon_pm.c+4−3
@@ -1542,8 +1542,7 @@ int radeon_pm_late_init(struct radeon_device *rdev) · 1541 unmodified lines
15421542 ret = device_create_file(rdev->dev, &dev_attr_power_method);
15431543 if (ret)
15441544 DRM_ERROR("failed to create device file for power method\n");
1545− if (!ret)
1546− rdev->pm.sysfs_initialized = true;
1545+ rdev->pm.sysfs_initialized = true;
15471546 }
15481547
15491548 mutex_lock(&rdev->pm.mutex);
@@ -1757,7 +1756,9 @@ static bool radeon_pm_in_vbl(struct radeon_device *rdev) · 207 unmodified lines
17571756 */
17581757 for (crtc = 0; (crtc < rdev->num_crtc) && in_vbl; crtc++) {
17591758 if (rdev->pm.active_crtcs & (1 << crtc)) {
1760− vbl_status = radeon_get_crtc_scanoutpos(rdev->ddev, crtc, 0,
1759+ vbl_status = radeon_get_crtc_scanoutpos(rdev->ddev,
1760+ crtc,
1761+ USE_REAL_VBLANKSTART,
17611762 &vpos, &hpos, NULL, NULL,
17621763 &rdev->mode_info.crtcs[crtc]->base.hwmode);
17631764 if ((vbl_status & DRM_SCANOUTPOS_VALID) &&
drivers/gpu/drm/radeon/rs600.c+1−1
@@ -813,7 +813,7 @@ int rs600_irq_process(struct radeon_device *rdev) · 812 unmodified lines
813813 status = rs600_irq_ack(rdev);
814814 }
815815 if (queue_hotplug)
816− schedule_work(&rdev->hotplug_work);
816+ schedule_delayed_work(&rdev->hotplug_work, 0);
817817 if (queue_hdmi)
818818 schedule_work(&rdev->audio_work);
819819 if (rdev->msi_enabled) {
drivers/gpu/drm/radeon/rs690.c+10−0
@@ -207,6 +207,9 @@ void rs690_line_buffer_adjust(struct radeon_device *rdev, · 206 unmodified lines
207207 {
208208 u32 tmp;
209209
210+ /* Guess line buffer size to be 8192 pixels */
211+ u32 lb_size = 8192;
212+
210213 /*
211214 * Line Buffer Setup
212215 * There is a single line buffer shared by both display controllers.
@@ -243,6 +246,13 @@ void rs690_line_buffer_adjust(struct radeon_device *rdev, · 30 unmodified lines
243246 tmp |= V_006520_DC_LB_MEMORY_SPLIT_D1_1Q_D2_3Q;
244247 }
245248 WREG32(R_006520_DC_LB_MEMORY_SPLIT, tmp);
249+
250+ /* Save number of lines the linebuffer leads before the scanout */
251+ if (mode1)
252+ rdev->mode_info.crtcs[0]->lb_vblank_lead_lines = DIV_ROUND_UP(lb_size, mode1->crtc_hdisplay);
253+
254+ if (mode2)
255+ rdev->mode_info.crtcs[1]->lb_vblank_lead_lines = DIV_ROUND_UP(lb_size, mode2->crtc_hdisplay);
246256 }
247257
248258 struct rs690_watermark {
drivers/gpu/drm/radeon/rv730_dpm.c+1−1
@@ -464,7 +464,7 @@ void rv730_stop_dpm(struct radeon_device *rdev) · 463 unmodified lines
464464 result = rv770_send_msg_to_smc(rdev, PPSMC_MSG_TwoLevelsDisabled);
465465
466466 if (result != PPSMC_Result_OK)
467− DRM_ERROR("Could not force DPM to low\n");
467+ DRM_DEBUG("Could not force DPM to low\n");
468468
469469 WREG32_P(GENERAL_PWRMGT, 0, ~GLOBAL_PWRMGT_EN);
470470
drivers/gpu/drm/radeon/rv770_dpm.c+2−2
@@ -193,7 +193,7 @@ void rv770_stop_dpm(struct radeon_device *rdev) · 192 unmodified lines
193193 result = rv770_send_msg_to_smc(rdev, PPSMC_MSG_TwoLevelsDisabled);
194194
195195 if (result != PPSMC_Result_OK)
196− DRM_ERROR("Could not force DPM to low.\n");
196+ DRM_DEBUG("Could not force DPM to low.\n");
197197
198198 WREG32_P(GENERAL_PWRMGT, 0, ~GLOBAL_PWRMGT_EN);
199199
@@ -1418,7 +1418,7 @@ int rv770_resume_smc(struct radeon_device *rdev) · 1218 unmodified lines
14181418 int rv770_set_sw_state(struct radeon_device *rdev)
14191419 {
14201420 if (rv770_send_msg_to_smc(rdev, PPSMC_MSG_SwitchToSwState) != PPSMC_Result_OK)
1421− return -EINVAL;
1421+ DRM_DEBUG("rv770_set_sw_state failed\n");
14221422 return 0;
14231423 }
14241424
drivers/gpu/drm/radeon/si.c+4−1
@@ -2376,6 +2376,9 @@ static void dce6_program_watermarks(struct radeon_device *rdev, · 2375 unmodified lines
23762376 c.full = dfixed_div(c, a);
23772377 priority_b_mark = dfixed_trunc(c);
23782378 priority_b_cnt |= priority_b_mark & PRIORITY_MARK_MASK;
2379+
2380+ /* Save number of lines the linebuffer leads before the scanout */
2381+ radeon_crtc->lb_vblank_lead_lines = DIV_ROUND_UP(lb_size, mode->crtc_hdisplay);
23792382 }
23802383
23812384 /* select wm A */
@@ -6848,7 +6851,7 @@ restart_ih: · 4466 unmodified lines
68486851 if (queue_dp)
68496852 schedule_work(&rdev->dp_work);
68506853 if (queue_hotplug)
6851− schedule_work(&rdev->hotplug_work);
6854+ schedule_delayed_work(&rdev->hotplug_work, 0);
68526855 if (queue_thermal && rdev->pm.dpm_enabled)
68536856 schedule_work(&rdev->pm.dpm.thermal.work);
68546857 rdev->ih.rptr = rptr;
drivers/gpu/drm/radeon/si_dpm.c+1−1
@@ -2927,7 +2927,7 @@ static struct si_dpm_quirk si_dpm_quirk_list[] = { · 2926 unmodified lines
29272927 { PCI_VENDOR_ID_ATI, 0x6810, 0x1462, 0x3036, 0, 120000 },
29282928 { PCI_VENDOR_ID_ATI, 0x6811, 0x174b, 0xe271, 0, 120000 },
29292929 { PCI_VENDOR_ID_ATI, 0x6810, 0x174b, 0xe271, 85000, 90000 },
2930− { PCI_VENDOR_ID_ATI, 0x6811, 0x1762, 0x2015, 0, 120000 },
2930+ { PCI_VENDOR_ID_ATI, 0x6811, 0x1462, 0x2015, 0, 120000 },
29312931 { PCI_VENDOR_ID_ATI, 0x6811, 0x1043, 0x2015, 0, 120000 },
29322932 { 0, 0, 0, 0 },
29332933 };
drivers/gpu/drm/rockchip/rockchip_drm_gem.c+1−0
@@ -67,6 +67,7 @@ static int rockchip_drm_gem_object_mmap(struct drm_gem_object *obj, · 66 unmodified lines
6767 * VM_PFNMAP flag that was set by drm_gem_mmap_obj()/drm_gem_mmap().
6868 */
6969 vma->vm_flags &= ~VM_PFNMAP;
70+ vma->vm_pgoff = 0;
7071
7172 ret = dma_mmap_attrs(drm->dev, vma, rk_obj->kvaddr, rk_obj->dma_addr,
7273 obj->size, &rk_obj->dma_attrs);
drivers/gpu/drm/rockchip/rockchip_drm_vop.c+18−25
@@ -374,6 +374,7 @@ static const struct of_device_id vop_driver_dt_match[] = { · 373 unmodified lines
374374 .data = &rk3288_vop },
375375 {},
376376 };
377+MODULE_DEVICE_TABLE(of, vop_driver_dt_match);
377378
378379 static inline void vop_writel(struct vop *vop, uint32_t offset, uint32_t v)
379380 {
@@ -959,8 +960,8 @@ static int vop_update_plane_event(struct drm_plane *plane, · 579 unmodified lines
959960 val = (dest.y2 - dest.y1 - 1) << 16;
960961 val |= (dest.x2 - dest.x1 - 1) & 0xffff;
961962 VOP_WIN_SET(vop, win, dsp_info, val);
962− val = (dsp_sty - 1) << 16;
963− val |= (dsp_stx - 1) & 0xffff;
963+ val = dsp_sty << 16;
964+ val |= dsp_stx & 0xffff;
964965 VOP_WIN_SET(vop, win, dsp_st, val);
965966 VOP_WIN_SET(vop, win, rb_swap, rb_swap);
966967
@@ -1289,7 +1290,7 @@ static void vop_win_state_complete(struct vop_win *vop_win, · 322 unmodified lines
12891290
12901291 if (state->event) {
12911292 spin_lock_irqsave(&drm->event_lock, flags);
1292− drm_send_vblank_event(drm, -1, state->event);
1293+ drm_crtc_send_vblank_event(crtc, state->event);
12931294 spin_unlock_irqrestore(&drm->event_lock, flags);
12941295 }
12951296
@@ -1575,32 +1576,25 @@ static int vop_initial(struct vop *vop) · 279 unmodified lines
15751576 return PTR_ERR(vop->dclk);
15761577 }
15771578
1578− ret = clk_prepare(vop->hclk);
1579− if (ret < 0) {
1580− dev_err(vop->dev, "failed to prepare hclk\n");
1581− return ret;
1582− }
1583−
15841579 ret = clk_prepare(vop->dclk);
15851580 if (ret < 0) {
15861581 dev_err(vop->dev, "failed to prepare dclk\n");
1587− goto err_unprepare_hclk;
1582+ return ret;
15881583 }
15891584
1590− ret = clk_prepare(vop->aclk);
1585+ /* Enable both the hclk and aclk to setup the vop */
1586+ ret = clk_prepare_enable(vop->hclk);
15911587 if (ret < 0) {
1592− dev_err(vop->dev, "failed to prepare aclk\n");
1588+ dev_err(vop->dev, "failed to prepare/enable hclk\n");
15931589 goto err_unprepare_dclk;
15941590 }
15951591
1596− /*
1597− * enable hclk, so that we can config vop register.
1598− */
1599− ret = clk_enable(vop->hclk);
1592+ ret = clk_prepare_enable(vop->aclk);
16001593 if (ret < 0) {
1601− dev_err(vop->dev, "failed to prepare aclk\n");
1602− goto err_unprepare_aclk;
1594+ dev_err(vop->dev, "failed to prepare/enable aclk\n");
1595+ goto err_disable_hclk;
16031596 }
1597+
16041598 /*
16051599 * do hclk_reset, reset all vop registers.
16061600 */
@@ -1608,7 +1602,7 @@ static int vop_initial(struct vop *vop) · 1 unmodified line
16081602 if (IS_ERR(ahb_rst)) {
16091603 dev_err(vop->dev, "failed to get ahb reset\n");
16101604 ret = PTR_ERR(ahb_rst);
1611− goto err_disable_hclk;
1605+ goto err_disable_aclk;
16121606 }
16131607 reset_control_assert(ahb_rst);
16141608 usleep_range(10, 20);
@@ -1634,26 +1628,25 @@ static int vop_initial(struct vop *vop) · 19 unmodified lines
16341628 if (IS_ERR(vop->dclk_rst)) {
16351629 dev_err(vop->dev, "failed to get dclk reset\n");
16361630 ret = PTR_ERR(vop->dclk_rst);
1637− goto err_unprepare_aclk;
1631+ goto err_disable_aclk;
16381632 }
16391633 reset_control_assert(vop->dclk_rst);
16401634 usleep_range(10, 20);
16411635 reset_control_deassert(vop->dclk_rst);
16421636
16431637 clk_disable(vop->hclk);
1638+ clk_disable(vop->aclk);
16441639
16451640 vop->is_enabled = false;
16461641
16471642 return 0;
16481643
1644+err_disable_aclk:
1645+ clk_disable_unprepare(vop->aclk);
16491646 err_disable_hclk:
1650− clk_disable(vop->hclk);
1651−err_unprepare_aclk:
1652− clk_unprepare(vop->aclk);
1647+ clk_disable_unprepare(vop->hclk);
16531648 err_unprepare_dclk:
16541649 clk_unprepare(vop->dclk);
1655−err_unprepare_hclk:
1656− clk_unprepare(vop->hclk);
16571650 return ret;
16581651 }
16591652
drivers/gpu/drm/vc4/vc4_crtc.c+5−4
@@ -168,7 +168,7 @@ static int vc4_get_clock_select(struct drm_crtc *crtc) · 167 unmodified lines
168168 struct drm_connector *connector;
169169
170170 drm_for_each_connector(connector, crtc->dev) {
171− if (connector && connector->state->crtc == crtc) {
171+ if (connector->state->crtc == crtc) {
172172 struct drm_encoder *encoder = connector->encoder;
173173 struct vc4_encoder *vc4_encoder =
174174 to_vc4_encoder(encoder);
@@ -401,7 +401,8 @@ static void vc4_crtc_atomic_flush(struct drm_crtc *crtc, · 226 unmodified lines
401401 dlist_next++;
402402
403403 HVS_WRITE(SCALER_DISPLISTX(vc4_crtc->channel),
404− (u32 *)vc4_crtc->dlist - (u32 *)vc4->hvs->dlist);
404+ (u32 __iomem *)vc4_crtc->dlist -
405+ (u32 __iomem *)vc4->hvs->dlist);
405406
406407 /* Make the next display list start after ours. */
407408 vc4_crtc->dlist_size -= (dlist_next - vc4_crtc->dlist);
@@ -591,14 +592,14 @@ static int vc4_crtc_bind(struct device *dev, struct device *master, void *data) · 183 unmodified lines
591592 * that will take too much.
592593 */
593594 primary_plane = vc4_plane_init(drm, DRM_PLANE_TYPE_PRIMARY);
594− if (!primary_plane) {
595+ if (IS_ERR(primary_plane)) {
595596 dev_err(dev, "failed to construct primary plane\n");
596597 ret = PTR_ERR(primary_plane);
597598 goto err;
598599 }
599600
600601 cursor_plane = vc4_plane_init(drm, DRM_PLANE_TYPE_CURSOR);
601− if (!cursor_plane) {
602+ if (IS_ERR(cursor_plane)) {
602603 dev_err(dev, "failed to construct cursor plane\n");
603604 ret = PTR_ERR(cursor_plane);
604605 goto err_primary;
drivers/gpu/drm/vc4/vc4_drv.c+0−1
@@ -259,7 +259,6 @@ static struct platform_driver vc4_platform_driver = { · 258 unmodified lines
259259 .remove = vc4_platform_drm_remove,
260260 .driver = {
261261 .name = "vc4-drm",
262− .owner = THIS_MODULE,
263262 .of_match_table = vc4_of_match,
264263 },
265264 };
drivers/gpu/drm/vc4/vc4_hvs.c+4−4
@@ -75,10 +75,10 @@ void vc4_hvs_dump_state(struct drm_device *dev) · 74 unmodified lines
7575 for (i = 0; i < 64; i += 4) {
7676 DRM_INFO("0x%08x (%s): 0x%08x 0x%08x 0x%08x 0x%08x\n",
7777 i * 4, i < HVS_BOOTLOADER_DLIST_END ? "B" : "D",
78− ((uint32_t *)vc4->hvs->dlist)[i + 0],
79− ((uint32_t *)vc4->hvs->dlist)[i + 1],
80− ((uint32_t *)vc4->hvs->dlist)[i + 2],
81− ((uint32_t *)vc4->hvs->dlist)[i + 3]);
78+ readl((u32 __iomem *)vc4->hvs->dlist + i + 0),
79+ readl((u32 __iomem *)vc4->hvs->dlist + i + 1),
80+ readl((u32 __iomem *)vc4->hvs->dlist + i + 2),
81+ readl((u32 __iomem *)vc4->hvs->dlist + i + 3));
8282 }
8383 }
8484
drivers/gpu/drm/vc4/vc4_plane.c+14−4
@@ -70,7 +70,7 @@ static bool plane_enabled(struct drm_plane_state *state) · 69 unmodified lines
7070 return state->fb && state->crtc;
7171 }
7272
73−struct drm_plane_state *vc4_plane_duplicate_state(struct drm_plane *plane)
73+static struct drm_plane_state *vc4_plane_duplicate_state(struct drm_plane *plane)
7474 {
7575 struct vc4_plane_state *vc4_state;
7676
@@ -97,8 +97,8 @@ struct drm_plane_state *vc4_plane_duplicate_state(struct drm_plane *plane) · 20 unmodified lines
9797 return &vc4_state->base;
9898 }
9999
100−void vc4_plane_destroy_state(struct drm_plane *plane,
101− struct drm_plane_state *state)
100+static void vc4_plane_destroy_state(struct drm_plane *plane,
101+ struct drm_plane_state *state)
102102 {
103103 struct vc4_plane_state *vc4_state = to_vc4_plane_state(state);
104104
@@ -108,7 +108,7 @@ void vc4_plane_destroy_state(struct drm_plane *plane, · 3 unmodified lines
108108 }
109109
110110 /* Called during init to allocate the plane's atomic state. */
111−void vc4_plane_reset(struct drm_plane *plane)
111+static void vc4_plane_reset(struct drm_plane *plane)
112112 {
113113 struct vc4_plane_state *vc4_state;
114114
@@ -157,6 +157,16 @@ static int vc4_plane_mode_set(struct drm_plane *plane, · 42 unmodified lines
157157 int crtc_w = state->crtc_w;
158158 int crtc_h = state->crtc_h;
159159
160+ if (state->crtc_w << 16 != state->src_w ||
161+ state->crtc_h << 16 != state->src_h) {
162+ /* We don't support scaling yet, which involves
163+ * allocating the LBM memory for scaling temporary
164+ * storage, and putting filter kernels in the HVS
165+ * context.
166+ */
167+ return -EINVAL;
168+ }
169+
160170 if (crtc_x < 0) {
161171 offset += drm_format_plane_cpp(fb->pixel_format, 0) * -crtc_x;
162172 crtc_w += crtc_x;
drivers/gpu/drm/virtio/virtgpu_display.c+1−1
@@ -412,7 +412,7 @@ static const struct drm_connector_funcs virtio_gpu_connector_funcs = { · 411 unmodified lines
412412 .save = virtio_gpu_conn_save,
413413 .restore = virtio_gpu_conn_restore,
414414 .detect = virtio_gpu_conn_detect,
415− .fill_modes = drm_helper_probe_single_connector_modes,
415+ .fill_modes = drm_helper_probe_single_connector_modes_nomerge,
416416 .destroy = virtio_gpu_conn_destroy,
417417 .reset = drm_atomic_helper_connector_reset,
418418 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
drivers/gpu/ipu-v3/ipu-common.c+38−31
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 #include <linux/irqchip/chained_irq.h>
2929 #include <linux/irqdomain.h>
3030 #include <linux/of_device.h>
31+#include <linux/of_graph.h>
3132
3233 #include <drm/drm_fourcc.h>
3334
@@ -993,11 +994,25 @@ static void platform_device_unregister_children(struct platform_device *pdev) · 959 unmodified lines
993994 struct ipu_platform_reg {
994995 struct ipu_client_platformdata pdata;
995996 const char *name;
996− int reg_offset;
997997 };
998998
999+/* These must be in the order of the corresponding device tree port nodes */
9991000 static const struct ipu_platform_reg client_reg[] = {
10001001 {
1002+ .pdata = {
1003+ .csi = 0,
1004+ .dma[0] = IPUV3_CHANNEL_CSI0,
1005+ .dma[1] = -EINVAL,
1006+ },
1007+ .name = "imx-ipuv3-camera",
1008+ }, {
1009+ .pdata = {
1010+ .csi = 1,
1011+ .dma[0] = IPUV3_CHANNEL_CSI1,
1012+ .dma[1] = -EINVAL,
1013+ },
1014+ .name = "imx-ipuv3-camera",
1015+ }, {
10011016 .pdata = {
10021017 .di = 0,
10031018 .dc = 5,
@@ -1015,22 +1030,6 @@ static const struct ipu_platform_reg client_reg[] = { · 11 unmodified lines
10151030 .dma[1] = -EINVAL,
10161031 },
10171032 .name = "imx-ipuv3-crtc",
1018− }, {
1019− .pdata = {
1020− .csi = 0,
1021− .dma[0] = IPUV3_CHANNEL_CSI0,
1022− .dma[1] = -EINVAL,
1023− },
1024− .reg_offset = IPU_CM_CSI0_REG_OFS,
1025− .name = "imx-ipuv3-camera",
1026− }, {
1027− .pdata = {
1028− .csi = 1,
1029− .dma[0] = IPUV3_CHANNEL_CSI1,
1030− .dma[1] = -EINVAL,
1031− },
1032− .reg_offset = IPU_CM_CSI1_REG_OFS,
1033− .name = "imx-ipuv3-camera",
10341033 },
10351034 };
10361035
@@ -1051,22 +1050,30 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base) · 14 unmodified lines
10511050 for (i = 0; i < ARRAY_SIZE(client_reg); i++) {
10521051 const struct ipu_platform_reg *reg = &client_reg[i];
10531052 struct platform_device *pdev;
1054− struct resource res;
1055−
1056− if (reg->reg_offset) {
1057− memset(&res, 0, sizeof(res));
1058− res.flags = IORESOURCE_MEM;
1059− res.start = ipu_base + ipu->devtype->cm_ofs + reg->reg_offset;
1060− res.end = res.start + PAGE_SIZE - 1;
1061− pdev = platform_device_register_resndata(dev, reg->name,
1062− id++, &res, 1, &reg->pdata, sizeof(reg->pdata));
1063− } else {
1064− pdev = platform_device_register_data(dev, reg->name,
1065− id++, &reg->pdata, sizeof(reg->pdata));
1053+
1054+ pdev = platform_device_alloc(reg->name, id++);
1055+ if (!pdev) {
1056+ ret = -ENOMEM;
1057+ goto err_register;
1058+ }
1059+
1060+ pdev->dev.parent = dev;
1061+
1062+ /* Associate subdevice with the corresponding port node */
1063+ pdev->dev.of_node = of_graph_get_port_by_id(dev->of_node, i);
1064+ if (!pdev->dev.of_node) {
1065+ dev_err(dev, "missing port@%d node in %s\n", i,
1066+ dev->of_node->full_name);
1067+ ret = -ENODEV;
1068+ goto err_register;
10661069 }
10671070
1068− if (IS_ERR(pdev)) {
1069− ret = PTR_ERR(pdev);
1071+ ret = platform_device_add_data(pdev, &reg->pdata,
1072+ sizeof(reg->pdata));
1073+ if (!ret)
1074+ ret = platform_device_add(pdev);
1075+ if (ret) {
1076+ platform_device_put(pdev);
10701077 goto err_register;
10711078 }
10721079 }
drivers/hid/hid-ids.h+1−0
@@ -609,6 +609,7 @@ · 608 unmodified lines
609609 #define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110
610610 #define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f
611611 #define USB_DEVICE_ID_LOGITECH_HARMONY_PS3 0x0306
612+#define USB_DEVICE_ID_LOGITECH_KEYBOARD_G710_PLUS 0xc24d
612613 #define USB_DEVICE_ID_LOGITECH_MOUSE_C01A 0xc01a
613614 #define USB_DEVICE_ID_LOGITECH_MOUSE_C05A 0xc05a
614615 #define USB_DEVICE_ID_LOGITECH_MOUSE_C06A 0xc06a
drivers/hid/hid-lg.c+3−2
@@ -665,8 +665,9 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id) · 664 unmodified lines
665665 struct lg_drv_data *drv_data;
666666 int ret;
667667
668− /* Only work with the 1st interface (G29 presents multiple) */
669− if (iface_num != 0) {
668+ /* G29 only work with the 1st interface */
669+ if ((hdev->product == USB_DEVICE_ID_LOGITECH_G29_WHEEL) &&
670+ (iface_num != 0)) {
670671 dbg_hid("%s: ignoring ifnum %d\n", __func__, iface_num);
671672 return -ENODEV;
672673 }
drivers/hid/usbhid/hid-quirks.c+1−0
@@ -84,6 +84,7 @@ static const struct hid_blacklist { · 83 unmodified lines
8484 { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A, HID_QUIRK_ALWAYS_POLL },
8585 { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
8686 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077, HID_QUIRK_ALWAYS_POLL },
87+ { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KEYBOARD_G710_PLUS, HID_QUIRK_NOGET },
8788 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C01A, HID_QUIRK_ALWAYS_POLL },
8889 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C05A, HID_QUIRK_ALWAYS_POLL },
8990 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C06A, HID_QUIRK_ALWAYS_POLL },
drivers/hid/wacom_wac.c+3−2
@@ -2481,7 +2481,7 @@ void wacom_setup_device_quirks(struct wacom *wacom) · 2480 unmodified lines
24812481 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
24822482 if (features->touch_max)
24832483 features->device_type |= WACOM_DEVICETYPE_TOUCH;
2484− if (features->type >= INTUOSHT || features->type <= BAMBOO_PT)
2484+ if (features->type >= INTUOSHT && features->type <= BAMBOO_PT)
24852485 features->device_type |= WACOM_DEVICETYPE_PAD;
24862486
24872487 features->x_max = 4096;
@@ -3213,7 +3213,8 @@ static const struct wacom_features wacom_features_0x32F = · 725 unmodified lines
32133213 WACOM_DTU_OFFSET, WACOM_DTU_OFFSET };
32143214 static const struct wacom_features wacom_features_0x336 =
32153215 { "Wacom DTU1141", 23472, 13203, 1023, 0,
3216− DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4 };
3216+ DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4,
3217+ WACOM_DTU_OFFSET, WACOM_DTU_OFFSET };
32173218 static const struct wacom_features wacom_features_0x57 =
32183219 { "Wacom DTK2241", 95640, 54060, 2047, 63,
32193220 DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 6,
drivers/hwmon/Kconfig+2−0
@@ -324,6 +324,7 @@ config SENSORS_APPLESMC · 323 unmodified lines
324324 config SENSORS_ARM_SCPI
325325 tristate "ARM SCPI Sensors"
326326 depends on ARM_SCPI_PROTOCOL
327+ depends on THERMAL || !THERMAL_OF
327328 help
328329 This driver provides support for temperature, voltage, current
329330 and power sensors available on ARM Ltd's SCP based platforms. The
@@ -1471,6 +1472,7 @@ config SENSORS_INA209 · 1141 unmodified lines
14711472 config SENSORS_INA2XX
14721473 tristate "Texas Instruments INA219 and compatibles"
14731474 depends on I2C
1475+ select REGMAP_I2C
14741476 help
14751477 If you say yes here you get support for INA219, INA220, INA226,
14761478 INA230, and INA231 power monitor chips.
drivers/hwmon/applesmc.c+1−1
@@ -537,7 +537,7 @@ static int applesmc_init_index(struct applesmc_registers *s) · 536 unmodified lines
537537 static int applesmc_init_smcreg_try(void)
538538 {
539539 struct applesmc_registers *s = &smcreg;
540− bool left_light_sensor, right_light_sensor;
540+ bool left_light_sensor = 0, right_light_sensor = 0;
541541 unsigned int count;
542542 u8 tmp[1];
543543 int ret;
drivers/hwmon/scpi-hwmon.c+11−10
@@ -117,7 +117,7 @@ static int scpi_hwmon_probe(struct platform_device *pdev) · 116 unmodified lines
117117 struct scpi_ops *scpi_ops;
118118 struct device *hwdev, *dev = &pdev->dev;
119119 struct scpi_sensors *scpi_sensors;
120− int ret;
120+ int ret, idx;
121121
122122 scpi_ops = get_scpi_ops();
123123 if (!scpi_ops)
@@ -146,8 +146,8 @@ static int scpi_hwmon_probe(struct platform_device *pdev) · 22 unmodified lines
146146
147147 scpi_sensors->scpi_ops = scpi_ops;
148148
149− for (i = 0; i < nr_sensors; i++) {
150− struct sensor_data *sensor = &scpi_sensors->data[i];
149+ for (i = 0, idx = 0; i < nr_sensors; i++) {
150+ struct sensor_data *sensor = &scpi_sensors->data[idx];
151151
152152 ret = scpi_ops->sensor_get_info(i, &sensor->info);
153153 if (ret)
@@ -183,7 +183,7 @@ static int scpi_hwmon_probe(struct platform_device *pdev) · 29 unmodified lines
183183 num_power++;
184184 break;
185185 default:
186− break;
186+ continue;
187187 }
188188
189189 sensor->dev_attr_input.attr.mode = S_IRUGO;
@@ -194,11 +194,12 @@ static int scpi_hwmon_probe(struct platform_device *pdev) · 4 unmodified lines
194194 sensor->dev_attr_label.show = scpi_show_label;
195195 sensor->dev_attr_label.attr.name = sensor->label;
196196
197− scpi_sensors->attrs[i << 1] = &sensor->dev_attr_input.attr;
198− scpi_sensors->attrs[(i << 1) + 1] = &sensor->dev_attr_label.attr;
197+ scpi_sensors->attrs[idx << 1] = &sensor->dev_attr_input.attr;
198+ scpi_sensors->attrs[(idx << 1) + 1] = &sensor->dev_attr_label.attr;
199199
200− sysfs_attr_init(scpi_sensors->attrs[i << 1]);
201− sysfs_attr_init(scpi_sensors->attrs[(i << 1) + 1]);
200+ sysfs_attr_init(scpi_sensors->attrs[idx << 1]);
201+ sysfs_attr_init(scpi_sensors->attrs[(idx << 1) + 1]);
202+ idx++;
202203 }
203204
204205 scpi_sensors->group.attrs = scpi_sensors->attrs;
@@ -236,8 +237,8 @@ static int scpi_hwmon_probe(struct platform_device *pdev) · 31 unmodified lines
236237
237238 zone->sensor_id = i;
238239 zone->scpi_sensors = scpi_sensors;
239− zone->tzd = thermal_zone_of_sensor_register(dev, i, zone,
240− &scpi_sensor_ops);
240+ zone->tzd = thermal_zone_of_sensor_register(dev,
241+ sensor->info.sensor_id, zone, &scpi_sensor_ops);
241242 /*
242243 * The call to thermal_zone_of_sensor_register returns
243244 * an error for sensors that are not associated with
drivers/i2c/busses/Kconfig+1−0
@@ -126,6 +126,7 @@ config I2C_I801 · 125 unmodified lines
126126 Sunrise Point-LP (PCH)
127127 DNV (SOC)
128128 Broxton (SOC)
129+ Lewisburg (PCH)
129130
130131 This driver can also be built as a module. If so, the module
131132 will be called i2c-i801.
drivers/i2c/busses/i2c-i801.c+6−0
@@ -62,6 +62,8 @@ · 61 unmodified lines
6262 * Sunrise Point-LP (PCH) 0x9d23 32 hard yes yes yes
6363 * DNV (SOC) 0x19df 32 hard yes yes yes
6464 * Broxton (SOC) 0x5ad4 32 hard yes yes yes
65+ * Lewisburg (PCH) 0xa1a3 32 hard yes yes yes
66+ * Lewisburg Supersku (PCH) 0xa223 32 hard yes yes yes
6567 *
6668 * Features supported by this driver:
6769 * Software PEC no
@@ -206,6 +208,8 @@ · 138 unmodified lines
206208 #define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_SMBUS 0x9d23
207209 #define PCI_DEVICE_ID_INTEL_DNV_SMBUS 0x19df
208210 #define PCI_DEVICE_ID_INTEL_BROXTON_SMBUS 0x5ad4
211+#define PCI_DEVICE_ID_INTEL_LEWISBURG_SMBUS 0xa1a3
212+#define PCI_DEVICE_ID_INTEL_LEWISBURG_SSKU_SMBUS 0xa223
209213
210214 struct i801_mux_config {
211215 char *gpio_chip;
@@ -869,6 +873,8 @@ static const struct pci_device_id i801_ids[] = { · 657 unmodified lines
869873 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_SMBUS) },
870874 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_DNV_SMBUS) },
871875 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BROXTON_SMBUS) },
876+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_LEWISBURG_SMBUS) },
877+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_LEWISBURG_SSKU_SMBUS) },
872878 { 0, }
873879 };
874880
drivers/i2c/busses/i2c-imx.c+1−0
@@ -50,6 +50,7 @@ · 49 unmodified lines
5050 #include <linux/of_device.h>
5151 #include <linux/of_dma.h>
5252 #include <linux/of_gpio.h>
53+#include <linux/pinctrl/consumer.h>
5354 #include <linux/platform_data/i2c-imx.h>
5455 #include <linux/platform_device.h>
5556 #include <linux/sched.h>
drivers/i2c/busses/i2c-xiic.c+3−1
@@ -662,8 +662,10 @@ static void __xiic_start_xfer(struct xiic_i2c *i2c) · 661 unmodified lines
662662
663663 static void xiic_start_xfer(struct xiic_i2c *i2c)
664664 {
665−
665+ spin_lock(&i2c->lock);
666+ xiic_reinit(i2c);
666667 __xiic_start_xfer(i2c);
668+ spin_unlock(&i2c->lock);
667669 }
668670
669671 static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
drivers/i2c/i2c-core.c+1−1
@@ -715,7 +715,7 @@ static int i2c_device_probe(struct device *dev) · 714 unmodified lines
715715 if (wakeirq > 0 && wakeirq != client->irq)
716716 status = dev_pm_set_dedicated_wake_irq(dev, wakeirq);
717717 else if (client->irq > 0)
718− status = dev_pm_set_wake_irq(dev, wakeirq);
718+ status = dev_pm_set_wake_irq(dev, client->irq);
719719 else
720720 status = 0;
721721
drivers/iio/adc/ad7793.c+1−1
@@ -101,7 +101,7 @@ · 100 unmodified lines
101101 #define AD7795_CH_AIN1M_AIN1M 8 /* AIN1(-) - AIN1(-) */
102102
103103 /* ID Register Bit Designations (AD7793_REG_ID) */
104−#define AD7785_ID 0xB
104+#define AD7785_ID 0x3
105105 #define AD7792_ID 0xA
106106 #define AD7793_ID 0xB
107107 #define AD7794_ID 0xF
drivers/iio/adc/vf610_adc.c+16−6
@@ -106,6 +106,13 @@ · 105 unmodified lines
106106
107107 #define DEFAULT_SAMPLE_TIME 1000
108108
109+/* V at 25°C of 696 mV */
110+#define VF610_VTEMP25_3V0 950
111+/* V at 25°C of 699 mV */
112+#define VF610_VTEMP25_3V3 867
113+/* Typical sensor slope coefficient at all temperatures */
114+#define VF610_TEMP_SLOPE_COEFF 1840
115+
109116 enum clk_sel {
110117 VF610_ADCIOC_BUSCLK_SET,
111118 VF610_ADCIOC_ALTCLK_SET,
@@ -197,6 +204,8 @@ static inline void vf610_adc_calculate_rates(struct vf610_adc *info) · 85 unmodified lines
197204 adc_feature->clk_div = 8;
198205 }
199206
207+ adck_rate = ipg_rate / adc_feature->clk_div;
208+
200209 /*
201210 * Determine the long sample time adder value to be used based
202211 * on the default minimum sample time provided.
@@ -221,7 +230,6 @@ static inline void vf610_adc_calculate_rates(struct vf610_adc *info) · 18 unmodified lines
221230 * BCT (Base Conversion Time): fixed to 25 ADCK cycles for 12 bit mode
222231 * LSTAdder(Long Sample Time): 3, 5, 7, 9, 13, 17, 21, 25 ADCK cycles
223232 */
224− adck_rate = ipg_rate / info->adc_feature.clk_div;
225233 for (i = 0; i < ARRAY_SIZE(vf610_hw_avgs); i++)
226234 info->sample_freq_avail[i] =
227235 adck_rate / (6 + vf610_hw_avgs[i] *
@@ -663,11 +671,13 @@ static int vf610_read_raw(struct iio_dev *indio_dev, · 435 unmodified lines
663671 break;
664672 case IIO_TEMP:
665673 /*
666− * Calculate in degree Celsius times 1000
667− * Using sensor slope of 1.84 mV/°C and
668− * V at 25°C of 696 mV
669− */
670− *val = 25000 - ((int)info->value - 864) * 1000000 / 1840;
674+ * Calculate in degree Celsius times 1000
675+ * Using the typical sensor slope of 1.84 mV/°C
676+ * and VREFH_ADC at 3.3V, V at 25°C of 699 mV
677+ */
678+ *val = 25000 - ((int)info->value - VF610_VTEMP25_3V3) *
679+ 1000000 / VF610_TEMP_SLOPE_COEFF;
680+
671681 break;
672682 default:
673683 mutex_unlock(&indio_dev->mlock);
drivers/iio/adc/xilinx-xadc-core.c+1−0
@@ -841,6 +841,7 @@ static int xadc_read_raw(struct iio_dev *indio_dev, · 840 unmodified lines
841841 case XADC_REG_VCCINT:
842842 case XADC_REG_VCCAUX:
843843 case XADC_REG_VREFP:
844+ case XADC_REG_VREFN:
844845 case XADC_REG_VCCBRAM:
845846 case XADC_REG_VCCPINT:
846847 case XADC_REG_VCCPAUX:
drivers/iio/dac/ad5064.c+64−27
@@ -113,12 +113,16 @@ enum ad5064_type { · 112 unmodified lines
113113 ID_AD5065,
114114 ID_AD5628_1,
115115 ID_AD5628_2,
116+ ID_AD5629_1,
117+ ID_AD5629_2,
116118 ID_AD5648_1,
117119 ID_AD5648_2,
118120 ID_AD5666_1,
119121 ID_AD5666_2,
120122 ID_AD5668_1,
121123 ID_AD5668_2,
124+ ID_AD5669_1,
125+ ID_AD5669_2,
122126 };
123127
124128 static int ad5064_write(struct ad5064_state *st, unsigned int cmd,
@@ -291,7 +295,7 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info[] = { · 166 unmodified lines
291295 { },
292296 };
293297
294−#define AD5064_CHANNEL(chan, addr, bits) { \
298+#define AD5064_CHANNEL(chan, addr, bits, _shift) { \
295299 .type = IIO_VOLTAGE, \
296300 .indexed = 1, \
297301 .output = 1, \
@@ -303,36 +307,39 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info[] = { · 5 unmodified lines
303307 .sign = 'u', \
304308 .realbits = (bits), \
305309 .storagebits = 16, \
306− .shift = 20 - bits, \
310+ .shift = (_shift), \
307311 }, \
308312 .ext_info = ad5064_ext_info, \
309313 }
310314
311−#define DECLARE_AD5064_CHANNELS(name, bits) \
315+#define DECLARE_AD5064_CHANNELS(name, bits, shift) \
312316 const struct iio_chan_spec name[] = { \
313− AD5064_CHANNEL(0, 0, bits), \
314− AD5064_CHANNEL(1, 1, bits), \
315− AD5064_CHANNEL(2, 2, bits), \
316− AD5064_CHANNEL(3, 3, bits), \
317− AD5064_CHANNEL(4, 4, bits), \
318− AD5064_CHANNEL(5, 5, bits), \
319− AD5064_CHANNEL(6, 6, bits), \
320− AD5064_CHANNEL(7, 7, bits), \
317+ AD5064_CHANNEL(0, 0, bits, shift), \
318+ AD5064_CHANNEL(1, 1, bits, shift), \
319+ AD5064_CHANNEL(2, 2, bits, shift), \
320+ AD5064_CHANNEL(3, 3, bits, shift), \
321+ AD5064_CHANNEL(4, 4, bits, shift), \
322+ AD5064_CHANNEL(5, 5, bits, shift), \
323+ AD5064_CHANNEL(6, 6, bits, shift), \
324+ AD5064_CHANNEL(7, 7, bits, shift), \
321325 }
322326
323−#define DECLARE_AD5065_CHANNELS(name, bits) \
327+#define DECLARE_AD5065_CHANNELS(name, bits, shift) \
324328 const struct iio_chan_spec name[] = { \
325− AD5064_CHANNEL(0, 0, bits), \
326− AD5064_CHANNEL(1, 3, bits), \
329+ AD5064_CHANNEL(0, 0, bits, shift), \
330+ AD5064_CHANNEL(1, 3, bits, shift), \
327331 }
328332
329−static DECLARE_AD5064_CHANNELS(ad5024_channels, 12);
330−static DECLARE_AD5064_CHANNELS(ad5044_channels, 14);
331−static DECLARE_AD5064_CHANNELS(ad5064_channels, 16);
333+static DECLARE_AD5064_CHANNELS(ad5024_channels, 12, 8);
334+static DECLARE_AD5064_CHANNELS(ad5044_channels, 14, 6);
335+static DECLARE_AD5064_CHANNELS(ad5064_channels, 16, 4);
332336
333−static DECLARE_AD5065_CHANNELS(ad5025_channels, 12);
334−static DECLARE_AD5065_CHANNELS(ad5045_channels, 14);
335−static DECLARE_AD5065_CHANNELS(ad5065_channels, 16);
337+static DECLARE_AD5065_CHANNELS(ad5025_channels, 12, 8);
338+static DECLARE_AD5065_CHANNELS(ad5045_channels, 14, 6);
339+static DECLARE_AD5065_CHANNELS(ad5065_channels, 16, 4);
340+
341+static DECLARE_AD5064_CHANNELS(ad5629_channels, 12, 4);
342+static DECLARE_AD5064_CHANNELS(ad5669_channels, 16, 0);
336343
337344 static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
338345 [ID_AD5024] = {
@@ -382,6 +389,18 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = { · 43 unmodified lines
382389 .channels = ad5024_channels,
383390 .num_channels = 8,
384391 },
392+ [ID_AD5629_1] = {
393+ .shared_vref = true,
394+ .internal_vref = 2500000,
395+ .channels = ad5629_channels,
396+ .num_channels = 8,
397+ },
398+ [ID_AD5629_2] = {
399+ .shared_vref = true,
400+ .internal_vref = 5000000,
401+ .channels = ad5629_channels,
402+ .num_channels = 8,
403+ },
385404 [ID_AD5648_1] = {
386405 .shared_vref = true,
387406 .internal_vref = 2500000,
@@ -418,6 +437,18 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = { · 30 unmodified lines
418437 .channels = ad5064_channels,
419438 .num_channels = 8,
420439 },
440+ [ID_AD5669_1] = {
441+ .shared_vref = true,
442+ .internal_vref = 2500000,
443+ .channels = ad5669_channels,
444+ .num_channels = 8,
445+ },
446+ [ID_AD5669_2] = {
447+ .shared_vref = true,
448+ .internal_vref = 5000000,
449+ .channels = ad5669_channels,
450+ .num_channels = 8,
451+ },
421452 };
422453
423454 static inline unsigned int ad5064_num_vref(struct ad5064_state *st)
@@ -597,10 +628,16 @@ static int ad5064_i2c_write(struct ad5064_state *st, unsigned int cmd, · 173 unmodified lines
597628 unsigned int addr, unsigned int val)
598629 {
599630 struct i2c_client *i2c = to_i2c_client(st->dev);
631+ int ret;
600632
601633 st->data.i2c[0] = (cmd << 4) | addr;
602634 put_unaligned_be16(val, &st->data.i2c[1]);
603− return i2c_master_send(i2c, st->data.i2c, 3);
635+
636+ ret = i2c_master_send(i2c, st->data.i2c, 3);
637+ if (ret < 0)
638+ return ret;
639+
640+ return 0;
604641 }
605642
606643 static int ad5064_i2c_probe(struct i2c_client *i2c,
@@ -616,12 +653,12 @@ static int ad5064_i2c_remove(struct i2c_client *i2c) · 9 unmodified lines
616653 }
617654
618655 static const struct i2c_device_id ad5064_i2c_ids[] = {
619− {"ad5629-1", ID_AD5628_1},
620− {"ad5629-2", ID_AD5628_2},
621− {"ad5629-3", ID_AD5628_2}, /* similar enough to ad5629-2 */
622− {"ad5669-1", ID_AD5668_1},
623− {"ad5669-2", ID_AD5668_2},
624− {"ad5669-3", ID_AD5668_2}, /* similar enough to ad5669-2 */
656+ {"ad5629-1", ID_AD5629_1},
657+ {"ad5629-2", ID_AD5629_2},
658+ {"ad5629-3", ID_AD5629_2}, /* similar enough to ad5629-2 */
659+ {"ad5669-1", ID_AD5669_1},
660+ {"ad5669-2", ID_AD5669_2},
661+ {"ad5669-3", ID_AD5669_2}, /* similar enough to ad5669-2 */
625662 {}
626663 };
627664 MODULE_DEVICE_TABLE(i2c, ad5064_i2c_ids);
drivers/iio/humidity/si7020.c+4−4
@@ -50,10 +50,10 @@ static int si7020_read_raw(struct iio_dev *indio_dev, · 49 unmodified lines
5050
5151 switch (mask) {
5252 case IIO_CHAN_INFO_RAW:
53− ret = i2c_smbus_read_word_data(*client,
54− chan->type == IIO_TEMP ?
55− SI7020CMD_TEMP_HOLD :
56− SI7020CMD_RH_HOLD);
53+ ret = i2c_smbus_read_word_swapped(*client,
54+ chan->type == IIO_TEMP ?
55+ SI7020CMD_TEMP_HOLD :
56+ SI7020CMD_RH_HOLD);
5757 if (ret < 0)
5858 return ret;
5959 *val = ret >> 2;
drivers/iommu/s390-iommu.c+21−2
@@ -216,6 +216,7 @@ static int s390_iommu_update_trans(struct s390_domain *s390_domain, · 215 unmodified lines
216216 u8 *page_addr = (u8 *) (pa & PAGE_MASK);
217217 dma_addr_t start_dma_addr = dma_addr;
218218 unsigned long irq_flags, nr_pages, i;
219+ unsigned long *entry;
219220 int rc = 0;
220221
221222 if (dma_addr < s390_domain->domain.geometry.aperture_start ||
@@ -228,8 +229,12 @@ static int s390_iommu_update_trans(struct s390_domain *s390_domain, · 6 unmodified lines
228229
229230 spin_lock_irqsave(&s390_domain->dma_table_lock, irq_flags);
230231 for (i = 0; i < nr_pages; i++) {
231− dma_update_cpu_trans(s390_domain->dma_table, page_addr,
232− dma_addr, flags);
232+ entry = dma_walk_cpu_trans(s390_domain->dma_table, dma_addr);
233+ if (!entry) {
234+ rc = -ENOMEM;
235+ goto undo_cpu_trans;
236+ }
237+ dma_update_cpu_trans(entry, page_addr, flags);
233238 page_addr += PAGE_SIZE;
234239 dma_addr += PAGE_SIZE;
235240 }
@@ -242,6 +247,20 @@ static int s390_iommu_update_trans(struct s390_domain *s390_domain, · 6 unmodified lines
242247 break;
243248 }
244249 spin_unlock(&s390_domain->list_lock);
250+
251+undo_cpu_trans:
252+ if (rc && ((flags & ZPCI_PTE_VALID_MASK) == ZPCI_PTE_VALID)) {
253+ flags = ZPCI_PTE_INVALID;
254+ while (i-- > 0) {
255+ page_addr -= PAGE_SIZE;
256+ dma_addr -= PAGE_SIZE;
257+ entry = dma_walk_cpu_trans(s390_domain->dma_table,
258+ dma_addr);
259+ if (!entry)
260+ break;
261+ dma_update_cpu_trans(entry, page_addr, flags);
262+ }
263+ }
245264 spin_unlock_irqrestore(&s390_domain->dma_table_lock, irq_flags);
246265
247266 return rc;
drivers/irqchip/irq-gic-common.c+9−4
@@ -84,12 +84,15 @@ void __init gic_dist_config(void __iomem *base, int gic_irqs, · 83 unmodified lines
8484 writel_relaxed(GICD_INT_DEF_PRI_X4, base + GIC_DIST_PRI + i);
8585
8686 /*
87− * Disable all interrupts. Leave the PPI and SGIs alone
88− * as they are enabled by redistributor registers.
87+ * Deactivate and disable all SPIs. Leave the PPI and SGIs
88+ * alone as they are in the redistributor registers on GICv3.
8989 */
90− for (i = 32; i < gic_irqs; i += 32)
90+ for (i = 32; i < gic_irqs; i += 32) {
9191 writel_relaxed(GICD_INT_EN_CLR_X32,
92− base + GIC_DIST_ENABLE_CLEAR + i / 8);
92+ base + GIC_DIST_ACTIVE_CLEAR + i / 8);
93+ writel_relaxed(GICD_INT_EN_CLR_X32,
94+ base + GIC_DIST_ENABLE_CLEAR + i / 8);
95+ }
9396
9497 if (sync_access)
9598 sync_access();
@@ -102,7 +105,9 @@ void gic_cpu_config(void __iomem *base, void (*sync_access)(void)) · 6 unmodified lines
102105 /*
103106 * Deal with the banked PPI and SGI interrupts - disable all
104107 * PPI interrupts, ensure all SGI interrupts are enabled.
108+ * Make sure everything is deactivated.
105109 */
110+ writel_relaxed(GICD_INT_EN_CLR_X32, base + GIC_DIST_ACTIVE_CLEAR);
106111 writel_relaxed(GICD_INT_EN_CLR_PPI, base + GIC_DIST_ENABLE_CLEAR);
107112 writel_relaxed(GICD_INT_EN_SET_SGI, base + GIC_DIST_ENABLE_SET);
108113
drivers/irqchip/irq-gic.c+36−2
@@ -73,9 +73,11 @@ struct gic_chip_data { · 72 unmodified lines
7373 union gic_base cpu_base;
7474 #ifdef CONFIG_CPU_PM
7575 u32 saved_spi_enable[DIV_ROUND_UP(1020, 32)];
76+ u32 saved_spi_active[DIV_ROUND_UP(1020, 32)];
7677 u32 saved_spi_conf[DIV_ROUND_UP(1020, 16)];
7778 u32 saved_spi_target[DIV_ROUND_UP(1020, 4)];
7879 u32 __percpu *saved_ppi_enable;
80+ u32 __percpu *saved_ppi_active;
7981 u32 __percpu *saved_ppi_conf;
8082 #endif
8183 struct irq_domain *domain;
@@ -566,6 +568,10 @@ static void gic_dist_save(unsigned int gic_nr) · 484 unmodified lines
566568 for (i = 0; i < DIV_ROUND_UP(gic_irqs, 32); i++)
567569 gic_data[gic_nr].saved_spi_enable[i] =
568570 readl_relaxed(dist_base + GIC_DIST_ENABLE_SET + i * 4);
571+
572+ for (i = 0; i < DIV_ROUND_UP(gic_irqs, 32); i++)
573+ gic_data[gic_nr].saved_spi_active[i] =
574+ readl_relaxed(dist_base + GIC_DIST_ACTIVE_SET + i * 4);
569575 }
570576
571577 /*
@@ -604,9 +610,19 @@ static void gic_dist_restore(unsigned int gic_nr) · 32 unmodified lines
604610 writel_relaxed(gic_data[gic_nr].saved_spi_target[i],
605611 dist_base + GIC_DIST_TARGET + i * 4);
606612
607− for (i = 0; i < DIV_ROUND_UP(gic_irqs, 32); i++)
613+ for (i = 0; i < DIV_ROUND_UP(gic_irqs, 32); i++) {
614+ writel_relaxed(GICD_INT_EN_CLR_X32,
615+ dist_base + GIC_DIST_ENABLE_CLEAR + i * 4);
608616 writel_relaxed(gic_data[gic_nr].saved_spi_enable[i],
609617 dist_base + GIC_DIST_ENABLE_SET + i * 4);
618+ }
619+
620+ for (i = 0; i < DIV_ROUND_UP(gic_irqs, 32); i++) {
621+ writel_relaxed(GICD_INT_EN_CLR_X32,
622+ dist_base + GIC_DIST_ACTIVE_CLEAR + i * 4);
623+ writel_relaxed(gic_data[gic_nr].saved_spi_active[i],
624+ dist_base + GIC_DIST_ACTIVE_SET + i * 4);
625+ }
610626
611627 writel_relaxed(GICD_ENABLE, dist_base + GIC_DIST_CTRL);
612628 }
@@ -631,6 +647,10 @@ static void gic_cpu_save(unsigned int gic_nr) · 18 unmodified lines
631647 for (i = 0; i < DIV_ROUND_UP(32, 32); i++)
632648 ptr[i] = readl_relaxed(dist_base + GIC_DIST_ENABLE_SET + i * 4);
633649
650+ ptr = raw_cpu_ptr(gic_data[gic_nr].saved_ppi_active);
651+ for (i = 0; i < DIV_ROUND_UP(32, 32); i++)
652+ ptr[i] = readl_relaxed(dist_base + GIC_DIST_ACTIVE_SET + i * 4);
653+
634654 ptr = raw_cpu_ptr(gic_data[gic_nr].saved_ppi_conf);
635655 for (i = 0; i < DIV_ROUND_UP(32, 16); i++)
636656 ptr[i] = readl_relaxed(dist_base + GIC_DIST_CONFIG + i * 4);
@@ -654,8 +674,18 @@ static void gic_cpu_restore(unsigned int gic_nr) · 17 unmodified lines
654674 return;
655675
656676 ptr = raw_cpu_ptr(gic_data[gic_nr].saved_ppi_enable);
657− for (i = 0; i < DIV_ROUND_UP(32, 32); i++)
677+ for (i = 0; i < DIV_ROUND_UP(32, 32); i++) {
678+ writel_relaxed(GICD_INT_EN_CLR_X32,
679+ dist_base + GIC_DIST_ENABLE_CLEAR + i * 4);
658680 writel_relaxed(ptr[i], dist_base + GIC_DIST_ENABLE_SET + i * 4);
681+ }
682+
683+ ptr = raw_cpu_ptr(gic_data[gic_nr].saved_ppi_active);
684+ for (i = 0; i < DIV_ROUND_UP(32, 32); i++) {
685+ writel_relaxed(GICD_INT_EN_CLR_X32,
686+ dist_base + GIC_DIST_ACTIVE_CLEAR + i * 4);
687+ writel_relaxed(ptr[i], dist_base + GIC_DIST_ACTIVE_SET + i * 4);
688+ }
659689
660690 ptr = raw_cpu_ptr(gic_data[gic_nr].saved_ppi_conf);
661691 for (i = 0; i < DIV_ROUND_UP(32, 16); i++)
@@ -710,6 +740,10 @@ static void __init gic_pm_init(struct gic_chip_data *gic) · 48 unmodified lines
710740 sizeof(u32));
711741 BUG_ON(!gic->saved_ppi_enable);
712742
743+ gic->saved_ppi_active = __alloc_percpu(DIV_ROUND_UP(32, 32) * 4,
744+ sizeof(u32));
745+ BUG_ON(!gic->saved_ppi_active);
746+
713747 gic->saved_ppi_conf = __alloc_percpu(DIV_ROUND_UP(32, 16) * 4,
714748 sizeof(u32));
715749 BUG_ON(!gic->saved_ppi_conf);
drivers/isdn/hisax/config.c+1−1
@@ -1896,7 +1896,7 @@ static void EChannel_proc_rcv(struct hisax_d_if *d_if) · 1895 unmodified lines
18961896 ptr--;
18971897 *ptr++ = '\n';
18981898 *ptr = 0;
1899− HiSax_putstatus(cs, NULL, "%s", cs->dlog);
1899+ HiSax_putstatus(cs, NULL, cs->dlog);
19001900 } else
19011901 HiSax_putstatus(cs, "LogEcho: ",
19021902 "warning Frame too big (%d)",
drivers/isdn/hisax/hfc_pci.c+1−1
@@ -901,7 +901,7 @@ Begin: · 900 unmodified lines
901901 ptr--;
902902 *ptr++ = '\n';
903903 *ptr = 0;
904− HiSax_putstatus(cs, NULL, "%s", cs->dlog);
904+ HiSax_putstatus(cs, NULL, cs->dlog);
905905 } else
906906 HiSax_putstatus(cs, "LogEcho: ", "warning Frame too big (%d)", total - 3);
907907 }
drivers/isdn/hisax/hfc_sx.c+1−1
@@ -674,7 +674,7 @@ receive_emsg(struct IsdnCardState *cs) · 673 unmodified lines
674674 ptr--;
675675 *ptr++ = '\n';
676676 *ptr = 0;
677− HiSax_putstatus(cs, NULL, "%s", cs->dlog);
677+ HiSax_putstatus(cs, NULL, cs->dlog);
678678 } else
679679 HiSax_putstatus(cs, "LogEcho: ", "warning Frame too big (%d)", skb->len);
680680 }
drivers/isdn/hisax/q931.c+3−3
@@ -1179,7 +1179,7 @@ LogFrame(struct IsdnCardState *cs, u_char *buf, int size) · 1178 unmodified lines
11791179 dp--;
11801180 *dp++ = '\n';
11811181 *dp = 0;
1182− HiSax_putstatus(cs, NULL, "%s", cs->dlog);
1182+ HiSax_putstatus(cs, NULL, cs->dlog);
11831183 } else
11841184 HiSax_putstatus(cs, "LogFrame: ", "warning Frame too big (%d)", size);
11851185 }
@@ -1246,7 +1246,7 @@ dlogframe(struct IsdnCardState *cs, struct sk_buff *skb, int dir) · 60 unmodified lines
12461246 }
12471247 if (finish) {
12481248 *dp = 0;
1249− HiSax_putstatus(cs, NULL, "%s", cs->dlog);
1249+ HiSax_putstatus(cs, NULL, cs->dlog);
12501250 return;
12511251 }
12521252 if ((0xfe & buf[0]) == PROTO_DIS_N0) { /* 1TR6 */
@@ -1509,5 +1509,5 @@ dlogframe(struct IsdnCardState *cs, struct sk_buff *skb, int dir) · 256 unmodified lines
15091509 dp += sprintf(dp, "Unknown protocol %x!", buf[0]);
15101510 }
15111511 *dp = 0;
1512− HiSax_putstatus(cs, NULL, "%s", cs->dlog);
1512+ HiSax_putstatus(cs, NULL, cs->dlog);
15131513 }
drivers/lightnvm/core.c+79−60
@@ -123,6 +123,26 @@ void nvm_unregister_mgr(struct nvmm_type *mt) · 122 unmodified lines
123123 }
124124 EXPORT_SYMBOL(nvm_unregister_mgr);
125125
126+/* register with device with a supported manager */
127+static int register_mgr(struct nvm_dev *dev)
128+{
129+ struct nvmm_type *mt;
130+ int ret = 0;
131+
132+ list_for_each_entry(mt, &nvm_mgrs, list) {
133+ ret = mt->register_mgr(dev);
134+ if (ret > 0) {
135+ dev->mt = mt;
136+ break; /* successfully initialized */
137+ }
138+ }
139+
140+ if (!ret)
141+ pr_info("nvm: no compatible nvm manager found.\n");
142+
143+ return ret;
144+}
145+
126146 static struct nvm_dev *nvm_find_nvm_dev(const char *name)
127147 {
128148 struct nvm_dev *dev;
@@ -160,11 +180,6 @@ int nvm_erase_blk(struct nvm_dev *dev, struct nvm_block *blk) · 31 unmodified lines
160180 }
161181 EXPORT_SYMBOL(nvm_erase_blk);
162182
163−static void nvm_core_free(struct nvm_dev *dev)
164−{
165− kfree(dev);
166−}
167−
168183 static int nvm_core_init(struct nvm_dev *dev)
169184 {
170185 struct nvm_id *id = &dev->identity;
@@ -179,12 +194,21 @@ static int nvm_core_init(struct nvm_dev *dev) · 8 unmodified lines
179194 dev->sec_size = grp->csecs;
180195 dev->oob_size = grp->sos;
181196 dev->sec_per_pg = grp->fpg_sz / grp->csecs;
182− dev->addr_mode = id->ppat;
183− dev->addr_format = id->ppaf;
197+ memcpy(&dev->ppaf, &id->ppaf, sizeof(struct nvm_addr_format));
184198
185199 dev->plane_mode = NVM_PLANE_SINGLE;
186200 dev->max_rq_size = dev->ops->max_phys_sect * dev->sec_size;
187201
202+ if (grp->mtype != 0) {
203+ pr_err("nvm: memory type not supported\n");
204+ return -EINVAL;
205+ }
206+
207+ if (grp->fmtype != 0 && grp->fmtype != 1) {
208+ pr_err("nvm: flash type not supported\n");
209+ return -EINVAL;
210+ }
211+
188212 if (grp->mpos & 0x020202)
189213 dev->plane_mode = NVM_PLANE_DOUBLE;
190214 if (grp->mpos & 0x040404)
@@ -213,21 +237,17 @@ static void nvm_free(struct nvm_dev *dev) · 22 unmodified lines
213237
214238 if (dev->mt)
215239 dev->mt->unregister_mgr(dev);
216−
217− nvm_core_free(dev);
218240 }
219241
220242 static int nvm_init(struct nvm_dev *dev)
221243 {
222− struct nvmm_type *mt;
223− int ret = 0;
244+ int ret = -EINVAL;
224245
225246 if (!dev->q || !dev->ops)
226− return -EINVAL;
247+ return ret;
227248
228249 if (dev->ops->identity(dev->q, &dev->identity)) {
229250 pr_err("nvm: device could not be identified\n");
230− ret = -EINVAL;
231251 goto err;
232252 }
233253
@@ -251,21 +271,13 @@ static int nvm_init(struct nvm_dev *dev) · 17 unmodified lines
251271 goto err;
252272 }
253273
254− /* register with device with a supported manager */
255− list_for_each_entry(mt, &nvm_mgrs, list) {
256− ret = mt->register_mgr(dev);
257− if (ret < 0)
258− goto err; /* initialization failed */
259− if (ret > 0) {
260− dev->mt = mt;
261− break; /* successfully initialized */
262− }
263− }
264−
265− if (!ret) {
266− pr_info("nvm: no compatible manager found.\n");
274+ down_write(&nvm_lock);
275+ ret = register_mgr(dev);
276+ up_write(&nvm_lock);
277+ if (ret < 0)
278+ goto err;
279+ if (!ret)
267280 return 0;
268− }
269281
270282 pr_info("nvm: registered %s [%u/%u/%u/%u/%u/%u]\n",
271283 dev->name, dev->sec_per_pg, dev->nr_planes,
@@ -273,7 +285,6 @@ static int nvm_init(struct nvm_dev *dev) · 1 unmodified line
273285 dev->nr_chnls);
274286 return 0;
275287 err:
276− nvm_free(dev);
277288 pr_err("nvm: failed to initialize nvm\n");
278289 return ret;
279290 }
@@ -308,22 +319,26 @@ int nvm_register(struct request_queue *q, char *disk_name, · 28 unmodified lines
308319 if (ret)
309320 goto err_init;
310321
311− down_write(&nvm_lock);
312− list_add(&dev->devices, &nvm_devices);
313− up_write(&nvm_lock);
322+ if (dev->ops->max_phys_sect > 256) {
323+ pr_info("nvm: max sectors supported is 256.\n");
324+ ret = -EINVAL;
325+ goto err_init;
326+ }
314327
315328 if (dev->ops->max_phys_sect > 1) {
316329 dev->ppalist_pool = dev->ops->create_dma_pool(dev->q,
317330 "ppalist");
318331 if (!dev->ppalist_pool) {
319332 pr_err("nvm: could not create ppa pool\n");
320− return -ENOMEM;
333+ ret = -ENOMEM;
334+ goto err_init;
321335 }
322− } else if (dev->ops->max_phys_sect > 256) {
323− pr_info("nvm: max sectors supported is 256.\n");
324− return -EINVAL;
325336 }
326337
338+ down_write(&nvm_lock);
339+ list_add(&dev->devices, &nvm_devices);
340+ up_write(&nvm_lock);
341+
327342 return 0;
328343 err_init:
329344 kfree(dev);
@@ -333,19 +348,22 @@ EXPORT_SYMBOL(nvm_register); · 3 unmodified lines
333348
334349 void nvm_unregister(char *disk_name)
335350 {
336− struct nvm_dev *dev = nvm_find_nvm_dev(disk_name);
351+ struct nvm_dev *dev;
337352
353+ down_write(&nvm_lock);
354+ dev = nvm_find_nvm_dev(disk_name);
338355 if (!dev) {
339356 pr_err("nvm: could not find device %s to unregister\n",
340357 disk_name);
358+ up_write(&nvm_lock);
341359 return;
342360 }
343361
344− nvm_exit(dev);
345−
346− down_write(&nvm_lock);
347362 list_del(&dev->devices);
348363 up_write(&nvm_lock);
364+
365+ nvm_exit(dev);
366+ kfree(dev);
349367 }
350368 EXPORT_SYMBOL(nvm_unregister);
351369
@@ -358,38 +376,30 @@ static int nvm_create_target(struct nvm_dev *dev, · 6 unmodified lines
358376 {
359377 struct nvm_ioctl_create_simple *s = &create->conf.s;
360378 struct request_queue *tqueue;
361− struct nvmm_type *mt;
362379 struct gendisk *tdisk;
363380 struct nvm_tgt_type *tt;
364381 struct nvm_target *t;
365382 void *targetdata;
366383 int ret = 0;
367384
385+ down_write(&nvm_lock);
368386 if (!dev->mt) {
369− /* register with device with a supported NVM manager */
370− list_for_each_entry(mt, &nvm_mgrs, list) {
371− ret = mt->register_mgr(dev);
372− if (ret < 0)
373− return ret; /* initialization failed */
374− if (ret > 0) {
375− dev->mt = mt;
376− break; /* successfully initialized */
377− }
378− }
379−
380− if (!ret) {
381− pr_info("nvm: no compatible nvm manager found.\n");
382− return -ENODEV;
387+ ret = register_mgr(dev);
388+ if (!ret)
389+ ret = -ENODEV;
390+ if (ret < 0) {
391+ up_write(&nvm_lock);
392+ return ret;
383393 }
384394 }
385395
386396 tt = nvm_find_target_type(create->tgttype);
387397 if (!tt) {
388398 pr_err("nvm: target type %s not found\n", create->tgttype);
399+ up_write(&nvm_lock);
389400 return -EINVAL;
390401 }
391402
392− down_write(&nvm_lock);
393403 list_for_each_entry(t, &dev->online_targets, list) {
394404 if (!strcmp(create->tgtname, t->disk->disk_name)) {
395405 pr_err("nvm: target name already exists.\n");
@@ -457,11 +467,11 @@ static void nvm_remove_target(struct nvm_target *t) · 61 unmodified lines
457467 lockdep_assert_held(&nvm_lock);
458468
459469 del_gendisk(tdisk);
470+ blk_cleanup_queue(q);
471+
460472 if (tt->exit)
461473 tt->exit(tdisk->private_data);
462474
463− blk_cleanup_queue(q);
464−
465475 put_disk(tdisk);
466476
467477 list_del(&t->list);
@@ -473,7 +483,9 @@ static int __nvm_configure_create(struct nvm_ioctl_create *create) · 5 unmodified lines
473483 struct nvm_dev *dev;
474484 struct nvm_ioctl_create_simple *s;
475485
486+ down_write(&nvm_lock);
476487 dev = nvm_find_nvm_dev(create->dev);
488+ up_write(&nvm_lock);
477489 if (!dev) {
478490 pr_err("nvm: device not found\n");
479491 return -EINVAL;
@@ -532,7 +544,9 @@ static int nvm_configure_show(const char *val) · 52 unmodified lines
532544 return -EINVAL;
533545 }
534546
547+ down_write(&nvm_lock);
535548 dev = nvm_find_nvm_dev(devname);
549+ up_write(&nvm_lock);
536550 if (!dev) {
537551 pr_err("nvm: device not found\n");
538552 return -EINVAL;
@@ -541,7 +555,7 @@ static int nvm_configure_show(const char *val) · 2 unmodified lines
541555 if (!dev->mt)
542556 return 0;
543557
544− dev->mt->free_blocks_print(dev);
558+ dev->mt->lun_info_print(dev);
545559
546560 return 0;
547561 }
@@ -677,8 +691,10 @@ static long nvm_ioctl_info(struct file *file, void __user *arg) · 129 unmodified lines
677691 info->tgtsize = tgt_iter;
678692 up_write(&nvm_lock);
679693
680− if (copy_to_user(arg, info, sizeof(struct nvm_ioctl_info)))
694+ if (copy_to_user(arg, info, sizeof(struct nvm_ioctl_info))) {
695+ kfree(info);
681696 return -EFAULT;
697+ }
682698
683699 kfree(info);
684700 return 0;
@@ -721,8 +737,11 @@ static long nvm_ioctl_get_devices(struct file *file, void __user *arg) · 36 unmodified lines
721737
722738 devices->nr_devices = i;
723739
724− if (copy_to_user(arg, devices, sizeof(struct nvm_ioctl_get_devices)))
740+ if (copy_to_user(arg, devices,
741+ sizeof(struct nvm_ioctl_get_devices))) {
742+ kfree(devices);
725743 return -EFAULT;
744+ }
726745
727746 kfree(devices);
728747 return 0;
drivers/lightnvm/gennvm.c+62−25
@@ -60,23 +60,27 @@ static int gennvm_luns_init(struct nvm_dev *dev, struct gen_nvm *gn) · 59 unmodified lines
6060 lun->vlun.lun_id = i % dev->luns_per_chnl;
6161 lun->vlun.chnl_id = i / dev->luns_per_chnl;
6262 lun->vlun.nr_free_blocks = dev->blks_per_lun;
63+ lun->vlun.nr_inuse_blocks = 0;
64+ lun->vlun.nr_bad_blocks = 0;
6365 }
6466 return 0;
6567 }
6668
67−static int gennvm_block_bb(u32 lun_id, void *bb_bitmap, unsigned int nr_blocks,
69+static int gennvm_block_bb(struct ppa_addr ppa, int nr_blocks, u8 *blks,
6870 void *private)
6971 {
7072 struct gen_nvm *gn = private;
71− struct gen_lun *lun = &gn->luns[lun_id];
73+ struct nvm_dev *dev = gn->dev;
74+ struct gen_lun *lun;
7275 struct nvm_block *blk;
7376 int i;
7477
75− if (unlikely(bitmap_empty(bb_bitmap, nr_blocks)))
76− return 0;
78+ lun = &gn->luns[(dev->nr_luns * ppa.g.ch) + ppa.g.lun];
79+
80+ for (i = 0; i < nr_blocks; i++) {
81+ if (blks[i] == 0)
82+ continue;
7783
78− i = -1;
79− while ((i = find_next_bit(bb_bitmap, nr_blocks, i + 1)) < nr_blocks) {
8084 blk = &lun->vlun.blocks[i];
8185 if (!blk) {
8286 pr_err("gennvm: BB data is out of bounds.\n");
@@ -84,6 +88,7 @@ static int gennvm_block_bb(u32 lun_id, void *bb_bitmap, unsigned int nr_blocks, · 1 unmodified line
8488 }
8589
8690 list_move_tail(&blk->list, &lun->bb_list);
91+ lun->vlun.nr_bad_blocks++;
8792 }
8893
8994 return 0;
@@ -136,6 +141,7 @@ static int gennvm_block_map(u64 slba, u32 nlb, __le64 *entries, void *private) · 46 unmodified lines
136141 list_move_tail(&blk->list, &lun->used_list);
137142 blk->type = 1;
138143 lun->vlun.nr_free_blocks--;
144+ lun->vlun.nr_inuse_blocks++;
139145 }
140146 }
141147
@@ -164,15 +170,25 @@ static int gennvm_blocks_init(struct nvm_dev *dev, struct gen_nvm *gn) · 22 unmodified lines
164170 block->id = cur_block_id++;
165171
166172 /* First block is reserved for device */
167− if (unlikely(lun_iter == 0 && blk_iter == 0))
173+ if (unlikely(lun_iter == 0 && blk_iter == 0)) {
174+ lun->vlun.nr_free_blocks--;
168175 continue;
176+ }
169177
170178 list_add_tail(&block->list, &lun->free_list);
171179 }
172180
173181 if (dev->ops->get_bb_tbl) {
174− ret = dev->ops->get_bb_tbl(dev->q, lun->vlun.id,
175− dev->blks_per_lun, gennvm_block_bb, gn);
182+ struct ppa_addr ppa;
183+
184+ ppa.ppa = 0;
185+ ppa.g.ch = lun->vlun.chnl_id;
186+ ppa.g.lun = lun->vlun.id;
187+ ppa = generic_to_dev_addr(dev, ppa);
188+
189+ ret = dev->ops->get_bb_tbl(dev, ppa,
190+ dev->blks_per_lun,
191+ gennvm_block_bb, gn);
176192 if (ret)
177193 pr_err("gennvm: could not read BB table\n");
178194 }
@@ -190,6 +206,14 @@ static int gennvm_blocks_init(struct nvm_dev *dev, struct gen_nvm *gn) · 11 unmodified lines
190206 return 0;
191207 }
192208
209+static void gennvm_free(struct nvm_dev *dev)
210+{
211+ gennvm_blocks_free(dev);
212+ gennvm_luns_free(dev);
213+ kfree(dev->mp);
214+ dev->mp = NULL;
215+}
216+
193217 static int gennvm_register(struct nvm_dev *dev)
194218 {
195219 struct gen_nvm *gn;
@@ -199,6 +223,7 @@ static int gennvm_register(struct nvm_dev *dev) · 3 unmodified lines
199223 if (!gn)
200224 return -ENOMEM;
201225
226+ gn->dev = dev;
202227 gn->nr_luns = dev->nr_luns;
203228 dev->mp = gn;
204229
@@ -216,16 +241,13 @@ static int gennvm_register(struct nvm_dev *dev) · 11 unmodified lines
216241
217242 return 1;
218243 err:
219− kfree(gn);
244+ gennvm_free(dev);
220245 return ret;
221246 }
222247
223248 static void gennvm_unregister(struct nvm_dev *dev)
224249 {
225− gennvm_blocks_free(dev);
226− gennvm_luns_free(dev);
227− kfree(dev->mp);
228− dev->mp = NULL;
250+ gennvm_free(dev);
229251 }
230252
231253 static struct nvm_block *gennvm_get_blk(struct nvm_dev *dev,
@@ -254,6 +276,7 @@ static struct nvm_block *gennvm_get_blk(struct nvm_dev *dev, · 22 unmodified lines
254276 blk->type = 1;
255277
256278 lun->vlun.nr_free_blocks--;
279+ lun->vlun.nr_inuse_blocks++;
257280
258281 spin_unlock(&vlun->lock);
259282 out:
@@ -271,16 +294,21 @@ static void gennvm_put_blk(struct nvm_dev *dev, struct nvm_block *blk) · 11 unmodified lines
271294 case 1:
272295 list_move_tail(&blk->list, &lun->free_list);
273296 lun->vlun.nr_free_blocks++;
297+ lun->vlun.nr_inuse_blocks--;
274298 blk->type = 0;
275299 break;
276300 case 2:
277301 list_move_tail(&blk->list, &lun->bb_list);
302+ lun->vlun.nr_bad_blocks++;
303+ lun->vlun.nr_inuse_blocks--;
278304 break;
279305 default:
280306 WARN_ON_ONCE(1);
281307 pr_err("gennvm: erroneous block type (%lu -> %u)\n",
282308 blk->id, blk->type);
283309 list_move_tail(&blk->list, &lun->bb_list);
310+ lun->vlun.nr_bad_blocks++;
311+ lun->vlun.nr_inuse_blocks--;
284312 }
285313
286314 spin_unlock(&vlun->lock);
@@ -292,10 +320,10 @@ static void gennvm_addr_to_generic_mode(struct nvm_dev *dev, struct nvm_rq *rqd) · 5 unmodified lines
292320
293321 if (rqd->nr_pages > 1) {
294322 for (i = 0; i < rqd->nr_pages; i++)
295− rqd->ppa_list[i] = addr_to_generic_mode(dev,
323+ rqd->ppa_list[i] = dev_to_generic_addr(dev,
296324 rqd->ppa_list[i]);
297325 } else {
298− rqd->ppa_addr = addr_to_generic_mode(dev, rqd->ppa_addr);
326+ rqd->ppa_addr = dev_to_generic_addr(dev, rqd->ppa_addr);
299327 }
300328 }
301329
@@ -305,10 +333,10 @@ static void gennvm_generic_to_addr_mode(struct nvm_dev *dev, struct nvm_rq *rqd) · 3 unmodified lines
305333
306334 if (rqd->nr_pages > 1) {
307335 for (i = 0; i < rqd->nr_pages; i++)
308− rqd->ppa_list[i] = generic_to_addr_mode(dev,
336+ rqd->ppa_list[i] = generic_to_dev_addr(dev,
309337 rqd->ppa_list[i]);
310338 } else {
311− rqd->ppa_addr = generic_to_addr_mode(dev, rqd->ppa_addr);
339+ rqd->ppa_addr = generic_to_dev_addr(dev, rqd->ppa_addr);
312340 }
313341 }
314342
@@ -354,10 +382,10 @@ static void gennvm_mark_blk_bad(struct nvm_dev *dev, struct nvm_rq *rqd) · 39 unmodified lines
354382 {
355383 int i;
356384
357− if (!dev->ops->set_bb)
385+ if (!dev->ops->set_bb_tbl)
358386 return;
359387
360− if (dev->ops->set_bb(dev->q, rqd, 1))
388+ if (dev->ops->set_bb_tbl(dev->q, rqd, 1))
361389 return;
362390
363391 gennvm_addr_to_generic_mode(dev, rqd);
@@ -440,15 +468,24 @@ static struct nvm_lun *gennvm_get_lun(struct nvm_dev *dev, int lunid) · 76 unmodified lines
440468 return &gn->luns[lunid].vlun;
441469 }
442470
443−static void gennvm_free_blocks_print(struct nvm_dev *dev)
471+static void gennvm_lun_info_print(struct nvm_dev *dev)
444472 {
445473 struct gen_nvm *gn = dev->mp;
446474 struct gen_lun *lun;
447475 unsigned int i;
448476
449− gennvm_for_each_lun(gn, lun, i)
450− pr_info("%s: lun%8u\t%u\n",
451− dev->name, i, lun->vlun.nr_free_blocks);
477+
478+ gennvm_for_each_lun(gn, lun, i) {
479+ spin_lock(&lun->vlun.lock);
480+
481+ pr_info("%s: lun%8u\t%u\t%u\t%u\n",
482+ dev->name, i,
483+ lun->vlun.nr_free_blocks,
484+ lun->vlun.nr_inuse_blocks,
485+ lun->vlun.nr_bad_blocks);
486+
487+ spin_unlock(&lun->vlun.lock);
488+ }
452489 }
453490
454491 static struct nvmm_type gennvm = {
@@ -466,7 +503,7 @@ static struct nvmm_type gennvm = { · 11 unmodified lines
466503 .erase_blk = gennvm_erase_blk,
467504
468505 .get_lun = gennvm_get_lun,
469− .free_blocks_print = gennvm_free_blocks_print,
506+ .lun_info_print = gennvm_lun_info_print,
470507 };
471508
472509 static int __init gennvm_module_init(void)
drivers/lightnvm/gennvm.h+2−0
@@ -35,6 +35,8 @@ struct gen_lun { · 34 unmodified lines
3535 };
3636
3737 struct gen_nvm {
38+ struct nvm_dev *dev;
39+
3840 int nr_luns;
3941 struct gen_lun *luns;
4042 };
drivers/lightnvm/rrpc.c+31−1
@@ -123,12 +123,42 @@ static u64 block_to_addr(struct rrpc *rrpc, struct rrpc_block *rblk) · 122 unmodified lines
123123 return blk->id * rrpc->dev->pgs_per_blk;
124124 }
125125
126+static struct ppa_addr linear_to_generic_addr(struct nvm_dev *dev,
127+ struct ppa_addr r)
128+{
129+ struct ppa_addr l;
130+ int secs, pgs, blks, luns;
131+ sector_t ppa = r.ppa;
132+
133+ l.ppa = 0;
134+
135+ div_u64_rem(ppa, dev->sec_per_pg, &secs);
136+ l.g.sec = secs;
137+
138+ sector_div(ppa, dev->sec_per_pg);
139+ div_u64_rem(ppa, dev->sec_per_blk, &pgs);
140+ l.g.pg = pgs;
141+
142+ sector_div(ppa, dev->pgs_per_blk);
143+ div_u64_rem(ppa, dev->blks_per_lun, &blks);
144+ l.g.blk = blks;
145+
146+ sector_div(ppa, dev->blks_per_lun);
147+ div_u64_rem(ppa, dev->luns_per_chnl, &luns);
148+ l.g.lun = luns;
149+
150+ sector_div(ppa, dev->luns_per_chnl);
151+ l.g.ch = ppa;
152+
153+ return l;
154+}
155+
126156 static struct ppa_addr rrpc_ppa_to_gaddr(struct nvm_dev *dev, u64 addr)
127157 {
128158 struct ppa_addr paddr;
129159
130160 paddr.ppa = addr;
131− return __linear_to_generic_addr(dev, paddr);
161+ return linear_to_generic_addr(dev, paddr);
132162 }
133163
134164 /* requires lun->lock taken */
drivers/md/dm-crypt.c+13−9
@@ -112,7 +112,8 @@ struct iv_tcw_private { · 111 unmodified lines
112112 * and encrypts / decrypts at the same time.
113113 */
114114 enum flags { DM_CRYPT_SUSPENDED, DM_CRYPT_KEY_VALID,
115− DM_CRYPT_SAME_CPU, DM_CRYPT_NO_OFFLOAD };
115+ DM_CRYPT_SAME_CPU, DM_CRYPT_NO_OFFLOAD,
116+ DM_CRYPT_EXIT_THREAD};
116117
117118 /*
118119 * The fields in here must be read only after initialization.
@@ -1203,20 +1204,18 @@ continue_locked: · 1084 unmodified lines
12031204 if (!RB_EMPTY_ROOT(&cc->write_tree))
12041205 goto pop_from_list;
12051206
1207+ if (unlikely(test_bit(DM_CRYPT_EXIT_THREAD, &cc->flags))) {
1208+ spin_unlock_irq(&cc->write_thread_wait.lock);
1209+ break;
1210+ }
1211+
12061212 __set_current_state(TASK_INTERRUPTIBLE);
12071213 __add_wait_queue(&cc->write_thread_wait, &wait);
12081214
12091215 spin_unlock_irq(&cc->write_thread_wait.lock);
12101216
1211− if (unlikely(kthread_should_stop())) {
1212− set_task_state(current, TASK_RUNNING);
1213− remove_wait_queue(&cc->write_thread_wait, &wait);
1214− break;
1215− }
1216−
12171217 schedule();
12181218
1219− set_task_state(current, TASK_RUNNING);
12201219 spin_lock_irq(&cc->write_thread_wait.lock);
12211220 __remove_wait_queue(&cc->write_thread_wait, &wait);
12221221 goto continue_locked;
@@ -1531,8 +1530,13 @@ static void crypt_dtr(struct dm_target *ti) · 308 unmodified lines
15311530 if (!cc)
15321531 return;
15331532
1534− if (cc->write_thread)
1533+ if (cc->write_thread) {
1534+ spin_lock_irq(&cc->write_thread_wait.lock);
1535+ set_bit(DM_CRYPT_EXIT_THREAD, &cc->flags);
1536+ wake_up_locked(&cc->write_thread_wait);
1537+ spin_unlock_irq(&cc->write_thread_wait.lock);
15351538 kthread_stop(cc->write_thread);
1539+ }
15361540
15371541 if (cc->io_queue)
15381542 destroy_workqueue(cc->io_queue);
drivers/md/dm-mpath.c+16−14
@@ -1537,32 +1537,34 @@ static int multipath_prepare_ioctl(struct dm_target *ti, · 1536 unmodified lines
15371537 struct block_device **bdev, fmode_t *mode)
15381538 {
15391539 struct multipath *m = ti->private;
1540− struct pgpath *pgpath;
15411540 unsigned long flags;
15421541 int r;
15431542
1544− r = 0;
1545−
15461543 spin_lock_irqsave(&m->lock, flags);
15471544
15481545 if (!m->current_pgpath)
15491546 __choose_pgpath(m, 0);
15501547
1551− pgpath = m->current_pgpath;
1552−
1553− if (pgpath) {
1554− *bdev = pgpath->path.dev->bdev;
1555− *mode = pgpath->path.dev->mode;
1548+ if (m->current_pgpath) {
1549+ if (!m->queue_io) {
1550+ *bdev = m->current_pgpath->path.dev->bdev;
1551+ *mode = m->current_pgpath->path.dev->mode;
1552+ r = 0;
1553+ } else {
1554+ /* pg_init has not started or completed */
1555+ r = -ENOTCONN;
1556+ }
1557+ } else {
1558+ /* No path is available */
1559+ if (m->queue_if_no_path)
1560+ r = -ENOTCONN;
1561+ else
1562+ r = -EIO;
15561563 }
15571564
1558− if ((pgpath && m->queue_io) || (!pgpath && m->queue_if_no_path))
1559− r = -ENOTCONN;
1560− else if (!*bdev)
1561− r = -EIO;
1562−
15631565 spin_unlock_irqrestore(&m->lock, flags);
15641566
1565− if (r == -ENOTCONN && !fatal_signal_pending(current)) {
1567+ if (r == -ENOTCONN) {
15661568 spin_lock_irqsave(&m->lock, flags);
15671569 if (!m->current_pg) {
15681570 /* Path status changed, redo selection */
drivers/md/dm-thin.c+3−3
@@ -2432,6 +2432,7 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode) · 2431 unmodified lines
24322432 case PM_WRITE:
24332433 if (old_mode != new_mode)
24342434 notify_of_pool_mode_change(pool, "write");
2435+ pool->pf.error_if_no_space = pt->requested_pf.error_if_no_space;
24352436 dm_pool_metadata_read_write(pool->pmd);
24362437 pool->process_bio = process_bio;
24372438 pool->process_discard = process_discard_bio;
@@ -4249,10 +4250,9 @@ static void thin_io_hints(struct dm_target *ti, struct queue_limits *limits) · 1811 unmodified lines
42494250 {
42504251 struct thin_c *tc = ti->private;
42514252 struct pool *pool = tc->pool;
4252− struct queue_limits *pool_limits = dm_get_queue_limits(pool->pool_md);
42534253
4254− if (!pool_limits->discard_granularity)
4255− return; /* pool's discard support is disabled */
4254+ if (!pool->pf.discard_enabled)
4255+ return;
42564256
42574257 limits->discard_granularity = pool->sectors_per_block << SECTOR_SHIFT;
42584258 limits->max_discard_sectors = 2048 * 1024 * 16; /* 16G */
drivers/md/dm.c+4−3
@@ -591,7 +591,7 @@ retry: · 590 unmodified lines
591591
592592 out:
593593 dm_put_live_table(md, *srcu_idx);
594− if (r == -ENOTCONN) {
594+ if (r == -ENOTCONN && !fatal_signal_pending(current)) {
595595 msleep(10);
596596 goto retry;
597597 }
@@ -603,9 +603,10 @@ static int dm_blk_ioctl(struct block_device *bdev, fmode_t mode, · 5 unmodified lines
603603 {
604604 struct mapped_device *md = bdev->bd_disk->private_data;
605605 struct dm_target *tgt;
606+ struct block_device *tgt_bdev = NULL;
606607 int srcu_idx, r;
607608
608− r = dm_get_live_table_for_ioctl(md, &tgt, &bdev, &mode, &srcu_idx);
609+ r = dm_get_live_table_for_ioctl(md, &tgt, &tgt_bdev, &mode, &srcu_idx);
609610 if (r < 0)
610611 return r;
611612
@@ -620,7 +621,7 @@ static int dm_blk_ioctl(struct block_device *bdev, fmode_t mode, · 8 unmodified lines
620621 goto out;
621622 }
622623
623− r = __blkdev_driver_ioctl(bdev, mode, cmd, arg);
624+ r = __blkdev_driver_ioctl(tgt_bdev, mode, cmd, arg);
624625 out:
625626 dm_put_live_table(md, srcu_idx);
626627 return r;
drivers/media/pci/cx23885/cx23885-core.c+2−2
@@ -1992,9 +1992,9 @@ static int cx23885_initdev(struct pci_dev *pci_dev, · 1991 unmodified lines
19921992 (unsigned long long)pci_resource_start(pci_dev, 0));
19931993
19941994 pci_set_master(pci_dev);
1995− if (!pci_set_dma_mask(pci_dev, 0xffffffff)) {
1995+ err = pci_set_dma_mask(pci_dev, 0xffffffff);
1996+ if (err) {
19961997 printk("%s/0: Oops: no 32bit PCI DMA ???\n", dev->name);
1997− err = -EIO;
19981998 goto fail_context;
19991999 }
20002000
drivers/media/pci/cx25821/cx25821-core.c+2−1
@@ -1319,7 +1319,8 @@ static int cx25821_initdev(struct pci_dev *pci_dev, · 1318 unmodified lines
13191319 dev->pci_lat, (unsigned long long)dev->base_io_addr);
13201320
13211321 pci_set_master(pci_dev);
1322− if (!pci_set_dma_mask(pci_dev, 0xffffffff)) {
1322+ err = pci_set_dma_mask(pci_dev, 0xffffffff);
1323+ if (err) {
13231324 pr_err("%s/0: Oops: no 32bit PCI DMA ???\n", dev->name);
13241325 err = -EIO;
13251326 goto fail_irq;
drivers/media/pci/cx88/cx88-alsa.c+2−2
@@ -890,9 +890,9 @@ static int snd_cx88_create(struct snd_card *card, struct pci_dev *pci, · 889 unmodified lines
890890 return err;
891891 }
892892
893− if (!pci_set_dma_mask(pci,DMA_BIT_MASK(32))) {
893+ err = pci_set_dma_mask(pci,DMA_BIT_MASK(32));
894+ if (err) {
894895 dprintk(0, "%s/1: Oops: no 32bit PCI DMA ???\n",core->name);
895− err = -EIO;
896896 cx88_core_put(core, pci);
897897 return err;
898898 }
drivers/media/pci/cx88/cx88-mpeg.c+2−1
@@ -393,7 +393,8 @@ static int cx8802_init_common(struct cx8802_dev *dev) · 392 unmodified lines
393393 if (pci_enable_device(dev->pci))
394394 return -EIO;
395395 pci_set_master(dev->pci);
396− if (!pci_set_dma_mask(dev->pci,DMA_BIT_MASK(32))) {
396+ err = pci_set_dma_mask(dev->pci,DMA_BIT_MASK(32));
397+ if (err) {
397398 printk("%s/2: Oops: no 32bit PCI DMA ???\n",dev->core->name);
398399 return -EIO;
399400 }
drivers/media/pci/cx88/cx88-video.c+2−2
@@ -1314,9 +1314,9 @@ static int cx8800_initdev(struct pci_dev *pci_dev, · 1313 unmodified lines
13141314 dev->pci_lat,(unsigned long long)pci_resource_start(pci_dev,0));
13151315
13161316 pci_set_master(pci_dev);
1317− if (!pci_set_dma_mask(pci_dev,DMA_BIT_MASK(32))) {
1317+ err = pci_set_dma_mask(pci_dev,DMA_BIT_MASK(32));
1318+ if (err) {
13181319 printk("%s/0: Oops: no 32bit PCI DMA ???\n",core->name);
1319− err = -EIO;
13201320 goto fail_core;
13211321 }
13221322 dev->alloc_ctx = vb2_dma_sg_init_ctx(&pci_dev->dev);
drivers/media/pci/netup_unidvb/netup_unidvb_core.c+1−1
@@ -810,7 +810,7 @@ static int netup_unidvb_initdev(struct pci_dev *pci_dev, · 809 unmodified lines
810810 "%s(): board vendor 0x%x, revision 0x%x\n",
811811 __func__, board_vendor, board_revision);
812812 pci_set_master(pci_dev);
813− if (!pci_set_dma_mask(pci_dev, 0xffffffff)) {
813+ if (pci_set_dma_mask(pci_dev, 0xffffffff) < 0) {
814814 dev_err(&pci_dev->dev,
815815 "%s(): 32bit PCI DMA is not supported\n", __func__);
816816 goto pci_detect_err;
drivers/media/pci/saa7134/saa7134-core.c+2−2
@@ -951,9 +951,9 @@ static int saa7134_initdev(struct pci_dev *pci_dev, · 950 unmodified lines
951951 pci_name(pci_dev), dev->pci_rev, pci_dev->irq,
952952 dev->pci_lat,(unsigned long long)pci_resource_start(pci_dev,0));
953953 pci_set_master(pci_dev);
954− if (!pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32))) {
954+ err = pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32));
955+ if (err) {
955956 pr_warn("%s: Oops: no 32bit PCI DMA ???\n", dev->name);
956− err = -EIO;
957957 goto fail1;
958958 }
959959
drivers/media/pci/saa7164/saa7164-core.c+2−2
@@ -1264,9 +1264,9 @@ static int saa7164_initdev(struct pci_dev *pci_dev, · 1263 unmodified lines
12641264
12651265 pci_set_master(pci_dev);
12661266 /* TODO */
1267− if (!pci_set_dma_mask(pci_dev, 0xffffffff)) {
1267+ err = pci_set_dma_mask(pci_dev, 0xffffffff);
1268+ if (err) {
12681269 printk("%s/0: Oops: no 32bit PCI DMA ???\n", dev->name);
1269− err = -EIO;
12701270 goto fail_irq;
12711271 }
12721272
drivers/media/pci/tw68/tw68-core.c+2−2
@@ -257,9 +257,9 @@ static int tw68_initdev(struct pci_dev *pci_dev, · 256 unmodified lines
257257 dev->name, pci_name(pci_dev), dev->pci_rev, pci_dev->irq,
258258 dev->pci_lat, (u64)pci_resource_start(pci_dev, 0));
259259 pci_set_master(pci_dev);
260− if (!pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32))) {
260+ err = pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32));
261+ if (err) {
261262 pr_info("%s: Oops: no 32bit PCI DMA ???\n", dev->name);
262− err = -EIO;
263263 goto fail1;
264264 }
265265
drivers/mmc/card/block.c+3−8
@@ -65,8 +65,7 @@ MODULE_ALIAS("mmc:block"); · 64 unmodified lines
6565 #define MMC_SANITIZE_REQ_TIMEOUT 240000
6666 #define MMC_EXTRACT_INDEX_FROM_ARG(x) ((x & 0x00FF0000) >> 16)
6767
68−#define mmc_req_rel_wr(req) (((req->cmd_flags & REQ_FUA) || \
69− (req->cmd_flags & REQ_META)) && \
68+#define mmc_req_rel_wr(req) ((req->cmd_flags & REQ_FUA) && \
7069 (rq_data_dir(req) == WRITE))
7170 #define PACKED_CMD_VER 0x01
7271 #define PACKED_CMD_WR 0x02
@@ -1467,13 +1466,9 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, · 1394 unmodified lines
14671466
14681467 /*
14691468 * Reliable writes are used to implement Forced Unit Access and
1470− * REQ_META accesses, and are supported only on MMCs.
1471− *
1472− * XXX: this really needs a good explanation of why REQ_META
1473− * is treated special.
1469+ * are supported only on MMCs.
14741470 */
1475− bool do_rel_wr = ((req->cmd_flags & REQ_FUA) ||
1476− (req->cmd_flags & REQ_META)) &&
1471+ bool do_rel_wr = (req->cmd_flags & REQ_FUA) &&
14771472 (rq_data_dir(req) == WRITE) &&
14781473 (md->flags & MMC_BLK_REL_WR);
14791474
drivers/mmc/core/mmc.c+69−24
@@ -1040,9 +1040,24 @@ static int mmc_select_hs_ddr(struct mmc_card *card) · 1039 unmodified lines
10401040 return err;
10411041 }
10421042
1043+/* Caller must hold re-tuning */
1044+static int mmc_switch_status(struct mmc_card *card)
1045+{
1046+ u32 status;
1047+ int err;
1048+
1049+ err = mmc_send_status(card, &status);
1050+ if (err)
1051+ return err;
1052+
1053+ return mmc_switch_status_error(card->host, status);
1054+}
1055+
10431056 static int mmc_select_hs400(struct mmc_card *card)
10441057 {
10451058 struct mmc_host *host = card->host;
1059+ bool send_status = true;
1060+ unsigned int max_dtr;
10461061 int err = 0;
10471062 u8 val;
10481063
@@ -1053,25 +1068,36 @@ static int mmc_select_hs400(struct mmc_card *card) · 4 unmodified lines
10531068 host->ios.bus_width == MMC_BUS_WIDTH_8))
10541069 return 0;
10551070
1056− /*
1057− * Before switching to dual data rate operation for HS400,
1058− * it is required to convert from HS200 mode to HS mode.
1059− */
1060− mmc_set_timing(card->host, MMC_TIMING_MMC_HS);
1061− mmc_set_bus_speed(card);
1071+ if (host->caps & MMC_CAP_WAIT_WHILE_BUSY)
1072+ send_status = false;
10621073
1074+ /* Reduce frequency to HS frequency */
1075+ max_dtr = card->ext_csd.hs_max_dtr;
1076+ mmc_set_clock(host, max_dtr);
1077+
1078+ /* Switch card to HS mode */
10631079 val = EXT_CSD_TIMING_HS |
10641080 card->drive_strength << EXT_CSD_DRV_STR_SHIFT;
10651081 err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
10661082 EXT_CSD_HS_TIMING, val,
10671083 card->ext_csd.generic_cmd6_time,
1068− true, true, true);
1084+ true, send_status, true);
10691085 if (err) {
10701086 pr_err("%s: switch to high-speed from hs200 failed, err:%d\n",
10711087 mmc_hostname(host), err);
10721088 return err;
10731089 }
10741090
1091+ /* Set host controller to HS timing */
1092+ mmc_set_timing(card->host, MMC_TIMING_MMC_HS);
1093+
1094+ if (!send_status) {
1095+ err = mmc_switch_status(card);
1096+ if (err)
1097+ goto out_err;
1098+ }
1099+
1100+ /* Switch card to DDR */
10751101 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
10761102 EXT_CSD_BUS_WIDTH,
10771103 EXT_CSD_DDR_BUS_WIDTH_8,
@@ -1082,22 +1108,35 @@ static int mmc_select_hs400(struct mmc_card *card) · 4 unmodified lines
10821108 return err;
10831109 }
10841110
1111+ /* Switch card to HS400 */
10851112 val = EXT_CSD_TIMING_HS400 |
10861113 card->drive_strength << EXT_CSD_DRV_STR_SHIFT;
10871114 err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
10881115 EXT_CSD_HS_TIMING, val,
10891116 card->ext_csd.generic_cmd6_time,
1090− true, true, true);
1117+ true, send_status, true);
10911118 if (err) {
10921119 pr_err("%s: switch to hs400 failed, err:%d\n",
10931120 mmc_hostname(host), err);
10941121 return err;
10951122 }
10961123
1124+ /* Set host controller to HS400 timing and frequency */
10971125 mmc_set_timing(host, MMC_TIMING_MMC_HS400);
10981126 mmc_set_bus_speed(card);
10991127
1128+ if (!send_status) {
1129+ err = mmc_switch_status(card);
1130+ if (err)
1131+ goto out_err;
1132+ }
1133+
11001134 return 0;
1135+
1136+out_err:
1137+ pr_err("%s: %s failed, error %d\n", mmc_hostname(card->host),
1138+ __func__, err);
1139+ return err;
11011140 }
11021141
11031142 int mmc_hs200_to_hs400(struct mmc_card *card)
@@ -1105,19 +1144,6 @@ int mmc_hs200_to_hs400(struct mmc_card *card) · 1 unmodified line
11051144 return mmc_select_hs400(card);
11061145 }
11071146
1108−/* Caller must hold re-tuning */
1109−static int mmc_switch_status(struct mmc_card *card)
1110−{
1111− u32 status;
1112− int err;
1113−
1114− err = mmc_send_status(card, &status);
1115− if (err)
1116− return err;
1117−
1118− return mmc_switch_status_error(card->host, status);
1119−}
1120−
11211147 int mmc_hs400_to_hs200(struct mmc_card *card)
11221148 {
11231149 struct mmc_host *host = card->host;
@@ -1219,6 +1245,8 @@ static void mmc_select_driver_type(struct mmc_card *card) · 95 unmodified lines
12191245 static int mmc_select_hs200(struct mmc_card *card)
12201246 {
12211247 struct mmc_host *host = card->host;
1248+ bool send_status = true;
1249+ unsigned int old_timing;
12221250 int err = -EINVAL;
12231251 u8 val;
12241252
@@ -1234,6 +1262,9 @@ static int mmc_select_hs200(struct mmc_card *card) · 9 unmodified lines
12341262
12351263 mmc_select_driver_type(card);
12361264
1265+ if (host->caps & MMC_CAP_WAIT_WHILE_BUSY)
1266+ send_status = false;
1267+
12371268 /*
12381269 * Set the bus width(4 or 8) with host's support and
12391270 * switch to HS200 mode if bus width is set successfully.
@@ -1245,11 +1276,25 @@ static int mmc_select_hs200(struct mmc_card *card) · 5 unmodified lines
12451276 err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
12461277 EXT_CSD_HS_TIMING, val,
12471278 card->ext_csd.generic_cmd6_time,
1248− true, true, true);
1249− if (!err)
1250− mmc_set_timing(host, MMC_TIMING_MMC_HS200);
1279+ true, send_status, true);
1280+ if (err)
1281+ goto err;
1282+ old_timing = host->ios.timing;
1283+ mmc_set_timing(host, MMC_TIMING_MMC_HS200);
1284+ if (!send_status) {
1285+ err = mmc_switch_status(card);
1286+ /*
1287+ * mmc_select_timing() assumes timing has not changed if
1288+ * it is a switch error.
1289+ */
1290+ if (err == -EBADMSG)
1291+ mmc_set_timing(host, old_timing);
1292+ }
12511293 }
12521294 err:
1295+ if (err)
1296+ pr_err("%s: %s failed, error %d\n", mmc_hostname(card->host),
1297+ __func__, err);
12531298 return err;
12541299 }
12551300
drivers/mmc/host/Kconfig+1−0
@@ -473,6 +473,7 @@ config MMC_DAVINCI · 472 unmodified lines
473473
474474 config MMC_GOLDFISH
475475 tristate "goldfish qemu Multimedia Card Interface support"
476+ depends on HAS_DMA
476477 depends on GOLDFISH || COMPILE_TEST
477478 help
478479 This selects the Goldfish Multimedia card Interface emulation
drivers/mmc/host/mtk-sd.c+1−1
@@ -1276,7 +1276,7 @@ static struct msdc_delay_phase get_best_delay(struct msdc_host *host, u32 delay) · 1275 unmodified lines
12761276 int start = 0, len = 0;
12771277 int start_final = 0, len_final = 0;
12781278 u8 final_phase = 0xff;
1279− struct msdc_delay_phase delay_phase;
1279+ struct msdc_delay_phase delay_phase = { 0, };
12801280
12811281 if (delay == 0) {
12821282 dev_err(host->dev, "phase error: [map:%x]\n", delay);
drivers/mmc/host/pxamci.c+1−1
@@ -805,7 +805,7 @@ static int pxamci_probe(struct platform_device *pdev) · 804 unmodified lines
805805 goto out;
806806 } else {
807807 mmc->caps |= host->pdata->gpio_card_ro_invert ?
808− MMC_CAP2_RO_ACTIVE_HIGH : 0;
808+ 0 : MMC_CAP2_RO_ACTIVE_HIGH;
809809 }
810810
811811 if (gpio_is_valid(gpio_cd))
drivers/mtd/nand/jz4740_nand.c+1−0
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525
2626 #include <linux/gpio.h>
2727
28+#include <asm/mach-jz4740/gpio.h>
2829 #include <asm/mach-jz4740/jz4740_nand.h>
2930
3031 #define JZ_REG_NAND_CTRL 0x50
drivers/mtd/nand/nand_base.c+1−1
@@ -3110,7 +3110,7 @@ static void nand_resume(struct mtd_info *mtd) · 3109 unmodified lines
31103110 */
31113111 static void nand_shutdown(struct mtd_info *mtd)
31123112 {
3113− nand_get_device(mtd, FL_SHUTDOWN);
3113+ nand_get_device(mtd, FL_PM_SUSPENDED);
31143114 }
31153115
31163116 /* Set default functions */
drivers/net/can/bfin_can.c+0−2
@@ -501,8 +501,6 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status) · 500 unmodified lines
501501 cf->data[2] |= CAN_ERR_PROT_FORM;
502502 else if (status & SER)
503503 cf->data[2] |= CAN_ERR_PROT_STUFF;
504− else
505− cf->data[2] |= CAN_ERR_PROT_UNSPEC;
506504 }
507505
508506 priv->can.state = state;
drivers/net/can/c_can/c_can.c+2−5
@@ -962,7 +962,6 @@ static int c_can_handle_bus_err(struct net_device *dev, · 961 unmodified lines
962962 * type of the last error to occur on the CAN bus
963963 */
964964 cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
965− cf->data[2] |= CAN_ERR_PROT_UNSPEC;
966965
967966 switch (lec_type) {
968967 case LEC_STUFF_ERROR:
@@ -975,8 +974,7 @@ static int c_can_handle_bus_err(struct net_device *dev, · 6 unmodified lines
975974 break;
976975 case LEC_ACK_ERROR:
977976 netdev_dbg(dev, "ack error\n");
978− cf->data[3] |= (CAN_ERR_PROT_LOC_ACK |
979− CAN_ERR_PROT_LOC_ACK_DEL);
977+ cf->data[3] = CAN_ERR_PROT_LOC_ACK;
980978 break;
981979 case LEC_BIT1_ERROR:
982980 netdev_dbg(dev, "bit1 error\n");
@@ -988,8 +986,7 @@ static int c_can_handle_bus_err(struct net_device *dev, · 5 unmodified lines
988986 break;
989987 case LEC_CRC_ERROR:
990988 netdev_dbg(dev, "CRC error\n");
991− cf->data[3] |= (CAN_ERR_PROT_LOC_CRC_SEQ |
992− CAN_ERR_PROT_LOC_CRC_DEL);
989+ cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
993990 break;
994991 default:
995992 break;
drivers/net/can/cc770/cc770.c+1−1
@@ -578,7 +578,7 @@ static int cc770_err(struct net_device *dev, u8 status) · 577 unmodified lines
578578 cf->data[2] |= CAN_ERR_PROT_BIT0;
579579 break;
580580 case STAT_LEC_CRC:
581− cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ;
581+ cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
582582 break;
583583 }
584584 }
drivers/net/can/flexcan.c+2−2
@@ -535,13 +535,13 @@ static void do_bus_err(struct net_device *dev, · 534 unmodified lines
535535 if (reg_esr & FLEXCAN_ESR_ACK_ERR) {
536536 netdev_dbg(dev, "ACK_ERR irq\n");
537537 cf->can_id |= CAN_ERR_ACK;
538− cf->data[3] |= CAN_ERR_PROT_LOC_ACK;
538+ cf->data[3] = CAN_ERR_PROT_LOC_ACK;
539539 tx_errors = 1;
540540 }
541541 if (reg_esr & FLEXCAN_ESR_CRC_ERR) {
542542 netdev_dbg(dev, "CRC_ERR irq\n");
543543 cf->data[2] |= CAN_ERR_PROT_BIT;
544− cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ;
544+ cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
545545 rx_errors = 1;
546546 }
547547 if (reg_esr & FLEXCAN_ESR_FRM_ERR) {
drivers/net/can/janz-ican3.c+0−1
@@ -1096,7 +1096,6 @@ static int ican3_handle_cevtind(struct ican3_dev *mod, struct ican3_msg *msg) · 1095 unmodified lines
10961096 cf->data[2] |= CAN_ERR_PROT_STUFF;
10971097 break;
10981098 default:
1099− cf->data[2] |= CAN_ERR_PROT_UNSPEC;
11001099 cf->data[3] = ecc & ECC_SEG;
11011100 break;
11021101 }
drivers/net/can/m_can/m_can.c+2−5
@@ -487,7 +487,6 @@ static int m_can_handle_lec_err(struct net_device *dev, · 486 unmodified lines
487487 * type of the last error to occur on the CAN bus
488488 */
489489 cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
490− cf->data[2] |= CAN_ERR_PROT_UNSPEC;
491490
492491 switch (lec_type) {
493492 case LEC_STUFF_ERROR:
@@ -500,8 +499,7 @@ static int m_can_handle_lec_err(struct net_device *dev, · 6 unmodified lines
500499 break;
501500 case LEC_ACK_ERROR:
502501 netdev_dbg(dev, "ack error\n");
503− cf->data[3] |= (CAN_ERR_PROT_LOC_ACK |
504− CAN_ERR_PROT_LOC_ACK_DEL);
502+ cf->data[3] = CAN_ERR_PROT_LOC_ACK;
505503 break;
506504 case LEC_BIT1_ERROR:
507505 netdev_dbg(dev, "bit1 error\n");
@@ -513,8 +511,7 @@ static int m_can_handle_lec_err(struct net_device *dev, · 5 unmodified lines
513511 break;
514512 case LEC_CRC_ERROR:
515513 netdev_dbg(dev, "CRC error\n");
516− cf->data[3] |= (CAN_ERR_PROT_LOC_CRC_SEQ |
517− CAN_ERR_PROT_LOC_CRC_DEL);
514+ cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
518515 break;
519516 default:
520517 break;
drivers/net/can/pch_can.c+1−2
@@ -559,8 +559,7 @@ static void pch_can_error(struct net_device *ndev, u32 status) · 558 unmodified lines
559559 stats->rx_errors++;
560560 break;
561561 case PCH_CRC_ERR:
562− cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ |
563− CAN_ERR_PROT_LOC_CRC_DEL;
562+ cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
564563 priv->can.can_stats.bus_error++;
565564 stats->rx_errors++;
566565 break;
drivers/net/can/rcar_can.c+5−6
@@ -241,17 +241,16 @@ static void rcar_can_error(struct net_device *ndev) · 240 unmodified lines
241241 u8 ecsr;
242242
243243 netdev_dbg(priv->ndev, "Bus error interrupt:\n");
244− if (skb) {
244+ if (skb)
245245 cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT;
246− cf->data[2] = CAN_ERR_PROT_UNSPEC;
247− }
246+
248247 ecsr = readb(&priv->regs->ecsr);
249248 if (ecsr & RCAR_CAN_ECSR_ADEF) {
250249 netdev_dbg(priv->ndev, "ACK Delimiter Error\n");
251250 tx_errors++;
252251 writeb(~RCAR_CAN_ECSR_ADEF, &priv->regs->ecsr);
253252 if (skb)
254− cf->data[3] |= CAN_ERR_PROT_LOC_ACK_DEL;
253+ cf->data[3] = CAN_ERR_PROT_LOC_ACK_DEL;
255254 }
256255 if (ecsr & RCAR_CAN_ECSR_BE0F) {
257256 netdev_dbg(priv->ndev, "Bit Error (dominant)\n");
@@ -272,7 +271,7 @@ static void rcar_can_error(struct net_device *ndev) · 14 unmodified lines
272271 rx_errors++;
273272 writeb(~RCAR_CAN_ECSR_CEF, &priv->regs->ecsr);
274273 if (skb)
275− cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ;
274+ cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
276275 }
277276 if (ecsr & RCAR_CAN_ECSR_AEF) {
278277 netdev_dbg(priv->ndev, "ACK Error\n");
@@ -280,7 +279,7 @@ static void rcar_can_error(struct net_device *ndev) · 1 unmodified line
280279 writeb(~RCAR_CAN_ECSR_AEF, &priv->regs->ecsr);
281280 if (skb) {
282281 cf->can_id |= CAN_ERR_ACK;
283− cf->data[3] |= CAN_ERR_PROT_LOC_ACK;
282+ cf->data[3] = CAN_ERR_PROT_LOC_ACK;
284283 }
285284 }
286285 if (ecsr & RCAR_CAN_ECSR_FEF) {
drivers/net/can/sja1000/sja1000.c+3−1
@@ -218,6 +218,9 @@ static void sja1000_start(struct net_device *dev) · 217 unmodified lines
218218 priv->write_reg(priv, SJA1000_RXERR, 0x0);
219219 priv->read_reg(priv, SJA1000_ECC);
220220
221+ /* clear interrupt flags */
222+ priv->read_reg(priv, SJA1000_IR);
223+
221224 /* leave reset mode */
222225 set_normal_mode(dev);
223226 }
@@ -446,7 +449,6 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) · 222 unmodified lines
446449 cf->data[2] |= CAN_ERR_PROT_STUFF;
447450 break;
448451 default:
449− cf->data[2] |= CAN_ERR_PROT_UNSPEC;
450452 cf->data[3] = ecc & ECC_SEG;
451453 break;
452454 }
drivers/net/can/sun4i_can.c+0−1
@@ -575,7 +575,6 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status) · 574 unmodified lines
575575 cf->data[2] |= CAN_ERR_PROT_STUFF;
576576 break;
577577 default:
578− cf->data[2] |= CAN_ERR_PROT_UNSPEC;
579578 cf->data[3] = (ecc & SUN4I_STA_ERR_SEG_CODE)
580579 >> 16;
581580 break;
drivers/net/can/ti_hecc.c+2−5
@@ -722,7 +722,6 @@ static int ti_hecc_error(struct net_device *ndev, int int_status, · 721 unmodified lines
722722 if (err_status & HECC_BUS_ERROR) {
723723 ++priv->can.can_stats.bus_error;
724724 cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT;
725− cf->data[2] |= CAN_ERR_PROT_UNSPEC;
726725 if (err_status & HECC_CANES_FE) {
727726 hecc_set_bit(priv, HECC_CANES, HECC_CANES_FE);
728727 cf->data[2] |= CAN_ERR_PROT_FORM;
@@ -737,13 +736,11 @@ static int ti_hecc_error(struct net_device *ndev, int int_status, · 8 unmodified lines
737736 }
738737 if (err_status & HECC_CANES_CRCE) {
739738 hecc_set_bit(priv, HECC_CANES, HECC_CANES_CRCE);
740− cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ |
741− CAN_ERR_PROT_LOC_CRC_DEL;
739+ cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
742740 }
743741 if (err_status & HECC_CANES_ACKE) {
744742 hecc_set_bit(priv, HECC_CANES, HECC_CANES_ACKE);
745− cf->data[3] |= CAN_ERR_PROT_LOC_ACK |
746− CAN_ERR_PROT_LOC_ACK_DEL;
743+ cf->data[3] = CAN_ERR_PROT_LOC_ACK;
747744 }
748745 }
749746
drivers/net/can/usb/ems_usb.c+0−1
@@ -377,7 +377,6 @@ static void ems_usb_rx_err(struct ems_usb *dev, struct ems_cpc_msg *msg) · 376 unmodified lines
377377 cf->data[2] |= CAN_ERR_PROT_STUFF;
378378 break;
379379 default:
380− cf->data[2] |= CAN_ERR_PROT_UNSPEC;
381380 cf->data[3] = ecc & SJA1000_ECC_SEG;
382381 break;
383382 }
drivers/net/can/usb/esd_usb2.c+0−1
@@ -282,7 +282,6 @@ static void esd_usb2_rx_event(struct esd_usb2_net_priv *priv, · 281 unmodified lines
282282 cf->data[2] |= CAN_ERR_PROT_STUFF;
283283 break;
284284 default:
285− cf->data[2] |= CAN_ERR_PROT_UNSPEC;
286285 cf->data[3] = ecc & SJA1000_ECC_SEG;
287286 break;
288287 }
drivers/net/can/usb/kvaser_usb.c+2−3
@@ -944,10 +944,9 @@ static void kvaser_usb_rx_error(const struct kvaser_usb *dev, · 943 unmodified lines
944944 cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT;
945945
946946 if (es->leaf.error_factor & M16C_EF_ACKE)
947− cf->data[3] |= (CAN_ERR_PROT_LOC_ACK);
947+ cf->data[3] = CAN_ERR_PROT_LOC_ACK;
948948 if (es->leaf.error_factor & M16C_EF_CRCE)
949− cf->data[3] |= (CAN_ERR_PROT_LOC_CRC_SEQ |
950− CAN_ERR_PROT_LOC_CRC_DEL);
949+ cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
951950 if (es->leaf.error_factor & M16C_EF_FORME)
952951 cf->data[2] |= CAN_ERR_PROT_FORM;
953952 if (es->leaf.error_factor & M16C_EF_STFE)
drivers/net/can/usb/usb_8dev.c+1−3
@@ -401,9 +401,7 @@ static void usb_8dev_rx_err_msg(struct usb_8dev_priv *priv, · 400 unmodified lines
401401 tx_errors = 1;
402402 break;
403403 case USB_8DEV_STATUSMSG_CRC:
404− cf->data[2] |= CAN_ERR_PROT_UNSPEC;
405− cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ |
406− CAN_ERR_PROT_LOC_CRC_DEL;
404+ cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
407405 rx_errors = 1;
408406 break;
409407 case USB_8DEV_STATUSMSG_BIT0:
drivers/net/can/xilinx_can.c+3−6
@@ -608,17 +608,15 @@ static void xcan_err_interrupt(struct net_device *ndev, u32 isr) · 607 unmodified lines
608608
609609 /* Check for error interrupt */
610610 if (isr & XCAN_IXR_ERROR_MASK) {
611− if (skb) {
611+ if (skb)
612612 cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
613− cf->data[2] |= CAN_ERR_PROT_UNSPEC;
614− }
615613
616614 /* Check for Ack error interrupt */
617615 if (err_status & XCAN_ESR_ACKER_MASK) {
618616 stats->tx_errors++;
619617 if (skb) {
620618 cf->can_id |= CAN_ERR_ACK;
621− cf->data[3] |= CAN_ERR_PROT_LOC_ACK;
619+ cf->data[3] = CAN_ERR_PROT_LOC_ACK;
622620 }
623621 }
624622
@@ -654,8 +652,7 @@ static void xcan_err_interrupt(struct net_device *ndev, u32 isr) · 29 unmodified lines
654652 stats->rx_errors++;
655653 if (skb) {
656654 cf->can_id |= CAN_ERR_PROT;
657− cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ |
658− CAN_ERR_PROT_LOC_CRC_DEL;
655+ cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
659656 }
660657 }
661658 priv->can.can_stats.bus_error++;
drivers/net/ethernet/Kconfig+1−0
@@ -29,6 +29,7 @@ source "drivers/net/ethernet/apm/Kconfig" · 28 unmodified lines
2929 source "drivers/net/ethernet/apple/Kconfig"
3030 source "drivers/net/ethernet/arc/Kconfig"
3131 source "drivers/net/ethernet/atheros/Kconfig"
32+source "drivers/net/ethernet/aurora/Kconfig"
3233 source "drivers/net/ethernet/cadence/Kconfig"
3334 source "drivers/net/ethernet/adi/Kconfig"
3435 source "drivers/net/ethernet/broadcom/Kconfig"
drivers/net/ethernet/Makefile+1−0
@@ -15,6 +15,7 @@ obj-$(CONFIG_NET_XGENE) += apm/ · 14 unmodified lines
1515 obj-$(CONFIG_NET_VENDOR_APPLE) += apple/
1616 obj-$(CONFIG_NET_VENDOR_ARC) += arc/
1717 obj-$(CONFIG_NET_VENDOR_ATHEROS) += atheros/
18+obj-$(CONFIG_NET_VENDOR_AURORA) += aurora/
1819 obj-$(CONFIG_NET_CADENCE) += cadence/
1920 obj-$(CONFIG_NET_BFIN) += adi/
2021 obj-$(CONFIG_NET_VENDOR_BROADCOM) += broadcom/
drivers/net/ethernet/amd/pcnet32.c+3−2
@@ -1500,10 +1500,11 @@ pcnet32_probe_pci(struct pci_dev *pdev, const struct pci_device_id *ent) · 1499 unmodified lines
15001500 return -ENODEV;
15011501 }
15021502
1503− if (!pci_set_dma_mask(pdev, PCNET32_DMA_MASK)) {
1503+ err = pci_set_dma_mask(pdev, PCNET32_DMA_MASK);
1504+ if (err) {
15041505 if (pcnet32_debug & NETIF_MSG_PROBE)
15051506 pr_err("architecture does not support 32bit PCI busmaster DMA\n");
1506− return -ENODEV;
1507+ return err;
15071508 }
15081509 if (!request_region(ioaddr, PCNET32_TOTAL_SIZE, "pcnet32_probe_pci")) {
15091510 if (pcnet32_debug & NETIF_MSG_PROBE)
drivers/net/ethernet/apm/xgene/xgene_enet_main.c+17−14
@@ -450,12 +450,12 @@ static netdev_tx_t xgene_enet_start_xmit(struct sk_buff *skb, · 449 unmodified lines
450450 return NETDEV_TX_OK;
451451 }
452452
453− pdata->ring_ops->wr_cmd(tx_ring, count);
454453 skb_tx_timestamp(skb);
455454
456455 pdata->stats.tx_packets++;
457456 pdata->stats.tx_bytes += skb->len;
458457
458+ pdata->ring_ops->wr_cmd(tx_ring, count);
459459 return NETDEV_TX_OK;
460460 }
461461
@@ -688,10 +688,10 @@ static int xgene_enet_open(struct net_device *ndev) · 226 unmodified lines
688688 mac_ops->tx_enable(pdata);
689689 mac_ops->rx_enable(pdata);
690690
691+ xgene_enet_napi_enable(pdata);
691692 ret = xgene_enet_register_irq(ndev);
692693 if (ret)
693694 return ret;
694− xgene_enet_napi_enable(pdata);
695695
696696 if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII)
697697 phy_start(pdata->phy_dev);
@@ -715,13 +715,13 @@ static int xgene_enet_close(struct net_device *ndev) · 17 unmodified lines
715715 else
716716 cancel_delayed_work_sync(&pdata->link_work);
717717
718− xgene_enet_napi_disable(pdata);
719− xgene_enet_free_irq(ndev);
720− xgene_enet_process_ring(pdata->rx_ring, -1);
721−
722718 mac_ops->tx_disable(pdata);
723719 mac_ops->rx_disable(pdata);
724720
721+ xgene_enet_free_irq(ndev);
722+ xgene_enet_napi_disable(pdata);
723+ xgene_enet_process_ring(pdata->rx_ring, -1);
724+
725725 return 0;
726726 }
727727
@@ -1474,15 +1474,15 @@ static int xgene_enet_probe(struct platform_device *pdev) · 746 unmodified lines
14741474 }
14751475 ndev->hw_features = ndev->features;
14761476
1477− ret = register_netdev(ndev);
1477+ ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
14781478 if (ret) {
1479− netdev_err(ndev, "Failed to register netdev\n");
1479+ netdev_err(ndev, "No usable DMA configuration\n");
14801480 goto err;
14811481 }
14821482
1483− ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
1483+ ret = register_netdev(ndev);
14841484 if (ret) {
1485− netdev_err(ndev, "No usable DMA configuration\n");
1485+ netdev_err(ndev, "Failed to register netdev\n");
14861486 goto err;
14871487 }
14881488
@@ -1490,14 +1490,17 @@ static int xgene_enet_probe(struct platform_device *pdev) · 1 unmodified line
14901490 if (ret)
14911491 goto err;
14921492
1493− xgene_enet_napi_add(pdata);
14941493 mac_ops = pdata->mac_ops;
1495− if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII)
1494+ if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) {
14961495 ret = xgene_enet_mdio_config(pdata);
1497− else
1496+ if (ret)
1497+ goto err;
1498+ } else {
14981499 INIT_DELAYED_WORK(&pdata->link_work, mac_ops->link_state);
1500+ }
14991501
1500− return ret;
1502+ xgene_enet_napi_add(pdata);
1503+ return 0;
15011504 err:
15021505 unregister_netdev(ndev);
15031506 free_netdev(ndev);
drivers/net/ethernet/atheros/alx/main.c+2−0
@@ -1534,6 +1534,8 @@ static const struct pci_device_id alx_pci_tbl[] = { · 1533 unmodified lines
15341534 .driver_data = ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG },
15351535 { PCI_VDEVICE(ATTANSIC, ALX_DEV_ID_E2200),
15361536 .driver_data = ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG },
1537+ { PCI_VDEVICE(ATTANSIC, ALX_DEV_ID_E2400),
1538+ .driver_data = ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG },
15371539 { PCI_VDEVICE(ATTANSIC, ALX_DEV_ID_AR8162),
15381540 .driver_data = ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG },
15391541 { PCI_VDEVICE(ATTANSIC, ALX_DEV_ID_AR8171) },
drivers/net/ethernet/atheros/alx/reg.h+1−0
@@ -37,6 +37,7 @@ · 36 unmodified lines
3737
3838 #define ALX_DEV_ID_AR8161 0x1091
3939 #define ALX_DEV_ID_E2200 0xe091
40+#define ALX_DEV_ID_E2400 0xe0a1
4041 #define ALX_DEV_ID_AR8162 0x1090
4142 #define ALX_DEV_ID_AR8171 0x10A1
4243 #define ALX_DEV_ID_AR8172 0x10A0
drivers/net/ethernet/aurora/Kconfig+20−0
@@ -0,0 +1,20 @@
1+config NET_VENDOR_AURORA
2+ bool "Aurora VLSI devices"
3+ help
4+ If you have a network (Ethernet) device belonging to this class,
5+ say Y.
6+
7+ Note that the answer to this question doesn't directly affect the
8+ kernel: saying N will just cause the configurator to skip all
9+ questions about Aurora devices. If you say Y, you will be asked
10+ for your specific device in the following questions.
11+
12+if NET_VENDOR_AURORA
13+
14+config AURORA_NB8800
15+ tristate "Aurora AU-NB8800 support"
16+ select PHYLIB
17+ help
18+ Support for the AU-NB8800 gigabit Ethernet controller.
19+
20+endif
drivers/net/ethernet/aurora/Makefile+1−0
@@ -0,0 +1 @@
1+obj-$(CONFIG_AURORA_NB8800) += nb8800.o
drivers/net/ethernet/aurora/nb8800.c+1552−0
@@ -0,0 +1,1552 @@
1+/*
2+ * Copyright (C) 2015 Mans Rullgard <mans@mansr.com>
3+ *
4+ * Mostly rewritten, based on driver from Sigma Designs. Original
5+ * copyright notice below.
6+ *
7+ *
8+ * Driver for tangox SMP864x/SMP865x/SMP867x/SMP868x builtin Ethernet Mac.
9+ *
10+ * Copyright (C) 2005 Maxime Bizon <mbizon@freebox.fr>
11+ *
12+ * This program is free software; you can redistribute it and/or modify
13+ * it under the terms of the GNU General Public License as published by
14+ * the Free Software Foundation; either version 2 of the License, or
15+ * (at your option) any later version.
16+ *
17+ * This program is distributed in the hope that it will be useful,
18+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
19+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+ * GNU General Public License for more details.
21+ */
22+
23+#include <linux/module.h>
24+#include <linux/etherdevice.h>
25+#include <linux/delay.h>
26+#include <linux/ethtool.h>
27+#include <linux/interrupt.h>
28+#include <linux/platform_device.h>
29+#include <linux/of_device.h>
30+#include <linux/of_mdio.h>
31+#include <linux/of_net.h>
32+#include <linux/dma-mapping.h>
33+#include <linux/phy.h>
34+#include <linux/cache.h>
35+#include <linux/jiffies.h>
36+#include <linux/io.h>
37+#include <linux/iopoll.h>
38+#include <asm/barrier.h>
39+
40+#include "nb8800.h"
41+
42+static void nb8800_tx_done(struct net_device *dev);
43+static int nb8800_dma_stop(struct net_device *dev);
44+
45+static inline u8 nb8800_readb(struct nb8800_priv *priv, int reg)
46+{
47+ return readb_relaxed(priv->base + reg);
48+}
49+
50+static inline u32 nb8800_readl(struct nb8800_priv *priv, int reg)
51+{
52+ return readl_relaxed(priv->base + reg);
53+}
54+
55+static inline void nb8800_writeb(struct nb8800_priv *priv, int reg, u8 val)
56+{
57+ writeb_relaxed(val, priv->base + reg);
58+}
59+
60+static inline void nb8800_writew(struct nb8800_priv *priv, int reg, u16 val)
61+{
62+ writew_relaxed(val, priv->base + reg);
63+}
64+
65+static inline void nb8800_writel(struct nb8800_priv *priv, int reg, u32 val)
66+{
67+ writel_relaxed(val, priv->base + reg);
68+}
69+
70+static inline void nb8800_maskb(struct nb8800_priv *priv, int reg,
71+ u32 mask, u32 val)
72+{
73+ u32 old = nb8800_readb(priv, reg);
74+ u32 new = (old & ~mask) | (val & mask);
75+
76+ if (new != old)
77+ nb8800_writeb(priv, reg, new);
78+}
79+
80+static inline void nb8800_maskl(struct nb8800_priv *priv, int reg,
81+ u32 mask, u32 val)
82+{
83+ u32 old = nb8800_readl(priv, reg);
84+ u32 new = (old & ~mask) | (val & mask);
85+
86+ if (new != old)
87+ nb8800_writel(priv, reg, new);
88+}
89+
90+static inline void nb8800_modb(struct nb8800_priv *priv, int reg, u8 bits,
91+ bool set)
92+{
93+ nb8800_maskb(priv, reg, bits, set ? bits : 0);
94+}
95+
96+static inline void nb8800_setb(struct nb8800_priv *priv, int reg, u8 bits)
97+{
98+ nb8800_maskb(priv, reg, bits, bits);
99+}
100+
101+static inline void nb8800_clearb(struct nb8800_priv *priv, int reg, u8 bits)
102+{
103+ nb8800_maskb(priv, reg, bits, 0);
104+}
105+
106+static inline void nb8800_modl(struct nb8800_priv *priv, int reg, u32 bits,
107+ bool set)
108+{
109+ nb8800_maskl(priv, reg, bits, set ? bits : 0);
110+}
111+
112+static inline void nb8800_setl(struct nb8800_priv *priv, int reg, u32 bits)
113+{
114+ nb8800_maskl(priv, reg, bits, bits);
115+}
116+
117+static inline void nb8800_clearl(struct nb8800_priv *priv, int reg, u32 bits)
118+{
119+ nb8800_maskl(priv, reg, bits, 0);
120+}
121+
122+static int nb8800_mdio_wait(struct mii_bus *bus)
123+{
124+ struct nb8800_priv *priv = bus->priv;
125+ u32 val;
126+
127+ return readl_poll_timeout_atomic(priv->base + NB8800_MDIO_CMD,
128+ val, !(val & MDIO_CMD_GO), 1, 1000);
129+}
130+
131+static int nb8800_mdio_cmd(struct mii_bus *bus, u32 cmd)
132+{
133+ struct nb8800_priv *priv = bus->priv;
134+ int err;
135+
136+ err = nb8800_mdio_wait(bus);
137+ if (err)
138+ return err;
139+
140+ nb8800_writel(priv, NB8800_MDIO_CMD, cmd);
141+ udelay(10);
142+ nb8800_writel(priv, NB8800_MDIO_CMD, cmd | MDIO_CMD_GO);
143+
144+ return nb8800_mdio_wait(bus);
145+}
146+
147+static int nb8800_mdio_read(struct mii_bus *bus, int phy_id, int reg)
148+{
149+ struct nb8800_priv *priv = bus->priv;
150+ u32 val;
151+ int err;
152+
153+ err = nb8800_mdio_cmd(bus, MDIO_CMD_ADDR(phy_id) | MDIO_CMD_REG(reg));
154+ if (err)
155+ return err;
156+
157+ val = nb8800_readl(priv, NB8800_MDIO_STS);
158+ if (val & MDIO_STS_ERR)
159+ return 0xffff;
160+
161+ return val & 0xffff;
162+}
163+
164+static int nb8800_mdio_write(struct mii_bus *bus, int phy_id, int reg, u16 val)
165+{
166+ u32 cmd = MDIO_CMD_ADDR(phy_id) | MDIO_CMD_REG(reg) |
167+ MDIO_CMD_DATA(val) | MDIO_CMD_WR;
168+
169+ return nb8800_mdio_cmd(bus, cmd);
170+}
171+
172+static void nb8800_mac_tx(struct net_device *dev, bool enable)
173+{
174+ struct nb8800_priv *priv = netdev_priv(dev);
175+
176+ while (nb8800_readl(priv, NB8800_TXC_CR) & TCR_EN)
177+ cpu_relax();
178+
179+ nb8800_modb(priv, NB8800_TX_CTL1, TX_EN, enable);
180+}
181+
182+static void nb8800_mac_rx(struct net_device *dev, bool enable)
183+{
184+ nb8800_modb(netdev_priv(dev), NB8800_RX_CTL, RX_EN, enable);
185+}
186+
187+static void nb8800_mac_af(struct net_device *dev, bool enable)
188+{
189+ nb8800_modb(netdev_priv(dev), NB8800_RX_CTL, RX_AF_EN, enable);
190+}
191+
192+static void nb8800_start_rx(struct net_device *dev)
193+{
194+ nb8800_setl(netdev_priv(dev), NB8800_RXC_CR, RCR_EN);
195+}
196+
197+static int nb8800_alloc_rx(struct net_device *dev, unsigned int i, bool napi)
198+{
199+ struct nb8800_priv *priv = netdev_priv(dev);
200+ struct nb8800_rx_desc *rxd = &priv->rx_descs[i];
201+ struct nb8800_rx_buf *rxb = &priv->rx_bufs[i];
202+ int size = L1_CACHE_ALIGN(RX_BUF_SIZE);
203+ dma_addr_t dma_addr;
204+ struct page *page;
205+ unsigned long offset;
206+ void *data;
207+
208+ data = napi ? napi_alloc_frag(size) : netdev_alloc_frag(size);
209+ if (!data)
210+ return -ENOMEM;
211+
212+ page = virt_to_head_page(data);
213+ offset = data - page_address(page);
214+
215+ dma_addr = dma_map_page(&dev->dev, page, offset, RX_BUF_SIZE,
216+ DMA_FROM_DEVICE);
217+
218+ if (dma_mapping_error(&dev->dev, dma_addr)) {
219+ skb_free_frag(data);
220+ return -ENOMEM;
221+ }
222+
223+ rxb->page = page;
224+ rxb->offset = offset;
225+ rxd->desc.s_addr = dma_addr;
226+
227+ return 0;
228+}
229+
230+static void nb8800_receive(struct net_device *dev, unsigned int i,
231+ unsigned int len)
232+{
233+ struct nb8800_priv *priv = netdev_priv(dev);
234+ struct nb8800_rx_desc *rxd = &priv->rx_descs[i];
235+ struct page *page = priv->rx_bufs[i].page;
236+ int offset = priv->rx_bufs[i].offset;
237+ void *data = page_address(page) + offset;
238+ dma_addr_t dma = rxd->desc.s_addr;
239+ struct sk_buff *skb;
240+ unsigned int size;
241+ int err;
242+
243+ size = len <= RX_COPYBREAK ? len : RX_COPYHDR;
244+
245+ skb = napi_alloc_skb(&priv->napi, size);
246+ if (!skb) {
247+ netdev_err(dev, "rx skb allocation failed\n");
248+ dev->stats.rx_dropped++;
249+ return;
250+ }
251+
252+ if (len <= RX_COPYBREAK) {
253+ dma_sync_single_for_cpu(&dev->dev, dma, len, DMA_FROM_DEVICE);
254+ memcpy(skb_put(skb, len), data, len);
255+ dma_sync_single_for_device(&dev->dev, dma, len,
256+ DMA_FROM_DEVICE);
257+ } else {
258+ err = nb8800_alloc_rx(dev, i, true);
259+ if (err) {
260+ netdev_err(dev, "rx buffer allocation failed\n");
261+ dev->stats.rx_dropped++;
262+ return;
263+ }
264+
265+ dma_unmap_page(&dev->dev, dma, RX_BUF_SIZE, DMA_FROM_DEVICE);
266+ memcpy(skb_put(skb, RX_COPYHDR), data, RX_COPYHDR);
267+ skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page,
268+ offset + RX_COPYHDR, len - RX_COPYHDR,
269+ RX_BUF_SIZE);
270+ }
271+
272+ skb->protocol = eth_type_trans(skb, dev);
273+ napi_gro_receive(&priv->napi, skb);
274+}
275+
276+static void nb8800_rx_error(struct net_device *dev, u32 report)
277+{
278+ if (report & RX_LENGTH_ERR)
279+ dev->stats.rx_length_errors++;
280+
281+ if (report & RX_FCS_ERR)
282+ dev->stats.rx_crc_errors++;
283+
284+ if (report & RX_FIFO_OVERRUN)
285+ dev->stats.rx_fifo_errors++;
286+
287+ if (report & RX_ALIGNMENT_ERROR)
288+ dev->stats.rx_frame_errors++;
289+
290+ dev->stats.rx_errors++;
291+}
292+
293+static int nb8800_poll(struct napi_struct *napi, int budget)
294+{
295+ struct net_device *dev = napi->dev;
296+ struct nb8800_priv *priv = netdev_priv(dev);
297+ struct nb8800_rx_desc *rxd;
298+ unsigned int last = priv->rx_eoc;
299+ unsigned int next;
300+ int work = 0;
301+
302+ nb8800_tx_done(dev);
303+
304+again:
305+ while (work < budget) {
306+ struct nb8800_rx_buf *rxb;
307+ unsigned int len;
308+
309+ next = (last + 1) % RX_DESC_COUNT;
310+
311+ rxb = &priv->rx_bufs[next];
312+ rxd = &priv->rx_descs[next];
313+
314+ if (!rxd->report)
315+ break;
316+
317+ len = RX_BYTES_TRANSFERRED(rxd->report);
318+
319+ if (IS_RX_ERROR(rxd->report))
320+ nb8800_rx_error(dev, rxd->report);
321+ else
322+ nb8800_receive(dev, next, len);
323+
324+ dev->stats.rx_packets++;
325+ dev->stats.rx_bytes += len;
326+
327+ if (rxd->report & RX_MULTICAST_PKT)
328+ dev->stats.multicast++;
329+
330+ rxd->report = 0;
331+ last = next;
332+ work++;
333+ }
334+
335+ if (work) {
336+ priv->rx_descs[last].desc.config |= DESC_EOC;
337+ wmb(); /* ensure new EOC is written before clearing old */
338+ priv->rx_descs[priv->rx_eoc].desc.config &= ~DESC_EOC;
339+ priv->rx_eoc = last;
340+ nb8800_start_rx(dev);
341+ }
342+
343+ if (work < budget) {
344+ nb8800_writel(priv, NB8800_RX_ITR, priv->rx_itr_irq);
345+
346+ /* If a packet arrived after we last checked but
347+ * before writing RX_ITR, the interrupt will be
348+ * delayed, so we retrieve it now.
349+ */
350+ if (priv->rx_descs[next].report)
351+ goto again;
352+
353+ napi_complete_done(napi, work);
354+ }
355+
356+ return work;
357+}
358+
359+static void __nb8800_tx_dma_start(struct net_device *dev)
360+{
361+ struct nb8800_priv *priv = netdev_priv(dev);
362+ struct nb8800_tx_buf *txb;
363+ u32 txc_cr;
364+
365+ txb = &priv->tx_bufs[priv->tx_queue];
366+ if (!txb->ready)
367+ return;
368+
369+ txc_cr = nb8800_readl(priv, NB8800_TXC_CR);
370+ if (txc_cr & TCR_EN)
371+ return;
372+
373+ nb8800_writel(priv, NB8800_TX_DESC_ADDR, txb->dma_desc);
374+ wmb(); /* ensure desc addr is written before starting DMA */
375+ nb8800_writel(priv, NB8800_TXC_CR, txc_cr | TCR_EN);
376+
377+ priv->tx_queue = (priv->tx_queue + txb->chain_len) % TX_DESC_COUNT;
378+}
379+
380+static void nb8800_tx_dma_start(struct net_device *dev)
381+{
382+ struct nb8800_priv *priv = netdev_priv(dev);
383+
384+ spin_lock_irq(&priv->tx_lock);
385+ __nb8800_tx_dma_start(dev);
386+ spin_unlock_irq(&priv->tx_lock);
387+}
388+
389+static void nb8800_tx_dma_start_irq(struct net_device *dev)
390+{
391+ struct nb8800_priv *priv = netdev_priv(dev);
392+
393+ spin_lock(&priv->tx_lock);
394+ __nb8800_tx_dma_start(dev);
395+ spin_unlock(&priv->tx_lock);
396+}
397+
398+static int nb8800_xmit(struct sk_buff *skb, struct net_device *dev)
399+{
400+ struct nb8800_priv *priv = netdev_priv(dev);
401+ struct nb8800_tx_desc *txd;
402+ struct nb8800_tx_buf *txb;
403+ struct nb8800_dma_desc *desc;
404+ dma_addr_t dma_addr;
405+ unsigned int dma_len;
406+ unsigned int align;
407+ unsigned int next;
408+
409+ if (atomic_read(&priv->tx_free) <= NB8800_DESC_LOW) {
410+ netif_stop_queue(dev);
411+ return NETDEV_TX_BUSY;
412+ }
413+
414+ align = (8 - (uintptr_t)skb->data) & 7;
415+
416+ dma_len = skb->len - align;
417+ dma_addr = dma_map_single(&dev->dev, skb->data + align,
418+ dma_len, DMA_TO_DEVICE);
419+
420+ if (dma_mapping_error(&dev->dev, dma_addr)) {
421+ netdev_err(dev, "tx dma mapping error\n");
422+ kfree_skb(skb);
423+ dev->stats.tx_dropped++;
424+ return NETDEV_TX_OK;
425+ }
426+
427+ if (atomic_dec_return(&priv->tx_free) <= NB8800_DESC_LOW) {
428+ netif_stop_queue(dev);
429+ skb->xmit_more = 0;
430+ }
431+
432+ next = priv->tx_next;
433+ txb = &priv->tx_bufs[next];
434+ txd = &priv->tx_descs[next];
435+ desc = &txd->desc[0];
436+
437+ next = (next + 1) % TX_DESC_COUNT;
438+
439+ if (align) {
440+ memcpy(txd->buf, skb->data, align);
441+
442+ desc->s_addr =
443+ txb->dma_desc + offsetof(struct nb8800_tx_desc, buf);
444+ desc->n_addr = txb->dma_desc + sizeof(txd->desc[0]);
445+ desc->config = DESC_BTS(2) | DESC_DS | align;
446+
447+ desc++;
448+ }
449+
450+ desc->s_addr = dma_addr;
451+ desc->n_addr = priv->tx_bufs[next].dma_desc;
452+ desc->config = DESC_BTS(2) | DESC_DS | DESC_EOF | dma_len;
453+
454+ if (!skb->xmit_more)
455+ desc->config |= DESC_EOC;
456+
457+ txb->skb = skb;
458+ txb->dma_addr = dma_addr;
459+ txb->dma_len = dma_len;
460+
461+ if (!priv->tx_chain) {
462+ txb->chain_len = 1;
463+ priv->tx_chain = txb;
464+ } else {
465+ priv->tx_chain->chain_len++;
466+ }
467+
468+ netdev_sent_queue(dev, skb->len);
469+
470+ priv->tx_next = next;
471+
472+ if (!skb->xmit_more) {
473+ smp_wmb();
474+ priv->tx_chain->ready = true;
475+ priv->tx_chain = NULL;
476+ nb8800_tx_dma_start(dev);
477+ }
478+
479+ return NETDEV_TX_OK;
480+}
481+
482+static void nb8800_tx_error(struct net_device *dev, u32 report)
483+{
484+ if (report & TX_LATE_COLLISION)
485+ dev->stats.collisions++;
486+
487+ if (report & TX_PACKET_DROPPED)
488+ dev->stats.tx_dropped++;
489+
490+ if (report & TX_FIFO_UNDERRUN)
491+ dev->stats.tx_fifo_errors++;
492+
493+ dev->stats.tx_errors++;
494+}
495+
496+static void nb8800_tx_done(struct net_device *dev)
497+{
498+ struct nb8800_priv *priv = netdev_priv(dev);
499+ unsigned int limit = priv->tx_next;
500+ unsigned int done = priv->tx_done;
501+ unsigned int packets = 0;
502+ unsigned int len = 0;
503+
504+ while (done != limit) {
505+ struct nb8800_tx_desc *txd = &priv->tx_descs[done];
506+ struct nb8800_tx_buf *txb = &priv->tx_bufs[done];
507+ struct sk_buff *skb;
508+
509+ if (!txd->report)
510+ break;
511+
512+ skb = txb->skb;
513+ len += skb->len;
514+
515+ dma_unmap_single(&dev->dev, txb->dma_addr, txb->dma_len,
516+ DMA_TO_DEVICE);
517+
518+ if (IS_TX_ERROR(txd->report)) {
519+ nb8800_tx_error(dev, txd->report);
520+ kfree_skb(skb);
521+ } else {
522+ consume_skb(skb);
523+ }
524+
525+ dev->stats.tx_packets++;
526+ dev->stats.tx_bytes += TX_BYTES_TRANSFERRED(txd->report);
527+ dev->stats.collisions += TX_EARLY_COLLISIONS(txd->report);
528+
529+ txb->skb = NULL;
530+ txb->ready = false;
531+ txd->report = 0;
532+
533+ done = (done + 1) % TX_DESC_COUNT;
534+ packets++;
535+ }
536+
537+ if (packets) {
538+ smp_mb__before_atomic();
539+ atomic_add(packets, &priv->tx_free);
540+ netdev_completed_queue(dev, packets, len);
541+ netif_wake_queue(dev);
542+ priv->tx_done = done;
543+ }
544+}
545+
546+static irqreturn_t nb8800_irq(int irq, void *dev_id)
547+{
548+ struct net_device *dev = dev_id;
549+ struct nb8800_priv *priv = netdev_priv(dev);
550+ irqreturn_t ret = IRQ_NONE;
551+ u32 val;
552+
553+ /* tx interrupt */
554+ val = nb8800_readl(priv, NB8800_TXC_SR);
555+ if (val) {
556+ nb8800_writel(priv, NB8800_TXC_SR, val);
557+
558+ if (val & TSR_DI)
559+ nb8800_tx_dma_start_irq(dev);
560+
561+ if (val & TSR_TI)
562+ napi_schedule_irqoff(&priv->napi);
563+
564+ if (unlikely(val & TSR_DE))
565+ netdev_err(dev, "TX DMA error\n");
566+
567+ /* should never happen with automatic status retrieval */
568+ if (unlikely(val & TSR_TO))
569+ netdev_err(dev, "TX Status FIFO overflow\n");
570+
571+ ret = IRQ_HANDLED;
572+ }
573+
574+ /* rx interrupt */
575+ val = nb8800_readl(priv, NB8800_RXC_SR);
576+ if (val) {
577+ nb8800_writel(priv, NB8800_RXC_SR, val);
578+
579+ if (likely(val & (RSR_RI | RSR_DI))) {
580+ nb8800_writel(priv, NB8800_RX_ITR, priv->rx_itr_poll);
581+ napi_schedule_irqoff(&priv->napi);
582+ }
583+
584+ if (unlikely(val & RSR_DE))
585+ netdev_err(dev, "RX DMA error\n");
586+
587+ /* should never happen with automatic status retrieval */
588+ if (unlikely(val & RSR_RO))
589+ netdev_err(dev, "RX Status FIFO overflow\n");
590+
591+ ret = IRQ_HANDLED;
592+ }
593+
594+ return ret;
595+}
596+
597+static void nb8800_mac_config(struct net_device *dev)
598+{
599+ struct nb8800_priv *priv = netdev_priv(dev);
600+ bool gigabit = priv->speed == SPEED_1000;
601+ u32 mac_mode_mask = RGMII_MODE | HALF_DUPLEX | GMAC_MODE;
602+ u32 mac_mode = 0;
603+ u32 slot_time;
604+ u32 phy_clk;
605+ u32 ict;
606+
607+ if (!priv->duplex)
608+ mac_mode |= HALF_DUPLEX;
609+
610+ if (gigabit) {
611+ if (priv->phy_mode == PHY_INTERFACE_MODE_RGMII)
612+ mac_mode |= RGMII_MODE;
613+
614+ mac_mode |= GMAC_MODE;
615+ phy_clk = 125000000;
616+
617+ /* Should be 512 but register is only 8 bits */
618+ slot_time = 255;
619+ } else {
620+ phy_clk = 25000000;
621+ slot_time = 128;
622+ }
623+
624+ ict = DIV_ROUND_UP(phy_clk, clk_get_rate(priv->clk));
625+
626+ nb8800_writeb(priv, NB8800_IC_THRESHOLD, ict);
627+ nb8800_writeb(priv, NB8800_SLOT_TIME, slot_time);
628+ nb8800_maskb(priv, NB8800_MAC_MODE, mac_mode_mask, mac_mode);
629+}
630+
631+static void nb8800_pause_config(struct net_device *dev)
632+{
633+ struct nb8800_priv *priv = netdev_priv(dev);
634+ struct phy_device *phydev = priv->phydev;
635+ u32 rxcr;
636+
637+ if (priv->pause_aneg) {
638+ if (!phydev || !phydev->link)
639+ return;
640+
641+ priv->pause_rx = phydev->pause;
642+ priv->pause_tx = phydev->pause ^ phydev->asym_pause;
643+ }
644+
645+ nb8800_modb(priv, NB8800_RX_CTL, RX_PAUSE_EN, priv->pause_rx);
646+
647+ rxcr = nb8800_readl(priv, NB8800_RXC_CR);
648+ if (!!(rxcr & RCR_FL) == priv->pause_tx)
649+ return;
650+
651+ if (netif_running(dev)) {
652+ napi_disable(&priv->napi);
653+ netif_tx_lock_bh(dev);
654+ nb8800_dma_stop(dev);
655+ nb8800_modl(priv, NB8800_RXC_CR, RCR_FL, priv->pause_tx);
656+ nb8800_start_rx(dev);
657+ netif_tx_unlock_bh(dev);
658+ napi_enable(&priv->napi);
659+ } else {
660+ nb8800_modl(priv, NB8800_RXC_CR, RCR_FL, priv->pause_tx);
661+ }
662+}
663+
664+static void nb8800_link_reconfigure(struct net_device *dev)
665+{
666+ struct nb8800_priv *priv = netdev_priv(dev);
667+ struct phy_device *phydev = priv->phydev;
668+ int change = 0;
669+
670+ if (phydev->link) {
671+ if (phydev->speed != priv->speed) {
672+ priv->speed = phydev->speed;
673+ change = 1;
674+ }
675+
676+ if (phydev->duplex != priv->duplex) {
677+ priv->duplex = phydev->duplex;
678+ change = 1;
679+ }
680+
681+ if (change)
682+ nb8800_mac_config(dev);
683+
684+ nb8800_pause_config(dev);
685+ }
686+
687+ if (phydev->link != priv->link) {
688+ priv->link = phydev->link;
689+ change = 1;
690+ }
691+
692+ if (change)
693+ phy_print_status(priv->phydev);
694+}
695+
696+static void nb8800_update_mac_addr(struct net_device *dev)
697+{
698+ struct nb8800_priv *priv = netdev_priv(dev);
699+ int i;
700+
701+ for (i = 0; i < ETH_ALEN; i++)
702+ nb8800_writeb(priv, NB8800_SRC_ADDR(i), dev->dev_addr[i]);
703+
704+ for (i = 0; i < ETH_ALEN; i++)
705+ nb8800_writeb(priv, NB8800_UC_ADDR(i), dev->dev_addr[i]);
706+}
707+
708+static int nb8800_set_mac_address(struct net_device *dev, void *addr)
709+{
710+ struct sockaddr *sock = addr;
711+
712+ if (netif_running(dev))
713+ return -EBUSY;
714+
715+ ether_addr_copy(dev->dev_addr, sock->sa_data);
716+ nb8800_update_mac_addr(dev);
717+
718+ return 0;
719+}
720+
721+static void nb8800_mc_init(struct net_device *dev, int val)
722+{
723+ struct nb8800_priv *priv = netdev_priv(dev);
724+
725+ nb8800_writeb(priv, NB8800_MC_INIT, val);
726+ readb_poll_timeout_atomic(priv->base + NB8800_MC_INIT, val, !val,
727+ 1, 1000);
728+}
729+
730+static void nb8800_set_rx_mode(struct net_device *dev)
731+{
732+ struct nb8800_priv *priv = netdev_priv(dev);
733+ struct netdev_hw_addr *ha;
734+ int i;
735+
736+ if (dev->flags & (IFF_PROMISC | IFF_ALLMULTI)) {
737+ nb8800_mac_af(dev, false);
738+ return;
739+ }
740+
741+ nb8800_mac_af(dev, true);
742+ nb8800_mc_init(dev, 0);
743+
744+ netdev_for_each_mc_addr(ha, dev) {
745+ for (i = 0; i < ETH_ALEN; i++)
746+ nb8800_writeb(priv, NB8800_MC_ADDR(i), ha->addr[i]);
747+
748+ nb8800_mc_init(dev, 0xff);
749+ }
750+}
751+
752+#define RX_DESC_SIZE (RX_DESC_COUNT * sizeof(struct nb8800_rx_desc))
753+#define TX_DESC_SIZE (TX_DESC_COUNT * sizeof(struct nb8800_tx_desc))
754+
755+static void nb8800_dma_free(struct net_device *dev)
756+{
757+ struct nb8800_priv *priv = netdev_priv(dev);
758+ unsigned int i;
759+
760+ if (priv->rx_bufs) {
761+ for (i = 0; i < RX_DESC_COUNT; i++)
762+ if (priv->rx_bufs[i].page)
763+ put_page(priv->rx_bufs[i].page);
764+
765+ kfree(priv->rx_bufs);
766+ priv->rx_bufs = NULL;
767+ }
768+
769+ if (priv->tx_bufs) {
770+ for (i = 0; i < TX_DESC_COUNT; i++)
771+ kfree_skb(priv->tx_bufs[i].skb);
772+
773+ kfree(priv->tx_bufs);
774+ priv->tx_bufs = NULL;
775+ }
776+
777+ if (priv->rx_descs) {
778+ dma_free_coherent(dev->dev.parent, RX_DESC_SIZE, priv->rx_descs,
779+ priv->rx_desc_dma);
780+ priv->rx_descs = NULL;
781+ }
782+
783+ if (priv->tx_descs) {
784+ dma_free_coherent(dev->dev.parent, TX_DESC_SIZE, priv->tx_descs,
785+ priv->tx_desc_dma);
786+ priv->tx_descs = NULL;
787+ }
788+}
789+
790+static void nb8800_dma_reset(struct net_device *dev)
791+{
792+ struct nb8800_priv *priv = netdev_priv(dev);
793+ struct nb8800_rx_desc *rxd;
794+ struct nb8800_tx_desc *txd;
795+ unsigned int i;
796+
797+ for (i = 0; i < RX_DESC_COUNT; i++) {
798+ dma_addr_t rx_dma = priv->rx_desc_dma + i * sizeof(*rxd);
799+
800+ rxd = &priv->rx_descs[i];
801+ rxd->desc.n_addr = rx_dma + sizeof(*rxd);
802+ rxd->desc.r_addr =
803+ rx_dma + offsetof(struct nb8800_rx_desc, report);
804+ rxd->desc.config = priv->rx_dma_config;
805+ rxd->report = 0;
806+ }
807+
808+ rxd->desc.n_addr = priv->rx_desc_dma;
809+ rxd->desc.config |= DESC_EOC;
810+
811+ priv->rx_eoc = RX_DESC_COUNT - 1;
812+
813+ for (i = 0; i < TX_DESC_COUNT; i++) {
814+ struct nb8800_tx_buf *txb = &priv->tx_bufs[i];
815+ dma_addr_t r_dma = txb->dma_desc +
816+ offsetof(struct nb8800_tx_desc, report);
817+
818+ txd = &priv->tx_descs[i];
819+ txd->desc[0].r_addr = r_dma;
820+ txd->desc[1].r_addr = r_dma;
821+ txd->report = 0;
822+ }
823+
824+ priv->tx_next = 0;
825+ priv->tx_queue = 0;
826+ priv->tx_done = 0;
827+ atomic_set(&priv->tx_free, TX_DESC_COUNT);
828+
829+ nb8800_writel(priv, NB8800_RX_DESC_ADDR, priv->rx_desc_dma);
830+
831+ wmb(); /* ensure all setup is written before starting */
832+}
833+
834+static int nb8800_dma_init(struct net_device *dev)
835+{
836+ struct nb8800_priv *priv = netdev_priv(dev);
837+ unsigned int n_rx = RX_DESC_COUNT;
838+ unsigned int n_tx = TX_DESC_COUNT;
839+ unsigned int i;
840+ int err;
841+
842+ priv->rx_descs = dma_alloc_coherent(dev->dev.parent, RX_DESC_SIZE,
843+ &priv->rx_desc_dma, GFP_KERNEL);
844+ if (!priv->rx_descs)
845+ goto err_out;
846+
847+ priv->rx_bufs = kcalloc(n_rx, sizeof(*priv->rx_bufs), GFP_KERNEL);
848+ if (!priv->rx_bufs)
849+ goto err_out;
850+
851+ for (i = 0; i < n_rx; i++) {
852+ err = nb8800_alloc_rx(dev, i, false);
853+ if (err)
854+ goto err_out;
855+ }
856+
857+ priv->tx_descs = dma_alloc_coherent(dev->dev.parent, TX_DESC_SIZE,
858+ &priv->tx_desc_dma, GFP_KERNEL);
859+ if (!priv->tx_descs)
860+ goto err_out;
861+
862+ priv->tx_bufs = kcalloc(n_tx, sizeof(*priv->tx_bufs), GFP_KERNEL);
863+ if (!priv->tx_bufs)
864+ goto err_out;
865+
866+ for (i = 0; i < n_tx; i++)
867+ priv->tx_bufs[i].dma_desc =
868+ priv->tx_desc_dma + i * sizeof(struct nb8800_tx_desc);
869+
870+ nb8800_dma_reset(dev);
871+
872+ return 0;
873+
874+err_out:
875+ nb8800_dma_free(dev);
876+
877+ return -ENOMEM;
878+}
879+
880+static int nb8800_dma_stop(struct net_device *dev)
881+{
882+ struct nb8800_priv *priv = netdev_priv(dev);
883+ struct nb8800_tx_buf *txb = &priv->tx_bufs[0];
884+ struct nb8800_tx_desc *txd = &priv->tx_descs[0];
885+ int retry = 5;
886+ u32 txcr;
887+ u32 rxcr;
888+ int err;
889+ unsigned int i;
890+
891+ /* wait for tx to finish */
892+ err = readl_poll_timeout_atomic(priv->base + NB8800_TXC_CR, txcr,
893+ !(txcr & TCR_EN) &&
894+ priv->tx_done == priv->tx_next,
895+ 1000, 1000000);
896+ if (err)
897+ return err;
898+
899+ /* The rx DMA only stops if it reaches the end of chain.
900+ * To make this happen, we set the EOC flag on all rx
901+ * descriptors, put the device in loopback mode, and send
902+ * a few dummy frames. The interrupt handler will ignore
903+ * these since NAPI is disabled and no real frames are in
904+ * the tx queue.
905+ */
906+
907+ for (i = 0; i < RX_DESC_COUNT; i++)
908+ priv->rx_descs[i].desc.config |= DESC_EOC;
909+
910+ txd->desc[0].s_addr =
911+ txb->dma_desc + offsetof(struct nb8800_tx_desc, buf);
912+ txd->desc[0].config = DESC_BTS(2) | DESC_DS | DESC_EOF | DESC_EOC | 8;
913+ memset(txd->buf, 0, sizeof(txd->buf));
914+
915+ nb8800_mac_af(dev, false);
916+ nb8800_setb(priv, NB8800_MAC_MODE, LOOPBACK_EN);
917+
918+ do {
919+ nb8800_writel(priv, NB8800_TX_DESC_ADDR, txb->dma_desc);
920+ wmb();
921+ nb8800_writel(priv, NB8800_TXC_CR, txcr | TCR_EN);
922+
923+ err = readl_poll_timeout_atomic(priv->base + NB8800_RXC_CR,
924+ rxcr, !(rxcr & RCR_EN),
925+ 1000, 100000);
926+ } while (err && --retry);
927+
928+ nb8800_mac_af(dev, true);
929+ nb8800_clearb(priv, NB8800_MAC_MODE, LOOPBACK_EN);
930+ nb8800_dma_reset(dev);
931+
932+ return retry ? 0 : -ETIMEDOUT;
933+}
934+
935+static void nb8800_pause_adv(struct net_device *dev)
936+{
937+ struct nb8800_priv *priv = netdev_priv(dev);
938+ u32 adv = 0;
939+
940+ if (!priv->phydev)
941+ return;
942+
943+ if (priv->pause_rx)
944+ adv |= ADVERTISED_Pause | ADVERTISED_Asym_Pause;
945+ if (priv->pause_tx)
946+ adv ^= ADVERTISED_Asym_Pause;
947+
948+ priv->phydev->supported |= adv;
949+ priv->phydev->advertising |= adv;
950+}
951+
952+static int nb8800_open(struct net_device *dev)
953+{
954+ struct nb8800_priv *priv = netdev_priv(dev);
955+ int err;
956+
957+ /* clear any pending interrupts */
958+ nb8800_writel(priv, NB8800_RXC_SR, 0xf);
959+ nb8800_writel(priv, NB8800_TXC_SR, 0xf);
960+
961+ err = nb8800_dma_init(dev);
962+ if (err)
963+ return err;
964+
965+ err = request_irq(dev->irq, nb8800_irq, 0, dev_name(&dev->dev), dev);
966+ if (err)
967+ goto err_free_dma;
968+
969+ nb8800_mac_rx(dev, true);
970+ nb8800_mac_tx(dev, true);
971+
972+ priv->phydev = of_phy_connect(dev, priv->phy_node,
973+ nb8800_link_reconfigure, 0,
974+ priv->phy_mode);
975+ if (!priv->phydev)
976+ goto err_free_irq;
977+
978+ nb8800_pause_adv(dev);
979+
980+ netdev_reset_queue(dev);
981+ napi_enable(&priv->napi);
982+ netif_start_queue(dev);
983+
984+ nb8800_start_rx(dev);
985+ phy_start(priv->phydev);
986+
987+ return 0;
988+
989+err_free_irq:
990+ free_irq(dev->irq, dev);
991+err_free_dma:
992+ nb8800_dma_free(dev);
993+
994+ return err;
995+}
996+
997+static int nb8800_stop(struct net_device *dev)
998+{
999+ struct nb8800_priv *priv = netdev_priv(dev);
1000+
1001+ phy_stop(priv->phydev);
1002+
1003+ netif_stop_queue(dev);
1004+ napi_disable(&priv->napi);
1005+
1006+ nb8800_dma_stop(dev);
1007+ nb8800_mac_rx(dev, false);
1008+ nb8800_mac_tx(dev, false);
1009+
1010+ phy_disconnect(priv->phydev);
1011+ priv->phydev = NULL;
1012+
1013+ free_irq(dev->irq, dev);
1014+
1015+ nb8800_dma_free(dev);
1016+
1017+ return 0;
1018+}
1019+
1020+static int nb8800_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1021+{
1022+ struct nb8800_priv *priv = netdev_priv(dev);
1023+
1024+ return phy_mii_ioctl(priv->phydev, rq, cmd);
1025+}
1026+
1027+static const struct net_device_ops nb8800_netdev_ops = {
1028+ .ndo_open = nb8800_open,
1029+ .ndo_stop = nb8800_stop,
1030+ .ndo_start_xmit = nb8800_xmit,
1031+ .ndo_set_mac_address = nb8800_set_mac_address,
1032+ .ndo_set_rx_mode = nb8800_set_rx_mode,
1033+ .ndo_do_ioctl = nb8800_ioctl,
1034+ .ndo_change_mtu = eth_change_mtu,
1035+ .ndo_validate_addr = eth_validate_addr,
1036+};
1037+
1038+static int nb8800_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1039+{
1040+ struct nb8800_priv *priv = netdev_priv(dev);
1041+
1042+ if (!priv->phydev)
1043+ return -ENODEV;
1044+
1045+ return phy_ethtool_gset(priv->phydev, cmd);
1046+}
1047+
1048+static int nb8800_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1049+{
1050+ struct nb8800_priv *priv = netdev_priv(dev);
1051+
1052+ if (!priv->phydev)
1053+ return -ENODEV;
1054+
1055+ return phy_ethtool_sset(priv->phydev, cmd);
1056+}
1057+
1058+static int nb8800_nway_reset(struct net_device *dev)
1059+{
1060+ struct nb8800_priv *priv = netdev_priv(dev);
1061+
1062+ if (!priv->phydev)
1063+ return -ENODEV;
1064+
1065+ return genphy_restart_aneg(priv->phydev);
1066+}
1067+
1068+static void nb8800_get_pauseparam(struct net_device *dev,
1069+ struct ethtool_pauseparam *pp)
1070+{
1071+ struct nb8800_priv *priv = netdev_priv(dev);
1072+
1073+ pp->autoneg = priv->pause_aneg;
1074+ pp->rx_pause = priv->pause_rx;
1075+ pp->tx_pause = priv->pause_tx;
1076+}
1077+
1078+static int nb8800_set_pauseparam(struct net_device *dev,
1079+ struct ethtool_pauseparam *pp)
1080+{
1081+ struct nb8800_priv *priv = netdev_priv(dev);
1082+
1083+ priv->pause_aneg = pp->autoneg;
1084+ priv->pause_rx = pp->rx_pause;
1085+ priv->pause_tx = pp->tx_pause;
1086+
1087+ nb8800_pause_adv(dev);
1088+
1089+ if (!priv->pause_aneg)
1090+ nb8800_pause_config(dev);
1091+ else if (priv->phydev)
1092+ phy_start_aneg(priv->phydev);
1093+
1094+ return 0;
1095+}
1096+
1097+static const char nb8800_stats_names[][ETH_GSTRING_LEN] = {
1098+ "rx_bytes_ok",
1099+ "rx_frames_ok",
1100+ "rx_undersize_frames",
1101+ "rx_fragment_frames",
1102+ "rx_64_byte_frames",
1103+ "rx_127_byte_frames",
1104+ "rx_255_byte_frames",
1105+ "rx_511_byte_frames",
1106+ "rx_1023_byte_frames",
1107+ "rx_max_size_frames",
1108+ "rx_oversize_frames",
1109+ "rx_bad_fcs_frames",
1110+ "rx_broadcast_frames",
1111+ "rx_multicast_frames",
1112+ "rx_control_frames",
1113+ "rx_pause_frames",
1114+ "rx_unsup_control_frames",
1115+ "rx_align_error_frames",
1116+ "rx_overrun_frames",
1117+ "rx_jabber_frames",
1118+ "rx_bytes",
1119+ "rx_frames",
1120+
1121+ "tx_bytes_ok",
1122+ "tx_frames_ok",
1123+ "tx_64_byte_frames",
1124+ "tx_127_byte_frames",
1125+ "tx_255_byte_frames",
1126+ "tx_511_byte_frames",
1127+ "tx_1023_byte_frames",
1128+ "tx_max_size_frames",
1129+ "tx_oversize_frames",
1130+ "tx_broadcast_frames",
1131+ "tx_multicast_frames",
1132+ "tx_control_frames",
1133+ "tx_pause_frames",
1134+ "tx_underrun_frames",
1135+ "tx_single_collision_frames",
1136+ "tx_multi_collision_frames",
1137+ "tx_deferred_collision_frames",
1138+ "tx_late_collision_frames",
1139+ "tx_excessive_collision_frames",
1140+ "tx_bytes",
1141+ "tx_frames",
1142+ "tx_collisions",
1143+};
1144+
1145+#define NB8800_NUM_STATS ARRAY_SIZE(nb8800_stats_names)
1146+
1147+static int nb8800_get_sset_count(struct net_device *dev, int sset)
1148+{
1149+ if (sset == ETH_SS_STATS)
1150+ return NB8800_NUM_STATS;
1151+
1152+ return -EOPNOTSUPP;
1153+}
1154+
1155+static void nb8800_get_strings(struct net_device *dev, u32 sset, u8 *buf)
1156+{
1157+ if (sset == ETH_SS_STATS)
1158+ memcpy(buf, &nb8800_stats_names, sizeof(nb8800_stats_names));
1159+}
1160+
1161+static u32 nb8800_read_stat(struct net_device *dev, int index)
1162+{
1163+ struct nb8800_priv *priv = netdev_priv(dev);
1164+
1165+ nb8800_writeb(priv, NB8800_STAT_INDEX, index);
1166+
1167+ return nb8800_readl(priv, NB8800_STAT_DATA);
1168+}
1169+
1170+static void nb8800_get_ethtool_stats(struct net_device *dev,
1171+ struct ethtool_stats *estats, u64 *st)
1172+{
1173+ unsigned int i;
1174+ u32 rx, tx;
1175+
1176+ for (i = 0; i < NB8800_NUM_STATS / 2; i++) {
1177+ rx = nb8800_read_stat(dev, i);
1178+ tx = nb8800_read_stat(dev, i | 0x80);
1179+ st[i] = rx;
1180+ st[i + NB8800_NUM_STATS / 2] = tx;
1181+ }
1182+}
1183+
1184+static const struct ethtool_ops nb8800_ethtool_ops = {
1185+ .get_settings = nb8800_get_settings,
1186+ .set_settings = nb8800_set_settings,
1187+ .nway_reset = nb8800_nway_reset,
1188+ .get_link = ethtool_op_get_link,
1189+ .get_pauseparam = nb8800_get_pauseparam,
1190+ .set_pauseparam = nb8800_set_pauseparam,
1191+ .get_sset_count = nb8800_get_sset_count,
1192+ .get_strings = nb8800_get_strings,
1193+ .get_ethtool_stats = nb8800_get_ethtool_stats,
1194+};
1195+
1196+static int nb8800_hw_init(struct net_device *dev)
1197+{
1198+ struct nb8800_priv *priv = netdev_priv(dev);
1199+ u32 val;
1200+
1201+ val = TX_RETRY_EN | TX_PAD_EN | TX_APPEND_FCS;
1202+ nb8800_writeb(priv, NB8800_TX_CTL1, val);
1203+
1204+ /* Collision retry count */
1205+ nb8800_writeb(priv, NB8800_TX_CTL2, 5);
1206+
1207+ val = RX_PAD_STRIP | RX_AF_EN;
1208+ nb8800_writeb(priv, NB8800_RX_CTL, val);
1209+
1210+ /* Chosen by fair dice roll */
1211+ nb8800_writeb(priv, NB8800_RANDOM_SEED, 4);
1212+
1213+ /* TX cycles per deferral period */
1214+ nb8800_writeb(priv, NB8800_TX_SDP, 12);
1215+
1216+ /* The following three threshold values have been
1217+ * experimentally determined for good results.
1218+ */
1219+
1220+ /* RX/TX FIFO threshold for partial empty (64-bit entries) */
1221+ nb8800_writeb(priv, NB8800_PE_THRESHOLD, 0);
1222+
1223+ /* RX/TX FIFO threshold for partial full (64-bit entries) */
1224+ nb8800_writeb(priv, NB8800_PF_THRESHOLD, 255);
1225+
1226+ /* Buffer size for transmit (64-bit entries) */
1227+ nb8800_writeb(priv, NB8800_TX_BUFSIZE, 64);
1228+
1229+ /* Configure tx DMA */
1230+
1231+ val = nb8800_readl(priv, NB8800_TXC_CR);
1232+ val &= TCR_LE; /* keep endian setting */
1233+ val |= TCR_DM; /* DMA descriptor mode */
1234+ val |= TCR_RS; /* automatically store tx status */
1235+ val |= TCR_DIE; /* interrupt on DMA chain completion */
1236+ val |= TCR_TFI(7); /* interrupt after 7 frames transmitted */
1237+ val |= TCR_BTS(2); /* 32-byte bus transaction size */
1238+ nb8800_writel(priv, NB8800_TXC_CR, val);
1239+
1240+ /* TX complete interrupt after 10 ms or 7 frames (see above) */
1241+ val = clk_get_rate(priv->clk) / 100;
1242+ nb8800_writel(priv, NB8800_TX_ITR, val);
1243+
1244+ /* Configure rx DMA */
1245+
1246+ val = nb8800_readl(priv, NB8800_RXC_CR);
1247+ val &= RCR_LE; /* keep endian setting */
1248+ val |= RCR_DM; /* DMA descriptor mode */
1249+ val |= RCR_RS; /* automatically store rx status */
1250+ val |= RCR_DIE; /* interrupt at end of DMA chain */
1251+ val |= RCR_RFI(7); /* interrupt after 7 frames received */
1252+ val |= RCR_BTS(2); /* 32-byte bus transaction size */
1253+ nb8800_writel(priv, NB8800_RXC_CR, val);
1254+
1255+ /* The rx interrupt can fire before the DMA has completed
1256+ * unless a small delay is added. 50 us is hopefully enough.
1257+ */
1258+ priv->rx_itr_irq = clk_get_rate(priv->clk) / 20000;
1259+
1260+ /* In NAPI poll mode we want to disable interrupts, but the
1261+ * hardware does not permit this. Delay 10 ms instead.
1262+ */
1263+ priv->rx_itr_poll = clk_get_rate(priv->clk) / 100;
1264+
1265+ nb8800_writel(priv, NB8800_RX_ITR, priv->rx_itr_irq);
1266+
1267+ priv->rx_dma_config = RX_BUF_SIZE | DESC_BTS(2) | DESC_DS | DESC_EOF;
1268+
1269+ /* Flow control settings */
1270+
1271+ /* Pause time of 0.1 ms */
1272+ val = 100000 / 512;
1273+ nb8800_writeb(priv, NB8800_PQ1, val >> 8);
1274+ nb8800_writeb(priv, NB8800_PQ2, val & 0xff);
1275+
1276+ /* Auto-negotiate by default */
1277+ priv->pause_aneg = true;
1278+ priv->pause_rx = true;
1279+ priv->pause_tx = true;
1280+
1281+ nb8800_mc_init(dev, 0);
1282+
1283+ return 0;
1284+}
1285+
1286+static int nb8800_tangox_init(struct net_device *dev)
1287+{
1288+ struct nb8800_priv *priv = netdev_priv(dev);
1289+ u32 pad_mode = PAD_MODE_MII;
1290+
1291+ switch (priv->phy_mode) {
1292+ case PHY_INTERFACE_MODE_MII:
1293+ case PHY_INTERFACE_MODE_GMII:
1294+ pad_mode = PAD_MODE_MII;
1295+ break;
1296+
1297+ case PHY_INTERFACE_MODE_RGMII:
1298+ pad_mode = PAD_MODE_RGMII;
1299+ break;
1300+
1301+ case PHY_INTERFACE_MODE_RGMII_TXID:
1302+ pad_mode = PAD_MODE_RGMII | PAD_MODE_GTX_CLK_DELAY;
1303+ break;
1304+
1305+ default:
1306+ dev_err(dev->dev.parent, "unsupported phy mode %s\n",
1307+ phy_modes(priv->phy_mode));
1308+ return -EINVAL;
1309+ }
1310+
1311+ nb8800_writeb(priv, NB8800_TANGOX_PAD_MODE, pad_mode);
1312+
1313+ return 0;
1314+}
1315+
1316+static int nb8800_tangox_reset(struct net_device *dev)
1317+{
1318+ struct nb8800_priv *priv = netdev_priv(dev);
1319+ int clk_div;
1320+
1321+ nb8800_writeb(priv, NB8800_TANGOX_RESET, 0);
1322+ usleep_range(1000, 10000);
1323+ nb8800_writeb(priv, NB8800_TANGOX_RESET, 1);
1324+
1325+ wmb(); /* ensure reset is cleared before proceeding */
1326+
1327+ clk_div = DIV_ROUND_UP(clk_get_rate(priv->clk), 2 * MAX_MDC_CLOCK);
1328+ nb8800_writew(priv, NB8800_TANGOX_MDIO_CLKDIV, clk_div);
1329+
1330+ return 0;
1331+}
1332+
1333+static const struct nb8800_ops nb8800_tangox_ops = {
1334+ .init = nb8800_tangox_init,
1335+ .reset = nb8800_tangox_reset,
1336+};
1337+
1338+static int nb8800_tango4_init(struct net_device *dev)
1339+{
1340+ struct nb8800_priv *priv = netdev_priv(dev);
1341+ int err;
1342+
1343+ err = nb8800_tangox_init(dev);
1344+ if (err)
1345+ return err;
1346+
1347+ /* On tango4 interrupt on DMA completion per frame works and gives
1348+ * better performance despite generating more rx interrupts.
1349+ */
1350+
1351+ /* Disable unnecessary interrupt on rx completion */
1352+ nb8800_clearl(priv, NB8800_RXC_CR, RCR_RFI(7));
1353+
1354+ /* Request interrupt on descriptor DMA completion */
1355+ priv->rx_dma_config |= DESC_ID;
1356+
1357+ return 0;
1358+}
1359+
1360+static const struct nb8800_ops nb8800_tango4_ops = {
1361+ .init = nb8800_tango4_init,
1362+ .reset = nb8800_tangox_reset,
1363+};
1364+
1365+static const struct of_device_id nb8800_dt_ids[] = {
1366+ {
1367+ .compatible = "aurora,nb8800",
1368+ },
1369+ {
1370+ .compatible = "sigma,smp8642-ethernet",
1371+ .data = &nb8800_tangox_ops,
1372+ },
1373+ {
1374+ .compatible = "sigma,smp8734-ethernet",
1375+ .data = &nb8800_tango4_ops,
1376+ },
1377+ { }
1378+};
1379+
1380+static int nb8800_probe(struct platform_device *pdev)
1381+{
1382+ const struct of_device_id *match;
1383+ const struct nb8800_ops *ops = NULL;
1384+ struct nb8800_priv *priv;
1385+ struct resource *res;
1386+ struct net_device *dev;
1387+ struct mii_bus *bus;
1388+ const unsigned char *mac;
1389+ void __iomem *base;
1390+ int irq;
1391+ int ret;
1392+
1393+ match = of_match_device(nb8800_dt_ids, &pdev->dev);
1394+ if (match)
1395+ ops = match->data;
1396+
1397+ irq = platform_get_irq(pdev, 0);
1398+ if (irq <= 0) {
1399+ dev_err(&pdev->dev, "No IRQ\n");
1400+ return -EINVAL;
1401+ }
1402+
1403+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1404+ base = devm_ioremap_resource(&pdev->dev, res);
1405+ if (IS_ERR(base))
1406+ return PTR_ERR(base);
1407+
1408+ dev_dbg(&pdev->dev, "AU-NB8800 Ethernet at %pa\n", &res->start);
1409+
1410+ dev = alloc_etherdev(sizeof(*priv));
1411+ if (!dev)
1412+ return -ENOMEM;
1413+
1414+ platform_set_drvdata(pdev, dev);
1415+ SET_NETDEV_DEV(dev, &pdev->dev);
1416+
1417+ priv = netdev_priv(dev);
1418+ priv->base = base;
1419+
1420+ priv->phy_mode = of_get_phy_mode(pdev->dev.of_node);
1421+ if (priv->phy_mode < 0)
1422+ priv->phy_mode = PHY_INTERFACE_MODE_RGMII;
1423+
1424+ priv->clk = devm_clk_get(&pdev->dev, NULL);
1425+ if (IS_ERR(priv->clk)) {
1426+ dev_err(&pdev->dev, "failed to get clock\n");
1427+ ret = PTR_ERR(priv->clk);
1428+ goto err_free_dev;
1429+ }
1430+
1431+ ret = clk_prepare_enable(priv->clk);
1432+ if (ret)
1433+ goto err_free_dev;
1434+
1435+ spin_lock_init(&priv->tx_lock);
1436+
1437+ if (ops && ops->reset) {
1438+ ret = ops->reset(dev);
1439+ if (ret)
1440+ goto err_free_dev;
1441+ }
1442+
1443+ bus = devm_mdiobus_alloc(&pdev->dev);
1444+ if (!bus) {
1445+ ret = -ENOMEM;
1446+ goto err_disable_clk;
1447+ }
1448+
1449+ bus->name = "nb8800-mii";
1450+ bus->read = nb8800_mdio_read;
1451+ bus->write = nb8800_mdio_write;
1452+ bus->parent = &pdev->dev;
1453+ snprintf(bus->id, MII_BUS_ID_SIZE, "%lx.nb8800-mii",
1454+ (unsigned long)res->start);
1455+ bus->priv = priv;
1456+
1457+ ret = of_mdiobus_register(bus, pdev->dev.of_node);
1458+ if (ret) {
1459+ dev_err(&pdev->dev, "failed to register MII bus\n");
1460+ goto err_disable_clk;
1461+ }
1462+
1463+ priv->phy_node = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0);
1464+ if (!priv->phy_node) {
1465+ dev_err(&pdev->dev, "no PHY specified\n");
1466+ ret = -ENODEV;
1467+ goto err_free_bus;
1468+ }
1469+
1470+ priv->mii_bus = bus;
1471+
1472+ ret = nb8800_hw_init(dev);
1473+ if (ret)
1474+ goto err_free_bus;
1475+
1476+ if (ops && ops->init) {
1477+ ret = ops->init(dev);
1478+ if (ret)
1479+ goto err_free_bus;
1480+ }
1481+
1482+ dev->netdev_ops = &nb8800_netdev_ops;
1483+ dev->ethtool_ops = &nb8800_ethtool_ops;
1484+ dev->flags |= IFF_MULTICAST;
1485+ dev->irq = irq;
1486+
1487+ mac = of_get_mac_address(pdev->dev.of_node);
1488+ if (mac)
1489+ ether_addr_copy(dev->dev_addr, mac);
1490+
1491+ if (!is_valid_ether_addr(dev->dev_addr))
1492+ eth_hw_addr_random(dev);
1493+
1494+ nb8800_update_mac_addr(dev);
1495+
1496+ netif_carrier_off(dev);
1497+
1498+ ret = register_netdev(dev);
1499+ if (ret) {
1500+ netdev_err(dev, "failed to register netdev\n");
1501+ goto err_free_dma;
1502+ }
1503+
1504+ netif_napi_add(dev, &priv->napi, nb8800_poll, NAPI_POLL_WEIGHT);
1505+
1506+ netdev_info(dev, "MAC address %pM\n", dev->dev_addr);
1507+
1508+ return 0;
1509+
1510+err_free_dma:
1511+ nb8800_dma_free(dev);
1512+err_free_bus:
1513+ mdiobus_unregister(bus);
1514+err_disable_clk:
1515+ clk_disable_unprepare(priv->clk);
1516+err_free_dev:
1517+ free_netdev(dev);
1518+
1519+ return ret;
1520+}
1521+
1522+static int nb8800_remove(struct platform_device *pdev)
1523+{
1524+ struct net_device *ndev = platform_get_drvdata(pdev);
1525+ struct nb8800_priv *priv = netdev_priv(ndev);
1526+
1527+ unregister_netdev(ndev);
1528+
1529+ mdiobus_unregister(priv->mii_bus);
1530+
1531+ clk_disable_unprepare(priv->clk);
1532+
1533+ nb8800_dma_free(ndev);
1534+ free_netdev(ndev);
1535+
1536+ return 0;
1537+}
1538+
1539+static struct platform_driver nb8800_driver = {
1540+ .driver = {
1541+ .name = "nb8800",
1542+ .of_match_table = nb8800_dt_ids,
1543+ },
1544+ .probe = nb8800_probe,
1545+ .remove = nb8800_remove,
1546+};
1547+
1548+module_platform_driver(nb8800_driver);
1549+
1550+MODULE_DESCRIPTION("Aurora AU-NB8800 Ethernet driver");
1551+MODULE_AUTHOR("Mans Rullgard <mans@mansr.com>");
1552+MODULE_LICENSE("GPL");
drivers/net/ethernet/aurora/nb8800.h+316−0
@@ -0,0 +1,316 @@
1+#ifndef _NB8800_H_
2+#define _NB8800_H_
3+
4+#include <linux/types.h>
5+#include <linux/skbuff.h>
6+#include <linux/phy.h>
7+#include <linux/clk.h>
8+#include <linux/bitops.h>
9+
10+#define RX_DESC_COUNT 256
11+#define TX_DESC_COUNT 256
12+
13+#define NB8800_DESC_LOW 4
14+
15+#define RX_BUF_SIZE 1552
16+
17+#define RX_COPYBREAK 256
18+#define RX_COPYHDR 128
19+
20+#define MAX_MDC_CLOCK 2500000
21+
22+/* Stargate Solutions SSN8800 core registers */
23+#define NB8800_TX_CTL1 0x000
24+#define TX_TPD BIT(5)
25+#define TX_APPEND_FCS BIT(4)
26+#define TX_PAD_EN BIT(3)
27+#define TX_RETRY_EN BIT(2)
28+#define TX_EN BIT(0)
29+
30+#define NB8800_TX_CTL2 0x001
31+
32+#define NB8800_RX_CTL 0x004
33+#define RX_BC_DISABLE BIT(7)
34+#define RX_RUNT BIT(6)
35+#define RX_AF_EN BIT(5)
36+#define RX_PAUSE_EN BIT(3)
37+#define RX_SEND_CRC BIT(2)
38+#define RX_PAD_STRIP BIT(1)
39+#define RX_EN BIT(0)
40+
41+#define NB8800_RANDOM_SEED 0x008
42+#define NB8800_TX_SDP 0x14
43+#define NB8800_TX_TPDP1 0x18
44+#define NB8800_TX_TPDP2 0x19
45+#define NB8800_SLOT_TIME 0x1c
46+
47+#define NB8800_MDIO_CMD 0x020
48+#define MDIO_CMD_GO BIT(31)
49+#define MDIO_CMD_WR BIT(26)
50+#define MDIO_CMD_ADDR(x) ((x) << 21)
51+#define MDIO_CMD_REG(x) ((x) << 16)
52+#define MDIO_CMD_DATA(x) ((x) << 0)
53+
54+#define NB8800_MDIO_STS 0x024
55+#define MDIO_STS_ERR BIT(31)
56+
57+#define NB8800_MC_ADDR(i) (0x028 + (i))
58+#define NB8800_MC_INIT 0x02e
59+#define NB8800_UC_ADDR(i) (0x03c + (i))
60+
61+#define NB8800_MAC_MODE 0x044
62+#define RGMII_MODE BIT(7)
63+#define HALF_DUPLEX BIT(4)
64+#define BURST_EN BIT(3)
65+#define LOOPBACK_EN BIT(2)
66+#define GMAC_MODE BIT(0)
67+
68+#define NB8800_IC_THRESHOLD 0x050
69+#define NB8800_PE_THRESHOLD 0x051
70+#define NB8800_PF_THRESHOLD 0x052
71+#define NB8800_TX_BUFSIZE 0x054
72+#define NB8800_FIFO_CTL 0x056
73+#define NB8800_PQ1 0x060
74+#define NB8800_PQ2 0x061
75+#define NB8800_SRC_ADDR(i) (0x06a + (i))
76+#define NB8800_STAT_DATA 0x078
77+#define NB8800_STAT_INDEX 0x07c
78+#define NB8800_STAT_CLEAR 0x07d
79+
80+#define NB8800_SLEEP_MODE 0x07e
81+#define SLEEP_MODE BIT(0)
82+
83+#define NB8800_WAKEUP 0x07f
84+#define WAKEUP BIT(0)
85+
86+/* Aurora NB8800 host interface registers */
87+#define NB8800_TXC_CR 0x100
88+#define TCR_LK BIT(12)
89+#define TCR_DS BIT(11)
90+#define TCR_BTS(x) (((x) & 0x7) << 8)
91+#define TCR_DIE BIT(7)
92+#define TCR_TFI(x) (((x) & 0x7) << 4)
93+#define TCR_LE BIT(3)
94+#define TCR_RS BIT(2)
95+#define TCR_DM BIT(1)
96+#define TCR_EN BIT(0)
97+
98+#define NB8800_TXC_SR 0x104
99+#define TSR_DE BIT(3)
100+#define TSR_DI BIT(2)
101+#define TSR_TO BIT(1)
102+#define TSR_TI BIT(0)
103+
104+#define NB8800_TX_SAR 0x108
105+#define NB8800_TX_DESC_ADDR 0x10c
106+
107+#define NB8800_TX_REPORT_ADDR 0x110
108+#define TX_BYTES_TRANSFERRED(x) (((x) >> 16) & 0xffff)
109+#define TX_FIRST_DEFERRAL BIT(7)
110+#define TX_EARLY_COLLISIONS(x) (((x) >> 3) & 0xf)
111+#define TX_LATE_COLLISION BIT(2)
112+#define TX_PACKET_DROPPED BIT(1)
113+#define TX_FIFO_UNDERRUN BIT(0)
114+#define IS_TX_ERROR(r) ((r) & 0x07)
115+
116+#define NB8800_TX_FIFO_SR 0x114
117+#define NB8800_TX_ITR 0x118
118+
119+#define NB8800_RXC_CR 0x200
120+#define RCR_FL BIT(13)
121+#define RCR_LK BIT(12)
122+#define RCR_DS BIT(11)
123+#define RCR_BTS(x) (((x) & 7) << 8)
124+#define RCR_DIE BIT(7)
125+#define RCR_RFI(x) (((x) & 7) << 4)
126+#define RCR_LE BIT(3)
127+#define RCR_RS BIT(2)
128+#define RCR_DM BIT(1)
129+#define RCR_EN BIT(0)
130+
131+#define NB8800_RXC_SR 0x204
132+#define RSR_DE BIT(3)
133+#define RSR_DI BIT(2)
134+#define RSR_RO BIT(1)
135+#define RSR_RI BIT(0)
136+
137+#define NB8800_RX_SAR 0x208
138+#define NB8800_RX_DESC_ADDR 0x20c
139+
140+#define NB8800_RX_REPORT_ADDR 0x210
141+#define RX_BYTES_TRANSFERRED(x) (((x) >> 16) & 0xFFFF)
142+#define RX_MULTICAST_PKT BIT(9)
143+#define RX_BROADCAST_PKT BIT(8)
144+#define RX_LENGTH_ERR BIT(7)
145+#define RX_FCS_ERR BIT(6)
146+#define RX_RUNT_PKT BIT(5)
147+#define RX_FIFO_OVERRUN BIT(4)
148+#define RX_LATE_COLLISION BIT(3)
149+#define RX_ALIGNMENT_ERROR BIT(2)
150+#define RX_ERROR_MASK 0xfc
151+#define IS_RX_ERROR(r) ((r) & RX_ERROR_MASK)
152+
153+#define NB8800_RX_FIFO_SR 0x214
154+#define NB8800_RX_ITR 0x218
155+
156+/* Sigma Designs SMP86xx additional registers */
157+#define NB8800_TANGOX_PAD_MODE 0x400
158+#define PAD_MODE_MASK 0x7
159+#define PAD_MODE_MII 0x0
160+#define PAD_MODE_RGMII 0x1
161+#define PAD_MODE_GTX_CLK_INV BIT(3)
162+#define PAD_MODE_GTX_CLK_DELAY BIT(4)
163+
164+#define NB8800_TANGOX_MDIO_CLKDIV 0x420
165+#define NB8800_TANGOX_RESET 0x424
166+
167+/* Hardware DMA descriptor */
168+struct nb8800_dma_desc {
169+ u32 s_addr; /* start address */
170+ u32 n_addr; /* next descriptor address */
171+ u32 r_addr; /* report address */
172+ u32 config;
173+} __aligned(8);
174+
175+#define DESC_ID BIT(23)
176+#define DESC_EOC BIT(22)
177+#define DESC_EOF BIT(21)

139 more lines aren’t shown here.

drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c+2−2

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

drivers/net/ethernet/broadcom/bnxt/bnxt.c+31−13

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

drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c+3−4

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

drivers/net/ethernet/cadence/macb.c+4−0

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

drivers/net/ethernet/cadence/macb.h+5−0

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

drivers/net/ethernet/cavium/thunder/nic.h+2−3

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

drivers/net/ethernet/cavium/thunder/nic_main.c+20−3

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

drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c+15−1

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

drivers/net/ethernet/cavium/thunder/nicvf_main.c+1−3

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

drivers/net/ethernet/cavium/thunder/nicvf_queues.c+1−1

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

drivers/net/ethernet/cavium/thunder/nicvf_queues.h+1−1

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

drivers/net/ethernet/cavium/thunder/thunder_bgx.c+24−4

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

drivers/net/ethernet/cavium/thunder/thunder_bgx.h+2−0

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

drivers/net/ethernet/dec/tulip/tulip_core.c+7−2

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

drivers/net/ethernet/dec/tulip/winbond-840.c+1−1

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

drivers/net/ethernet/freescale/Kconfig+2−1

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

drivers/net/ethernet/freescale/gianfar.c+3−3

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

drivers/net/ethernet/freescale/gianfar_ptp.c+1−1

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

drivers/net/ethernet/intel/fm10k/fm10k_netdev.c+3−1

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

drivers/net/ethernet/marvell/mvneta.c+27−6

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

drivers/net/ethernet/nxp/lpc_eth.c+1−1

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

drivers/net/ethernet/renesas/ravb_main.c+4−2

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

drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c+7−6

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

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+8−1

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

drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c+13−15

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

drivers/net/ethernet/ti/cpsw-common.c+3−0

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

drivers/net/macvtap.c+2−2

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

drivers/net/phy/broadcom.c+1−1

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

drivers/net/phy/phy.c+2−1

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

drivers/net/tun.c+2−2

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

drivers/net/usb/cdc_ncm.c+4−4

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

drivers/net/usb/qmi_wwan.c+1−0

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

drivers/net/vmxnet3/vmxnet3_drv.c+60−11

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

drivers/net/vrf.c+1−10

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

drivers/net/wan/hdlc_fr.c+5−5

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

drivers/net/wan/x25_asy.c+1−5

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

drivers/net/wireless/ath/ath10k/core.c+47−2

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

drivers/net/wireless/ath/ath10k/core.h+1−0

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

drivers/net/wireless/ath/ath10k/hw.h+15−2

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

drivers/net/wireless/ath/ath10k/mac.c+1−1

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

drivers/net/wireless/ath/ath10k/pci.c+43−10

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

drivers/net/wireless/iwlwifi/iwl-7000.c+1−1

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

drivers/net/wireless/iwlwifi/iwl-8000.c+1−1

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

drivers/net/wireless/iwlwifi/mvm/d3.c+2−6

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

drivers/net/wireless/iwlwifi/mvm/mac80211.c+8−3

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

drivers/net/wireless/iwlwifi/mvm/sta.c+47−41

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

drivers/net/wireless/iwlwifi/mvm/sta.h+2−2

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

drivers/net/wireless/iwlwifi/pcie/drv.c+18−1

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

drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c+1−1

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

drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c+1−1

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

drivers/nvme/host/Makefile+2−1

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

drivers/nvme/host/lightnvm.c+118−47

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

drivers/nvme/host/nvme.h+14−0

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

drivers/nvme/host/pci.c+37−14

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

drivers/pci/host/pcie-designware.c+0−1

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

drivers/pci/host/pcie-hisi.c+2−2

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

drivers/pci/pci-driver.c+14−2

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

drivers/pci/pci-sysfs.c+4−1

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

drivers/pci/pci.h+0−2

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

drivers/pci/probe.c+2−2

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

drivers/pinctrl/Kconfig+0−4

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

drivers/pinctrl/freescale/pinctrl-imx1-core.c+6−2

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

drivers/pinctrl/mediatek/pinctrl-mtk-common.c+4−7

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

drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c+1−1

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

drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c+1−1

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

drivers/pinctrl/sh-pfc/pfc-sh7734.c+3−3

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

drivers/remoteproc/remoteproc_core.c+2−0

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

drivers/remoteproc/remoteproc_debugfs.c+1−1

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

drivers/rtc/rtc-ds1307.c+8−36

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

drivers/s390/cio/chsc.c+17−20

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

drivers/s390/cio/chsc.h+15−0

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

drivers/s390/cio/cio.c+14−0

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

drivers/s390/cio/css.c+0−5

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

drivers/s390/crypto/Makefile+5−2

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

drivers/s390/crypto/ap_bus.c+6−0

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

drivers/s390/crypto/zcrypt_api.c+4−6

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

drivers/s390/crypto/zcrypt_api.h+1−0

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

drivers/s390/crypto/zcrypt_msgtype50.c+1−0

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

drivers/s390/crypto/zcrypt_msgtype6.c+3−0

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

drivers/scsi/Kconfig+3−0

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

drivers/scsi/advansys.c+1−1

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

drivers/scsi/hosts.c+11−0

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

drivers/scsi/hpsa.c+1−1

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

drivers/scsi/mpt3sas/Kconfig+9−0

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

drivers/scsi/mpt3sas/mpt3sas_scsih.c+1−2

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

drivers/scsi/mvsas/mv_init.c+2−2

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

drivers/scsi/qla2xxx/qla_nx.c+2−1

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

drivers/scsi/qla2xxx/tcm_qla2xxx.c+1−1

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

drivers/scsi/scsi_debug.c+5−4

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

drivers/scsi/scsi_pm.c+10−10

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

drivers/scsi/scsi_scan.c+6−3

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

drivers/scsi/scsi_sysfs.c+11−11

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

drivers/scsi/scsi_transport_sas.c+30−0

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

drivers/scsi/sd.c+48−21

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

drivers/scsi/sd.h+1−0

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

drivers/scsi/ses.c+32−26

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

drivers/scsi/st.c+3−2

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

drivers/sh/pm_runtime.c+1−1

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

drivers/soc/mediatek/Kconfig+1−0

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

drivers/soc/ti/knav_qmss_queue.c+4−4

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

drivers/spi/spi-bcm63xx.c+2−2

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

drivers/spi/spi-mt65xx.c+18−8

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

drivers/spi/spi-pl022.c+22−6

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

drivers/spi/spi.c+2−0

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

drivers/staging/iio/Kconfig+2−1

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

drivers/staging/iio/adc/lpc32xx_adc.c+2−2

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

drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h+0−1

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

drivers/staging/lustre/lustre/libcfs/module.c+0−17

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

drivers/staging/wilc1000/coreconfigurator.c+25−23

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

drivers/target/iscsi/iscsi_target.c+12−1

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

drivers/target/iscsi/iscsi_target_nego.c+1−0

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

drivers/target/iscsi/iscsi_target_parameters.c+5−5

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

drivers/target/target_core_sbc.c+11−6

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

drivers/target/target_core_stat.c+1−1

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

drivers/target/target_core_tmr.c+6−1

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

drivers/target/target_core_transport.c+14−12

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

drivers/target/target_core_user.c+1−3

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

drivers/thermal/Kconfig+1−1

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

drivers/thermal/imx_thermal.c+41−15

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

drivers/thermal/of-thermal.c+1−1

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

drivers/thermal/power_allocator.c+7−17

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

drivers/thermal/rcar_thermal.c+21−28

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

drivers/thermal/rockchip_thermal.c+240−88

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

drivers/tty/n_tty.c+1−1

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

drivers/tty/serial/8250/8250_fsl.c+1−0

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

drivers/tty/serial/8250/Kconfig+1−0

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

drivers/tty/serial/Kconfig+1−1

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

drivers/tty/serial/bcm63xx_uart.c+1−1

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

drivers/tty/serial/etraxfs-uart.c+1−1

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

drivers/tty/tty_audit.c+1−1

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

drivers/tty/tty_io.c+4−0

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

drivers/tty/tty_ioctl.c+0−4

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

drivers/tty/tty_ldisc.c+1−1

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

drivers/usb/chipidea/ci_hdrc_imx.c+121−21

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

drivers/usb/chipidea/debug.c+2−0

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

drivers/usb/chipidea/udc.c+17−0

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

drivers/usb/chipidea/usbmisc_imx.c+6−4

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

drivers/usb/class/usblp.c+1−1

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

drivers/usb/core/Kconfig+1−2

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

drivers/usb/dwc2/hcd.c+5−4

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

drivers/usb/dwc2/platform.c+2−1

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

drivers/usb/dwc3/dwc3-pci.c+4−0

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

drivers/usb/dwc3/gadget.c+23−1

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

drivers/usb/gadget/function/f_loopback.c+1−1

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

drivers/usb/gadget/udc/atmel_usba_udc.c+1−1

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

drivers/usb/host/xhci-hub.c+9−6

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

drivers/usb/host/xhci-ring.c+6−26

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

drivers/usb/host/xhci.c+10−0

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

drivers/usb/musb/musb_core.c+6−6

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

drivers/usb/musb/musb_host.c+16−6

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

drivers/usb/phy/Kconfig+1−3

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

drivers/usb/phy/phy-mxs-usb.c+5−2

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

drivers/usb/phy/phy-omap-otg.c+1−1

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

drivers/usb/serial/option.c+11−0

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

drivers/usb/serial/qcserial.c+74−20

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

drivers/usb/serial/ti_usb_3410_5052.c+2−0

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

drivers/usb/serial/ti_usb_3410_5052.h+4−0

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

drivers/watchdog/Kconfig+1−1

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

drivers/watchdog/mtk_wdt.c+1−0

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

drivers/watchdog/omap_wdt.c+1−1

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

drivers/watchdog/pnx4008_wdt.c+4−4

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

drivers/watchdog/tegra_wdt.c+3−1

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

drivers/watchdog/w83977f_wdt.c+1−1

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

drivers/xen/events/events_base.c+3−2

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

drivers/xen/evtchn.c+107−16

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

drivers/xen/gntdev.c+1−1

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

fs/Kconfig+6−0

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

fs/block_dev.c+16−2

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

fs/btrfs/backref.c+1−1

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

fs/btrfs/ctree.h+4−0

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

fs/btrfs/extent-tree.c+100−23

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

fs/btrfs/file.c+7−3

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

fs/btrfs/inode.c+1−23

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

fs/btrfs/qgroup.c+4−1

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

fs/btrfs/scrub.c+56−6

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

fs/btrfs/tests/free-space-tests.c+3−1

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

fs/btrfs/transaction.c+32−0

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

fs/btrfs/transaction.h+4−0

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

fs/btrfs/volumes.c+6−7

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

fs/btrfs/volumes.h+1−1

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

fs/configfs/dir.c+110−0

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

fs/dax.c+4−0

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

fs/direct-io.c+9−1

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

fs/dlm/lowcomms.c+2−2

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

fs/ext2/super.c+2−0

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

fs/ext4/super.c+5−1

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

fs/fat/dir.c+11−5

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

fs/hugetlbfs/inode.c+32−33

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

fs/namei.c+0−1

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

fs/ncpfs/ioctl.c+2−0

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

fs/nfs/callback_xdr.c+5−2

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

fs/nfs/inode.c+9−2

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

fs/nfs/nfs42proc.c+2−1

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

fs/nfs/nfs4client.c+1−1

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

fs/nfs/nfs4file.c+27−32

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

fs/nfs/nfs4proc.c+1−1

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

fs/nfs/nfs4xdr.c+1−0

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

fs/nfs/pnfs.c+31−25

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

fs/ocfs2/namei.c+2−0

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

fs/overlayfs/copy_up.c+6−17

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

fs/overlayfs/inode.c+8−11

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

fs/overlayfs/overlayfs.h+1−2

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

fs/splice.c+8−0

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

fs/sysv/inode.c+2−9

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

include/drm/drmP.h+10−0

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

include/drm/drm_atomic.h+3−0

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

include/kvm/arm_vgic.h+1−1

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

include/linux/acpi.h+2−2

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

include/linux/blkdev.h+3−2

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

include/linux/bpf.h+4−1

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

include/linux/configfs.h+10−0

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

include/linux/cpufreq.h+1−0

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

include/linux/dns_resolver.h+1−1

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

include/linux/enclosure.h+4−0

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

include/linux/gfp.h+1−1

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

include/linux/ipv6.h+1−1

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

include/linux/kref.h+0−33

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

include/linux/kvm_host.h+11−0

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

include/linux/lightnvm.h+44−132

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

include/linux/net.h+9−4

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

include/linux/netdevice.h+2−1

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

include/linux/nfs_xdr.h+1−0

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

include/linux/of_dma.h+1−1

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

include/linux/pci.h+9−0

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

include/linux/scpi_protocol.h+1−1

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

include/linux/signal.h+0−1

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

include/linux/slab.h+27−18

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

include/linux/syscalls.h+1−1

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

include/linux/thermal.h+2−1

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

include/linux/tty.h+3−3

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

include/linux/types.h+1−1

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

include/net/af_unix.h+1−0

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

include/net/ip6_route.h+4−13

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

include/net/ipv6.h+21−1

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

include/net/mac80211.h+4−2

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

include/net/ndisc.h+1−2

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

include/net/sch_generic.h+3−0

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

include/net/sctp/structs.h+8−8

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

include/net/sock.h+25−7

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

include/scsi/scsi_host.h+3−0

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

include/scsi/scsi_transport_sas.h+10−0

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

include/sound/soc-dapm.h+1−0

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

include/target/target_core_base.h+1−1

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

include/uapi/linux/nfs.h+0−11

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

include/video/imx-ipu-v3.h+0−1

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

kernel/bpf/arraymap.c+8−2

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

kernel/bpf/hashtab.c+25−9

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

kernel/bpf/inode.c+3−3

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

kernel/bpf/syscall.c+27−13

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

kernel/bpf/verifier.c+1−2

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

kernel/livepatch/core.c+6−0

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

kernel/panic.c+4−1

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

kernel/pid.c+2−2

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

kernel/sched/core.c+30−6

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

kernel/sched/cputime.c+3−0

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

kernel/sched/rt.c+1−1

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

kernel/sched/sched.h+3−0

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

kernel/sched/wait.c+8−8

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

kernel/signal.c+1−1

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

kernel/trace/ring_buffer.c+9−8

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

kernel/trace/trace_events.c+16−0

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

mm/huge_memory.c+2−2

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

mm/kasan/kasan.c+2−0

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

mm/memory.c+4−4

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

mm/page-writeback.c+3−1

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

mm/slab.c+1−1

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

mm/slab.h+1−1

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

mm/slab_common.c+3−3

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

mm/slob.c+1−1

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

mm/slub.c+211−93

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

mm/vmalloc.c+2−3

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

net/bluetooth/af_bluetooth.c+3−3

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

net/bluetooth/smp.c+6−1

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

net/caif/caif_socket.c+2−2

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

net/core/datagram.c+1−1

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

net/core/neighbour.c+2−2

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

net/core/netclassid_cgroup.c+18−8

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

net/core/scm.c+2−0

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

net/core/sock.c+5−7

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

net/core/stream.c+3−3

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

net/dccp/ipv6.c+23−14

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

net/dccp/proto.c+1−2

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

net/decnet/af_decnet.c+4−4

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

net/dns_resolver/dns_query.c+1−1

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

net/hsr/hsr_device.c+1−1

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

net/ipv4/igmp.c+3−2

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

net/ipv4/ipmr.c+8−15

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

net/ipv4/tcp.c+3−4

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

net/ipv4/tcp_input.c+20−3

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

net/ipv4/tcp_ipv4.c+2−1

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

net/ipv4/tcp_timer.c+13−1

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

net/ipv4/udp.c+0−1

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

net/ipv6/addrconf.c+1−1

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

net/ipv6/af_inet6.c+10−5

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

net/ipv6/datagram.c+3−1

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

net/ipv6/exthdrs.c+2−1

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

net/ipv6/icmp.c+0−14

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

net/ipv6/inet6_connection_sock.c+9−12

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

net/ipv6/ip6_tunnel.c+1−1

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

net/ipv6/ip6mr.c+8−11

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

net/ipv6/ipv6_sockglue.c+22−11

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

net/ipv6/ndisc.c+3−7

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

net/ipv6/netfilter/nf_conntrack_reasm.c+3−2

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

net/ipv6/raw.c+6−2

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

net/ipv6/reassembly.c+7−3

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

net/ipv6/route.c+1−1

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

net/ipv6/syncookies.c+1−1

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

net/ipv6/tcp_ipv6.c+19−13

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

net/ipv6/udp.c+6−2

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

net/iucv/af_iucv.c+1−1

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

net/l2tp/l2tp_ip6.c+6−2

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

net/mac80211/agg-tx.c+2−1

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

net/mac80211/cfg.c+6−2

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

net/mac80211/iface.c+3−2

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

net/mac80211/main.c+1−2

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

net/mac80211/mesh_pathtbl.c+4−4

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

net/mac80211/scan.c+5−4

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

net/nfc/llcp_sock.c+1−1

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

net/openvswitch/dp_notify.c+1−1

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

net/openvswitch/vport-geneve.c+0−1

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

net/openvswitch/vport-gre.c+0−1

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

net/openvswitch/vport-netdev.c+6−2

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

net/openvswitch/vport.c+4−4

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

net/openvswitch/vport.h+7−1

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

net/packet/af_packet.c+2−2

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

net/rds/connection.c+0−6

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

net/rds/send.c+3−1

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

net/rxrpc/ar-ack.c+3−1

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

net/rxrpc/ar-output.c+1−1

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

net/sched/sch_api.c+18−9

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

net/sched/sch_generic.c+1−1

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

net/sched/sch_mq.c+2−2

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

net/sched/sch_mqprio.c+2−2

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

net/sctp/ipv6.c+10−3

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

net/sctp/socket.c+25−14

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

net/socket.c+7−14

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

net/sunrpc/backchannel_rqst.c+8−0

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

net/sunrpc/svc.c+1−0

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

net/sunrpc/xprtsock.c+7−7

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

net/tipc/link.c+2−0

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

net/tipc/socket.c+7−3

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

net/tipc/udp_media.c+5−2

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

net/unix/af_unix.c+231−37

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

scripts/kernel-doc+1−1

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

security/keys/encrypted-keys/encrypted.c+2−0

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

security/keys/trusted.c+4−1

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

security/keys/user_defined.c+4−1

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

security/selinux/ss/conditional.c+2−2

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

sound/firewire/dice/dice.c+4−0

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

sound/pci/hda/hda_intel.c+7−0

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

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

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

sound/pci/hda/patch_hdmi.c+8−1

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

sound/pci/hda/patch_realtek.c+23−0

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

sound/pci/hda/patch_sigmatel.c+29−16

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

sound/soc/codecs/arizona.c+5−11

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

sound/soc/codecs/es8328.c+8−8

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

sound/soc/codecs/nau8825.c+31−0

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

sound/soc/codecs/rl6231.c+4−2

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

sound/soc/codecs/rt5645.c+57−4

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

sound/soc/codecs/rt5670.h+6−6

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

sound/soc/codecs/rt5677.c+61−39

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

sound/soc/codecs/wm8960.c+1−1

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

sound/soc/codecs/wm8962.c+2−2

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

sound/soc/davinci/davinci-mcasp.c+10−2

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

sound/soc/fsl/Kconfig+2−0

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

sound/soc/fsl/fsl_sai.c+2−1

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

sound/soc/intel/Kconfig+1−1

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

sound/soc/intel/skylake/skl-topology.c+1−0

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

sound/soc/rockchip/rockchip_spdif.c+1−1

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

sound/soc/rockchip/rockchip_spdif.h+3−3

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

sound/soc/sh/rcar/gen.c+1−1

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

sound/soc/sh/rcar/src.c+7−0

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

sound/soc/soc-core.c+3−3

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

sound/soc/soc-dapm.c+7−0

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

sound/soc/soc-ops.c+1−1

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

sound/soc/soc-topology.c+2−1

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

sound/soc/sti/uniperif_player.c+6−3

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

sound/soc/sti/uniperif_reader.c+1−2

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

sound/soc/sunxi/sun4i-codec.c+14−13

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

sound/usb/midi.c+46−0

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

sound/usb/quirks-table.h+11−0

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

sound/usb/quirks.c+1−0

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

sound/usb/usbaudio.h+1−0

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

tools/Makefile+10−1

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

tools/perf/builtin-inject.c+1−0

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

tools/perf/builtin-report.c+3−3

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

tools/perf/ui/browsers/hists.c+1−6

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

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

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

tools/perf/util/dso.c+17−0

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

tools/perf/util/dso.h+1−0

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

tools/perf/util/machine.c+1−0

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

tools/perf/util/probe-finder.c+17−7

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

tools/perf/util/symbol.c+16−18

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

tools/perf/util/symbol.h+1−0

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

tools/power/x86/turbostat/turbostat.c+4−4

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

tools/testing/nvdimm/test/nfit.c+15−34

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

tools/testing/selftests/futex/README+1−1

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

tools/testing/selftests/seccomp/seccomp_bpf.c+7−4

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

tools/vm/page-types.c+1−0

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

virt/kvm/arm/arch_timer.c+17−11

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

virt/kvm/arm/vgic.c+24−26

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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

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

Repository code

Go to file
t