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
587 587
588 modprobe ipmi_watchdog timeout=<t> pretimeout=<t> action=<action type>588 modprobe ipmi_watchdog timeout=<t> pretimeout=<t> action=<action type>
589 preaction=<preaction type> preop=<preop type> start_now=x589 preaction=<preaction type> preop=<preop type> start_now=x
590 nowayout=x ifnum_to_use=n590 nowayout=x ifnum_to_use=n panic_wdt_timeout=<t>
591 591
592ifnum_to_use specifies which interface the watchdog timer should use.592ifnum_to_use specifies which interface the watchdog timer should use.
593The default is -1, which means to pick the first one registered.593The 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
597occur (if pretimeout is zero, then pretimeout will not be enabled). Note597occur (if pretimeout is zero, then pretimeout will not be enabled). Note
598that the pretimeout is the time before the final timeout. So if the598that the pretimeout is the time before the final timeout. So if the
599timeout is 50 seconds and the pretimeout is 10 seconds, then the pretimeout599timeout is 50 seconds and the pretimeout is 10 seconds, then the pretimeout
600will occur in 40 second (10 seconds before the timeout).600will occur in 40 second (10 seconds before the timeout). The panic_wdt_timeout
601is the value of timeout which is set on kernel panic, in order to let actions
602such as kdump to occur during panic.
601 603
602The action may be "reset", "power_cycle", or "power_off", and604The action may be "reset", "power_cycle", or "power_off", and
603specifies what to do when the timer times out, and defaults to605specifies what to do when the timer times out, and defaults to
@@ -634,6 +636,7 @@ for configuring the watchdog: · 30 unmodified lines
634 ipmi_watchdog.preop=<preop type>636 ipmi_watchdog.preop=<preop type>
635 ipmi_watchdog.start_now=x637 ipmi_watchdog.start_now=x
636 ipmi_watchdog.nowayout=x638 ipmi_watchdog.nowayout=x
639 ipmi_watchdog.panic_wdt_timeout=<t>
637 640
638The options are the same as the module parameter options.641The options are the same as the module parameter options.
639 642
Documentation/arm/keystone/Overview.txt+0−18
@@ -49,24 +49,6 @@ specified through DTS. Following are the DTS used:- · 48 unmodified lines
49The device tree documentation for the keystone machines are located at49The device tree documentation for the keystone machines are located at
50 Documentation/devicetree/bindings/arm/keystone/keystone.txt50 Documentation/devicetree/bindings/arm/keystone/keystone.txt
51 51
52Known issues & workaround
53-------------------------
54
55Some of the device drivers used on keystone are re-used from that from
56DaVinci and other TI SoCs. These device drivers may use clock APIs directly.
57Some of the keystone specific drivers such as netcp uses run time power
58management API instead to enable clock. As this API has limitations on
59keystone, 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
70Document Author52Document Author
71---------------53---------------
72Murali Karicheri <m-karicheri2@ti.com>54Murali 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
70 parameter.70 parameter.
71 1: The multi-queue block layer is instantiated with a hardware dispatch71 1: The multi-queue block layer is instantiated with a hardware dispatch
72 queue for each CPU node in the system.72 queue for each CPU node in the system.
73
74use_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
8- phy-mode: See ethernet.txt file in the same directory8- phy-mode: See ethernet.txt file in the same directory
9- clocks: a pointer to the reference clock for this device.9- clocks: a pointer to the reference clock for this device.
10 10
11Optional 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
11Example:16Example:
12 17
13ethernet@d0070000 {18ethernet@d0070000 {
@@ -15,6 +20,7 @@ ethernet@d0070000 { · 1 unmodified line
15 reg = <0xd0070000 0x2500>;20 reg = <0xd0070000 0x2500>;
16 interrupts = <8>;21 interrupts = <8>;
17 clocks = <&gate_clk 4>;22 clocks = <&gate_clk 4>;
23 tx-csum-limit = <9800>
18 status = "okay";24 status = "okay";
19 phy = <&phy0>;25 phy = <&phy0>;
20 phy-mode = "rgmii-id";26 phy-mode = "rgmii-id";
Documentation/devicetree/bindings/thermal/rockchip-thermal.txt+3−1
@@ -1,7 +1,9 @@
1* Temperature Sensor ADC (TSADC) on rockchip SoCs1* Temperature Sensor ADC (TSADC) on rockchip SoCs
2 2
3Required properties:3Required 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
5- reg : physical base address of the controller and length of memory mapped7- reg : physical base address of the controller and length of memory mapped
6 region.8 region.
7- interrupts : The interrupt number to the cpu. The interrupt specifier format9- 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
32 * Intel Sunrise Point-LP (PCH)32 * Intel Sunrise Point-LP (PCH)
33 * Intel DNV (SOC)33 * Intel DNV (SOC)
34 * Intel Broxton (SOC)34 * Intel Broxton (SOC)
35 * Intel Lewisburg (PCH)
35 Datasheets: Publicly available at the Intel website36 Datasheets: Publicly available at the Intel website
36 37
37On Intel Patsburg and later chipsets, both the normal host SMBus controller38On 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
1583 hwp_only1583 hwp_only
1584 Only load intel_pstate on systems which support1584 Only load intel_pstate on systems which support
1585 hardware P state control (HWP) if available.1585 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.
1589 1586
1590 intremap= [X86-64, Intel-IOMMU]1587 intremap= [X86-64, Intel-IOMMU]
1591 on enable Interrupt Remapping (default)1588 on enable Interrupt Remapping (default)
MAINTAINERS+27−10
@@ -318,7 +318,7 @@ M: Zhang Rui <rui.zhang@intel.com> · 317 unmodified lines
318L: linux-acpi@vger.kernel.org318L: linux-acpi@vger.kernel.org
319W: https://01.org/linux-acpi319W: https://01.org/linux-acpi
320S: Supported320S: Supported
321F: drivers/acpi/video.c321F: drivers/acpi/acpi_video.c
322 322
323ACPI WMI DRIVER323ACPI WMI DRIVER
324L: platform-driver-x86@vger.kernel.org324L: platform-driver-x86@vger.kernel.org
@@ -1847,7 +1847,7 @@ S: Supported · 1522 unmodified lines
1847F: drivers/net/wireless/ath/ath6kl/1847F: drivers/net/wireless/ath/ath6kl/
1848 1848
1849WILOCITY WIL6210 WIRELESS DRIVER1849WILOCITY WIL6210 WIRELESS DRIVER
1850M: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>1850M: Maya Erez <qca_merez@qca.qualcomm.com>
1851L: linux-wireless@vger.kernel.org1851L: linux-wireless@vger.kernel.org
1852L: wil6210@qca.qualcomm.com1852L: wil6210@qca.qualcomm.com
1853S: Supported1853S: Supported
@@ -1931,7 +1931,7 @@ S: Supported · 77 unmodified lines
1931F: drivers/i2c/busses/i2c-at91.c1931F: drivers/i2c/busses/i2c-at91.c
1932 1932
1933ATMEL ISI DRIVER1933ATMEL ISI DRIVER
1934M: Josh Wu <josh.wu@atmel.com>1934M: Ludovic Desroches <ludovic.desroches@atmel.com>
1935L: linux-media@vger.kernel.org1935L: linux-media@vger.kernel.org
1936S: Supported1936S: Supported
1937F: drivers/media/platform/soc_camera/atmel-isi.c1937F: drivers/media/platform/soc_camera/atmel-isi.c
@@ -1950,7 +1950,8 @@ S: Supported · 12 unmodified lines
1950F: drivers/net/ethernet/cadence/1950F: drivers/net/ethernet/cadence/
1951 1951
1952ATMEL NAND DRIVER1952ATMEL NAND DRIVER
1953M: Josh Wu <josh.wu@atmel.com>1953M: Wenyou Yang <wenyou.yang@atmel.com>
1954M: Josh Wu <rainyfeeling@outlook.com>
1954L: linux-mtd@lists.infradead.org1955L: linux-mtd@lists.infradead.org
1955S: Supported1956S: Supported
1956F: drivers/mtd/nand/atmel_nand*1957F: drivers/mtd/nand/atmel_nand*
@@ -2449,7 +2450,9 @@ F: drivers/firmware/broadcom/* · 492 unmodified lines
2449 2450
2450BROADCOM STB NAND FLASH DRIVER2451BROADCOM STB NAND FLASH DRIVER
2451M: Brian Norris <computersforpeace@gmail.com>2452M: Brian Norris <computersforpeace@gmail.com>
2453M: Kamal Dasu <kdasu.kdev@gmail.com>
2452L: linux-mtd@lists.infradead.org2454L: linux-mtd@lists.infradead.org
2455L: bcm-kernel-feedback-list@broadcom.com
2453S: Maintained2456S: Maintained
2454F: drivers/mtd/nand/brcmnand/2457F: drivers/mtd/nand/brcmnand/
2455 2458
@@ -2929,10 +2932,9 @@ S: Maintained · 473 unmodified lines
2929F: drivers/platform/x86/compal-laptop.c2932F: drivers/platform/x86/compal-laptop.c
2930 2933
2931CONEXANT ACCESSRUNNER USB DRIVER2934CONEXANT ACCESSRUNNER USB DRIVER
2932M: Simon Arlott <cxacru@fire.lp0.eu>
2933L: accessrunner-general@lists.sourceforge.net2935L: accessrunner-general@lists.sourceforge.net
2934W: http://accessrunner.sourceforge.net/2936W: http://accessrunner.sourceforge.net/
2935S: Maintained2937S: Orphan
2936F: drivers/usb/atm/cxacru.c2938F: drivers/usb/atm/cxacru.c
2937 2939
2938CONFIGFS2940CONFIGFS
@@ -4409,6 +4411,7 @@ K: fmc_d.*register · 1470 unmodified lines
4409 4411
4410FPGA MANAGER FRAMEWORK4412FPGA MANAGER FRAMEWORK
4411M: Alan Tull <atull@opensource.altera.com>4413M: Alan Tull <atull@opensource.altera.com>
4414R: Moritz Fischer <moritz.fischer@ettus.com>
4412S: Maintained4415S: Maintained
4413F: drivers/fpga/4416F: drivers/fpga/
4414F: include/linux/fpga/fpga-mgr.h4417F: include/linux/fpga/fpga-mgr.h
@@ -6371,6 +6374,7 @@ F: arch/*/include/asm/pmem.h · 1956 unmodified lines
6371LIGHTNVM PLATFORM SUPPORT6374LIGHTNVM PLATFORM SUPPORT
6372M: Matias Bjorling <mb@lightnvm.io>6375M: Matias Bjorling <mb@lightnvm.io>
6373W: http://github/OpenChannelSSD6376W: http://github/OpenChannelSSD
6377L: linux-block@vger.kernel.org
6374S: Maintained6378S: Maintained
6375F: drivers/lightnvm/6379F: drivers/lightnvm/
6376F: include/linux/lightnvm.h6380F: include/linux/lightnvm.h
@@ -7909,6 +7913,18 @@ S: Maintained · 1532 unmodified lines
7909F: net/openvswitch/7913F: net/openvswitch/
7910F: include/uapi/linux/openvswitch.h7914F: include/uapi/linux/openvswitch.h
7911 7915
7916OPERATING PERFORMANCE POINTS (OPP)
7917M: Viresh Kumar <vireshk@kernel.org>
7918M: Nishanth Menon <nm@ti.com>
7919M: Stephen Boyd <sboyd@codeaurora.org>
7920L: linux-pm@vger.kernel.org
7921S: Maintained
7922T: git git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm.git
7923F: drivers/base/power/opp/
7924F: include/linux/pm_opp.h
7925F: Documentation/power/opp.txt
7926F: Documentation/devicetree/bindings/opp/
7927
7912OPL4 DRIVER7928OPL4 DRIVER
7913M: Clemens Ladisch <clemens@ladisch.de>7929M: Clemens Ladisch <clemens@ladisch.de>
7914L: alsa-devel@alsa-project.org (moderated for non-subscribers)7930L: alsa-devel@alsa-project.org (moderated for non-subscribers)
@@ -9322,7 +9338,6 @@ F: drivers/i2c/busses/i2c-designware-* · 1407 unmodified lines
9322F: include/linux/platform_data/i2c-designware.h9338F: include/linux/platform_data/i2c-designware.h
9323 9339
9324SYNOPSYS DESIGNWARE MMC/SD/SDIO DRIVER9340SYNOPSYS DESIGNWARE MMC/SD/SDIO DRIVER
9325M: Seungwon Jeon <tgih.jun@samsung.com>
9326M: Jaehoon Chung <jh80.chung@samsung.com>9341M: Jaehoon Chung <jh80.chung@samsung.com>
9327L: linux-mmc@vger.kernel.org9342L: linux-mmc@vger.kernel.org
9328S: Maintained9343S: Maintained
@@ -9419,8 +9434,10 @@ F: include/scsi/sg.h · 90 unmodified lines
9419 9434
9420SCSI SUBSYSTEM9435SCSI SUBSYSTEM
9421M: "James E.J. Bottomley" <JBottomley@odin.com>9436M: "James E.J. Bottomley" <JBottomley@odin.com>
9422L: linux-scsi@vger.kernel.org
9423T: git git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git9437T: git git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git
9438M: "Martin K. Petersen" <martin.petersen@oracle.com>
9439T: git git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git
9440L: linux-scsi@vger.kernel.org
9424S: Maintained9441S: Maintained
9425F: drivers/scsi/9442F: drivers/scsi/
9426F: include/scsi/9443F: include/scsi/
@@ -10895,9 +10912,9 @@ S: Maintained · 1468 unmodified lines
10895F: drivers/media/tuners/tua9001*10912F: drivers/media/tuners/tua9001*
10896 10913
10897TULIP NETWORK DRIVERS10914TULIP NETWORK DRIVERS
10898M: Grant Grundler <grundler@parisc-linux.org>
10899L: netdev@vger.kernel.org10915L: netdev@vger.kernel.org
10900S: Maintained10916L: linux-parisc@vger.kernel.org
10917S: Orphan
10901F: drivers/net/ethernet/dec/tulip/10918F: drivers/net/ethernet/dec/tulip/
10902 10919
10903TUN/TAP driver10920TUN/TAP driver
Makefile+1−1
@@ -1,7 +1,7 @@
1VERSION = 41VERSION = 4
2PATCHLEVEL = 42PATCHLEVEL = 4
3SUBLEVEL = 03SUBLEVEL = 0
4EXTRAVERSION = -rc14EXTRAVERSION = -rc4
5NAME = Blurry Fish Butt5NAME = Blurry Fish Butt
6 6
7# *DOCUMENTATION*7# *DOCUMENTATION*
arch/arc/configs/axs101_defconfig+1−1
@@ -1,4 +1,4 @@
1CONFIG_CROSS_COMPILE="arc-linux-uclibc-"1CONFIG_CROSS_COMPILE="arc-linux-"
2CONFIG_DEFAULT_HOSTNAME="ARCLinux"2CONFIG_DEFAULT_HOSTNAME="ARCLinux"
3# CONFIG_SWAP is not set3# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y4CONFIG_SYSVIPC=y
arch/arc/configs/axs103_defconfig+1−1
@@ -1,4 +1,4 @@
1CONFIG_CROSS_COMPILE="arc-linux-uclibc-"1CONFIG_CROSS_COMPILE="arc-linux-"
2CONFIG_DEFAULT_HOSTNAME="ARCLinux"2CONFIG_DEFAULT_HOSTNAME="ARCLinux"
3# CONFIG_SWAP is not set3# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y4CONFIG_SYSVIPC=y
arch/arc/configs/axs103_smp_defconfig+1−1
@@ -1,4 +1,4 @@
1CONFIG_CROSS_COMPILE="arc-linux-uclibc-"1CONFIG_CROSS_COMPILE="arc-linux-"
2CONFIG_DEFAULT_HOSTNAME="ARCLinux"2CONFIG_DEFAULT_HOSTNAME="ARCLinux"
3# CONFIG_SWAP is not set3# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y4CONFIG_SYSVIPC=y
arch/arc/configs/nsim_hs_defconfig+1−1
@@ -1,4 +1,4 @@
1CONFIG_CROSS_COMPILE="arc-linux-uclibc-"1CONFIG_CROSS_COMPILE="arc-linux-"
2# CONFIG_LOCALVERSION_AUTO is not set2# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_DEFAULT_HOSTNAME="ARCLinux"3CONFIG_DEFAULT_HOSTNAME="ARCLinux"
4# CONFIG_SWAP is not set4# CONFIG_SWAP is not set
arch/arc/configs/nsim_hs_smp_defconfig+1−1
@@ -1,4 +1,4 @@
1CONFIG_CROSS_COMPILE="arc-linux-uclibc-"1CONFIG_CROSS_COMPILE="arc-linux-"
2# CONFIG_LOCALVERSION_AUTO is not set2# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_DEFAULT_HOSTNAME="ARCLinux"3CONFIG_DEFAULT_HOSTNAME="ARCLinux"
4# CONFIG_SWAP is not set4# CONFIG_SWAP is not set
arch/arc/configs/nsimosci_hs_defconfig+1−1
@@ -1,4 +1,4 @@
1CONFIG_CROSS_COMPILE="arc-linux-uclibc-"1CONFIG_CROSS_COMPILE="arc-linux-"
2# CONFIG_LOCALVERSION_AUTO is not set2# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_DEFAULT_HOSTNAME="ARCLinux"3CONFIG_DEFAULT_HOSTNAME="ARCLinux"
4# CONFIG_SWAP is not set4# CONFIG_SWAP is not set
arch/arc/configs/nsimosci_hs_smp_defconfig+1−1
@@ -1,4 +1,4 @@
1CONFIG_CROSS_COMPILE="arc-linux-uclibc-"1CONFIG_CROSS_COMPILE="arc-linux-"
2CONFIG_DEFAULT_HOSTNAME="ARCLinux"2CONFIG_DEFAULT_HOSTNAME="ARCLinux"
3# CONFIG_SWAP is not set3# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y4CONFIG_SYSVIPC=y
arch/arc/configs/vdk_hs38_defconfig+1−1
@@ -1,4 +1,4 @@
1CONFIG_CROSS_COMPILE="arc-linux-uclibc-"1CONFIG_CROSS_COMPILE="arc-linux-"
2# CONFIG_LOCALVERSION_AUTO is not set2# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_DEFAULT_HOSTNAME="ARCLinux"3CONFIG_DEFAULT_HOSTNAME="ARCLinux"
4# CONFIG_CROSS_MEMORY_ATTACH is not set4# CONFIG_CROSS_MEMORY_ATTACH is not set
arch/arc/configs/vdk_hs38_smp_defconfig+1−1
@@ -1,4 +1,4 @@
1CONFIG_CROSS_COMPILE="arc-linux-uclibc-"1CONFIG_CROSS_COMPILE="arc-linux-"
2# CONFIG_LOCALVERSION_AUTO is not set2# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_DEFAULT_HOSTNAME="ARCLinux"3CONFIG_DEFAULT_HOSTNAME="ARCLinux"
4# CONFIG_CROSS_MEMORY_ATTACH is not set4# CONFIG_CROSS_MEMORY_ATTACH is not set
arch/arc/include/asm/irqflags-arcv2.h+3−0
@@ -37,6 +37,9 @@ · 36 unmodified lines
37#define ISA_INIT_STATUS_BITS (STATUS_IE_MASK | STATUS_AD_MASK | \37#define ISA_INIT_STATUS_BITS (STATUS_IE_MASK | STATUS_AD_MASK | \
38 (ARCV2_IRQ_DEF_PRIO << 1))38 (ARCV2_IRQ_DEF_PRIO << 1))
39 39
40/* SLEEP needs default irq priority (<=) which can interrupt the doze */
41#define ISA_SLEEP_ARG (0x10 | ARCV2_IRQ_DEF_PRIO)
42
40#ifndef __ASSEMBLY__43#ifndef __ASSEMBLY__
41 44
42/*45/*
arch/arc/include/asm/irqflags-compact.h+2−0
@@ -43,6 +43,8 @@ · 42 unmodified lines
43 43
44#define ISA_INIT_STATUS_BITS STATUS_IE_MASK44#define ISA_INIT_STATUS_BITS STATUS_IE_MASK
45 45
46#define ISA_SLEEP_ARG 0x3
47
46#ifndef __ASSEMBLY__48#ifndef __ASSEMBLY__
47 49
48/******************************************************************50/******************************************************************
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
58 "st sp, [r24] \n\t"58 "st sp, [r24] \n\t"
59#endif59#endif
60 60
61 "sync \n\t"
62
63 /*61 /*
64 * setup _current_task with incoming tsk.62 * setup _current_task with incoming tsk.
65 * optionally, set r25 to that as well63 * 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
44 * don't need to do anything special to return it44 * don't need to do anything special to return it
45 */45 */
46 46
47 /* hardware memory barrier */
48 sync
49
50 /*47 /*
51 * switch to new task, contained in r148 * switch to new task, contained in r1
52 * Temp reg r3 is required to get the ptr to store val49 * 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
44void arch_cpu_idle(void)44void arch_cpu_idle(void)
45{45{
46 /* sleep, but enable all interrupts before committing */46 /* sleep, but enable all interrupts before committing */
47 if (is_isa_arcompact()) {47 __asm__ __volatile__(
48 __asm__("sleep 0x3");48 "sleep %0 \n"
49 } else {49 :
50 __asm__("sleep 0x10");50 :"I"(ISA_SLEEP_ARG)); /* can't be "r" has to be embedded const */
51 }
52}51}
53 52
54asmlinkage void ret_from_fork(void);53asmlinkage 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
986 (const u8 *)(fde +986 (const u8 *)(fde +
987 1) +987 1) +
988 *fde, ptrType);988 *fde, ptrType);
989 if (pc >= endLoc)989 if (pc >= endLoc) {
990 fde = NULL;990 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) {
1002 cie = NULL;991 cie = NULL;
1003 break;
1004 }992 }
1005 if (cie == NULL993 } else {
1006 || cie == &not_fde994 fde = NULL;
1007 || (ptrType = fde_pointer_type(cie)) < 0)995 cie = NULL;
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;
1025 }996 }
1026 }997 }
1027 }998 }
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
619 619
620 int dirty = !test_and_set_bit(PG_dc_clean, &page->flags);620 int dirty = !test_and_set_bit(PG_dc_clean, &page->flags);
621 if (dirty) {621 if (dirty) {
622 /* wback + inv dcache lines */622 /* wback + inv dcache lines (K-mapping) */
623 __flush_dcache_page(paddr, paddr);623 __flush_dcache_page(paddr, paddr);
624 624
625 /* invalidate any existing icache lines */625 /* invalidate any existing icache lines (U-mapping) */
626 if (vma->vm_flags & VM_EXEC)626 if (vma->vm_flags & VM_EXEC)
627 __inv_icache_page(paddr, vaddr);627 __inv_icache_page(paddr, vaddr);
628 }628 }
arch/arm/Kconfig+2−2
@@ -76,6 +76,8 @@ config ARM · 75 unmodified lines
76 select IRQ_FORCED_THREADING76 select IRQ_FORCED_THREADING
77 select MODULES_USE_ELF_REL77 select MODULES_USE_ELF_REL
78 select NO_BOOTMEM78 select NO_BOOTMEM
79 select OF_EARLY_FLATTREE if OF
80 select OF_RESERVED_MEM if OF
79 select OLD_SIGACTION81 select OLD_SIGACTION
80 select OLD_SIGSUSPEND382 select OLD_SIGSUSPEND3
81 select PERF_USE_VMALLOC83 select PERF_USE_VMALLOC
@@ -1822,8 +1824,6 @@ config USE_OF · 1740 unmodified lines
1822 bool "Flattened Device Tree support"1824 bool "Flattened Device Tree support"
1823 select IRQ_DOMAIN1825 select IRQ_DOMAIN
1824 select OF1826 select OF
1825 select OF_EARLY_FLATTREE
1826 select OF_RESERVED_MEM
1827 help1827 help
1828 Include support for flattened device tree machine descriptions.1828 Include support for flattened device tree machine descriptions.
1829 1829
arch/arm/boot/dts/am57xx-beagle-x15.dts+1−0
@@ -604,6 +604,7 @@ · 603 unmodified lines
604 reg = <0x6f>;604 reg = <0x6f>;
605 interrupts-extended = <&crossbar_mpu GIC_SPI 2 IRQ_TYPE_EDGE_RISING>,605 interrupts-extended = <&crossbar_mpu GIC_SPI 2 IRQ_TYPE_EDGE_RISING>,
606 <&dra7_pmx_core 0x424>;606 <&dra7_pmx_core 0x424>;
607 interrupt-names = "irq", "wakeup";
607 608
608 pinctrl-names = "default";609 pinctrl-names = "default";
609 pinctrl-0 = <&mcp79410_pins_default>;610 pinctrl-0 = <&mcp79410_pins_default>;
arch/arm/boot/dts/animeo_ip.dts+3−3
@@ -155,21 +155,21 @@ · 154 unmodified lines
155 label = "keyswitch_in";155 label = "keyswitch_in";
156 gpios = <&pioB 1 GPIO_ACTIVE_HIGH>;156 gpios = <&pioB 1 GPIO_ACTIVE_HIGH>;
157 linux,code = <28>;157 linux,code = <28>;
158 gpio-key,wakeup;158 wakeup-source;
159 };159 };
160 160
161 error_in {161 error_in {
162 label = "error_in";162 label = "error_in";
163 gpios = <&pioB 2 GPIO_ACTIVE_HIGH>;163 gpios = <&pioB 2 GPIO_ACTIVE_HIGH>;
164 linux,code = <29>;164 linux,code = <29>;
165 gpio-key,wakeup;165 wakeup-source;
166 };166 };
167 167
168 btn {168 btn {
169 label = "btn";169 label = "btn";
170 gpios = <&pioC 23 GPIO_ACTIVE_HIGH>;170 gpios = <&pioC 23 GPIO_ACTIVE_HIGH>;
171 linux,code = <31>;171 linux,code = <31>;
172 gpio-key,wakeup;172 wakeup-source;
173 };173 };
174 };174 };
175};175};
arch/arm/boot/dts/armada-38x.dtsi+1−0
@@ -498,6 +498,7 @@ · 497 unmodified lines
498 reg = <0x70000 0x4000>;498 reg = <0x70000 0x4000>;
499 interrupts-extended = <&mpic 8>;499 interrupts-extended = <&mpic 8>;
500 clocks = <&gateclk 4>;500 clocks = <&gateclk 4>;
501 tx-csum-limit = <9800>;
501 status = "disabled";502 status = "disabled";
502 };503 };
503 504
arch/arm/boot/dts/at91-foxg20.dts+1−1
@@ -159,7 +159,7 @@ · 158 unmodified lines
159 label = "Button";159 label = "Button";
160 gpios = <&pioC 4 GPIO_ACTIVE_LOW>;160 gpios = <&pioC 4 GPIO_ACTIVE_LOW>;
161 linux,code = <0x103>;161 linux,code = <0x103>;
162 gpio-key,wakeup;162 wakeup-source;
163 };163 };
164 };164 };
165};165};
arch/arm/boot/dts/at91-kizbox.dts+2−11
@@ -24,15 +24,6 @@ · 23 unmodified lines
24 };24 };
25 25
26 clocks {26 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
36 main_xtal {27 main_xtal {
37 clock-frequency = <18432000>;28 clock-frequency = <18432000>;
38 };29 };
@@ -94,14 +85,14 @@ · 55 unmodified lines
94 label = "PB_RST";85 label = "PB_RST";
95 gpios = <&pioB 30 GPIO_ACTIVE_HIGH>;86 gpios = <&pioB 30 GPIO_ACTIVE_HIGH>;
96 linux,code = <0x100>;87 linux,code = <0x100>;
97 gpio-key,wakeup;88 wakeup-source;
98 };89 };
99 90
100 user {91 user {
101 label = "PB_USER";92 label = "PB_USER";
102 gpios = <&pioB 31 GPIO_ACTIVE_HIGH>;93 gpios = <&pioB 31 GPIO_ACTIVE_HIGH>;
103 linux,code = <0x101>;94 linux,code = <0x101>;
104 gpio-key,wakeup;95 wakeup-source;
105 };96 };
106 };97 };
107 98
arch/arm/boot/dts/at91-kizbox2.dts+3−3
@@ -171,21 +171,21 @@ · 170 unmodified lines
171 label = "PB_PROG";171 label = "PB_PROG";
172 gpios = <&pioE 27 GPIO_ACTIVE_LOW>;172 gpios = <&pioE 27 GPIO_ACTIVE_LOW>;
173 linux,code = <0x102>;173 linux,code = <0x102>;
174 gpio-key,wakeup;174 wakeup-source;
175 };175 };
176 176
177 reset {177 reset {
178 label = "PB_RST";178 label = "PB_RST";
179 gpios = <&pioE 29 GPIO_ACTIVE_LOW>;179 gpios = <&pioE 29 GPIO_ACTIVE_LOW>;
180 linux,code = <0x100>;180 linux,code = <0x100>;
181 gpio-key,wakeup;181 wakeup-source;
182 };182 };
183 183
184 user {184 user {
185 label = "PB_USER";185 label = "PB_USER";
186 gpios = <&pioE 31 GPIO_ACTIVE_HIGH>;186 gpios = <&pioE 31 GPIO_ACTIVE_HIGH>;
187 linux,code = <0x101>;187 linux,code = <0x101>;
188 gpio-key,wakeup;188 wakeup-source;
189 };189 };
190 };190 };
191 191
arch/arm/boot/dts/at91-kizboxmini.dts+2−2
@@ -98,14 +98,14 @@ · 97 unmodified lines
98 label = "PB_PROG";98 label = "PB_PROG";
99 gpios = <&pioC 17 GPIO_ACTIVE_LOW>;99 gpios = <&pioC 17 GPIO_ACTIVE_LOW>;
100 linux,code = <0x102>;100 linux,code = <0x102>;
101 gpio-key,wakeup;101 wakeup-source;
102 };102 };
103 103
104 reset {104 reset {
105 label = "PB_RST";105 label = "PB_RST";
106 gpios = <&pioC 16 GPIO_ACTIVE_LOW>;106 gpios = <&pioC 16 GPIO_ACTIVE_LOW>;
107 linux,code = <0x100>;107 linux,code = <0x100>;
108 gpio-key,wakeup;108 wakeup-source;
109 };109 };
110 };110 };
111 111
arch/arm/boot/dts/at91-qil_a9260.dts+1−1
@@ -183,7 +183,7 @@ · 182 unmodified lines
183 label = "user_pb";183 label = "user_pb";
184 gpios = <&pioB 10 GPIO_ACTIVE_LOW>;184 gpios = <&pioB 10 GPIO_ACTIVE_LOW>;
185 linux,code = <28>;185 linux,code = <28>;
186 gpio-key,wakeup;186 wakeup-source;
187 };187 };
188 };188 };
189 189
arch/arm/boot/dts/at91-sama5d2_xplained.dts+106−9
@@ -45,6 +45,7 @@ · 44 unmodified lines
45/dts-v1/;45/dts-v1/;
46#include "sama5d2.dtsi"46#include "sama5d2.dtsi"
47#include "sama5d2-pinfunc.h"47#include "sama5d2-pinfunc.h"
48#include <dt-bindings/mfd/atmel-flexcom.h>
48 49
49/ {50/ {
50 model = "Atmel SAMA5D2 Xplained";51 model = "Atmel SAMA5D2 Xplained";
@@ -59,15 +60,6 @@ · 8 unmodified lines
59 };60 };
60 61
61 clocks {62 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
71 slow_xtal {63 slow_xtal {
72 clock-frequency = <32768>;64 clock-frequency = <32768>;
73 };65 };
@@ -91,6 +83,22 @@ · 17 unmodified lines
91 status = "okay";83 status = "okay";
92 };84 };
93 85
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
94 apb {102 apb {
95 spi0: spi@f8000000 {103 spi0: spi@f8000000 {
96 pinctrl-names = "default";104 pinctrl-names = "default";
@@ -181,12 +189,49 @@ · 84 unmodified lines
181 };189 };
182 };190 };
183 191
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
184 uart3: serial@fc008000 {209 uart3: serial@fc008000 {
185 pinctrl-names = "default";210 pinctrl-names = "default";
186 pinctrl-0 = <&pinctrl_uart3_default>;211 pinctrl-0 = <&pinctrl_uart3_default>;
187 status = "okay";212 status = "okay";
188 };213 };
189 214
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
190 i2c1: i2c@fc028000 {235 i2c1: i2c@fc028000 {
191 dmas = <0>, <0>;236 dmas = <0>, <0>;
192 pinctrl-names = "default";237 pinctrl-names = "default";
@@ -201,6 +246,18 @@ · 8 unmodified lines
201 };246 };
202 247
203 pinctrl@fc038000 {248 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
204 pinctrl_i2c0_default: i2c0_default {261 pinctrl_i2c0_default: i2c0_default {
205 pinmux = <PIN_PD21__TWD0>,262 pinmux = <PIN_PD21__TWD0>,
206 <PIN_PD22__TWCK0>;263 <PIN_PD22__TWCK0>;
@@ -227,6 +284,46 @@ · 20 unmodified lines
227 bias-disable;284 bias-disable;
228 };285 };
229 286
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
230 pinctrl_spi0_default: spi0_default {327 pinctrl_spi0_default: spi0_default {
231 pinmux = <PIN_PA14__SPI0_SPCK>,328 pinmux = <PIN_PA14__SPI0_SPCK>,
232 <PIN_PA15__SPI0_MOSI>,329 <PIN_PA15__SPI0_MOSI>,
arch/arm/boot/dts/at91-sama5d3_xplained.dts+1−1
@@ -315,7 +315,7 @@ · 314 unmodified lines
315 label = "PB_USER";315 label = "PB_USER";
316 gpios = <&pioE 29 GPIO_ACTIVE_LOW>;316 gpios = <&pioE 29 GPIO_ACTIVE_LOW>;
317 linux,code = <0x104>;317 linux,code = <0x104>;
318 gpio-key,wakeup;318 wakeup-source;
319 };319 };
320 };320 };
321 321
arch/arm/boot/dts/at91-sama5d4_xplained.dts+1−11
@@ -50,7 +50,6 @@ · 49 unmodified lines
50 compatible = "atmel,sama5d4-xplained", "atmel,sama5d4", "atmel,sama5";50 compatible = "atmel,sama5d4-xplained", "atmel,sama5d4", "atmel,sama5";
51 51
52 chosen {52 chosen {
53 bootargs = "ignore_loglevel earlyprintk";
54 stdout-path = "serial0:115200n8";53 stdout-path = "serial0:115200n8";
55 };54 };
56 55
@@ -59,15 +58,6 @@ · 2 unmodified lines
59 };58 };
60 59
61 clocks {60 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
71 slow_xtal {61 slow_xtal {
72 clock-frequency = <32768>;62 clock-frequency = <32768>;
73 };63 };
@@ -235,7 +225,7 @@ · 161 unmodified lines
235 label = "pb_user1";225 label = "pb_user1";
236 gpios = <&pioE 8 GPIO_ACTIVE_HIGH>;226 gpios = <&pioE 8 GPIO_ACTIVE_HIGH>;
237 linux,code = <0x100>;227 linux,code = <0x100>;
238 gpio-key,wakeup;228 wakeup-source;
239 };229 };
240 };230 };
241 231
arch/arm/boot/dts/at91-sama5d4ek.dts+1−11
@@ -50,7 +50,6 @@ · 49 unmodified lines
50 compatible = "atmel,sama5d4ek", "atmel,sama5d4", "atmel,sama5";50 compatible = "atmel,sama5d4ek", "atmel,sama5d4", "atmel,sama5";
51 51
52 chosen {52 chosen {
53 bootargs = "ignore_loglevel earlyprintk";
54 stdout-path = "serial0:115200n8";53 stdout-path = "serial0:115200n8";
55 };54 };
56 55
@@ -59,15 +58,6 @@ · 2 unmodified lines
59 };58 };
60 59
61 clocks {60 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
71 slow_xtal {61 slow_xtal {
72 clock-frequency = <32768>;62 clock-frequency = <32768>;
73 };63 };
@@ -304,7 +294,7 @@ · 230 unmodified lines
304 label = "pb_user1";294 label = "pb_user1";
305 gpios = <&pioE 13 GPIO_ACTIVE_HIGH>;295 gpios = <&pioE 13 GPIO_ACTIVE_HIGH>;
306 linux,code = <0x100>;296 linux,code = <0x100>;
307 gpio-key,wakeup;297 wakeup-source;
308 };298 };
309 };299 };
310 300
arch/arm/boot/dts/at91rm9200ek.dts+0−9
@@ -21,15 +21,6 @@ · 20 unmodified lines
21 };21 };
22 22
23 clocks {23 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
33 slow_xtal {24 slow_xtal {
34 clock-frequency = <32768>;25 clock-frequency = <32768>;
35 };26 };
arch/arm/boot/dts/at91sam9261ek.dts+5−14
@@ -22,15 +22,6 @@ · 21 unmodified lines
22 };22 };
23 23
24 clocks {24 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
34 slow_xtal {25 slow_xtal {
35 clock-frequency = <32768>;26 clock-frequency = <32768>;
36 };27 };
@@ -149,7 +140,7 @@ · 112 unmodified lines
149 ti,debounce-tol = /bits/ 16 <65535>;140 ti,debounce-tol = /bits/ 16 <65535>;
150 ti,debounce-max = /bits/ 16 <1>;141 ti,debounce-max = /bits/ 16 <1>;
151 142
152 linux,wakeup;143 wakeup-source;
153 };144 };
154 };145 };
155 146
@@ -193,28 +184,28 @@ · 37 unmodified lines
193 label = "button_0";184 label = "button_0";
194 gpios = <&pioA 27 GPIO_ACTIVE_LOW>;185 gpios = <&pioA 27 GPIO_ACTIVE_LOW>;
195 linux,code = <256>;186 linux,code = <256>;
196 gpio-key,wakeup;187 wakeup-source;
197 };188 };
198 189
199 button_1 {190 button_1 {
200 label = "button_1";191 label = "button_1";
201 gpios = <&pioA 26 GPIO_ACTIVE_LOW>;192 gpios = <&pioA 26 GPIO_ACTIVE_LOW>;
202 linux,code = <257>;193 linux,code = <257>;
203 gpio-key,wakeup;194 wakeup-source;
204 };195 };
205 196
206 button_2 {197 button_2 {
207 label = "button_2";198 label = "button_2";
208 gpios = <&pioA 25 GPIO_ACTIVE_LOW>;199 gpios = <&pioA 25 GPIO_ACTIVE_LOW>;
209 linux,code = <258>;200 linux,code = <258>;
210 gpio-key,wakeup;201 wakeup-source;
211 };202 };
212 203
213 button_3 {204 button_3 {
214 label = "button_3";205 label = "button_3";
215 gpios = <&pioA 24 GPIO_ACTIVE_LOW>;206 gpios = <&pioA 24 GPIO_ACTIVE_LOW>;
216 linux,code = <259>;207 linux,code = <259>;
217 gpio-key,wakeup;208 wakeup-source;
218 };209 };
219 };210 };
220};211};
arch/arm/boot/dts/at91sam9263ek.dts+2−11
@@ -22,15 +22,6 @@ · 21 unmodified lines
22 };22 };
23 23
24 clocks {24 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
34 slow_xtal {25 slow_xtal {
35 clock-frequency = <32768>;26 clock-frequency = <32768>;
36 };27 };
@@ -213,14 +204,14 @@ · 176 unmodified lines
213 label = "left_click";204 label = "left_click";
214 gpios = <&pioC 5 GPIO_ACTIVE_LOW>;205 gpios = <&pioC 5 GPIO_ACTIVE_LOW>;
215 linux,code = <272>;206 linux,code = <272>;
216 gpio-key,wakeup;207 wakeup-source;
217 };208 };
218 209
219 right_click {210 right_click {
220 label = "right_click";211 label = "right_click";
221 gpios = <&pioC 4 GPIO_ACTIVE_LOW>;212 gpios = <&pioC 4 GPIO_ACTIVE_LOW>;
222 linux,code = <273>;213 linux,code = <273>;
223 gpio-key,wakeup;214 wakeup-source;
224 };215 };
225 };216 };
226 217
arch/arm/boot/dts/at91sam9g20ek_common.dtsi+2−11
@@ -19,15 +19,6 @@ · 18 unmodified lines
19 };19 };
20 20
21 clocks {21 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
31 slow_xtal {22 slow_xtal {
32 clock-frequency = <32768>;23 clock-frequency = <32768>;
33 };24 };
@@ -206,14 +197,14 @@ · 172 unmodified lines
206 label = "Button 3";197 label = "Button 3";
207 gpios = <&pioA 30 GPIO_ACTIVE_LOW>;198 gpios = <&pioA 30 GPIO_ACTIVE_LOW>;
208 linux,code = <0x103>;199 linux,code = <0x103>;
209 gpio-key,wakeup;200 wakeup-source;
210 };201 };
211 202
212 btn4 {203 btn4 {
213 label = "Button 4";204 label = "Button 4";
214 gpios = <&pioA 31 GPIO_ACTIVE_LOW>;205 gpios = <&pioA 31 GPIO_ACTIVE_LOW>;
215 linux,code = <0x104>;206 linux,code = <0x104>;
216 gpio-key,wakeup;207 wakeup-source;
217 };208 };
218 };209 };
219 210
arch/arm/boot/dts/at91sam9m10g45ek.dts+2−11
@@ -24,15 +24,6 @@ · 23 unmodified lines
24 };24 };
25 25
26 clocks {26 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
36 slow_xtal {27 slow_xtal {
37 clock-frequency = <32768>;28 clock-frequency = <32768>;
38 };29 };
@@ -323,14 +314,14 @@ · 284 unmodified lines
323 label = "left_click";314 label = "left_click";
324 gpios = <&pioB 6 GPIO_ACTIVE_LOW>;315 gpios = <&pioB 6 GPIO_ACTIVE_LOW>;
325 linux,code = <272>;316 linux,code = <272>;
326 gpio-key,wakeup;317 wakeup-source;
327 };318 };
328 319
329 right_click {320 right_click {
330 label = "right_click";321 label = "right_click";
331 gpios = <&pioB 7 GPIO_ACTIVE_LOW>;322 gpios = <&pioB 7 GPIO_ACTIVE_LOW>;
332 linux,code = <273>;323 linux,code = <273>;
333 gpio-key,wakeup;324 wakeup-source;
334 };325 };
335 326
336 left {327 left {
arch/arm/boot/dts/at91sam9n12ek.dts+1−10
@@ -23,15 +23,6 @@ · 22 unmodified lines
23 };23 };
24 24
25 clocks {25 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
35 slow_xtal {26 slow_xtal {
36 clock-frequency = <32768>;27 clock-frequency = <32768>;
37 };28 };
@@ -219,7 +210,7 @@ · 181 unmodified lines
219 label = "Enter";210 label = "Enter";
220 gpios = <&pioB 3 GPIO_ACTIVE_LOW>;211 gpios = <&pioB 3 GPIO_ACTIVE_LOW>;
221 linux,code = <28>;212 linux,code = <28>;
222 gpio-key,wakeup;213 wakeup-source;
223 };214 };
224 };215 };
225 216
arch/arm/boot/dts/at91sam9rlek.dts+2−11
@@ -22,15 +22,6 @@ · 21 unmodified lines
22 };22 };
23 23
24 clocks {24 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
34 slow_xtal {25 slow_xtal {
35 clock-frequency = <32768>;26 clock-frequency = <32768>;
36 };27 };
@@ -225,14 +216,14 @@ · 188 unmodified lines
225 label = "right_click";216 label = "right_click";
226 gpios = <&pioB 0 GPIO_ACTIVE_LOW>;217 gpios = <&pioB 0 GPIO_ACTIVE_LOW>;
227 linux,code = <273>;218 linux,code = <273>;
228 gpio-key,wakeup;219 wakeup-source;
229 };220 };
230 221
231 left_click {222 left_click {
232 label = "left_click";223 label = "left_click";
233 gpios = <&pioB 1 GPIO_ACTIVE_LOW>;224 gpios = <&pioB 1 GPIO_ACTIVE_LOW>;
234 linux,code = <272>;225 linux,code = <272>;
235 gpio-key,wakeup;226 wakeup-source;
236 };227 };
237 };228 };
238 229
arch/arm/boot/dts/at91sam9x5cm.dtsi+0−11
@@ -12,17 +12,6 @@ · 11 unmodified lines
12 reg = <0x20000000 0x8000000>;12 reg = <0x20000000 0x8000000>;
13 };13 };
14 14
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
26 clocks {15 clocks {
27 slow_xtal {16 slow_xtal {
28 clock-frequency = <32768>;17 clock-frequency = <32768>;
arch/arm/boot/dts/dra7.dtsi+2−2
@@ -1459,8 +1459,8 @@ · 1458 unmodified lines
1459 interrupt-names = "tx", "rx";1459 interrupt-names = "tx", "rx";
1460 dmas = <&sdma_xbar 133>, <&sdma_xbar 132>;1460 dmas = <&sdma_xbar 133>, <&sdma_xbar 132>;
1461 dma-names = "tx", "rx";1461 dma-names = "tx", "rx";
1462 clocks = <&mcasp3_ahclkx_mux>;1462 clocks = <&mcasp3_aux_gfclk_mux>, <&mcasp3_ahclkx_mux>;
1463 clock-names = "fck";1463 clock-names = "fck", "ahclkx";
1464 status = "disabled";1464 status = "disabled";
1465 };1465 };
1466 1466
arch/arm/boot/dts/imx27.dtsi+12−4
@@ -486,7 +486,10 @@ · 485 unmodified lines
486 compatible = "fsl,imx27-usb";486 compatible = "fsl,imx27-usb";
487 reg = <0x10024000 0x200>;487 reg = <0x10024000 0x200>;
488 interrupts = <56>;488 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";
490 fsl,usbmisc = <&usbmisc 0>;493 fsl,usbmisc = <&usbmisc 0>;
491 status = "disabled";494 status = "disabled";
492 };495 };
@@ -495,7 +498,10 @@ · 2 unmodified lines
495 compatible = "fsl,imx27-usb";498 compatible = "fsl,imx27-usb";
496 reg = <0x10024200 0x200>;499 reg = <0x10024200 0x200>;
497 interrupts = <54>;500 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";
499 fsl,usbmisc = <&usbmisc 1>;505 fsl,usbmisc = <&usbmisc 1>;
500 dr_mode = "host";506 dr_mode = "host";
501 status = "disabled";507 status = "disabled";
@@ -505,7 +511,10 @@ · 3 unmodified lines
505 compatible = "fsl,imx27-usb";511 compatible = "fsl,imx27-usb";
506 reg = <0x10024400 0x200>;512 reg = <0x10024400 0x200>;
507 interrupts = <55>;513 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";
509 fsl,usbmisc = <&usbmisc 2>;518 fsl,usbmisc = <&usbmisc 2>;
510 dr_mode = "host";519 dr_mode = "host";
511 status = "disabled";520 status = "disabled";
@@ -515,7 +524,6 @@ · 3 unmodified lines
515 #index-cells = <1>;524 #index-cells = <1>;
516 compatible = "fsl,imx27-usbmisc";525 compatible = "fsl,imx27-usbmisc";
517 reg = <0x10024600 0x200>;526 reg = <0x10024600 0x200>;
518 clocks = <&clks IMX27_CLK_USB_AHB_GATE>;
519 };527 };
520 528
521 sahara2: sahara@10025000 {529 sahara2: sahara@10025000 {
arch/arm/boot/dts/k2l-netcp.dtsi+1−1
@@ -137,7 +137,7 @@ netcp: netcp@26000000 { · 136 unmodified lines
137 /* NetCP address range */137 /* NetCP address range */
138 ranges = <0 0x26000000 0x1000000>;138 ranges = <0 0x26000000 0x1000000>;
139 139
140 clocks = <&papllclk>, <&clkcpgmac>, <&chipclk12>;140 clocks = <&clkosr>, <&papllclk>, <&clkcpgmac>, <&chipclk12>;
141 dma-coherent;141 dma-coherent;
142 142
143 ti,navigator-dmas = <&dma_gbe 0>,143 ti,navigator-dmas = <&dma_gbe 0>,
arch/arm/boot/dts/kirkwood-ts219.dtsi+1−1
@@ -40,7 +40,7 @@ · 39 unmodified lines
40 };40 };
41 poweroff@12100 {41 poweroff@12100 {
42 compatible = "qnap,power-off";42 compatible = "qnap,power-off";
43 reg = <0x12000 0x100>;43 reg = <0x12100 0x100>;
44 clocks = <&gate_clk 7>;44 clocks = <&gate_clk 7>;
45 };45 };
46 spi@10600 {46 spi@10600 {
arch/arm/boot/dts/rk3288-veyron-minnie.dts+4−0
@@ -86,6 +86,10 @@ · 85 unmodified lines
86 };86 };
87};87};
88 88
89&emmc {
90 /delete-property/mmc-hs200-1_8v;
91};
92
89&gpio_keys {93&gpio_keys {
90 pinctrl-0 = <&pwr_key_l &ap_lid_int_l &volum_down_l &volum_up_l>;94 pinctrl-0 = <&pwr_key_l &ap_lid_int_l &volum_down_l &volum_up_l>;
91 95
arch/arm/boot/dts/rk3288.dtsi+8−2
@@ -452,8 +452,10 @@ · 451 unmodified lines
452 clock-names = "tsadc", "apb_pclk";452 clock-names = "tsadc", "apb_pclk";
453 resets = <&cru SRST_TSADC>;453 resets = <&cru SRST_TSADC>;
454 reset-names = "tsadc-apb";454 reset-names = "tsadc-apb";
455 pinctrl-names = "default";455 pinctrl-names = "init", "default", "sleep";
456 pinctrl-0 = <&otp_out>;456 pinctrl-0 = <&otp_gpio>;
457 pinctrl-1 = <&otp_out>;
458 pinctrl-2 = <&otp_gpio>;
457 #thermal-sensor-cells = <1>;459 #thermal-sensor-cells = <1>;
458 rockchip,hw-tshut-temp = <95000>;460 rockchip,hw-tshut-temp = <95000>;
459 status = "disabled";461 status = "disabled";
@@ -1395,6 +1397,10 @@ · 935 unmodified lines
1395 };1397 };
1396 1398
1397 tsadc {1399 tsadc {
1400 otp_gpio: otp-gpio {
1401 rockchip,pins = <0 10 RK_FUNC_GPIO &pcfg_pull_none>;
1402 };
1403
1398 otp_out: otp-out {1404 otp_out: otp-out {
1399 rockchip,pins = <0 10 RK_FUNC_1 &pcfg_pull_none>;1405 rockchip,pins = <0 10 RK_FUNC_1 &pcfg_pull_none>;
1400 };1406 };
arch/arm/boot/dts/sama5d35ek.dts+1−1
@@ -49,7 +49,7 @@ · 48 unmodified lines
49 label = "pb_user1";49 label = "pb_user1";
50 gpios = <&pioE 27 GPIO_ACTIVE_HIGH>;50 gpios = <&pioE 27 GPIO_ACTIVE_HIGH>;
51 linux,code = <0x100>;51 linux,code = <0x100>;
52 gpio-key,wakeup;52 wakeup-source;
53 };53 };
54 };54 };
55};55};
arch/arm/boot/dts/sama5d4.dtsi+1−1
@@ -1300,7 +1300,7 @@ · 1299 unmodified lines
1300 };1300 };
1301 1301
1302 watchdog@fc068640 {1302 watchdog@fc068640 {
1303 compatible = "atmel,at91sam9260-wdt";1303 compatible = "atmel,sama5d4-wdt";
1304 reg = <0xfc068640 0x10>;1304 reg = <0xfc068640 0x10>;
1305 clocks = <&clk32k>;1305 clocks = <&clk32k>;
1306 status = "disabled";1306 status = "disabled";
arch/arm/boot/dts/usb_a9260_common.dtsi+1−1
@@ -115,7 +115,7 @@ · 114 unmodified lines
115 label = "user_pb";115 label = "user_pb";
116 gpios = <&pioB 10 GPIO_ACTIVE_LOW>;116 gpios = <&pioB 10 GPIO_ACTIVE_LOW>;
117 linux,code = <28>;117 linux,code = <28>;
118 gpio-key,wakeup;118 wakeup-source;
119 };119 };
120 };120 };
121 121
arch/arm/boot/dts/usb_a9263.dts+1−1
@@ -143,7 +143,7 @@ · 142 unmodified lines
143 label = "user_pb";143 label = "user_pb";
144 gpios = <&pioB 10 GPIO_ACTIVE_LOW>;144 gpios = <&pioB 10 GPIO_ACTIVE_LOW>;
145 linux,code = <28>;145 linux,code = <28>;
146 gpio-key,wakeup;146 wakeup-source;
147 };147 };
148 };148 };
149 149
arch/arm/boot/dts/vfxxx.dtsi+4−4
@@ -158,7 +158,7 @@ · 157 unmodified lines
158 interrupts = <67 IRQ_TYPE_LEVEL_HIGH>;158 interrupts = <67 IRQ_TYPE_LEVEL_HIGH>;
159 clocks = <&clks VF610_CLK_DSPI0>;159 clocks = <&clks VF610_CLK_DSPI0>;
160 clock-names = "dspi";160 clock-names = "dspi";
161 spi-num-chipselects = <5>;161 spi-num-chipselects = <6>;
162 status = "disabled";162 status = "disabled";
163 };163 };
164 164
@@ -170,7 +170,7 @@ · 5 unmodified lines
170 interrupts = <68 IRQ_TYPE_LEVEL_HIGH>;170 interrupts = <68 IRQ_TYPE_LEVEL_HIGH>;
171 clocks = <&clks VF610_CLK_DSPI1>;171 clocks = <&clks VF610_CLK_DSPI1>;
172 clock-names = "dspi";172 clock-names = "dspi";
173 spi-num-chipselects = <5>;173 spi-num-chipselects = <4>;
174 status = "disabled";174 status = "disabled";
175 };175 };
176 176
@@ -461,6 +461,8 @@ · 284 unmodified lines
461 clock-names = "adc";461 clock-names = "adc";
462 #io-channel-cells = <1>;462 #io-channel-cells = <1>;
463 status = "disabled";463 status = "disabled";
464 fsl,adck-max-frequency = <30000000>, <40000000>,
465 <20000000>;
464 };466 };
465 467
466 esdhc0: esdhc@400b1000 {468 esdhc0: esdhc@400b1000 {
@@ -472,8 +474,6 @@ · 5 unmodified lines
472 <&clks VF610_CLK_ESDHC0>;474 <&clks VF610_CLK_ESDHC0>;
473 clock-names = "ipg", "ahb", "per";475 clock-names = "ipg", "ahb", "per";
474 status = "disabled";476 status = "disabled";
475 fsl,adck-max-frequency = <30000000>, <40000000>,
476 <20000000>;
477 };477 };
478 478
479 esdhc1: esdhc@400b2000 {479 esdhc1: esdhc@400b2000 {
arch/arm/configs/at91_dt_defconfig+0−1
@@ -125,7 +125,6 @@ CONFIG_POWER_RESET=y · 124 unmodified lines
125# CONFIG_HWMON is not set125# CONFIG_HWMON is not set
126CONFIG_WATCHDOG=y126CONFIG_WATCHDOG=y
127CONFIG_AT91SAM9X_WATCHDOG=y127CONFIG_AT91SAM9X_WATCHDOG=y
128CONFIG_SSB=m
129CONFIG_MFD_ATMEL_HLCDC=y128CONFIG_MFD_ATMEL_HLCDC=y
130CONFIG_REGULATOR=y129CONFIG_REGULATOR=y
131CONFIG_REGULATOR_FIXED_VOLTAGE=y130CONFIG_REGULATOR_FIXED_VOLTAGE=y
arch/arm/configs/sama5_defconfig+0−1
@@ -129,7 +129,6 @@ CONFIG_GPIO_SYSFS=y · 128 unmodified lines
129CONFIG_POWER_SUPPLY=y129CONFIG_POWER_SUPPLY=y
130CONFIG_POWER_RESET=y130CONFIG_POWER_RESET=y
131# CONFIG_HWMON is not set131# CONFIG_HWMON is not set
132CONFIG_SSB=m
133CONFIG_MFD_ATMEL_FLEXCOM=y132CONFIG_MFD_ATMEL_FLEXCOM=y
134CONFIG_REGULATOR=y133CONFIG_REGULATOR=y
135CONFIG_REGULATOR_FIXED_VOLTAGE=y134CONFIG_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
40#define arch_trigger_all_cpu_backtrace(x) arch_trigger_all_cpu_backtrace(x)40#define arch_trigger_all_cpu_backtrace(x) arch_trigger_all_cpu_backtrace(x)
41#endif41#endif
42 42
43static inline int nr_legacy_irqs(void)
44{
45 return NR_IRQS_LEGACY;
46}
47
43#endif48#endif
44 49
45#endif50#endif
arch/arm/include/asm/kvm_emulate.h+12−0
@@ -28,6 +28,18 @@ · 27 unmodified lines
28unsigned long *vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num);28unsigned long *vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num);
29unsigned long *vcpu_spsr(struct kvm_vcpu *vcpu);29unsigned long *vcpu_spsr(struct kvm_vcpu *vcpu);
30 30
31static inline unsigned long vcpu_get_reg(struct kvm_vcpu *vcpu,
32 u8 reg_num)
33{
34 return *vcpu_reg(vcpu, reg_num);
35}
36
37static 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
31bool kvm_condition_valid(struct kvm_vcpu *vcpu);43bool kvm_condition_valid(struct kvm_vcpu *vcpu);
32void kvm_skip_instr(struct kvm_vcpu *vcpu, bool is_wide_instr);44void kvm_skip_instr(struct kvm_vcpu *vcpu, bool is_wide_instr);
33void kvm_inject_undefined(struct kvm_vcpu *vcpu);45void kvm_inject_undefined(struct kvm_vcpu *vcpu);
arch/arm/include/uapi/asm/unistd.h+1−0
@@ -416,6 +416,7 @@ · 415 unmodified lines
416#define __NR_execveat (__NR_SYSCALL_BASE+387)416#define __NR_execveat (__NR_SYSCALL_BASE+387)
417#define __NR_userfaultfd (__NR_SYSCALL_BASE+388)417#define __NR_userfaultfd (__NR_SYSCALL_BASE+388)
418#define __NR_membarrier (__NR_SYSCALL_BASE+389)418#define __NR_membarrier (__NR_SYSCALL_BASE+389)
419#define __NR_mlock2 (__NR_SYSCALL_BASE+390)
419 420
420/*421/*
421 * The following SWIs are ARM private.422 * The following SWIs are ARM private.
arch/arm/kernel/bios32.c+11−8
@@ -17,11 +17,6 @@ · 16 unmodified lines
17#include <asm/mach/pci.h>17#include <asm/mach/pci.h>
18 18
19static int debug_pci;19static int debug_pci;
20static 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;
25 20
26/*21/*
27 * We can't use pci_get_device() here since we are22 * 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
461 sys->busnr = busnr;456 sys->busnr = busnr;
462 sys->swizzle = hw->swizzle;457 sys->swizzle = hw->swizzle;
463 sys->map_irq = hw->map_irq;458 sys->map_irq = hw->map_irq;
464 align_resource = hw->align_resource;
465 INIT_LIST_HEAD(&sys->resources);459 INIT_LIST_HEAD(&sys->resources);
466 460
467 if (hw->private_data)461 if (hw->private_data)
@@ -470,6 +464,8 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw, · 2 unmodified lines
470 ret = hw->setup(nr, sys);464 ret = hw->setup(nr, sys);
471 465
472 if (ret > 0) {466 if (ret > 0) {
467 struct pci_host_bridge *host_bridge;
468
473 ret = pcibios_init_resources(nr, sys);469 ret = pcibios_init_resources(nr, sys);
474 if (ret) {470 if (ret) {
475 kfree(sys);471 kfree(sys);
@@ -491,6 +487,9 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw, · 15 unmodified lines
491 busnr = sys->bus->busn_res.end + 1;487 busnr = sys->bus->busn_res.end + 1;
492 488
493 list_add(&sys->node, head);489 list_add(&sys->node, head);
490
491 host_bridge = pci_find_host_bridge(sys->bus);
492 host_bridge->align_resource = hw->align_resource;
494 } else {493 } else {
495 kfree(sys);494 kfree(sys);
496 if (ret < 0)495 if (ret < 0)
@@ -578,14 +577,18 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res, · 81 unmodified lines
578{577{
579 struct pci_dev *dev = data;578 struct pci_dev *dev = data;
580 resource_size_t start = res->start;579 resource_size_t start = res->start;
580 struct pci_host_bridge *host_bridge;
581 581
582 if (res->flags & IORESOURCE_IO && start & 0x300)582 if (res->flags & IORESOURCE_IO && start & 0x300)
583 start = (start + 0x3ff) & ~0x3ff;583 start = (start + 0x3ff) & ~0x3ff;
584 584
585 start = (start + align - 1) & ~(align - 1);585 start = (start + align - 1) & ~(align - 1);
586 586
587 if (align_resource)587 host_bridge = pci_find_host_bridge(dev->bus);
588 return align_resource(dev, res, start, size, align);588
589 if (host_bridge->align_resource)
590 return host_bridge->align_resource(dev, res,
591 start, size, align);
589 592
590 return start;593 return start;
591}594}
arch/arm/kernel/calls.S+1−0
@@ -399,6 +399,7 @@ · 398 unmodified lines
399 CALL(sys_execveat)399 CALL(sys_execveat)
400 CALL(sys_userfaultfd)400 CALL(sys_userfaultfd)
401 CALL(sys_membarrier)401 CALL(sys_membarrier)
402 CALL(sys_mlock2)
402#ifndef syscalls_counted403#ifndef syscalls_counted
403.equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls404.equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls
404#define syscalls_counted405#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
563 if (vcpu->arch.power_off || vcpu->arch.pause)563 if (vcpu->arch.power_off || vcpu->arch.pause)
564 vcpu_sleep(vcpu);564 vcpu_sleep(vcpu);
565 565
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
572 /*566 /*
573 * Preparing the interrupts to be injected also567 * Preparing the interrupts to be injected also
574 * involves poking the GIC, which must be done in a568 * involves poking the GIC, which must be done in a
575 * non-preemptible context.569 * non-preemptible context.
576 */570 */
577 preempt_disable();571 preempt_disable();
572 kvm_timer_flush_hwstate(vcpu);
578 kvm_vgic_flush_hwstate(vcpu);573 kvm_vgic_flush_hwstate(vcpu);
579 574
580 local_irq_disable();575 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
115 trace_kvm_mmio(KVM_TRACE_MMIO_READ, len, run->mmio.phys_addr,115 trace_kvm_mmio(KVM_TRACE_MMIO_READ, len, run->mmio.phys_addr,
116 data);116 data);
117 data = vcpu_data_host_to_guest(vcpu, data, len);117 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);
119 }119 }
120 120
121 return 0;121 return 0;
@@ -186,7 +186,8 @@ int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run, · 64 unmodified lines
186 rt = vcpu->arch.mmio_decode.rt;186 rt = vcpu->arch.mmio_decode.rt;
187 187
188 if (is_write) {188 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);
190 191
191 trace_kvm_mmio(KVM_TRACE_MMIO_WRITE, len, fault_ipa, data);192 trace_kvm_mmio(KVM_TRACE_MMIO_WRITE, len, fault_ipa, data);
192 mmio_write_buf(data_buf, len, data);193 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
98 __kvm_flush_dcache_pud(pud);98 __kvm_flush_dcache_pud(pud);
99}99}
100 100
101static bool kvm_is_device_pfn(unsigned long pfn)
102{
103 return !pfn_valid(pfn);
104}
105
101/**106/**
102 * stage2_dissolve_pmd() - clear and flush huge PMD entry107 * stage2_dissolve_pmd() - clear and flush huge PMD entry
103 * @kvm: pointer to kvm structure.108 * @kvm: pointer to kvm structure.
@@ -213,7 +218,7 @@ static void unmap_ptes(struct kvm *kvm, pmd_t *pmd, · 109 unmodified lines
213 kvm_tlb_flush_vmid_ipa(kvm, addr);218 kvm_tlb_flush_vmid_ipa(kvm, addr);
214 219
215 /* No need to invalidate the cache for device mappings */220 /* 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)))
217 kvm_flush_dcache_pte(old_pte);222 kvm_flush_dcache_pte(old_pte);
218 223
219 put_page(virt_to_page(pte));224 put_page(virt_to_page(pte));
@@ -305,8 +310,7 @@ static void stage2_flush_ptes(struct kvm *kvm, pmd_t *pmd, · 85 unmodified lines
305 310
306 pte = pte_offset_kernel(pmd, addr);311 pte = pte_offset_kernel(pmd, addr);
307 do {312 do {
308 if (!pte_none(*pte) &&313 if (!pte_none(*pte) && !kvm_is_device_pfn(pte_pfn(*pte)))
309 (pte_val(*pte) & PAGE_S2_DEVICE) != PAGE_S2_DEVICE)
310 kvm_flush_dcache_pte(*pte);314 kvm_flush_dcache_pte(*pte);
311 } while (pte++, addr += PAGE_SIZE, addr != end);315 } while (pte++, addr += PAGE_SIZE, addr != end);
312}316}
@@ -1037,11 +1041,6 @@ static bool kvm_is_write_fault(struct kvm_vcpu *vcpu) · 724 unmodified lines
1037 return kvm_vcpu_dabt_iswrite(vcpu);1041 return kvm_vcpu_dabt_iswrite(vcpu);
1038}1042}
1039 1043
1040static bool kvm_is_device_pfn(unsigned long pfn)
1041{
1042 return !pfn_valid(pfn);
1043}
1044
1045/**1044/**
1046 * stage2_wp_ptes - write protect PMD range1045 * stage2_wp_ptes - write protect PMD range
1047 * @pmd: pointer to pmd entry1046 * @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
75 unsigned long context_id;75 unsigned long context_id;
76 phys_addr_t target_pc;76 phys_addr_t target_pc;
77 77
78 cpu_id = *vcpu_reg(source_vcpu, 1) & MPIDR_HWID_BITMASK;78 cpu_id = vcpu_get_reg(source_vcpu, 1) & MPIDR_HWID_BITMASK;
79 if (vcpu_mode_is_32bit(source_vcpu))79 if (vcpu_mode_is_32bit(source_vcpu))
80 cpu_id &= ~((u32) 0);80 cpu_id &= ~((u32) 0);
81 81
@@ -94,8 +94,8 @@ static unsigned long kvm_psci_vcpu_on(struct kvm_vcpu *source_vcpu) · 12 unmodified lines
94 return PSCI_RET_INVALID_PARAMS;94 return PSCI_RET_INVALID_PARAMS;
95 }95 }
96 96
97 target_pc = *vcpu_reg(source_vcpu, 2);97 target_pc = vcpu_get_reg(source_vcpu, 2);
98 context_id = *vcpu_reg(source_vcpu, 3);98 context_id = vcpu_get_reg(source_vcpu, 3);
99 99
100 kvm_reset_vcpu(vcpu);100 kvm_reset_vcpu(vcpu);
101 101
@@ -114,7 +114,7 @@ static unsigned long kvm_psci_vcpu_on(struct kvm_vcpu *source_vcpu) · 12 unmodified lines
114 * NOTE: We always update r0 (or x0) because for PSCI v0.1114 * NOTE: We always update r0 (or x0) because for PSCI v0.1
115 * the general puspose registers are undefined upon CPU_ON.115 * the general puspose registers are undefined upon CPU_ON.
116 */116 */
117 *vcpu_reg(vcpu, 0) = context_id;117 vcpu_set_reg(vcpu, 0, context_id);
118 vcpu->arch.power_off = false;118 vcpu->arch.power_off = false;
119 smp_mb(); /* Make sure the above is visible */119 smp_mb(); /* Make sure the above is visible */
120 120
@@ -134,8 +134,8 @@ static unsigned long kvm_psci_vcpu_affinity_info(struct kvm_vcpu *vcpu) · 13 unmodified lines
134 struct kvm *kvm = vcpu->kvm;134 struct kvm *kvm = vcpu->kvm;
135 struct kvm_vcpu *tmp;135 struct kvm_vcpu *tmp;
136 136
137 target_affinity = *vcpu_reg(vcpu, 1);137 target_affinity = vcpu_get_reg(vcpu, 1);
138 lowest_affinity_level = *vcpu_reg(vcpu, 2);138 lowest_affinity_level = vcpu_get_reg(vcpu, 2);
139 139
140 /* Determine target affinity mask */140 /* Determine target affinity mask */
141 target_affinity_mask = psci_affinity_mask(lowest_affinity_level);141 target_affinity_mask = psci_affinity_mask(lowest_affinity_level);
@@ -209,7 +209,7 @@ int kvm_psci_version(struct kvm_vcpu *vcpu) · 67 unmodified lines
209static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu)209static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu)
210{210{
211 int ret = 1;211 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);
213 unsigned long val;213 unsigned long val;
214 214
215 switch (psci_fn) {215 switch (psci_fn) {
@@ -273,13 +273,13 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu) · 57 unmodified lines
273 break;273 break;
274 }274 }
275 275
276 *vcpu_reg(vcpu, 0) = val;276 vcpu_set_reg(vcpu, 0, val);
277 return ret;277 return ret;
278}278}
279 279
280static int kvm_psci_0_1_call(struct kvm_vcpu *vcpu)280static int kvm_psci_0_1_call(struct kvm_vcpu *vcpu)
281{281{
282 unsigned long psci_fn = *vcpu_reg(vcpu, 0) & ~((u32) 0);282 unsigned long psci_fn = vcpu_get_reg(vcpu, 0) & ~((u32) 0);
283 unsigned long val;283 unsigned long val;
284 284
285 switch (psci_fn) {285 switch (psci_fn) {
@@ -295,7 +295,7 @@ static int kvm_psci_0_1_call(struct kvm_vcpu *vcpu) · 9 unmodified lines
295 break;295 break;
296 }296 }
297 297
298 *vcpu_reg(vcpu, 0) = val;298 vcpu_set_reg(vcpu, 0, val);
299 return 1;299 return 1;
300}300}
301 301
arch/arm/mach-dove/include/mach/entry-macro.S+2−2
@@ -18,13 +18,13 @@ · 17 unmodified lines
18 @ check low interrupts18 @ check low interrupts
19 ldr \irqstat, [\base, #IRQ_CAUSE_LOW_OFF]19 ldr \irqstat, [\base, #IRQ_CAUSE_LOW_OFF]
20 ldr \tmp, [\base, #IRQ_MASK_LOW_OFF]20 ldr \tmp, [\base, #IRQ_MASK_LOW_OFF]
21 mov \irqnr, #3121 mov \irqnr, #32
22 ands \irqstat, \irqstat, \tmp22 ands \irqstat, \irqstat, \tmp
23 23
24 @ if no low interrupts set, check high interrupts24 @ if no low interrupts set, check high interrupts
25 ldreq \irqstat, [\base, #IRQ_CAUSE_HIGH_OFF]25 ldreq \irqstat, [\base, #IRQ_CAUSE_HIGH_OFF]
26 ldreq \tmp, [\base, #IRQ_MASK_HIGH_OFF]26 ldreq \tmp, [\base, #IRQ_MASK_HIGH_OFF]
27 moveq \irqnr, #6327 moveq \irqnr, #64
28 andeqs \irqstat, \irqstat, \tmp28 andeqs \irqstat, \irqstat, \tmp
29 29
30 @ find first active interrupt source30 @ 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
177 .irq_unmask = imx_gpc_irq_unmask,177 .irq_unmask = imx_gpc_irq_unmask,
178 .irq_retrigger = irq_chip_retrigger_hierarchy,178 .irq_retrigger = irq_chip_retrigger_hierarchy,
179 .irq_set_wake = imx_gpc_irq_set_wake,179 .irq_set_wake = imx_gpc_irq_set_wake,
180 .irq_set_type = irq_chip_set_type_parent,
180#ifdef CONFIG_SMP181#ifdef CONFIG_SMP
181 .irq_set_affinity = irq_chip_set_affinity_parent,182 .irq_set_affinity = irq_chip_set_affinity_parent,
182#endif183#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
143 * Ensure that CPU power state is set to ON to avoid CPU143 * Ensure that CPU power state is set to ON to avoid CPU
144 * powerdomain transition on wfi144 * powerdomain transition on wfi
145 */145 */
146 clkdm_wakeup(cpu1_clkdm);146 clkdm_wakeup_nolock(cpu1_clkdm);
147 omap_set_pwrdm_state(cpu1_pwrdm, PWRDM_POWER_ON);147 pwrdm_set_next_pwrst(cpu1_pwrdm, PWRDM_POWER_ON);
148 clkdm_allow_idle(cpu1_clkdm);148 clkdm_allow_idle_nolock(cpu1_clkdm);
149 149
150 if (IS_PM44XX_ERRATUM(PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD)) {150 if (IS_PM44XX_ERRATUM(PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD)) {
151 while (gic_dist_disabled()) {151 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
890 return ret;890 return ret;
891}891}
892 892
893static 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
908static 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
893/**923/**
894 * _enable_clocks - enable hwmod main clock and interface clocks924 * _enable_clocks - enable hwmod main clock and interface clocks
895 * @oh: struct omap_hwmod *925 * @oh: struct omap_hwmod *
@@ -917,6 +947,9 @@ static int _enable_clocks(struct omap_hwmod *oh) · 21 unmodified lines
917 clk_enable(os->_clk);947 clk_enable(os->_clk);
918 }948 }
919 949
950 if (oh->flags & HWMOD_OPT_CLKS_NEEDED)
951 _enable_optional_clocks(oh);
952
920 /* The opt clocks are controlled by the device driver. */953 /* The opt clocks are controlled by the device driver. */
921 954
922 return 0;955 return 0;
@@ -948,41 +981,14 @@ static int _disable_clocks(struct omap_hwmod *oh) · 25 unmodified lines
948 clk_disable(os->_clk);981 clk_disable(os->_clk);
949 }982 }
950 983
984 if (oh->flags & HWMOD_OPT_CLKS_NEEDED)
985 _disable_optional_clocks(oh);
986
951 /* The opt clocks are controlled by the device driver. */987 /* The opt clocks are controlled by the device driver. */
952 988
953 return 0;989 return 0;
954}990}
955 991
956static 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
971static 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
986/**992/**
987 * _omap4_enable_module - enable CLKCTRL modulemode on OMAP4993 * _omap4_enable_module - enable CLKCTRL modulemode on OMAP4
988 * @oh: struct omap_hwmod *994 * @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
523 * HWMOD_RECONFIG_IO_CHAIN: omap_hwmod code needs to reconfigure wake-up 523 * HWMOD_RECONFIG_IO_CHAIN: omap_hwmod code needs to reconfigure wake-up
524 * events by calling _reconfigure_io_chain() when a device is enabled524 * events by calling _reconfigure_io_chain() when a device is enabled
525 * or idled.525 * 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.
526 */528 */
527#define HWMOD_SWSUP_SIDLE (1 << 0)529#define HWMOD_SWSUP_SIDLE (1 << 0)
528#define HWMOD_SWSUP_MSTANDBY (1 << 1)530#define HWMOD_SWSUP_MSTANDBY (1 << 1)
@@ -538,6 +540,7 @@ struct omap_hwmod_omap4_prcm { · 9 unmodified lines
538#define HWMOD_FORCE_MSTANDBY (1 << 11)540#define HWMOD_FORCE_MSTANDBY (1 << 11)
539#define HWMOD_SWSUP_SIDLE_ACT (1 << 12)541#define HWMOD_SWSUP_SIDLE_ACT (1 << 12)
540#define HWMOD_RECONFIG_IO_CHAIN (1 << 13)542#define HWMOD_RECONFIG_IO_CHAIN (1 << 13)
543#define HWMOD_OPT_CLKS_NEEDED (1 << 14)
541 544
542/*545/*
543 * omap_hwmod._int_flags definitions546 * 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
1297 .dev_attr = &mcspi4_dev_attr,1297 .dev_attr = &mcspi4_dev_attr,
1298};1298};
1299 1299
1300/*
1301 * 'mcasp' class
1302 *
1303 */
1304static 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
1311static struct omap_hwmod_class dra7xx_mcasp_hwmod_class = {
1312 .name = "mcasp",
1313 .sysc = &dra7xx_mcasp_sysc,
1314};
1315
1316/* mcasp3 */
1317static struct omap_hwmod_opt_clk mcasp3_opt_clks[] = {
1318 { .role = "ahclkx", .clk = "mcasp3_ahclkx_mux" },
1319};
1320
1321static 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
1300/*1338/*
1301 * 'mmc' class1339 * 'mmc' class
1302 *1340 *
@@ -2566,6 +2604,22 @@ static struct omap_hwmod_ocp_if dra7xx_l3_main_1__hdmi = { · 1263 unmodified lines
2566 .user = OCP_USER_MPU | OCP_USER_SDMA,2604 .user = OCP_USER_MPU | OCP_USER_SDMA,
2567};2605};
2568 2606
2607/* l4_per2 -> mcasp3 */
2608static 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 */
2616static 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
2569/* l4_per1 -> elm */2623/* l4_per1 -> elm */
2570static struct omap_hwmod_ocp_if dra7xx_l4_per1__elm = {2624static struct omap_hwmod_ocp_if dra7xx_l4_per1__elm = {
2571 .master = &dra7xx_l4_per1_hwmod,2625 .master = &dra7xx_l4_per1_hwmod,
@@ -3308,6 +3362,8 @@ static struct omap_hwmod_ocp_if *dra7xx_hwmod_ocp_ifs[] __initdata = { · 736 unmodified lines
3308 &dra7xx_l4_wkup__dcan1,3362 &dra7xx_l4_wkup__dcan1,
3309 &dra7xx_l4_per2__dcan2,3363 &dra7xx_l4_per2__dcan2,
3310 &dra7xx_l4_per2__cpgmac0,3364 &dra7xx_l4_per2__cpgmac0,
3365 &dra7xx_l4_per2__mcasp3,
3366 &dra7xx_l3_main_1__mcasp3,
3311 &dra7xx_gmac__mdio,3367 &dra7xx_gmac__mdio,
3312 &dra7xx_l4_cfg__dma_system,3368 &dra7xx_l4_cfg__dma_system,
3313 &dra7xx_l3_main_1__dss,3369 &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
144 .name = "l4_ls",144 .name = "l4_ls",
145 .clkdm_name = "alwon_l3s_clkdm",145 .clkdm_name = "alwon_l3s_clkdm",
146 .class = &l4_hwmod_class,146 .class = &l4_hwmod_class,
147 .flags = HWMOD_NO_IDLEST,
147};148};
148 149
149/*150/*
@@ -155,6 +156,7 @@ static struct omap_hwmod dm81xx_l4_hs_hwmod = { · 5 unmodified lines
155 .name = "l4_hs",156 .name = "l4_hs",
156 .clkdm_name = "alwon_l3_med_clkdm",157 .clkdm_name = "alwon_l3_med_clkdm",
157 .class = &l4_hwmod_class,158 .class = &l4_hwmod_class,
159 .flags = HWMOD_NO_IDLEST,
158};160};
159 161
160/* L3 slow -> L4 ls peripheral interface running at 125MHz */162/* L3 slow -> L4 ls peripheral interface running at 125MHz */
@@ -850,6 +852,7 @@ static struct omap_hwmod dm816x_emac0_hwmod = { · 689 unmodified lines
850 .name = "emac0",852 .name = "emac0",
851 .clkdm_name = "alwon_ethernet_clkdm",853 .clkdm_name = "alwon_ethernet_clkdm",
852 .class = &dm816x_emac_hwmod_class,854 .class = &dm816x_emac_hwmod_class,
855 .flags = HWMOD_NO_IDLEST,
853};856};
854 857
855static struct omap_hwmod_ocp_if dm81xx_l4_hs__emac0 = {858static 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
24#include <linux/platform_data/iommu-omap.h>24#include <linux/platform_data/iommu-omap.h>
25#include <linux/platform_data/wkup_m3.h>25#include <linux/platform_data/wkup_m3.h>
26 26
27#include <asm/siginfo.h>
28#include <asm/signal.h>
29
30#include "common.h"27#include "common.h"
31#include "common-board-devices.h"28#include "common-board-devices.h"
32#include "dss-common.h"29#include "dss-common.h"
@@ -385,29 +382,6 @@ static void __init omap3_pandora_legacy_init(void) · 352 unmodified lines
385}382}
386#endif /* CONFIG_ARCH_OMAP3 */383#endif /* CONFIG_ARCH_OMAP3 */
387 384
388#ifdef CONFIG_SOC_TI81XX
389static int fault_fixed_up;
390
391static 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
404static 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
411#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)385#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
412static struct iommu_platform_data omap4_iommu_pdata = {386static struct iommu_platform_data omap4_iommu_pdata = {
413 .reset_name = "mmu_cache",387 .reset_name = "mmu_cache",
@@ -536,9 +510,6 @@ static struct pdata_init pdata_quirks[] __initdata = { · 122 unmodified lines
536 { "openpandora,omap3-pandora-600mhz", omap3_pandora_legacy_init, },510 { "openpandora,omap3-pandora-600mhz", omap3_pandora_legacy_init, },
537 { "openpandora,omap3-pandora-1ghz", omap3_pandora_legacy_init, },511 { "openpandora,omap3-pandora-1ghz", omap3_pandora_legacy_init, },
538#endif512#endif
539#ifdef CONFIG_SOC_TI81XX
540 { "hp,t410", t410_abort_init, },
541#endif
542#ifdef CONFIG_SOC_OMAP5513#ifdef CONFIG_SOC_OMAP5
543 { "ti,omap5-uevm", omap5_uevm_legacy_init, },514 { "ti,omap5-uevm", omap5_uevm_legacy_init, },
544#endif515#endif
arch/arm/mach-omap2/pm34xx.c+2−2
@@ -301,11 +301,11 @@ static void omap3_pm_idle(void) · 300 unmodified lines
301 if (omap_irq_pending())301 if (omap_irq_pending())
302 return;302 return;
303 303
304 trace_cpu_idle(1, smp_processor_id());304 trace_cpu_idle_rcuidle(1, smp_processor_id());
305 305
306 omap_sram_idle();306 omap_sram_idle();
307 307
308 trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());308 trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
309}309}
310 310
311#ifdef CONFIG_SUSPEND311#ifdef CONFIG_SUSPEND
arch/arm/mach-orion5x/include/mach/entry-macro.S+1−1
@@ -21,5 +21,5 @@ · 20 unmodified lines
21 @ find cause bits that are unmasked21 @ find cause bits that are unmasked
22 ands \irqstat, \irqstat, \tmp @ clear Z flag if any22 ands \irqstat, \irqstat, \tmp @ clear Z flag if any
23 clzne \irqnr, \irqstat @ calc irqnr23 clzne \irqnr, \irqstat @ calc irqnr
24 rsbne \irqnr, \irqnr, #3124 rsbne \irqnr, \irqnr, #32
25 .endm25 .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
344{344{
345 palm_bl_power = bl;345 palm_bl_power = bl;
346 palm_lcd_power = lcd;346 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));
348 platform_device_register(&palm27x_backlight);348 platform_device_register(&palm27x_backlight);
349}349}
350#endif350#endif
arch/arm/mach-pxa/palmtc.c+1−1
@@ -169,7 +169,7 @@ static inline void palmtc_keys_init(void) {} · 168 unmodified lines
169#if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)169#if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
170static struct pwm_lookup palmtc_pwm_lookup[] = {170static struct pwm_lookup palmtc_pwm_lookup[] = {
171 PWM_LOOKUP("pxa25x-pwm.1", 0, "pwm-backlight.0", NULL, PALMTC_PERIOD_NS,171 PWM_LOOKUP("pxa25x-pwm.1", 0, "pwm-backlight.0", NULL, PALMTC_PERIOD_NS,
172 PWM_PERIOD_NORMAL),172 PWM_POLARITY_NORMAL),
173};173};
174 174
175static struct platform_pwm_backlight_data palmtc_backlight_data = {175static struct platform_pwm_backlight_data palmtc_backlight_data = {
arch/arm/mach-shmobile/setup-r8a7793.c+1−1
@@ -19,7 +19,7 @@ · 18 unmodified lines
19#include "common.h"19#include "common.h"
20#include "rcar-gen2.h"20#include "rcar-gen2.h"
21 21
22static const char *r8a7793_boards_compat_dt[] __initconst = {22static const char * const r8a7793_boards_compat_dt[] __initconst = {
23 "renesas,r8a7793",23 "renesas,r8a7793",
24 NULL,24 NULL,
25};25};
arch/arm/mach-zx/Kconfig+1−1
@@ -13,7 +13,7 @@ config SOC_ZX296702 · 12 unmodified lines
13 select ARM_GLOBAL_TIMER13 select ARM_GLOBAL_TIMER
14 select HAVE_ARM_SCU if SMP14 select HAVE_ARM_SCU if SMP
15 select HAVE_ARM_TWD if SMP15 select HAVE_ARM_TWD if SMP
16 select PM_GENERIC_DOMAINS16 select PM_GENERIC_DOMAINS if PM
17 help17 help
18 Support for ZTE ZX296702 SoC which is a dual core CortexA9MP18 Support for ZTE ZX296702 SoC which is a dual core CortexA9MP
19endif19endif
arch/arm64/Kconfig+22−1
@@ -49,7 +49,7 @@ config ARM64 · 48 unmodified lines
49 select HAVE_ARCH_AUDITSYSCALL49 select HAVE_ARCH_AUDITSYSCALL
50 select HAVE_ARCH_BITREVERSE50 select HAVE_ARCH_BITREVERSE
51 select HAVE_ARCH_JUMP_LABEL51 select HAVE_ARCH_JUMP_LABEL
52 select HAVE_ARCH_KASAN if SPARSEMEM_VMEMMAP52 select HAVE_ARCH_KASAN if SPARSEMEM_VMEMMAP && !(ARM64_16K_PAGES && ARM64_VA_BITS_48)
53 select HAVE_ARCH_KGDB53 select HAVE_ARCH_KGDB
54 select HAVE_ARCH_SECCOMP_FILTER54 select HAVE_ARCH_SECCOMP_FILTER
55 select HAVE_ARCH_TRACEHOOK55 select HAVE_ARCH_TRACEHOOK
@@ -316,6 +316,27 @@ config ARM64_ERRATUM_832075 · 260 unmodified lines
316 316
317 If unsure, say Y.317 If unsure, say Y.
318 318
319config 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
319config ARM64_ERRATUM_845719340config ARM64_ERRATUM_845719
320 bool "Cortex-A53: 845719: a load might read incorrect data"341 bool "Cortex-A53: 845719: a load might read incorrect data"
321 depends on COMPAT342 depends on COMPAT
arch/arm64/crypto/aes-ce-cipher.c+1−1
@@ -237,7 +237,7 @@ EXPORT_SYMBOL(ce_aes_setkey); · 236 unmodified lines
237static struct crypto_alg aes_alg = {237static struct crypto_alg aes_alg = {
238 .cra_name = "aes",238 .cra_name = "aes",
239 .cra_driver_name = "aes-ce",239 .cra_driver_name = "aes-ce",
240 .cra_priority = 300,240 .cra_priority = 250,
241 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,241 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
242 .cra_blocksize = AES_BLOCK_SIZE,242 .cra_blocksize = AES_BLOCK_SIZE,
243 .cra_ctxsize = sizeof(struct crypto_aes_ctx),243 .cra_ctxsize = sizeof(struct crypto_aes_ctx),
arch/arm64/include/asm/barrier.h+10−6
@@ -64,27 +64,31 @@ do { \ · 63 unmodified lines
64 64
65#define smp_load_acquire(p) \65#define smp_load_acquire(p) \
66({ \66({ \
67 typeof(*p) ___p1; \67 union { typeof(*p) __val; char __c[1]; } __u; \
68 compiletime_assert_atomic_type(*p); \68 compiletime_assert_atomic_type(*p); \
69 switch (sizeof(*p)) { \69 switch (sizeof(*p)) { \
70 case 1: \70 case 1: \
71 asm volatile ("ldarb %w0, %1" \71 asm volatile ("ldarb %w0, %1" \
72 : "=r" (___p1) : "Q" (*p) : "memory"); \72 : "=r" (*(__u8 *)__u.__c) \
73 : "Q" (*p) : "memory"); \
73 break; \74 break; \
74 case 2: \75 case 2: \
75 asm volatile ("ldarh %w0, %1" \76 asm volatile ("ldarh %w0, %1" \
76 : "=r" (___p1) : "Q" (*p) : "memory"); \77 : "=r" (*(__u16 *)__u.__c) \
78 : "Q" (*p) : "memory"); \
77 break; \79 break; \
78 case 4: \80 case 4: \
79 asm volatile ("ldar %w0, %1" \81 asm volatile ("ldar %w0, %1" \
80 : "=r" (___p1) : "Q" (*p) : "memory"); \82 : "=r" (*(__u32 *)__u.__c) \
83 : "Q" (*p) : "memory"); \
81 break; \84 break; \
82 case 8: \85 case 8: \
83 asm volatile ("ldar %0, %1" \86 asm volatile ("ldar %0, %1" \
84 : "=r" (___p1) : "Q" (*p) : "memory"); \87 : "=r" (*(__u64 *)__u.__c) \
88 : "Q" (*p) : "memory"); \
85 break; \89 break; \
86 } \90 } \
87 ___p1; \91 __u.__val; \
88})92})
89 93
90#define read_barrier_depends() do { } while(0)94#define read_barrier_depends() do { } while(0)
arch/arm64/include/asm/compat.h+1−2
@@ -23,7 +23,6 @@ · 22 unmodified lines
23 */23 */
24#include <linux/types.h>24#include <linux/types.h>
25#include <linux/sched.h>25#include <linux/sched.h>
26#include <linux/ptrace.h>
27 26
28#define COMPAT_USER_HZ 10027#define COMPAT_USER_HZ 100
29#ifdef __AARCH64EB__28#ifdef __AARCH64EB__
@@ -234,7 +233,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr) · 204 unmodified lines
234 return (u32)(unsigned long)uptr;233 return (u32)(unsigned long)uptr;
235}234}
236 235
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)))
238 237
239static inline void __user *arch_compat_alloc_user_space(long len)238static inline void __user *arch_compat_alloc_user_space(long len)
240{239{
arch/arm64/include/asm/cpufeature.h+22−3
@@ -29,8 +29,9 @@ · 28 unmodified lines
29#define ARM64_HAS_PAN 429#define ARM64_HAS_PAN 4
30#define ARM64_HAS_LSE_ATOMICS 530#define ARM64_HAS_LSE_ATOMICS 5
31#define ARM64_WORKAROUND_CAVIUM_23154 631#define ARM64_WORKAROUND_CAVIUM_23154 6
32#define ARM64_WORKAROUND_834220 7
32 33
33#define ARM64_NCAPS 734#define ARM64_NCAPS 8
34 35
35#ifndef __ASSEMBLY__36#ifndef __ASSEMBLY__
36 37
@@ -46,8 +47,12 @@ enum ftr_type { · 9 unmodified lines
46#define FTR_STRICT true /* SANITY check strict matching required */47#define FTR_STRICT true /* SANITY check strict matching required */
47#define FTR_NONSTRICT false /* SANITY check ignored */48#define FTR_NONSTRICT false /* SANITY check ignored */
48 49
50#define FTR_SIGNED true /* Value should be treated as signed */
51#define FTR_UNSIGNED false /* Value should be treated as unsigned */
52
49struct arm64_ftr_bits {53struct 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 ? */
51 enum ftr_type type;56 enum ftr_type type;
52 u8 shift;57 u8 shift;
53 u8 width;58 u8 width;
@@ -123,6 +128,18 @@ cpuid_feature_extract_field(u64 features, int field) · 69 unmodified lines
123 return cpuid_feature_extract_field_width(features, field, 4);128 return cpuid_feature_extract_field_width(features, field, 4);
124}129}
125 130
131static inline unsigned int __attribute_const__
132cpuid_feature_extract_unsigned_field_width(u64 features, int field, int width)
133{
134 return (u64)(features << (64 - width - field)) >> (64 - width);
135}
136
137static inline unsigned int __attribute_const__
138cpuid_feature_extract_unsigned_field(u64 features, int field)
139{
140 return cpuid_feature_extract_unsigned_field_width(features, field, 4);
141}
142
126static inline u64 arm64_ftr_mask(struct arm64_ftr_bits *ftrp)143static inline u64 arm64_ftr_mask(struct arm64_ftr_bits *ftrp)
127{144{
128 return (u64)GENMASK(ftrp->shift + ftrp->width - 1, ftrp->shift);145 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
130 147
131static inline s64 arm64_ftr_value(struct arm64_ftr_bits *ftrp, u64 val)148static inline s64 arm64_ftr_value(struct arm64_ftr_bits *ftrp, u64 val)
132{149{
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);
134}153}
135 154
136static inline bool id_aa64mmfr0_mixed_endian_el0(u64 mmfr0)155static 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
18 18
19#ifdef __KERNEL__19#ifdef __KERNEL__
20 20
21#include <linux/acpi.h>
22#include <linux/types.h>21#include <linux/types.h>
23#include <linux/vmalloc.h>22#include <linux/vmalloc.h>
24 23
@@ -26,22 +25,16 @@ · 1 unmodified line
26#include <asm/xen/hypervisor.h>25#include <asm/xen/hypervisor.h>
27 26
28#define DMA_ERROR_CODE (~(dma_addr_t)0)27#define DMA_ERROR_CODE (~(dma_addr_t)0)
29extern struct dma_map_ops *dma_ops;
30extern struct dma_map_ops dummy_dma_ops;28extern struct dma_map_ops dummy_dma_ops;
31 29
32static inline struct dma_map_ops *__generic_dma_ops(struct device *dev)30static inline struct dma_map_ops *__generic_dma_ops(struct device *dev)
33{31{
34 if (unlikely(!dev))32 if (dev && dev->archdata.dma_ops)
35 return dma_ops;
36 else if (dev->archdata.dma_ops)
37 return dev->archdata.dma_ops;33 return dev->archdata.dma_ops;
38 else if (acpi_disabled)
39 return dma_ops;
40 34
41 /*35 /*
42 * When ACPI is enabled, if arch_set_dma_ops is not called,36 * We expect no ISA devices, and all other DMA masters are expected to
43 * we will disable device DMA capability by setting it37 * have someone call arch_setup_dma_ops at device creation time.
44 * to dummy_dma_ops.
45 */38 */
46 return &dummy_dma_ops;39 return &dummy_dma_ops;
47}40}
arch/arm64/include/asm/hw_breakpoint.h+4−2
@@ -138,16 +138,18 @@ extern struct pmu perf_ops_bp; · 137 unmodified lines
138/* Determine number of BRP registers available. */138/* Determine number of BRP registers available. */
139static inline int get_num_brps(void)139static inline int get_num_brps(void)
140{140{
141 u64 dfr0 = read_system_reg(SYS_ID_AA64DFR0_EL1);
141 return 1 +142 return 1 +
142 cpuid_feature_extract_field(read_system_reg(SYS_ID_AA64DFR0_EL1),143 cpuid_feature_extract_unsigned_field(dfr0,
143 ID_AA64DFR0_BRPS_SHIFT);144 ID_AA64DFR0_BRPS_SHIFT);
144}145}
145 146
146/* Determine number of WRP registers available. */147/* Determine number of WRP registers available. */
147static inline int get_num_wrps(void)148static inline int get_num_wrps(void)
148{149{
150 u64 dfr0 = read_system_reg(SYS_ID_AA64DFR0_EL1);
149 return 1 +151 return 1 +
150 cpuid_feature_extract_field(read_system_reg(SYS_ID_AA64DFR0_EL1),152 cpuid_feature_extract_unsigned_field(dfr0,
151 ID_AA64DFR0_WRPS_SHIFT);153 ID_AA64DFR0_WRPS_SHIFT);
152}154}
153 155
arch/arm64/include/asm/irq.h+5−0
@@ -7,4 +7,9 @@ struct pt_regs; · 6 unmodified lines
7 7
8extern void set_handle_irq(void (*handle_irq)(struct pt_regs *));8extern void set_handle_irq(void (*handle_irq)(struct pt_regs *));
9 9
10static inline int nr_legacy_irqs(void)
11{
12 return 0;
13}
14
10#endif15#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
99 *vcpu_cpsr(vcpu) |= COMPAT_PSR_T_BIT;99 *vcpu_cpsr(vcpu) |= COMPAT_PSR_T_BIT;
100}100}
101 101
102static 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 */
107static inline unsigned long vcpu_get_reg(const struct kvm_vcpu *vcpu,
108 u8 reg_num)
103{109{
104 if (vcpu_mode_is_32bit(vcpu))110 return (reg_num == 31) ? 0 : vcpu_gp_regs(vcpu)->regs.regs[reg_num];
105 return vcpu_reg32(vcpu, reg_num);111}
106 112
107 return (unsigned long *)&vcpu_gp_regs(vcpu)->regs.regs[reg_num];113static 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;
108}118}
109 119
110/* Get vcpu SPSR for current mode */120/* 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
101#define destroy_context(mm) do { } while(0)101#define destroy_context(mm) do { } while(0)
102void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);102void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
103 103
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; })
105 105
106/*106/*
107 * This is called when "tsk" is about to enter lazy TLB mode.107 * 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
81 81
82#define PAGE_KERNEL __pgprot(_PAGE_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE)82#define PAGE_KERNEL __pgprot(_PAGE_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE)
83#define PAGE_KERNEL_RO __pgprot(_PAGE_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_RDONLY)83#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)
84#define PAGE_KERNEL_EXEC __pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_WRITE)85#define PAGE_KERNEL_EXEC __pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_WRITE)
85#define PAGE_KERNEL_EXEC_CONT __pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_CONT)86#define PAGE_KERNEL_EXEC_CONT __pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_CONT)
86 87
arch/arm64/kernel/cpu_errata.c+9−0
@@ -75,6 +75,15 @@ const struct arm64_cpu_capabilities arm64_errata[] = { · 74 unmodified lines
75 (1 << MIDR_VARIANT_SHIFT) | 2),75 (1 << MIDR_VARIANT_SHIFT) | 2),
76 },76 },
77#endif77#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
78#ifdef CONFIG_ARM64_ERRATUM_84571987#ifdef CONFIG_ARM64_ERRATUM_845719
79 {88 {
80 /* Cortex-A53 r0p[01234] */89 /* 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
44 44
45DECLARE_BITMAP(cpu_hwcaps, ARM64_NCAPS);45DECLARE_BITMAP(cpu_hwcaps, ARM64_NCAPS);
46 46
47#define ARM64_FTR_BITS(STRICT, TYPE, SHIFT, WIDTH, SAFE_VAL) \47#define __ARM64_FTR_BITS(SIGNED, STRICT, TYPE, SHIFT, WIDTH, SAFE_VAL) \
48 { \48 { \
49 .sign = SIGNED, \
49 .strict = STRICT, \50 .strict = STRICT, \
50 .type = TYPE, \51 .type = TYPE, \
51 .shift = SHIFT, \52 .shift = SHIFT, \
@@ -53,6 +54,14 @@ DECLARE_BITMAP(cpu_hwcaps, ARM64_NCAPS); · 1 unmodified line
53 .safe_val = SAFE_VAL, \54 .safe_val = SAFE_VAL, \
54 }55 }
55 56
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
56#define ARM64_FTR_END \65#define ARM64_FTR_END \
57 { \66 { \
58 .width = 0, \67 .width = 0, \
@@ -99,7 +108,7 @@ static struct arm64_ftr_bits ftr_id_aa64mmfr0[] = { · 40 unmodified lines
99 * Differing PARange is fine as long as all peripherals and memory are mapped108 * Differing PARange is fine as long as all peripherals and memory are mapped
100 * within the minimum PARange of all CPUs109 * within the minimum PARange of all CPUs
101 */110 */
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),
103 ARM64_FTR_END,112 ARM64_FTR_END,
104};113};
105 114
@@ -115,18 +124,18 @@ static struct arm64_ftr_bits ftr_id_aa64mmfr1[] = { · 9 unmodified lines
115};124};
116 125
117static struct arm64_ftr_bits ftr_ctr[] = {126static 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 */
119 ARM64_FTR_BITS(FTR_STRICT, FTR_EXACT, 28, 3, 0),128 ARM64_FTR_BITS(FTR_STRICT, FTR_EXACT, 28, 3, 0),
120 ARM64_FTR_BITS(FTR_STRICT, FTR_HIGHER_SAFE, 24, 4, 0), /* CWG */129 U_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 */130 U_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 */131 U_ARM64_FTR_BITS(FTR_STRICT, FTR_LOWER_SAFE, 16, 4, 1), /* DminLine */
123 /*132 /*
124 * Linux can handle differing I-cache policies. Userspace JITs will133 * Linux can handle differing I-cache policies. Userspace JITs will
125 * make use of *minLine134 * make use of *minLine
126 */135 */
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 */
128 ARM64_FTR_BITS(FTR_STRICT, FTR_EXACT, 4, 10, 0), /* RAZ */137 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 */
130 ARM64_FTR_END,139 ARM64_FTR_END,
131};140};
132 141
@@ -144,12 +153,12 @@ static struct arm64_ftr_bits ftr_id_mmfr0[] = { · 11 unmodified lines
144 153
145static struct arm64_ftr_bits ftr_id_aa64dfr0[] = {154static struct arm64_ftr_bits ftr_id_aa64dfr0[] = {
146 ARM64_FTR_BITS(FTR_STRICT, FTR_EXACT, 32, 32, 0),155 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),156 U_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),157 U_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),158 U_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),159 U_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),160 U_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),161 U_ARM64_FTR_BITS(FTR_STRICT, FTR_EXACT, ID_AA64DFR0_DEBUGVER_SHIFT, 4, 0x6),
153 ARM64_FTR_END,162 ARM64_FTR_END,
154};163};
155 164
arch/arm64/kernel/cpuinfo.c+5−0
@@ -30,6 +30,7 @@ · 29 unmodified lines
30#include <linux/seq_file.h>30#include <linux/seq_file.h>
31#include <linux/sched.h>31#include <linux/sched.h>
32#include <linux/smp.h>32#include <linux/smp.h>
33#include <linux/delay.h>
33 34
34/*35/*
35 * In case the boot CPU is hotpluggable, we record its initial state and36 * 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
112 */113 */
113 seq_printf(m, "processor\t: %d\n", i);114 seq_printf(m, "processor\t: %d\n", i);
114 115
116 seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
117 loops_per_jiffy / (500000UL/HZ),
118 loops_per_jiffy / (5000UL/HZ) % 100);
119
115 /*120 /*
116 * Dump out the common processor features in a single line.121 * Dump out the common processor features in a single line.
117 * Userspace should read the hwcaps with getauxval(AT_HWCAP)122 * 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
127 table_size = sizeof(efi_config_table_64_t) * efi.systab->nr_tables;127 table_size = sizeof(efi_config_table_64_t) * efi.systab->nr_tables;
128 config_tables = early_memremap(efi_to_phys(efi.systab->tables),128 config_tables = early_memremap(efi_to_phys(efi.systab->tables),
129 table_size);129 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 }
131 retval = efi_config_parse_tables(config_tables, efi.systab->nr_tables,135 retval = efi_config_parse_tables(config_tables, efi.systab->nr_tables,
132 sizeof(efi_config_table_64_t), NULL);136 sizeof(efi_config_table_64_t), NULL);
133 137
@@ -209,6 +213,14 @@ void __init efi_init(void) · 75 unmodified lines
209 PAGE_ALIGN(params.mmap_size + (params.mmap & ~PAGE_MASK)));213 PAGE_ALIGN(params.mmap_size + (params.mmap & ~PAGE_MASK)));
210 memmap.phys_map = params.mmap;214 memmap.phys_map = params.mmap;
211 memmap.map = early_memremap(params.mmap, params.mmap_size);215 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 }
212 memmap.map_end = memmap.map + params.mmap_size;224 memmap.map_end = memmap.map + params.mmap_size;
213 memmap.desc_size = params.desc_size;225 memmap.desc_size = params.desc_size;
214 memmap.desc_version = params.desc_ver;226 memmap.desc_version = params.desc_ver;
@@ -224,8 +236,9 @@ static bool __init efi_virtmap_init(void) · 9 unmodified lines
224{236{
225 efi_memory_desc_t *md;237 efi_memory_desc_t *md;
226 238
239 init_new_context(NULL, &efi_mm);
240
227 for_each_efi_memory_desc(&memmap, md) {241 for_each_efi_memory_desc(&memmap, md) {
228 u64 paddr, npages, size;
229 pgprot_t prot;242 pgprot_t prot;
230 243
231 if (!(md->attribute & EFI_MEMORY_RUNTIME))244 if (!(md->attribute & EFI_MEMORY_RUNTIME))
@@ -233,11 +246,6 @@ static bool __init efi_virtmap_init(void) · 1 unmodified line
233 if (md->virt_addr == 0)246 if (md->virt_addr == 0)
234 return false;247 return false;
235 248
236 paddr = md->phys_addr;
237 npages = md->num_pages;
238 memrange_efi_to_native(&paddr, &npages);
239 size = npages << PAGE_SHIFT;
240
241 pr_info(" EFI remap 0x%016llx => %p\n",249 pr_info(" EFI remap 0x%016llx => %p\n",
242 md->phys_addr, (void *)md->virt_addr);250 md->phys_addr, (void *)md->virt_addr);
243 251
@@ -254,7 +262,9 @@ static bool __init efi_virtmap_init(void) · 10 unmodified lines
254 else262 else
255 prot = PAGE_KERNEL;263 prot = PAGE_KERNEL;
256 264
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));
258 }268 }
259 return true;269 return true;
260}270}
@@ -270,12 +280,12 @@ static int __init arm64_enable_runtime_services(void) · 9 unmodified lines
270 280
271 if (!efi_enabled(EFI_BOOT)) {281 if (!efi_enabled(EFI_BOOT)) {
272 pr_info("EFI services will not be available.\n");282 pr_info("EFI services will not be available.\n");
273 return -1;283 return 0;
274 }284 }
275 285
276 if (efi_runtime_disabled()) {286 if (efi_runtime_disabled()) {
277 pr_info("EFI runtime services will be disabled.\n");287 pr_info("EFI runtime services will be disabled.\n");
278 return -1;288 return 0;
279 }289 }
280 290
281 pr_info("Remapping and enabling EFI services.\n");291 pr_info("Remapping and enabling EFI services.\n");
@@ -285,7 +295,7 @@ static int __init arm64_enable_runtime_services(void) · 3 unmodified lines
285 mapsize);295 mapsize);
286 if (!memmap.map) {296 if (!memmap.map) {
287 pr_err("Failed to remap EFI memory map\n");297 pr_err("Failed to remap EFI memory map\n");
288 return -1;298 return -ENOMEM;
289 }299 }
290 memmap.map_end = memmap.map + mapsize;300 memmap.map_end = memmap.map + mapsize;
291 efi.memmap = &memmap;301 efi.memmap = &memmap;
@@ -294,13 +304,13 @@ static int __init arm64_enable_runtime_services(void) · 2 unmodified lines
294 sizeof(efi_system_table_t));304 sizeof(efi_system_table_t));
295 if (!efi.systab) {305 if (!efi.systab) {
296 pr_err("Failed to remap EFI System Table\n");306 pr_err("Failed to remap EFI System Table\n");
297 return -1;307 return -ENOMEM;
298 }308 }
299 set_bit(EFI_SYSTEM_TABLES, &efi.flags);309 set_bit(EFI_SYSTEM_TABLES, &efi.flags);
300 310
301 if (!efi_virtmap_init()) {311 if (!efi_virtmap_init()) {
302 pr_err("No UEFI virtual mapping was installed -- runtime services will not be available\n");312 pr_err("No UEFI virtual mapping was installed -- runtime services will not be available\n");
303 return -1;313 return -ENOMEM;
304 }314 }
305 315
306 /* Set up runtime services function pointers */316 /* Set up runtime services function pointers */
@@ -329,14 +339,7 @@ core_initcall(arm64_dmi_init); · 22 unmodified lines
329 339
330static void efi_set_pgd(struct mm_struct *mm)340static void efi_set_pgd(struct mm_struct *mm)
331{341{
332 if (mm == &init_mm)342 switch_mm(NULL, mm, NULL);
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();
340}343}
341 344
342void efi_virtmap_load(void)345void efi_virtmap_load(void)
arch/arm64/kernel/suspend.c+10−0
@@ -1,3 +1,4 @@
1#include <linux/ftrace.h>
1#include <linux/percpu.h>2#include <linux/percpu.h>
2#include <linux/slab.h>3#include <linux/slab.h>
3#include <asm/cacheflush.h>4#include <asm/cacheflush.h>
@@ -70,6 +71,13 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long)) · 66 unmodified lines
70 */71 */
71 local_dbg_save(flags);72 local_dbg_save(flags);
72 73
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
73 /*81 /*
74 * mm context saved on the stack, it will be restored when82 * mm context saved on the stack, it will be restored when
75 * the cpu comes out of reset through the identity mapped83 * 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
111 hw_breakpoint_restore(NULL);119 hw_breakpoint_restore(NULL);
112 }120 }
113 121
122 unpause_graph_tracing();
123
114 /*124 /*
115 * Restore pstate flags. OS lock and mdscr have been already125 * Restore pstate flags. OS lock and mdscr have been already
116 * restored, so from this point onwards, debugging is fully126 * 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
37{37{
38 int ret;38 int ret;
39 39
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),
41 kvm_vcpu_hvc_get_imm(vcpu));41 kvm_vcpu_hvc_get_imm(vcpu));
42 42
43 ret = kvm_psci_call(vcpu);43 ret = kvm_psci_call(vcpu);
arch/arm64/kvm/hyp.S+12−2
@@ -864,6 +864,10 @@ ENTRY(__kvm_flush_vm_context) · 863 unmodified lines
864ENDPROC(__kvm_flush_vm_context)864ENDPROC(__kvm_flush_vm_context)
865 865
866__kvm_hyp_panic:866__kvm_hyp_panic:
867 // Stash PAR_EL1 before corrupting it in __restore_sysregs
868 mrs x0, par_el1
869 push x0, xzr
870
867 // Guess the context by looking at VTTBR:871 // Guess the context by looking at VTTBR:
868 // If zero, then we're already a host.872 // If zero, then we're already a host.
869 // Otherwise restore a minimal host context before panicing.873 // Otherwise restore a minimal host context before panicing.
@@ -898,7 +902,7 @@ __kvm_hyp_panic: · 28 unmodified lines
898 mrs x3, esr_el2902 mrs x3, esr_el2
899 mrs x4, far_el2903 mrs x4, far_el2
900 mrs x5, hpfar_el2904 mrs x5, hpfar_el2
901 mrs x6, par_el1905 pop x6, xzr // active context PAR_EL1
902 mrs x7, tpidr_el2906 mrs x7, tpidr_el2
903 907
904 mov lr, #(PSR_F_BIT | PSR_I_BIT | PSR_A_BIT | PSR_D_BIT |\908 mov lr, #(PSR_F_BIT | PSR_I_BIT | PSR_A_BIT | PSR_D_BIT |\
@@ -914,7 +918,7 @@ __kvm_hyp_panic: · 9 unmodified lines
914ENDPROC(__kvm_hyp_panic)918ENDPROC(__kvm_hyp_panic)
915 919
916__hyp_panic_str:920__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"
918 922
919 .align 2923 .align 2
920 924
@@ -1015,9 +1019,15 @@ el1_trap: · 94 unmodified lines
1015 b.ne 1f // Not an abort we care about1019 b.ne 1f // Not an abort we care about
1016 1020
1017 /* This is an abort. Check for permission fault */1021 /* This is an abort. Check for permission fault */
1022alternative_if_not ARM64_WORKAROUND_834220
1018 and x2, x1, #ESR_ELx_FSC_TYPE1023 and x2, x1, #ESR_ELx_FSC_TYPE
1019 cmp x2, #FSC_PERM1024 cmp x2, #FSC_PERM
1020 b.ne 1f // Not a permission fault1025 b.ne 1f // Not a permission fault
1026alternative_else
1027 nop // Use the permission fault path to
1028 nop // check for a valid S1 translation,
1029 nop // regardless of the ESR value.
1030alternative_endif
1021 1031
1022 /*1032 /*
1023 * Check for Stage-1 page table walk, which is guaranteed1033 * 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
48 48
49 /* Note: These now point to the banked copies */49 /* Note: These now point to the banked copies */
50 *vcpu_spsr(vcpu) = new_spsr_value;50 *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;
52 52
53 /* Branch to exception vector */53 /* Branch to exception vector */
54 if (sctlr & (1 << 13))54 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
78 * See note at ARMv7 ARM B1.14.4 (TL;DR: S/W ops are not easily virtualized).78 * See note at ARMv7 ARM B1.14.4 (TL;DR: S/W ops are not easily virtualized).
79 */79 */
80static bool access_dcsw(struct kvm_vcpu *vcpu,80static bool access_dcsw(struct kvm_vcpu *vcpu,
81 const struct sys_reg_params *p,81 struct sys_reg_params *p,
82 const struct sys_reg_desc *r)82 const struct sys_reg_desc *r)
83{83{
84 if (!p->is_write)84 if (!p->is_write)
@@ -94,21 +94,19 @@ static bool access_dcsw(struct kvm_vcpu *vcpu, · 9 unmodified lines
94 * sys_regs and leave it in complete control of the caches.94 * sys_regs and leave it in complete control of the caches.
95 */95 */
96static bool access_vm_reg(struct kvm_vcpu *vcpu,96static bool access_vm_reg(struct kvm_vcpu *vcpu,
97 const struct sys_reg_params *p,97 struct sys_reg_params *p,
98 const struct sys_reg_desc *r)98 const struct sys_reg_desc *r)
99{99{
100 unsigned long val;
101 bool was_enabled = vcpu_has_cache_enabled(vcpu);100 bool was_enabled = vcpu_has_cache_enabled(vcpu);
102 101
103 BUG_ON(!p->is_write);102 BUG_ON(!p->is_write);
104 103
105 val = *vcpu_reg(vcpu, p->Rt);
106 if (!p->is_aarch32) {104 if (!p->is_aarch32) {
107 vcpu_sys_reg(vcpu, r->reg) = val;105 vcpu_sys_reg(vcpu, r->reg) = p->regval;
108 } else {106 } else {
109 if (!p->is_32bit)107 if (!p->is_32bit)
110 vcpu_cp15_64_high(vcpu, r->reg) = val >> 32;108 vcpu_cp15_64_high(vcpu, r->reg) = upper_32_bits(p->regval);
111 vcpu_cp15_64_low(vcpu, r->reg) = val & 0xffffffffUL;109 vcpu_cp15_64_low(vcpu, r->reg) = lower_32_bits(p->regval);
112 }110 }
113 111
114 kvm_toggle_cache(vcpu, was_enabled);112 kvm_toggle_cache(vcpu, was_enabled);
@@ -122,22 +120,19 @@ static bool access_vm_reg(struct kvm_vcpu *vcpu, · 7 unmodified lines
122 * for both AArch64 and AArch32 accesses.120 * for both AArch64 and AArch32 accesses.
123 */121 */
124static bool access_gic_sgi(struct kvm_vcpu *vcpu,122static bool access_gic_sgi(struct kvm_vcpu *vcpu,
125 const struct sys_reg_params *p,123 struct sys_reg_params *p,
126 const struct sys_reg_desc *r)124 const struct sys_reg_desc *r)
127{125{
128 u64 val;
129
130 if (!p->is_write)126 if (!p->is_write)
131 return read_from_write_only(vcpu, p);127 return read_from_write_only(vcpu, p);
132 128
133 val = *vcpu_reg(vcpu, p->Rt);129 vgic_v3_dispatch_sgi(vcpu, p->regval);
134 vgic_v3_dispatch_sgi(vcpu, val);
135 130
136 return true;131 return true;
137}132}
138 133
139static bool trap_raz_wi(struct kvm_vcpu *vcpu,134static bool trap_raz_wi(struct kvm_vcpu *vcpu,
140 const struct sys_reg_params *p,135 struct sys_reg_params *p,
141 const struct sys_reg_desc *r)136 const struct sys_reg_desc *r)
142{137{
143 if (p->is_write)138 if (p->is_write)
@@ -147,19 +142,19 @@ static bool trap_raz_wi(struct kvm_vcpu *vcpu, · 3 unmodified lines
147}142}
148 143
149static bool trap_oslsr_el1(struct kvm_vcpu *vcpu,144static bool trap_oslsr_el1(struct kvm_vcpu *vcpu,
150 const struct sys_reg_params *p,145 struct sys_reg_params *p,
151 const struct sys_reg_desc *r)146 const struct sys_reg_desc *r)
152{147{
153 if (p->is_write) {148 if (p->is_write) {
154 return ignore_write(vcpu, p);149 return ignore_write(vcpu, p);
155 } else {150 } else {
156 *vcpu_reg(vcpu, p->Rt) = (1 << 3);151 p->regval = (1 << 3);
157 return true;152 return true;
158 }153 }
159}154}
160 155
161static bool trap_dbgauthstatus_el1(struct kvm_vcpu *vcpu,156static bool trap_dbgauthstatus_el1(struct kvm_vcpu *vcpu,
162 const struct sys_reg_params *p,157 struct sys_reg_params *p,
163 const struct sys_reg_desc *r)158 const struct sys_reg_desc *r)
164{159{
165 if (p->is_write) {160 if (p->is_write) {
@@ -167,7 +162,7 @@ static bool trap_dbgauthstatus_el1(struct kvm_vcpu *vcpu, · 1 unmodified line
167 } else {162 } else {
168 u32 val;163 u32 val;
169 asm volatile("mrs %0, dbgauthstatus_el1" : "=r" (val));164 asm volatile("mrs %0, dbgauthstatus_el1" : "=r" (val));
170 *vcpu_reg(vcpu, p->Rt) = val;165 p->regval = val;
171 return true;166 return true;
172 }167 }
173}168}
@@ -200,17 +195,17 @@ static bool trap_dbgauthstatus_el1(struct kvm_vcpu *vcpu, · 26 unmodified lines
200 * now use the debug registers.195 * now use the debug registers.
201 */196 */
202static bool trap_debug_regs(struct kvm_vcpu *vcpu,197static bool trap_debug_regs(struct kvm_vcpu *vcpu,
203 const struct sys_reg_params *p,198 struct sys_reg_params *p,
204 const struct sys_reg_desc *r)199 const struct sys_reg_desc *r)
205{200{
206 if (p->is_write) {201 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;
208 vcpu->arch.debug_flags |= KVM_ARM64_DEBUG_DIRTY;203 vcpu->arch.debug_flags |= KVM_ARM64_DEBUG_DIRTY;
209 } else {204 } else {
210 *vcpu_reg(vcpu, p->Rt) = vcpu_sys_reg(vcpu, r->reg);205 p->regval = vcpu_sys_reg(vcpu, r->reg);
211 }206 }
212 207
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);
214 209
215 return true;210 return true;
216}211}
@@ -225,10 +220,10 @@ static bool trap_debug_regs(struct kvm_vcpu *vcpu, · 8 unmodified lines
225 * hyp.S code switches between host and guest values in future.220 * hyp.S code switches between host and guest values in future.
226 */221 */
227static inline void reg_to_dbg(struct kvm_vcpu *vcpu,222static inline void reg_to_dbg(struct kvm_vcpu *vcpu,
228 const struct sys_reg_params *p,223 struct sys_reg_params *p,
229 u64 *dbg_reg)224 u64 *dbg_reg)
230{225{
231 u64 val = *vcpu_reg(vcpu, p->Rt);226 u64 val = p->regval;
232 227
233 if (p->is_32bit) {228 if (p->is_32bit) {
234 val &= 0xffffffffUL;229 val &= 0xffffffffUL;
@@ -240,19 +235,16 @@ static inline void reg_to_dbg(struct kvm_vcpu *vcpu, · 5 unmodified lines
240}235}
241 236
242static inline void dbg_to_reg(struct kvm_vcpu *vcpu,237static inline void dbg_to_reg(struct kvm_vcpu *vcpu,
243 const struct sys_reg_params *p,238 struct sys_reg_params *p,
244 u64 *dbg_reg)239 u64 *dbg_reg)
245{240{
246 u64 val = *dbg_reg;241 p->regval = *dbg_reg;
247
248 if (p->is_32bit)242 if (p->is_32bit)
249 val &= 0xffffffffUL;243 p->regval &= 0xffffffffUL;
250
251 *vcpu_reg(vcpu, p->Rt) = val;
252}244}
253 245
254static inline bool trap_bvr(struct kvm_vcpu *vcpu,246static inline bool trap_bvr(struct kvm_vcpu *vcpu,
255 const struct sys_reg_params *p,247 struct sys_reg_params *p,
256 const struct sys_reg_desc *rd)248 const struct sys_reg_desc *rd)
257{249{
258 u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_bvr[rd->reg];250 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
294}286}
295 287
296static inline bool trap_bcr(struct kvm_vcpu *vcpu,288static inline bool trap_bcr(struct kvm_vcpu *vcpu,
297 const struct sys_reg_params *p,289 struct sys_reg_params *p,
298 const struct sys_reg_desc *rd)290 const struct sys_reg_desc *rd)
299{291{
300 u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_bcr[rd->reg];292 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
337}329}
338 330
339static inline bool trap_wvr(struct kvm_vcpu *vcpu,331static inline bool trap_wvr(struct kvm_vcpu *vcpu,
340 const struct sys_reg_params *p,332 struct sys_reg_params *p,
341 const struct sys_reg_desc *rd)333 const struct sys_reg_desc *rd)
342{334{
343 u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_wvr[rd->reg];335 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
380}372}
381 373
382static inline bool trap_wcr(struct kvm_vcpu *vcpu,374static inline bool trap_wcr(struct kvm_vcpu *vcpu,
383 const struct sys_reg_params *p,375 struct sys_reg_params *p,
384 const struct sys_reg_desc *rd)376 const struct sys_reg_desc *rd)
385{377{
386 u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_wcr[rd->reg];378 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
687};679};
688 680
689static bool trap_dbgidr(struct kvm_vcpu *vcpu,681static bool trap_dbgidr(struct kvm_vcpu *vcpu,
690 const struct sys_reg_params *p,682 struct sys_reg_params *p,
691 const struct sys_reg_desc *r)683 const struct sys_reg_desc *r)
692{684{
693 if (p->is_write) {685 if (p->is_write) {
@@ -697,23 +689,23 @@ static bool trap_dbgidr(struct kvm_vcpu *vcpu, · 3 unmodified lines
697 u64 pfr = read_system_reg(SYS_ID_AA64PFR0_EL1);689 u64 pfr = read_system_reg(SYS_ID_AA64PFR0_EL1);
698 u32 el3 = !!cpuid_feature_extract_field(pfr, ID_AA64PFR0_EL3_SHIFT);690 u32 el3 = !!cpuid_feature_extract_field(pfr, ID_AA64PFR0_EL3_SHIFT);
699 691
700 *vcpu_reg(vcpu, p->Rt) = ((((dfr >> ID_AA64DFR0_WRPS_SHIFT) & 0xf) << 28) |692 p->regval = ((((dfr >> ID_AA64DFR0_WRPS_SHIFT) & 0xf) << 28) |
701 (((dfr >> ID_AA64DFR0_BRPS_SHIFT) & 0xf) << 24) |693 (((dfr >> ID_AA64DFR0_BRPS_SHIFT) & 0xf) << 24) |
702 (((dfr >> ID_AA64DFR0_CTX_CMPS_SHIFT) & 0xf) << 20) |694 (((dfr >> ID_AA64DFR0_CTX_CMPS_SHIFT) & 0xf) << 20)
703 (6 << 16) | (el3 << 14) | (el3 << 12));695 | (6 << 16) | (el3 << 14) | (el3 << 12));
704 return true;696 return true;
705 }697 }
706}698}
707 699
708static bool trap_debug32(struct kvm_vcpu *vcpu,700static bool trap_debug32(struct kvm_vcpu *vcpu,
709 const struct sys_reg_params *p,701 struct sys_reg_params *p,
710 const struct sys_reg_desc *r)702 const struct sys_reg_desc *r)
711{703{
712 if (p->is_write) {704 if (p->is_write) {
713 vcpu_cp14(vcpu, r->reg) = *vcpu_reg(vcpu, p->Rt);705 vcpu_cp14(vcpu, r->reg) = p->regval;
714 vcpu->arch.debug_flags |= KVM_ARM64_DEBUG_DIRTY;706 vcpu->arch.debug_flags |= KVM_ARM64_DEBUG_DIRTY;
715 } else {707 } else {
716 *vcpu_reg(vcpu, p->Rt) = vcpu_cp14(vcpu, r->reg);708 p->regval = vcpu_cp14(vcpu, r->reg);
717 }709 }
718 710
719 return true;711 return true;
@@ -731,7 +723,7 @@ static bool trap_debug32(struct kvm_vcpu *vcpu, · 11 unmodified lines
731 */723 */
732 724
733static inline bool trap_xvr(struct kvm_vcpu *vcpu,725static inline bool trap_xvr(struct kvm_vcpu *vcpu,
734 const struct sys_reg_params *p,726 struct sys_reg_params *p,
735 const struct sys_reg_desc *rd)727 const struct sys_reg_desc *rd)
736{728{
737 u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_bvr[rd->reg];729 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
740 u64 val = *dbg_reg;732 u64 val = *dbg_reg;
741 733
742 val &= 0xffffffffUL;734 val &= 0xffffffffUL;
743 val |= *vcpu_reg(vcpu, p->Rt) << 32;735 val |= p->regval << 32;
744 *dbg_reg = val;736 *dbg_reg = val;
745 737
746 vcpu->arch.debug_flags |= KVM_ARM64_DEBUG_DIRTY;738 vcpu->arch.debug_flags |= KVM_ARM64_DEBUG_DIRTY;
747 } else {739 } else {
748 *vcpu_reg(vcpu, p->Rt) = *dbg_reg >> 32;740 p->regval = *dbg_reg >> 32;
749 }741 }
750 742
751 trace_trap_reg(__func__, rd->reg, p->is_write, *dbg_reg);743 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
991 * Return 0 if the access has been handled, and -1 if not.983 * Return 0 if the access has been handled, and -1 if not.
992 */984 */
993static int emulate_cp(struct kvm_vcpu *vcpu,985static int emulate_cp(struct kvm_vcpu *vcpu,
994 const struct sys_reg_params *params,986 struct sys_reg_params *params,
995 const struct sys_reg_desc *table,987 const struct sys_reg_desc *table,
996 size_t num)988 size_t num)
997{989{
@@ -1062,12 +1054,12 @@ static int kvm_handle_cp_64(struct kvm_vcpu *vcpu, · 64 unmodified lines
1062{1054{
1063 struct sys_reg_params params;1055 struct sys_reg_params params;
1064 u32 hsr = kvm_vcpu_get_hsr(vcpu);1056 u32 hsr = kvm_vcpu_get_hsr(vcpu);
1057 int Rt = (hsr >> 5) & 0xf;
1065 int Rt2 = (hsr >> 10) & 0xf;1058 int Rt2 = (hsr >> 10) & 0xf;
1066 1059
1067 params.is_aarch32 = true;1060 params.is_aarch32 = true;
1068 params.is_32bit = false;1061 params.is_32bit = false;
1069 params.CRm = (hsr >> 1) & 0xf;1062 params.CRm = (hsr >> 1) & 0xf;
1070 params.Rt = (hsr >> 5) & 0xf;
1071 params.is_write = ((hsr & 1) == 0);1063 params.is_write = ((hsr & 1) == 0);
1072 1064
1073 params.Op0 = 0;1065 params.Op0 = 0;
@@ -1076,15 +1068,12 @@ static int kvm_handle_cp_64(struct kvm_vcpu *vcpu, · 2 unmodified lines
1076 params.CRn = 0;1068 params.CRn = 0;
1077 1069
1078 /*1070 /*
1079 * Massive hack here. Store Rt2 in the top 32bits so we only1071 * Make a 64-bit value out of Rt and Rt2. As we use the same trap
1080 * have one register to deal with. As we use the same trap
1081 * backends between AArch32 and AArch64, we get away with it.1072 * backends between AArch32 and AArch64, we get away with it.
1082 */1073 */
1083 if (params.is_write) {1074 if (params.is_write) {
1084 u64 val = *vcpu_reg(vcpu, params.Rt);1075 params.regval = vcpu_get_reg(vcpu, Rt) & 0xffffffff;
1085 val &= 0xffffffff;1076 params.regval |= vcpu_get_reg(vcpu, Rt2) << 32;
1086 val |= *vcpu_reg(vcpu, Rt2) << 32;
1087 *vcpu_reg(vcpu, params.Rt) = val;
1088 }1077 }
1089 1078
1090 if (!emulate_cp(vcpu, &params, target_specific, nr_specific))1079 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
1095 unhandled_cp_access(vcpu, &params);1084 unhandled_cp_access(vcpu, &params);
1096 1085
1097out:1086out:
1098 /* Do the opposite hack for the read side */1087 /* Split up the value between registers for the read side */
1099 if (!params.is_write) {1088 if (!params.is_write) {
1100 u64 val = *vcpu_reg(vcpu, params.Rt);1089 vcpu_set_reg(vcpu, Rt, lower_32_bits(params.regval));
1101 val >>= 32;1090 vcpu_set_reg(vcpu, Rt2, upper_32_bits(params.regval));
1102 *vcpu_reg(vcpu, Rt2) = val;
1103 }1091 }
1104 1092
1105 return 1;1093 return 1;
@@ -1118,21 +1106,24 @@ static int kvm_handle_cp_32(struct kvm_vcpu *vcpu, · 12 unmodified lines
1118{1106{
1119 struct sys_reg_params params;1107 struct sys_reg_params params;
1120 u32 hsr = kvm_vcpu_get_hsr(vcpu);1108 u32 hsr = kvm_vcpu_get_hsr(vcpu);
1109 int Rt = (hsr >> 5) & 0xf;
1121 1110
1122 params.is_aarch32 = true;1111 params.is_aarch32 = true;
1123 params.is_32bit = true;1112 params.is_32bit = true;
1124 params.CRm = (hsr >> 1) & 0xf;1113 params.CRm = (hsr >> 1) & 0xf;
1125 params.Rt = (hsr >> 5) & 0xf;1114 params.regval = vcpu_get_reg(vcpu, Rt);
1126 params.is_write = ((hsr & 1) == 0);1115 params.is_write = ((hsr & 1) == 0);
1127 params.CRn = (hsr >> 10) & 0xf;1116 params.CRn = (hsr >> 10) & 0xf;
1128 params.Op0 = 0;1117 params.Op0 = 0;
1129 params.Op1 = (hsr >> 14) & 0x7;1118 params.Op1 = (hsr >> 14) & 0x7;
1130 params.Op2 = (hsr >> 17) & 0x7;1119 params.Op2 = (hsr >> 17) & 0x7;
1131 1120
1132 if (!emulate_cp(vcpu, &params, target_specific, nr_specific))1121 if (!emulate_cp(vcpu, &params, target_specific, nr_specific) ||
1133 return 1;1122 !emulate_cp(vcpu, &params, global, nr_global)) {
1134 if (!emulate_cp(vcpu, &params, global, nr_global))1123 if (!params.is_write)
1124 vcpu_set_reg(vcpu, Rt, params.regval);
1135 return 1;1125 return 1;
1126 }
1136 1127
1137 unhandled_cp_access(vcpu, &params);1128 unhandled_cp_access(vcpu, &params);
1138 return 1;1129 return 1;
@@ -1175,7 +1166,7 @@ int kvm_handle_cp14_32(struct kvm_vcpu *vcpu, struct kvm_run *run) · 36 unmodified lines
1175}1166}
1176 1167
1177static int emulate_sys_reg(struct kvm_vcpu *vcpu,1168static int emulate_sys_reg(struct kvm_vcpu *vcpu,
1178 const struct sys_reg_params *params)1169 struct sys_reg_params *params)
1179{1170{
1180 size_t num;1171 size_t num;
1181 const struct sys_reg_desc *table, *r;1172 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
1230{1221{
1231 struct sys_reg_params params;1222 struct sys_reg_params params;
1232 unsigned long esr = kvm_vcpu_get_hsr(vcpu);1223 unsigned long esr = kvm_vcpu_get_hsr(vcpu);
1224 int Rt = (esr >> 5) & 0x1f;
1225 int ret;
1233 1226
1234 trace_kvm_handle_sys_reg(esr);1227 trace_kvm_handle_sys_reg(esr);
1235 1228
@@ -1240,10 +1233,14 @@ int kvm_handle_sys_reg(struct kvm_vcpu *vcpu, struct kvm_run *run) · 4 unmodified lines
1240 params.CRn = (esr >> 10) & 0xf;1233 params.CRn = (esr >> 10) & 0xf;
1241 params.CRm = (esr >> 1) & 0xf;1234 params.CRm = (esr >> 1) & 0xf;
1242 params.Op2 = (esr >> 17) & 0x7;1235 params.Op2 = (esr >> 17) & 0x7;
1243 params.Rt = (esr >> 5) & 0x1f;1236 params.regval = vcpu_get_reg(vcpu, Rt);
1244 params.is_write = !(esr & 1);1237 params.is_write = !(esr & 1);
1245 1238
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;
1247}1244}
1248 1245
1249/******************************************************************************1246/******************************************************************************
arch/arm64/kvm/sys_regs.h+4−4
@@ -28,7 +28,7 @@ struct sys_reg_params { · 27 unmodified lines
28 u8 CRn;28 u8 CRn;
29 u8 CRm;29 u8 CRm;
30 u8 Op2;30 u8 Op2;
31 u8 Rt;31 u64 regval;
32 bool is_write;32 bool is_write;
33 bool is_aarch32;33 bool is_aarch32;
34 bool is_32bit; /* Only valid if is_aarch32 is true */34 bool is_32bit; /* Only valid if is_aarch32 is true */
@@ -44,7 +44,7 @@ struct sys_reg_desc { · 9 unmodified lines
44 44
45 /* Trapped access from guest, if non-NULL. */45 /* Trapped access from guest, if non-NULL. */
46 bool (*access)(struct kvm_vcpu *,46 bool (*access)(struct kvm_vcpu *,
47 const struct sys_reg_params *,47 struct sys_reg_params *,
48 const struct sys_reg_desc *);48 const struct sys_reg_desc *);
49 49
50 /* Initialization for vcpu. */50 /* Initialization for vcpu. */
@@ -77,9 +77,9 @@ static inline bool ignore_write(struct kvm_vcpu *vcpu, · 26 unmodified lines
77}77}
78 78
79static inline bool read_zero(struct kvm_vcpu *vcpu,79static inline bool read_zero(struct kvm_vcpu *vcpu,
80 const struct sys_reg_params *p)80 struct sys_reg_params *p)
81{81{
82 *vcpu_reg(vcpu, p->Rt) = 0;82 p->regval = 0;
83 return true;83 return true;
84}84}
85 85
arch/arm64/kvm/sys_regs_generic_v8.c+2−2
@@ -31,13 +31,13 @@ · 30 unmodified lines
31#include "sys_regs.h"31#include "sys_regs.h"
32 32
33static bool access_actlr(struct kvm_vcpu *vcpu,33static bool access_actlr(struct kvm_vcpu *vcpu,
34 const struct sys_reg_params *p,34 struct sys_reg_params *p,
35 const struct sys_reg_desc *r)35 const struct sys_reg_desc *r)
36{36{
37 if (p->is_write)37 if (p->is_write)
38 return ignore_write(vcpu, p);38 return ignore_write(vcpu, p);
39 39
40 *vcpu_reg(vcpu, p->Rt) = vcpu_sys_reg(vcpu, ACTLR_EL1);40 p->regval = vcpu_sys_reg(vcpu, ACTLR_EL1);
41 return true;41 return true;
42}42}
43 43
arch/arm64/mm/context.c+26−12
@@ -76,13 +76,28 @@ static void flush_context(unsigned int cpu) · 75 unmodified lines
76 __flush_icache_all();76 __flush_icache_all();
77}77}
78 78
79static int is_reserved_asid(u64 asid)79static bool check_update_reserved_asid(u64 asid, u64 newasid)
80{80{
81 int cpu;81 int cpu;
82 for_each_possible_cpu(cpu)82 bool hit = false;
83 if (per_cpu(reserved_asids, cpu) == asid)83
84 return 1;84 /*
85 return 0;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;
86}101}
87 102
88static u64 new_context(struct mm_struct *mm, unsigned int cpu)103static 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
92 u64 generation = atomic64_read(&asid_generation);107 u64 generation = atomic64_read(&asid_generation);
93 108
94 if (asid != 0) {109 if (asid != 0) {
110 u64 newasid = generation | (asid & ~ASID_MASK);
111
95 /*112 /*
96 * If our current ASID was active during a rollover, we113 * If our current ASID was active during a rollover, we
97 * can continue to use it and this was just a false alarm.114 * can continue to use it and this was just a false alarm.
98 */115 */
99 if (is_reserved_asid(asid))116 if (check_update_reserved_asid(asid, newasid))
100 return generation | (asid & ~ASID_MASK);117 return newasid;
101 118
102 /*119 /*
103 * We had a valid ASID in a previous life, so try to re-use120 * 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
105 */122 */
106 asid &= ~ASID_MASK;123 asid &= ~ASID_MASK;
107 if (!__test_and_set_bit(asid, asid_map))124 if (!__test_and_set_bit(asid, asid_map))
108 goto bump_gen;125 return newasid;
109 }126 }
110 127
111 /*128 /*
@@ -129,10 +146,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu) · 17 unmodified lines
129set_asid:146set_asid:
130 __set_bit(asid, asid_map);147 __set_bit(asid, asid_map);
131 cur_idx = asid;148 cur_idx = asid;
132 149 return asid | generation;
133bump_gen:
134 asid |= generation;
135 return asid;
136}150}
137 151
138void check_and_switch_context(struct mm_struct *mm, unsigned int cpu)152void 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
18 */18 */
19 19
20#include <linux/gfp.h>20#include <linux/gfp.h>
21#include <linux/acpi.h>
21#include <linux/export.h>22#include <linux/export.h>
22#include <linux/slab.h>23#include <linux/slab.h>
23#include <linux/genalloc.h>24#include <linux/genalloc.h>
@@ -28,9 +29,6 @@ · 4 unmodified lines
28 29
29#include <asm/cacheflush.h>30#include <asm/cacheflush.h>
30 31
31struct dma_map_ops *dma_ops;
32EXPORT_SYMBOL(dma_ops);
33
34static pgprot_t __get_dma_pgprot(struct dma_attrs *attrs, pgprot_t prot,32static pgprot_t __get_dma_pgprot(struct dma_attrs *attrs, pgprot_t prot,
35 bool coherent)33 bool coherent)
36{34{
@@ -515,13 +513,7 @@ EXPORT_SYMBOL(dummy_dma_ops); · 478 unmodified lines
515 513
516static int __init arm64_dma_init(void)514static int __init arm64_dma_init(void)
517{515{
518 int ret;516 return atomic_pool_init();
519
520 dma_ops = &swiotlb_dma_ops;
521
522 ret = atomic_pool_init();
523
524 return ret;
525}517}
526arch_initcall(arm64_dma_init);518arch_initcall(arm64_dma_init);
527 519
@@ -552,10 +544,14 @@ static void *__iommu_alloc_attrs(struct device *dev, size_t size, · 24 unmodified lines
552{544{
553 bool coherent = is_device_dma_coherent(dev);545 bool coherent = is_device_dma_coherent(dev);
554 int ioprot = dma_direction_to_prot(DMA_BIDIRECTIONAL, coherent);546 int ioprot = dma_direction_to_prot(DMA_BIDIRECTIONAL, coherent);
547 size_t iosize = size;
555 void *addr;548 void *addr;
556 549
557 if (WARN(!dev, "cannot create IOMMU mapping for unknown device\n"))550 if (WARN(!dev, "cannot create IOMMU mapping for unknown device\n"))
558 return NULL;551 return NULL;
552
553 size = PAGE_ALIGN(size);
554
559 /*555 /*
560 * Some drivers rely on this, and we probably don't want the556 * Some drivers rely on this, and we probably don't want the
561 * possibility of stale kernel data being read by devices anyway.557 * 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
566 struct page **pages;562 struct page **pages;
567 pgprot_t prot = __get_dma_pgprot(attrs, PAGE_KERNEL, coherent);563 pgprot_t prot = __get_dma_pgprot(attrs, PAGE_KERNEL, coherent);
568 564
569 pages = iommu_dma_alloc(dev, size, gfp, ioprot, handle,565 pages = iommu_dma_alloc(dev, iosize, gfp, ioprot, handle,
570 flush_page);566 flush_page);
571 if (!pages)567 if (!pages)
572 return NULL;568 return NULL;
@@ -574,7 +570,7 @@ static void *__iommu_alloc_attrs(struct device *dev, size_t size, · 1 unmodified line
574 addr = dma_common_pages_remap(pages, size, VM_USERMAP, prot,570 addr = dma_common_pages_remap(pages, size, VM_USERMAP, prot,
575 __builtin_return_address(0));571 __builtin_return_address(0));
576 if (!addr)572 if (!addr)
577 iommu_dma_free(dev, pages, size, handle);573 iommu_dma_free(dev, pages, iosize, handle);
578 } else {574 } else {
579 struct page *page;575 struct page *page;
580 /*576 /*
@@ -591,7 +587,7 @@ static void *__iommu_alloc_attrs(struct device *dev, size_t size, · 10 unmodified lines
591 if (!addr)587 if (!addr)
592 return NULL;588 return NULL;
593 589
594 *handle = iommu_dma_map_page(dev, page, 0, size, ioprot);590 *handle = iommu_dma_map_page(dev, page, 0, iosize, ioprot);
595 if (iommu_dma_mapping_error(dev, *handle)) {591 if (iommu_dma_mapping_error(dev, *handle)) {
596 if (coherent)592 if (coherent)
597 __free_pages(page, get_order(size));593 __free_pages(page, get_order(size));
@@ -606,6 +602,9 @@ static void *__iommu_alloc_attrs(struct device *dev, size_t size, · 8 unmodified lines
606static void __iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr,602static void __iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr,
607 dma_addr_t handle, struct dma_attrs *attrs)603 dma_addr_t handle, struct dma_attrs *attrs)
608{604{
605 size_t iosize = size;
606
607 size = PAGE_ALIGN(size);
609 /*608 /*
610 * @cpu_addr will be one of 3 things depending on how it was allocated:609 * @cpu_addr will be one of 3 things depending on how it was allocated:
611 * - A remapped array of pages from iommu_dma_alloc(), for all610 * - 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
617 * Hence how dodgy the below logic looks...616 * Hence how dodgy the below logic looks...
618 */617 */
619 if (__in_atomic_pool(cpu_addr, size)) {618 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);
621 __free_from_pool(cpu_addr, size);620 __free_from_pool(cpu_addr, size);
622 } else if (is_vmalloc_addr(cpu_addr)){621 } else if (is_vmalloc_addr(cpu_addr)){
623 struct vm_struct *area = find_vm_area(cpu_addr);622 struct vm_struct *area = find_vm_area(cpu_addr);
624 623
625 if (WARN_ON(!area || !area->pages))624 if (WARN_ON(!area || !area->pages))
626 return;625 return;
627 iommu_dma_free(dev, area->pages, size, &handle);626 iommu_dma_free(dev, area->pages, iosize, &handle);
628 dma_common_free_remap(cpu_addr, size, VM_USERMAP);627 dma_common_free_remap(cpu_addr, size, VM_USERMAP);
629 } else {628 } else {
630 iommu_dma_unmap_page(dev, handle, size, 0, NULL);629 iommu_dma_unmap_page(dev, handle, iosize, 0, NULL);
631 __free_pages(virt_to_page(cpu_addr), get_order(size));630 __free_pages(virt_to_page(cpu_addr), get_order(size));
632 }631 }
633}632}
@@ -984,8 +983,8 @@ static void __iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, · 350 unmodified lines
984void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,983void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
985 struct iommu_ops *iommu, bool coherent)984 struct iommu_ops *iommu, bool coherent)
986{985{
987 if (!acpi_disabled && !dev->archdata.dma_ops)986 if (!dev->archdata.dma_ops)
988 dev->archdata.dma_ops = dma_ops;987 dev->archdata.dma_ops = &swiotlb_dma_ops;
989 988
990 dev->archdata.dma_coherent = coherent;989 dev->archdata.dma_coherent = coherent;
991 __iommu_setup_dma_ops(dev, dma_base, size, iommu);990 __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
393 { do_translation_fault, SIGSEGV, SEGV_MAPERR, "level 1 translation fault" },393 { do_translation_fault, SIGSEGV, SEGV_MAPERR, "level 1 translation fault" },
394 { do_translation_fault, SIGSEGV, SEGV_MAPERR, "level 2 translation fault" },394 { do_translation_fault, SIGSEGV, SEGV_MAPERR, "level 2 translation fault" },
395 { do_page_fault, SIGSEGV, SEGV_MAPERR, "level 3 translation fault" },395 { 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" },
397 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 1 access flag fault" },397 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 1 access flag fault" },
398 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 2 access flag fault" },398 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 2 access flag fault" },
399 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 3 access flag fault" },399 { 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" },
401 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 1 permission fault" },401 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 1 permission fault" },
402 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 2 permission fault" },402 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 2 permission fault" },
403 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 3 permission fault" },403 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 3 permission fault" },
404 { do_bad, SIGBUS, 0, "synchronous external abort" },404 { do_bad, SIGBUS, 0, "synchronous external abort" },
405 { do_bad, SIGBUS, 0, "asynchronous external abort" },405 { do_bad, SIGBUS, 0, "unknown 17" },
406 { do_bad, SIGBUS, 0, "unknown 18" },406 { do_bad, SIGBUS, 0, "unknown 18" },
407 { do_bad, SIGBUS, 0, "unknown 19" },407 { do_bad, SIGBUS, 0, "unknown 19" },
408 { do_bad, SIGBUS, 0, "synchronous abort (translation table walk)" },408 { do_bad, SIGBUS, 0, "synchronous abort (translation table walk)" },
@@ -410,16 +410,16 @@ static struct fault_info { · 1 unmodified line
410 { do_bad, SIGBUS, 0, "synchronous abort (translation table walk)" },410 { do_bad, SIGBUS, 0, "synchronous abort (translation table walk)" },
411 { do_bad, SIGBUS, 0, "synchronous abort (translation table walk)" },411 { do_bad, SIGBUS, 0, "synchronous abort (translation table walk)" },
412 { do_bad, SIGBUS, 0, "synchronous parity error" },412 { do_bad, SIGBUS, 0, "synchronous parity error" },
413 { do_bad, SIGBUS, 0, "asynchronous parity error" },413 { do_bad, SIGBUS, 0, "unknown 25" },
414 { do_bad, SIGBUS, 0, "unknown 26" },414 { do_bad, SIGBUS, 0, "unknown 26" },
415 { do_bad, SIGBUS, 0, "unknown 27" },415 { do_bad, SIGBUS, 0, "unknown 27" },
416 { 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" },417 { do_bad, SIGBUS, 0, "synchronous parity error (translation table walk)" },
418 { 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" },419 { do_bad, SIGBUS, 0, "synchronous parity error (translation table walk)" },
420 { do_bad, SIGBUS, 0, "unknown 32" },420 { do_bad, SIGBUS, 0, "unknown 32" },
421 { do_bad, SIGBUS, BUS_ADRALN, "alignment fault" },421 { do_bad, SIGBUS, BUS_ADRALN, "alignment fault" },
422 { do_bad, SIGBUS, 0, "debug event" },422 { do_bad, SIGBUS, 0, "unknown 34" },
423 { do_bad, SIGBUS, 0, "unknown 35" },423 { do_bad, SIGBUS, 0, "unknown 35" },
424 { do_bad, SIGBUS, 0, "unknown 36" },424 { do_bad, SIGBUS, 0, "unknown 36" },
425 { do_bad, SIGBUS, 0, "unknown 37" },425 { do_bad, SIGBUS, 0, "unknown 37" },
@@ -433,21 +433,21 @@ static struct fault_info { · 7 unmodified lines
433 { do_bad, SIGBUS, 0, "unknown 45" },433 { do_bad, SIGBUS, 0, "unknown 45" },
434 { do_bad, SIGBUS, 0, "unknown 46" },434 { do_bad, SIGBUS, 0, "unknown 46" },
435 { do_bad, SIGBUS, 0, "unknown 47" },435 { do_bad, SIGBUS, 0, "unknown 47" },
436 { do_bad, SIGBUS, 0, "unknown 48" },436 { do_bad, SIGBUS, 0, "TLB conflict abort" },
437 { do_bad, SIGBUS, 0, "unknown 49" },437 { do_bad, SIGBUS, 0, "unknown 49" },
438 { do_bad, SIGBUS, 0, "unknown 50" },438 { do_bad, SIGBUS, 0, "unknown 50" },
439 { do_bad, SIGBUS, 0, "unknown 51" },439 { do_bad, SIGBUS, 0, "unknown 51" },
440 { do_bad, SIGBUS, 0, "implementation fault (lockdown abort)" },440 { do_bad, SIGBUS, 0, "implementation fault (lockdown abort)" },
441 { do_bad, SIGBUS, 0, "unknown 53" },441 { do_bad, SIGBUS, 0, "implementation fault (unsupported exclusive)" },
442 { do_bad, SIGBUS, 0, "unknown 54" },442 { do_bad, SIGBUS, 0, "unknown 54" },
443 { do_bad, SIGBUS, 0, "unknown 55" },443 { do_bad, SIGBUS, 0, "unknown 55" },
444 { do_bad, SIGBUS, 0, "unknown 56" },444 { do_bad, SIGBUS, 0, "unknown 56" },
445 { do_bad, SIGBUS, 0, "unknown 57" },445 { do_bad, SIGBUS, 0, "unknown 57" },
446 { do_bad, SIGBUS, 0, "implementation fault (coprocessor abort)" },446 { do_bad, SIGBUS, 0, "unknown 58" },
447 { do_bad, SIGBUS, 0, "unknown 59" },447 { do_bad, SIGBUS, 0, "unknown 59" },
448 { do_bad, SIGBUS, 0, "unknown 60" },448 { do_bad, SIGBUS, 0, "unknown 60" },
449 { do_bad, SIGBUS, 0, "unknown 61" },449 { do_bad, SIGBUS, 0, "section domain fault" },
450 { do_bad, SIGBUS, 0, "unknown 62" },450 { do_bad, SIGBUS, 0, "page domain fault" },
451 { do_bad, SIGBUS, 0, "unknown 63" },451 { do_bad, SIGBUS, 0, "unknown 63" },
452};452};
453 453
arch/arm64/mm/mmu.c+21−70
@@ -64,8 +64,12 @@ EXPORT_SYMBOL(phys_mem_access_prot); · 63 unmodified lines
64 64
65static void __init *early_alloc(unsigned long sz)65static void __init *early_alloc(unsigned long sz)
66{66{
67 void *ptr = __va(memblock_alloc(sz, sz));67 phys_addr_t phys;
68 BUG_ON(!ptr);68 void *ptr;
69
70 phys = memblock_alloc(sz, sz);
71 BUG_ON(!phys);
72 ptr = __va(phys);
69 memset(ptr, 0, sz);73 memset(ptr, 0, sz);
70 return ptr;74 return ptr;
71}75}
@@ -81,55 +85,19 @@ static void split_pmd(pmd_t *pmd, pte_t *pte) · 9 unmodified lines
81 do {85 do {
82 /*86 /*
83 * Need to have the least restrictive permissions available87 * Need to have the least restrictive permissions available
84 * permissions will be fixed up later. Default the new page88 * permissions will be fixed up later
85 * range as contiguous ptes.
86 */89 */
87 set_pte(pte, pfn_pte(pfn, PAGE_KERNEL_EXEC_CONT));90 set_pte(pte, pfn_pte(pfn, PAGE_KERNEL_EXEC));
88 pfn++;91 pfn++;
89 } while (pte++, i++, i < PTRS_PER_PTE);92 } while (pte++, i++, i < PTRS_PER_PTE);
90}93}
91 94
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 */
96static 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 */
111static 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
126static void alloc_init_pte(pmd_t *pmd, unsigned long addr,95static 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,
128 pgprot_t prot,97 pgprot_t prot,
129 void *(*alloc)(unsigned long size))98 void *(*alloc)(unsigned long size))
130{99{
131 pte_t *pte;100 pte_t *pte;
132 unsigned long next;
133 101
134 if (pmd_none(*pmd) || pmd_sect(*pmd)) {102 if (pmd_none(*pmd) || pmd_sect(*pmd)) {
135 pte = alloc(PTRS_PER_PTE * sizeof(pte_t));103 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
142 110
143 pte = pte_offset_kernel(pmd, addr);111 pte = pte_offset_kernel(pmd, addr);
144 do {112 do {
145 next = min(end, (addr + CONT_SIZE) & CONT_MASK);113 set_pte(pte, pfn_pte(pfn, prot));
146 if (((addr | next | phys) & ~CONT_MASK) == 0) {114 pfn++;
147 /* a block of CONT_PTES */115 } while (pte++, addr += PAGE_SIZE, addr != end);
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);
166}116}
167 117
168static void split_pud(pud_t *old_pud, pmd_t *pmd)118static 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
223 }173 }
224 }174 }
225 } else {175 } 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);
227 }178 }
228 phys += next - addr;179 phys += next - addr;
229 } while (pmd++, addr = next, addr != end);180 } 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
362 * for now. This will get more fine grained later once all memory313 * for now. This will get more fine grained later once all memory
363 * is mapped314 * is mapped
364 */315 */
365 unsigned long kernel_x_start = round_down(__pa(_stext), SECTION_SIZE);316 unsigned long kernel_x_start = round_down(__pa(_stext), SWAPPER_BLOCK_SIZE);
366 unsigned long kernel_x_end = round_up(__pa(__init_end), SECTION_SIZE);317 unsigned long kernel_x_end = round_up(__pa(__init_end), SWAPPER_BLOCK_SIZE);
367 318
368 if (end < kernel_x_start) {319 if (end < kernel_x_start) {
369 create_mapping(start, __phys_to_virt(start),320 create_mapping(start, __phys_to_virt(start),
@@ -451,18 +402,18 @@ static void __init fixup_executable(void) · 81 unmodified lines
451{402{
452#ifdef CONFIG_DEBUG_RODATA403#ifdef CONFIG_DEBUG_RODATA
453 /* now that we are actually fully mapped, make the start/end more fine grained */404 /* 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)) {
455 unsigned long aligned_start = round_down(__pa(_stext),406 unsigned long aligned_start = round_down(__pa(_stext),
456 SECTION_SIZE);407 SWAPPER_BLOCK_SIZE);
457 408
458 create_mapping(aligned_start, __phys_to_virt(aligned_start),409 create_mapping(aligned_start, __phys_to_virt(aligned_start),
459 __pa(_stext) - aligned_start,410 __pa(_stext) - aligned_start,
460 PAGE_KERNEL);411 PAGE_KERNEL);
461 }412 }
462 413
463 if (!IS_ALIGNED((unsigned long)__init_end, SECTION_SIZE)) {414 if (!IS_ALIGNED((unsigned long)__init_end, SWAPPER_BLOCK_SIZE)) {
464 unsigned long aligned_end = round_up(__pa(__init_end),415 unsigned long aligned_end = round_up(__pa(__init_end),
465 SECTION_SIZE);416 SWAPPER_BLOCK_SIZE);
466 create_mapping(__pa(__init_end), (unsigned long)__init_end,417 create_mapping(__pa(__init_end), (unsigned long)__init_end,
467 aligned_end - __pa(__init_end),418 aligned_end - __pa(__init_end),
468 PAGE_KERNEL);419 PAGE_KERNEL);
@@ -475,7 +426,7 @@ void mark_rodata_ro(void) · 6 unmodified lines
475{426{
476 create_mapping_late(__pa(_stext), (unsigned long)_stext,427 create_mapping_late(__pa(_stext), (unsigned long)_stext,
477 (unsigned long)_etext - (unsigned long)_stext,428 (unsigned long)_etext - (unsigned long)_stext,
478 PAGE_KERNEL_EXEC | PTE_RDONLY);429 PAGE_KERNEL_ROX);
479 430
480}431}
481#endif432#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
139/* Stack must be multiples of 16B */139/* Stack must be multiples of 16B */
140#define STACK_ALIGN(sz) (((sz) + 15) & ~15)140#define STACK_ALIGN(sz) (((sz) + 15) & ~15)
141 141
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
142static void build_prologue(struct jit_ctx *ctx)148static void build_prologue(struct jit_ctx *ctx)
143{149{
144 const u8 r6 = bpf2a64[BPF_REG_6];150 const u8 r6 = bpf2a64[BPF_REG_6];
@@ -150,10 +156,6 @@ static void build_prologue(struct jit_ctx *ctx) · 5 unmodified lines
150 const u8 rx = bpf2a64[BPF_REG_X];156 const u8 rx = bpf2a64[BPF_REG_X];
151 const u8 tmp1 = bpf2a64[TMP_REG_1];157 const u8 tmp1 = bpf2a64[TMP_REG_1];
152 const u8 tmp2 = bpf2a64[TMP_REG_2];158 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);
157 159
158 /*160 /*
159 * BPF prog stack layout161 * BPF prog stack layout
@@ -165,12 +167,13 @@ static void build_prologue(struct jit_ctx *ctx) · 5 unmodified lines
165 * | ... | callee saved registers167 * | ... | callee saved registers
166 * +-----+168 * +-----+
167 * | | x25/x26169 * | | x25/x26
168 * BPF fp register => -80:+-----+170 * BPF fp register => -80:+-----+ <= (BPF_FP)
169 * | |171 * | |
170 * | ... | BPF prog stack172 * | ... | BPF prog stack
171 * | |173 * | |
172 * | |174 * +-----+ <= (BPF_FP - MAX_BPF_STACK)
173 * current A64_SP => +-----+175 * |RSVD | JIT scratchpad
176 * current A64_SP => +-----+ <= (BPF_FP - STACK_SIZE)
174 * | |177 * | |
175 * | ... | Function call stack178 * | ... | Function call stack
176 * | |179 * | |
@@ -196,7 +199,7 @@ static void build_prologue(struct jit_ctx *ctx) · 19 unmodified lines
196 emit(A64_MOV(1, fp, A64_SP), ctx);199 emit(A64_MOV(1, fp, A64_SP), ctx);
197 200
198 /* Set up function call stack */201 /* 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);
200 203
201 /* Clear registers A and X */204 /* Clear registers A and X */
202 emit_a64_mov_i64(ra, 0, ctx);205 emit_a64_mov_i64(ra, 0, ctx);
@@ -213,13 +216,9 @@ static void build_epilogue(struct jit_ctx *ctx) · 10 unmodified lines
213 const u8 fp = bpf2a64[BPF_REG_FP];216 const u8 fp = bpf2a64[BPF_REG_FP];
214 const u8 tmp1 = bpf2a64[TMP_REG_1];217 const u8 tmp1 = bpf2a64[TMP_REG_1];
215 const u8 tmp2 = bpf2a64[TMP_REG_2];218 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);
220 219
221 /* We're done with BPF stack */220 /* 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);
223 222
224 /* Restore fs (x25) and x26 */223 /* Restore fs (x25) and x26 */
225 emit(A64_POP(fp, A64_R(26), A64_SP), ctx);224 emit(A64_POP(fp, A64_R(26), A64_SP), ctx);
@@ -591,7 +590,25 @@ emit_cond_jmp: · 365 unmodified lines
591 case BPF_ST | BPF_MEM | BPF_H:590 case BPF_ST | BPF_MEM | BPF_H:
592 case BPF_ST | BPF_MEM | BPF_B:591 case BPF_ST | BPF_MEM | BPF_B:
593 case BPF_ST | BPF_MEM | BPF_DW:592 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;
595 612
596 /* STX: *(size *)(dst + off) = src */613 /* STX: *(size *)(dst + off) = src */
597 case BPF_STX | BPF_MEM | BPF_W:614 case BPF_STX | BPF_MEM | BPF_W:
@@ -658,7 +675,7 @@ emit_cond_jmp: · 60 unmodified lines
658 return -EINVAL;675 return -EINVAL;
659 }676 }
660 emit_a64_mov_i64(r3, size, ctx);677 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);
662 emit_a64_mov_i64(r5, (unsigned long)bpf_load_pointer, ctx);679 emit_a64_mov_i64(r5, (unsigned long)bpf_load_pointer, ctx);
663 emit(A64_PUSH(A64_FP, A64_LR, A64_SP), ctx);680 emit(A64_PUSH(A64_FP, A64_LR, A64_SP), ctx);
664 emit(A64_MOV(1, A64_FP, A64_SP), ctx);681 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
98 memstart = PAGE_ALIGN(_ramstart);98 memstart = PAGE_ALIGN(_ramstart);
99 min_low_pfn = PFN_DOWN(_rambase);99 min_low_pfn = PFN_DOWN(_rambase);
100 start_pfn = PFN_DOWN(memstart);100 start_pfn = PFN_DOWN(memstart);
101 max_low_pfn = PFN_DOWN(_ramend);101 max_pfn = max_low_pfn = PFN_DOWN(_ramend);
102 high_memory = (void *)_ramend;102 high_memory = (void *)_ramend;
103 103
104 m68k_virt_to_node_shift = fls(_ramend - _rambase - 1) - 6;104 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
4#include <uapi/asm/unistd.h>4#include <uapi/asm/unistd.h>
5 5
6 6
7#define NR_syscalls 3757#define NR_syscalls 376
8 8
9#define __ARCH_WANT_OLD_READDIR9#define __ARCH_WANT_OLD_READDIR
10#define __ARCH_WANT_OLD_STAT10#define __ARCH_WANT_OLD_STAT
arch/m68k/include/uapi/asm/unistd.h+1−0
@@ -380,5 +380,6 @@ · 379 unmodified lines
380#define __NR_sendmmsg 372380#define __NR_sendmmsg 372
381#define __NR_userfaultfd 373381#define __NR_userfaultfd 373
382#define __NR_membarrier 374382#define __NR_membarrier 374
383#define __NR_mlock2 375
383 384
384#endif /* _UAPI_ASM_M68K_UNISTD_H_ */385#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
238 * Give all the memory to the bootmap allocator, tell it to put the238 * Give all the memory to the bootmap allocator, tell it to put the
239 * boot mem_map at the start of memory.239 * boot mem_map at the start of memory.
240 */240 */
241 min_low_pfn = PFN_DOWN(memory_start);
242 max_pfn = max_low_pfn = PFN_DOWN(memory_end);
243
241 bootmap_size = init_bootmem_node(244 bootmap_size = init_bootmem_node(
242 NODE_DATA(0),245 NODE_DATA(0),
243 memory_start >> PAGE_SHIFT, /* map goes here */246 min_low_pfn, /* map goes here */
244 PAGE_OFFSET >> PAGE_SHIFT, /* 0 on coldfire */247 PFN_DOWN(PAGE_OFFSET),
245 memory_end >> PAGE_SHIFT);248 max_pfn);
246 /*249 /*
247 * Free the usable memory, we have to make sure we do not free250 * Free the usable memory, we have to make sure we do not free
248 * the bootmem bitmap so we then reserve it after freeing it :-)251 * 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
395 .long sys_sendmmsg395 .long sys_sendmmsg
396 .long sys_userfaultfd396 .long sys_userfaultfd
397 .long sys_membarrier397 .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
250 high_memory = phys_to_virt(max_addr);250 high_memory = phys_to_virt(max_addr);
251 251
252 min_low_pfn = availmem >> PAGE_SHIFT;252 min_low_pfn = availmem >> PAGE_SHIFT;
253 max_low_pfn = max_addr >> PAGE_SHIFT;253 max_pfn = max_low_pfn = max_addr >> PAGE_SHIFT;
254 254
255 for (i = 0; i < m68k_num_memory; i++) {255 for (i = 0; i < m68k_num_memory; i++) {
256 addr = m68k_memory[i].addr;256 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
118 memory_end = memory_end & PAGE_MASK;118 memory_end = memory_end & PAGE_MASK;
119 119
120 start_page = __pa(memory_start) >> PAGE_SHIFT;120 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;
122 122
123 high_memory = (void *)memory_end;123 high_memory = (void *)memory_end;
124 availmem = memory_start;124 availmem = memory_start;
125 125
126 m68k_setup_node(0);126 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);
128 availmem = (availmem + (PAGE_SIZE-1)) & PAGE_MASK;128 availmem = (availmem + (PAGE_SIZE-1)) & PAGE_MASK;
129 129
130 free_bootmem(__pa(availmem), memory_end - (availmem));130 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
216 AR71XX_RESET_SIZE);216 AR71XX_RESET_SIZE);
217 ath79_pll_base = ioremap_nocache(AR71XX_PLL_BASE,217 ath79_pll_base = ioremap_nocache(AR71XX_PLL_BASE,
218 AR71XX_PLL_SIZE);218 AR71XX_PLL_SIZE);
219 ath79_detect_sys_type();
219 ath79_ddr_ctrl_init();220 ath79_ddr_ctrl_init();
220 221
221 ath79_detect_sys_type();
222 if (mips_machtype != ATH79_MACH_GENERIC_OF)222 if (mips_machtype != ATH79_MACH_GENERIC_OF)
223 detect_memory_region(0, ATH79_MEM_SIZE_MIN, ATH79_MEM_SIZE_MAX);223 detect_memory_region(0, ATH79_MEM_SIZE_MIN, ATH79_MEM_SIZE_MAX);
224 224
@@ -281,3 +281,8 @@ MIPS_MACHINE(ATH79_MACH_GENERIC, · 56 unmodified lines
281 "Generic",281 "Generic",
282 "Generic AR71XX/AR724X/AR913X based board",282 "Generic AR71XX/AR724X/AR913X based board",
283 ath79_generic_init);283 ath79_generic_init);
284
285MIPS_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
107 miscintc: interrupt-controller@18060010 {107 miscintc: interrupt-controller@18060010 {
108 compatible = "qca,ar9132-misc-intc",108 compatible = "qca,ar9132-misc-intc",
109 "qca,ar7100-misc-intc";109 "qca,ar7100-misc-intc";
110 reg = <0x18060010 0x4>;110 reg = <0x18060010 0x8>;
111 111
112 interrupt-parent = <&cpuintc>;112 interrupt-parent = <&cpuintc>;
113 interrupts = <6>;113 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
200{200{
201 /* avoid <linux/mm.h> include hell */201 /* avoid <linux/mm.h> include hell */
202 extern unsigned long max_mapnr;202 extern unsigned long max_mapnr;
203 unsigned long pfn_offset = ARCH_PFN_OFFSET;
203 204
204 return pfn >= ARCH_PFN_OFFSET && pfn < max_mapnr;205 return pfn >= pfn_offset && pfn < max_mapnr;
205}206}
206 207
207#elif defined(CONFIG_SPARSEMEM)208#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
1581 1581
1582 base = (inst >> 21) & 0x1f;1582 base = (inst >> 21) & 0x1f;
1583 op_inst = (inst >> 16) & 0x1f;1583 op_inst = (inst >> 16) & 0x1f;
1584 offset = inst & 0xffff;1584 offset = (int16_t)inst;
1585 cache = (inst >> 16) & 0x3;1585 cache = (inst >> 16) & 0x3;
1586 op = (inst >> 18) & 0x7;1586 op = (inst >> 18) & 0x7;
1587 1587
arch/mips/kvm/locore.S+10−6
@@ -157,9 +157,11 @@ FEXPORT(__kvm_mips_vcpu_run) · 156 unmodified lines
157 157
158FEXPORT(__kvm_mips_load_asid)158FEXPORT(__kvm_mips_load_asid)
159 /* Set the ASID for the Guest Kernel */159 /* Set the ASID for the Guest Kernel */
160 INT_SLL t0, t0, 1 /* with kseg0 @ 0x40000000, kernel */160 PTR_L t0, VCPU_COP0(k1)
161 /* addresses shift to 0x80000000 */161 LONG_L t0, COP0_STATUS(t0)
162 bltz t0, 1f /* If kernel */162 andi t0, KSU_USER | ST0_ERL | ST0_EXL
163 xori t0, KSU_USER
164 bnez t0, 1f /* If kernel */
163 INT_ADDIU t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */165 INT_ADDIU t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */
164 INT_ADDIU t1, k1, VCPU_GUEST_USER_ASID /* else user */166 INT_ADDIU t1, k1, VCPU_GUEST_USER_ASID /* else user */
1651:1671:
@@ -474,9 +476,11 @@ __kvm_mips_return_to_guest: · 308 unmodified lines
474 mtc0 t0, CP0_EPC476 mtc0 t0, CP0_EPC
475 477
476 /* Set the ASID for the Guest Kernel */478 /* Set the ASID for the Guest Kernel */
477 INT_SLL t0, t0, 1 /* with kseg0 @ 0x40000000, kernel */479 PTR_L t0, VCPU_COP0(k1)
478 /* addresses shift to 0x80000000 */480 LONG_L t0, COP0_STATUS(t0)
479 bltz t0, 1f /* If kernel */481 andi t0, KSU_USER | ST0_ERL | ST0_EXL
482 xori t0, KSU_USER
483 bnez t0, 1f /* If kernel */
480 INT_ADDIU t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */484 INT_ADDIU t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */
481 INT_ADDIU t1, k1, VCPU_GUEST_USER_ASID /* else user */485 INT_ADDIU t1, k1, VCPU_GUEST_USER_ASID /* else user */
4821:4861:
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
279 279
280 if (!gebase) {280 if (!gebase) {
281 err = -ENOMEM;281 err = -ENOMEM;
282 goto out_free_cpu;282 goto out_uninit_cpu;
283 }283 }
284 kvm_debug("Allocated %d bytes for KVM Exception Handlers @ %p\n",284 kvm_debug("Allocated %d bytes for KVM Exception Handlers @ %p\n",
285 ALIGN(size, PAGE_SIZE), gebase);285 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
343out_free_gebase:343out_free_gebase:
344 kfree(gebase);344 kfree(gebase);
345 345
346out_uninit_cpu:
347 kvm_vcpu_uninit(vcpu);
348
346out_free_cpu:349out_free_cpu:
347 kfree(vcpu);350 kfree(vcpu);
348 351
arch/mips/pci/pci-rt2880.c+2−2
@@ -11,6 +11,7 @@ · 10 unmodified lines
11 * by the Free Software Foundation.11 * by the Free Software Foundation.
12 */12 */
13 13
14#include <linux/delay.h>
14#include <linux/types.h>15#include <linux/types.h>
15#include <linux/pci.h>16#include <linux/pci.h>
16#include <linux/io.h>17#include <linux/io.h>
@@ -232,8 +233,7 @@ static int rt288x_pci_probe(struct platform_device *pdev) · 215 unmodified lines
232 ioport_resource.end = RT2880_PCI_IO_BASE + RT2880_PCI_IO_SIZE - 1;233 ioport_resource.end = RT2880_PCI_IO_BASE + RT2880_PCI_IO_SIZE - 1;
233 234
234 rt2880_pci_reg_write(0, RT2880_PCI_REG_PCICFG_ADDR);235 rt2880_pci_reg_write(0, RT2880_PCI_REG_PCICFG_ADDR);
235 for (i = 0; i < 0xfffff; i++)236 udelay(1);
236 ;
237 237
238 rt2880_pci_reg_write(0x79, RT2880_PCI_REG_ARBCTL);238 rt2880_pci_reg_write(0x79, RT2880_PCI_REG_ARBCTL);
239 rt2880_pci_reg_write(0x07FF0001, RT2880_PCI_REG_BAR0SETUP_ADDR);239 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
10 * option) any later version.10 * option) any later version.
11 */11 */
12 12
13#include <linux/delay.h>
14
13#include <asm/bootinfo.h>15#include <asm/bootinfo.h>
14#include <asm/cacheflush.h>16#include <asm/cacheflush.h>
15#include <asm/idle.h>17#include <asm/idle.h>
@@ -77,7 +79,7 @@ void msp7120_reset(void) · 61 unmodified lines
77 */79 */
78 80
79 /* Wait a bit for the DDRC to settle */81 /* Wait a bit for the DDRC to settle */
80 for (i = 0; i < 100000000; i++);82 mdelay(125);
81 83
82#if defined(CONFIG_PMC_MSP7120_GW)84#if defined(CONFIG_PMC_MSP7120_GW)
83 /*85 /*
arch/mips/sni/reset.c+4−2
@@ -3,6 +3,8 @@ · 2 unmodified lines
3 *3 *
4 * Reset a SNI machine.4 * Reset a SNI machine.
5 */5 */
6#include <linux/delay.h>
7
6#include <asm/io.h>8#include <asm/io.h>
7#include <asm/reboot.h>9#include <asm/reboot.h>
8#include <asm/sni.h>10#include <asm/sni.h>
@@ -32,9 +34,9 @@ void sni_machine_restart(char *command) · 23 unmodified lines
32 for (;;) {34 for (;;) {
33 for (i = 0; i < 100; i++) {35 for (i = 0; i < 100; i++) {
34 kb_wait();36 kb_wait();
35 for (j = 0; j < 100000 ; j++)37 udelay(50);
36 /* nothing */;
37 outb_p(0xfe, 0x64); /* pulse reset low */38 outb_p(0xfe, 0x64); /* pulse reset low */
39 udelay(50);
38 }40 }
39 }41 }
40}42}
arch/mn10300/Kconfig+1−3
@@ -1,6 +1,7 @@
1config MN103001config MN10300
2 def_bool y2 def_bool y
3 select HAVE_OPROFILE3 select HAVE_OPROFILE
4 select HAVE_UID16
4 select GENERIC_IRQ_SHOW5 select GENERIC_IRQ_SHOW
5 select ARCH_WANT_IPC_PARSE_VERSION6 select ARCH_WANT_IPC_PARSE_VERSION
6 select HAVE_ARCH_TRACEHOOK7 select HAVE_ARCH_TRACEHOOK
@@ -37,9 +38,6 @@ config HIGHMEM · 30 unmodified lines
37config NUMA38config NUMA
38 def_bool n39 def_bool n
39 40
40config UID16
41 def_bool y
42
43config RWSEM_GENERIC_SPINLOCK41config RWSEM_GENERIC_SPINLOCK
44 def_bool y42 def_bool y
45 43
arch/nios2/mm/cacheflush.c+4−20
@@ -23,22 +23,6 @@ static void __flush_dcache(unsigned long start, unsigned long end) · 22 unmodified lines
23 end += (cpuinfo.dcache_line_size - 1);23 end += (cpuinfo.dcache_line_size - 1);
24 end &= ~(cpuinfo.dcache_line_size - 1);24 end &= ~(cpuinfo.dcache_line_size - 1);
25 25
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
34static 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
42 if (end > start + cpuinfo.dcache_size)26 if (end > start + cpuinfo.dcache_size)
43 end = start + cpuinfo.dcache_size;27 end = start + cpuinfo.dcache_size;
44 28
@@ -112,7 +96,7 @@ static void flush_aliases(struct address_space *mapping, struct page *page) · 67 unmodified lines
112 96
113void flush_cache_all(void)97void flush_cache_all(void)
114{98{
115 __flush_dcache_all(0, cpuinfo.dcache_size);99 __flush_dcache(0, cpuinfo.dcache_size);
116 __flush_icache(0, cpuinfo.icache_size);100 __flush_icache(0, cpuinfo.icache_size);
117}101}
118 102
@@ -182,7 +166,7 @@ void __flush_dcache_page(struct address_space *mapping, struct page *page) · 63 unmodified lines
182 */166 */
183 unsigned long start = (unsigned long)page_address(page);167 unsigned long start = (unsigned long)page_address(page);
184 168
185 __flush_dcache_all(start, start + PAGE_SIZE);169 __flush_dcache(start, start + PAGE_SIZE);
186}170}
187 171
188void flush_dcache_page(struct page *page)172void 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
268{252{
269 flush_cache_page(vma, user_vaddr, page_to_pfn(page));253 flush_cache_page(vma, user_vaddr, page_to_pfn(page));
270 memcpy(dst, src, len);254 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);
272 if (vma->vm_flags & VM_EXEC)256 if (vma->vm_flags & VM_EXEC)
273 __flush_icache((unsigned long)src, (unsigned long)src + len);257 __flush_icache((unsigned long)src, (unsigned long)src + len);
274}258}
@@ -279,7 +263,7 @@ void copy_to_user_page(struct vm_area_struct *vma, struct page *page, · 4 unmodified lines
279{263{
280 flush_cache_page(vma, user_vaddr, page_to_pfn(page));264 flush_cache_page(vma, user_vaddr, page_to_pfn(page));
281 memcpy(dst, src, len);265 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);
283 if (vma->vm_flags & VM_EXEC)267 if (vma->vm_flags & VM_EXEC)
284 __flush_icache((unsigned long)dst, (unsigned long)dst + len);268 __flush_icache((unsigned long)dst, (unsigned long)dst + len);
285}269}
arch/parisc/Kconfig+3−0
@@ -108,6 +108,9 @@ config PGTABLE_LEVELS · 107 unmodified lines
108 default 3 if 64BIT && PARISC_PAGE_SIZE_4KB108 default 3 if 64BIT && PARISC_PAGE_SIZE_4KB
109 default 2109 default 2
110 110
111config SYS_SUPPORTS_HUGETLBFS
112 def_bool y if PA20
113
111source "init/Kconfig"114source "init/Kconfig"
112 115
113source "kernel/Kconfig.freezer"116source "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
8void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
9 pte_t *ptep, pte_t pte);
10
11pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
12 pte_t *ptep);
13
14static 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 */
24static 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
34static 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
42static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
43 unsigned long addr, pte_t *ptep)
44{
45}
46
47static inline int huge_pte_none(pte_t pte)
48{
49 return pte_none(pte);
50}
51
52static inline pte_t huge_pte_wrprotect(pte_t pte)
53{
54 return pte_wrprotect(pte);
55}
56
57static 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
64static 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
76static inline pte_t huge_ptep_get(pte_t *ptep)
77{
78 return *ptep;
79}
80
81static 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
145#endif /* CONFIG_DISCONTIGMEM */145#endif /* CONFIG_DISCONTIGMEM */
146 146
147#ifdef CONFIG_HUGETLB_PAGE147#ifdef CONFIG_HUGETLB_PAGE
148#define HPAGE_SHIFT 22 /* 4MB (is this fixed?) */148#define HPAGE_SHIFT PMD_SHIFT /* fixed for transparent huge pages */
149#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT)149#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT)
150#define HPAGE_MASK (~(HPAGE_SIZE - 1))150#define HPAGE_MASK (~(HPAGE_SIZE - 1))
151#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)151#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
152#endif162#endif
163#endif /* CONFIG_HUGETLB_PAGE */
153 164
154#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)165#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
155 166
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
35 PxD_FLAG_VALID | 35 PxD_FLAG_VALID |
36 PxD_FLAG_ATTACHED) 36 PxD_FLAG_ATTACHED)
37 + (__u32)(__pa((unsigned long)pgd) >> PxD_VALUE_SHIFT));37 + (__u32)(__pa((unsigned long)pgd) >> PxD_VALUE_SHIFT));
38 /* The first pmd entry also is marked with _PAGE_GATEWAY as38 /* The first pmd entry also is marked with PxD_FLAG_ATTACHED as
39 * a signal that this pmd may not be freed */39 * a signal that this pmd may not be freed */
40 __pgd_val_set(*pgd, PxD_FLAG_ATTACHED);40 __pgd_val_set(*pgd, PxD_FLAG_ATTACHED);
41#endif41#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
83 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, (unsigned long)pgd_val(e))83 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, (unsigned long)pgd_val(e))
84 84
85/* This is the size of the initially mapped kernel memory */85/* 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
87#define KERNEL_INITIAL_SIZE (1 << KERNEL_INITIAL_ORDER)91#define KERNEL_INITIAL_SIZE (1 << KERNEL_INITIAL_ORDER)
88 92
89#if CONFIG_PGTABLE_LEVELS == 393#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
167#define _PAGE_NO_CACHE_BIT 24 /* (0x080) Uncached Page (U bit) */171#define _PAGE_NO_CACHE_BIT 24 /* (0x080) Uncached Page (U bit) */
168#define _PAGE_ACCESSED_BIT 23 /* (0x100) Software: Page Accessed */172#define _PAGE_ACCESSED_BIT 23 /* (0x100) Software: Page Accessed */
169#define _PAGE_PRESENT_BIT 22 /* (0x200) Software: translation valid */173#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 */
171#define _PAGE_USER_BIT 20 /* (0x800) Software: User accessible page */175#define _PAGE_USER_BIT 20 /* (0x800) Software: User accessible page */
172 176
173/* N.B. The bits are defined in terms of a 32 bit word above, so the */177/* 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
194#define _PAGE_NO_CACHE (1 << xlate_pabit(_PAGE_NO_CACHE_BIT))198#define _PAGE_NO_CACHE (1 << xlate_pabit(_PAGE_NO_CACHE_BIT))
195#define _PAGE_ACCESSED (1 << xlate_pabit(_PAGE_ACCESSED_BIT))199#define _PAGE_ACCESSED (1 << xlate_pabit(_PAGE_ACCESSED_BIT))
196#define _PAGE_PRESENT (1 << xlate_pabit(_PAGE_PRESENT_BIT))200#define _PAGE_PRESENT (1 << xlate_pabit(_PAGE_PRESENT_BIT))
201#define _PAGE_HUGE (1 << xlate_pabit(_PAGE_HPAGE_BIT))
197#define _PAGE_USER (1 << xlate_pabit(_PAGE_USER_BIT))202#define _PAGE_USER (1 << xlate_pabit(_PAGE_USER_BIT))
198 203
199#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | _PAGE_DIRTY | _PAGE_ACCESSED)204#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
217#define PxD_FLAG_VALID (1 << xlate_pabit(_PxD_VALID_BIT))222#define PxD_FLAG_VALID (1 << xlate_pabit(_PxD_VALID_BIT))
218#define PxD_FLAG_MASK (0xf)223#define PxD_FLAG_MASK (0xf)
219#define PxD_FLAG_SHIFT (4)224#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)
221 226
222#ifndef __ASSEMBLY__227#ifndef __ASSEMBLY__
223 228
@@ -362,6 +367,18 @@ static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; ret · 138 unmodified lines
362static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_WRITE; return pte; }367static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_WRITE; return pte; }
363static inline pte_t pte_mkspecial(pte_t pte) { return pte; }368static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
364 369
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
365/*382/*
366 * Conversion functions: convert a page and protection to a page entry,383 * Conversion functions: convert a page and protection to a page entry,
367 * and a page entry and page directory to the page they refer to.384 * 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
410/* Find an entry in the second-level page table.. */427/* Find an entry in the second-level page table.. */
411 428
412#if CONFIG_PGTABLE_LEVELS == 3429#if CONFIG_PGTABLE_LEVELS == 3
430#define pmd_index(addr) (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))
413#define pmd_offset(dir,address) \431#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))
415#else433#else
416#define pmd_offset(dir,addr) ((pmd_t *) dir)434#define pmd_offset(dir,addr) ((pmd_t *) dir)
417#endif435#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
192 */192 */
193typedef unsigned int elf_caddr_t;193typedef unsigned int elf_caddr_t;
194 194
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
222/* The ELF abi wants things done a "wee bit" differently than195/* The ELF abi wants things done a "wee bit" differently than
223 * som does. Supporting this behavior here avoids196 * som does. Supporting this behavior here avoids
224 * having our own version of create_elf_tables.197 * having our own version of create_elf_tables.
arch/parisc/include/uapi/asm/mman.h+0−10
@@ -49,16 +49,6 @@ · 48 unmodified lines
49#define MADV_DONTFORK 10 /* don't inherit across fork */49#define MADV_DONTFORK 10 /* don't inherit across fork */
50#define MADV_DOFORK 11 /* do inherit across fork */50#define MADV_DOFORK 11 /* do inherit across fork */
51 51
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
62#define MADV_MERGEABLE 65 /* KSM may merge identical pages */52#define MADV_MERGEABLE 65 /* KSM may merge identical pages */
63#define MADV_UNMERGEABLE 66 /* KSM may not merge identical pages */53#define MADV_UNMERGEABLE 66 /* KSM may not merge identical pages */
64 54
arch/parisc/kernel/asm-offsets.c+8−0
@@ -289,6 +289,14 @@ int main(void) · 288 unmodified lines
289 DEFINE(ASM_PTE_ENTRY_SIZE, PTE_ENTRY_SIZE);289 DEFINE(ASM_PTE_ENTRY_SIZE, PTE_ENTRY_SIZE);
290 DEFINE(ASM_PFN_PTE_SHIFT, PFN_PTE_SHIFT);290 DEFINE(ASM_PFN_PTE_SHIFT, PFN_PTE_SHIFT);
291 DEFINE(ASM_PT_INITIAL, PT_INITIAL);291 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
292 BLANK();300 BLANK();
293 DEFINE(EXCDATA_IP, offsetof(struct exception_data, fault_ip));301 DEFINE(EXCDATA_IP, offsetof(struct exception_data, fault_ip));
294 DEFINE(EXCDATA_SPACE, offsetof(struct exception_data, fault_space));302 DEFINE(EXCDATA_SPACE, offsetof(struct exception_data, fault_space));
arch/parisc/kernel/entry.S+34−22
@@ -502,21 +502,38 @@ · 501 unmodified lines
502 STREG \pte,0(\ptp)502 STREG \pte,0(\ptp)
503 .endm503 .endm
504 504
505 /* We have (depending on the page size):
506 * - 38 to 52-bit Physical Page Number
507 * - 12 to 26-bit page offset
508 */
505 /* bitshift difference between a PFN (based on kernel's PAGE_SIZE)509 /* bitshift difference between a PFN (based on kernel's PAGE_SIZE)
506 * to a CPU TLB 4k PFN (4k => 12 bits to shift) */510 * 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)
508 513
509 /* Drop prot bits and convert to page addr for iitlbt and idtlbt */514 /* Drop prot bits and convert to page addr for iitlbt and idtlbt */
510 .macro convert_for_tlb_insert20 pte515 .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 */
511 extrd,u \pte,(63-ASM_PFN_PTE_SHIFT)+(63-58)+PAGE_ADD_SHIFT,\527 extrd,u \pte,(63-ASM_PFN_PTE_SHIFT)+(63-58)+PAGE_ADD_SHIFT,\
512 64-PAGE_SHIFT-PAGE_ADD_SHIFT,\pte528 64-PAGE_SHIFT-PAGE_ADD_SHIFT,\pte
513 depdi _PAGE_SIZE_ENCODING_DEFAULT,63,\529 depdi _PAGE_SIZE_ENCODING_DEFAULT,63,\
514 (63-58)+PAGE_ADD_SHIFT,\pte530 (63-58)+PAGE_ADD_SHIFT,\pte
531#endif
515 .endm532 .endm
516 533
517 /* Convert the pte and prot to tlb insertion values. How534 /* Convert the pte and prot to tlb insertion values. How
518 * this happens is quite subtle, read below */535 * this happens is quite subtle, read below */
519 .macro make_insert_tlb spc,pte,prot536 .macro make_insert_tlb spc,pte,prot,tmp
520 space_to_prot \spc \prot /* create prot id from space */537 space_to_prot \spc \prot /* create prot id from space */
521 /* The following is the real subtlety. This is depositing538 /* The following is the real subtlety. This is depositing
522 * T <-> _PAGE_REFTRAP539 * T <-> _PAGE_REFTRAP
@@ -553,7 +570,7 @@ · 30 unmodified lines
553 depdi 1,12,1,\prot570 depdi 1,12,1,\prot
554 571
555 /* Drop prot bits and convert to page addr for iitlbt and idtlbt */572 /* Drop prot bits and convert to page addr for iitlbt and idtlbt */
556 convert_for_tlb_insert20 \pte573 convert_for_tlb_insert20 \pte \tmp
557 .endm574 .endm
558 575
559 /* Identical macro to make_insert_tlb above, except it576 /* Identical macro to make_insert_tlb above, except it
@@ -646,17 +663,12 @@ · 86 unmodified lines
646 663
647 664
648 /*665 /*
649 * Align fault_vector_20 on 4K boundary so that both666 * Fault_vectors are architecturally required to be aligned on a 2K
650 * fault_vector_11 and fault_vector_20 are on the667 * boundary
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.
655 */668 */
656 669
657 .text670 .text
658 671 .align 2048
659 .align 4096
660 672
661ENTRY(fault_vector_20)673ENTRY(fault_vector_20)
662 /* First vector is invalid (0) */674 /* First vector is invalid (0) */
@@ -1147,7 +1159,7 @@ dtlb_miss_20w: · 484 unmodified lines
1147 tlb_lock spc,ptp,pte,t0,t1,dtlb_check_alias_20w1159 tlb_lock spc,ptp,pte,t0,t1,dtlb_check_alias_20w
1148 update_accessed ptp,pte,t0,t11160 update_accessed ptp,pte,t0,t1
1149 1161
1150 make_insert_tlb spc,pte,prot1162 make_insert_tlb spc,pte,prot,t1
1151 1163
1152 idtlbt pte,prot1164 idtlbt pte,prot
1153 1165
@@ -1173,7 +1185,7 @@ nadtlb_miss_20w: · 19 unmodified lines
1173 tlb_lock spc,ptp,pte,t0,t1,nadtlb_check_alias_20w1185 tlb_lock spc,ptp,pte,t0,t1,nadtlb_check_alias_20w
1174 update_accessed ptp,pte,t0,t11186 update_accessed ptp,pte,t0,t1
1175 1187
1176 make_insert_tlb spc,pte,prot1188 make_insert_tlb spc,pte,prot,t1
1177 1189
1178 idtlbt pte,prot1190 idtlbt pte,prot
1179 1191
@@ -1267,7 +1279,7 @@ dtlb_miss_20: · 87 unmodified lines
1267 tlb_lock spc,ptp,pte,t0,t1,dtlb_check_alias_201279 tlb_lock spc,ptp,pte,t0,t1,dtlb_check_alias_20
1268 update_accessed ptp,pte,t0,t11280 update_accessed ptp,pte,t0,t1
1269 1281
1270 make_insert_tlb spc,pte,prot1282 make_insert_tlb spc,pte,prot,t1
1271 1283
1272 f_extend pte,t11284 f_extend pte,t1
1273 1285
@@ -1295,7 +1307,7 @@ nadtlb_miss_20: · 21 unmodified lines
1295 tlb_lock spc,ptp,pte,t0,t1,nadtlb_check_alias_201307 tlb_lock spc,ptp,pte,t0,t1,nadtlb_check_alias_20
1296 update_accessed ptp,pte,t0,t11308 update_accessed ptp,pte,t0,t1
1297 1309
1298 make_insert_tlb spc,pte,prot1310 make_insert_tlb spc,pte,prot,t1
1299 1311
1300 f_extend pte,t11312 f_extend pte,t1
1301 1313
@@ -1404,7 +1416,7 @@ itlb_miss_20w: · 102 unmodified lines
1404 tlb_lock spc,ptp,pte,t0,t1,itlb_fault1416 tlb_lock spc,ptp,pte,t0,t1,itlb_fault
1405 update_accessed ptp,pte,t0,t11417 update_accessed ptp,pte,t0,t1
1406 1418
1407 make_insert_tlb spc,pte,prot1419 make_insert_tlb spc,pte,prot,t1
1408 1420
1409 iitlbt pte,prot1421 iitlbt pte,prot
1410 1422
@@ -1428,7 +1440,7 @@ naitlb_miss_20w: · 17 unmodified lines
1428 tlb_lock spc,ptp,pte,t0,t1,naitlb_check_alias_20w1440 tlb_lock spc,ptp,pte,t0,t1,naitlb_check_alias_20w
1429 update_accessed ptp,pte,t0,t11441 update_accessed ptp,pte,t0,t1
1430 1442
1431 make_insert_tlb spc,pte,prot1443 make_insert_tlb spc,pte,prot,t1
1432 1444
1433 iitlbt pte,prot1445 iitlbt pte,prot
1434 1446
@@ -1514,7 +1526,7 @@ itlb_miss_20: · 79 unmodified lines
1514 tlb_lock spc,ptp,pte,t0,t1,itlb_fault1526 tlb_lock spc,ptp,pte,t0,t1,itlb_fault
1515 update_accessed ptp,pte,t0,t11527 update_accessed ptp,pte,t0,t1
1516 1528
1517 make_insert_tlb spc,pte,prot1529 make_insert_tlb spc,pte,prot,t1
1518 1530
1519 f_extend pte,t11531 f_extend pte,t1
1520 1532
@@ -1534,7 +1546,7 @@ naitlb_miss_20: · 13 unmodified lines
1534 tlb_lock spc,ptp,pte,t0,t1,naitlb_check_alias_201546 tlb_lock spc,ptp,pte,t0,t1,naitlb_check_alias_20
1535 update_accessed ptp,pte,t0,t11547 update_accessed ptp,pte,t0,t1
1536 1548
1537 make_insert_tlb spc,pte,prot1549 make_insert_tlb spc,pte,prot,t1
1538 1550
1539 f_extend pte,t11551 f_extend pte,t1
1540 1552
@@ -1566,7 +1578,7 @@ dbit_trap_20w: · 25 unmodified lines
1566 tlb_lock spc,ptp,pte,t0,t1,dbit_fault1578 tlb_lock spc,ptp,pte,t0,t1,dbit_fault
1567 update_dirty ptp,pte,t11579 update_dirty ptp,pte,t1
1568 1580
1569 make_insert_tlb spc,pte,prot1581 make_insert_tlb spc,pte,prot,t1
1570 1582
1571 idtlbt pte,prot1583 idtlbt pte,prot
1572 1584
@@ -1610,7 +1622,7 @@ dbit_trap_20: · 37 unmodified lines
1610 tlb_lock spc,ptp,pte,t0,t1,dbit_fault1622 tlb_lock spc,ptp,pte,t0,t1,dbit_fault
1611 update_dirty ptp,pte,t11623 update_dirty ptp,pte,t1
1612 1624
1613 make_insert_tlb spc,pte,prot1625 make_insert_tlb spc,pte,prot,t1
1614 1626
1615 f_extend pte,t11627 f_extend pte,t1
1616 1628
arch/parisc/kernel/head.S+2−2
@@ -69,7 +69,7 @@ $bss_loop: · 68 unmodified lines
69 stw,ma %arg2,4(%r1)69 stw,ma %arg2,4(%r1)
70 stw,ma %arg3,4(%r1)70 stw,ma %arg3,4(%r1)
71 71
72 /* Initialize startup VM. Just map first 8/16 MB of memory */72 /* Initialize startup VM. Just map first 16/32 MB of memory */
73 load32 PA(swapper_pg_dir),%r473 load32 PA(swapper_pg_dir),%r4
74 mtctl %r4,%cr24 /* Initialize kernel root pointer */74 mtctl %r4,%cr24 /* Initialize kernel root pointer */
75 mtctl %r4,%cr25 /* Initialize user root pointer */75 mtctl %r4,%cr25 /* Initialize user root pointer */
@@ -107,7 +107,7 @@ $bss_loop: · 31 unmodified lines
107 /* Now initialize the PTEs themselves. We use RWX for107 /* Now initialize the PTEs themselves. We use RWX for
108 * everything ... it will get remapped correctly later */108 * everything ... it will get remapped correctly later */
109 ldo 0+_PAGE_KERNEL_RWX(%r0),%r3 /* Hardwired 0 phys addr start */109 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 */
111 load32 PA(pg0),%r1111 load32 PA(pg0),%r1
112 112
113$pgt_fill_loop:113$pgt_fill_loop:
arch/parisc/kernel/setup.c+13−1
@@ -130,7 +130,16 @@ void __init setup_arch(char **cmdline_p) · 129 unmodified lines
130 printk(KERN_INFO "The 32-bit Kernel has started...\n");130 printk(KERN_INFO "The 32-bit Kernel has started...\n");
131#endif131#endif
132 132
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
134 143
135 pdc_console_init();144 pdc_console_init();
136 145
@@ -377,6 +386,7 @@ arch_initcall(parisc_init); · 240 unmodified lines
377void start_parisc(void)386void start_parisc(void)
378{387{
379 extern void start_kernel(void);388 extern void start_kernel(void);
389 extern void early_trap_init(void);
380 390
381 int ret, cpunum;391 int ret, cpunum;
382 struct pdc_coproc_cfg coproc_cfg;392 struct pdc_coproc_cfg coproc_cfg;
@@ -397,6 +407,8 @@ void start_parisc(void) · 14 unmodified lines
397 panic("must have an fpu to boot linux");407 panic("must have an fpu to boot linux");
398 }408 }
399 409
410 early_trap_init(); /* initialize checksum of fault_vector */
411
400 start_kernel();412 start_kernel();
401 // not reached413 // not reached
402}414}
arch/parisc/kernel/syscall.S+2−2
@@ -369,7 +369,7 @@ tracesys_exit: · 368 unmodified lines
369 ldo -16(%r30),%r29 /* Reference param save area */369 ldo -16(%r30),%r29 /* Reference param save area */
370#endif370#endif
371 ldo TASK_REGS(%r1),%r26371 ldo TASK_REGS(%r1),%r26
372 bl do_syscall_trace_exit,%r2372 BL do_syscall_trace_exit,%r2
373 STREG %r28,TASK_PT_GR28(%r1) /* save return value now */373 STREG %r28,TASK_PT_GR28(%r1) /* save return value now */
374 ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */374 ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */
375 LDREG TI_TASK(%r1), %r1375 LDREG TI_TASK(%r1), %r1
@@ -390,7 +390,7 @@ tracesys_sigexit: · 14 unmodified lines
390#ifdef CONFIG_64BIT390#ifdef CONFIG_64BIT
391 ldo -16(%r30),%r29 /* Reference param save area */391 ldo -16(%r30),%r29 /* Reference param save area */
392#endif392#endif
393 bl do_syscall_trace_exit,%r2393 BL do_syscall_trace_exit,%r2
394 ldo TASK_REGS(%r1),%r26394 ldo TASK_REGS(%r1),%r26
395 395
396 ldil L%syscall_exit_rfi,%r1396 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
807}807}
808 808
809 809
810int __init check_ivt(void *iva)810void __init initialize_ivt(const void *iva)
811{811{
812 extern u32 os_hpmc_size;812 extern u32 os_hpmc_size;
813 extern const u32 os_hpmc[];813 extern const u32 os_hpmc[];
@@ -818,8 +818,8 @@ int __init check_ivt(void *iva) · 4 unmodified lines
818 u32 *hpmcp;818 u32 *hpmcp;
819 u32 length;819 u32 length;
820 820
821 if (strcmp((char *)iva, "cows can fly"))821 if (strcmp((const char *)iva, "cows can fly"))
822 return -1;822 panic("IVT invalid");
823 823
824 ivap = (u32 *)iva;824 ivap = (u32 *)iva;
825 825
@@ -839,28 +839,23 @@ int __init check_ivt(void *iva) · 13 unmodified lines
839 check += ivap[i];839 check += ivap[i];
840 840
841 ivap[5] = -check;841 ivap[5] = -check;
842
843 return 0;
844}842}
845 843
846#ifndef CONFIG_64BIT
847extern const void fault_vector_11;
848#endif
849extern const void fault_vector_20;
850 844
851void __init trap_init(void)845/* early_trap_init() is called before we set up kernel mappings and
846 * write-protect the kernel */
847void __init early_trap_init(void)
852{848{
853 void *iva;849 extern const void fault_vector_20;
854 850
855 if (boot_cpu_data.cpu_type >= pcxu)851#ifndef CONFIG_64BIT
856 iva = (void *) &fault_vector_20;852 extern const void fault_vector_11;
857 else853 initialize_ivt(&fault_vector_11);
858#ifdef CONFIG_64BIT
859 panic("Can't boot 64-bit OS on PA1.1 processor!");
860#else
861 iva = (void *) &fault_vector_11;
862#endif854#endif
863 855
864 if (check_ivt(iva))856 initialize_ivt(&fault_vector_20);
865 panic("IVT invalid");857}
858
859void __init trap_init(void)
860{
866}861}
arch/parisc/kernel/vmlinux.lds.S+6−3
@@ -60,7 +60,7 @@ SECTIONS · 59 unmodified lines
60 EXIT_DATA60 EXIT_DATA
61 }61 }
62 PERCPU_SECTION(8)62 PERCPU_SECTION(8)
63 . = ALIGN(PAGE_SIZE);63 . = ALIGN(HUGEPAGE_SIZE);
64 __init_end = .;64 __init_end = .;
65 /* freed after init ends here */65 /* freed after init ends here */
66 66
@@ -116,7 +116,7 @@ SECTIONS · 49 unmodified lines
116 * that we can properly leave these116 * that we can properly leave these
117 * as writable117 * as writable
118 */118 */
119 . = ALIGN(PAGE_SIZE);119 . = ALIGN(HUGEPAGE_SIZE);
120 data_start = .;120 data_start = .;
121 121
122 EXCEPTION_TABLE(8)122 EXCEPTION_TABLE(8)
@@ -135,8 +135,11 @@ SECTIONS · 12 unmodified lines
135 _edata = .;135 _edata = .;
136 136
137 /* BSS */137 /* 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. */
139 141
142 . = ALIGN(HUGEPAGE_SIZE);
140 _end = . ;143 _end = . ;
141 144
142 STABS_DEBUG145 STABS_DEBUG
arch/parisc/mm/Makefile+1−0
@@ -3,3 +3,4 @@ · 2 unmodified lines
3#3#
4 4
5obj-y := init.o fault.o ioremap.o5obj-y := init.o fault.o ioremap.o
6obj-$(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
23unsigned long
24hugetlb_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
46pte_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
71pte_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 */
96static 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
116void 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
142pte_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
153int pmd_huge(pmd_t pmd)
154{
155 return 0;
156}
157
158int 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
409 unsigned long vaddr;409 unsigned long vaddr;
410 unsigned long ro_start;410 unsigned long ro_start;
411 unsigned long ro_end;411 unsigned long ro_end;
412 unsigned long fv_addr;412 unsigned long kernel_end;
413 unsigned long gw_addr;
414 extern const unsigned long fault_vector_20;
415 extern void * const linux_gateway_page;
416 413
417 ro_start = __pa((unsigned long)_text);414 ro_start = __pa((unsigned long)_text);
418 ro_end = __pa((unsigned long)&data_start);415 ro_end = __pa((unsigned long)&data_start);
419 fv_addr = __pa((unsigned long)&fault_vector_20) & PAGE_MASK;416 kernel_end = __pa((unsigned long)&_end);
420 gw_addr = __pa((unsigned long)&linux_gateway_page) & PAGE_MASK;
421 417
422 end_paddr = start_paddr + size;418 end_paddr = start_paddr + size;
423 419
@@ -475,24 +471,25 @@ static void __init map_pages(unsigned long start_vaddr, · 51 unmodified lines
475 for (tmp2 = start_pte; tmp2 < PTRS_PER_PTE; tmp2++, pg_table++) {471 for (tmp2 = start_pte; tmp2 < PTRS_PER_PTE; tmp2++, pg_table++) {
476 pte_t pte;472 pte_t pte;
477 473
478 /*
479 * Map the fault vector writable so we can
480 * write the HPMC checksum.
481 */
482 if (force)474 if (force)
483 pte = __mk_pte(address, pgprot);475 pte = __mk_pte(address, pgprot);
484 else if (parisc_text_address(vaddr) &&476 else if (parisc_text_address(vaddr)) {
485 address != fv_addr)
486 pte = __mk_pte(address, PAGE_KERNEL_EXEC);477 pte = __mk_pte(address, PAGE_KERNEL_EXEC);
478 if (address >= ro_start && address < kernel_end)
479 pte = pte_mkhuge(pte);
480 }
487 else481 else
488#if defined(CONFIG_PARISC_PAGE_SIZE_4KB)482#if defined(CONFIG_PARISC_PAGE_SIZE_4KB)
489 if (address >= ro_start && address < ro_end483 if (address >= ro_start && address < ro_end) {
490 && address != fv_addr484 pte = __mk_pte(address, PAGE_KERNEL_EXEC);
491 && address != gw_addr)485 pte = pte_mkhuge(pte);
492 pte = __mk_pte(address, PAGE_KERNEL_RO);486 } else
493 else
494#endif487#endif
488 {
495 pte = __mk_pte(address, pgprot);489 pte = __mk_pte(address, pgprot);
490 if (address >= ro_start && address < kernel_end)
491 pte = pte_mkhuge(pte);
492 }
496 493
497 if (address >= end_paddr) {494 if (address >= end_paddr) {
498 if (force)495 if (force)
@@ -536,15 +533,12 @@ void free_initmem(void) · 37 unmodified lines
536 533
537 /* force the kernel to see the new TLB entries */534 /* force the kernel to see the new TLB entries */
538 __flush_tlb_range(0, init_begin, init_end);535 __flush_tlb_range(0, init_begin, init_end);
539 /* Attempt to catch anyone trying to execute code here536
540 * by filling the page with BRK insns.
541 */
542 memset((void *)init_begin, 0x00, init_end - init_begin);
543 /* finally dump all the instructions which were cached, since the537 /* finally dump all the instructions which were cached, since the
544 * pages are no-longer executable */538 * pages are no-longer executable */
545 flush_icache_range(init_begin, init_end);539 flush_icache_range(init_begin, init_end);
546 540
547 free_initmem_default(-1);541 free_initmem_default(POISON_FREE_INITMEM);
548 542
549 /* set up a new led state on systems shipped LED State panel */543 /* set up a new led state on systems shipped LED State panel */
550 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BCOMPLETE);544 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BCOMPLETE);
@@ -728,8 +722,8 @@ static void __init pagetable_init(void) · 177 unmodified lines
728 unsigned long size;722 unsigned long size;
729 723
730 start_paddr = pmem_ranges[range].start_pfn << PAGE_SHIFT;724 start_paddr = pmem_ranges[range].start_pfn << PAGE_SHIFT;
731 end_paddr = start_paddr + (pmem_ranges[range].pages << PAGE_SHIFT);
732 size = pmem_ranges[range].pages << PAGE_SHIFT;725 size = pmem_ranges[range].pages << PAGE_SHIFT;
726 end_paddr = start_paddr + size;
733 727
734 map_pages((unsigned long)__va(start_paddr), start_paddr,728 map_pages((unsigned long)__va(start_paddr), start_paddr,
735 size, PAGE_KERNEL, 0);729 size, PAGE_KERNEL, 0);
arch/powerpc/include/asm/reg.h+1−0
@@ -108,6 +108,7 @@ · 107 unmodified lines
108#define MSR_TS_T __MASK(MSR_TS_T_LG) /* Transaction Transactional */108#define MSR_TS_T __MASK(MSR_TS_T_LG) /* Transaction Transactional */
109#define MSR_TS_MASK (MSR_TS_T | MSR_TS_S) /* Transaction State bits */109#define MSR_TS_MASK (MSR_TS_T | MSR_TS_S) /* Transaction State bits */
110#define MSR_TM_ACTIVE(x) (((x) & MSR_TS_MASK) != 0) /* Transaction active? */110#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 */
111#define MSR_TM_TRANSACTIONAL(x) (((x) & MSR_TS_MASK) == MSR_TS_T)112#define MSR_TM_TRANSACTIONAL(x) (((x) & MSR_TS_MASK) == MSR_TS_T)
112#define MSR_TM_SUSPENDED(x) (((x) & MSR_TS_MASK) == MSR_TS_S)113#define MSR_TM_SUSPENDED(x) (((x) & MSR_TS_MASK) == MSR_TS_S)
113 114
arch/powerpc/include/asm/systbl.h+1−0
@@ -382,3 +382,4 @@ COMPAT_SYS(shmat) · 381 unmodified lines
382SYSCALL(shmdt)382SYSCALL(shmdt)
383SYSCALL(shmget)383SYSCALL(shmget)
384COMPAT_SYS(shmctl)384COMPAT_SYS(shmctl)
385SYSCALL(mlock2)
arch/powerpc/include/asm/unistd.h+1−1
@@ -12,7 +12,7 @@ · 11 unmodified lines
12#include <uapi/asm/unistd.h>12#include <uapi/asm/unistd.h>
13 13
14 14
15#define __NR_syscalls 37815#define __NR_syscalls 379
16 16
17#define __NR__exit __NR_exit17#define __NR__exit __NR_exit
18#define NR_syscalls __NR_syscalls18#define NR_syscalls __NR_syscalls
arch/powerpc/include/uapi/asm/unistd.h+1−0
@@ -400,5 +400,6 @@ · 399 unmodified lines
400#define __NR_shmdt 375400#define __NR_shmdt 375
401#define __NR_shmget 376401#define __NR_shmget 376
402#define __NR_shmctl 377402#define __NR_shmctl 377
403#define __NR_mlock2 378
403 404
404#endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */405#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
551 msr_diff &= MSR_FP | MSR_VEC | MSR_VSX | MSR_FE0 | MSR_FE1;551 msr_diff &= MSR_FP | MSR_VEC | MSR_VSX | MSR_FE0 | MSR_FE1;
552 }552 }
553 553
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
554 tm_reclaim(thr, thr->regs->msr, cause);572 tm_reclaim(thr, thr->regs->msr, cause);
555 573
556 /* Having done the reclaim, we now have the checkpointed574 /* 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
875 return 1;875 return 1;
876#endif /* CONFIG_SPE */876#endif /* CONFIG_SPE */
877 877
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);
878 /* Now, recheckpoint. This loads up all of the checkpointed (older)887 /* Now, recheckpoint. This loads up all of the checkpointed (older)
879 * registers, including FP and V[S]Rs. After recheckpointing, the888 * registers, including FP and V[S]Rs. After recheckpointing, the
880 * transactional versions should be loaded.889 * transactional versions should be loaded.
@@ -884,11 +893,6 @@ static long restore_tm_user_regs(struct pt_regs *regs, · 3 unmodified lines
884 current->thread.tm_texasr |= TEXASR_FS;893 current->thread.tm_texasr |= TEXASR_FS;
885 /* This loads the checkpointed FP/VEC state, if used */894 /* This loads the checkpointed FP/VEC state, if used */
886 tm_recheckpoint(&current->thread, msr);895 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);
892 896
893 /* This loads the speculative FP/VEC state, if used */897 /* This loads the speculative FP/VEC state, if used */
894 if (msr & MSR_FP) {898 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
438 438
439 /* get MSR separately, transfer the LE bit if doing signal return */439 /* get MSR separately, transfer the LE bit if doing signal return */
440 err |= __get_user(msr, &sc->gp_regs[PT_MSR]);440 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
441 /* pull in MSR TM from user context */445 /* pull in MSR TM from user context */
442 regs->msr = (regs->msr & ~MSR_TS_MASK) | (msr & MSR_TS_MASK);446 regs->msr = (regs->msr & ~MSR_TS_MASK) | (msr & MSR_TS_MASK);
443 447
arch/s390/include/asm/cio.h+1−0
@@ -312,6 +312,7 @@ extern void css_schedule_reprobe(void); · 311 unmodified lines
312extern void reipl_ccw_dev(struct ccw_dev_id *id);312extern void reipl_ccw_dev(struct ccw_dev_id *id);
313 313
314struct cio_iplinfo {314struct cio_iplinfo {
315 u8 ssid;
315 u16 devno;316 u16 devno;
316 int is_qdio;317 int is_qdio;
317};318};
arch/s390/include/asm/elf.h+10−3
@@ -206,9 +206,16 @@ do { \ · 205 unmodified lines
206} while (0)206} while (0)
207#endif /* CONFIG_COMPAT */207#endif /* CONFIG_COMPAT */
208 208
209extern unsigned long mmap_rnd_mask;209/*
210 210 * Cache aliasing on the latest machines calls for a mapping granularity
211#define STACK_RND_MASK (test_thread_flag(TIF_31BIT) ? 0x7ff : mmap_rnd_mask)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
212 219
213#define ARCH_DLINFO \220#define ARCH_DLINFO \
214do { \221do { \
arch/s390/include/asm/ipl.h+2−1
@@ -64,7 +64,8 @@ struct ipl_block_fcp { · 63 unmodified lines
64 64
65struct ipl_block_ccw {65struct ipl_block_ccw {
66 u8 reserved1[84];66 u8 reserved1[84];
67 u8 reserved2[2];67 u16 reserved2 : 13;
68 u8 ssid : 3;
68 u16 devno;69 u16 devno;
69 u8 vm_flags;70 u8 vm_flags;
70 u8 reserved3[3];71 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
195void dma_free_seg_table(unsigned long);195void dma_free_seg_table(unsigned long);
196unsigned long *dma_alloc_cpu_table(void);196unsigned long *dma_alloc_cpu_table(void);
197void dma_cleanup_tables(unsigned long *);197void dma_cleanup_tables(unsigned long *);
198void dma_update_cpu_trans(unsigned long *, void *, dma_addr_t, int);198unsigned long *dma_walk_cpu_trans(unsigned long *rto, dma_addr_t dma_addr);
199void dma_update_cpu_trans(unsigned long *entry, void *page_addr, int flags);
200
199#endif201#endif
arch/s390/include/asm/trace/diag.h+3−3
@@ -19,7 +19,7 @@ · 18 unmodified lines
19#define TRACE_INCLUDE_PATH asm/trace19#define TRACE_INCLUDE_PATH asm/trace
20#define TRACE_INCLUDE_FILE diag20#define TRACE_INCLUDE_FILE diag
21 21
22TRACE_EVENT(diagnose,22TRACE_EVENT(s390_diagnose,
23 TP_PROTO(unsigned short nr),23 TP_PROTO(unsigned short nr),
24 TP_ARGS(nr),24 TP_ARGS(nr),
25 TP_STRUCT__entry(25 TP_STRUCT__entry(
@@ -32,9 +32,9 @@ TRACE_EVENT(diagnose, · 6 unmodified lines
32);32);
33 33
34#ifdef CONFIG_TRACEPOINTS34#ifdef CONFIG_TRACEPOINTS
35void trace_diagnose_norecursion(int diag_nr);35void trace_s390_diagnose_norecursion(int diag_nr);
36#else36#else
37static inline void trace_diagnose_norecursion(int diag_nr) { }37static inline void trace_s390_diagnose_norecursion(int diag_nr) { }
38#endif38#endif
39 39
40#endif /* _TRACE_S390_DIAG_H */40#endif /* _TRACE_S390_DIAG_H */
arch/s390/include/uapi/asm/unistd.h+10−9
@@ -192,14 +192,14 @@ · 191 unmodified lines
192#define __NR_set_tid_address 252192#define __NR_set_tid_address 252
193#define __NR_fadvise64 253193#define __NR_fadvise64 253
194#define __NR_timer_create 254194#define __NR_timer_create 254
195#define __NR_timer_settime (__NR_timer_create+1)195#define __NR_timer_settime 255
196#define __NR_timer_gettime (__NR_timer_create+2)196#define __NR_timer_gettime 256
197#define __NR_timer_getoverrun (__NR_timer_create+3)197#define __NR_timer_getoverrun 257
198#define __NR_timer_delete (__NR_timer_create+4)198#define __NR_timer_delete 258
199#define __NR_clock_settime (__NR_timer_create+5)199#define __NR_clock_settime 259
200#define __NR_clock_gettime (__NR_timer_create+6)200#define __NR_clock_gettime 260
201#define __NR_clock_getres (__NR_timer_create+7)201#define __NR_clock_getres 261
202#define __NR_clock_nanosleep (__NR_timer_create+8)202#define __NR_clock_nanosleep 262
203/* Number 263 is reserved for vserver */203/* Number 263 is reserved for vserver */
204#define __NR_statfs64 265204#define __NR_statfs64 265
205#define __NR_fstatfs64 266205#define __NR_fstatfs64 266
@@ -309,7 +309,8 @@ · 103 unmodified lines
309#define __NR_recvfrom 371309#define __NR_recvfrom 371
310#define __NR_recvmsg 372310#define __NR_recvmsg 372
311#define __NR_shutdown 373311#define __NR_shutdown 373
312#define NR_syscalls 374312#define __NR_mlock2 374
313#define NR_syscalls 375
313 314
314/* 315/*
315 * There are some system calls that are not present on 64 bit, some316 * 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
176COMPAT_SYSCALL_WRAP3(getsockname, int, fd, struct sockaddr __user *, usockaddr, int __user *, usockaddr_len);176COMPAT_SYSCALL_WRAP3(getsockname, int, fd, struct sockaddr __user *, usockaddr, int __user *, usockaddr_len);
177COMPAT_SYSCALL_WRAP3(getpeername, int, fd, struct sockaddr __user *, usockaddr, int __user *, usockaddr_len);177COMPAT_SYSCALL_WRAP3(getpeername, int, fd, struct sockaddr __user *, usockaddr, int __user *, usockaddr_len);
178COMPAT_SYSCALL_WRAP6(sendto, int, fd, void __user *, buff, size_t, len, unsigned int, flags, struct sockaddr __user *, addr, int, addr_len);178COMPAT_SYSCALL_WRAP6(sendto, int, fd, void __user *, buff, size_t, len, unsigned int, flags, struct sockaddr __user *, addr, int, addr_len);
179COMPAT_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
121void diag_stat_inc(enum diag_stat_enum nr)121void diag_stat_inc(enum diag_stat_enum nr)
122{122{
123 this_cpu_inc(diag_stat.counter[nr]);123 this_cpu_inc(diag_stat.counter[nr]);
124 trace_diagnose(diag_map[nr].code);124 trace_s390_diagnose(diag_map[nr].code);
125}125}
126EXPORT_SYMBOL(diag_stat_inc);126EXPORT_SYMBOL(diag_stat_inc);
127 127
128void diag_stat_inc_norecursion(enum diag_stat_enum nr)128void diag_stat_inc_norecursion(enum diag_stat_enum nr)
129{129{
130 this_cpu_inc(diag_stat.counter[nr]);130 this_cpu_inc(diag_stat.counter[nr]);
131 trace_diagnose_norecursion(diag_map[nr].code);131 trace_s390_diagnose_norecursion(diag_map[nr].code);
132}132}
133EXPORT_SYMBOL(diag_stat_inc_norecursion);133EXPORT_SYMBOL(diag_stat_inc_norecursion);
134 134
arch/s390/kernel/head.S+12−83
@@ -26,6 +26,7 @@ · 25 unmodified lines
26#include <asm/asm-offsets.h>26#include <asm/asm-offsets.h>
27#include <asm/thread_info.h>27#include <asm/thread_info.h>
28#include <asm/page.h>28#include <asm/page.h>
29#include <asm/ptrace.h>
29 30
30#define ARCH_OFFSET 431#define ARCH_OFFSET 4
31 32
@@ -59,19 +60,6 @@ __HEAD · 27 unmodified lines
59 .long 0x020006e0,0x2000005060 .long 0x020006e0,0x20000050
60 61
61 .org 0x20062 .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
720: lmh %r0,%r15,0(%r13) # clear high-order half of gprs
73 sam31 # switch to 31 bit addressing mode
74 br %r14
75 63
76#64#
77# subroutine to wait for end I/O65# subroutine to wait for end I/O
@@ -159,7 +147,14 @@ __HEAD · 81 unmodified lines
159 .long 0x02200050,0x00000000147 .long 0x02200050,0x00000000
160 148
161iplstart:149iplstart:
162 bas %r14,.Lsetmode # Immediately switch to 64 bit mode150 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
1560: lmh %r0,%r15,0(%r13) # clear high-order half of gprs
157 sam31 # switch to 31 bit addressing mode
163 lh %r1,0xb8 # test if subchannel number158 lh %r1,0xb8 # test if subchannel number
164 bct %r1,.Lnoload # is valid159 bct %r1,.Lnoload # is valid
165 l %r1,0xb8 # load ipl subchannel number160 l %r1,0xb8 # load ipl subchannel number
@@ -268,71 +263,6 @@ iplstart: · 102 unmodified lines
268 .align 8263 .align 8
269.Lcpuid:.fill 8,1,0264.Lcpuid:.fill 8,1,0
270 265
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
277ENTRY(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
336#266#
337# startup-code at 0x10000, running in absolute addressing mode267# startup-code at 0x10000, running in absolute addressing mode
338# this is called either by the ipl loader or directly by PSW restart268# this is called either by the ipl loader or directly by PSW restart
@@ -364,7 +294,7 @@ ENTRY(startup_kdump) · 25 unmodified lines
364 bras %r13,0f294 bras %r13,0f
365 .fill 16,4,0x0295 .fill 16,4,0x0
3660: lmh %r0,%r15,0(%r13) # clear high-order half of gprs2960: lmh %r0,%r15,0(%r13) # clear high-order half of gprs
367 sam31 # switch to 31 bit addressing mode297 sam64 # switch to 64 bit addressing mode
368 basr %r13,0 # get base298 basr %r13,0 # get base
369.LPG0:299.LPG0:
370 xc 0x200(256),0x200 # partially clear lowcore300 xc 0x200(256),0x200 # partially clear lowcore
@@ -395,7 +325,7 @@ ENTRY(startup_kdump) · 24 unmodified lines
395 jnz 1b325 jnz 1b
396 j 4f326 j 4f
3972: l %r15,.Lstack-.LPG0(%r13)3272: l %r15,.Lstack-.LPG0(%r13)
398 ahi %r15,-96328 ahi %r15,-STACK_FRAME_OVERHEAD
399 la %r2,.Lals_string-.LPG0(%r13)329 la %r2,.Lals_string-.LPG0(%r13)
400 l %r3,.Lsclp_print-.LPG0(%r13)330 l %r3,.Lsclp_print-.LPG0(%r13)
401 basr %r14,%r3331 basr %r14,%r3
@@ -429,8 +359,7 @@ ENTRY(startup_kdump) · 27 unmodified lines
429 .long 1, 0xc0000000359 .long 1, 0xc0000000
430#endif360#endif
4314:3614:
432 /* Continue with 64bit startup code in head64.S */362 /* Continue with startup code in head64.S */
433 sam64 # switch to 64 bit mode
434 jg startup_continue363 jg startup_continue
435 364
436 .align 8365 .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
121 * Must be in data section since the bss section121 * Must be in data section since the bss section
122 * is not cleared when these are accessed.122 * is not cleared when these are accessed.
123 */123 */
124static u8 ipl_ssid __attribute__((__section__(".data"))) = 0;
124static u16 ipl_devno __attribute__((__section__(".data"))) = 0;125static u16 ipl_devno __attribute__((__section__(".data"))) = 0;
125u32 ipl_flags __attribute__((__section__(".data"))) = 0;126u32 ipl_flags __attribute__((__section__(".data"))) = 0;
126 127
@@ -197,6 +198,33 @@ static ssize_t sys_##_prefix##_##_name##_show(struct kobject *kobj, \ · 70 unmodified lines
197 return snprintf(page, PAGE_SIZE, _format, ##args); \198 return snprintf(page, PAGE_SIZE, _format, ##args); \
198}199}
199 200
201#define IPL_ATTR_CCW_STORE_FN(_prefix, _name, _ipl_blk) \
202static 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) \
220IPL_ATTR_SHOW_FN(_prefix, _name, "0.%x.%04x\n", \
221 _ipl_blk.ssid, _ipl_blk.devno); \
222IPL_ATTR_CCW_STORE_FN(_prefix, _name, _ipl_blk); \
223static 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
200#define DEFINE_IPL_ATTR_RO(_prefix, _name, _format, _value) \228#define DEFINE_IPL_ATTR_RO(_prefix, _name, _format, _value) \
201IPL_ATTR_SHOW_FN(_prefix, _name, _format, _value) \229IPL_ATTR_SHOW_FN(_prefix, _name, _format, _value) \
202static struct kobj_attribute sys_##_prefix##_##_name##_attr = \230static struct kobj_attribute sys_##_prefix##_##_name##_attr = \
@@ -395,7 +423,7 @@ static ssize_t sys_ipl_device_show(struct kobject *kobj, · 192 unmodified lines
395 423
396 switch (ipl_info.type) {424 switch (ipl_info.type) {
397 case IPL_TYPE_CCW:425 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);
399 case IPL_TYPE_FCP:427 case IPL_TYPE_FCP:
400 case IPL_TYPE_FCP_DUMP:428 case IPL_TYPE_FCP_DUMP:
401 return sprintf(page, "0.0.%04x\n", ipl->ipl_info.fcp.devno);429 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
687 struct bin_attribute *attr,715 struct bin_attribute *attr,
688 char *buf, loff_t off, size_t count)716 char *buf, loff_t off, size_t count)
689{717{
718 size_t scpdata_len = count;
690 size_t padding;719 size_t padding;
691 size_t scpdata_len;
692
693 if (off < 0)
694 return -EINVAL;
695 720
696 if (off >= DIAG308_SCPDATA_SIZE)
697 return -ENOSPC;
698 721
699 if (count > DIAG308_SCPDATA_SIZE - off)722 if (off)
700 count = DIAG308_SCPDATA_SIZE - off;723 return -EINVAL;
701
702 memcpy(reipl_block_fcp->ipl_info.fcp.scp_data, buf + off, count);
703 scpdata_len = off + count;
704 724
725 memcpy(reipl_block_fcp->ipl_info.fcp.scp_data, buf, count);
705 if (scpdata_len % 8) {726 if (scpdata_len % 8) {
706 padding = 8 - (scpdata_len % 8);727 padding = 8 - (scpdata_len % 8);
707 memset(reipl_block_fcp->ipl_info.fcp.scp_data + scpdata_len,728 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
717}738}
718static struct bin_attribute sys_reipl_fcp_scp_data_attr =739static struct bin_attribute sys_reipl_fcp_scp_data_attr =
719 __BIN_ATTR(scp_data, (S_IRUGO | S_IWUSR), reipl_fcp_scpdata_read,740 __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);
721 742
722static struct bin_attribute *reipl_fcp_bin_attrs[] = {743static struct bin_attribute *reipl_fcp_bin_attrs[] = {
723 &sys_reipl_fcp_scp_data_attr,744 &sys_reipl_fcp_scp_data_attr,
@@ -814,9 +835,7 @@ static struct attribute_group reipl_fcp_attr_group = { · 90 unmodified lines
814};835};
815 836
816/* CCW reipl device attributes */837/* CCW reipl device attributes */
817 838DEFINE_IPL_CCW_ATTR_RW(reipl_ccw, device, reipl_block_ccw->ipl_info.ccw);
818DEFINE_IPL_ATTR_RW(reipl_ccw, device, "0.0.%04llx\n", "0.0.%llx\n",
819 reipl_block_ccw->ipl_info.ccw.devno);
820 839
821/* NSS wrapper */840/* NSS wrapper */
822static ssize_t reipl_nss_loadparm_show(struct kobject *kobj,841static ssize_t reipl_nss_loadparm_show(struct kobject *kobj,
@@ -1056,8 +1075,8 @@ static void __reipl_run(void *unused) · 233 unmodified lines
1056 1075
1057 switch (reipl_method) {1076 switch (reipl_method) {
1058 case REIPL_METHOD_CCW_CIO:1077 case REIPL_METHOD_CCW_CIO:
1078 devid.ssid = reipl_block_ccw->ipl_info.ccw.ssid;
1059 devid.devno = reipl_block_ccw->ipl_info.ccw.devno;1079 devid.devno = reipl_block_ccw->ipl_info.ccw.devno;
1060 devid.ssid = 0;
1061 reipl_ccw_dev(&devid);1080 reipl_ccw_dev(&devid);
1062 break;1081 break;
1063 case REIPL_METHOD_CCW_VM:1082 case REIPL_METHOD_CCW_VM:
@@ -1192,6 +1211,7 @@ static int __init reipl_ccw_init(void) · 128 unmodified lines
1192 1211
1193 reipl_block_ccw_init(reipl_block_ccw);1212 reipl_block_ccw_init(reipl_block_ccw);
1194 if (ipl_info.type == IPL_TYPE_CCW) {1213 if (ipl_info.type == IPL_TYPE_CCW) {
1214 reipl_block_ccw->ipl_info.ccw.ssid = ipl_ssid;
1195 reipl_block_ccw->ipl_info.ccw.devno = ipl_devno;1215 reipl_block_ccw->ipl_info.ccw.devno = ipl_devno;
1196 reipl_block_ccw_fill_parms(reipl_block_ccw);1216 reipl_block_ccw_fill_parms(reipl_block_ccw);
1197 }1217 }
@@ -1336,9 +1356,7 @@ static struct attribute_group dump_fcp_attr_group = { · 138 unmodified lines
1336};1356};
1337 1357
1338/* CCW dump device attributes */1358/* CCW dump device attributes */
1339 1359DEFINE_IPL_CCW_ATTR_RW(dump_ccw, device, dump_block_ccw->ipl_info.ccw);
1340DEFINE_IPL_ATTR_RW(dump_ccw, device, "0.0.%04llx\n", "0.0.%llx\n",
1341 dump_block_ccw->ipl_info.ccw.devno);
1342 1360
1343static struct attribute *dump_ccw_attrs[] = {1361static struct attribute *dump_ccw_attrs[] = {
1344 &sys_dump_ccw_device_attr.attr,1362 &sys_dump_ccw_device_attr.attr,
@@ -1418,8 +1436,8 @@ static void __dump_run(void *unused) · 73 unmodified lines
1418 1436
1419 switch (dump_method) {1437 switch (dump_method) {
1420 case DUMP_METHOD_CCW_CIO:1438 case DUMP_METHOD_CCW_CIO:
1439 devid.ssid = dump_block_ccw->ipl_info.ccw.ssid;
1421 devid.devno = dump_block_ccw->ipl_info.ccw.devno;1440 devid.devno = dump_block_ccw->ipl_info.ccw.devno;
1422 devid.ssid = 0;
1423 reipl_ccw_dev(&devid);1441 reipl_ccw_dev(&devid);
1424 break;1442 break;
1425 case DUMP_METHOD_CCW_VM:1443 case DUMP_METHOD_CCW_VM:
@@ -1939,14 +1957,14 @@ void __init setup_ipl(void) · 513 unmodified lines
1939 ipl_info.type = get_ipl_type();1957 ipl_info.type = get_ipl_type();
1940 switch (ipl_info.type) {1958 switch (ipl_info.type) {
1941 case IPL_TYPE_CCW:1959 case IPL_TYPE_CCW:
1960 ipl_info.data.ccw.dev_id.ssid = ipl_ssid;
1942 ipl_info.data.ccw.dev_id.devno = ipl_devno;1961 ipl_info.data.ccw.dev_id.devno = ipl_devno;
1943 ipl_info.data.ccw.dev_id.ssid = 0;
1944 break;1962 break;
1945 case IPL_TYPE_FCP:1963 case IPL_TYPE_FCP:
1946 case IPL_TYPE_FCP_DUMP:1964 case IPL_TYPE_FCP_DUMP:
1965 ipl_info.data.fcp.dev_id.ssid = 0;
1947 ipl_info.data.fcp.dev_id.devno =1966 ipl_info.data.fcp.dev_id.devno =
1948 IPL_PARMBLOCK_START->ipl_info.fcp.devno;1967 IPL_PARMBLOCK_START->ipl_info.fcp.devno;
1949 ipl_info.data.fcp.dev_id.ssid = 0;
1950 ipl_info.data.fcp.wwpn = IPL_PARMBLOCK_START->ipl_info.fcp.wwpn;1968 ipl_info.data.fcp.wwpn = IPL_PARMBLOCK_START->ipl_info.fcp.wwpn;
1951 ipl_info.data.fcp.lun = IPL_PARMBLOCK_START->ipl_info.fcp.lun;1969 ipl_info.data.fcp.lun = IPL_PARMBLOCK_START->ipl_info.fcp.lun;
1952 break;1970 break;
@@ -1978,6 +1996,7 @@ void __init ipl_save_parameters(void) · 25 unmodified lines
1978 if (cio_get_iplinfo(&iplinfo))1996 if (cio_get_iplinfo(&iplinfo))
1979 return;1997 return;
1980 1998
1999 ipl_ssid = iplinfo.ssid;
1981 ipl_devno = iplinfo.devno;2000 ipl_devno = iplinfo.devno;
1982 ipl_flags |= IPL_DEVNO_VALID;2001 ipl_flags |= IPL_DEVNO_VALID;
1983 if (!iplinfo.is_qdio)2002 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
243 243
244static inline unsigned long brk_rnd(void)244static inline unsigned long brk_rnd(void)
245{245{
246 /* 8MB for 32bit, 1GB for 64bit */246 return (get_random_int() & BRK_RND_MASK) << PAGE_SHIFT;
247 if (is_32bit_task())
248 return (get_random_int() & 0x7ffUL) << PAGE_SHIFT;
249 else
250 return (get_random_int() & 0x3ffffUL) << PAGE_SHIFT;
251}247}
252 248
253unsigned long arch_randomize_brk(struct mm_struct *mm)249unsigned 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
21 __ctl_load(cr0_new, 0, 0);21 __ctl_load(cr0_new, 0, 0);
22 22
23 psw_ext_save = S390_lowcore.external_new_psw;23 psw_ext_save = S390_lowcore.external_new_psw;
24 psw_mask = __extract_psw() & (PSW_MASK_EA | PSW_MASK_BA);24 psw_mask = __extract_psw();
25 S390_lowcore.external_new_psw.mask = psw_mask;25 S390_lowcore.external_new_psw.mask = psw_mask;
26 psw_wait.mask = psw_mask | PSW_MASK_EXT | PSW_MASK_WAIT;26 psw_wait.mask = psw_mask | PSW_MASK_EXT | PSW_MASK_WAIT;
27 S390_lowcore.ext_int_code = 0;27 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
764 get_cpu_id(&cpu_id);764 get_cpu_id(&cpu_id);
765 add_device_randomness(&cpu_id, sizeof(cpu_id));765 add_device_randomness(&cpu_id, sizeof(cpu_id));
766 switch (cpu_id.machine) {766 switch (cpu_id.machine) {
767 case 0x9672:
768 strcpy(elf_platform, "g5");
769 break;
770 case 0x2064:767 case 0x2064:
771 case 0x2066:768 case 0x2066:
772 default: /* Use "z900" as default for 64 bit kernels. */769 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
382SYSCALL(sys_recvfrom,compat_sys_recvfrom)382SYSCALL(sys_recvfrom,compat_sys_recvfrom)
383SYSCALL(sys_recvmsg,compat_sys_recvmsg)383SYSCALL(sys_recvmsg,compat_sys_recvmsg)
384SYSCALL(sys_shutdown,sys_shutdown)384SYSCALL(sys_shutdown,sys_shutdown)
385SYSCALL(sys_mlock2,compat_sys_mlock2)
arch/s390/kernel/trace.c+3−3
@@ -9,11 +9,11 @@ · 8 unmodified lines
9#define CREATE_TRACE_POINTS9#define CREATE_TRACE_POINTS
10#include <asm/trace/diag.h>10#include <asm/trace/diag.h>
11 11
12EXPORT_TRACEPOINT_SYMBOL(diagnose);12EXPORT_TRACEPOINT_SYMBOL(s390_diagnose);
13 13
14static DEFINE_PER_CPU(unsigned int, diagnose_trace_depth);14static DEFINE_PER_CPU(unsigned int, diagnose_trace_depth);
15 15
16void trace_diagnose_norecursion(int diag_nr)16void trace_s390_diagnose_norecursion(int diag_nr)
17{17{
18 unsigned long flags;18 unsigned long flags;
19 unsigned int *depth;19 unsigned int *depth;
@@ -22,7 +22,7 @@ void trace_diagnose_norecursion(int diag_nr) · 2 unmodified lines
22 depth = this_cpu_ptr(&diagnose_trace_depth);22 depth = this_cpu_ptr(&diagnose_trace_depth);
23 if (*depth == 0) {23 if (*depth == 0) {
24 (*depth)++;24 (*depth)++;
25 trace_diagnose(diag_nr);25 trace_s390_diagnose(diag_nr);
26 (*depth)--;26 (*depth)--;
27 }27 }
28 local_irq_restore(flags);28 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
1030 src_id, 0);1030 src_id, 0);
1031 1031
1032 /* sending vcpu invalid */1032 /* sending vcpu invalid */
1033 if (src_id >= KVM_MAX_VCPUS ||1033 if (kvm_get_vcpu_by_id(vcpu->kvm, src_id) == NULL)
1034 kvm_get_vcpu(vcpu->kvm, src_id) == NULL)
1035 return -EINVAL;1034 return -EINVAL;
1036 1035
1037 if (sclp.has_sigpif)1036 if (sclp.has_sigpif)
@@ -1110,6 +1109,10 @@ static int __inject_sigp_emergency(struct kvm_vcpu *vcpu, · 72 unmodified lines
1110 trace_kvm_s390_inject_vcpu(vcpu->vcpu_id, KVM_S390_INT_EMERGENCY,1109 trace_kvm_s390_inject_vcpu(vcpu->vcpu_id, KVM_S390_INT_EMERGENCY,
1111 irq->u.emerg.code, 0);1110 irq->u.emerg.code, 0);
1112 1111
1112 /* sending vcpu invalid */
1113 if (kvm_get_vcpu_by_id(vcpu->kvm, irq->u.emerg.code) == NULL)
1114 return -EINVAL;
1115
1113 set_bit(irq->u.emerg.code, li->sigp_emerg_pending);1116 set_bit(irq->u.emerg.code, li->sigp_emerg_pending);
1114 set_bit(IRQ_PEND_EXT_EMERGENCY, &li->pending_irqs);1117 set_bit(IRQ_PEND_EXT_EMERGENCY, &li->pending_irqs);
1115 atomic_or(CPUSTAT_EXT_INT, li->cpuflags);1118 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
342 r = 0;342 r = 0;
343 break;343 break;
344 case KVM_CAP_S390_VECTOR_REGISTERS:344 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) {
346 set_kvm_facility(kvm->arch.model.fac->mask, 129);349 set_kvm_facility(kvm->arch.model.fac->mask, 129);
347 set_kvm_facility(kvm->arch.model.fac->list, 129);350 set_kvm_facility(kvm->arch.model.fac->list, 129);
348 r = 0;351 r = 0;
349 } else352 } else
350 r = -EINVAL;353 r = -EINVAL;
354 mutex_unlock(&kvm->lock);
351 VM_EVENT(kvm, 3, "ENABLE: CAP_S390_VECTOR_REGISTERS %s",355 VM_EVENT(kvm, 3, "ENABLE: CAP_S390_VECTOR_REGISTERS %s",
352 r ? "(not available)" : "(success)");356 r ? "(not available)" : "(success)");
353 break;357 break;
arch/s390/kvm/priv.c+1−1
@@ -660,7 +660,7 @@ static int handle_pfmf(struct kvm_vcpu *vcpu) · 659 unmodified lines
660 660
661 kvm_s390_get_regs_rre(vcpu, &reg1, &reg2);661 kvm_s390_get_regs_rre(vcpu, &reg1, &reg2);
662 662
663 if (!MACHINE_HAS_PFMF)663 if (!test_kvm_facility(vcpu->kvm, 8))
664 return kvm_s390_inject_program_int(vcpu, PGM_OPERATION);664 return kvm_s390_inject_program_int(vcpu, PGM_OPERATION);
665 665
666 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)666 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
291 u16 cpu_addr, u32 parameter, u64 *status_reg)291 u16 cpu_addr, u32 parameter, u64 *status_reg)
292{292{
293 int rc;293 int rc;
294 struct kvm_vcpu *dst_vcpu;294 struct kvm_vcpu *dst_vcpu = kvm_get_vcpu_by_id(vcpu->kvm, cpu_addr);
295 295
296 if (cpu_addr >= KVM_MAX_VCPUS)
297 return SIGP_CC_NOT_OPERATIONAL;
298
299 dst_vcpu = kvm_get_vcpu(vcpu->kvm, cpu_addr);
300 if (!dst_vcpu)296 if (!dst_vcpu)
301 return SIGP_CC_NOT_OPERATIONAL;297 return SIGP_CC_NOT_OPERATIONAL;
302 298
@@ -478,7 +474,7 @@ int kvm_s390_handle_sigp_pei(struct kvm_vcpu *vcpu) · 175 unmodified lines
478 trace_kvm_s390_handle_sigp_pei(vcpu, order_code, cpu_addr);474 trace_kvm_s390_handle_sigp_pei(vcpu, order_code, cpu_addr);
479 475
480 if (order_code == SIGP_EXTERNAL_CALL) {476 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);
482 BUG_ON(dest_vcpu == NULL);478 BUG_ON(dest_vcpu == NULL);
483 479
484 kvm_s390_vcpu_wakeup(dest_vcpu);480 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
48 48
49static void __init setup_zero_pages(void)49static void __init setup_zero_pages(void)
50{50{
51 struct cpuid cpu_id;
52 unsigned int order;51 unsigned int order;
53 struct page *page;52 struct page *page;
54 int i;53 int i;
55 54
56 get_cpu_id(&cpu_id);55 /* Latest machines require a mapping granularity of 512KB */
57 switch (cpu_id.machine) {56 order = 7;
58 case 0x9672: /* g5 */57
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 }
82 /* Limit number of empty zero pages for small memory sizes */58 /* Limit number of empty zero pages for small memory sizes */
83 while (order > 2 && (totalram_pages >> 10) < (1UL << order))59 while (order > 2 && (totalram_pages >> 10) < (1UL << order))
84 order--;60 order--;
arch/s390/mm/mmap.c+9−51
@@ -31,9 +31,6 @@ · 30 unmodified lines
31#include <linux/security.h>31#include <linux/security.h>
32#include <asm/pgalloc.h>32#include <asm/pgalloc.h>
33 33
34unsigned long mmap_rnd_mask;
35static unsigned long mmap_align_mask;
36
37static unsigned long stack_maxrandom_size(void)34static unsigned long stack_maxrandom_size(void)
38{35{
39 if (!(current->flags & PF_RANDOMIZE))36 if (!(current->flags & PF_RANDOMIZE))
@@ -62,10 +59,7 @@ static inline int mmap_is_legacy(void) · 22 unmodified lines
62 59
63unsigned long arch_mmap_rnd(void)60unsigned long arch_mmap_rnd(void)
64{61{
65 if (is_32bit_task())62 return (get_random_int() & MMAP_RND_MASK) << PAGE_SHIFT;
66 return (get_random_int() & 0x7ff) << PAGE_SHIFT;
67 else
68 return (get_random_int() & mmap_rnd_mask) << PAGE_SHIFT;
69}63}
70 64
71static unsigned long mmap_base_legacy(unsigned long rnd)65static 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
92 struct mm_struct *mm = current->mm;86 struct mm_struct *mm = current->mm;
93 struct vm_area_struct *vma;87 struct vm_area_struct *vma;
94 struct vm_unmapped_area_info info;88 struct vm_unmapped_area_info info;
95 int do_color_align;
96 89
97 if (len > TASK_SIZE - mmap_min_addr)90 if (len > TASK_SIZE - mmap_min_addr)
98 return -ENOMEM;91 return -ENOMEM;
@@ -108,15 +101,14 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, · 9 unmodified lines
108 return addr;101 return addr;
109 }102 }
110 103
111 do_color_align = 0;
112 if (filp || (flags & MAP_SHARED))
113 do_color_align = !is_32bit_task();
114
115 info.flags = 0;104 info.flags = 0;
116 info.length = len;105 info.length = len;
117 info.low_limit = mm->mmap_base;106 info.low_limit = mm->mmap_base;
118 info.high_limit = TASK_SIZE;107 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;
120 info.align_offset = pgoff << PAGE_SHIFT;112 info.align_offset = pgoff << PAGE_SHIFT;
121 return vm_unmapped_area(&info);113 return vm_unmapped_area(&info);
122}114}
@@ -130,7 +122,6 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, · 7 unmodified lines
130 struct mm_struct *mm = current->mm;122 struct mm_struct *mm = current->mm;
131 unsigned long addr = addr0;123 unsigned long addr = addr0;
132 struct vm_unmapped_area_info info;124 struct vm_unmapped_area_info info;
133 int do_color_align;
134 125
135 /* requested length too big for entire address space */126 /* requested length too big for entire address space */
136 if (len > TASK_SIZE - mmap_min_addr)127 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
148 return addr;139 return addr;
149 }140 }
150 141
151 do_color_align = 0;
152 if (filp || (flags & MAP_SHARED))
153 do_color_align = !is_32bit_task();
154
155 info.flags = VM_UNMAPPED_AREA_TOPDOWN;142 info.flags = VM_UNMAPPED_AREA_TOPDOWN;
156 info.length = len;143 info.length = len;
157 info.low_limit = max(PAGE_SIZE, mmap_min_addr);144 info.low_limit = max(PAGE_SIZE, mmap_min_addr);
158 info.high_limit = mm->mmap_base;145 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;
160 info.align_offset = pgoff << PAGE_SHIFT;150 info.align_offset = pgoff << PAGE_SHIFT;
161 addr = vm_unmapped_area(&info);151 addr = vm_unmapped_area(&info);
162 152
@@ -254,35 +244,3 @@ void arch_pick_mmap_layout(struct mm_struct *mm) · 91 unmodified lines
254 mm->get_unmapped_area = s390_get_unmapped_area_topdown;244 mm->get_unmapped_area = s390_get_unmapped_area_topdown;
255 }245 }
256}246}
257
258static 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}
288early_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
33 return NULL;33 return NULL;
34 34
35 for (entry = table; entry < table + ZPCI_TABLE_ENTRIES; entry++)35 for (entry = table; entry < table + ZPCI_TABLE_ENTRIES; entry++)
36 *entry = ZPCI_TABLE_INVALID | ZPCI_TABLE_PROTECTED;36 *entry = ZPCI_TABLE_INVALID;
37 return table;37 return table;
38}38}
39 39
@@ -51,7 +51,7 @@ static unsigned long *dma_alloc_page_table(void) · 11 unmodified lines
51 return NULL;51 return NULL;
52 52
53 for (entry = table; entry < table + ZPCI_PT_ENTRIES; entry++)53 for (entry = table; entry < table + ZPCI_PT_ENTRIES; entry++)
54 *entry = ZPCI_PTE_INVALID | ZPCI_TABLE_PROTECTED;54 *entry = ZPCI_PTE_INVALID;
55 return table;55 return table;
56}56}
57 57
@@ -95,7 +95,7 @@ static unsigned long *dma_get_page_table_origin(unsigned long *entry) · 37 unmodified lines
95 return pto;95 return pto;
96}96}
97 97
98static unsigned long *dma_walk_cpu_trans(unsigned long *rto, dma_addr_t dma_addr)98unsigned long *dma_walk_cpu_trans(unsigned long *rto, dma_addr_t dma_addr)
99{99{
100 unsigned long *sto, *pto;100 unsigned long *sto, *pto;
101 unsigned int rtx, sx, px;101 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
114 return &pto[px];114 return &pto[px];
115}115}
116 116
117void dma_update_cpu_trans(unsigned long *dma_table, void *page_addr,117void dma_update_cpu_trans(unsigned long *entry, void *page_addr, int flags)
118 dma_addr_t dma_addr, int flags)
119{118{
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
128 if (flags & ZPCI_PTE_INVALID) {119 if (flags & ZPCI_PTE_INVALID) {
129 invalidate_pt_entry(entry);120 invalidate_pt_entry(entry);
130 return;
131 } else {121 } else {
132 set_pt_pfaa(entry, page_addr);122 set_pt_pfaa(entry, page_addr);
133 validate_pt_entry(entry);123 validate_pt_entry(entry);
@@ -146,18 +136,25 @@ static int dma_update_trans(struct zpci_dev *zdev, unsigned long pa, · 12 unmodified lines
146 u8 *page_addr = (u8 *) (pa & PAGE_MASK);136 u8 *page_addr = (u8 *) (pa & PAGE_MASK);
147 dma_addr_t start_dma_addr = dma_addr;137 dma_addr_t start_dma_addr = dma_addr;
148 unsigned long irq_flags;138 unsigned long irq_flags;
139 unsigned long *entry;
149 int i, rc = 0;140 int i, rc = 0;
150 141
151 if (!nr_pages)142 if (!nr_pages)
152 return -EINVAL;143 return -EINVAL;
153 144
154 spin_lock_irqsave(&zdev->dma_table_lock, irq_flags);145 spin_lock_irqsave(&zdev->dma_table_lock, irq_flags);
155 if (!zdev->dma_table)146 if (!zdev->dma_table) {
147 rc = -EINVAL;
156 goto no_refresh;148 goto no_refresh;
149 }
157 150
158 for (i = 0; i < nr_pages; i++) {151 for (i = 0; i < nr_pages; i++) {
159 dma_update_cpu_trans(zdev->dma_table, page_addr, dma_addr,152 entry = dma_walk_cpu_trans(zdev->dma_table, dma_addr);
160 flags);153 if (!entry) {
154 rc = -ENOMEM;
155 goto undo_cpu_trans;
156 }
157 dma_update_cpu_trans(entry, page_addr, flags);
161 page_addr += PAGE_SIZE;158 page_addr += PAGE_SIZE;
162 dma_addr += PAGE_SIZE;159 dma_addr += PAGE_SIZE;
163 }160 }
@@ -176,6 +173,18 @@ static int dma_update_trans(struct zpci_dev *zdev, unsigned long pa, · 12 unmodified lines
176 173
177 rc = zpci_refresh_trans((u64) zdev->fh << 32, start_dma_addr,174 rc = zpci_refresh_trans((u64) zdev->fh << 32, start_dma_addr,
178 nr_pages * PAGE_SIZE);175 nr_pages * PAGE_SIZE);
176undo_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 }
179 188
180no_refresh:189no_refresh:
181 spin_unlock_irqrestore(&zdev->dma_table_lock, irq_flags);190 spin_unlock_irqrestore(&zdev->dma_table_lock, irq_flags);
@@ -260,6 +269,16 @@ out: · 78 unmodified lines
260 spin_unlock_irqrestore(&zdev->iommu_bitmap_lock, flags);269 spin_unlock_irqrestore(&zdev->iommu_bitmap_lock, flags);
261}270}
262 271
272static 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
263static dma_addr_t s390_dma_map_pages(struct device *dev, struct page *page,282static dma_addr_t s390_dma_map_pages(struct device *dev, struct page *page,
264 unsigned long offset, size_t size,283 unsigned long offset, size_t size,
265 enum dma_data_direction direction,284 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
270 unsigned long pa = page_to_phys(page) + offset;289 unsigned long pa = page_to_phys(page) + offset;
271 int flags = ZPCI_PTE_VALID;290 int flags = ZPCI_PTE_VALID;
272 dma_addr_t dma_addr;291 dma_addr_t dma_addr;
292 int ret;
273 293
274 /* This rounds up number of pages based on size and offset */294 /* This rounds up number of pages based on size and offset */
275 nr_pages = iommu_num_pages(pa, size, PAGE_SIZE);295 nr_pages = iommu_num_pages(pa, size, PAGE_SIZE);
276 iommu_page_index = dma_alloc_iommu(zdev, nr_pages);296 iommu_page_index = dma_alloc_iommu(zdev, nr_pages);
277 if (iommu_page_index == -1)297 if (iommu_page_index == -1) {
298 ret = -ENOSPC;
278 goto out_err;299 goto out_err;
300 }
279 301
280 /* Use rounded up size */302 /* Use rounded up size */
281 size = nr_pages * PAGE_SIZE;303 size = nr_pages * PAGE_SIZE;
282 304
283 dma_addr = zdev->start_dma + iommu_page_index * PAGE_SIZE;305 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;
285 goto out_free;308 goto out_free;
309 }
286 310
287 if (direction == DMA_NONE || direction == DMA_TO_DEVICE)311 if (direction == DMA_NONE || direction == DMA_TO_DEVICE)
288 flags |= ZPCI_TABLE_PROTECTED;312 flags |= ZPCI_TABLE_PROTECTED;
289 313
290 if (!dma_update_trans(zdev, pa, dma_addr, size, flags)) {314 ret = dma_update_trans(zdev, pa, dma_addr, size, flags);
291 atomic64_add(nr_pages, &zdev->mapped_pages);315 if (ret)
292 return dma_addr + (offset & ~PAGE_MASK);316 goto out_free;
293 }317
318 atomic64_add(nr_pages, &zdev->mapped_pages);
319 return dma_addr + (offset & ~PAGE_MASK);
294 320
295out_free:321out_free:
296 dma_free_iommu(zdev, iommu_page_index, nr_pages);322 dma_free_iommu(zdev, iommu_page_index, nr_pages);
297out_err:323out_err:
298 zpci_err("map error:\n");324 zpci_err("map error:\n");
299 zpci_err_hex(&pa, sizeof(pa));325 zpci_err_dma(ret, pa);
300 return DMA_ERROR_CODE;326 return DMA_ERROR_CODE;
301}327}
302 328
@@ -306,14 +332,16 @@ static void s390_dma_unmap_pages(struct device *dev, dma_addr_t dma_addr, · 3 unmodified lines
306{332{
307 struct zpci_dev *zdev = to_zpci(to_pci_dev(dev));333 struct zpci_dev *zdev = to_zpci(to_pci_dev(dev));
308 unsigned long iommu_page_index;334 unsigned long iommu_page_index;
309 int npages;335 int npages, ret;
310 336
311 npages = iommu_num_pages(dma_addr, size, PAGE_SIZE);337 npages = iommu_num_pages(dma_addr, size, PAGE_SIZE);
312 dma_addr = dma_addr & PAGE_MASK;338 dma_addr = dma_addr & PAGE_MASK;
313 if (dma_update_trans(zdev, 0, dma_addr, npages * PAGE_SIZE,339 ret = dma_update_trans(zdev, 0, dma_addr, npages * PAGE_SIZE,
314 ZPCI_TABLE_PROTECTED | ZPCI_PTE_INVALID)) {340 ZPCI_PTE_INVALID);
341 if (ret) {
315 zpci_err("unmap error:\n");342 zpci_err("unmap error:\n");
316 zpci_err_hex(&dma_addr, sizeof(dma_addr));343 zpci_err_dma(ret, dma_addr);
344 return;
317 }345 }
318 346
319 atomic64_add(npages, &zdev->unmapped_pages);347 atomic64_add(npages, &zdev->unmapped_pages);
arch/x86/boot/boot.h+0−1
@@ -23,7 +23,6 @@ · 22 unmodified lines
23#include <stdarg.h>23#include <stdarg.h>
24#include <linux/types.h>24#include <linux/types.h>
25#include <linux/edd.h>25#include <linux/edd.h>
26#include <asm/boot.h>
27#include <asm/setup.h>26#include <asm/setup.h>
28#include "bitops.h"27#include "bitops.h"
29#include "ctype.h"28#include "ctype.h"
arch/x86/boot/video-mode.c+2−0
@@ -19,6 +19,8 @@ · 18 unmodified lines
19#include "video.h"19#include "video.h"
20#include "vesa.h"20#include "vesa.h"
21 21
22#include <uapi/asm/boot.h>
23
22/*24/*
23 * Common variables25 * Common variables
24 */26 */
arch/x86/boot/video.c+2−0
@@ -13,6 +13,8 @@ · 12 unmodified lines
13 * Select video mode13 * Select video mode
14 */14 */
15 15
16#include <uapi/asm/boot.h>
17
16#include "boot.h"18#include "boot.h"
17#include "video.h"19#include "video.h"
18#include "vesa.h"20#include "vesa.h"
arch/x86/entry/entry_64.S+18−1
@@ -509,6 +509,17 @@ END(irq_entries_start) · 508 unmodified lines
509 * tracking that we're in kernel mode.509 * tracking that we're in kernel mode.
510 */510 */
511 SWAPGS511 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
512#ifdef CONFIG_CONTEXT_TRACKING523#ifdef CONFIG_CONTEXT_TRACKING
513 call enter_from_user_mode524 call enter_from_user_mode
514#endif525#endif
@@ -1049,12 +1060,18 @@ ENTRY(error_entry) · 534 unmodified lines
1049 SWAPGS1060 SWAPGS
1050 1061
1051.Lerror_entry_from_usermode_after_swapgs:1062.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
1052#ifdef CONFIG_CONTEXT_TRACKING1069#ifdef CONFIG_CONTEXT_TRACKING
1053 call enter_from_user_mode1070 call enter_from_user_mode
1054#endif1071#endif
1072 ret
1055 1073
1056.Lerror_entry_done:1074.Lerror_entry_done:
1057
1058 TRACE_IRQS_OFF1075 TRACE_IRQS_OFF
1059 ret1076 ret
1060 1077
arch/x86/include/asm/msr-index.h+1−2
@@ -35,7 +35,7 @@ · 34 unmodified lines
35#define MSR_IA32_PERFCTR0 0x000000c135#define MSR_IA32_PERFCTR0 0x000000c1
36#define MSR_IA32_PERFCTR1 0x000000c236#define MSR_IA32_PERFCTR1 0x000000c2
37#define MSR_FSB_FREQ 0x000000cd37#define MSR_FSB_FREQ 0x000000cd
38#define MSR_NHM_PLATFORM_INFO 0x000000ce38#define MSR_PLATFORM_INFO 0x000000ce
39 39
40#define MSR_NHM_SNB_PKG_CST_CFG_CTL 0x000000e240#define MSR_NHM_SNB_PKG_CST_CFG_CTL 0x000000e2
41#define NHM_C3_AUTO_DEMOTE (1UL << 25)41#define NHM_C3_AUTO_DEMOTE (1UL << 25)
@@ -44,7 +44,6 @@ · 2 unmodified lines
44#define SNB_C1_AUTO_UNDEMOTE (1UL << 27)44#define SNB_C1_AUTO_UNDEMOTE (1UL << 27)
45#define SNB_C3_AUTO_UNDEMOTE (1UL << 28)45#define SNB_C3_AUTO_UNDEMOTE (1UL << 28)
46 46
47#define MSR_PLATFORM_INFO 0x000000ce
48#define MSR_MTRRcap 0x000000fe47#define MSR_MTRRcap 0x000000fe
49#define MSR_IA32_BBL_CR_CTL 0x0000011948#define MSR_IA32_BBL_CR_CTL 0x00000119
50#define MSR_IA32_BBL_CR_CTL3 0x0000011e49#define MSR_IA32_BBL_CR_CTL3 0x0000011e
arch/x86/include/asm/page_types.h+9−7
@@ -9,19 +9,21 @@ · 8 unmodified lines
9#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)9#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
10#define PAGE_MASK (~(PAGE_SIZE-1))10#define PAGE_MASK (~(PAGE_SIZE-1))
11 11
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
12#define __PHYSICAL_MASK ((phys_addr_t)((1ULL << __PHYSICAL_MASK_SHIFT) - 1))18#define __PHYSICAL_MASK ((phys_addr_t)((1ULL << __PHYSICAL_MASK_SHIFT) - 1))
13#define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1)19#define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1)
14 20
15/* Cast PAGE_MASK to a signed type so that it is sign-extended if21/* Cast *PAGE_MASK to a signed type so that it is sign-extended if
16 virtual addresses are 32-bits but physical addresses are larger22 virtual addresses are 32-bits but physical addresses are larger
17 (ie, 32-bit PAE). */23 (ie, 32-bit PAE). */
18#define PHYSICAL_PAGE_MASK (((signed long)PAGE_MASK) & __PHYSICAL_MASK)24#define PHYSICAL_PAGE_MASK (((signed long)PAGE_MASK) & __PHYSICAL_MASK)
19 25#define PHYSICAL_PMD_PAGE_MASK (((signed long)PMD_PAGE_MASK) & __PHYSICAL_MASK)
20#define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT)26#define PHYSICAL_PUD_PAGE_MASK (((signed long)PUD_PAGE_MASK) & __PHYSICAL_MASK)
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 27
26#define HPAGE_SHIFT PMD_SHIFT28#define HPAGE_SHIFT PMD_SHIFT
27#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)29#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
279static inline pudval_t pud_pfn_mask(pud_t pud)279static inline pudval_t pud_pfn_mask(pud_t pud)
280{280{
281 if (native_pud_val(pud) & _PAGE_PSE)281 if (native_pud_val(pud) & _PAGE_PSE)
282 return PUD_PAGE_MASK & PHYSICAL_PAGE_MASK;282 return PHYSICAL_PUD_PAGE_MASK;
283 else283 else
284 return PTE_PFN_MASK;284 return PTE_PFN_MASK;
285}285}
286 286
287static inline pudval_t pud_flags_mask(pud_t pud)287static inline pudval_t pud_flags_mask(pud_t pud)
288{288{
289 if (native_pud_val(pud) & _PAGE_PSE)289 return ~pud_pfn_mask(pud);
290 return ~(PUD_PAGE_MASK & (pudval_t)PHYSICAL_PAGE_MASK);
291 else
292 return ~PTE_PFN_MASK;
293}290}
294 291
295static inline pudval_t pud_flags(pud_t pud)292static inline pudval_t pud_flags(pud_t pud)
@@ -300,17 +297,14 @@ static inline pudval_t pud_flags(pud_t pud) · 4 unmodified lines
300static inline pmdval_t pmd_pfn_mask(pmd_t pmd)297static inline pmdval_t pmd_pfn_mask(pmd_t pmd)
301{298{
302 if (native_pmd_val(pmd) & _PAGE_PSE)299 if (native_pmd_val(pmd) & _PAGE_PSE)
303 return PMD_PAGE_MASK & PHYSICAL_PAGE_MASK;300 return PHYSICAL_PMD_PAGE_MASK;
304 else301 else
305 return PTE_PFN_MASK;302 return PTE_PFN_MASK;
306}303}
307 304
308static inline pmdval_t pmd_flags_mask(pmd_t pmd)305static inline pmdval_t pmd_flags_mask(pmd_t pmd)
309{306{
310 if (native_pmd_val(pmd) & _PAGE_PSE)307 return ~pmd_pfn_mask(pmd);
311 return ~(PMD_PAGE_MASK & (pmdval_t)PHYSICAL_PAGE_MASK);
312 else
313 return ~PTE_PFN_MASK;
314}308}
315 309
316static inline pmdval_t pmd_flags(pmd_t pmd)310static inline pmdval_t pmd_flags(pmd_t pmd)
arch/x86/include/asm/x86_init.h+0−1
@@ -1,7 +1,6 @@
1#ifndef _ASM_X86_PLATFORM_H1#ifndef _ASM_X86_PLATFORM_H
2#define _ASM_X86_PLATFORM_H2#define _ASM_X86_PLATFORM_H
3 3
4#include <asm/pgtable_types.h>
5#include <asm/bootparam.h>4#include <asm/bootparam.h>
6 5
7struct mpc_bus;6struct mpc_bus;
arch/x86/kernel/cpu/common.c+1−2
@@ -273,10 +273,9 @@ __setup("nosmap", setup_disable_smap); · 272 unmodified lines
273 273
274static __always_inline void setup_smap(struct cpuinfo_x86 *c)274static __always_inline void setup_smap(struct cpuinfo_x86 *c)
275{275{
276 unsigned long eflags;276 unsigned long eflags = native_save_fl();
277 277
278 /* This should have been cleared long ago */278 /* This should have been cleared long ago */
279 raw_local_save_flags(eflags);
280 BUG_ON(eflags & X86_EFLAGS_AC);279 BUG_ON(eflags & X86_EFLAGS_AC);
281 280
282 if (cpu_has(c, X86_FEATURE_SMAP)) {281 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
698 return error;698 return error;
699 699
700}700}
701late_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
385 */385 */
386void fpu__init_prepare_fx_sw_frame(void)386void fpu__init_prepare_fx_sw_frame(void)
387{387{
388 int fsave_header_size = sizeof(struct fregs_state);
389 int size = xstate_size + FP_XSTATE_MAGIC2_SIZE;388 int size = xstate_size + FP_XSTATE_MAGIC2_SIZE;
390 389
391 if (config_enabled(CONFIG_X86_32))
392 size += fsave_header_size;
393
394 fx_sw_reserved.magic1 = FP_XSTATE_MAGIC1;390 fx_sw_reserved.magic1 = FP_XSTATE_MAGIC1;
395 fx_sw_reserved.extended_size = size;391 fx_sw_reserved.extended_size = size;
396 fx_sw_reserved.xfeatures = xfeatures_mask;392 fx_sw_reserved.xfeatures = xfeatures_mask;
397 fx_sw_reserved.xstate_size = xstate_size;393 fx_sw_reserved.xstate_size = xstate_size;
398 394
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
400 fx_sw_reserved_ia32 = fx_sw_reserved;399 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;
402 }401 }
403}402}
404 403
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
694 if (!boot_cpu_has(X86_FEATURE_XSAVE))694 if (!boot_cpu_has(X86_FEATURE_XSAVE))
695 return NULL;695 return NULL;
696 696
697 xsave = &current->thread.fpu.state.xsave;
698 /*697 /*
699 * We should not ever be requesting features that we698 * We should not ever be requesting features that we
700 * have not enabled. Remember that pcntxt_mask is699 * have not enabled. Remember that pcntxt_mask is
arch/x86/kernel/mcount_64.S+6−0
@@ -278,6 +278,12 @@ trace: · 277 unmodified lines
278 /* save_mcount_regs fills in first two parameters */278 /* save_mcount_regs fills in first two parameters */
279 save_mcount_regs279 save_mcount_regs
280 280
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 */
281 call *ftrace_trace_function287 call *ftrace_trace_function
282 288
283 restore_mcount_regs289 restore_mcount_regs
arch/x86/kernel/pmem.c+12−0
@@ -4,10 +4,22 @@ · 3 unmodified lines
4 */4 */
5#include <linux/platform_device.h>5#include <linux/platform_device.h>
6#include <linux/module.h>6#include <linux/module.h>
7#include <linux/ioport.h>
8
9static int found(u64 start, u64 end, void *data)
10{
11 return 1;
12}
7 13
8static __init int register_e820_pmem(void)14static __init int register_e820_pmem(void)
9{15{
16 char *pmem = "Persistent Memory (legacy)";
10 struct platform_device *pdev;17 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;
11 23
12 /*24 /*
13 * See drivers/nvdimm/e820.c for the implementation, this is25 * 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
1250 if (efi_enabled(EFI_BOOT))1250 if (efi_enabled(EFI_BOOT))
1251 efi_apply_memmap_quirks();1251 efi_apply_memmap_quirks();
1252#endif1252#endif
1253
1254 microcode_init();
1255}1253}
1256 1254
1257#ifdef CONFIG_X86_321255#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
690 signal_setup_done(failed, ksig, stepping);690 signal_setup_done(failed, ksig, stepping);
691}691}
692 692
693#ifdef CONFIG_X86_32693static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs)
694#define NR_restart_syscall __NR_restart_syscall694{
695#else /* !CONFIG_X86_32 */695#if defined(CONFIG_X86_32) || !defined(CONFIG_X86_64)
696#define NR_restart_syscall \696 return __NR_restart_syscall;
697 test_thread_flag(TIF_IA32) ? __NR_ia32_restart_syscall : __NR_restart_syscall697#else /* !CONFIG_X86_32 && CONFIG_X86_64 */
698#endif /* CONFIG_X86_32 */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}
699 702
700/*703/*
701 * Note that 'init' is a special process: it doesn't get signals it doesn't704 * 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
724 break;727 break;
725 728
726 case -ERESTART_RESTARTBLOCK:729 case -ERESTART_RESTARTBLOCK:
727 regs->ax = NR_restart_syscall;730 regs->ax = get_nr_restart_syscall(regs);
728 regs->ip -= 2;731 regs->ip -= 2;
729 break;732 break;
730 }733 }
arch/x86/kernel/smpboot.c+5−4
@@ -509,7 +509,7 @@ void __inquire_remote_apic(int apicid) · 508 unmodified lines
509 */509 */
510#define UDELAY_10MS_DEFAULT 10000510#define UDELAY_10MS_DEFAULT 10000
511 511
512static unsigned int init_udelay = INT_MAX;512static unsigned int init_udelay = UINT_MAX;
513 513
514static int __init cpu_init_udelay(char *str)514static int __init cpu_init_udelay(char *str)
515{515{
@@ -522,14 +522,15 @@ early_param("cpu_init_udelay", cpu_init_udelay); · 6 unmodified lines
522static void __init smp_quirk_init_udelay(void)522static void __init smp_quirk_init_udelay(void)
523{523{
524 /* if cmdline changed it from default, leave it alone */524 /* if cmdline changed it from default, leave it alone */
525 if (init_udelay != INT_MAX)525 if (init_udelay != UINT_MAX)
526 return;526 return;
527 527
528 /* if modern processor, use no delay */528 /* if modern processor, use no delay */
529 if (((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && (boot_cpu_data.x86 == 6)) ||529 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))) {
531 init_udelay = 0;531 init_udelay = 0;
532 532 return;
533 }
533 /* else, use legacy delay */534 /* else, use legacy delay */
534 init_udelay = UDELAY_10MS_DEFAULT;535 init_udelay = UDELAY_10MS_DEFAULT;
535}536}
arch/x86/kvm/vmx.c+0−5
@@ -7394,11 +7394,6 @@ static int handle_invvpid(struct kvm_vcpu *vcpu) · 7393 unmodified lines
7394 7394
7395 switch (type) {7395 switch (type) {
7396 case VMX_VPID_EXTENT_ALL_CONTEXT:7396 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 }
7402 __vmx_flush_tlb(vcpu, to_vmx(vcpu)->nested.vpid02);7397 __vmx_flush_tlb(vcpu, to_vmx(vcpu)->nested.vpid02);
7403 nested_vmx_succeed(vcpu);7398 nested_vmx_succeed(vcpu);
7404 break;7399 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
2763 return 0;2763 return 0;
2764}2764}
2765 2765
2766static 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 */
2778static 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
2766static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu,2786static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu,
2767 struct kvm_interrupt *irq)2787 struct kvm_interrupt *irq)
2768{2788{
@@ -2786,6 +2806,7 @@ static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, · 17 unmodified lines
2786 return -EEXIST;2806 return -EEXIST;
2787 2807
2788 vcpu->arch.pending_external_vector = irq->irq;2808 vcpu->arch.pending_external_vector = irq->irq;
2809 kvm_make_request(KVM_REQ_EVENT, vcpu);
2789 return 0;2810 return 0;
2790}2811}
2791 2812
@@ -5910,23 +5931,10 @@ static int emulator_fix_hypercall(struct x86_emulate_ctxt *ctxt) · 3118 unmodified lines
5910 return emulator_write_emulated(ctxt, rip, instruction, 3, NULL);5931 return emulator_write_emulated(ctxt, rip, instruction, 3, NULL);
5911}5932}
5912 5933
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 */
5919static int dm_request_for_irq_injection(struct kvm_vcpu *vcpu)5934static int dm_request_for_irq_injection(struct kvm_vcpu *vcpu)
5920{5935{
5921 if (!vcpu->run->request_interrupt_window || pic_in_kernel(vcpu->kvm))5936 return vcpu->run->request_interrupt_window &&
5922 return false;5937 likely(!pic_in_kernel(vcpu->kvm));
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));
5930}5938}
5931 5939
5932static void post_kvm_run_save(struct kvm_vcpu *vcpu)5940static 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
5937 kvm_run->flags = is_smm(vcpu) ? KVM_RUN_X86_SMM : 0;5945 kvm_run->flags = is_smm(vcpu) ? KVM_RUN_X86_SMM : 0;
5938 kvm_run->cr8 = kvm_get_cr8(vcpu);5946 kvm_run->cr8 = kvm_get_cr8(vcpu);
5939 kvm_run->apic_base = kvm_get_apic_base(vcpu);5947 kvm_run->apic_base = kvm_get_apic_base(vcpu);
5940 if (!irqchip_in_kernel(vcpu->kvm))5948 kvm_run->ready_for_interrupt_injection =
5941 kvm_run->ready_for_interrupt_injection =5949 pic_in_kernel(vcpu->kvm) ||
5942 kvm_arch_interrupt_allowed(vcpu) &&5950 kvm_vcpu_ready_for_interrupt_injection(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;
5951}5951}
5952 5952
5953static void update_cr8_intercept(struct kvm_vcpu *vcpu)5953static 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
6360static int vcpu_enter_guest(struct kvm_vcpu *vcpu)6360static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
6361{6361{
6362 int r;6362 int r;
6363 bool req_int_win = !lapic_in_kernel(vcpu) &&6363 bool req_int_win =
6364 vcpu->run->request_interrupt_window;6364 dm_request_for_irq_injection(vcpu) &&
6365 kvm_cpu_accept_dm_intr(vcpu);
6366
6365 bool req_immediate_exit = false;6367 bool req_immediate_exit = false;
6366 6368
6367 if (vcpu->requests) {6369 if (vcpu->requests) {
@@ -6663,7 +6665,8 @@ static int vcpu_run(struct kvm_vcpu *vcpu) · 295 unmodified lines
6663 if (kvm_cpu_has_pending_timer(vcpu))6665 if (kvm_cpu_has_pending_timer(vcpu))
6664 kvm_inject_pending_timer_irqs(vcpu);6666 kvm_inject_pending_timer_irqs(vcpu);
6665 6667
6666 if (dm_request_for_irq_injection(vcpu)) {6668 if (dm_request_for_irq_injection(vcpu) &&
6669 kvm_vcpu_ready_for_interrupt_injection(vcpu)) {
6667 r = 0;6670 r = 0;
6668 vcpu->run->exit_reason = KVM_EXIT_IRQ_WINDOW_OPEN;6671 vcpu->run->exit_reason = KVM_EXIT_IRQ_WINDOW_OPEN;
6669 ++vcpu->stat.request_irq_exits;6672 ++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
101 switch (type) {101 switch (type) {
102 case REG_TYPE_RM:102 case REG_TYPE_RM:
103 regno = X86_MODRM_RM(insn->modrm.value);103 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))
105 regno += 8;105 regno += 8;
106 break;106 break;
107 107
108 case REG_TYPE_INDEX:108 case REG_TYPE_INDEX:
109 regno = X86_SIB_INDEX(insn->sib.value);109 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))
111 regno += 8;111 regno += 8;
112 break;112 break;
113 113
114 case REG_TYPE_BASE:114 case REG_TYPE_BASE:
115 regno = X86_SIB_BASE(insn->sib.value);115 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))
117 regno += 8;117 regno += 8;
118 break;118 break;
119 119
@@ -585,6 +585,29 @@ static unsigned long mpx_bd_entry_to_bt_addr(struct mm_struct *mm, · 465 unmodified lines
585 return bt_addr;585 return bt_addr;
586}586}
587 587
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 */
593int 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
588/*611/*
589 * Get the base of bounds tables pointed by specific bounds612 * Get the base of bounds tables pointed by specific bounds
590 * directory entry.613 * directory entry.
@@ -605,7 +628,7 @@ static int get_bt_addr(struct mm_struct *mm, · 14 unmodified lines
605 int need_write = 0;628 int need_write = 0;
606 629
607 pagefault_disable();630 pagefault_disable();
608 ret = get_user(bd_entry, bd_entry_ptr);631 ret = get_user_bd_entry(mm, &bd_entry, bd_entry_ptr);
609 pagefault_enable();632 pagefault_enable();
610 if (!ret)633 if (!ret)
611 break;634 break;
@@ -700,11 +723,23 @@ static unsigned long mpx_get_bt_entry_offset_bytes(struct mm_struct *mm, · 88 unmodified lines
700 */723 */
701static inline unsigned long bd_entry_virt_space(struct mm_struct *mm)724static inline unsigned long bd_entry_virt_space(struct mm_struct *mm)
702{725{
703 unsigned long long virt_space = (1ULL << boot_cpu_data.x86_virt_bits);726 unsigned long long virt_space;
704 if (is_64bit_mm(mm))727 unsigned long long GB = (1ULL << 30);
705 return virt_space / MPX_BD_NR_ENTRIES_64;728
706 else729 /*
707 return virt_space / MPX_BD_NR_ENTRIES_32;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;
708}743}
709 744
710/*745/*
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
50 if (!found)50 if (!found)
51 pci_add_resource(resources, &info->busn);51 pci_add_resource(resources, &info->busn);
52 52
53 list_for_each_entry(root_res, &info->resources, list) {53 list_for_each_entry(root_res, &info->resources, list)
54 struct resource *res;54 pci_add_resource(resources, &root_res->res);
55 struct resource *root;
56 55
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 }
65 return;56 return;
66 57
67default_resources:58default_resources:
block/blk-core.c+7−14
@@ -2114,7 +2114,8 @@ blk_qc_t submit_bio(int rw, struct bio *bio) · 2113 unmodified lines
2114EXPORT_SYMBOL(submit_bio);2114EXPORT_SYMBOL(submit_bio);
2115 2115
2116/**2116/**
2117 * blk_rq_check_limits - Helper function to check a request for the queue limit2117 * blk_cloned_rq_check_limits - Helper function to check a cloned request
2118 * for new the queue limits
2118 * @q: the queue2119 * @q: the queue
2119 * @rq: the request being checked2120 * @rq: the request being checked
2120 *2121 *
@@ -2125,20 +2126,13 @@ EXPORT_SYMBOL(submit_bio); · 4 unmodified lines
2125 * after it is inserted to @q, it should be checked against @q before2126 * after it is inserted to @q, it should be checked against @q before
2126 * the insertion using this generic function.2127 * the insertion using this generic function.
2127 *2128 *
2128 * This function should also be useful for request stacking drivers
2129 * in some cases below, so export this function.
2130 * Request stacking drivers like request-based dm may change the queue2129 * 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).2130 * limits when retrying requests on other queues. Those requests need
2132 * Such request stacking drivers should check those requests against2131 * to be checked against the new queue limits again during dispatch.
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.
2136 */2132 */
2137int blk_rq_check_limits(struct request_queue *q, struct request *rq)2133static int blk_cloned_rq_check_limits(struct request_queue *q,
2134 struct request *rq)
2138{2135{
2139 if (!rq_mergeable(rq))
2140 return 0;
2141
2142 if (blk_rq_sectors(rq) > blk_queue_get_max_sectors(q, rq->cmd_flags)) {2136 if (blk_rq_sectors(rq) > blk_queue_get_max_sectors(q, rq->cmd_flags)) {
2143 printk(KERN_ERR "%s: over max size limit.\n", __func__);2137 printk(KERN_ERR "%s: over max size limit.\n", __func__);
2144 return -EIO;2138 return -EIO;
@@ -2158,7 +2152,6 @@ int blk_rq_check_limits(struct request_queue *q, struct request *rq) · 13 unmodified lines
2158 2152
2159 return 0;2153 return 0;
2160}2154}
2161EXPORT_SYMBOL_GPL(blk_rq_check_limits);
2162 2155
2163/**2156/**
2164 * blk_insert_cloned_request - Helper for stacking drivers to submit a request2157 * 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
2170 unsigned long flags;2163 unsigned long flags;
2171 int where = ELEVATOR_INSERT_BACK;2164 int where = ELEVATOR_INSERT_BACK;
2172 2165
2173 if (blk_rq_check_limits(q, rq))2166 if (blk_cloned_rq_check_limits(q, rq))
2174 return -EIO;2167 return -EIO;
2175 2168
2176 if (rq->rq_disk &&2169 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
76 struct bio_vec bv, bvprv, *bvprvp = NULL;76 struct bio_vec bv, bvprv, *bvprvp = NULL;
77 struct bvec_iter iter;77 struct bvec_iter iter;
78 unsigned seg_size = 0, nsegs = 0, sectors = 0;78 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;
79 82
80 bio_for_each_segment(bv, bio, iter) {83 bio_for_each_segment(bv, bio, iter) {
81 if (sectors + (bv.bv_len >> 9) > queue_max_sectors(q))84 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
98 101
99 seg_size += bv.bv_len;102 seg_size += bv.bv_len;
100 bvprv = bv;103 bvprv = bv;
101 bvprvp = &bv;104 bvprvp = &bvprv;
102 sectors += bv.bv_len >> 9;105 sectors += bv.bv_len >> 9;
106
107 if (nsegs == 1 && seg_size > front_seg_size)
108 front_seg_size = seg_size;
103 continue;109 continue;
104 }110 }
105new_segment:111new_segment:
@@ -108,16 +114,29 @@ new_segment: · 2 unmodified lines
108 114
109 nsegs++;115 nsegs++;
110 bvprv = bv;116 bvprv = bv;
111 bvprvp = &bv;117 bvprvp = &bvprv;
112 seg_size = bv.bv_len;118 seg_size = bv.bv_len;
113 sectors += bv.bv_len >> 9;119 sectors += bv.bv_len >> 9;
120
121 if (nsegs == 1 && seg_size > front_seg_size)
122 front_seg_size = seg_size;
114 }123 }
115 124
116 *segs = nsegs;125 do_split = false;
117 return NULL;
118split:126split:
119 *segs = nsegs;127 *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;
121}140}
122 141
123void blk_queue_split(struct request_queue *q, struct bio **bio,142void 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
412 if (sg)431 if (sg)
413 sg_mark_end(sg);432 sg_mark_end(sg);
414 433
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
415 return nsegs;440 return nsegs;
416}441}
417EXPORT_SYMBOL(blk_rq_map_sg);442EXPORT_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
1291 blk_mq_bio_to_request(rq, bio);1291 blk_mq_bio_to_request(rq, bio);
1292 1292
1293 /*1293 /*
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.
1295 * Otherwise the existing request in the plug list will be1295 * Otherwise the existing request in the plug list will be
1296 * issued. So the plug list will have one request at most1296 * issued. So the plug list will have one request at most
1297 */1297 */
1298 if (plug) {1298 if (plug) {
1299 /*1299 /*
1300 * The plug list might get flushed before this. If that1300 * The plug list might get flushed before this. If that
1301 * happens, same_queue_rq is invalid and plug list is empty1301 * happens, same_queue_rq is invalid and plug list is
1302 **/1302 * empty
1303 */
1303 if (same_queue_rq && !list_empty(&plug->mq_list)) {1304 if (same_queue_rq && !list_empty(&plug->mq_list)) {
1304 old_rq = same_queue_rq;1305 old_rq = same_queue_rq;
1305 list_del_init(&old_rq->queuelist);1306 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
1380 blk_mq_bio_to_request(rq, bio);1381 blk_mq_bio_to_request(rq, bio);
1381 if (!request_count)1382 if (!request_count)
1382 trace_block_plug(q);1383 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) {
1384 blk_flush_plug_list(plug, false);1388 blk_flush_plug_list(plug, false);
1385 trace_block_plug(q);1389 trace_block_plug(q);
1386 }1390 }
1391
1387 list_add_tail(&rq->queuelist, &plug->mq_list);1392 list_add_tail(&rq->queuelist, &plug->mq_list);
1388 blk_mq_put_ctx(data.ctx);
1389 return cookie;1393 return cookie;
1390 }1394 }
1391 1395
block/blk-settings.c+16−20
@@ -91,7 +91,8 @@ void blk_set_default_limits(struct queue_limits *lim) · 90 unmodified lines
91 lim->seg_boundary_mask = BLK_SEG_BOUNDARY_MASK;91 lim->seg_boundary_mask = BLK_SEG_BOUNDARY_MASK;
92 lim->virt_boundary_mask = 0;92 lim->virt_boundary_mask = 0;
93 lim->max_segment_size = BLK_MAX_SEGMENT_SIZE;93 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;
95 lim->chunk_sectors = 0;96 lim->chunk_sectors = 0;
96 lim->max_write_same_sectors = 0;97 lim->max_write_same_sectors = 0;
97 lim->max_discard_sectors = 0;98 lim->max_discard_sectors = 0;
@@ -127,6 +128,7 @@ void blk_set_stacking_limits(struct queue_limits *lim) · 29 unmodified lines
127 lim->max_hw_sectors = UINT_MAX;128 lim->max_hw_sectors = UINT_MAX;
128 lim->max_segment_size = UINT_MAX;129 lim->max_segment_size = UINT_MAX;
129 lim->max_sectors = UINT_MAX;130 lim->max_sectors = UINT_MAX;
131 lim->max_dev_sectors = UINT_MAX;
130 lim->max_write_same_sectors = UINT_MAX;132 lim->max_write_same_sectors = UINT_MAX;
131}133}
132EXPORT_SYMBOL(blk_set_stacking_limits);134EXPORT_SYMBOL(blk_set_stacking_limits);
@@ -214,8 +216,8 @@ void blk_queue_bounce_limit(struct request_queue *q, u64 max_addr) · 81 unmodified lines
214EXPORT_SYMBOL(blk_queue_bounce_limit);216EXPORT_SYMBOL(blk_queue_bounce_limit);
215 217
216/**218/**
217 * blk_limits_max_hw_sectors - set hard and soft limit of max sectors for request219 * blk_queue_max_hw_sectors - set max sectors for a request for this queue
218 * @limits: the queue limits220 * @q: the request queue for the device
219 * @max_hw_sectors: max hardware sectors in the usual 512b unit221 * @max_hw_sectors: max hardware sectors in the usual 512b unit
220 *222 *
221 * Description:223 * Description:
@@ -224,13 +226,19 @@ EXPORT_SYMBOL(blk_queue_bounce_limit); · 2 unmodified lines
224 * the device driver based upon the capabilities of the I/O226 * the device driver based upon the capabilities of the I/O
225 * controller.227 * controller.
226 *228 *
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 *
227 * max_sectors is a soft limit imposed by the block layer for232 * max_sectors is a soft limit imposed by the block layer for
228 * filesystem type requests. This value can be overridden on a233 * filesystem type requests. This value can be overridden on a
229 * per-device basis in /sys/block/<device>/queue/max_sectors_kb.234 * per-device basis in /sys/block/<device>/queue/max_sectors_kb.
230 * The soft limit can not exceed max_hw_sectors.235 * The soft limit can not exceed max_hw_sectors.
231 **/236 **/
232void blk_limits_max_hw_sectors(struct queue_limits *limits, unsigned int max_hw_sectors)237void blk_queue_max_hw_sectors(struct request_queue *q, unsigned int max_hw_sectors)
233{238{
239 struct queue_limits *limits = &q->limits;
240 unsigned int max_sectors;
241
234 if ((max_hw_sectors << 9) < PAGE_CACHE_SIZE) {242 if ((max_hw_sectors << 9) < PAGE_CACHE_SIZE) {
235 max_hw_sectors = 1 << (PAGE_CACHE_SHIFT - 9);243 max_hw_sectors = 1 << (PAGE_CACHE_SHIFT - 9);
236 printk(KERN_INFO "%s: set to minimum %d\n",244 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
238 }246 }
239 247
240 limits->max_hw_sectors = max_hw_sectors;248 limits->max_hw_sectors = max_hw_sectors;
241 limits->max_sectors = min_t(unsigned int, max_hw_sectors,249 max_sectors = min_not_zero(max_hw_sectors, limits->max_dev_sectors);
242 BLK_DEF_MAX_SECTORS);250 max_sectors = min_t(unsigned int, max_sectors, BLK_DEF_MAX_SECTORS);
243}251 limits->max_sectors = max_sectors;
244EXPORT_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 **/
254void 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);
257}252}
258EXPORT_SYMBOL(blk_queue_max_hw_sectors);253EXPORT_SYMBOL(blk_queue_max_hw_sectors);
259 254
@@ -527,6 +522,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, · 267 unmodified lines
527 522
528 t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors);523 t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors);
529 t->max_hw_sectors = min_not_zero(t->max_hw_sectors, b->max_hw_sectors);524 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);
530 t->max_write_same_sectors = min(t->max_write_same_sectors,526 t->max_write_same_sectors = min(t->max_write_same_sectors,
531 b->max_write_same_sectors);527 b->max_write_same_sectors);
532 t->bounce_pfn = min_not_zero(t->bounce_pfn, b->bounce_pfn);528 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
205 if (ret < 0)205 if (ret < 0)
206 return ret;206 return ret;
207 207
208 max_hw_sectors_kb = min_not_zero(max_hw_sectors_kb, (unsigned long)
209 q->limits.max_dev_sectors >> 1);
210
208 if (max_sectors_kb > max_hw_sectors_kb || max_sectors_kb < page_kb)211 if (max_sectors_kb > max_hw_sectors_kb || max_sectors_kb < page_kb)
209 return -EINVAL;212 return -EINVAL;
210 213
block/blk-timeout.c+5−3
@@ -158,11 +158,13 @@ void blk_abort_request(struct request *req) · 157 unmodified lines
158{158{
159 if (blk_mark_rq_complete(req))159 if (blk_mark_rq_complete(req))
160 return;160 return;
161 blk_delete_timer(req);161
162 if (req->q->mq_ops)162 if (req->q->mq_ops) {
163 blk_mq_rq_timed_out(req, false);163 blk_mq_rq_timed_out(req, false);
164 else164 } else {
165 blk_delete_timer(req);
165 blk_rq_timed_out(req);166 blk_rq_timed_out(req);
167 }
166}168}
167EXPORT_SYMBOL_GPL(blk_abort_request);169EXPORT_SYMBOL_GPL(blk_abort_request);
168 170
block/blk.h+0−2
@@ -72,8 +72,6 @@ void blk_dequeue_request(struct request *rq); · 71 unmodified lines
72void __blk_queue_free_tags(struct request_queue *q);72void __blk_queue_free_tags(struct request_queue *q);
73bool __blk_end_bidi_request(struct request *rq, int error,73bool __blk_end_bidi_request(struct request *rq, int error,
74 unsigned int nr_bytes, unsigned int bidi_bytes);74 unsigned int nr_bytes, unsigned int bidi_bytes);
75int blk_queue_enter(struct request_queue *q, gfp_t gfp);
76void blk_queue_exit(struct request_queue *q);
77void blk_freeze_queue(struct request_queue *q);75void blk_freeze_queue(struct request_queue *q);
78 76
79static inline void blk_queue_enter_live(struct request_queue *q)77static 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
21static int noop_dispatch(struct request_queue *q, int force)21static int noop_dispatch(struct request_queue *q, int force)
22{22{
23 struct noop_data *nd = q->elevator->elevator_data;23 struct noop_data *nd = q->elevator->elevator_data;
24 struct request *rq;
24 25
25 if (!list_empty(&nd->queue)) {26 rq = list_first_entry_or_null(&nd->queue, struct request, queuelist);
26 struct request *rq;27 if (rq) {
27 rq = list_entry(nd->queue.next, struct request, queuelist);
28 list_del_init(&rq->queuelist);28 list_del_init(&rq->queuelist);
29 elv_dispatch_sort(q, rq);29 elv_dispatch_sort(q, rq);
30 return 1;30 return 1;
@@ -46,7 +46,7 @@ noop_former_request(struct request_queue *q, struct request *rq) · 15 unmodified lines
46 46
47 if (rq->queuelist.prev == &nd->queue)47 if (rq->queuelist.prev == &nd->queue)
48 return NULL;48 return NULL;
49 return list_entry(rq->queuelist.prev, struct request, queuelist);49 return list_prev_entry(rq, queuelist);
50}50}
51 51
52static struct request *52static struct request *
@@ -56,7 +56,7 @@ noop_latter_request(struct request_queue *q, struct request *rq) · 3 unmodified lines
56 56
57 if (rq->queuelist.next == &nd->queue)57 if (rq->queuelist.next == &nd->queue)
58 return NULL;58 return NULL;
59 return list_entry(rq->queuelist.next, struct request, queuelist);59 return list_next_entry(rq, queuelist);
60}60}
61 61
62static int noop_init_queue(struct request_queue *q, struct elevator_type *e)62static 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
397 struct hd_struct *part;397 struct hd_struct *part;
398 int res;398 int res;
399 399
400 if (bdev->bd_part_count)400 if (bdev->bd_part_count || bdev->bd_super)
401 return -EBUSY;401 return -EBUSY;
402 res = invalidate_partition(disk, 0);402 res = invalidate_partition(disk, 0);
403 if (res)403 if (res)
block/partitions/mac.c+7−3
@@ -32,7 +32,7 @@ int mac_partition(struct parsed_partitions *state) · 31 unmodified lines
32 Sector sect;32 Sector sect;
33 unsigned char *data;33 unsigned char *data;
34 int slot, blocks_in_map;34 int slot, blocks_in_map;
35 unsigned secsize;35 unsigned secsize, datasize, partoffset;
36#ifdef CONFIG_PPC_PMAC36#ifdef CONFIG_PPC_PMAC
37 int found_root = 0;37 int found_root = 0;
38 int found_root_goodness = 0;38 int found_root_goodness = 0;
@@ -50,10 +50,14 @@ int mac_partition(struct parsed_partitions *state) · 11 unmodified lines
50 }50 }
51 secsize = be16_to_cpu(md->block_size);51 secsize = be16_to_cpu(md->block_size);
52 put_dev_sector(sect);52 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);
54 if (!data)55 if (!data)
55 return -1;56 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);
57 if (be16_to_cpu(part->signature) != MAC_PARTITION_MAGIC) {61 if (be16_to_cpu(part->signature) != MAC_PARTITION_MAGIC) {
58 put_dev_sector(sect);62 put_dev_sector(sect);
59 return 0; /* not a MacOS disk */63 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
125 if (flags & MSG_DONTWAIT)125 if (flags & MSG_DONTWAIT)
126 return -EAGAIN;126 return -EAGAIN;
127 127
128 set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);128 sk_set_bit(SOCKWQ_ASYNC_WAITDATA, sk);
129 129
130 for (;;) {130 for (;;) {
131 if (signal_pending(current))131 if (signal_pending(current))
@@ -139,7 +139,7 @@ static int aead_wait_for_data(struct sock *sk, unsigned flags) · 7 unmodified lines
139 }139 }
140 finish_wait(sk_sleep(sk), &wait);140 finish_wait(sk_sleep(sk), &wait);
141 141
142 clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);142 sk_clear_bit(SOCKWQ_ASYNC_WAITDATA, sk);
143 143
144 return err;144 return err;
145}145}
crypto/algif_skcipher.c+3−3
@@ -212,7 +212,7 @@ static int skcipher_wait_for_wmem(struct sock *sk, unsigned flags) · 211 unmodified lines
212 if (flags & MSG_DONTWAIT)212 if (flags & MSG_DONTWAIT)
213 return -EAGAIN;213 return -EAGAIN;
214 214
215 set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);215 sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk);
216 216
217 for (;;) {217 for (;;) {
218 if (signal_pending(current))218 if (signal_pending(current))
@@ -258,7 +258,7 @@ static int skcipher_wait_for_data(struct sock *sk, unsigned flags) · 39 unmodified lines
258 return -EAGAIN;258 return -EAGAIN;
259 }259 }
260 260
261 set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);261 sk_set_bit(SOCKWQ_ASYNC_WAITDATA, sk);
262 262
263 for (;;) {263 for (;;) {
264 if (signal_pending(current))264 if (signal_pending(current))
@@ -272,7 +272,7 @@ static int skcipher_wait_for_data(struct sock *sk, unsigned flags) · 7 unmodified lines
272 }272 }
273 finish_wait(sk_sleep(sk), &wait);273 finish_wait(sk_sleep(sk), &wait);
274 274
275 clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);275 sk_clear_bit(SOCKWQ_ASYNC_WAITDATA, sk);
276 276
277 return err;277 return err;
278}278}
drivers/Makefile+1−1
@@ -63,6 +63,7 @@ obj-$(CONFIG_FB_I810) += video/fbdev/i810/ · 62 unmodified lines
63obj-$(CONFIG_FB_INTEL) += video/fbdev/intelfb/63obj-$(CONFIG_FB_INTEL) += video/fbdev/intelfb/
64 64
65obj-$(CONFIG_PARPORT) += parport/65obj-$(CONFIG_PARPORT) += parport/
66obj-$(CONFIG_NVM) += lightnvm/
66obj-y += base/ block/ misc/ mfd/ nfc/67obj-y += base/ block/ misc/ mfd/ nfc/
67obj-$(CONFIG_LIBNVDIMM) += nvdimm/68obj-$(CONFIG_LIBNVDIMM) += nvdimm/
68obj-$(CONFIG_DMA_SHARED_BUFFER) += dma-buf/69obj-$(CONFIG_DMA_SHARED_BUFFER) += dma-buf/
@@ -70,7 +71,6 @@ obj-$(CONFIG_NUBUS) += nubus/ · 1 unmodified line
70obj-y += macintosh/71obj-y += macintosh/
71obj-$(CONFIG_IDE) += ide/72obj-$(CONFIG_IDE) += ide/
72obj-$(CONFIG_SCSI) += scsi/73obj-$(CONFIG_SCSI) += scsi/
73obj-$(CONFIG_NVM) += lightnvm/
74obj-y += nvme/74obj-y += nvme/
75obj-$(CONFIG_ATA) += ata/75obj-$(CONFIG_ATA) += ata/
76obj-$(CONFIG_TARGET_CORE) += target/76obj-$(CONFIG_TARGET_CORE) += target/
drivers/acpi/Kconfig+2−2
@@ -58,10 +58,10 @@ config ACPI_CCA_REQUIRED · 57 unmodified lines
58 bool58 bool
59 59
60config ACPI_DEBUGGER60config ACPI_DEBUGGER
61 bool "In-kernel debugger (EXPERIMENTAL)"61 bool "AML debugger interface (EXPERIMENTAL)"
62 select ACPI_DEBUG62 select ACPI_DEBUG
63 help63 help
64 Enable in-kernel debugging facilities: statistics, internal64 Enable in-kernel debugging of AML facilities: statistics, internal
65 object dump, single step control method execution.65 object dump, single step control method execution.
66 This is still under development, currently enabling this only66 This is still under development, currently enabling this only
67 results in the compilation of the ACPICA debugger files.67 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
304 304
305static int register_pcc_channel(int pcc_subspace_idx)305static int register_pcc_channel(int pcc_subspace_idx)
306{306{
307 struct acpi_pcct_subspace *cppc_ss;307 struct acpi_pcct_hw_reduced *cppc_ss;
308 unsigned int len;308 unsigned int len;
309 309
310 if (pcc_subspace_idx >= 0) {310 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
1103 }1103 }
1104 1104
1105err_exit:1105err_exit:
1106 if (result && q)1106 if (result)
1107 acpi_ec_delete_query(q);1107 acpi_ec_delete_query(q);
1108 if (data)1108 if (data)
1109 *data = value;1109 *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
233 struct nfit_table_prev *prev,233 struct nfit_table_prev *prev,
234 struct acpi_nfit_system_address *spa)234 struct acpi_nfit_system_address *spa)
235{235{
236 size_t length = min_t(size_t, sizeof(*spa), spa->header.length);
236 struct device *dev = acpi_desc->dev;237 struct device *dev = acpi_desc->dev;
237 struct nfit_spa *nfit_spa;238 struct nfit_spa *nfit_spa;
238 239
239 list_for_each_entry(nfit_spa, &prev->spas, list) {240 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) {
241 list_move_tail(&nfit_spa->list, &acpi_desc->spas);242 list_move_tail(&nfit_spa->list, &acpi_desc->spas);
242 return true;243 return true;
243 }244 }
@@ -259,11 +260,12 @@ static bool add_memdev(struct acpi_nfit_desc *acpi_desc, · 15 unmodified lines
259 struct nfit_table_prev *prev,260 struct nfit_table_prev *prev,
260 struct acpi_nfit_memory_map *memdev)261 struct acpi_nfit_memory_map *memdev)
261{262{
263 size_t length = min_t(size_t, sizeof(*memdev), memdev->header.length);
262 struct device *dev = acpi_desc->dev;264 struct device *dev = acpi_desc->dev;
263 struct nfit_memdev *nfit_memdev;265 struct nfit_memdev *nfit_memdev;
264 266
265 list_for_each_entry(nfit_memdev, &prev->memdevs, list)267 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) {
267 list_move_tail(&nfit_memdev->list, &acpi_desc->memdevs);269 list_move_tail(&nfit_memdev->list, &acpi_desc->memdevs);
268 return true;270 return true;
269 }271 }
@@ -284,11 +286,12 @@ static bool add_dcr(struct acpi_nfit_desc *acpi_desc, · 14 unmodified lines
284 struct nfit_table_prev *prev,286 struct nfit_table_prev *prev,
285 struct acpi_nfit_control_region *dcr)287 struct acpi_nfit_control_region *dcr)
286{288{
289 size_t length = min_t(size_t, sizeof(*dcr), dcr->header.length);
287 struct device *dev = acpi_desc->dev;290 struct device *dev = acpi_desc->dev;
288 struct nfit_dcr *nfit_dcr;291 struct nfit_dcr *nfit_dcr;
289 292
290 list_for_each_entry(nfit_dcr, &prev->dcrs, list)293 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) {
292 list_move_tail(&nfit_dcr->list, &acpi_desc->dcrs);295 list_move_tail(&nfit_dcr->list, &acpi_desc->dcrs);
293 return true;296 return true;
294 }297 }
@@ -308,11 +311,12 @@ static bool add_bdw(struct acpi_nfit_desc *acpi_desc, · 13 unmodified lines
308 struct nfit_table_prev *prev,311 struct nfit_table_prev *prev,
309 struct acpi_nfit_data_region *bdw)312 struct acpi_nfit_data_region *bdw)
310{313{
314 size_t length = min_t(size_t, sizeof(*bdw), bdw->header.length);
311 struct device *dev = acpi_desc->dev;315 struct device *dev = acpi_desc->dev;
312 struct nfit_bdw *nfit_bdw;316 struct nfit_bdw *nfit_bdw;
313 317
314 list_for_each_entry(nfit_bdw, &prev->bdws, list)318 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) {
316 list_move_tail(&nfit_bdw->list, &acpi_desc->bdws);320 list_move_tail(&nfit_bdw->list, &acpi_desc->bdws);
317 return true;321 return true;
318 }322 }
@@ -332,11 +336,12 @@ static bool add_idt(struct acpi_nfit_desc *acpi_desc, · 13 unmodified lines
332 struct nfit_table_prev *prev,336 struct nfit_table_prev *prev,
333 struct acpi_nfit_interleave *idt)337 struct acpi_nfit_interleave *idt)
334{338{
339 size_t length = min_t(size_t, sizeof(*idt), idt->header.length);
335 struct device *dev = acpi_desc->dev;340 struct device *dev = acpi_desc->dev;
336 struct nfit_idt *nfit_idt;341 struct nfit_idt *nfit_idt;
337 342
338 list_for_each_entry(nfit_idt, &prev->idts, list)343 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) {
340 list_move_tail(&nfit_idt->list, &acpi_desc->idts);345 list_move_tail(&nfit_idt->list, &acpi_desc->idts);
341 return true;346 return true;
342 }347 }
@@ -356,11 +361,12 @@ static bool add_flush(struct acpi_nfit_desc *acpi_desc, · 13 unmodified lines
356 struct nfit_table_prev *prev,361 struct nfit_table_prev *prev,
357 struct acpi_nfit_flush_address *flush)362 struct acpi_nfit_flush_address *flush)
358{363{
364 size_t length = min_t(size_t, sizeof(*flush), flush->header.length);
359 struct device *dev = acpi_desc->dev;365 struct device *dev = acpi_desc->dev;
360 struct nfit_flush *nfit_flush;366 struct nfit_flush *nfit_flush;
361 367
362 list_for_each_entry(nfit_flush, &prev->flushes, list)368 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) {
364 list_move_tail(&nfit_flush->list, &acpi_desc->flushes);370 list_move_tail(&nfit_flush->list, &acpi_desc->flushes);
365 return true;371 return true;
366 }372 }
@@ -655,7 +661,7 @@ static ssize_t revision_show(struct device *dev, · 288 unmodified lines
655 struct nvdimm_bus_descriptor *nd_desc = to_nd_desc(nvdimm_bus);661 struct nvdimm_bus_descriptor *nd_desc = to_nd_desc(nvdimm_bus);
656 struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc);662 struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc);
657 663
658 return sprintf(buf, "%d\n", acpi_desc->nfit->header.revision);664 return sprintf(buf, "%d\n", acpi_desc->acpi_header.revision);
659}665}
660static DEVICE_ATTR_RO(revision);666static DEVICE_ATTR_RO(revision);
661 667
@@ -1652,7 +1658,6 @@ int acpi_nfit_init(struct acpi_nfit_desc *acpi_desc, acpi_size sz) · 990 unmodified lines
1652 1658
1653 data = (u8 *) acpi_desc->nfit;1659 data = (u8 *) acpi_desc->nfit;
1654 end = data + sz;1660 end = data + sz;
1655 data += sizeof(struct acpi_table_nfit);
1656 while (!IS_ERR_OR_NULL(data))1661 while (!IS_ERR_OR_NULL(data))
1657 data = add_table(acpi_desc, &prev, data, end);1662 data = add_table(acpi_desc, &prev, data, end);
1658 1663
@@ -1748,13 +1753,29 @@ static int acpi_nfit_add(struct acpi_device *adev) · 89 unmodified lines
1748 return PTR_ERR(acpi_desc);1753 return PTR_ERR(acpi_desc);
1749 }1754 }
1750 1755
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);
1752 1763
1753 /* Evaluate _FIT and override with that if present */1764 /* Evaluate _FIT and override with that if present */
1754 status = acpi_evaluate_object(adev->handle, "_FIT", NULL, &buf);1765 status = acpi_evaluate_object(adev->handle, "_FIT", NULL, &buf);
1755 if (ACPI_SUCCESS(status) && buf.length > 0) {1766 if (ACPI_SUCCESS(status) && buf.length > 0) {
1756 acpi_desc->nfit = (struct acpi_table_nfit *)buf.pointer;1767 union acpi_object *obj;
1757 sz = buf.length;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);
1758 }1779 }
1759 1780
1760 rc = acpi_nfit_init(acpi_desc, sz);1781 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
1777{1798{
1778 struct acpi_nfit_desc *acpi_desc = dev_get_drvdata(&adev->dev);1799 struct acpi_nfit_desc *acpi_desc = dev_get_drvdata(&adev->dev);
1779 struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL };1800 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;
1781 struct device *dev = &adev->dev;1803 struct device *dev = &adev->dev;
1782 acpi_status status;1804 acpi_status status;
1783 int ret;1805 int ret;
@@ -1808,12 +1830,19 @@ static void acpi_nfit_notify(struct acpi_device *adev, u32 event) · 24 unmodified lines
1808 }1830 }
1809 1831
1810 nfit_saved = acpi_desc->nfit;1832 nfit_saved = acpi_desc->nfit;
1811 acpi_desc->nfit = (struct acpi_table_nfit *)buf.pointer;1833 obj = buf.pointer;
1812 ret = acpi_nfit_init(acpi_desc, buf.length);1834 if (obj->type == ACPI_TYPE_BUFFER) {
1813 if (!ret) {1835 acpi_desc->nfit =
1814 /* Merge failed, restore old nfit, and exit */1836 (struct acpi_nfit_header *)obj->buffer.pointer;
1815 acpi_desc->nfit = nfit_saved;1837 ret = acpi_nfit_init(acpi_desc, obj->buffer.length);
1816 dev_err(dev, "failed to merge updated NFIT\n");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");
1817 }1846 }
1818 kfree(buf.pointer);1847 kfree(buf.pointer);
1819 1848
drivers/acpi/nfit.h+2−1
@@ -96,7 +96,8 @@ struct nfit_mem { · 95 unmodified lines
96 96
97struct acpi_nfit_desc {97struct acpi_nfit_desc {
98 struct nvdimm_bus_descriptor nd_desc;98 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;
100 struct mutex spa_map_mutex;101 struct mutex spa_map_mutex;
101 struct mutex init_mutex;102 struct mutex init_mutex;
102 struct list_head spa_maps;103 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
768 else768 else
769 continue;769 continue;
770 770
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
771 conflict = insert_resource_conflict(root, res);778 conflict = insert_resource_conflict(root, res);
772 if (conflict) {779 if (conflict) {
773 dev_info(&info->bridge->dev,780 dev_info(&info->bridge->dev,
drivers/acpi/sbshc.c+7−41
@@ -14,7 +14,6 @@ · 13 unmodified lines
14#include <linux/delay.h>14#include <linux/delay.h>
15#include <linux/module.h>15#include <linux/module.h>
16#include <linux/interrupt.h>16#include <linux/interrupt.h>
17#include <linux/dmi.h>
18#include "sbshc.h"17#include "sbshc.h"
19 18
20#define PREFIX "ACPI: "19#define PREFIX "ACPI: "
@@ -30,6 +29,7 @@ struct acpi_smb_hc { · 9 unmodified lines
30 u8 query_bit;29 u8 query_bit;
31 smbus_alarm_callback callback;30 smbus_alarm_callback callback;
32 void *context;31 void *context;
32 bool done;
33};33};
34 34
35static int acpi_smbus_hc_add(struct acpi_device *device);35static int acpi_smbus_hc_add(struct acpi_device *device);
@@ -88,8 +88,6 @@ enum acpi_smb_offset { · 52 unmodified lines
88 ACPI_SMB_ALARM_DATA = 0x26, /* 2 bytes alarm data */88 ACPI_SMB_ALARM_DATA = 0x26, /* 2 bytes alarm data */
89};89};
90 90
91static bool macbook;
92
93static inline int smb_hc_read(struct acpi_smb_hc *hc, u8 address, u8 *data)91static inline int smb_hc_read(struct acpi_smb_hc *hc, u8 address, u8 *data)
94{92{
95 return ec_read(hc->offset + address, data);93 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
100 return ec_write(hc->offset + address, data);98 return ec_write(hc->offset + address, data);
101}99}
102 100
103static 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
110static int wait_transaction_complete(struct acpi_smb_hc *hc, int timeout)101static int wait_transaction_complete(struct acpi_smb_hc *hc, int timeout)
111{102{
112 if (wait_event_timeout(hc->wait, smb_check_done(hc),103 if (wait_event_timeout(hc->wait, hc->done, msecs_to_jiffies(timeout)))
113 msecs_to_jiffies(timeout)))
114 return 0;104 return 0;
115 /*105 return -ETIME;
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;
124}106}
125 107
126static int acpi_smbus_transaction(struct acpi_smb_hc *hc, u8 protocol,108static 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
135 }117 }
136 118
137 mutex_lock(&hc->lock);119 mutex_lock(&hc->lock);
138 if (macbook)120 hc->done = false;
139 udelay(5);
140 if (smb_hc_read(hc, ACPI_SMB_PROTOCOL, &temp))121 if (smb_hc_read(hc, ACPI_SMB_PROTOCOL, &temp))
141 goto end;122 goto end;
142 if (temp) {123 if (temp) {
@@ -235,8 +216,10 @@ static int smbus_alarm(void *context) · 92 unmodified lines
235 if (smb_hc_read(hc, ACPI_SMB_STATUS, &status.raw))216 if (smb_hc_read(hc, ACPI_SMB_STATUS, &status.raw))
236 return 0;217 return 0;
237 /* Check if it is only a completion notify */218 /* 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;
239 wake_up(&hc->wait);221 wake_up(&hc->wait);
222 }
240 if (!status.fields.alarm)223 if (!status.fields.alarm)
241 return 0;224 return 0;
242 mutex_lock(&hc->lock);225 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
262 acpi_handle handle, acpi_ec_query_func func,245 acpi_handle handle, acpi_ec_query_func func,
263 void *data);246 void *data);
264 247
265static 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
272static 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
280static int acpi_smbus_hc_add(struct acpi_device *device)248static int acpi_smbus_hc_add(struct acpi_device *device)
281{249{
282 int status;250 int status;
283 unsigned long long val;251 unsigned long long val;
284 struct acpi_smb_hc *hc;252 struct acpi_smb_hc *hc;
285 253
286 dmi_check_system(acpi_smbus_dmi_table);
287
288 if (!device)254 if (!device)
289 return -EINVAL;255 return -EINVAL;
290 256
drivers/base/power/domain.c+1−2
@@ -1775,10 +1775,10 @@ int genpd_dev_pm_attach(struct device *dev) · 1774 unmodified lines
1775 }1775 }
1776 1776
1777 pd = of_genpd_get_from_provider(&pd_args);1777 pd = of_genpd_get_from_provider(&pd_args);
1778 of_node_put(pd_args.np);
1778 if (IS_ERR(pd)) {1779 if (IS_ERR(pd)) {
1779 dev_dbg(dev, "%s() failed to find PM domain: %ld\n",1780 dev_dbg(dev, "%s() failed to find PM domain: %ld\n",
1780 __func__, PTR_ERR(pd));1781 __func__, PTR_ERR(pd));
1781 of_node_put(dev->of_node);
1782 return -EPROBE_DEFER;1782 return -EPROBE_DEFER;
1783 }1783 }
1784 1784
@@ -1796,7 +1796,6 @@ int genpd_dev_pm_attach(struct device *dev) · 11 unmodified lines
1796 if (ret < 0) {1796 if (ret < 0) {
1797 dev_err(dev, "failed to add to PM domain %s: %d",1797 dev_err(dev, "failed to add to PM domain %s: %d",
1798 pd->name, ret);1798 pd->name, ret);
1799 of_node_put(dev->of_node);
1800 goto out;1799 goto out;
1801 }1800 }
1802 1801
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
160 struct gpd_timing_data *td;160 struct gpd_timing_data *td;
161 s64 constraint_ns;161 s64 constraint_ns;
162 162
163 if (!pdd->dev->driver)
164 continue;
165
166 /*163 /*
167 * Check if the device is allowed to be off long enough for the164 * Check if the device is allowed to be off long enough for the
168 * domain to turn off and on (that's how much time it will165 * 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
68 struct wake_irq *wirq;68 struct wake_irq *wirq;
69 int err;69 int err;
70 70
71 if (irq < 0)
72 return -EINVAL;
73
71 wirq = kzalloc(sizeof(*wirq), GFP_KERNEL);74 wirq = kzalloc(sizeof(*wirq), GFP_KERNEL);
72 if (!wirq)75 if (!wirq)
73 return -ENOMEM;76 return -ENOMEM;
@@ -167,6 +170,9 @@ int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq) · 93 unmodified lines
167 struct wake_irq *wirq;170 struct wake_irq *wirq;
168 int err;171 int err;
169 172
173 if (irq < 0)
174 return -EINVAL;
175
170 wirq = kzalloc(sizeof(*wirq), GFP_KERNEL);176 wirq = kzalloc(sizeof(*wirq), GFP_KERNEL);
171 if (!wirq)177 if (!wirq)
172 return -ENOMEM;178 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
3810 sector_t capacity;3810 sector_t capacity;
3811 unsigned int index = 0;3811 unsigned int index = 0;
3812 struct kobject *kobj;3812 struct kobject *kobj;
3813 unsigned char thd_name[16];
3814 3813
3815 if (dd->disk)3814 if (dd->disk)
3816 goto skip_create_disk; /* hw init done, before rebuild */3815 goto skip_create_disk; /* hw init done, before rebuild */
@@ -3958,10 +3957,9 @@ skip_create_disk: · 141 unmodified lines
3958 }3957 }
3959 3958
3960start_service_thread:3959start_service_thread:
3961 sprintf(thd_name, "mtip_svc_thd_%02d", index);
3962 dd->mtip_svc_handler = kthread_create_on_node(mtip_service_thread,3960 dd->mtip_svc_handler = kthread_create_on_node(mtip_service_thread,
3963 dd, dd->numa_node, "%s",3961 dd, dd->numa_node,
3964 thd_name);3962 "mtip_svc_thd_%02d", index);
3965 3963
3966 if (IS_ERR(dd->mtip_svc_handler)) {3964 if (IS_ERR(dd->mtip_svc_handler)) {
3967 dev_err(&dd->pdev->dev, "service thread failed to start\n");3965 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
8#include <linux/slab.h>8#include <linux/slab.h>
9#include <linux/blk-mq.h>9#include <linux/blk-mq.h>
10#include <linux/hrtimer.h>10#include <linux/hrtimer.h>
11#include <linux/lightnvm.h>
11 12
12struct nullb_cmd {13struct nullb_cmd {
13 struct list_head list;14 struct list_head list;
@@ -17,6 +18,7 @@ struct nullb_cmd { · 3 unmodified lines
17 struct bio *bio;18 struct bio *bio;
18 unsigned int tag;19 unsigned int tag;
19 struct nullb_queue *nq;20 struct nullb_queue *nq;
21 struct hrtimer timer;
20};22};
21 23
22struct nullb_queue {24struct nullb_queue {
@@ -39,23 +41,14 @@ struct nullb { · 16 unmodified lines
39 41
40 struct nullb_queue *queues;42 struct nullb_queue *queues;
41 unsigned int nr_queues;43 unsigned int nr_queues;
44 char disk_name[DISK_NAME_LEN];
42};45};
43 46
44static LIST_HEAD(nullb_list);47static LIST_HEAD(nullb_list);
45static struct mutex lock;48static struct mutex lock;
46static int null_major;49static int null_major;
47static int nullb_indexes;50static int nullb_indexes;
48 51static struct kmem_cache *ppa_cache;
49struct 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 */
58static DEFINE_PER_CPU(struct completion_queue, completion_queues);
59 52
60enum {53enum {
61 NULL_IRQ_NONE = 0,54 NULL_IRQ_NONE = 0,
@@ -119,6 +112,10 @@ static int nr_devices = 2; · 57 unmodified lines
119module_param(nr_devices, int, S_IRUGO);112module_param(nr_devices, int, S_IRUGO);
120MODULE_PARM_DESC(nr_devices, "Number of devices to register");113MODULE_PARM_DESC(nr_devices, "Number of devices to register");
121 114
115static bool use_lightnvm;
116module_param(use_lightnvm, bool, S_IRUGO);
117MODULE_PARM_DESC(use_lightnvm, "Register as a LightNVM device");
118
122static int irqmode = NULL_IRQ_SOFTIRQ;119static int irqmode = NULL_IRQ_SOFTIRQ;
123 120
124static int null_set_irqmode(const char *str, const struct kernel_param *kp)121static 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
135device_param_cb(irqmode, &null_irqmode_param_ops, &irqmode, S_IRUGO);132device_param_cb(irqmode, &null_irqmode_param_ops, &irqmode, S_IRUGO);
136MODULE_PARM_DESC(irqmode, "IRQ completion handler. 0-none, 1-softirq, 2-timer");133MODULE_PARM_DESC(irqmode, "IRQ completion handler. 0-none, 1-softirq, 2-timer");
137 134
138static int completion_nsec = 10000;135static unsigned long completion_nsec = 10000;
139module_param(completion_nsec, int, S_IRUGO);136module_param(completion_nsec, ulong, S_IRUGO);
140MODULE_PARM_DESC(completion_nsec, "Time in ns to complete a request in hardware. Default: 10,000ns");137MODULE_PARM_DESC(completion_nsec, "Time in ns to complete a request in hardware. Default: 10,000ns");
141 138
142static int hw_queue_depth = 64;139static int hw_queue_depth = 64;
@@ -173,6 +170,8 @@ static void free_cmd(struct nullb_cmd *cmd) · 30 unmodified lines
173 put_tag(cmd->nq, cmd->tag);170 put_tag(cmd->nq, cmd->tag);
174}171}
175 172
173static enum hrtimer_restart null_cmd_timer_expired(struct hrtimer *timer);
174
176static struct nullb_cmd *__alloc_cmd(struct nullb_queue *nq)175static struct nullb_cmd *__alloc_cmd(struct nullb_queue *nq)
177{176{
178 struct nullb_cmd *cmd;177 struct nullb_cmd *cmd;
@@ -183,6 +182,11 @@ static struct nullb_cmd *__alloc_cmd(struct nullb_queue *nq) · 4 unmodified lines
183 cmd = &nq->cmds[tag];182 cmd = &nq->cmds[tag];
184 cmd->tag = tag;183 cmd->tag = tag;
185 cmd->nq = nq;184 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 }
186 return cmd;190 return cmd;
187 }191 }
188 192
@@ -213,6 +217,8 @@ static struct nullb_cmd *alloc_cmd(struct nullb_queue *nq, int can_wait) · 24 unmodified lines
213 217
214static void end_cmd(struct nullb_cmd *cmd)218static void end_cmd(struct nullb_cmd *cmd)
215{219{
220 struct request_queue *q = NULL;
221
216 switch (queue_mode) {222 switch (queue_mode) {
217 case NULL_Q_MQ:223 case NULL_Q_MQ:
218 blk_mq_end_request(cmd->rq, 0);224 blk_mq_end_request(cmd->rq, 0);
@@ -223,55 +229,37 @@ static void end_cmd(struct nullb_cmd *cmd) · 4 unmodified lines
223 break;229 break;
224 case NULL_Q_BIO:230 case NULL_Q_BIO:
225 bio_endio(cmd->bio);231 bio_endio(cmd->bio);
226 break;232 goto free_cmd;
227 }233 }
228 234
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 }
247free_cmd:
229 free_cmd(cmd);248 free_cmd(cmd);
230}249}
231 250
232static enum hrtimer_restart null_cmd_timer_expired(struct hrtimer *timer)251static enum hrtimer_restart null_cmd_timer_expired(struct hrtimer *timer)
233{252{
234 struct completion_queue *cq;253 end_cmd(container_of(timer, struct nullb_cmd, timer));
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 }
259 254
260 return HRTIMER_NORESTART;255 return HRTIMER_NORESTART;
261}256}
262 257
263static void null_cmd_end_timer(struct nullb_cmd *cmd)258static void null_cmd_end_timer(struct nullb_cmd *cmd)
264{259{
265 struct completion_queue *cq = &per_cpu(completion_queues, get_cpu());260 ktime_t kt = ktime_set(0, completion_nsec);
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);
270 261
271 hrtimer_start(&cq->timer, kt, HRTIMER_MODE_REL_PINNED);262 hrtimer_start(&cmd->timer, kt, HRTIMER_MODE_REL);
272 }
273
274 put_cpu();
275}263}
276 264
277static void null_softirq_done_fn(struct request *rq)265static 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
369{357{
370 struct nullb_cmd *cmd = blk_mq_rq_to_pdu(bd->rq);358 struct nullb_cmd *cmd = blk_mq_rq_to_pdu(bd->rq);
371 359
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 }
372 cmd->rq = bd->rq;364 cmd->rq = bd->rq;
373 cmd->nq = hctx->driver_data;365 cmd->nq = hctx->driver_data;
374 366
@@ -427,15 +419,156 @@ static void null_del_dev(struct nullb *nullb) · 52 unmodified lines
427{419{
428 list_del_init(&nullb->list);420 list_del_init(&nullb->list);
429 421
430 del_gendisk(nullb->disk);422 if (use_lightnvm)
423 nvm_unregister(nullb->disk_name);
424 else
425 del_gendisk(nullb->disk);
431 blk_cleanup_queue(nullb->q);426 blk_cleanup_queue(nullb->q);
432 if (queue_mode == NULL_Q_MQ)427 if (queue_mode == NULL_Q_MQ)
433 blk_mq_free_tag_set(&nullb->tag_set);428 blk_mq_free_tag_set(&nullb->tag_set);
434 put_disk(nullb->disk);429 if (!use_lightnvm)
430 put_disk(nullb->disk);
435 cleanup_queues(nullb);431 cleanup_queues(nullb);
436 kfree(nullb);432 kfree(nullb);
437}433}
438 434
435#ifdef CONFIG_NVM
436
437static 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
447static 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
473static 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
526static 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
539static void null_lnvm_destroy_dma_pool(void *pool)
540{
541 mempool_destroy(pool);
542}
543
544static 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
550static void null_lnvm_dev_dma_free(void *pool, void *entry,
551 dma_addr_t dma_handler)
552{
553 mempool_free(entry, pool);
554}
555
556static 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
569static struct nvm_dev_ops null_lnvm_dev_ops;
570#endif /* CONFIG_NVM */
571
439static int null_open(struct block_device *bdev, fmode_t mode)572static int null_open(struct block_device *bdev, fmode_t mode)
440{573{
441 return 0;574 return 0;
@@ -575,11 +708,6 @@ static int null_add_dev(void) · 133 unmodified lines
575 queue_flag_set_unlocked(QUEUE_FLAG_NONROT, nullb->q);708 queue_flag_set_unlocked(QUEUE_FLAG_NONROT, nullb->q);
576 queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, nullb->q);709 queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, nullb->q);
577 710
578 disk = nullb->disk = alloc_disk_node(1, home_node);
579 if (!disk) {
580 rv = -ENOMEM;
581 goto out_cleanup_blk_queue;
582 }
583 711
584 mutex_lock(&lock);712 mutex_lock(&lock);
585 list_add_tail(&nullb->list, &nullb_list);713 list_add_tail(&nullb->list, &nullb_list);
@@ -589,6 +717,21 @@ static int null_add_dev(void) · 3 unmodified lines
589 blk_queue_logical_block_size(nullb->q, bs);717 blk_queue_logical_block_size(nullb->q, bs);
590 blk_queue_physical_block_size(nullb->q, bs);718 blk_queue_physical_block_size(nullb->q, bs);
591 719
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 }
592 size = gb * 1024 * 1024 * 1024ULL;735 size = gb * 1024 * 1024 * 1024ULL;
593 set_capacity(disk, size >> 9);736 set_capacity(disk, size >> 9);
594 737
@@ -598,10 +741,15 @@ static int null_add_dev(void) · 3 unmodified lines
598 disk->fops = &null_fops;741 disk->fops = &null_fops;
599 disk->private_data = nullb;742 disk->private_data = nullb;
600 disk->queue = nullb->q;743 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
602 add_disk(disk);746 add_disk(disk);
747done:
603 return 0;748 return 0;
604 749
750out_cleanup_lightnvm:
751 if (use_lightnvm)
752 nvm_unregister(nullb->disk_name);
605out_cleanup_blk_queue:753out_cleanup_blk_queue:
606 blk_cleanup_queue(nullb->q);754 blk_cleanup_queue(nullb->q);
607out_cleanup_tags:755out_cleanup_tags:
@@ -625,6 +773,18 @@ static int __init null_init(void) · 17 unmodified lines
625 bs = PAGE_SIZE;773 bs = PAGE_SIZE;
626 }774 }
627 775
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
628 if (queue_mode == NULL_Q_MQ && use_per_node_hctx) {788 if (queue_mode == NULL_Q_MQ && use_per_node_hctx) {
629 if (submit_queues < nr_online_nodes) {789 if (submit_queues < nr_online_nodes) {
630 pr_warn("null_blk: submit_queues param is set to %u.",790 pr_warn("null_blk: submit_queues param is set to %u.",
@@ -638,32 +798,31 @@ static int __init null_init(void) · 7 unmodified lines
638 798
639 mutex_init(&lock);799 mutex_init(&lock);
640 800
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
654 null_major = register_blkdev(0, "nullb");801 null_major = register_blkdev(0, "nullb");
655 if (null_major < 0)802 if (null_major < 0)
656 return null_major;803 return null_major;
657 804
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
658 for (i = 0; i < nr_devices; i++) {814 for (i = 0; i < nr_devices; i++) {
659 if (null_add_dev()) {815 if (null_add_dev()) {
660 unregister_blkdev(null_major, "nullb");816 unregister_blkdev(null_major, "nullb");
661 return -EINVAL;817 goto err_ppa;
662 }818 }
663 }819 }
664 820
665 pr_info("null: module loaded\n");821 pr_info("null: module loaded\n");
666 return 0;822 return 0;
823err_ppa:
824 kmem_cache_destroy(ppa_cache);
825 return -EINVAL;
667}826}
668 827
669static void __exit null_exit(void)828static void __exit null_exit(void)
@@ -678,6 +837,8 @@ static void __exit null_exit(void) · 8 unmodified lines
678 null_del_dev(nullb);837 null_del_dev(nullb);
679 }838 }
680 mutex_unlock(&lock);839 mutex_unlock(&lock);
840
841 kmem_cache_destroy(ppa_cache);
681}842}
682 843
683module_init(null_init);844module_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
3442 goto err_rq;3442 goto err_rq;
3443 }3443 }
3444 img_request->rq = rq;3444 img_request->rq = rq;
3445 snapc = NULL; /* img_request consumes a ref */
3445 3446
3446 if (op_type == OBJ_OP_DISCARD)3447 if (op_type == OBJ_OP_DISCARD)
3447 result = rbd_img_request_fill(img_request, OBJ_REQUEST_NODATA,3448 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
117 117
118module_platform_driver(omap_ocp2scp_driver);118module_platform_driver(omap_ocp2scp_driver);
119 119
120MODULE_ALIAS("platform: omap-ocp2scp");120MODULE_ALIAS("platform:omap-ocp2scp");
121MODULE_AUTHOR("Texas Instruments Inc.");121MODULE_AUTHOR("Texas Instruments Inc.");
122MODULE_DESCRIPTION("OMAP OCP2SCP driver");122MODULE_DESCRIPTION("OMAP OCP2SCP driver");
123MODULE_LICENSE("GPL v2");123MODULE_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
412 return rv;412 return rv;
413}413}
414 414
415static void start_check_enables(struct smi_info *smi_info)415static 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 */
425static 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
436static void start_check_enables(struct smi_info *smi_info, bool start_timer)
416{437{
417 unsigned char msg[2];438 unsigned char msg[2];
418 439
419 msg[0] = (IPMI_NETFN_APP_REQUEST << 2);440 msg[0] = (IPMI_NETFN_APP_REQUEST << 2);
420 msg[1] = IPMI_GET_BMC_GLOBAL_ENABLES_CMD;441 msg[1] = IPMI_GET_BMC_GLOBAL_ENABLES_CMD;
421 442
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);
423 smi_info->si_state = SI_CHECKING_ENABLES;447 smi_info->si_state = SI_CHECKING_ENABLES;
424}448}
425 449
426static void start_clear_flags(struct smi_info *smi_info)450static void start_clear_flags(struct smi_info *smi_info, bool start_timer)
427{451{
428 unsigned char msg[3];452 unsigned char msg[3];
429 453
@@ -432,7 +456,10 @@ static void start_clear_flags(struct smi_info *smi_info) · 2 unmodified lines
432 msg[1] = IPMI_CLEAR_MSG_FLAGS_CMD;456 msg[1] = IPMI_CLEAR_MSG_FLAGS_CMD;
433 msg[2] = WDT_PRE_TIMEOUT_INT;457 msg[2] = WDT_PRE_TIMEOUT_INT;
434 458
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);
436 smi_info->si_state = SI_CLEARING_FLAGS;463 smi_info->si_state = SI_CLEARING_FLAGS;
437}464}
438 465
@@ -442,10 +469,8 @@ static void start_getting_msg_queue(struct smi_info *smi_info) · 3 unmodified lines
442 smi_info->curr_msg->data[1] = IPMI_GET_MSG_CMD;469 smi_info->curr_msg->data[1] = IPMI_GET_MSG_CMD;
443 smi_info->curr_msg->data_size = 2;470 smi_info->curr_msg->data_size = 2;
444 471
445 smi_info->handlers->start_transaction(472 start_new_msg(smi_info, smi_info->curr_msg->data,
446 smi_info->si_sm,473 smi_info->curr_msg->data_size);
447 smi_info->curr_msg->data,
448 smi_info->curr_msg->data_size);
449 smi_info->si_state = SI_GETTING_MESSAGES;474 smi_info->si_state = SI_GETTING_MESSAGES;
450}475}
451 476
@@ -455,20 +480,11 @@ static void start_getting_events(struct smi_info *smi_info) · 3 unmodified lines
455 smi_info->curr_msg->data[1] = IPMI_READ_EVENT_MSG_BUFFER_CMD;480 smi_info->curr_msg->data[1] = IPMI_READ_EVENT_MSG_BUFFER_CMD;
456 smi_info->curr_msg->data_size = 2;481 smi_info->curr_msg->data_size = 2;
457 482
458 smi_info->handlers->start_transaction(483 start_new_msg(smi_info, smi_info->curr_msg->data,
459 smi_info->si_sm,484 smi_info->curr_msg->data_size);
460 smi_info->curr_msg->data,
461 smi_info->curr_msg->data_size);
462 smi_info->si_state = SI_GETTING_EVENTS;485 smi_info->si_state = SI_GETTING_EVENTS;
463}486}
464 487
465static 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
472/*488/*
473 * When we have a situtaion where we run out of memory and cannot489 * When we have a situtaion where we run out of memory and cannot
474 * allocate messages, we just leave them in the BMC and run the system490 * 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
478 * Note that we cannot just use disable_irq(), since the interrupt may494 * Note that we cannot just use disable_irq(), since the interrupt may
479 * be shared.495 * be shared.
480 */496 */
481static inline bool disable_si_irq(struct smi_info *smi_info)497static inline bool disable_si_irq(struct smi_info *smi_info, bool start_timer)
482{498{
483 if ((smi_info->irq) && (!smi_info->interrupt_disabled)) {499 if ((smi_info->irq) && (!smi_info->interrupt_disabled)) {
484 smi_info->interrupt_disabled = true;500 smi_info->interrupt_disabled = true;
485 start_check_enables(smi_info);501 start_check_enables(smi_info, start_timer);
486 return true;502 return true;
487 }503 }
488 return false;504 return false;
@@ -492,7 +508,7 @@ static inline bool enable_si_irq(struct smi_info *smi_info) · 3 unmodified lines
492{508{
493 if ((smi_info->irq) && (smi_info->interrupt_disabled)) {509 if ((smi_info->irq) && (smi_info->interrupt_disabled)) {
494 smi_info->interrupt_disabled = false;510 smi_info->interrupt_disabled = false;
495 start_check_enables(smi_info);511 start_check_enables(smi_info, true);
496 return true;512 return true;
497 }513 }
498 return false;514 return false;
@@ -510,7 +526,7 @@ static struct ipmi_smi_msg *alloc_msg_handle_irq(struct smi_info *smi_info) · 11 unmodified lines
510 526
511 msg = ipmi_alloc_smi_msg();527 msg = ipmi_alloc_smi_msg();
512 if (!msg) {528 if (!msg) {
513 if (!disable_si_irq(smi_info))529 if (!disable_si_irq(smi_info, true))
514 smi_info->si_state = SI_NORMAL;530 smi_info->si_state = SI_NORMAL;
515 } else if (enable_si_irq(smi_info)) {531 } else if (enable_si_irq(smi_info)) {
516 ipmi_free_smi_msg(msg);532 ipmi_free_smi_msg(msg);
@@ -526,7 +542,7 @@ static void handle_flags(struct smi_info *smi_info) · 9 unmodified lines
526 /* Watchdog pre-timeout */542 /* Watchdog pre-timeout */
527 smi_inc_stat(smi_info, watchdog_pretimeouts);543 smi_inc_stat(smi_info, watchdog_pretimeouts);
528 544
529 start_clear_flags(smi_info);545 start_clear_flags(smi_info, true);
530 smi_info->msg_flags &= ~WDT_PRE_TIMEOUT_INT;546 smi_info->msg_flags &= ~WDT_PRE_TIMEOUT_INT;
531 if (smi_info->intf)547 if (smi_info->intf)
532 ipmi_smi_watchdog_pretimeout(smi_info->intf);548 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
879 msg[0] = (IPMI_NETFN_APP_REQUEST << 2);895 msg[0] = (IPMI_NETFN_APP_REQUEST << 2);
880 msg[1] = IPMI_GET_MSG_FLAGS_CMD;896 msg[1] = IPMI_GET_MSG_FLAGS_CMD;
881 897
882 smi_info->handlers->start_transaction(898 start_new_msg(smi_info, msg, 2);
883 smi_info->si_sm, msg, 2);
884 smi_info->si_state = SI_GETTING_FLAGS;899 smi_info->si_state = SI_GETTING_FLAGS;
885 goto restart;900 goto restart;
886 }901 }
@@ -910,7 +925,7 @@ static enum si_sm_result smi_event_handler(struct smi_info *smi_info, · 23 unmodified lines
910 * disable and messages disabled.925 * disable and messages disabled.
911 */926 */
912 if (smi_info->supports_event_msg_buff || smi_info->irq) {927 if (smi_info->supports_event_msg_buff || smi_info->irq) {
913 start_check_enables(smi_info);928 start_check_enables(smi_info, true);
914 } else {929 } else {
915 smi_info->curr_msg = alloc_msg_handle_irq(smi_info);930 smi_info->curr_msg = alloc_msg_handle_irq(smi_info);
916 if (!smi_info->curr_msg)931 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
920 }935 }
921 goto restart;936 goto restart;
922 }937 }
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
923 out:945 out:
924 return si_sm_result;946 return si_sm_result;
925}947}
@@ -2560,6 +2582,7 @@ static const struct of_device_id of_ipmi_match[] = { · 1634 unmodified lines
2560 .data = (void *)(unsigned long) SI_BT },2582 .data = (void *)(unsigned long) SI_BT },
2561 {},2583 {},
2562};2584};
2585MODULE_DEVICE_TABLE(of, of_ipmi_match);
2563 2586
2564static int of_ipmi_probe(struct platform_device *dev)2587static int of_ipmi_probe(struct platform_device *dev)
2565{2588{
@@ -2646,7 +2669,6 @@ static int of_ipmi_probe(struct platform_device *dev) · 80 unmodified lines
2646 }2669 }
2647 return 0;2670 return 0;
2648}2671}
2649MODULE_DEVICE_TABLE(of, of_ipmi_match);
2650#else2672#else
2651#define of_ipmi_match NULL2673#define of_ipmi_match NULL
2652static int of_ipmi_probe(struct platform_device *dev)2674static 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
3613 * Start clearing the flags before we enable interrupts or the3635 * Start clearing the flags before we enable interrupts or the
3614 * timer to avoid racing with the timer.3636 * timer to avoid racing with the timer.
3615 */3637 */
3616 start_clear_flags(new_smi);3638 start_clear_flags(new_smi, false);
3617 3639
3618 /*3640 /*
3619 * IRQ is defined to be set when non-zero. req_events will3641 * 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
3908 poll(to_clean);3930 poll(to_clean);
3909 schedule_timeout_uninterruptible(1);3931 schedule_timeout_uninterruptible(1);
3910 }3932 }
3911 disable_si_irq(to_clean);3933 disable_si_irq(to_clean, false);
3912 while (to_clean->curr_msg || (to_clean->si_state != SI_NORMAL)) {3934 while (to_clean->curr_msg || (to_clean->si_state != SI_NORMAL)) {
3913 poll(to_clean);3935 poll(to_clean);
3914 schedule_timeout_uninterruptible(1);3936 schedule_timeout_uninterruptible(1);
drivers/char/ipmi/ipmi_watchdog.c+7−1
@@ -153,6 +153,9 @@ static int timeout = 10; · 152 unmodified lines
153/* The pre-timeout is disabled by default. */153/* The pre-timeout is disabled by default. */
154static int pretimeout;154static int pretimeout;
155 155
156/* Default timeout to set on panic */
157static int panic_wdt_timeout = 255;
158
156/* Default action is to reset the board on a timeout. */159/* Default action is to reset the board on a timeout. */
157static unsigned char action_val = WDOG_TIMEOUT_RESET;160static unsigned char action_val = WDOG_TIMEOUT_RESET;
158 161
@@ -293,6 +296,9 @@ MODULE_PARM_DESC(timeout, "Timeout value in seconds."); · 134 unmodified lines
293module_param(pretimeout, timeout, 0644);296module_param(pretimeout, timeout, 0644);
294MODULE_PARM_DESC(pretimeout, "Pretimeout value in seconds.");297MODULE_PARM_DESC(pretimeout, "Pretimeout value in seconds.");
295 298
299module_param(panic_wdt_timeout, timeout, 0644);
300MODULE_PARM_DESC(timeout, "Timeout value on kernel panic in seconds.");
301
296module_param_cb(action, &param_ops_str, action_op, 0644);302module_param_cb(action, &param_ops_str, action_op, 0644);
297MODULE_PARM_DESC(action, "Timeout action. One of: "303MODULE_PARM_DESC(action, "Timeout action. One of: "
298 "reset, none, power_cycle, power_off.");304 "reset, none, power_cycle, power_off.");
@@ -1189,7 +1195,7 @@ static int wdog_panic_handler(struct notifier_block *this, · 890 unmodified lines
1189 /* Make sure we do this only once. */1195 /* Make sure we do this only once. */
1190 panic_event_handled = 1;1196 panic_event_handled = 1;
1191 1197
1192 timeout = 255;1198 timeout = panic_wdt_timeout;
1193 pretimeout = 0;1199 pretimeout = 0;
1194 panic_halt_ipmi_set_timeout();1200 panic_halt_ipmi_set_timeout();
1195 }1201 }
drivers/clocksource/Kconfig+1−0
@@ -1,4 +1,5 @@
1menu "Clock Source drivers"1menu "Clock Source drivers"
2 depends on !ARCH_USES_GETTIMEOFFSET
2 3
3config CLKSRC_OF4config CLKSRC_OF
4 bool5 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
203 int err;203 int err;
204 204
205 ftm_writel(0x00, priv->clkevt_base + FTM_CNTIN);205 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);
207 207
208 ftm_reset_counter(priv->clkevt_base);208 ftm_reset_counter(priv->clkevt_base);
209 209
@@ -230,7 +230,7 @@ static int __init ftm_clocksource_init(unsigned long freq) · 20 unmodified lines
230 int err;230 int err;
231 231
232 ftm_writel(0x00, priv->clksrc_base + FTM_CNTIN);232 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);
234 234
235 ftm_reset_counter(priv->clksrc_base);235 ftm_reset_counter(priv->clksrc_base);
236 236
drivers/cpufreq/Kconfig.arm+2−1
@@ -84,6 +84,7 @@ config ARM_KIRKWOOD_CPUFREQ · 83 unmodified lines
84config ARM_MT8173_CPUFREQ84config ARM_MT8173_CPUFREQ
85 bool "Mediatek MT8173 CPUFreq support"85 bool "Mediatek MT8173 CPUFreq support"
86 depends on ARCH_MEDIATEK && REGULATOR86 depends on ARCH_MEDIATEK && REGULATOR
87 depends on ARM64 || (ARM_CPU_TOPOLOGY && COMPILE_TEST)
87 depends on !CPU_THERMAL || THERMAL=y88 depends on !CPU_THERMAL || THERMAL=y
88 select PM_OPP89 select PM_OPP
89 help90 help
@@ -201,7 +202,7 @@ config ARM_SA1110_CPUFREQ · 111 unmodified lines
201 202
202config ARM_SCPI_CPUFREQ203config ARM_SCPI_CPUFREQ
203 tristate "SCPI based CPUfreq driver"204 tristate "SCPI based CPUfreq driver"
204 depends on ARM_BIG_LITTLE_CPUFREQ && ARM_SCPI_PROTOCOL205 depends on ARM_BIG_LITTLE_CPUFREQ && ARM_SCPI_PROTOCOL && COMMON_CLK_SCPI
205 help206 help
206 This adds the CPUfreq driver support for ARM big.LITTLE platforms207 This adds the CPUfreq driver support for ARM big.LITTLE platforms
207 using SCPI protocol for CPU power management.208 using SCPI protocol for CPU power management.
drivers/cpufreq/Kconfig.x86+0−1
@@ -5,7 +5,6 @@ · 4 unmodified lines
5config X86_INTEL_PSTATE5config X86_INTEL_PSTATE
6 bool "Intel P state control"6 bool "Intel P state control"
7 depends on X867 depends on X86
8 select ACPI_PROCESSOR if ACPI
9 help8 help
10 This driver provides a P state for Intel core processors.9 This driver provides a P state for Intel core processors.
11 The driver implements an internal governor and will become10 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
98 policy->max = cpu->perf_caps.highest_perf;98 policy->max = cpu->perf_caps.highest_perf;
99 policy->cpuinfo.min_freq = policy->min;99 policy->cpuinfo.min_freq = policy->min;
100 policy->cpuinfo.max_freq = policy->max;100 policy->cpuinfo.max_freq = policy->max;
101 policy->shared_type = cpu->shared_type;
101 102
102 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)103 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
103 cpumask_copy(policy->cpus, cpu->shared_cpu_map);104 cpumask_copy(policy->cpus, cpu->shared_cpu_map);
104 else {105 else if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL) {
105 /* Support only SW_ANY for now. */106 /* Support only SW_ANY for now. */
106 pr_debug("Unsupported CPU co-ord type\n");107 pr_debug("Unsupported CPU co-ord type\n");
107 return -EFAULT;108 return -EFAULT;
drivers/cpufreq/cpufreq.c+12−9
@@ -976,10 +976,14 @@ static int cpufreq_init_policy(struct cpufreq_policy *policy) · 975 unmodified lines
976 976
977 new_policy.governor = gov;977 new_policy.governor = gov;
978 978
979 /* Use the default policy if its valid. */979 /* Use the default policy if there is no last_policy. */
980 if (cpufreq_driver->setpolicy)980 if (cpufreq_driver->setpolicy) {
981 cpufreq_parse_governor(gov->name, &new_policy.policy, NULL);981 if (policy->last_policy)
982 982 new_policy.policy = policy->last_policy;
983 else
984 cpufreq_parse_governor(gov->name, &new_policy.policy,
985 NULL);
986 }
983 /* set default policy */987 /* set default policy */
984 return cpufreq_set_policy(policy, &new_policy);988 return cpufreq_set_policy(policy, &new_policy);
985}989}
@@ -1330,6 +1334,8 @@ static void cpufreq_offline_prepare(unsigned int cpu) · 344 unmodified lines
1330 if (has_target())1334 if (has_target())
1331 strncpy(policy->last_governor, policy->governor->name,1335 strncpy(policy->last_governor, policy->governor->name,
1332 CPUFREQ_NAME_LEN);1336 CPUFREQ_NAME_LEN);
1337 else
1338 policy->last_policy = policy->policy;
1333 } else if (cpu == policy->cpu) {1339 } else if (cpu == policy->cpu) {
1334 /* Nominate new CPU */1340 /* Nominate new CPU */
1335 policy->cpu = cpumask_any(policy->cpus);1341 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
1401 }1407 }
1402 1408
1403 cpumask_clear_cpu(cpu, policy->real_cpus);1409 cpumask_clear_cpu(cpu, policy->real_cpus);
1410 remove_cpu_dev_symlink(policy, cpu);
1404 1411
1405 if (cpumask_empty(policy->real_cpus)) {1412 if (cpumask_empty(policy->real_cpus))
1406 cpufreq_policy_free(policy, true);1413 cpufreq_policy_free(policy, true);
1407 return;
1408 }
1409
1410 remove_cpu_dev_symlink(policy, cpu);
1411}1414}
1412 1415
1413static void handle_update(struct work_struct *work)1416static void handle_update(struct work_struct *work)
drivers/cpufreq/intel_pstate.c+77−245
@@ -34,14 +34,10 @@ · 33 unmodified lines
34#include <asm/cpu_device_id.h>34#include <asm/cpu_device_id.h>
35#include <asm/cpufeature.h>35#include <asm/cpufeature.h>
36 36
37#if IS_ENABLED(CONFIG_ACPI)37#define ATOM_RATIOS 0x66a
38#include <acpi/processor.h>38#define ATOM_VIDS 0x66b
39#endif39#define ATOM_TURBO_RATIOS 0x66c
40 40#define ATOM_TURBO_VIDS 0x66d
41#define BYT_RATIOS 0x66a
42#define BYT_VIDS 0x66b
43#define BYT_TURBO_RATIOS 0x66c
44#define BYT_TURBO_VIDS 0x66d
45 41
46#define FRAC_BITS 842#define FRAC_BITS 8
47#define int_tofp(X) ((int64_t)(X) << FRAC_BITS)43#define int_tofp(X) ((int64_t)(X) << FRAC_BITS)
@@ -117,9 +113,6 @@ struct cpudata { · 69 unmodified lines
117 u64 prev_mperf;113 u64 prev_mperf;
118 u64 prev_tsc;114 u64 prev_tsc;
119 struct sample sample;115 struct sample sample;
120#if IS_ENABLED(CONFIG_ACPI)
121 struct acpi_processor_performance acpi_perf_data;
122#endif
123};116};
124 117
125static struct cpudata **all_cpu_data;118static struct cpudata **all_cpu_data;
@@ -150,7 +143,6 @@ struct cpu_defaults { · 24 unmodified lines
150static struct pstate_adjust_policy pid_params;143static struct pstate_adjust_policy pid_params;
151static struct pstate_funcs pstate_funcs;144static struct pstate_funcs pstate_funcs;
152static int hwp_active;145static int hwp_active;
153static int no_acpi_perf;
154 146
155struct perf_limits {147struct perf_limits {
156 int no_turbo;148 int no_turbo;
@@ -163,8 +155,6 @@ struct perf_limits { · 6 unmodified lines
163 int max_sysfs_pct;155 int max_sysfs_pct;
164 int min_policy_pct;156 int min_policy_pct;
165 int min_sysfs_pct;157 int min_sysfs_pct;
166 int max_perf_ctl;
167 int min_perf_ctl;
168};158};
169 159
170static struct perf_limits performance_limits = {160static struct perf_limits performance_limits = {
@@ -191,8 +181,6 @@ static struct perf_limits powersave_limits = { · 20 unmodified lines
191 .max_sysfs_pct = 100,181 .max_sysfs_pct = 100,
192 .min_policy_pct = 0,182 .min_policy_pct = 0,
193 .min_sysfs_pct = 0,183 .min_sysfs_pct = 0,
194 .max_perf_ctl = 0,
195 .min_perf_ctl = 0,
196};184};
197 185
198#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE186#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE
@@ -201,153 +189,6 @@ static struct perf_limits *limits = &performance_limits; · 2 unmodified lines
201static struct perf_limits *limits = &powersave_limits;189static struct perf_limits *limits = &powersave_limits;
202#endif190#endif
203 191
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 */
216static int convert_to_native_pstate_format(struct cpudata *cpu, int index)
217{
218 return cpu->acpi_perf_data.states[index].control >> 8;
219}
220
221static 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
327static 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
340static int intel_pstate_init_perf_limits(struct cpufreq_policy *policy)
341{
342 return 0;
343}
344
345static int intel_pstate_exit_perf_limits(struct cpufreq_policy *policy)
346{
347 return 0;
348}
349#endif
350
351static inline void pid_reset(struct _pid *pid, int setpoint, int busy,192static inline void pid_reset(struct _pid *pid, int setpoint, int busy,
352 int deadband, int integral) {193 int deadband, int integral) {
353 pid->setpoint = setpoint;194 pid->setpoint = setpoint;
@@ -687,31 +528,31 @@ static void intel_pstate_hwp_enable(struct cpudata *cpudata) · 333 unmodified lines
687 wrmsrl_on_cpu(cpudata->cpu, MSR_PM_ENABLE, 0x1);528 wrmsrl_on_cpu(cpudata->cpu, MSR_PM_ENABLE, 0x1);
688}529}
689 530
690static int byt_get_min_pstate(void)531static int atom_get_min_pstate(void)
691{532{
692 u64 value;533 u64 value;
693 534
694 rdmsrl(BYT_RATIOS, value);535 rdmsrl(ATOM_RATIOS, value);
695 return (value >> 8) & 0x7F;536 return (value >> 8) & 0x7F;
696}537}
697 538
698static int byt_get_max_pstate(void)539static int atom_get_max_pstate(void)
699{540{
700 u64 value;541 u64 value;
701 542
702 rdmsrl(BYT_RATIOS, value);543 rdmsrl(ATOM_RATIOS, value);
703 return (value >> 16) & 0x7F;544 return (value >> 16) & 0x7F;
704}545}
705 546
706static int byt_get_turbo_pstate(void)547static int atom_get_turbo_pstate(void)
707{548{
708 u64 value;549 u64 value;
709 550
710 rdmsrl(BYT_TURBO_RATIOS, value);551 rdmsrl(ATOM_TURBO_RATIOS, value);
711 return value & 0x7F;552 return value & 0x7F;
712}553}
713 554
714static void byt_set_pstate(struct cpudata *cpudata, int pstate)555static void atom_set_pstate(struct cpudata *cpudata, int pstate)
715{556{
716 u64 val;557 u64 val;
717 int32_t vid_fp;558 int32_t vid_fp;
@@ -736,27 +577,42 @@ static void byt_set_pstate(struct cpudata *cpudata, int pstate) · 18 unmodified lines
736 wrmsrl_on_cpu(cpudata->cpu, MSR_IA32_PERF_CTL, val);577 wrmsrl_on_cpu(cpudata->cpu, MSR_IA32_PERF_CTL, val);
737}578}
738 579
739#define BYT_BCLK_FREQS 5580static int silvermont_get_scaling(void)
740static int byt_freq_table[BYT_BCLK_FREQS] = { 833, 1000, 1333, 1167, 800};
741
742static int byt_get_scaling(void)
743{581{
744 u64 value;582 u64 value;
745 int i;583 int i;
584 /* Defined in Table 35-6 from SDM (Sept 2015) */
585 static int silvermont_freq_table[] = {
586 83300, 100000, 133300, 116700, 80000};
746 587
747 rdmsrl(MSR_FSB_FREQ, value);588 rdmsrl(MSR_FSB_FREQ, value);
748 i = value & 0x3;589 i = value & 0x7;
590 WARN_ON(i > 4);
749 591
750 BUG_ON(i > BYT_BCLK_FREQS);592 return silvermont_freq_table[i];
593}
751 594
752 return byt_freq_table[i] * 100;595static 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];
753}609}
754 610
755static void byt_get_vid(struct cpudata *cpudata)611static void atom_get_vid(struct cpudata *cpudata)
756{612{
757 u64 value;613 u64 value;
758 614
759 rdmsrl(BYT_VIDS, value);615 rdmsrl(ATOM_VIDS, value);
760 cpudata->vid.min = int_tofp((value >> 8) & 0x7f);616 cpudata->vid.min = int_tofp((value >> 8) & 0x7f);
761 cpudata->vid.max = int_tofp((value >> 16) & 0x7f);617 cpudata->vid.max = int_tofp((value >> 16) & 0x7f);
762 cpudata->vid.ratio = div_fp(618 cpudata->vid.ratio = div_fp(
@@ -764,7 +620,7 @@ static void byt_get_vid(struct cpudata *cpudata) · 1 unmodified line
764 int_tofp(cpudata->pstate.max_pstate -620 int_tofp(cpudata->pstate.max_pstate -
765 cpudata->pstate.min_pstate));621 cpudata->pstate.min_pstate));
766 622
767 rdmsrl(BYT_TURBO_VIDS, value);623 rdmsrl(ATOM_TURBO_VIDS, value);
768 cpudata->vid.turbo = value & 0x7f;624 cpudata->vid.turbo = value & 0x7f;
769}625}
770 626
@@ -885,7 +741,7 @@ static struct cpu_defaults core_params = { · 114 unmodified lines
885 },741 },
886};742};
887 743
888static struct cpu_defaults byt_params = {744static struct cpu_defaults silvermont_params = {
889 .pid_policy = {745 .pid_policy = {
890 .sample_rate_ms = 10,746 .sample_rate_ms = 10,
891 .deadband = 0,747 .deadband = 0,
@@ -895,13 +751,33 @@ static struct cpu_defaults byt_params = { · 3 unmodified lines
895 .i_gain_pct = 4,751 .i_gain_pct = 4,
896 },752 },
897 .funcs = {753 .funcs = {
898 .get_max = byt_get_max_pstate,754 .get_max = atom_get_max_pstate,
899 .get_max_physical = byt_get_max_pstate,755 .get_max_physical = atom_get_max_pstate,
900 .get_min = byt_get_min_pstate,756 .get_min = atom_get_min_pstate,
901 .get_turbo = byt_get_turbo_pstate,757 .get_turbo = atom_get_turbo_pstate,
902 .set = byt_set_pstate,758 .set = atom_set_pstate,
903 .get_scaling = byt_get_scaling,759 .get_scaling = silvermont_get_scaling,
904 .get_vid = byt_get_vid,760 .get_vid = atom_get_vid,
761 },
762};
763
764static 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,
905 },781 },
906};782};
907 783
@@ -938,23 +814,12 @@ static void intel_pstate_get_min_max(struct cpudata *cpu, int *min, int *max) · 30 unmodified lines
938 * policy, or by cpu specific default values determined through814 * policy, or by cpu specific default values determined through
939 * experimentation.815 * experimentation.
940 */816 */
941 if (limits->max_perf_ctl && limits->max_sysfs_pct >=817 max_perf_adj = fp_toint(mul_fp(int_tofp(max_perf), limits->max_perf));
942 limits->max_policy_pct) {818 *max = clamp_t(int, max_perf_adj,
943 *max = limits->max_perf_ctl;819 cpu->pstate.min_pstate, cpu->pstate.turbo_pstate);
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 }
950 820
951 if (limits->min_perf_ctl) {821 min_perf = fp_toint(mul_fp(int_tofp(max_perf), limits->min_perf));
952 *min = limits->min_perf_ctl;822 *min = clamp_t(int, min_perf, cpu->pstate.min_pstate, max_perf);
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 }
958}823}
959 824
960static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate, bool force)825static 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
1153static const struct x86_cpu_id intel_pstate_cpu_ids[] = {1018static const struct x86_cpu_id intel_pstate_cpu_ids[] = {
1154 ICPU(0x2a, core_params),1019 ICPU(0x2a, core_params),
1155 ICPU(0x2d, core_params),1020 ICPU(0x2d, core_params),
1156 ICPU(0x37, byt_params),1021 ICPU(0x37, silvermont_params),
1157 ICPU(0x3a, core_params),1022 ICPU(0x3a, core_params),
1158 ICPU(0x3c, core_params),1023 ICPU(0x3c, core_params),
1159 ICPU(0x3d, core_params),1024 ICPU(0x3d, core_params),
@@ -1162,7 +1027,7 @@ static const struct x86_cpu_id intel_pstate_cpu_ids[] = { · 2 unmodified lines
1162 ICPU(0x45, core_params),1027 ICPU(0x45, core_params),
1163 ICPU(0x46, core_params),1028 ICPU(0x46, core_params),
1164 ICPU(0x47, core_params),1029 ICPU(0x47, core_params),
1165 ICPU(0x4c, byt_params),1030 ICPU(0x4c, airmont_params),
1166 ICPU(0x4e, core_params),1031 ICPU(0x4e, core_params),
1167 ICPU(0x4f, core_params),1032 ICPU(0x4f, core_params),
1168 ICPU(0x5e, core_params),1033 ICPU(0x5e, core_params),
@@ -1229,12 +1094,6 @@ static unsigned int intel_pstate_get(unsigned int cpu_num) · 60 unmodified lines
1229 1094
1230static int intel_pstate_set_policy(struct cpufreq_policy *policy)1095static int intel_pstate_set_policy(struct cpufreq_policy *policy)
1231{1096{
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);
1238 if (!policy->cpuinfo.max_freq)1097 if (!policy->cpuinfo.max_freq)
1239 return -ENODEV;1098 return -ENODEV;
1240 1099
@@ -1242,6 +1101,8 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) · 1 unmodified line
1242 policy->max >= policy->cpuinfo.max_freq) {1101 policy->max >= policy->cpuinfo.max_freq) {
1243 pr_debug("intel_pstate: set performance\n");1102 pr_debug("intel_pstate: set performance\n");
1244 limits = &performance_limits;1103 limits = &performance_limits;
1104 if (hwp_active)
1105 intel_pstate_hwp_set();
1245 return 0;1106 return 0;
1246 }1107 }
1247 1108
@@ -1249,7 +1110,8 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) · 1 unmodified line
1249 limits = &powersave_limits;1110 limits = &powersave_limits;
1250 limits->min_policy_pct = (policy->min * 100) / policy->cpuinfo.max_freq;1111 limits->min_policy_pct = (policy->min * 100) / policy->cpuinfo.max_freq;
1251 limits->min_policy_pct = clamp_t(int, limits->min_policy_pct, 0 , 100);1112 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);
1253 limits->max_policy_pct = clamp_t(int, limits->max_policy_pct, 0 , 100);1115 limits->max_policy_pct = clamp_t(int, limits->max_policy_pct, 0 , 100);
1254 1116
1255 /* Normalize user input to [min_policy_pct, max_policy_pct] */1117 /* 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
1261 limits->max_sysfs_pct);1123 limits->max_sysfs_pct);
1262 limits->max_perf_pct = max(limits->min_policy_pct,1124 limits->max_perf_pct = max(limits->min_policy_pct,
1263 limits->max_perf_pct);1125 limits->max_perf_pct);
1126 limits->max_perf = round_up(limits->max_perf, 8);
1264 1127
1265 /* Make sure min_perf_pct <= max_perf_pct */1128 /* Make sure min_perf_pct <= max_perf_pct */
1266 limits->min_perf_pct = min(limits->max_perf_pct, limits->min_perf_pct);1129 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
1270 limits->max_perf = div_fp(int_tofp(limits->max_perf_pct),1133 limits->max_perf = div_fp(int_tofp(limits->max_perf_pct),
1271 int_tofp(100));1134 int_tofp(100));
1272 1135
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
1290 if (hwp_active)1136 if (hwp_active)
1291 intel_pstate_hwp_set();1137 intel_pstate_hwp_set();
1292 1138
@@ -1341,30 +1187,18 @@ static int intel_pstate_cpu_init(struct cpufreq_policy *policy) · 48 unmodified lines
1341 policy->cpuinfo.min_freq = cpu->pstate.min_pstate * cpu->pstate.scaling;1187 policy->cpuinfo.min_freq = cpu->pstate.min_pstate * cpu->pstate.scaling;
1342 policy->cpuinfo.max_freq =1188 policy->cpuinfo.max_freq =
1343 cpu->pstate.turbo_pstate * cpu->pstate.scaling;1189 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 */
1350 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;1190 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
1351 cpumask_set_cpu(policy->cpu, policy->cpus);1191 cpumask_set_cpu(policy->cpu, policy->cpus);
1352 1192
1353 return 0;1193 return 0;
1354}1194}
1355 1195
1356static int intel_pstate_cpu_exit(struct cpufreq_policy *policy)
1357{
1358 return intel_pstate_exit_perf_limits(policy);
1359}
1360
1361static struct cpufreq_driver intel_pstate_driver = {1196static struct cpufreq_driver intel_pstate_driver = {
1362 .flags = CPUFREQ_CONST_LOOPS,1197 .flags = CPUFREQ_CONST_LOOPS,
1363 .verify = intel_pstate_verify_policy,1198 .verify = intel_pstate_verify_policy,
1364 .setpolicy = intel_pstate_set_policy,1199 .setpolicy = intel_pstate_set_policy,
1365 .get = intel_pstate_get,1200 .get = intel_pstate_get,
1366 .init = intel_pstate_cpu_init,1201 .init = intel_pstate_cpu_init,
1367 .exit = intel_pstate_cpu_exit,
1368 .stop_cpu = intel_pstate_stop_cpu,1202 .stop_cpu = intel_pstate_stop_cpu,
1369 .name = "intel_pstate",1203 .name = "intel_pstate",
1370};1204};
@@ -1406,6 +1240,7 @@ static void copy_cpu_funcs(struct pstate_funcs *funcs) · 35 unmodified lines
1406}1240}
1407 1241
1408#if IS_ENABLED(CONFIG_ACPI)1242#if IS_ENABLED(CONFIG_ACPI)
1243#include <acpi/processor.h>
1409 1244
1410static bool intel_pstate_no_acpi_pss(void)1245static bool intel_pstate_no_acpi_pss(void)
1411{1246{
@@ -1601,9 +1436,6 @@ static int __init intel_pstate_setup(char *str) · 189 unmodified lines
1601 force_load = 1;1436 force_load = 1;
1602 if (!strcmp(str, "hwp_only"))1437 if (!strcmp(str, "hwp_only"))
1603 hwp_only = 1;1438 hwp_only = 1;
1604 if (!strcmp(str, "no_acpi"))
1605 no_acpi_perf = 1;
1606
1607 return 0;1439 return 0;
1608}1440}
1609early_param("intel_pstate", intel_pstate_setup);1441early_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
409 processed += to_process;409 processed += to_process;
410 } while (processed < nbytes);410 } while (processed < nbytes);
411 411
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,
413 authsize) ? -EBADMSG : 0;413 authsize) ? -EBADMSG : 0;
414out:414out:
415 spin_unlock_irqrestore(&nx_ctx->lock, irq_flags);415 spin_unlock_irqrestore(&nx_ctx->lock, irq_flags);
drivers/crypto/nx/nx-aes-gcm.c+2−1
@@ -21,6 +21,7 @@ · 20 unmodified lines
21 21
22#include <crypto/internal/aead.h>22#include <crypto/internal/aead.h>
23#include <crypto/aes.h>23#include <crypto/aes.h>
24#include <crypto/algapi.h>
24#include <crypto/scatterwalk.h>25#include <crypto/scatterwalk.h>
25#include <linux/module.h>26#include <linux/module.h>
26#include <linux/types.h>27#include <linux/types.h>
@@ -418,7 +419,7 @@ mac: · 391 unmodified lines
418 itag, req->src, req->assoclen + nbytes,419 itag, req->src, req->assoclen + nbytes,
419 crypto_aead_authsize(crypto_aead_reqtfm(req)),420 crypto_aead_authsize(crypto_aead_reqtfm(req)),
420 SCATTERWALK_FROM_SG);421 SCATTERWALK_FROM_SG);
421 rc = memcmp(itag, otag,422 rc = crypto_memneq(itag, otag,
422 crypto_aead_authsize(crypto_aead_reqtfm(req))) ?423 crypto_aead_authsize(crypto_aead_reqtfm(req))) ?
423 -EBADMSG : 0;424 -EBADMSG : 0;
424 }425 }
drivers/crypto/talitos.c+1−1
@@ -977,7 +977,7 @@ static void ipsec_esp_decrypt_swauth_done(struct device *dev, · 976 unmodified lines
977 } else977 } else
978 oicv = (char *)&edesc->link_tbl[0];978 oicv = (char *)&edesc->link_tbl[0];
979 979
980 err = memcmp(oicv, icv, authsize) ? -EBADMSG : 0;980 err = crypto_memneq(oicv, icv, authsize) ? -EBADMSG : 0;
981 }981 }
982 982
983 kfree(edesc);983 kfree(edesc);
drivers/dma/at_hdmac.c+10−10
@@ -729,8 +729,8 @@ atc_prep_dma_interleaved(struct dma_chan *chan, · 728 unmodified lines
729 return NULL;729 return NULL;
730 730
731 dev_info(chan2dev(chan),731 dev_info(chan2dev(chan),
732 "%s: src=0x%08x, dest=0x%08x, numf=%d, frame_size=%d, flags=0x%lx\n",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,733 __func__, &xt->src_start, &xt->dst_start, xt->numf,
734 xt->frame_size, flags);734 xt->frame_size, flags);
735 735
736 /*736 /*
@@ -824,8 +824,8 @@ atc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src, · 87 unmodified lines
824 u32 ctrla;824 u32 ctrla;
825 u32 ctrlb;825 u32 ctrlb;
826 826
827 dev_vdbg(chan2dev(chan), "prep_dma_memcpy: d0x%x s0x%x l0x%zx f0x%lx\n",827 dev_vdbg(chan2dev(chan), "prep_dma_memcpy: d%pad s%pad l0x%zx f0x%lx\n",
828 dest, src, len, flags);828 &dest, &src, len, flags);
829 829
830 if (unlikely(!len)) {830 if (unlikely(!len)) {
831 dev_dbg(chan2dev(chan), "prep_dma_memcpy: length is zero!\n");831 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
938 void __iomem *vaddr;938 void __iomem *vaddr;
939 dma_addr_t paddr;939 dma_addr_t paddr;
940 940
941 dev_vdbg(chan2dev(chan), "%s: d0x%x v0x%x l0x%zx f0x%lx\n", __func__,941 dev_vdbg(chan2dev(chan), "%s: d%pad v0x%x l0x%zx f0x%lx\n", __func__,
942 dest, value, len, flags);942 &dest, value, len, flags);
943 943
944 if (unlikely(!len)) {944 if (unlikely(!len)) {
945 dev_dbg(chan2dev(chan), "%s: length is zero!\n", __func__);945 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
1022 dma_addr_t dest = sg_dma_address(sg);1022 dma_addr_t dest = sg_dma_address(sg);
1023 size_t len = sg_dma_len(sg);1023 size_t len = sg_dma_len(sg);
1024 1024
1025 dev_vdbg(chan2dev(chan), "%s: d0x%08x, l0x%zx\n",1025 dev_vdbg(chan2dev(chan), "%s: d%pad, l0x%zx\n",
1026 __func__, dest, len);1026 __func__, &dest, len);
1027 1027
1028 if (!is_dma_fill_aligned(chan->device, dest, 0, len)) {1028 if (!is_dma_fill_aligned(chan->device, dest, 0, len)) {
1029 dev_err(chan2dev(chan), "%s: buffer is not aligned\n",1029 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
1439 unsigned int periods = buf_len / period_len;1439 unsigned int periods = buf_len / period_len;
1440 unsigned int i;1440 unsigned int i;
1441 1441
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",
1443 direction == DMA_MEM_TO_DEV ? "TO DEVICE" : "FROM DEVICE",1443 direction == DMA_MEM_TO_DEV ? "TO DEVICE" : "FROM DEVICE",
1444 buf_addr,1444 &buf_addr,
1445 periods, buf_len, period_len);1445 periods, buf_len, period_len);
1446 1446
1447 if (unlikely(!atslave || !buf_len || !period_len)) {1447 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
385static void atc_dump_lli(struct at_dma_chan *atchan, struct at_lli *lli)385static void atc_dump_lli(struct at_dma_chan *atchan, struct at_lli *lli)
386{386{
387 dev_crit(chan2dev(&atchan->chan_common),387 dev_crit(chan2dev(&atchan->chan_common),
388 " desc: s0x%x d0x%x ctrl0x%x:0x%x l0x%x\n",388 " desc: s%pad d%pad ctrl0x%x:0x%x l0x%pad\n",
389 lli->saddr, lli->daddr,389 &lli->saddr, &lli->daddr,
390 lli->ctrla, lli->ctrlb, lli->dscr);390 lli->ctrla, lli->ctrlb, &lli->dscr);
391}391}
392 392
393 393
drivers/dma/at_xdmac.c+10−10
@@ -920,8 +920,8 @@ at_xdmac_interleaved_queue_desc(struct dma_chan *chan, · 919 unmodified lines
920 desc->lld.mbr_cfg = chan_cc;920 desc->lld.mbr_cfg = chan_cc;
921 921
922 dev_dbg(chan2dev(chan),922 dev_dbg(chan2dev(chan),
923 "%s: lld: mbr_sa=0x%08x, mbr_da=0x%08x, mbr_ubc=0x%08x, mbr_cfg=0x%08x\n",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,924 __func__, &desc->lld.mbr_sa, &desc->lld.mbr_da,
925 desc->lld.mbr_ubc, desc->lld.mbr_cfg);925 desc->lld.mbr_ubc, desc->lld.mbr_cfg);
926 926
927 /* Chain lld. */927 /* Chain lld. */
@@ -953,8 +953,8 @@ at_xdmac_prep_interleaved(struct dma_chan *chan, · 25 unmodified lines
953 if ((xt->numf > 1) && (xt->frame_size > 1))953 if ((xt->numf > 1) && (xt->frame_size > 1))
954 return NULL;954 return NULL;
955 955
956 dev_dbg(chan2dev(chan), "%s: src=0x%08x, dest=0x%08x, numf=%d, frame_size=%d, flags=0x%lx\n",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,957 __func__, &xt->src_start, &xt->dst_start, xt->numf,
958 xt->frame_size, flags);958 xt->frame_size, flags);
959 959
960 src_addr = xt->src_start;960 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
1179 desc->lld.mbr_cfg = chan_cc;1179 desc->lld.mbr_cfg = chan_cc;
1180 1180
1181 dev_dbg(chan2dev(chan),1181 dev_dbg(chan2dev(chan),
1182 "%s: lld: mbr_da=0x%08x, mbr_ds=0x%08x, mbr_ubc=0x%08x, mbr_cfg=0x%08x\n",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,1183 __func__, &desc->lld.mbr_da, &desc->lld.mbr_ds, desc->lld.mbr_ubc,
1184 desc->lld.mbr_cfg);1184 desc->lld.mbr_cfg);
1185 1185
1186 return desc;1186 return desc;
@@ -1193,8 +1193,8 @@ at_xdmac_prep_dma_memset(struct dma_chan *chan, dma_addr_t dest, int value, · 6 unmodified lines
1193 struct at_xdmac_chan *atchan = to_at_xdmac_chan(chan);1193 struct at_xdmac_chan *atchan = to_at_xdmac_chan(chan);
1194 struct at_xdmac_desc *desc;1194 struct at_xdmac_desc *desc;
1195 1195
1196 dev_dbg(chan2dev(chan), "%s: dest=0x%08x, len=%d, pattern=0x%x, flags=0x%lx\n",1196 dev_dbg(chan2dev(chan), "%s: dest=%pad, len=%d, pattern=0x%x, flags=0x%lx\n",
1197 __func__, dest, len, value, flags);1197 __func__, &dest, len, value, flags);
1198 1198
1199 if (unlikely(!len))1199 if (unlikely(!len))
1200 return NULL;1200 return NULL;
@@ -1229,8 +1229,8 @@ at_xdmac_prep_dma_memset_sg(struct dma_chan *chan, struct scatterlist *sgl, · 28 unmodified lines
1229 1229
1230 /* Prepare descriptors. */1230 /* Prepare descriptors. */
1231 for_each_sg(sgl, sg, sg_len, i) {1231 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",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),1233 __func__, &sg_dma_address(sg), sg_dma_len(sg),
1234 value, flags);1234 value, flags);
1235 desc = at_xdmac_memset_create_desc(chan, atchan,1235 desc = at_xdmac_memset_create_desc(chan, atchan,
1236 sg_dma_address(sg),1236 sg_dma_address(sg),
drivers/dma/edma.c+2−2
@@ -107,7 +107,7 @@ · 106 unmodified lines
107 107
108/* CCCFG register */108/* CCCFG register */
109#define GET_NUM_DMACH(x) (x & 0x7) /* bits 0-2 */109#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 */
111#define GET_NUM_PAENTRY(x) ((x & 0x7000) >> 12) /* bits 12-14 */111#define GET_NUM_PAENTRY(x) ((x & 0x7000) >> 12) /* bits 12-14 */
112#define GET_NUM_EVQUE(x) ((x & 0x70000) >> 16) /* bits 16-18 */112#define GET_NUM_EVQUE(x) ((x & 0x70000) >> 16) /* bits 16-18 */
113#define GET_NUM_REGN(x) ((x & 0x300000) >> 20) /* bits 20-21 */113#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
1565 struct platform_device *tc_pdev;1565 struct platform_device *tc_pdev;
1566 int ret;1566 int ret;
1567 1567
1568 if (!tc)1568 if (!IS_ENABLED(CONFIG_OF) || !tc)
1569 return;1569 return;
1570 1570
1571 tc_pdev = of_find_device_by_node(tc->node);1571 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
1462 1462
1463#define EVENT_REMAP_CELLS 31463#define EVENT_REMAP_CELLS 3
1464 1464
1465static int __init sdma_event_remap(struct sdma_engine *sdma)1465static int sdma_event_remap(struct sdma_engine *sdma)
1466{1466{
1467 struct device_node *np = sdma->dev->of_node;1467 struct device_node *np = sdma->dev->of_node;
1468 struct device_node *gpr_np = of_parse_phandle(np, "gpr", 0);1468 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
679 struct usb_dmac *dmac = dev_get_drvdata(dev);679 struct usb_dmac *dmac = dev_get_drvdata(dev);
680 int i;680 int i;
681 681
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;
683 usb_dmac_chan_halt(&dmac->channels[i]);685 usb_dmac_chan_halt(&dmac->channels[i]);
686 }
684 687
685 return 0;688 return 0;
686}689}
@@ -799,11 +802,10 @@ static int usb_dmac_probe(struct platform_device *pdev) · 112 unmodified lines
799 ret = pm_runtime_get_sync(&pdev->dev);802 ret = pm_runtime_get_sync(&pdev->dev);
800 if (ret < 0) {803 if (ret < 0) {
801 dev_err(&pdev->dev, "runtime PM get sync failed (%d)\n", ret);804 dev_err(&pdev->dev, "runtime PM get sync failed (%d)\n", ret);
802 return ret;805 goto error_pm;
803 }806 }
804 807
805 ret = usb_dmac_init(dmac);808 ret = usb_dmac_init(dmac);
806 pm_runtime_put(&pdev->dev);
807 809
808 if (ret) {810 if (ret) {
809 dev_err(&pdev->dev, "failed to reset device\n");811 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
851 if (ret < 0)853 if (ret < 0)
852 goto error;854 goto error;
853 855
856 pm_runtime_put(&pdev->dev);
854 return 0;857 return 0;
855 858
856error:859error:
857 of_dma_controller_free(pdev->dev.of_node);860 of_dma_controller_free(pdev->dev.of_node);
861 pm_runtime_put(&pdev->dev);
862error_pm:
858 pm_runtime_disable(&pdev->dev);863 pm_runtime_disable(&pdev->dev);
859 return ret;864 return ret;
860}865}
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
113 113
114static int mmio_74xx_gpio_probe(struct platform_device *pdev)114static int mmio_74xx_gpio_probe(struct platform_device *pdev)
115{115{
116 const struct of_device_id *of_id =116 const struct of_device_id *of_id;
117 of_match_device(mmio_74xx_gpio_ids, &pdev->dev);
118 struct mmio_74xx_gpio_priv *priv;117 struct mmio_74xx_gpio_priv *priv;
119 struct resource *res;118 struct resource *res;
120 void __iomem *dat;119 void __iomem *dat;
121 int err;120 int err;
122 121
122 of_id = of_match_device(mmio_74xx_gpio_ids, &pdev->dev);
123 if (!of_id)
124 return -ENODEV;
125
123 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);126 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
124 if (!priv)127 if (!priv)
125 return -ENOMEM;128 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
1122 /* MPUIO is a bit different, reading IRQ status clears it */1122 /* MPUIO is a bit different, reading IRQ status clears it */
1123 if (bank->is_mpuio) {1123 if (bank->is_mpuio) {
1124 irqc->irq_ack = dummy_irq_chip.irq_ack;1124 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;
1127 if (!bank->regs->wkup_en)1125 if (!bank->regs->wkup_en)
1128 irqc->irq_set_wake = NULL;1126 irqc->irq_set_wake = NULL;
1129 }1127 }
drivers/gpio/gpio-palmas.c+2−0
@@ -167,6 +167,8 @@ static int palmas_gpio_probe(struct platform_device *pdev) · 166 unmodified lines
167 const struct palmas_device_data *dev_data;167 const struct palmas_device_data *dev_data;
168 168
169 match = of_match_device(of_palmas_gpio_match, &pdev->dev);169 match = of_match_device(of_palmas_gpio_match, &pdev->dev);
170 if (!match)
171 return -ENODEV;
170 dev_data = match->data;172 dev_data = match->data;
171 if (!dev_data)173 if (!dev_data)
172 dev_data = &palmas_dev_data;174 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
187static int syscon_gpio_probe(struct platform_device *pdev)187static int syscon_gpio_probe(struct platform_device *pdev)
188{188{
189 struct device *dev = &pdev->dev;189 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;
191 struct syscon_gpio_priv *priv;191 struct syscon_gpio_priv *priv;
192 struct device_node *np = dev->of_node;192 struct device_node *np = dev->of_node;
193 int ret;193 int ret;
194 194
195 of_id = of_match_device(syscon_gpio_ids, dev);
196 if (!of_id)
197 return -ENODEV;
198
195 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);199 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
196 if (!priv)200 if (!priv)
197 return -ENOMEM;201 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
375}375}
376#endif376#endif
377 377
378#ifdef CONFIG_DEBUG_FS
379
380#include <linux/debugfs.h>
381#include <linux/seq_file.h>
382
383static 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
406static int dbg_gpio_open(struct inode *inode, struct file *file)
407{
408 return single_open(file, dbg_gpio_show, &inode->i_private);
409}
410
411static 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
418static 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
426static inline void tegra_gpio_debuginit(void)
427{
428}
429
430#endif
431
378static struct irq_chip tegra_gpio_irq_chip = {432static struct irq_chip tegra_gpio_irq_chip = {
379 .name = "GPIO",433 .name = "GPIO",
380 .irq_ack = tegra_gpio_irq_ack,434 .irq_ack = tegra_gpio_irq_ack,
@@ -519,6 +573,8 @@ static int tegra_gpio_probe(struct platform_device *pdev) · 138 unmodified lines
519 spin_lock_init(&bank->lvl_lock[j]);573 spin_lock_init(&bank->lvl_lock[j]);
520 }574 }
521 575
576 tegra_gpio_debuginit();
577
522 return 0;578 return 0;
523}579}
524 580
@@ -536,52 +592,3 @@ static int __init tegra_gpio_init(void) · 11 unmodified lines
536 return platform_driver_register(&tegra_gpio_driver);592 return platform_driver_register(&tegra_gpio_driver);
537}593}
538postcore_initcall(tegra_gpio_init);594postcore_initcall(tegra_gpio_init);
539
540#ifdef CONFIG_DEBUG_FS
541
542#include <linux/debugfs.h>
543#include <linux/seq_file.h>
544
545static 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
568static int dbg_gpio_open(struct inode *inode, struct file *file)
569{
570 return single_open(file, dbg_gpio_show, &inode->i_private);
571}
572
573static 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
580static 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}
586late_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
233 for (i = 0; i != chip->ngpio; ++i) {233 for (i = 0; i != chip->ngpio; ++i) {
234 struct gpio_desc *gpio = &chip->desc[i];234 struct gpio_desc *gpio = &chip->desc[i];
235 235
236 if (!gpio->name)236 if (!gpio->name || !name)
237 continue;237 continue;
238 238
239 if (!strcmp(gpio->name, name)) {239 if (!strcmp(gpio->name, name)) {
drivers/gpu/drm/amd/amdgpu/amdgpu.h+62−64
@@ -389,7 +389,6 @@ struct amdgpu_clock { · 388 unmodified lines
389 * Fences.389 * Fences.
390 */390 */
391struct amdgpu_fence_driver {391struct amdgpu_fence_driver {
392 struct amdgpu_ring *ring;
393 uint64_t gpu_addr;392 uint64_t gpu_addr;
394 volatile uint32_t *cpu_addr;393 volatile uint32_t *cpu_addr;
395 /* sync_seq is protected by ring emission lock */394 /* sync_seq is protected by ring emission lock */
@@ -398,7 +397,7 @@ struct amdgpu_fence_driver { · 2 unmodified lines
398 bool initialized;397 bool initialized;
399 struct amdgpu_irq_src *irq_src;398 struct amdgpu_irq_src *irq_src;
400 unsigned irq_type;399 unsigned irq_type;
401 struct delayed_work lockup_work;400 struct timer_list fallback_timer;
402 wait_queue_head_t fence_queue;401 wait_queue_head_t fence_queue;
403};402};
404 403
@@ -497,6 +496,7 @@ struct amdgpu_bo_va_mapping { · 92 unmodified lines
497 496
498/* bo virtual addresses in a specific vm */497/* bo virtual addresses in a specific vm */
499struct amdgpu_bo_va {498struct amdgpu_bo_va {
499 struct mutex mutex;
500 /* protected by bo being reserved */500 /* protected by bo being reserved */
501 struct list_head bo_list;501 struct list_head bo_list;
502 struct fence *last_pt_update;502 struct fence *last_pt_update;
@@ -539,6 +539,7 @@ struct amdgpu_bo { · 36 unmodified lines
539 /* Constant after initialization */539 /* Constant after initialization */
540 struct amdgpu_device *adev;540 struct amdgpu_device *adev;
541 struct drm_gem_object gem_base;541 struct drm_gem_object gem_base;
542 struct amdgpu_bo *parent;
542 543
543 struct ttm_bo_kmap_obj dma_buf_vmap;544 struct ttm_bo_kmap_obj dma_buf_vmap;
544 pid_t pid;545 pid_t pid;
@@ -917,8 +918,8 @@ struct amdgpu_ring { · 372 unmodified lines
917#define AMDGPU_VM_FAULT_STOP_ALWAYS 2918#define AMDGPU_VM_FAULT_STOP_ALWAYS 2
918 919
919struct amdgpu_vm_pt {920struct amdgpu_vm_pt {
920 struct amdgpu_bo *bo;921 struct amdgpu_bo *bo;
921 uint64_t addr;922 uint64_t addr;
922};923};
923 924
924struct amdgpu_vm_id {925struct amdgpu_vm_id {
@@ -926,13 +927,9 @@ struct amdgpu_vm_id { · 1 unmodified line
926 uint64_t pd_gpu_addr;927 uint64_t pd_gpu_addr;
927 /* last flushed PD/PT update */928 /* last flushed PD/PT update */
928 struct fence *flushed_updates;929 struct fence *flushed_updates;
929 /* last use of vmid */
930 struct fence *last_id_use;
931};930};
932 931
933struct amdgpu_vm {932struct amdgpu_vm {
934 struct mutex mutex;
935
936 struct rb_root va;933 struct rb_root va;
937 934
938 /* protecting invalidated */935 /* protecting invalidated */
@@ -957,24 +954,72 @@ struct amdgpu_vm { · 18 unmodified lines
957 954
958 /* for id and flush management per ring */955 /* for id and flush management per ring */
959 struct amdgpu_vm_id ids[AMDGPU_MAX_RINGS];956 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;
960};961};
961 962
962struct amdgpu_vm_manager {963struct amdgpu_vm_manager {
963 struct fence *active[AMDGPU_NUM_VM];964 struct {
964 uint32_t max_pfn;965 struct fence *active;
966 atomic_long_t owner;
967 } ids[AMDGPU_NUM_VM];
968
969 uint32_t max_pfn;
965 /* number of VMIDs */970 /* number of VMIDs */
966 unsigned nvm;971 unsigned nvm;
967 /* vram base address for page table entry */972 /* vram base address for page table entry */
968 u64 vram_base_offset;973 u64 vram_base_offset;
969 /* is vm enabled? */974 /* is vm enabled? */
970 bool enabled;975 bool enabled;
971 /* for hw to save the PD addr on suspend/resume */
972 uint32_t saved_table_addr[AMDGPU_NUM_VM];
973 /* vm pte handling */976 /* vm pte handling */
974 const struct amdgpu_vm_pte_funcs *vm_pte_funcs;977 const struct amdgpu_vm_pte_funcs *vm_pte_funcs;
975 struct amdgpu_ring *vm_pte_funcs_ring;978 struct amdgpu_ring *vm_pte_funcs_ring;
976};979};
977 980
981void amdgpu_vm_manager_fini(struct amdgpu_device *adev);
982int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm);
983void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm);
984struct amdgpu_bo_list_entry *amdgpu_vm_get_bos(struct amdgpu_device *adev,
985 struct amdgpu_vm *vm,
986 struct list_head *head);
987int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
988 struct amdgpu_sync *sync);
989void amdgpu_vm_flush(struct amdgpu_ring *ring,
990 struct amdgpu_vm *vm,
991 struct fence *updates);
992void amdgpu_vm_fence(struct amdgpu_device *adev,
993 struct amdgpu_vm *vm,
994 struct fence *fence);
995uint64_t amdgpu_vm_map_gart(struct amdgpu_device *adev, uint64_t addr);
996int amdgpu_vm_update_page_directory(struct amdgpu_device *adev,
997 struct amdgpu_vm *vm);
998int amdgpu_vm_clear_freed(struct amdgpu_device *adev,
999 struct amdgpu_vm *vm);
1000int amdgpu_vm_clear_invalids(struct amdgpu_device *adev, struct amdgpu_vm *vm,
1001 struct amdgpu_sync *sync);
1002int amdgpu_vm_bo_update(struct amdgpu_device *adev,
1003 struct amdgpu_bo_va *bo_va,
1004 struct ttm_mem_reg *mem);
1005void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev,
1006 struct amdgpu_bo *bo);
1007struct amdgpu_bo_va *amdgpu_vm_bo_find(struct amdgpu_vm *vm,
1008 struct amdgpu_bo *bo);
1009struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev,
1010 struct amdgpu_vm *vm,
1011 struct amdgpu_bo *bo);
1012int 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);
1016int amdgpu_vm_bo_unmap(struct amdgpu_device *adev,
1017 struct amdgpu_bo_va *bo_va,
1018 uint64_t addr);
1019void amdgpu_vm_bo_rmv(struct amdgpu_device *adev,
1020 struct amdgpu_bo_va *bo_va);
1021int amdgpu_vm_free_job(struct amdgpu_job *job);
1022
978/*1023/*
979 * context related structures1024 * context related structures
980 */1025 */
@@ -1211,6 +1256,7 @@ struct amdgpu_cs_parser { · 230 unmodified lines
1211 /* relocations */1256 /* relocations */
1212 struct amdgpu_bo_list_entry *vm_bos;1257 struct amdgpu_bo_list_entry *vm_bos;
1213 struct list_head validated;1258 struct list_head validated;
1259 struct fence *fence;
1214 1260
1215 struct amdgpu_ib *ibs;1261 struct amdgpu_ib *ibs;
1216 uint32_t num_ibs;1262 uint32_t num_ibs;
@@ -1226,7 +1272,7 @@ struct amdgpu_job { · 9 unmodified lines
1226 struct amdgpu_device *adev;1272 struct amdgpu_device *adev;
1227 struct amdgpu_ib *ibs;1273 struct amdgpu_ib *ibs;
1228 uint32_t num_ibs;1274 uint32_t num_ibs;
1229 struct mutex job_lock;1275 void *owner;
1230 struct amdgpu_user_fence uf;1276 struct amdgpu_user_fence uf;
1231 int (*free_job)(struct amdgpu_job *job);1277 int (*free_job)(struct amdgpu_job *job);
1232};1278};
@@ -2257,11 +2303,6 @@ void amdgpu_pci_config_reset(struct amdgpu_device *adev); · 1024 unmodified lines
2257bool amdgpu_card_posted(struct amdgpu_device *adev);2303bool amdgpu_card_posted(struct amdgpu_device *adev);
2258void amdgpu_update_display_priority(struct amdgpu_device *adev);2304void amdgpu_update_display_priority(struct amdgpu_device *adev);
2259bool amdgpu_boot_test_post_card(struct amdgpu_device *adev);2305bool amdgpu_boot_test_post_card(struct amdgpu_device *adev);
2260struct 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);
2265 2306
2266int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data);2307int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data);
2267int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type,2308int 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
2318long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd,2359long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd,
2319 unsigned long arg);2360 unsigned long arg);
2320 2361
2321/*
2322 * vm
2323 */
2324int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm);
2325void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm);
2326struct amdgpu_bo_list_entry *amdgpu_vm_get_bos(struct amdgpu_device *adev,
2327 struct amdgpu_vm *vm,
2328 struct list_head *head);
2329int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
2330 struct amdgpu_sync *sync);
2331void amdgpu_vm_flush(struct amdgpu_ring *ring,
2332 struct amdgpu_vm *vm,
2333 struct fence *updates);
2334void amdgpu_vm_fence(struct amdgpu_device *adev,
2335 struct amdgpu_vm *vm,
2336 struct amdgpu_fence *fence);
2337uint64_t amdgpu_vm_map_gart(struct amdgpu_device *adev, uint64_t addr);
2338int amdgpu_vm_update_page_directory(struct amdgpu_device *adev,
2339 struct amdgpu_vm *vm);
2340int amdgpu_vm_clear_freed(struct amdgpu_device *adev,
2341 struct amdgpu_vm *vm);
2342int amdgpu_vm_clear_invalids(struct amdgpu_device *adev,
2343 struct amdgpu_vm *vm, struct amdgpu_sync *sync);
2344int amdgpu_vm_bo_update(struct amdgpu_device *adev,
2345 struct amdgpu_bo_va *bo_va,
2346 struct ttm_mem_reg *mem);
2347void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev,
2348 struct amdgpu_bo *bo);
2349struct amdgpu_bo_va *amdgpu_vm_bo_find(struct amdgpu_vm *vm,
2350 struct amdgpu_bo *bo);
2351struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev,
2352 struct amdgpu_vm *vm,
2353 struct amdgpu_bo *bo);
2354int 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);
2358int amdgpu_vm_bo_unmap(struct amdgpu_device *adev,
2359 struct amdgpu_bo_va *bo_va,
2360 uint64_t addr);
2361void amdgpu_vm_bo_rmv(struct amdgpu_device *adev,
2362 struct amdgpu_bo_va *bo_va);
2363int amdgpu_vm_free_job(struct amdgpu_job *job);
2364/*2362/*
2365 * functions used by amdgpu_encoder.c2363 * functions used by amdgpu_encoder.c
2366 */2364 */
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
127 return 0;127 return 0;
128}128}
129 129
130struct 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
154int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)130int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)
155{131{
156 union drm_amdgpu_cs *cs = data;132 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
246 }222 }
247 223
248 p->uf.bo = gem_to_amdgpu_bo(gobj);224 p->uf.bo = gem_to_amdgpu_bo(gobj);
225 amdgpu_bo_ref(p->uf.bo);
226 drm_gem_object_unreference_unlocked(gobj);
249 p->uf.offset = fence_data->offset;227 p->uf.offset = fence_data->offset;
250 } else {228 } else {
251 ret = -EINVAL;229 ret = -EINVAL;
@@ -463,8 +441,18 @@ static int cmp_size_smaller_first(void *priv, struct list_head *a, · 211 unmodified lines
463 return (int)la->robj->tbo.num_pages - (int)lb->robj->tbo.num_pages;441 return (int)la->robj->tbo.num_pages - (int)lb->robj->tbo.num_pages;
464}442}
465 443
466static 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 **/
452static void amdgpu_cs_parser_fini(struct amdgpu_cs_parser *parser, int error, bool backoff)
467{453{
454 unsigned i;
455
468 if (!error) {456 if (!error) {
469 /* Sort the buffer list from the smallest to largest buffer,457 /* Sort the buffer list from the smallest to largest buffer,
470 * which affects the order of buffers in the LRU list.458 * 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
479 list_sort(NULL, &parser->validated, cmp_size_smaller_first);467 list_sort(NULL, &parser->validated, cmp_size_smaller_first);
480 468
481 ttm_eu_fence_buffer_objects(&parser->ticket,469 ttm_eu_fence_buffer_objects(&parser->ticket,
482 &parser->validated,470 &parser->validated,
483 &parser->ibs[parser->num_ibs-1].fence->base);471 parser->fence);
484 } else if (backoff) {472 } else if (backoff) {
485 ttm_eu_backoff_reservation(&parser->ticket,473 ttm_eu_backoff_reservation(&parser->ticket,
486 &parser->validated);474 &parser->validated);
487 }475 }
488}476 fence_put(parser->fence);
489 477
490static void amdgpu_cs_parser_fini_late(struct amdgpu_cs_parser *parser)
491{
492 unsigned i;
493 if (parser->ctx)478 if (parser->ctx)
494 amdgpu_ctx_put(parser->ctx);479 amdgpu_ctx_put(parser->ctx);
495 if (parser->bo_list)480 if (parser->bo_list)
@@ -499,31 +484,12 @@ static void amdgpu_cs_parser_fini_late(struct amdgpu_cs_parser *parser) · 3 unmodified lines
499 for (i = 0; i < parser->nchunks; i++)484 for (i = 0; i < parser->nchunks; i++)
500 drm_free_large(parser->chunks[i].kdata);485 drm_free_large(parser->chunks[i].kdata);
501 kfree(parser->chunks);486 kfree(parser->chunks);
502 if (!amdgpu_enable_scheduler)487 if (parser->ibs)
503 {488 for (i = 0; i < parser->num_ibs; i++)
504 if (parser->ibs)489 amdgpu_ib_free(parser->adev, &parser->ibs[i]);
505 for (i = 0; i < parser->num_ibs; i++)490 kfree(parser->ibs);
506 amdgpu_ib_free(parser->adev, &parser->ibs[i]);491 if (parser->uf.bo)
507 kfree(parser->ibs);492 amdgpu_bo_unref(&parser->uf.bo);
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 **/
523static 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);
527}493}
528 494
529static int amdgpu_bo_vm_update_pte(struct amdgpu_cs_parser *p,495static 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
610 }576 }
611 577
612 r = amdgpu_bo_vm_update_pte(parser, vm);578 r = amdgpu_bo_vm_update_pte(parser, vm);
613 if (r) {579 if (!r)
614 goto out;580 amdgpu_cs_sync_rings(parser);
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);
620 581
621out:
622 return r;582 return r;
623}583}
624 584
@@ -818,7 +778,7 @@ static int amdgpu_cs_free_job(struct amdgpu_job *job) · 193 unmodified lines
818 amdgpu_ib_free(job->adev, &job->ibs[i]);778 amdgpu_ib_free(job->adev, &job->ibs[i]);
819 kfree(job->ibs);779 kfree(job->ibs);
820 if (job->uf.bo)780 if (job->uf.bo)
821 drm_gem_object_unreference_unlocked(&job->uf.bo->gem_base);781 amdgpu_bo_unref(&job->uf.bo);
822 return 0;782 return 0;
823}783}
824 784
@@ -826,38 +786,35 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 1 unmodified line
826{786{
827 struct amdgpu_device *adev = dev->dev_private;787 struct amdgpu_device *adev = dev->dev_private;
828 union drm_amdgpu_cs *cs = data;788 union drm_amdgpu_cs *cs = data;
829 struct amdgpu_fpriv *fpriv = filp->driver_priv;789 struct amdgpu_cs_parser parser = {};
830 struct amdgpu_vm *vm = &fpriv->vm;
831 struct amdgpu_cs_parser *parser;
832 bool reserved_buffers = false;790 bool reserved_buffers = false;
833 int i, r;791 int i, r;
834 792
835 if (!adev->accel_working)793 if (!adev->accel_working)
836 return -EBUSY;794 return -EBUSY;
837 795
838 parser = amdgpu_cs_parser_create(adev, filp, NULL, NULL, 0);796 parser.adev = adev;
839 if (!parser)797 parser.filp = filp;
840 return -ENOMEM;798
841 r = amdgpu_cs_parser_init(parser, data);799 r = amdgpu_cs_parser_init(&parser, data);
842 if (r) {800 if (r) {
843 DRM_ERROR("Failed to initialize parser !\n");801 DRM_ERROR("Failed to initialize parser !\n");
844 amdgpu_cs_parser_fini(parser, r, false);802 amdgpu_cs_parser_fini(&parser, r, false);
845 r = amdgpu_cs_handle_lockup(adev, r);803 r = amdgpu_cs_handle_lockup(adev, r);
846 return r;804 return r;
847 }805 }
848 mutex_lock(&vm->mutex);806 r = amdgpu_cs_parser_relocs(&parser);
849 r = amdgpu_cs_parser_relocs(parser);
850 if (r == -ENOMEM)807 if (r == -ENOMEM)
851 DRM_ERROR("Not enough memory for command submission!\n");808 DRM_ERROR("Not enough memory for command submission!\n");
852 else if (r && r != -ERESTARTSYS)809 else if (r && r != -ERESTARTSYS)
853 DRM_ERROR("Failed to process the buffer list %d!\n", r);810 DRM_ERROR("Failed to process the buffer list %d!\n", r);
854 else if (!r) {811 else if (!r) {
855 reserved_buffers = true;812 reserved_buffers = true;
856 r = amdgpu_cs_ib_fill(adev, parser);813 r = amdgpu_cs_ib_fill(adev, &parser);
857 }814 }
858 815
859 if (!r) {816 if (!r) {
860 r = amdgpu_cs_dependencies(adev, parser);817 r = amdgpu_cs_dependencies(adev, &parser);
861 if (r)818 if (r)
862 DRM_ERROR("Failed in the dependencies handling %d!\n", r);819 DRM_ERROR("Failed in the dependencies handling %d!\n", r);
863 }820 }
@@ -865,63 +822,71 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 1 unmodified line
865 if (r)822 if (r)
866 goto out;823 goto out;
867 824
868 for (i = 0; i < parser->num_ibs; i++)825 for (i = 0; i < parser.num_ibs; i++)
869 trace_amdgpu_cs(parser, i);826 trace_amdgpu_cs(&parser, i);
870 827
871 r = amdgpu_cs_ib_vm_chunk(adev, parser);828 r = amdgpu_cs_ib_vm_chunk(adev, &parser);
872 if (r)829 if (r)
873 goto out;830 goto out;
874 831
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;
876 struct amdgpu_job *job;835 struct amdgpu_job *job;
877 struct amdgpu_ring * ring = parser->ibs->ring;836
878 job = kzalloc(sizeof(struct amdgpu_job), GFP_KERNEL);837 job = kzalloc(sizeof(struct amdgpu_job), GFP_KERNEL);
879 if (!job) {838 if (!job) {
880 r = -ENOMEM;839 r = -ENOMEM;
881 goto out;840 goto out;
882 }841 }
842
883 job->base.sched = &ring->sched;843 job->base.sched = &ring->sched;
884 job->base.s_entity = &parser->ctx->rings[ring->idx].entity;844 job->base.s_entity = &parser.ctx->rings[ring->idx].entity;
885 job->adev = parser->adev;845 job->adev = parser.adev;
886 job->ibs = parser->ibs;846 job->owner = parser.filp;
887 job->num_ibs = parser->num_ibs;847 job->free_job = amdgpu_cs_free_job;
888 job->base.owner = parser->filp;848
889 mutex_init(&job->job_lock);849 job->ibs = parser.ibs;
850 job->num_ibs = parser.num_ibs;
851 parser.ibs = NULL;
852 parser.num_ibs = 0;
853
890 if (job->ibs[job->num_ibs - 1].user) {854 if (job->ibs[job->num_ibs - 1].user) {
891 memcpy(&job->uf, &parser->uf,855 job->uf = parser.uf;
892 sizeof(struct amdgpu_user_fence));
893 job->ibs[job->num_ibs - 1].user = &job->uf;856 job->ibs[job->num_ibs - 1].user = &job->uf;
857 parser.uf.bo = NULL;
894 }858 }
895 859
896 job->free_job = amdgpu_cs_free_job;860 fence = amd_sched_fence_create(job->base.s_entity,
897 mutex_lock(&job->job_lock);861 parser.filp);
898 r = amd_sched_entity_push_job(&job->base);862 if (!fence) {
899 if (r) {863 r = -ENOMEM;
900 mutex_unlock(&job->job_lock);
901 amdgpu_cs_free_job(job);864 amdgpu_cs_free_job(job);
902 kfree(job);865 kfree(job);
903 goto out;866 goto out;
904 }867 }
905 cs->out.handle =868 job->base.s_fence = fence;
906 amdgpu_ctx_add_fence(parser->ctx, ring,869 parser.fence = fence_get(&fence->base);
907 &job->base.s_fence->base);
908 parser->ibs[parser->num_ibs - 1].sequence = cs->out.handle;
909 870
910 list_sort(NULL, &parser->validated, cmp_size_smaller_first);871 cs->out.handle = amdgpu_ctx_add_fence(parser.ctx, ring,
911 ttm_eu_fence_buffer_objects(&parser->ticket,872 &fence->base);
912 &parser->validated,873 job->ibs[job->num_ibs - 1].sequence = cs->out.handle;
913 &job->base.s_fence->base);
914 874
915 mutex_unlock(&job->job_lock);875 trace_amdgpu_cs_ioctl(job);
916 amdgpu_cs_parser_fini_late(parser);876 amd_sched_entity_push_job(&job->base);
917 mutex_unlock(&vm->mutex);877
918 return 0;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;
919 }886 }
920 887
921 cs->out.handle = parser->ibs[parser->num_ibs - 1].sequence;
922out:888out:
923 amdgpu_cs_parser_fini(parser, r, reserved_buffers);889 amdgpu_cs_parser_fini(&parser, r, reserved_buffers);
924 mutex_unlock(&vm->mutex);
925 r = amdgpu_cs_handle_lockup(adev, r);890 r = amdgpu_cs_handle_lockup(adev, r);
926 return r;891 return r;
927}892}
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
73 struct drm_crtc *crtc = &amdgpuCrtc->base;73 struct drm_crtc *crtc = &amdgpuCrtc->base;
74 unsigned long flags;74 unsigned long flags;
75 unsigned i;75 unsigned i;
76 int vpos, hpos, stat, min_udelay;
77 struct drm_vblank_crtc *vblank = &crtc->dev->vblank[work->crtc_id];
76 78
77 amdgpu_flip_wait_fence(adev, &work->excl);79 amdgpu_flip_wait_fence(adev, &work->excl);
78 for (i = 0; i < work->shared_count; ++i)80 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
81 /* We borrow the event spin lock for protecting flip_status */83 /* We borrow the event spin lock for protecting flip_status */
82 spin_lock_irqsave(&crtc->dev->event_lock, flags);84 spin_lock_irqsave(&crtc->dev->event_lock, flags);
83 85
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
84 /* do the flip (mmio) */121 /* do the flip (mmio) */
85 adev->mode_info.funcs->page_flip(adev, work->crtc_id, work->base);122 adev->mode_info.funcs->page_flip(adev, work->crtc_id, work->base);
86 /* set the flip status */123 /* set the flip status */
@@ -109,7 +146,7 @@ static void amdgpu_unpin_work_func(struct work_struct *__work) · 22 unmodified lines
109 } else146 } else
110 DRM_ERROR("failed to reserve buffer after flip\n");147 DRM_ERROR("failed to reserve buffer after flip\n");
111 148
112 drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base);149 amdgpu_bo_unref(&work->old_rbo);
113 kfree(work->shared);150 kfree(work->shared);
114 kfree(work);151 kfree(work);
115}152}
@@ -148,8 +185,8 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc, · 32 unmodified lines
148 obj = old_amdgpu_fb->obj;185 obj = old_amdgpu_fb->obj;
149 186
150 /* take a reference to the old object */187 /* take a reference to the old object */
151 drm_gem_object_reference(obj);
152 work->old_rbo = gem_to_amdgpu_bo(obj);188 work->old_rbo = gem_to_amdgpu_bo(obj);
189 amdgpu_bo_ref(work->old_rbo);
153 190
154 new_amdgpu_fb = to_amdgpu_framebuffer(fb);191 new_amdgpu_fb = to_amdgpu_framebuffer(fb);
155 obj = new_amdgpu_fb->obj;192 obj = new_amdgpu_fb->obj;
@@ -222,7 +259,7 @@ pflip_cleanup: · 66 unmodified lines
222 amdgpu_bo_unreserve(new_rbo);259 amdgpu_bo_unreserve(new_rbo);
223 260
224cleanup:261cleanup:
225 drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base);262 amdgpu_bo_unref(&work->old_rbo);
226 fence_put(work->excl);263 fence_put(work->excl);
227 for (i = 0; i < work->shared_count; ++i)264 for (i = 0; i < work->shared_count; ++i)
228 fence_put(work->shared[i]);265 fence_put(work->shared[i]);
@@ -712,6 +749,15 @@ bool amdgpu_crtc_scaling_mode_fixup(struct drm_crtc *crtc, · 483 unmodified lines
712 * \param dev Device to query.749 * \param dev Device to query.
713 * \param pipe Crtc to query.750 * \param pipe Crtc to query.
714 * \param flags Flags from caller (DRM_CALLED_FROM_VBLIRQ or 0).751 * \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 *
715 * \param *vpos Location where vertical scanout position should be stored.761 * \param *vpos Location where vertical scanout position should be stored.
716 * \param *hpos Location where horizontal scanout position should go.762 * \param *hpos Location where horizontal scanout position should go.
717 * \param *stime Target location for timestamp taken immediately before763 * \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
776 vbl_end = 0;822 vbl_end = 0;
777 }823 }
778 824
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
779 /* Test scanout position against vblank region. */844 /* Test scanout position against vblank region. */
780 if ((*vpos < vbl_start) && (*vpos >= vbl_end))845 if ((*vpos < vbl_start) && (*vpos >= vbl_end))
781 in_vbl = false;846 in_vbl = false;
782 847
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
783 /* Check if inside vblank area and apply corrective offsets:859 /* Check if inside vblank area and apply corrective offsets:
784 * vpos will then be >=0 in video scanout area, but negative860 * vpos will then be >=0 in video scanout area, but negative
785 * within vblank area, counting down the number of lines until861 * 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
795 /* Correct for shifted end of vbl at vbl_end. */871 /* Correct for shifted end of vbl at vbl_end. */
796 *vpos = *vpos - vbl_end;872 *vpos = *vpos - vbl_end;
797 873
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
824 return ret;874 return ret;
825}875}
826 876
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c+54−47
@@ -47,6 +47,9 @@ · 46 unmodified lines
47 * that the the relevant GPU caches have been flushed.47 * that the the relevant GPU caches have been flushed.
48 */48 */
49 49
50static struct kmem_cache *amdgpu_fence_slab;
51static atomic_t amdgpu_fence_slab_ref = ATOMIC_INIT(0);
52
50/**53/**
51 * amdgpu_fence_write - write a fence value54 * amdgpu_fence_write - write a fence value
52 *55 *
@@ -84,24 +87,6 @@ static u32 amdgpu_fence_read(struct amdgpu_ring *ring) · 31 unmodified lines
84 return seq;87 return seq;
85}88}
86 89
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 */
94static 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
105/**90/**
106 * amdgpu_fence_emit - emit a fence on the requested ring91 * amdgpu_fence_emit - emit a fence on the requested ring
107 *92 *
@@ -118,7 +103,7 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, void *owner, · 10 unmodified lines
118 struct amdgpu_device *adev = ring->adev;103 struct amdgpu_device *adev = ring->adev;
119 104
120 /* we are protected by the ring emission mutex */105 /* 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);
122 if ((*fence) == NULL) {107 if ((*fence) == NULL) {
123 return -ENOMEM;108 return -ENOMEM;
124 }109 }
@@ -132,10 +117,22 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, void *owner, · 7 unmodified lines
132 amdgpu_ring_emit_fence(ring, ring->fence_drv.gpu_addr,117 amdgpu_ring_emit_fence(ring, ring->fence_drv.gpu_addr,
133 (*fence)->seq,118 (*fence)->seq,
134 AMDGPU_FENCE_FLAG_INT);119 AMDGPU_FENCE_FLAG_INT);
135 trace_amdgpu_fence_emit(ring->adev->ddev, ring->idx, (*fence)->seq);
136 return 0;120 return 0;
137}121}
138 122
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 */
130static 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
139/**136/**
140 * amdgpu_fence_activity - check for fence activity137 * amdgpu_fence_activity - check for fence activity
141 *138 *
@@ -202,45 +199,38 @@ static bool amdgpu_fence_activity(struct amdgpu_ring *ring) · 60 unmodified lines
202 } while (atomic64_xchg(&ring->fence_drv.last_seq, seq) > seq);199 } while (atomic64_xchg(&ring->fence_drv.last_seq, seq) > seq);
203 200
204 if (seq < last_emitted)201 if (seq < last_emitted)
205 amdgpu_fence_schedule_check(ring);202 amdgpu_fence_schedule_fallback(ring);
206 203
207 return wake;204 return wake;
208}205}
209 206
210/**207/**
211 * amdgpu_fence_check_lockup - check for hardware lockup208 * amdgpu_fence_process - process a fence
212 *209 *
213 * @work: delayed work item210 * @adev: amdgpu_device pointer
211 * @ring: ring index the fence is associated with
214 *212 *
215 * Checks for fence activity and if there is none probe213 * Checks the current fence value and wakes the fence queue
216 * the hardware if a lockup occured.214 * if the sequence number has increased (all asics).
217 */215 */
218static void amdgpu_fence_check_lockup(struct work_struct *work)216void amdgpu_fence_process(struct amdgpu_ring *ring)
219{217{
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
227 if (amdgpu_fence_activity(ring))218 if (amdgpu_fence_activity(ring))
228 wake_up_all(&ring->fence_drv.fence_queue);219 wake_up_all(&ring->fence_drv.fence_queue);
229}220}
230 221
231/**222/**
232 * amdgpu_fence_process - process a fence223 * amdgpu_fence_fallback - fallback for hardware interrupts
233 *224 *
234 * @adev: amdgpu_device pointer225 * @work: delayed work item
235 * @ring: ring index the fence is associated with
236 *226 *
237 * Checks the current fence value and wakes the fence queue227 * Checks for fence activity.
238 * if the sequence number has increased (all asics).
239 */228 */
240void amdgpu_fence_process(struct amdgpu_ring *ring)229static void amdgpu_fence_fallback(unsigned long arg)
241{230{
242 if (amdgpu_fence_activity(ring))231 struct amdgpu_ring *ring = (void *)arg;
243 wake_up_all(&ring->fence_drv.fence_queue);232
233 amdgpu_fence_process(ring);
244}234}
245 235
246/**236/**
@@ -290,7 +280,7 @@ static int amdgpu_fence_ring_wait_seq(struct amdgpu_ring *ring, uint64_t seq) · 43 unmodified lines
290 if (atomic64_read(&ring->fence_drv.last_seq) >= seq)280 if (atomic64_read(&ring->fence_drv.last_seq) >= seq)
291 return 0;281 return 0;
292 282
293 amdgpu_fence_schedule_check(ring);283 amdgpu_fence_schedule_fallback(ring);
294 wait_event(ring->fence_drv.fence_queue, (284 wait_event(ring->fence_drv.fence_queue, (
295 (signaled = amdgpu_fence_seq_signaled(ring, seq))));285 (signaled = amdgpu_fence_seq_signaled(ring, seq))));
296 286
@@ -491,9 +481,8 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring) · 194 unmodified lines
491 atomic64_set(&ring->fence_drv.last_seq, 0);481 atomic64_set(&ring->fence_drv.last_seq, 0);
492 ring->fence_drv.initialized = false;482 ring->fence_drv.initialized = false;
493 483
494 INIT_DELAYED_WORK(&ring->fence_drv.lockup_work,484 setup_timer(&ring->fence_drv.fallback_timer, amdgpu_fence_fallback,
495 amdgpu_fence_check_lockup);485 (unsigned long)ring);
496 ring->fence_drv.ring = ring;
497 486
498 init_waitqueue_head(&ring->fence_drv.fence_queue);487 init_waitqueue_head(&ring->fence_drv.fence_queue);
499 488
@@ -536,6 +525,13 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring) · 36 unmodified lines
536 */525 */
537int amdgpu_fence_driver_init(struct amdgpu_device *adev)526int amdgpu_fence_driver_init(struct amdgpu_device *adev)
538{527{
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 }
539 if (amdgpu_debugfs_fence_init(adev))535 if (amdgpu_debugfs_fence_init(adev))
540 dev_err(adev->dev, "fence debugfs file creation failed\n");536 dev_err(adev->dev, "fence debugfs file creation failed\n");
541 537
@@ -554,9 +550,12 @@ void amdgpu_fence_driver_fini(struct amdgpu_device *adev) · 12 unmodified lines
554{550{
555 int i, r;551 int i, r;
556 552
553 if (atomic_dec_and_test(&amdgpu_fence_slab_ref))
554 kmem_cache_destroy(amdgpu_fence_slab);
557 mutex_lock(&adev->ring_lock);555 mutex_lock(&adev->ring_lock);
558 for (i = 0; i < AMDGPU_MAX_RINGS; i++) {556 for (i = 0; i < AMDGPU_MAX_RINGS; i++) {
559 struct amdgpu_ring *ring = adev->rings[i];557 struct amdgpu_ring *ring = adev->rings[i];
558
560 if (!ring || !ring->fence_drv.initialized)559 if (!ring || !ring->fence_drv.initialized)
561 continue;560 continue;
562 r = amdgpu_fence_wait_empty(ring);561 r = amdgpu_fence_wait_empty(ring);
@@ -568,6 +567,7 @@ void amdgpu_fence_driver_fini(struct amdgpu_device *adev) · 5 unmodified lines
568 amdgpu_irq_put(adev, ring->fence_drv.irq_src,567 amdgpu_irq_put(adev, ring->fence_drv.irq_src,
569 ring->fence_drv.irq_type);568 ring->fence_drv.irq_type);
570 amd_sched_fini(&ring->sched);569 amd_sched_fini(&ring->sched);
570 del_timer_sync(&ring->fence_drv.fallback_timer);
571 ring->fence_drv.initialized = false;571 ring->fence_drv.initialized = false;
572 }572 }
573 mutex_unlock(&adev->ring_lock);573 mutex_unlock(&adev->ring_lock);
@@ -751,18 +751,25 @@ static bool amdgpu_fence_enable_signaling(struct fence *f) · 177 unmodified lines
751 fence->fence_wake.func = amdgpu_fence_check_signaled;751 fence->fence_wake.func = amdgpu_fence_check_signaled;
752 __add_wait_queue(&ring->fence_drv.fence_queue, &fence->fence_wake);752 __add_wait_queue(&ring->fence_drv.fence_queue, &fence->fence_wake);
753 fence_get(f);753 fence_get(f);
754 amdgpu_fence_schedule_check(ring);754 if (!timer_pending(&ring->fence_drv.fallback_timer))
755 amdgpu_fence_schedule_fallback(ring);
755 FENCE_TRACE(&fence->base, "armed on ring %i!\n", ring->idx);756 FENCE_TRACE(&fence->base, "armed on ring %i!\n", ring->idx);
756 return true;757 return true;
757}758}
758 759
760static 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
759const struct fence_ops amdgpu_fence_ops = {766const struct fence_ops amdgpu_fence_ops = {
760 .get_driver_name = amdgpu_fence_get_driver_name,767 .get_driver_name = amdgpu_fence_get_driver_name,
761 .get_timeline_name = amdgpu_fence_get_timeline_name,768 .get_timeline_name = amdgpu_fence_get_timeline_name,
762 .enable_signaling = amdgpu_fence_enable_signaling,769 .enable_signaling = amdgpu_fence_enable_signaling,
763 .signaled = amdgpu_fence_is_signaled,770 .signaled = amdgpu_fence_is_signaled,
764 .wait = fence_default_wait,771 .wait = fence_default_wait,
765 .release = NULL,772 .release = amdgpu_fence_release,
766};773};
767 774
768/*775/*
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
115 struct amdgpu_vm *vm = &fpriv->vm;115 struct amdgpu_vm *vm = &fpriv->vm;
116 struct amdgpu_bo_va *bo_va;116 struct amdgpu_bo_va *bo_va;
117 int r;117 int r;
118 mutex_lock(&vm->mutex);
119 r = amdgpu_bo_reserve(rbo, false);118 r = amdgpu_bo_reserve(rbo, false);
120 if (r) {119 if (r)
121 mutex_unlock(&vm->mutex);
122 return r;120 return r;
123 }
124 121
125 bo_va = amdgpu_vm_bo_find(vm, rbo);122 bo_va = amdgpu_vm_bo_find(vm, rbo);
126 if (!bo_va) {123 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
129 ++bo_va->ref_count;126 ++bo_va->ref_count;
130 }127 }
131 amdgpu_bo_unreserve(rbo);128 amdgpu_bo_unreserve(rbo);
132 mutex_unlock(&vm->mutex);
133 return 0;129 return 0;
134}130}
135 131
@@ -142,10 +138,8 @@ void amdgpu_gem_object_close(struct drm_gem_object *obj, · 6 unmodified lines
142 struct amdgpu_vm *vm = &fpriv->vm;138 struct amdgpu_vm *vm = &fpriv->vm;
143 struct amdgpu_bo_va *bo_va;139 struct amdgpu_bo_va *bo_va;
144 int r;140 int r;
145 mutex_lock(&vm->mutex);
146 r = amdgpu_bo_reserve(rbo, true);141 r = amdgpu_bo_reserve(rbo, true);
147 if (r) {142 if (r) {
148 mutex_unlock(&vm->mutex);
149 dev_err(adev->dev, "leaking bo va because "143 dev_err(adev->dev, "leaking bo va because "
150 "we fail to reserve bo (%d)\n", r);144 "we fail to reserve bo (%d)\n", r);
151 return;145 return;
@@ -157,7 +151,6 @@ void amdgpu_gem_object_close(struct drm_gem_object *obj, · 5 unmodified lines
157 }151 }
158 }152 }
159 amdgpu_bo_unreserve(rbo);153 amdgpu_bo_unreserve(rbo);
160 mutex_unlock(&vm->mutex);
161}154}
162 155
163static int amdgpu_gem_handle_lockup(struct amdgpu_device *adev, int r)156static 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
242 AMDGPU_GEM_USERPTR_REGISTER))235 AMDGPU_GEM_USERPTR_REGISTER))
243 return -EINVAL;236 return -EINVAL;
244 237
245 if (!(args->flags & AMDGPU_GEM_USERPTR_ANONONLY) ||238 if (!(args->flags & AMDGPU_GEM_USERPTR_READONLY) && (
246 !(args->flags & AMDGPU_GEM_USERPTR_REGISTER)) {239 !(args->flags & AMDGPU_GEM_USERPTR_ANONONLY) ||
240 !(args->flags & AMDGPU_GEM_USERPTR_REGISTER))) {
247 241
248 /* if we want to write to it we must require anonymous242 /* if we want to write to it we must require anonymous
249 memory and install a MMU notifier */243 memory and install a MMU notifier */
@@ -483,6 +477,9 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev, · 233 unmodified lines
483 if (domain == AMDGPU_GEM_DOMAIN_CPU)477 if (domain == AMDGPU_GEM_DOMAIN_CPU)
484 goto error_unreserve;478 goto error_unreserve;
485 }479 }
480 r = amdgpu_vm_update_page_directory(adev, bo_va->vm);
481 if (r)
482 goto error_unreserve;
486 483
487 r = amdgpu_vm_clear_freed(adev, bo_va->vm);484 r = amdgpu_vm_clear_freed(adev, bo_va->vm);
488 if (r)485 if (r)
@@ -512,6 +509,9 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data, · 23 unmodified lines
512 struct amdgpu_fpriv *fpriv = filp->driver_priv;509 struct amdgpu_fpriv *fpriv = filp->driver_priv;
513 struct amdgpu_bo *rbo;510 struct amdgpu_bo *rbo;
514 struct amdgpu_bo_va *bo_va;511 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;
515 uint32_t invalid_flags, va_flags = 0;515 uint32_t invalid_flags, va_flags = 0;
516 int r = 0;516 int r = 0;
517 517
@@ -547,19 +547,28 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data, · 29 unmodified lines
547 gobj = drm_gem_object_lookup(dev, filp, args->handle);547 gobj = drm_gem_object_lookup(dev, filp, args->handle);
548 if (gobj == NULL)548 if (gobj == NULL)
549 return -ENOENT;549 return -ENOENT;
550 mutex_lock(&fpriv->vm.mutex);
551 rbo = gem_to_amdgpu_bo(gobj);550 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);
553 if (r) {563 if (r) {
554 mutex_unlock(&fpriv->vm.mutex);
555 drm_gem_object_unreference_unlocked(gobj);564 drm_gem_object_unreference_unlocked(gobj);
556 return r;565 return r;
557 }566 }
558 567
559 bo_va = amdgpu_vm_bo_find(&fpriv->vm, rbo);568 bo_va = amdgpu_vm_bo_find(&fpriv->vm, rbo);
560 if (!bo_va) {569 if (!bo_va) {
561 amdgpu_bo_unreserve(rbo);570 ttm_eu_backoff_reservation(&ticket, &list);
562 mutex_unlock(&fpriv->vm.mutex);571 drm_gem_object_unreference_unlocked(gobj);
563 return -ENOENT;572 return -ENOENT;
564 }573 }
565 574
@@ -581,10 +590,10 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data, · 15 unmodified lines
581 default:590 default:
582 break;591 break;
583 }592 }
584 593 ttm_eu_backoff_reservation(&ticket, &list);
585 if (!r && !(args->flags & AMDGPU_VM_DELAY_UPDATE))594 if (!r && !(args->flags & AMDGPU_VM_DELAY_UPDATE))
586 amdgpu_gem_va_update_vm(adev, bo_va, args->operation);595 amdgpu_gem_va_update_vm(adev, bo_va, args->operation);
587 mutex_unlock(&fpriv->vm.mutex);596
588 drm_gem_object_unreference_unlocked(gobj);597 drm_gem_object_unreference_unlocked(gobj);
589 return r;598 return r;
590}599}
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
62 int r;62 int r;
63 63
64 if (size) {64 if (size) {
65 r = amdgpu_sa_bo_new(adev, &adev->ring_tmp_bo,65 r = amdgpu_sa_bo_new(&adev->ring_tmp_bo,
66 &ib->sa_bo, size, 256);66 &ib->sa_bo, size, 256);
67 if (r) {67 if (r) {
68 dev_err(adev->dev, "failed to get a new IB (%d)\n", r);68 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
216 }216 }
217 217
218 if (ib->vm)218 if (ib->vm)
219 amdgpu_vm_fence(adev, ib->vm, ib->fence);219 amdgpu_vm_fence(adev, ib->vm, &ib->fence->base);
220 220
221 amdgpu_ring_unlock_commit(ring);221 amdgpu_ring_unlock_commit(ring);
222 return 0;222 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
611u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)611u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
612{612{
613 struct amdgpu_device *adev = dev->dev_private;613 struct amdgpu_device *adev = dev->dev_private;
614 int vpos, hpos, stat;
615 u32 count;
614 616
615 if (pipe >= adev->mode_info.num_crtc) {617 if (pipe >= adev->mode_info.num_crtc) {
616 DRM_ERROR("Invalid crtc %u\n", pipe);618 DRM_ERROR("Invalid crtc %u\n", pipe);
617 return -EINVAL;619 return -EINVAL;
618 }620 }
619 621
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;
621}667}
622 668
623/**669/**
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h+5−0
@@ -407,6 +407,7 @@ struct amdgpu_crtc { · 406 unmodified lines
407 u32 line_time;407 u32 line_time;
408 u32 wm_low;408 u32 wm_low;
409 u32 wm_high;409 u32 wm_high;
410 u32 lb_vblank_lead_lines;
410 struct drm_display_mode hw_mode;411 struct drm_display_mode hw_mode;
411};412};
412 413
@@ -528,6 +529,10 @@ struct amdgpu_framebuffer { · 115 unmodified lines
528#define ENCODER_MODE_IS_DP(em) (((em) == ATOM_ENCODER_MODE_DP) || \529#define ENCODER_MODE_IS_DP(em) (((em) == ATOM_ENCODER_MODE_DP) || \
529 ((em) == ATOM_ENCODER_MODE_DP_MST))530 ((em) == ATOM_ENCODER_MODE_DP_MST))
530 531
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
531void amdgpu_link_encoder_connector(struct drm_device *dev);536void amdgpu_link_encoder_connector(struct drm_device *dev);
532 537
533struct drm_connector *538struct 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
100 list_del_init(&bo->list);100 list_del_init(&bo->list);
101 mutex_unlock(&bo->adev->gem.mutex);101 mutex_unlock(&bo->adev->gem.mutex);
102 drm_gem_object_release(&bo->gem_base);102 drm_gem_object_release(&bo->gem_base);
103 amdgpu_bo_unref(&bo->parent);
103 kfree(bo->metadata);104 kfree(bo->metadata);
104 kfree(bo);105 kfree(bo);
105}106}
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
189 struct amdgpu_sa_manager *sa_manager);189 struct amdgpu_sa_manager *sa_manager);
190int amdgpu_sa_bo_manager_suspend(struct amdgpu_device *adev,190int amdgpu_sa_bo_manager_suspend(struct amdgpu_device *adev,
191 struct amdgpu_sa_manager *sa_manager);191 struct amdgpu_sa_manager *sa_manager);
192int amdgpu_sa_bo_new(struct amdgpu_device *adev,192int amdgpu_sa_bo_new(struct amdgpu_sa_manager *sa_manager,
193 struct amdgpu_sa_manager *sa_manager,193 struct amdgpu_sa_bo **sa_bo,
194 struct amdgpu_sa_bo **sa_bo,194 unsigned size, unsigned align);
195 unsigned size, unsigned align);
196void amdgpu_sa_bo_free(struct amdgpu_device *adev,195void amdgpu_sa_bo_free(struct amdgpu_device *adev,
197 struct amdgpu_sa_bo **sa_bo,196 struct amdgpu_sa_bo **sa_bo,
198 struct fence *fence);197 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
311 return false;311 return false;
312}312}
313 313
314int amdgpu_sa_bo_new(struct amdgpu_device *adev,314int amdgpu_sa_bo_new(struct amdgpu_sa_manager *sa_manager,
315 struct amdgpu_sa_manager *sa_manager,
316 struct amdgpu_sa_bo **sa_bo,315 struct amdgpu_sa_bo **sa_bo,
317 unsigned size, unsigned align)316 unsigned size, unsigned align)
318{317{
drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c+12−18
@@ -26,6 +26,7 @@ · 25 unmodified lines
26#include <linux/sched.h>26#include <linux/sched.h>
27#include <drm/drmP.h>27#include <drm/drmP.h>
28#include "amdgpu.h"28#include "amdgpu.h"
29#include "amdgpu_trace.h"
29 30
30static struct fence *amdgpu_sched_dependency(struct amd_sched_job *sched_job)31static struct fence *amdgpu_sched_dependency(struct amd_sched_job *sched_job)
31{32{
@@ -44,11 +45,8 @@ static struct fence *amdgpu_sched_run_job(struct amd_sched_job *sched_job) · 12 unmodified lines
44 return NULL;45 return NULL;
45 }46 }
46 job = to_amdgpu_job(sched_job);47 job = to_amdgpu_job(sched_job);
47 mutex_lock(&job->job_lock);48 trace_amdgpu_sched_run_job(job);
48 r = amdgpu_ib_schedule(job->adev,49 r = amdgpu_ib_schedule(job->adev, job->num_ibs, job->ibs, job->owner);
49 job->num_ibs,
50 job->ibs,
51 job->base.owner);
52 if (r) {50 if (r) {
53 DRM_ERROR("Error scheduling IBs (%d)\n", r);51 DRM_ERROR("Error scheduling IBs (%d)\n", r);
54 goto err;52 goto err;
@@ -61,8 +59,6 @@ err: · 6 unmodified lines
61 if (job->free_job)59 if (job->free_job)
62 job->free_job(job);60 job->free_job(job);
63 61
64 mutex_unlock(&job->job_lock);
65 fence_put(&job->base.s_fence->base);
66 kfree(job);62 kfree(job);
67 return fence ? &fence->base : NULL;63 return fence ? &fence->base : NULL;
68}64}
@@ -88,21 +84,19 @@ int amdgpu_sched_ib_submit_kernel_helper(struct amdgpu_device *adev, · 19 unmodified lines
88 return -ENOMEM;84 return -ENOMEM;
89 job->base.sched = &ring->sched;85 job->base.sched = &ring->sched;
90 job->base.s_entity = &adev->kernel_ctx.rings[ring->idx].entity;86 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
91 job->adev = adev;94 job->adev = adev;
92 job->ibs = ibs;95 job->ibs = ibs;
93 job->num_ibs = num_ibs;96 job->num_ibs = num_ibs;
94 job->base.owner = owner;97 job->owner = owner;
95 mutex_init(&job->job_lock);
96 job->free_job = free_job;98 job->free_job = free_job;
97 mutex_lock(&job->job_lock);99 amd_sched_entity_push_job(&job->base);
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);
106 } else {100 } else {
107 r = amdgpu_ib_schedule(adev, num_ibs, ibs, owner);101 r = amdgpu_ib_schedule(adev, num_ibs, ibs, owner);
108 if (r)102 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
40 if (*semaphore == NULL) {40 if (*semaphore == NULL) {
41 return -ENOMEM;41 return -ENOMEM;
42 }42 }
43 r = amdgpu_sa_bo_new(adev, &adev->ring_tmp_bo,43 r = amdgpu_sa_bo_new(&adev->ring_tmp_bo,
44 &(*semaphore)->sa_bo, 8, 8);44 &(*semaphore)->sa_bo, 8, 8);
45 if (r) {45 if (r) {
46 kfree(*semaphore);46 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
302 return -EINVAL;302 return -EINVAL;
303 }303 }
304 304
305 if (amdgpu_enable_scheduler || !amdgpu_enable_semaphores ||305 if (amdgpu_enable_scheduler || !amdgpu_enable_semaphores) {
306 (count >= AMDGPU_NUM_SYNCS)) {306 r = fence_wait(&fence->base, true);
307 if (r)
308 return r;
309 continue;
310 }
311
312 if (count >= AMDGPU_NUM_SYNCS) {
307 /* not enough room, wait manually */313 /* not enough room, wait manually */
308 r = fence_wait(&fence->base, false);314 r = fence_wait(&fence->base, false);
309 if (r)315 if (r)
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h+51−43
@@ -48,6 +48,57 @@ TRACE_EVENT(amdgpu_cs, · 47 unmodified lines
48 __entry->fences)48 __entry->fences)
49);49);
50 50
51TRACE_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
76TRACE_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
51TRACE_EVENT(amdgpu_vm_grab_id,102TRACE_EVENT(amdgpu_vm_grab_id,
52 TP_PROTO(unsigned vmid, int ring),103 TP_PROTO(unsigned vmid, int ring),
53 TP_ARGS(vmid, ring),104 TP_ARGS(vmid, ring),
@@ -196,49 +247,6 @@ TRACE_EVENT(amdgpu_bo_list_set, · 142 unmodified lines
196 TP_printk("list=%p, bo=%p", __entry->list, __entry->bo)247 TP_printk("list=%p, bo=%p", __entry->list, __entry->bo)
197);248);
198 249
199DECLARE_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
221DEFINE_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
228DEFINE_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
235DEFINE_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
242DECLARE_EVENT_CLASS(amdgpu_semaphore_request,250DECLARE_EVENT_CLASS(amdgpu_semaphore_request,
243 251
244 TP_PROTO(int ring, struct amdgpu_semaphore *sem),252 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
587 uint32_t flags = amdgpu_ttm_tt_pte_flags(gtt->adev, ttm, bo_mem);587 uint32_t flags = amdgpu_ttm_tt_pte_flags(gtt->adev, ttm, bo_mem);
588 int r;588 int r;
589 589
590 if (gtt->userptr)590 if (gtt->userptr) {
591 amdgpu_ttm_tt_pin_userptr(ttm);591 r = amdgpu_ttm_tt_pin_userptr(ttm);
592 592 if (r) {
593 DRM_ERROR("failed to pin userptr\n");
594 return r;
595 }
596 }
593 gtt->offset = (unsigned long)(bo_mem->start << PAGE_SHIFT);597 gtt->offset = (unsigned long)(bo_mem->start << PAGE_SHIFT);
594 if (!ttm->num_pages) {598 if (!ttm->num_pages) {
595 WARN(1, "nothing to bind %lu pages for mreg %p back %p!\n",599 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
797 if (mem && mem->mem_type != TTM_PL_SYSTEM)801 if (mem && mem->mem_type != TTM_PL_SYSTEM)
798 flags |= AMDGPU_PTE_VALID;802 flags |= AMDGPU_PTE_VALID;
799 803
800 if (mem && mem->mem_type == TTM_PL_TT)804 if (mem && mem->mem_type == TTM_PL_TT) {
801 flags |= AMDGPU_PTE_SYSTEM;805 flags |= AMDGPU_PTE_SYSTEM;
802 806
803 if (!ttm || ttm->caching_state == tt_cached)807 if (ttm->caching_state == tt_cached)
804 flags |= AMDGPU_PTE_SNOOPED;808 flags |= AMDGPU_PTE_SNOOPED;
809 }
805 810
806 if (adev->asic_type >= CHIP_TOPAZ)811 if (adev->asic_type >= CHIP_TOPAZ)
807 flags |= AMDGPU_PTE_EXECUTABLE;812 flags |= AMDGPU_PTE_EXECUTABLE;
@@ -1073,10 +1078,10 @@ static int amdgpu_mm_dump_table(struct seq_file *m, void *data) · 265 unmodified lines
1073 ret = drm_mm_dump_table(m, mm);1078 ret = drm_mm_dump_table(m, mm);
1074 spin_unlock(&glob->lru_lock);1079 spin_unlock(&glob->lru_lock);
1075 if (ttm_pl == TTM_PL_VRAM)1080 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",
1077 adev->mman.bdev.man[ttm_pl].size,1082 adev->mman.bdev.man[ttm_pl].size,
1078 atomic64_read(&adev->vram_usage) >> 20,1083 (u64)atomic64_read(&adev->vram_usage) >> 20,
1079 atomic64_read(&adev->vram_vis_usage) >> 20);1084 (u64)atomic64_read(&adev->vram_vis_usage) >> 20);
1080 return ret;1085 return ret;
1081}1086}
1082 1087
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
392 ib->ptr[ib->length_dw++] = 0x00000001; /* session cmd */392 ib->ptr[ib->length_dw++] = 0x00000001; /* session cmd */
393 ib->ptr[ib->length_dw++] = handle;393 ib->ptr[ib->length_dw++] = handle;
394 394
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 */
396 ib->ptr[ib->length_dw++] = 0x01000001; /* create cmd */399 ib->ptr[ib->length_dw++] = 0x01000001; /* create cmd */
397 ib->ptr[ib->length_dw++] = 0x00000000;400 ib->ptr[ib->length_dw++] = 0x00000000;
398 ib->ptr[ib->length_dw++] = 0x00000042;401 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
404 ib->ptr[ib->length_dw++] = 0x00000100;407 ib->ptr[ib->length_dw++] = 0x00000100;
405 ib->ptr[ib->length_dw++] = 0x0000000c;408 ib->ptr[ib->length_dw++] = 0x0000000c;
406 ib->ptr[ib->length_dw++] = 0x00000000;409 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 }
407 416
408 ib->ptr[ib->length_dw++] = 0x00000014; /* len */417 ib->ptr[ib->length_dw++] = 0x00000014; /* len */
409 ib->ptr[ib->length_dw++] = 0x05000005; /* feedback buffer */418 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
143 unsigned i;143 unsigned i;
144 144
145 /* check if the id is still valid */145 /* check if the id is still valid */
146 if (vm_id->id && vm_id->last_id_use &&146 if (vm_id->id) {
147 vm_id->last_id_use == adev->vm_manager.active[vm_id->id]) {147 unsigned id = vm_id->id;
148 trace_amdgpu_vm_grab_id(vm_id->id, ring->idx);148 long owner;
149 return 0;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 }
150 }155 }
151 156
152 /* we definately need to flush */157 /* 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
154 159
155 /* skip over VMID 0, since it is the system VM */160 /* skip over VMID 0, since it is the system VM */
156 for (i = 1; i < adev->vm_manager.nvm; ++i) {161 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;
158 struct amdgpu_ring *fring;163 struct amdgpu_ring *fring;
159 164
160 if (fence == NULL) {165 if (fence == NULL) {
@@ -176,7 +181,7 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, · 15 unmodified lines
176 if (choices[i]) {181 if (choices[i]) {
177 struct fence *fence;182 struct fence *fence;
178 183
179 fence = adev->vm_manager.active[choices[i]];184 fence = adev->vm_manager.ids[choices[i]].active;
180 vm_id->id = choices[i];185 vm_id->id = choices[i];
181 186
182 trace_amdgpu_vm_grab_id(choices[i], ring->idx);187 trace_amdgpu_vm_grab_id(choices[i], ring->idx);
@@ -207,24 +212,21 @@ void amdgpu_vm_flush(struct amdgpu_ring *ring, · 24 unmodified lines
207 uint64_t pd_addr = amdgpu_bo_gpu_offset(vm->page_directory);212 uint64_t pd_addr = amdgpu_bo_gpu_offset(vm->page_directory);
208 struct amdgpu_vm_id *vm_id = &vm->ids[ring->idx];213 struct amdgpu_vm_id *vm_id = &vm->ids[ring->idx];
209 struct fence *flushed_updates = vm_id->flushed_updates;214 struct fence *flushed_updates = vm_id->flushed_updates;
210 bool is_earlier = false;215 bool is_later;
211 216
212 if (flushed_updates && updates) {217 if (!flushed_updates)
213 BUG_ON(flushed_updates->context != updates->context);218 is_later = true;
214 is_earlier = (updates->seqno - flushed_updates->seqno <=219 else if (!updates)
215 INT_MAX) ? true : false;220 is_later = false;
216 }221 else
217 222 is_later = fence_is_later(updates, flushed_updates);
218 if (pd_addr != vm_id->pd_gpu_addr || !flushed_updates ||
219 is_earlier) {
220 223
224 if (pd_addr != vm_id->pd_gpu_addr || is_later) {
221 trace_amdgpu_vm_flush(pd_addr, ring->idx, vm_id->id);225 trace_amdgpu_vm_flush(pd_addr, ring->idx, vm_id->id);
222 if (is_earlier) {226 if (is_later) {
223 vm_id->flushed_updates = fence_get(updates);227 vm_id->flushed_updates = fence_get(updates);
224 fence_put(flushed_updates);228 fence_put(flushed_updates);
225 }229 }
226 if (!flushed_updates)
227 vm_id->flushed_updates = fence_get(updates);
228 vm_id->pd_gpu_addr = pd_addr;230 vm_id->pd_gpu_addr = pd_addr;
229 amdgpu_ring_emit_vm_flush(ring, vm_id->id, vm_id->pd_gpu_addr);231 amdgpu_ring_emit_vm_flush(ring, vm_id->id, vm_id->pd_gpu_addr);
230 }232 }
@@ -244,16 +246,14 @@ void amdgpu_vm_flush(struct amdgpu_ring *ring, · 13 unmodified lines
244 */246 */
245void amdgpu_vm_fence(struct amdgpu_device *adev,247void amdgpu_vm_fence(struct amdgpu_device *adev,
246 struct amdgpu_vm *vm,248 struct amdgpu_vm *vm,
247 struct amdgpu_fence *fence)249 struct fence *fence)
248{250{
249 unsigned ridx = fence->ring->idx;251 struct amdgpu_ring *ring = amdgpu_ring_from_fence(fence);
250 unsigned vm_id = vm->ids[ridx].id;252 unsigned vm_id = vm->ids[ring->idx].id;
251
252 fence_put(adev->vm_manager.active[vm_id]);
253 adev->vm_manager.active[vm_id] = fence_get(&fence->base);
254 253
255 fence_put(vm->ids[ridx].last_id_use);254 fence_put(adev->vm_manager.ids[vm_id].active);
256 vm->ids[ridx].last_id_use = fence_get(&fence->base);255 adev->vm_manager.ids[vm_id].active = fence_get(fence);
256 atomic_long_set(&adev->vm_manager.ids[vm_id].owner, (long)vm);
257}257}
258 258
259/**259/**
@@ -332,6 +332,8 @@ int amdgpu_vm_free_job(struct amdgpu_job *job) · 72 unmodified lines
332 *332 *
333 * @adev: amdgpu_device pointer333 * @adev: amdgpu_device pointer
334 * @bo: bo to clear334 * @bo: bo to clear
335 *
336 * need to reserve bo first before calling it.
335 */337 */
336static int amdgpu_vm_clear_bo(struct amdgpu_device *adev,338static int amdgpu_vm_clear_bo(struct amdgpu_device *adev,
337 struct amdgpu_bo *bo)339 struct amdgpu_bo *bo)
@@ -343,24 +345,20 @@ static int amdgpu_vm_clear_bo(struct amdgpu_device *adev, · 5 unmodified lines
343 uint64_t addr;345 uint64_t addr;
344 int r;346 int r;
345 347
346 r = amdgpu_bo_reserve(bo, false);
347 if (r)
348 return r;
349
350 r = reservation_object_reserve_shared(bo->tbo.resv);348 r = reservation_object_reserve_shared(bo->tbo.resv);
351 if (r)349 if (r)
352 return r;350 return r;
353 351
354 r = ttm_bo_validate(&bo->tbo, &bo->placement, true, false);352 r = ttm_bo_validate(&bo->tbo, &bo->placement, true, false);
355 if (r)353 if (r)
356 goto error_unreserve;354 goto error;
357 355
358 addr = amdgpu_bo_gpu_offset(bo);356 addr = amdgpu_bo_gpu_offset(bo);
359 entries = amdgpu_bo_size(bo) / 8;357 entries = amdgpu_bo_size(bo) / 8;
360 358
361 ib = kzalloc(sizeof(struct amdgpu_ib), GFP_KERNEL);359 ib = kzalloc(sizeof(struct amdgpu_ib), GFP_KERNEL);
362 if (!ib)360 if (!ib)
363 goto error_unreserve;361 goto error;
364 362
365 r = amdgpu_ib_get(ring, NULL, entries * 2 + 64, ib);363 r = amdgpu_ib_get(ring, NULL, entries * 2 + 64, ib);
366 if (r)364 if (r)
@@ -378,16 +376,14 @@ static int amdgpu_vm_clear_bo(struct amdgpu_device *adev, · 11 unmodified lines
378 if (!r)376 if (!r)
379 amdgpu_bo_fence(bo, fence, true);377 amdgpu_bo_fence(bo, fence, true);
380 fence_put(fence);378 fence_put(fence);
381 if (amdgpu_enable_scheduler) {379 if (amdgpu_enable_scheduler)
382 amdgpu_bo_unreserve(bo);
383 return 0;380 return 0;
384 }381
385error_free:382error_free:
386 amdgpu_ib_free(adev, ib);383 amdgpu_ib_free(adev, ib);
387 kfree(ib);384 kfree(ib);
388 385
389error_unreserve:386error:
390 amdgpu_bo_unreserve(bo);
391 return r;387 return r;
392}388}
393 389
@@ -889,17 +885,21 @@ int amdgpu_vm_clear_freed(struct amdgpu_device *adev, · 495 unmodified lines
889 struct amdgpu_bo_va_mapping *mapping;885 struct amdgpu_bo_va_mapping *mapping;
890 int r;886 int r;
891 887
888 spin_lock(&vm->freed_lock);
892 while (!list_empty(&vm->freed)) {889 while (!list_empty(&vm->freed)) {
893 mapping = list_first_entry(&vm->freed,890 mapping = list_first_entry(&vm->freed,
894 struct amdgpu_bo_va_mapping, list);891 struct amdgpu_bo_va_mapping, list);
895 list_del(&mapping->list);892 list_del(&mapping->list);
896 893 spin_unlock(&vm->freed_lock);
897 r = amdgpu_vm_bo_update_mapping(adev, vm, mapping, 0, 0, NULL);894 r = amdgpu_vm_bo_update_mapping(adev, vm, mapping, 0, 0, NULL);
898 kfree(mapping);895 kfree(mapping);
899 if (r)896 if (r)
900 return r;897 return r;
901 898
899 spin_lock(&vm->freed_lock);
902 }900 }
901 spin_unlock(&vm->freed_lock);
902
903 return 0;903 return 0;
904 904
905}905}
@@ -926,8 +926,9 @@ int amdgpu_vm_clear_invalids(struct amdgpu_device *adev, · 20 unmodified lines
926 bo_va = list_first_entry(&vm->invalidated,926 bo_va = list_first_entry(&vm->invalidated,
927 struct amdgpu_bo_va, vm_status);927 struct amdgpu_bo_va, vm_status);
928 spin_unlock(&vm->status_lock);928 spin_unlock(&vm->status_lock);
929 929 mutex_lock(&bo_va->mutex);
930 r = amdgpu_vm_bo_update(adev, bo_va, NULL);930 r = amdgpu_vm_bo_update(adev, bo_va, NULL);
931 mutex_unlock(&bo_va->mutex);
931 if (r)932 if (r)
932 return r;933 return r;
933 934
@@ -971,7 +972,7 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev, · 37 unmodified lines
971 INIT_LIST_HEAD(&bo_va->valids);972 INIT_LIST_HEAD(&bo_va->valids);
972 INIT_LIST_HEAD(&bo_va->invalids);973 INIT_LIST_HEAD(&bo_va->invalids);
973 INIT_LIST_HEAD(&bo_va->vm_status);974 INIT_LIST_HEAD(&bo_va->vm_status);
974 975 mutex_init(&bo_va->mutex);
975 list_add_tail(&bo_va->bo_list, &bo->va);976 list_add_tail(&bo_va->bo_list, &bo->va);
976 977
977 return bo_va;978 return bo_va;
@@ -989,7 +990,7 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev, · 11 unmodified lines
989 * Add a mapping of the BO at the specefied addr into the VM.990 * Add a mapping of the BO at the specefied addr into the VM.
990 * Returns 0 for success, error for failure.991 * Returns 0 for success, error for failure.
991 *992 *
992 * Object has to be reserved and gets unreserved by this function!993 * Object has to be reserved and unreserved outside!
993 */994 */
994int amdgpu_vm_bo_map(struct amdgpu_device *adev,995int amdgpu_vm_bo_map(struct amdgpu_device *adev,
995 struct amdgpu_bo_va *bo_va,996 struct amdgpu_bo_va *bo_va,
@@ -1005,30 +1006,27 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev, · 9 unmodified lines
1005 1006
1006 /* validate the parameters */1007 /* validate the parameters */
1007 if (saddr & AMDGPU_GPU_PAGE_MASK || offset & AMDGPU_GPU_PAGE_MASK ||1008 if (saddr & AMDGPU_GPU_PAGE_MASK || offset & AMDGPU_GPU_PAGE_MASK ||
1008 size == 0 || size & AMDGPU_GPU_PAGE_MASK) {1009 size == 0 || size & AMDGPU_GPU_PAGE_MASK)
1009 amdgpu_bo_unreserve(bo_va->bo);
1010 return -EINVAL;1010 return -EINVAL;
1011 }
1012 1011
1013 /* make sure object fit at this offset */1012 /* make sure object fit at this offset */
1014 eaddr = saddr + size;1013 eaddr = saddr + size;
1015 if ((saddr >= eaddr) || (offset + size > amdgpu_bo_size(bo_va->bo))) {1014 if ((saddr >= eaddr) || (offset + size > amdgpu_bo_size(bo_va->bo)))
1016 amdgpu_bo_unreserve(bo_va->bo);
1017 return -EINVAL;1015 return -EINVAL;
1018 }
1019 1016
1020 last_pfn = eaddr / AMDGPU_GPU_PAGE_SIZE;1017 last_pfn = eaddr / AMDGPU_GPU_PAGE_SIZE;
1021 if (last_pfn > adev->vm_manager.max_pfn) {1018 if (last_pfn > adev->vm_manager.max_pfn) {
1022 dev_err(adev->dev, "va above limit (0x%08X > 0x%08X)\n",1019 dev_err(adev->dev, "va above limit (0x%08X > 0x%08X)\n",
1023 last_pfn, adev->vm_manager.max_pfn);1020 last_pfn, adev->vm_manager.max_pfn);
1024 amdgpu_bo_unreserve(bo_va->bo);
1025 return -EINVAL;1021 return -EINVAL;
1026 }1022 }
1027 1023
1028 saddr /= AMDGPU_GPU_PAGE_SIZE;1024 saddr /= AMDGPU_GPU_PAGE_SIZE;
1029 eaddr /= AMDGPU_GPU_PAGE_SIZE;1025 eaddr /= AMDGPU_GPU_PAGE_SIZE;
1030 1026
1027 spin_lock(&vm->it_lock);
1031 it = interval_tree_iter_first(&vm->va, saddr, eaddr - 1);1028 it = interval_tree_iter_first(&vm->va, saddr, eaddr - 1);
1029 spin_unlock(&vm->it_lock);
1032 if (it) {1030 if (it) {
1033 struct amdgpu_bo_va_mapping *tmp;1031 struct amdgpu_bo_va_mapping *tmp;
1034 tmp = container_of(it, struct amdgpu_bo_va_mapping, it);1032 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
1036 dev_err(adev->dev, "bo %p va 0x%010Lx-0x%010Lx conflict with "1034 dev_err(adev->dev, "bo %p va 0x%010Lx-0x%010Lx conflict with "
1037 "0x%010lx-0x%010lx\n", bo_va->bo, saddr, eaddr,1035 "0x%010lx-0x%010lx\n", bo_va->bo, saddr, eaddr,
1038 tmp->it.start, tmp->it.last + 1);1036 tmp->it.start, tmp->it.last + 1);
1039 amdgpu_bo_unreserve(bo_va->bo);
1040 r = -EINVAL;1037 r = -EINVAL;
1041 goto error;1038 goto error;
1042 }1039 }
1043 1040
1044 mapping = kmalloc(sizeof(*mapping), GFP_KERNEL);1041 mapping = kmalloc(sizeof(*mapping), GFP_KERNEL);
1045 if (!mapping) {1042 if (!mapping) {
1046 amdgpu_bo_unreserve(bo_va->bo);
1047 r = -ENOMEM;1043 r = -ENOMEM;
1048 goto error;1044 goto error;
1049 }1045 }
@@ -1054,8 +1050,12 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev, · 4 unmodified lines
1054 mapping->offset = offset;1050 mapping->offset = offset;
1055 mapping->flags = flags;1051 mapping->flags = flags;
1056 1052
1053 mutex_lock(&bo_va->mutex);
1057 list_add(&mapping->list, &bo_va->invalids);1054 list_add(&mapping->list, &bo_va->invalids);
1055 mutex_unlock(&bo_va->mutex);
1056 spin_lock(&vm->it_lock);
1058 interval_tree_insert(&mapping->it, &vm->va);1057 interval_tree_insert(&mapping->it, &vm->va);
1058 spin_unlock(&vm->it_lock);
1059 trace_amdgpu_vm_bo_map(bo_va, mapping);1059 trace_amdgpu_vm_bo_map(bo_va, mapping);
1060 1060
1061 /* Make sure the page tables are allocated */1061 /* Make sure the page tables are allocated */
@@ -1067,8 +1067,6 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev, · 5 unmodified lines
1067 if (eaddr > vm->max_pde_used)1067 if (eaddr > vm->max_pde_used)
1068 vm->max_pde_used = eaddr;1068 vm->max_pde_used = eaddr;
1069 1069
1070 amdgpu_bo_unreserve(bo_va->bo);
1071
1072 /* walk over the address space and allocate the page tables */1070 /* walk over the address space and allocate the page tables */
1073 for (pt_idx = saddr; pt_idx <= eaddr; ++pt_idx) {1071 for (pt_idx = saddr; pt_idx <= eaddr; ++pt_idx) {
1074 struct reservation_object *resv = vm->page_directory->tbo.resv;1072 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
1077 if (vm->page_tables[pt_idx].bo)1075 if (vm->page_tables[pt_idx].bo)
1078 continue;1076 continue;
1079 1077
1080 ww_mutex_lock(&resv->lock, NULL);
1081 r = amdgpu_bo_create(adev, AMDGPU_VM_PTE_COUNT * 8,1078 r = amdgpu_bo_create(adev, AMDGPU_VM_PTE_COUNT * 8,
1082 AMDGPU_GPU_PAGE_SIZE, true,1079 AMDGPU_GPU_PAGE_SIZE, true,
1083 AMDGPU_GEM_DOMAIN_VRAM,1080 AMDGPU_GEM_DOMAIN_VRAM,
1084 AMDGPU_GEM_CREATE_NO_CPU_ACCESS,1081 AMDGPU_GEM_CREATE_NO_CPU_ACCESS,
1085 NULL, resv, &pt);1082 NULL, resv, &pt);
1086 ww_mutex_unlock(&resv->lock);
1087 if (r)1083 if (r)
1088 goto error_free;1084 goto error_free;
1089 1085
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
1090 r = amdgpu_vm_clear_bo(adev, pt);1091 r = amdgpu_vm_clear_bo(adev, pt);
1091 if (r) {1092 if (r) {
1092 amdgpu_bo_unref(&pt);1093 amdgpu_bo_unref(&pt);
@@ -1101,7 +1102,9 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev, · 8 unmodified lines
1101 1102
1102error_free:1103error_free:
1103 list_del(&mapping->list);1104 list_del(&mapping->list);
1105 spin_lock(&vm->it_lock);
1104 interval_tree_remove(&mapping->it, &vm->va);1106 interval_tree_remove(&mapping->it, &vm->va);
1107 spin_unlock(&vm->it_lock);
1105 trace_amdgpu_vm_bo_unmap(bo_va, mapping);1108 trace_amdgpu_vm_bo_unmap(bo_va, mapping);
1106 kfree(mapping);1109 kfree(mapping);
1107 1110
@@ -1119,7 +1122,7 @@ error: · 11 unmodified lines
1119 * Remove a mapping of the BO at the specefied addr from the VM.1122 * Remove a mapping of the BO at the specefied addr from the VM.
1120 * Returns 0 for success, error for failure.1123 * Returns 0 for success, error for failure.
1121 *1124 *
1122 * Object has to be reserved and gets unreserved by this function!1125 * Object has to be reserved and unreserved outside!
1123 */1126 */
1124int amdgpu_vm_bo_unmap(struct amdgpu_device *adev,1127int amdgpu_vm_bo_unmap(struct amdgpu_device *adev,
1125 struct amdgpu_bo_va *bo_va,1128 struct amdgpu_bo_va *bo_va,
@@ -1130,7 +1133,7 @@ int amdgpu_vm_bo_unmap(struct amdgpu_device *adev, · 4 unmodified lines
1130 bool valid = true;1133 bool valid = true;
1131 1134
1132 saddr /= AMDGPU_GPU_PAGE_SIZE;1135 saddr /= AMDGPU_GPU_PAGE_SIZE;
1133 1136 mutex_lock(&bo_va->mutex);
1134 list_for_each_entry(mapping, &bo_va->valids, list) {1137 list_for_each_entry(mapping, &bo_va->valids, list) {
1135 if (mapping->it.start == saddr)1138 if (mapping->it.start == saddr)
1136 break;1139 break;
@@ -1145,20 +1148,24 @@ int amdgpu_vm_bo_unmap(struct amdgpu_device *adev, · 8 unmodified lines
1145 }1148 }
1146 1149
1147 if (&mapping->list == &bo_va->invalids) {1150 if (&mapping->list == &bo_va->invalids) {
1148 amdgpu_bo_unreserve(bo_va->bo);1151 mutex_unlock(&bo_va->mutex);
1149 return -ENOENT;1152 return -ENOENT;
1150 }1153 }
1151 }1154 }
1152 1155 mutex_unlock(&bo_va->mutex);
1153 list_del(&mapping->list);1156 list_del(&mapping->list);
1157 spin_lock(&vm->it_lock);
1154 interval_tree_remove(&mapping->it, &vm->va);1158 interval_tree_remove(&mapping->it, &vm->va);
1159 spin_unlock(&vm->it_lock);
1155 trace_amdgpu_vm_bo_unmap(bo_va, mapping);1160 trace_amdgpu_vm_bo_unmap(bo_va, mapping);
1156 1161
1157 if (valid)1162 if (valid) {
1163 spin_lock(&vm->freed_lock);
1158 list_add(&mapping->list, &vm->freed);1164 list_add(&mapping->list, &vm->freed);
1159 else1165 spin_unlock(&vm->freed_lock);
1166 } else {
1160 kfree(mapping);1167 kfree(mapping);
1161 amdgpu_bo_unreserve(bo_va->bo);1168 }
1162 1169
1163 return 0;1170 return 0;
1164}1171}
@@ -1187,17 +1194,23 @@ void amdgpu_vm_bo_rmv(struct amdgpu_device *adev, · 22 unmodified lines
1187 1194
1188 list_for_each_entry_safe(mapping, next, &bo_va->valids, list) {1195 list_for_each_entry_safe(mapping, next, &bo_va->valids, list) {
1189 list_del(&mapping->list);1196 list_del(&mapping->list);
1197 spin_lock(&vm->it_lock);
1190 interval_tree_remove(&mapping->it, &vm->va);1198 interval_tree_remove(&mapping->it, &vm->va);
1199 spin_unlock(&vm->it_lock);
1191 trace_amdgpu_vm_bo_unmap(bo_va, mapping);1200 trace_amdgpu_vm_bo_unmap(bo_va, mapping);
1201 spin_lock(&vm->freed_lock);
1192 list_add(&mapping->list, &vm->freed);1202 list_add(&mapping->list, &vm->freed);
1203 spin_unlock(&vm->freed_lock);
1193 }1204 }
1194 list_for_each_entry_safe(mapping, next, &bo_va->invalids, list) {1205 list_for_each_entry_safe(mapping, next, &bo_va->invalids, list) {
1195 list_del(&mapping->list);1206 list_del(&mapping->list);
1207 spin_lock(&vm->it_lock);
1196 interval_tree_remove(&mapping->it, &vm->va);1208 interval_tree_remove(&mapping->it, &vm->va);
1209 spin_unlock(&vm->it_lock);
1197 kfree(mapping);1210 kfree(mapping);
1198 }1211 }
1199
1200 fence_put(bo_va->last_pt_update);1212 fence_put(bo_va->last_pt_update);
1213 mutex_destroy(&bo_va->mutex);
1201 kfree(bo_va);1214 kfree(bo_va);
1202}1215}
1203 1216
@@ -1241,15 +1254,14 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) · 37 unmodified lines
1241 for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {1254 for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
1242 vm->ids[i].id = 0;1255 vm->ids[i].id = 0;
1243 vm->ids[i].flushed_updates = NULL;1256 vm->ids[i].flushed_updates = NULL;
1244 vm->ids[i].last_id_use = NULL;
1245 }1257 }
1246 mutex_init(&vm->mutex);
1247 vm->va = RB_ROOT;1258 vm->va = RB_ROOT;
1248 spin_lock_init(&vm->status_lock);1259 spin_lock_init(&vm->status_lock);
1249 INIT_LIST_HEAD(&vm->invalidated);1260 INIT_LIST_HEAD(&vm->invalidated);
1250 INIT_LIST_HEAD(&vm->cleared);1261 INIT_LIST_HEAD(&vm->cleared);
1251 INIT_LIST_HEAD(&vm->freed);1262 INIT_LIST_HEAD(&vm->freed);
1252 1263 spin_lock_init(&vm->it_lock);
1264 spin_lock_init(&vm->freed_lock);
1253 pd_size = amdgpu_vm_directory_size(adev);1265 pd_size = amdgpu_vm_directory_size(adev);
1254 pd_entries = amdgpu_vm_num_pdes(adev);1266 pd_entries = amdgpu_vm_num_pdes(adev);
1255 1267
@@ -1269,8 +1281,14 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) · 13 unmodified lines
1269 NULL, NULL, &vm->page_directory);1281 NULL, NULL, &vm->page_directory);
1270 if (r)1282 if (r)
1271 return r;1283 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 }
1273 r = amdgpu_vm_clear_bo(adev, vm->page_directory);1290 r = amdgpu_vm_clear_bo(adev, vm->page_directory);
1291 amdgpu_bo_unreserve(vm->page_directory);
1274 if (r) {1292 if (r) {
1275 amdgpu_bo_unref(&vm->page_directory);1293 amdgpu_bo_unref(&vm->page_directory);
1276 vm->page_directory = NULL;1294 vm->page_directory = NULL;
@@ -1313,11 +1331,27 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) · 36 unmodified lines
1313 1331
1314 amdgpu_bo_unref(&vm->page_directory);1332 amdgpu_bo_unref(&vm->page_directory);
1315 fence_put(vm->page_directory_fence);1333 fence_put(vm->page_directory_fence);
1316
1317 for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {1334 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);
1318 fence_put(vm->ids[i].flushed_updates);1339 fence_put(vm->ids[i].flushed_updates);
1319 fence_put(vm->ids[i].last_id_use);
1320 }1340 }
1321 1341
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 */
1351void 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);
1323}1357}
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
6569 switch (state) {6569 switch (state) {
6570 case AMDGPU_IRQ_STATE_DISABLE:6570 case AMDGPU_IRQ_STATE_DISABLE:
6571 cg_thermal_int = RREG32_SMC(ixCG_THERMAL_INT);6571 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;
6573 WREG32_SMC(ixCG_THERMAL_INT, cg_thermal_int);6573 WREG32_SMC(ixCG_THERMAL_INT, cg_thermal_int);
6574 break;6574 break;
6575 case AMDGPU_IRQ_STATE_ENABLE:6575 case AMDGPU_IRQ_STATE_ENABLE:
6576 cg_thermal_int = RREG32_SMC(ixCG_THERMAL_INT);6576 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;
6578 WREG32_SMC(ixCG_THERMAL_INT, cg_thermal_int);6578 WREG32_SMC(ixCG_THERMAL_INT, cg_thermal_int);
6579 break;6579 break;
6580 default:6580 default:
@@ -6586,12 +6586,12 @@ static int ci_dpm_set_interrupt_state(struct amdgpu_device *adev, · 5 unmodified lines
6586 switch (state) {6586 switch (state) {
6587 case AMDGPU_IRQ_STATE_DISABLE:6587 case AMDGPU_IRQ_STATE_DISABLE:
6588 cg_thermal_int = RREG32_SMC(ixCG_THERMAL_INT);6588 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;
6590 WREG32_SMC(ixCG_THERMAL_INT, cg_thermal_int);6590 WREG32_SMC(ixCG_THERMAL_INT, cg_thermal_int);
6591 break;6591 break;
6592 case AMDGPU_IRQ_STATE_ENABLE:6592 case AMDGPU_IRQ_STATE_ENABLE:
6593 cg_thermal_int = RREG32_SMC(ixCG_THERMAL_INT);6593 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;
6595 WREG32_SMC(ixCG_THERMAL_INT, cg_thermal_int);6595 WREG32_SMC(ixCG_THERMAL_INT, cg_thermal_int);
6596 break;6596 break;
6597 default:6597 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
1250 u32 pixel_period;1250 u32 pixel_period;
1251 u32 line_time = 0;1251 u32 line_time = 0;
1252 u32 latency_watermark_a = 0, latency_watermark_b = 0;1252 u32 latency_watermark_a = 0, latency_watermark_b = 0;
1253 u32 tmp, wm_mask;1253 u32 tmp, wm_mask, lb_vblank_lead_lines = 0;
1254 1254
1255 if (amdgpu_crtc->base.enabled && num_heads && mode) {1255 if (amdgpu_crtc->base.enabled && num_heads && mode) {
1256 pixel_period = 1000000 / (u32)mode->clock;1256 pixel_period = 1000000 / (u32)mode->clock;
@@ -1333,6 +1333,7 @@ static void dce_v10_0_program_watermarks(struct amdgpu_device *adev, · 76 unmodified lines
1333 (adev->mode_info.disp_priority == 2)) {1333 (adev->mode_info.disp_priority == 2)) {
1334 DRM_DEBUG_KMS("force priority to high\n");1334 DRM_DEBUG_KMS("force priority to high\n");
1335 }1335 }
1336 lb_vblank_lead_lines = DIV_ROUND_UP(lb_size, mode->crtc_hdisplay);
1336 }1337 }
1337 1338
1338 /* select wm A */1339 /* select wm A */
@@ -1357,6 +1358,8 @@ static void dce_v10_0_program_watermarks(struct amdgpu_device *adev, · 18 unmodified lines
1357 amdgpu_crtc->line_time = line_time;1358 amdgpu_crtc->line_time = line_time;
1358 amdgpu_crtc->wm_high = latency_watermark_a;1359 amdgpu_crtc->wm_high = latency_watermark_a;
1359 amdgpu_crtc->wm_low = latency_watermark_b;1360 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;
1360}1363}
1361 1364
1362/**1365/**
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
1238 u32 pixel_period;1238 u32 pixel_period;
1239 u32 line_time = 0;1239 u32 line_time = 0;
1240 u32 latency_watermark_a = 0, latency_watermark_b = 0;1240 u32 latency_watermark_a = 0, latency_watermark_b = 0;
1241 u32 tmp, wm_mask;1241 u32 tmp, wm_mask, lb_vblank_lead_lines = 0;
1242 1242
1243 if (amdgpu_crtc->base.enabled && num_heads && mode) {1243 if (amdgpu_crtc->base.enabled && num_heads && mode) {
1244 pixel_period = 1000000 / (u32)mode->clock;1244 pixel_period = 1000000 / (u32)mode->clock;
@@ -1321,6 +1321,7 @@ static void dce_v11_0_program_watermarks(struct amdgpu_device *adev, · 76 unmodified lines
1321 (adev->mode_info.disp_priority == 2)) {1321 (adev->mode_info.disp_priority == 2)) {
1322 DRM_DEBUG_KMS("force priority to high\n");1322 DRM_DEBUG_KMS("force priority to high\n");
1323 }1323 }
1324 lb_vblank_lead_lines = DIV_ROUND_UP(lb_size, mode->crtc_hdisplay);
1324 }1325 }
1325 1326
1326 /* select wm A */1327 /* select wm A */
@@ -1345,6 +1346,8 @@ static void dce_v11_0_program_watermarks(struct amdgpu_device *adev, · 18 unmodified lines
1345 amdgpu_crtc->line_time = line_time;1346 amdgpu_crtc->line_time = line_time;
1346 amdgpu_crtc->wm_high = latency_watermark_a;1347 amdgpu_crtc->wm_high = latency_watermark_a;
1347 amdgpu_crtc->wm_low = latency_watermark_b;1348 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;
1348}1351}
1349 1352
1350/**1353/**
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
1193 u32 pixel_period;1193 u32 pixel_period;
1194 u32 line_time = 0;1194 u32 line_time = 0;
1195 u32 latency_watermark_a = 0, latency_watermark_b = 0;1195 u32 latency_watermark_a = 0, latency_watermark_b = 0;
1196 u32 tmp, wm_mask;1196 u32 tmp, wm_mask, lb_vblank_lead_lines = 0;
1197 1197
1198 if (amdgpu_crtc->base.enabled && num_heads && mode) {1198 if (amdgpu_crtc->base.enabled && num_heads && mode) {
1199 pixel_period = 1000000 / (u32)mode->clock;1199 pixel_period = 1000000 / (u32)mode->clock;
@@ -1276,6 +1276,7 @@ static void dce_v8_0_program_watermarks(struct amdgpu_device *adev, · 76 unmodified lines
1276 (adev->mode_info.disp_priority == 2)) {1276 (adev->mode_info.disp_priority == 2)) {
1277 DRM_DEBUG_KMS("force priority to high\n");1277 DRM_DEBUG_KMS("force priority to high\n");
1278 }1278 }
1279 lb_vblank_lead_lines = DIV_ROUND_UP(lb_size, mode->crtc_hdisplay);
1279 }1280 }
1280 1281
1281 /* select wm A */1282 /* select wm A */
@@ -1302,6 +1303,8 @@ static void dce_v8_0_program_watermarks(struct amdgpu_device *adev, · 20 unmodified lines
1302 amdgpu_crtc->line_time = line_time;1303 amdgpu_crtc->line_time = line_time;
1303 amdgpu_crtc->wm_high = latency_watermark_a;1304 amdgpu_crtc->wm_high = latency_watermark_a;
1304 amdgpu_crtc->wm_low = latency_watermark_b;1305 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;
1305}1308}
1306 1309
1307/**1310/**
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
268 mmCGTT_CP_CLK_CTRL, 0xffffffff, 0x00000100,268 mmCGTT_CP_CLK_CTRL, 0xffffffff, 0x00000100,
269 mmCGTT_CPC_CLK_CTRL, 0xffffffff, 0x00000100,269 mmCGTT_CPC_CLK_CTRL, 0xffffffff, 0x00000100,
270 mmCGTT_CPF_CLK_CTRL, 0xffffffff, 0x40000100,270 mmCGTT_CPF_CLK_CTRL, 0xffffffff, 0x40000100,
271 mmCGTT_DRM_CLK_CTRL0, 0xffffffff, 0x00600100,
272 mmCGTT_GDS_CLK_CTRL, 0xffffffff, 0x00000100,271 mmCGTT_GDS_CLK_CTRL, 0xffffffff, 0x00000100,
273 mmCGTT_IA_CLK_CTRL, 0xffffffff, 0x06000100,272 mmCGTT_IA_CLK_CTRL, 0xffffffff, 0x06000100,
274 mmCGTT_PA_CLK_CTRL, 0xffffffff, 0x00000100,273 mmCGTT_PA_CLK_CTRL, 0xffffffff, 0x00000100,
@@ -296,10 +295,6 @@ static const u32 fiji_mgcg_cgcg_init[] = · 21 unmodified lines
296 mmCGTS_SM_CTRL_REG, 0xffffffff, 0x96e00200,295 mmCGTS_SM_CTRL_REG, 0xffffffff, 0x96e00200,
297 mmCP_RB_WPTR_POLL_CNTL, 0xffffffff, 0x00900100,296 mmCP_RB_WPTR_POLL_CNTL, 0xffffffff, 0x00900100,
298 mmRLC_CGCG_CGLS_CTRL, 0xffffffff, 0x0020003c,297 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,
303 mmCP_MEM_SLP_CNTL, 0x00000001, 0x00000001,298 mmCP_MEM_SLP_CNTL, 0x00000001, 0x00000001,
304};299};
305 300
@@ -1000,7 +995,7 @@ static void gfx_v8_0_gpu_early_init(struct amdgpu_device *adev) · 694 unmodified lines
1000 adev->gfx.config.max_cu_per_sh = 16;995 adev->gfx.config.max_cu_per_sh = 16;
1001 adev->gfx.config.max_sh_per_se = 1;996 adev->gfx.config.max_sh_per_se = 1;
1002 adev->gfx.config.max_backends_per_se = 4;997 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;
1004 adev->gfx.config.max_gprs = 256;999 adev->gfx.config.max_gprs = 256;
1005 adev->gfx.config.max_gs_threads = 32;1000 adev->gfx.config.max_gs_threads = 32;
1006 adev->gfx.config.max_hw_contexts = 8;1001 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
1613 WREG32(mmGB_MACROTILE_MODE0 + reg_offset, gb_tile_moden);1608 WREG32(mmGB_MACROTILE_MODE0 + reg_offset, gb_tile_moden);
1614 }1609 }
1615 case CHIP_FIJI:1610 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;
1616 case CHIP_TONGA:1901 case CHIP_TONGA:
1617 for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) {1902 for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) {
1618 switch (reg_offset) {1903 switch (reg_offset) {
@@ -2971,10 +3256,13 @@ static int gfx_v8_0_cp_gfx_start(struct amdgpu_device *adev) · 1352 unmodified lines
2971 amdgpu_ring_write(ring, mmPA_SC_RASTER_CONFIG - PACKET3_SET_CONTEXT_REG_START);3256 amdgpu_ring_write(ring, mmPA_SC_RASTER_CONFIG - PACKET3_SET_CONTEXT_REG_START);
2972 switch (adev->asic_type) {3257 switch (adev->asic_type) {
2973 case CHIP_TONGA:3258 case CHIP_TONGA:
2974 case CHIP_FIJI:
2975 amdgpu_ring_write(ring, 0x16000012);3259 amdgpu_ring_write(ring, 0x16000012);
2976 amdgpu_ring_write(ring, 0x0000002A);3260 amdgpu_ring_write(ring, 0x0000002A);
2977 break;3261 break;
3262 case CHIP_FIJI:
3263 amdgpu_ring_write(ring, 0x3a00161a);
3264 amdgpu_ring_write(ring, 0x0000002e);
3265 break;
2978 case CHIP_TOPAZ:3266 case CHIP_TOPAZ:
2979 case CHIP_CARRIZO:3267 case CHIP_CARRIZO:
2980 amdgpu_ring_write(ring, 0x00000002);3268 amdgpu_ring_write(ring, 0x00000002);
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c+5−8
@@ -40,7 +40,7 @@ · 39 unmodified lines
40static void gmc_v7_0_set_gart_funcs(struct amdgpu_device *adev);40static void gmc_v7_0_set_gart_funcs(struct amdgpu_device *adev);
41static void gmc_v7_0_set_irq_funcs(struct amdgpu_device *adev);41static void gmc_v7_0_set_irq_funcs(struct amdgpu_device *adev);
42 42
43MODULE_FIRMWARE("radeon/boniare_mc.bin");43MODULE_FIRMWARE("radeon/bonaire_mc.bin");
44MODULE_FIRMWARE("radeon/hawaii_mc.bin");44MODULE_FIRMWARE("radeon/hawaii_mc.bin");
45 45
46/**46/**
@@ -501,6 +501,7 @@ static int gmc_v7_0_gart_enable(struct amdgpu_device *adev) · 454 unmodified lines
501 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_PDE0_CACHE_LRU_UPDATE_BY_WRITE, 1);501 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_PDE0_CACHE_LRU_UPDATE_BY_WRITE, 1);
502 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, EFFECTIVE_L2_QUEUE_SIZE, 7);502 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, EFFECTIVE_L2_QUEUE_SIZE, 7);
503 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, CONTEXT1_IDENTITY_ACCESS_MODE, 1);503 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);
504 WREG32(mmVM_L2_CNTL, tmp);505 WREG32(mmVM_L2_CNTL, tmp);
505 tmp = REG_SET_FIELD(0, VM_L2_CNTL2, INVALIDATE_ALL_L1_TLBS, 1);506 tmp = REG_SET_FIELD(0, VM_L2_CNTL2, INVALIDATE_ALL_L1_TLBS, 1);
506 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL2, INVALIDATE_L2_CACHE, 1);507 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
512 WREG32(mmVM_L2_CNTL3, tmp);513 WREG32(mmVM_L2_CNTL3, tmp);
513 /* setup context0 */514 /* setup context0 */
514 WREG32(mmVM_CONTEXT0_PAGE_TABLE_START_ADDR, adev->mc.gtt_start >> 12);515 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);
516 WREG32(mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR, adev->gart.table_addr >> 12);517 WREG32(mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR, adev->gart.table_addr >> 12);
517 WREG32(mmVM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR,518 WREG32(mmVM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR,
518 (u32)(adev->dummy_page.addr >> 12));519 (u32)(adev->dummy_page.addr >> 12));
@@ -960,12 +961,10 @@ static int gmc_v7_0_sw_init(void *handle) · 441 unmodified lines
960 961
961static int gmc_v7_0_sw_fini(void *handle)962static int gmc_v7_0_sw_fini(void *handle)
962{963{
963 int i;
964 struct amdgpu_device *adev = (struct amdgpu_device *)handle;964 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
965 965
966 if (adev->vm_manager.enabled) {966 if (adev->vm_manager.enabled) {
967 for (i = 0; i < AMDGPU_NUM_VM; ++i)967 amdgpu_vm_manager_fini(adev);
968 fence_put(adev->vm_manager.active[i]);
969 gmc_v7_0_vm_fini(adev);968 gmc_v7_0_vm_fini(adev);
970 adev->vm_manager.enabled = false;969 adev->vm_manager.enabled = false;
971 }970 }
@@ -1010,12 +1009,10 @@ static int gmc_v7_0_hw_fini(void *handle) · 38 unmodified lines
1010 1009
1011static int gmc_v7_0_suspend(void *handle)1010static int gmc_v7_0_suspend(void *handle)
1012{1011{
1013 int i;
1014 struct amdgpu_device *adev = (struct amdgpu_device *)handle;1012 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
1015 1013
1016 if (adev->vm_manager.enabled) {1014 if (adev->vm_manager.enabled) {
1017 for (i = 0; i < AMDGPU_NUM_VM; ++i)1015 amdgpu_vm_manager_fini(adev);
1018 fence_put(adev->vm_manager.active[i]);
1019 gmc_v7_0_vm_fini(adev);1016 gmc_v7_0_vm_fini(adev);
1020 adev->vm_manager.enabled = false;1017 adev->vm_manager.enabled = false;
1021 }1018 }
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
629 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_PDE0_CACHE_LRU_UPDATE_BY_WRITE, 1);629 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_PDE0_CACHE_LRU_UPDATE_BY_WRITE, 1);
630 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, EFFECTIVE_L2_QUEUE_SIZE, 7);630 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, EFFECTIVE_L2_QUEUE_SIZE, 7);
631 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, CONTEXT1_IDENTITY_ACCESS_MODE, 1);631 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);
632 WREG32(mmVM_L2_CNTL, tmp);633 WREG32(mmVM_L2_CNTL, tmp);
633 tmp = RREG32(mmVM_L2_CNTL2);634 tmp = RREG32(mmVM_L2_CNTL2);
634 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL2, INVALIDATE_ALL_L1_TLBS, 1);635 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
656 WREG32(mmVM_L2_CNTL4, tmp);657 WREG32(mmVM_L2_CNTL4, tmp);
657 /* setup context0 */658 /* setup context0 */
658 WREG32(mmVM_CONTEXT0_PAGE_TABLE_START_ADDR, adev->mc.gtt_start >> 12);659 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);
660 WREG32(mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR, adev->gart.table_addr >> 12);661 WREG32(mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR, adev->gart.table_addr >> 12);
661 WREG32(mmVM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR,662 WREG32(mmVM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR,
662 (u32)(adev->dummy_page.addr >> 12));663 (u32)(adev->dummy_page.addr >> 12));
@@ -979,12 +980,10 @@ static int gmc_v8_0_sw_init(void *handle) · 316 unmodified lines
979 980
980static int gmc_v8_0_sw_fini(void *handle)981static int gmc_v8_0_sw_fini(void *handle)
981{982{
982 int i;
983 struct amdgpu_device *adev = (struct amdgpu_device *)handle;983 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
984 984
985 if (adev->vm_manager.enabled) {985 if (adev->vm_manager.enabled) {
986 for (i = 0; i < AMDGPU_NUM_VM; ++i)986 amdgpu_vm_manager_fini(adev);
987 fence_put(adev->vm_manager.active[i]);
988 gmc_v8_0_vm_fini(adev);987 gmc_v8_0_vm_fini(adev);
989 adev->vm_manager.enabled = false;988 adev->vm_manager.enabled = false;
990 }989 }
@@ -1031,12 +1030,10 @@ static int gmc_v8_0_hw_fini(void *handle) · 40 unmodified lines
1031 1030
1032static int gmc_v8_0_suspend(void *handle)1031static int gmc_v8_0_suspend(void *handle)
1033{1032{
1034 int i;
1035 struct amdgpu_device *adev = (struct amdgpu_device *)handle;1033 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
1036 1034
1037 if (adev->vm_manager.enabled) {1035 if (adev->vm_manager.enabled) {
1038 for (i = 0; i < AMDGPU_NUM_VM; ++i)1036 amdgpu_vm_manager_fini(adev);
1039 fence_put(adev->vm_manager.active[i]);
1040 gmc_v8_0_vm_fini(adev);1037 gmc_v8_0_vm_fini(adev);
1041 adev->vm_manager.enabled = false;1038 adev->vm_manager.enabled = false;
1042 }1039 }
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c+19−5
@@ -40,6 +40,9 @@ · 39 unmodified lines
40 40
41#define GRBM_GFX_INDEX__VCE_INSTANCE__SHIFT 0x0441#define GRBM_GFX_INDEX__VCE_INSTANCE__SHIFT 0x04
42#define GRBM_GFX_INDEX__VCE_INSTANCE_MASK 0x1042#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
43 46
44#define VCE_V3_0_FW_SIZE (384 * 1024)47#define VCE_V3_0_FW_SIZE (384 * 1024)
45#define VCE_V3_0_STACK_SIZE (64 * 1024)48#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
130 133
131 /* set BUSY flag */134 /* set BUSY flag */
132 WREG32_P(mmVCE_STATUS, 1, ~1);135 WREG32_P(mmVCE_STATUS, 1, ~1);
133 136 if (adev->asic_type >= CHIP_STONEY)
134 WREG32_P(mmVCE_VCPU_CNTL, VCE_VCPU_CNTL__CLK_EN_MASK,137 WREG32_P(mmVCE_VCPU_CNTL, 1, ~0x200001);
135 ~VCE_VCPU_CNTL__CLK_EN_MASK);138 else
139 WREG32_P(mmVCE_VCPU_CNTL, VCE_VCPU_CNTL__CLK_EN_MASK,
140 ~VCE_VCPU_CNTL__CLK_EN_MASK);
136 141
137 WREG32_P(mmVCE_SOFT_RESET,142 WREG32_P(mmVCE_SOFT_RESET,
138 VCE_SOFT_RESET__ECPU_SOFT_RESET_MASK,143 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
391 WREG32(mmVCE_LMI_SWAP_CNTL, 0);396 WREG32(mmVCE_LMI_SWAP_CNTL, 0);
392 WREG32(mmVCE_LMI_SWAP_CNTL1, 0);397 WREG32(mmVCE_LMI_SWAP_CNTL1, 0);
393 WREG32(mmVCE_LMI_VM_CTRL, 0);398 WREG32(mmVCE_LMI_VM_CTRL, 0);
394 399 if (adev->asic_type >= CHIP_STONEY) {
395 WREG32(mmVCE_LMI_VCPU_CACHE_40BIT_BAR, (adev->vce.gpu_addr >> 8));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));
396 offset = AMDGPU_VCE_FIRMWARE_OFFSET;405 offset = AMDGPU_VCE_FIRMWARE_OFFSET;
397 size = VCE_V3_0_FW_SIZE;406 size = VCE_V3_0_FW_SIZE;
398 WREG32(mmVCE_VCPU_CACHE_OFFSET0, offset & 0x7fffffff);407 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
576 struct amdgpu_iv_entry *entry)585 struct amdgpu_iv_entry *entry)
577{586{
578 DRM_DEBUG("IH: VCE\n");587 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
579 switch (entry->src_data) {593 switch (entry->src_data) {
580 case 0:594 case 0:
581 amdgpu_fence_process(&adev->vce.ring[0]);595 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
16 TP_ARGS(sched_job),16 TP_ARGS(sched_job),
17 TP_STRUCT__entry(17 TP_STRUCT__entry(
18 __field(struct amd_sched_entity *, entity)18 __field(struct amd_sched_entity *, entity)
19 __field(struct amd_sched_job *, sched_job)
20 __field(struct fence *, fence)
19 __field(const char *, name)21 __field(const char *, name)
20 __field(u32, job_count)22 __field(u32, job_count)
21 __field(int, hw_job_count)23 __field(int, hw_job_count)
@@ -23,16 +25,32 @@ TRACE_EVENT(amd_sched_job, · 1 unmodified line
23 25
24 TP_fast_assign(26 TP_fast_assign(
25 __entry->entity = sched_job->s_entity;27 __entry->entity = sched_job->s_entity;
28 __entry->sched_job = sched_job;
29 __entry->fence = &sched_job->s_fence->base;
26 __entry->name = sched_job->sched->name;30 __entry->name = sched_job->sched->name;
27 __entry->job_count = kfifo_len(31 __entry->job_count = kfifo_len(
28 &sched_job->s_entity->job_queue) / sizeof(sched_job);32 &sched_job->s_entity->job_queue) / sizeof(sched_job);
29 __entry->hw_job_count = atomic_read(33 __entry->hw_job_count = atomic_read(
30 &sched_job->sched->hw_rq_count);34 &sched_job->sched->hw_rq_count);
31 ),35 ),
32 TP_printk("entity=%p, ring=%s, job count:%u, hw job count:%d",36 TP_printk("entity=%p, sched job=%p, fence=%p, ring=%s, job count:%u, hw job count:%d",
33 __entry->entity, __entry->name, __entry->job_count,37 __entry->entity, __entry->sched_job, __entry->fence, __entry->name,
34 __entry->hw_job_count)38 __entry->job_count, __entry->hw_job_count)
35);39);
40
41TRACE_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
36#endif54#endif
37 55
38/* This part must be outside protection */56/* This part must be outside protection */
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c+99−52
@@ -30,10 +30,12 @@ · 29 unmodified lines
30#define CREATE_TRACE_POINTS30#define CREATE_TRACE_POINTS
31#include "gpu_sched_trace.h"31#include "gpu_sched_trace.h"
32 32
33static struct amd_sched_job *33static bool amd_sched_entity_is_ready(struct amd_sched_entity *entity);
34amd_sched_entity_pop_job(struct amd_sched_entity *entity);
35static void amd_sched_wakeup(struct amd_gpu_scheduler *sched);34static void amd_sched_wakeup(struct amd_gpu_scheduler *sched);
36 35
36struct kmem_cache *sched_fence_slab;
37atomic_t sched_fence_slab_ref = ATOMIC_INIT(0);
38
37/* Initialize a given run queue struct */39/* Initialize a given run queue struct */
38static void amd_sched_rq_init(struct amd_sched_rq *rq)40static void amd_sched_rq_init(struct amd_sched_rq *rq)
39{41{
@@ -61,36 +63,36 @@ static void amd_sched_rq_remove_entity(struct amd_sched_rq *rq, · 21 unmodified lines
61}63}
62 64
63/**65/**
64 * Select next job from a specified run queue with round robin policy.66 * Select an entity which could provide a job to run
65 * Return NULL if nothing available.67 *
68 * @rq The run queue to check.
69 *
70 * Try to find a ready entity, returns NULL if none found.
66 */71 */
67static struct amd_sched_job *72static struct amd_sched_entity *
68amd_sched_rq_select_job(struct amd_sched_rq *rq)73amd_sched_rq_select_entity(struct amd_sched_rq *rq)
69{74{
70 struct amd_sched_entity *entity;75 struct amd_sched_entity *entity;
71 struct amd_sched_job *sched_job;
72 76
73 spin_lock(&rq->lock);77 spin_lock(&rq->lock);
74 78
75 entity = rq->current_entity;79 entity = rq->current_entity;
76 if (entity) {80 if (entity) {
77 list_for_each_entry_continue(entity, &rq->entities, list) {81 list_for_each_entry_continue(entity, &rq->entities, list) {
78 sched_job = amd_sched_entity_pop_job(entity);82 if (amd_sched_entity_is_ready(entity)) {
79 if (sched_job) {
80 rq->current_entity = entity;83 rq->current_entity = entity;
81 spin_unlock(&rq->lock);84 spin_unlock(&rq->lock);
82 return sched_job;85 return entity;
83 }86 }
84 }87 }
85 }88 }
86 89
87 list_for_each_entry(entity, &rq->entities, list) {90 list_for_each_entry(entity, &rq->entities, list) {
88 91
89 sched_job = amd_sched_entity_pop_job(entity);92 if (amd_sched_entity_is_ready(entity)) {
90 if (sched_job) {
91 rq->current_entity = entity;93 rq->current_entity = entity;
92 spin_unlock(&rq->lock);94 spin_unlock(&rq->lock);
93 return sched_job;95 return entity;
94 }96 }
95 97
96 if (entity == rq->current_entity)98 if (entity == rq->current_entity)
@@ -173,6 +175,24 @@ static bool amd_sched_entity_is_idle(struct amd_sched_entity *entity) · 76 unmodified lines
173 return false;175 return false;
174}176}
175 177
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 */
185static 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
176/**196/**
177 * Destroy a context entity197 * Destroy a context entity
178 *198 *
@@ -208,32 +228,53 @@ static void amd_sched_entity_wakeup(struct fence *f, struct fence_cb *cb) · 29 unmodified lines
208 amd_sched_wakeup(entity->sched);228 amd_sched_wakeup(entity->sched);
209}229}
210 230
231static 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
211static struct amd_sched_job *266static struct amd_sched_job *
212amd_sched_entity_pop_job(struct amd_sched_entity *entity)267amd_sched_entity_pop_job(struct amd_sched_entity *entity)
213{268{
214 struct amd_gpu_scheduler *sched = entity->sched;269 struct amd_gpu_scheduler *sched = entity->sched;
215 struct amd_sched_job *sched_job;270 struct amd_sched_job *sched_job;
216 271
217 if (ACCESS_ONCE(entity->dependency))
218 return NULL;
219
220 if (!kfifo_out_peek(&entity->job_queue, &sched_job, sizeof(sched_job)))272 if (!kfifo_out_peek(&entity->job_queue, &sched_job, sizeof(sched_job)))
221 return NULL;273 return NULL;
222 274
223 while ((entity->dependency = sched->ops->dependency(sched_job))) {275 while ((entity->dependency = sched->ops->dependency(sched_job)))
224 276 if (amd_sched_entity_add_dependency_cb(entity))
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
235 return NULL;277 return NULL;
236 }
237 278
238 return sched_job;279 return sched_job;
239}280}
@@ -247,6 +288,7 @@ amd_sched_entity_pop_job(struct amd_sched_entity *entity) · 7 unmodified lines
247 */288 */
248static bool amd_sched_entity_in(struct amd_sched_job *sched_job)289static bool amd_sched_entity_in(struct amd_sched_job *sched_job)
249{290{
291 struct amd_gpu_scheduler *sched = sched_job->sched;
250 struct amd_sched_entity *entity = sched_job->s_entity;292 struct amd_sched_entity *entity = sched_job->s_entity;
251 bool added, first = false;293 bool added, first = false;
252 294
@@ -261,7 +303,7 @@ static bool amd_sched_entity_in(struct amd_sched_job *sched_job) · 8 unmodified lines
261 303
262 /* first job wakes up scheduler */304 /* first job wakes up scheduler */
263 if (first)305 if (first)
264 amd_sched_wakeup(sched_job->sched);306 amd_sched_wakeup(sched);
265 307
266 return added;308 return added;
267}309}
@@ -273,22 +315,13 @@ static bool amd_sched_entity_in(struct amd_sched_job *sched_job) · 5 unmodified lines
273 *315 *
274 * Returns 0 for success, negative error code otherwise.316 * Returns 0 for success, negative error code otherwise.
275 */317 */
276int amd_sched_entity_push_job(struct amd_sched_job *sched_job)318void amd_sched_entity_push_job(struct amd_sched_job *sched_job)
277{319{
278 struct amd_sched_entity *entity = sched_job->s_entity;320 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;
287 321
322 trace_amd_sched_job(sched_job);
288 wait_event(entity->sched->job_scheduled,323 wait_event(entity->sched->job_scheduled,
289 amd_sched_entity_in(sched_job));324 amd_sched_entity_in(sched_job));
290 trace_amd_sched_job(sched_job);
291 return 0;
292}325}
293 326
294/**327/**
@@ -310,22 +343,22 @@ static void amd_sched_wakeup(struct amd_gpu_scheduler *sched) · 15 unmodified lines
310}343}
311 344
312/**345/**
313 * Select next to run346 * Select next entity to process
314*/347*/
315static struct amd_sched_job *348static struct amd_sched_entity *
316amd_sched_select_job(struct amd_gpu_scheduler *sched)349amd_sched_select_entity(struct amd_gpu_scheduler *sched)
317{350{
318 struct amd_sched_job *sched_job;351 struct amd_sched_entity *entity;
319 352
320 if (!amd_sched_ready(sched))353 if (!amd_sched_ready(sched))
321 return NULL;354 return NULL;
322 355
323 /* Kernel run queue has higher priority than normal run queue*/356 /* Kernel run queue has higher priority than normal run queue*/
324 sched_job = amd_sched_rq_select_job(&sched->kernel_rq);357 entity = amd_sched_rq_select_entity(&sched->kernel_rq);
325 if (sched_job == NULL)358 if (entity == NULL)
326 sched_job = amd_sched_rq_select_job(&sched->sched_rq);359 entity = amd_sched_rq_select_entity(&sched->sched_rq);
327 360
328 return sched_job;361 return entity;
329}362}
330 363
331static void amd_sched_process_job(struct fence *f, struct fence_cb *cb)364static 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
343 list_del_init(&s_fence->list);376 list_del_init(&s_fence->list);
344 spin_unlock_irqrestore(&sched->fence_list_lock, flags);377 spin_unlock_irqrestore(&sched->fence_list_lock, flags);
345 }378 }
379 trace_amd_sched_process_job(s_fence);
346 fence_put(&s_fence->base);380 fence_put(&s_fence->base);
347 wake_up_interruptible(&sched->wake_up_worker);381 wake_up_interruptible(&sched->wake_up_worker);
348}382}
@@ -386,13 +420,16 @@ static int amd_sched_main(void *param) · 37 unmodified lines
386 unsigned long flags;420 unsigned long flags;
387 421
388 wait_event_interruptible(sched->wake_up_worker,422 wait_event_interruptible(sched->wake_up_worker,
389 kthread_should_stop() ||423 (entity = amd_sched_select_entity(sched)) ||
390 (sched_job = amd_sched_select_job(sched)));424 kthread_should_stop());
391 425
426 if (!entity)
427 continue;
428
429 sched_job = amd_sched_entity_pop_job(entity);
392 if (!sched_job)430 if (!sched_job)
393 continue;431 continue;
394 432
395 entity = sched_job->s_entity;
396 s_fence = sched_job->s_fence;433 s_fence = sched_job->s_fence;
397 434
398 if (sched->timeout != MAX_SCHEDULE_TIMEOUT) {435 if (sched->timeout != MAX_SCHEDULE_TIMEOUT) {
@@ -405,6 +442,7 @@ static int amd_sched_main(void *param) · 6 unmodified lines
405 442
406 atomic_inc(&sched->hw_rq_count);443 atomic_inc(&sched->hw_rq_count);
407 fence = sched->ops->run_job(sched_job);444 fence = sched->ops->run_job(sched_job);
445 amd_sched_fence_scheduled(s_fence);
408 if (fence) {446 if (fence) {
409 r = fence_add_callback(fence, &s_fence->cb,447 r = fence_add_callback(fence, &s_fence->cb,
410 amd_sched_process_job);448 amd_sched_process_job);
@@ -450,6 +488,13 @@ int amd_sched_init(struct amd_gpu_scheduler *sched, · 39 unmodified lines
450 init_waitqueue_head(&sched->wake_up_worker);488 init_waitqueue_head(&sched->wake_up_worker);
451 init_waitqueue_head(&sched->job_scheduled);489 init_waitqueue_head(&sched->job_scheduled);
452 atomic_set(&sched->hw_rq_count, 0);490 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 }
453 498
454 /* Each scheduler will run on a seperate kernel thread */499 /* Each scheduler will run on a seperate kernel thread */
455 sched->thread = kthread_run(amd_sched_main, sched, sched->name);500 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
470{515{
471 if (sched->thread)516 if (sched->thread)
472 kthread_stop(sched->thread);517 kthread_stop(sched->thread);
518 if (atomic_dec_and_test(&sched_fence_slab_ref))
519 kmem_cache_destroy(sched_fence_slab);
473}520}
drivers/gpu/drm/amd/scheduler/gpu_scheduler.h+8−3
@@ -27,9 +27,14 @@ · 26 unmodified lines
27#include <linux/kfifo.h>27#include <linux/kfifo.h>
28#include <linux/fence.h>28#include <linux/fence.h>
29 29
30#define AMD_SCHED_FENCE_SCHEDULED_BIT FENCE_FLAG_USER_BITS
31
30struct amd_gpu_scheduler;32struct amd_gpu_scheduler;
31struct amd_sched_rq;33struct amd_sched_rq;
32 34
35extern struct kmem_cache *sched_fence_slab;
36extern atomic_t sched_fence_slab_ref;
37
33/**38/**
34 * A scheduler entity is a wrapper around a job queue or a group39 * A scheduler entity is a wrapper around a job queue or a group
35 * of other entities. Entities take turns emitting jobs from their 40 * of other entities. Entities take turns emitting jobs from their
@@ -65,6 +70,7 @@ struct amd_sched_rq { · 29 unmodified lines
65struct amd_sched_fence {70struct amd_sched_fence {
66 struct fence base;71 struct fence base;
67 struct fence_cb cb;72 struct fence_cb cb;
73 struct list_head scheduled_cb;
68 struct amd_gpu_scheduler *sched;74 struct amd_gpu_scheduler *sched;
69 spinlock_t lock;75 spinlock_t lock;
70 void *owner;76 void *owner;
@@ -76,7 +82,6 @@ struct amd_sched_job { · 5 unmodified lines
76 struct amd_gpu_scheduler *sched;82 struct amd_gpu_scheduler *sched;
77 struct amd_sched_entity *s_entity;83 struct amd_sched_entity *s_entity;
78 struct amd_sched_fence *s_fence;84 struct amd_sched_fence *s_fence;
79 void *owner;
80};85};
81 86
82extern const struct fence_ops amd_sched_fence_ops;87extern 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
128 uint32_t jobs);133 uint32_t jobs);
129void amd_sched_entity_fini(struct amd_gpu_scheduler *sched,134void amd_sched_entity_fini(struct amd_gpu_scheduler *sched,
130 struct amd_sched_entity *entity);135 struct amd_sched_entity *entity);
131int amd_sched_entity_push_job(struct amd_sched_job *sched_job);136void amd_sched_entity_push_job(struct amd_sched_job *sched_job);
132 137
133struct amd_sched_fence *amd_sched_fence_create(138struct amd_sched_fence *amd_sched_fence_create(
134 struct amd_sched_entity *s_entity, void *owner);139 struct amd_sched_entity *s_entity, void *owner);
140void amd_sched_fence_scheduled(struct amd_sched_fence *fence);
135void amd_sched_fence_signal(struct amd_sched_fence *fence);141void amd_sched_fence_signal(struct amd_sched_fence *fence);
136 142
137
138#endif143#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
32 struct amd_sched_fence *fence = NULL;32 struct amd_sched_fence *fence = NULL;
33 unsigned seq;33 unsigned seq;
34 34
35 fence = kzalloc(sizeof(struct amd_sched_fence), GFP_KERNEL);35 fence = kmem_cache_zalloc(sched_fence_slab, GFP_KERNEL);
36 if (fence == NULL)36 if (fence == NULL)
37 return NULL;37 return NULL;
38
39 INIT_LIST_HEAD(&fence->scheduled_cb);
38 fence->owner = owner;40 fence->owner = owner;
39 fence->sched = s_entity->sched;41 fence->sched = s_entity->sched;
40 spin_lock_init(&fence->lock);42 spin_lock_init(&fence->lock);
@@ -55,6 +57,17 @@ void amd_sched_fence_signal(struct amd_sched_fence *fence) · 14 unmodified lines
55 FENCE_TRACE(&fence->base, "was already signaled\n");57 FENCE_TRACE(&fence->base, "was already signaled\n");
56}58}
57 59
60void 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
58static const char *amd_sched_fence_get_driver_name(struct fence *fence)71static const char *amd_sched_fence_get_driver_name(struct fence *fence)
59{72{
60 return "amd_sched";73 return "amd_sched";
@@ -71,11 +84,17 @@ static bool amd_sched_fence_enable_signaling(struct fence *f) · 10 unmodified lines
71 return true;84 return true;
72}85}
73 86
87static 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
74const struct fence_ops amd_sched_fence_ops = {93const struct fence_ops amd_sched_fence_ops = {
75 .get_driver_name = amd_sched_fence_get_driver_name,94 .get_driver_name = amd_sched_fence_get_driver_name,
76 .get_timeline_name = amd_sched_fence_get_timeline_name,95 .get_timeline_name = amd_sched_fence_get_timeline_name,
77 .enable_signaling = amd_sched_fence_enable_signaling,96 .enable_signaling = amd_sched_fence_enable_signaling,
78 .signaled = NULL,97 .signaled = NULL,
79 .wait = fence_default_wait,98 .wait = fence_default_wait,
80 .release = NULL,99 .release = amd_sched_fence_release,
81};100};
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
1432 return ret;1432 return ret;
1433}1433}
1434 1434
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 */
1447void 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}
1472EXPORT_SYMBOL(drm_atomic_clean_old_fb);
1473
1435int drm_mode_atomic_ioctl(struct drm_device *dev,1474int drm_mode_atomic_ioctl(struct drm_device *dev,
1436 void *data, struct drm_file *file_priv)1475 void *data, struct drm_file *file_priv)
1437{1476{
@@ -1446,7 +1485,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, · 8 unmodified lines
1446 struct drm_plane *plane;1485 struct drm_plane *plane;
1447 struct drm_crtc *crtc;1486 struct drm_crtc *crtc;
1448 struct drm_crtc_state *crtc_state;1487 struct drm_crtc_state *crtc_state;
1449 unsigned plane_mask = 0;1488 unsigned plane_mask;
1450 int ret = 0;1489 int ret = 0;
1451 unsigned int i, j;1490 unsigned int i, j;
1452 1491
@@ -1486,6 +1525,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, · 33 unmodified lines
1486 state->allow_modeset = !!(arg->flags & DRM_MODE_ATOMIC_ALLOW_MODESET);1525 state->allow_modeset = !!(arg->flags & DRM_MODE_ATOMIC_ALLOW_MODESET);
1487 1526
1488retry:1527retry:
1528 plane_mask = 0;
1489 copied_objs = 0;1529 copied_objs = 0;
1490 copied_props = 0;1530 copied_props = 0;
1491 1531
@@ -1576,24 +1616,7 @@ retry: · 84 unmodified lines
1576 }1616 }
1577 1617
1578out:1618out:
1579 /* if succeeded, fixup legacy plane crtc/fb ptrs before dropping1619 drm_atomic_clean_old_fb(dev, plane_mask, ret);
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 }
1597 1620
1598 if (ret && arg->flags & DRM_MODE_PAGE_FLIP_EVENT) {1621 if (ret && arg->flags & DRM_MODE_PAGE_FLIP_EVENT) {
1599 /*1622 /*
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
210 return -EINVAL;210 return -EINVAL;
211 }211 }
212 212
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
213 if (new_encoder == connector_state->best_encoder) {221 if (new_encoder == connector_state->best_encoder) {
214 DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] keeps [ENCODER:%d:%s], now on [CRTC:%d]\n",222 DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] keeps [ENCODER:%d:%s], now on [CRTC:%d]\n",
215 connector->base.id,223 connector->base.id,
@@ -1553,6 +1561,9 @@ retry: · 1337 unmodified lines
1553 goto fail;1561 goto fail;
1554 }1562 }
1555 1563
1564 if (plane_state->crtc && (plane == plane->crtc->cursor))
1565 plane_state->state->legacy_cursor_update = true;
1566
1556 ret = __drm_atomic_helper_disable_plane(plane, plane_state);1567 ret = __drm_atomic_helper_disable_plane(plane, plane_state);
1557 if (ret != 0)1568 if (ret != 0)
1558 goto fail;1569 goto fail;
@@ -1605,9 +1616,6 @@ int __drm_atomic_helper_disable_plane(struct drm_plane *plane, · 46 unmodified lines
1605 plane_state->src_h = 0;1616 plane_state->src_h = 0;
1606 plane_state->src_w = 0;1617 plane_state->src_w = 0;
1607 1618
1608 if (plane->crtc && (plane == plane->crtc->cursor))
1609 plane_state->state->legacy_cursor_update = true;
1610
1611 return 0;1619 return 0;
1612}1620}
1613 1621
@@ -1741,6 +1749,7 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set, · 127 unmodified lines
1741 struct drm_crtc_state *crtc_state;1749 struct drm_crtc_state *crtc_state;
1742 struct drm_plane_state *primary_state;1750 struct drm_plane_state *primary_state;
1743 struct drm_crtc *crtc = set->crtc;1751 struct drm_crtc *crtc = set->crtc;
1752 int hdisplay, vdisplay;
1744 int ret;1753 int ret;
1745 1754
1746 crtc_state = drm_atomic_get_crtc_state(state, crtc);1755 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
1783 if (ret != 0)1792 if (ret != 0)
1784 return ret;1793 return ret;
1785 1794
1795 drm_crtc_get_hv_timing(set->mode, &hdisplay, &vdisplay);
1796
1786 drm_atomic_set_fb_for_plane(primary_state, set->fb);1797 drm_atomic_set_fb_for_plane(primary_state, set->fb);
1787 primary_state->crtc_x = 0;1798 primary_state->crtc_x = 0;
1788 primary_state->crtc_y = 0;1799 primary_state->crtc_y = 0;
1789 primary_state->crtc_h = set->mode->vdisplay;1800 primary_state->crtc_h = vdisplay;
1790 primary_state->crtc_w = set->mode->hdisplay;1801 primary_state->crtc_w = hdisplay;
1791 primary_state->src_x = set->x << 16;1802 primary_state->src_x = set->x << 16;
1792 primary_state->src_y = set->y << 16;1803 primary_state->src_y = set->y << 16;
1793 if (primary_state->rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {1804 if (primary_state->rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
1794 primary_state->src_h = set->mode->hdisplay << 16;1805 primary_state->src_h = hdisplay << 16;
1795 primary_state->src_w = set->mode->vdisplay << 16;1806 primary_state->src_w = vdisplay << 16;
1796 } else {1807 } else {
1797 primary_state->src_h = set->mode->vdisplay << 16;1808 primary_state->src_h = vdisplay << 16;
1798 primary_state->src_w = set->mode->hdisplay << 16;1809 primary_state->src_w = hdisplay << 16;
1799 }1810 }
1800 1811
1801commit:1812commit:
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
160 goto out_unlock;160 goto out_unlock;
161 }161 }
162 162
163 if (!file_priv->allowed_master) {
164 ret = drm_new_set_master(dev, file_priv);
165 goto out_unlock;
166 }
167
163 file_priv->minor->master = drm_master_get(file_priv->master);168 file_priv->minor->master = drm_master_get(file_priv->master);
164 file_priv->is_master = 1;169 file_priv->is_master = 1;
165 if (dev->driver->master_set) {170 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
342 struct drm_plane *plane;342 struct drm_plane *plane;
343 struct drm_atomic_state *state;343 struct drm_atomic_state *state;
344 int i, ret;344 int i, ret;
345 unsigned plane_mask;
345 346
346 state = drm_atomic_state_alloc(dev);347 state = drm_atomic_state_alloc(dev);
347 if (!state)348 if (!state)
@@ -349,11 +350,10 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper) · 1 unmodified line
349 350
350 state->acquire_ctx = dev->mode_config.acquire_ctx;351 state->acquire_ctx = dev->mode_config.acquire_ctx;
351retry:352retry:
353 plane_mask = 0;
352 drm_for_each_plane(plane, dev) {354 drm_for_each_plane(plane, dev) {
353 struct drm_plane_state *plane_state;355 struct drm_plane_state *plane_state;
354 356
355 plane->old_fb = plane->fb;
356
357 plane_state = drm_atomic_get_plane_state(state, plane);357 plane_state = drm_atomic_get_plane_state(state, plane);
358 if (IS_ERR(plane_state)) {358 if (IS_ERR(plane_state)) {
359 ret = PTR_ERR(plane_state);359 ret = PTR_ERR(plane_state);
@@ -362,6 +362,9 @@ retry: · 2 unmodified lines
362 362
363 plane_state->rotation = BIT(DRM_ROTATE_0);363 plane_state->rotation = BIT(DRM_ROTATE_0);
364 364
365 plane->old_fb = plane->fb;
366 plane_mask |= 1 << drm_plane_index(plane);
367
365 /* disable non-primary: */368 /* disable non-primary: */
366 if (plane->type == DRM_PLANE_TYPE_PRIMARY)369 if (plane->type == DRM_PLANE_TYPE_PRIMARY)
367 continue;370 continue;
@@ -382,19 +385,7 @@ retry: · 14 unmodified lines
382 ret = drm_atomic_commit(state);385 ret = drm_atomic_commit(state);
383 386
384fail:387fail:
385 drm_for_each_plane(plane, dev) {388 drm_atomic_clean_old_fb(dev, plane_mask, ret);
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 }
398 389
399 if (ret == -EDEADLK)390 if (ret == -EDEADLK)
400 goto backoff;391 goto backoff;
@@ -1236,7 +1227,9 @@ static int pan_display_atomic(struct fb_var_screeninfo *var, · 835 unmodified lines
1236 struct drm_fb_helper *fb_helper = info->par;1227 struct drm_fb_helper *fb_helper = info->par;
1237 struct drm_device *dev = fb_helper->dev;1228 struct drm_device *dev = fb_helper->dev;
1238 struct drm_atomic_state *state;1229 struct drm_atomic_state *state;
1230 struct drm_plane *plane;
1239 int i, ret;1231 int i, ret;
1232 unsigned plane_mask;
1240 1233
1241 state = drm_atomic_state_alloc(dev);1234 state = drm_atomic_state_alloc(dev);
1242 if (!state)1235 if (!state)
@@ -1244,19 +1237,22 @@ static int pan_display_atomic(struct fb_var_screeninfo *var, · 1 unmodified line
1244 1237
1245 state->acquire_ctx = dev->mode_config.acquire_ctx;1238 state->acquire_ctx = dev->mode_config.acquire_ctx;
1246retry:1239retry:
1240 plane_mask = 0;
1247 for(i = 0; i < fb_helper->crtc_count; i++) {1241 for(i = 0; i < fb_helper->crtc_count; i++) {
1248 struct drm_mode_set *mode_set;1242 struct drm_mode_set *mode_set;
1249 1243
1250 mode_set = &fb_helper->crtc_info[i].mode_set;1244 mode_set = &fb_helper->crtc_info[i].mode_set;
1251 1245
1252 mode_set->crtc->primary->old_fb = mode_set->crtc->primary->fb;
1253
1254 mode_set->x = var->xoffset;1246 mode_set->x = var->xoffset;
1255 mode_set->y = var->yoffset;1247 mode_set->y = var->yoffset;
1256 1248
1257 ret = __drm_atomic_helper_set_config(mode_set, state);1249 ret = __drm_atomic_helper_set_config(mode_set, state);
1258 if (ret != 0)1250 if (ret != 0)
1259 goto fail;1251 goto fail;
1252
1253 plane = mode_set->crtc->primary;
1254 plane_mask |= drm_plane_index(plane);
1255 plane->old_fb = plane->fb;
1260 }1256 }
1261 1257
1262 ret = drm_atomic_commit(state);1258 ret = drm_atomic_commit(state);
@@ -1268,26 +1264,7 @@ retry: · 5 unmodified lines
1268 1264
1269 1265
1270fail:1266fail:
1271 for(i = 0; i < fb_helper->crtc_count; i++) {1267 drm_atomic_clean_old_fb(dev, plane_mask, ret);
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 }
1291 1268
1292 if (ret == -EDEADLK)1269 if (ret == -EDEADLK)
1293 goto backoff;1270 goto backoff;
drivers/gpu/drm/drm_fops.c+56−28
@@ -125,6 +125,60 @@ static int drm_cpu_valid(void) · 124 unmodified lines
125 return 1;125 return 1;
126}126}
127 127
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 */
138int 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
173out_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
128/**182/**
129 * Called whenever a process opens /dev/drm.183 * Called whenever a process opens /dev/drm.
130 *184 *
@@ -189,35 +243,9 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor) · 58 unmodified lines
189 mutex_lock(&dev->master_mutex);243 mutex_lock(&dev->master_mutex);
190 if (drm_is_primary_client(priv) && !priv->minor->master) {244 if (drm_is_primary_client(priv) && !priv->minor->master) {
191 /* create a new master */245 /* create a new master */
192 priv->minor->master = drm_master_create(priv->minor);246 ret = drm_new_set_master(dev, priv);
193 if (!priv->minor->master) {247 if (ret)
194 ret = -ENOMEM;
195 goto out_close;248 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 }
221 } else if (drm_is_primary_client(priv)) {249 } else if (drm_is_primary_client(priv)) {
222 /* get a reference to the master */250 /* get a reference to the master */
223 priv->master = drm_master_get(priv->minor->master);251 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
980 struct drm_pending_vblank_event *e,980 struct drm_pending_vblank_event *e,
981 unsigned long seq, struct timeval *now)981 unsigned long seq, struct timeval *now)
982{982{
983 WARN_ON_SMP(!spin_is_locked(&dev->event_lock));983 assert_spin_locked(&dev->event_lock);
984
984 e->event.sequence = seq;985 e->event.sequence = seq;
985 e->event.tv_sec = now->tv_sec;986 e->event.tv_sec = now->tv_sec;
986 e->event.tv_usec = now->tv_usec;987 e->event.tv_usec = now->tv_usec;
@@ -992,6 +993,57 @@ static void send_vblank_event(struct drm_device *dev, · 5 unmodified lines
992 e->event.sequence);993 e->event.sequence);
993}994}
994 995
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 */
1013void 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}
1022EXPORT_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 */
1040void 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}
1045EXPORT_SYMBOL(drm_crtc_arm_vblank_event);
1046
995/**1047/**
996 * drm_send_vblank_event - helper to send vblank event after pageflip1048 * drm_send_vblank_event - helper to send vblank event after pageflip
997 * @dev: DRM device1049 * @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
2734 return "AUX_C";2734 return "AUX_C";
2735 case POWER_DOMAIN_AUX_D:2735 case POWER_DOMAIN_AUX_D:
2736 return "AUX_D";2736 return "AUX_D";
2737 case POWER_DOMAIN_GMBUS:
2738 return "GMBUS";
2737 case POWER_DOMAIN_INIT:2739 case POWER_DOMAIN_INIT:
2738 return "INIT";2740 return "INIT";
2739 default:2741 default:
drivers/gpu/drm/i915/i915_drv.h+5−0
@@ -199,6 +199,7 @@ enum intel_display_power_domain { · 198 unmodified lines
199 POWER_DOMAIN_AUX_B,199 POWER_DOMAIN_AUX_B,
200 POWER_DOMAIN_AUX_C,200 POWER_DOMAIN_AUX_C,
201 POWER_DOMAIN_AUX_D,201 POWER_DOMAIN_AUX_D,
202 POWER_DOMAIN_GMBUS,
202 POWER_DOMAIN_INIT,203 POWER_DOMAIN_INIT,
203 204
204 POWER_DOMAIN_NUM,205 POWER_DOMAIN_NUM,
@@ -351,6 +352,8 @@ enum intel_dpll_id { · 146 unmodified lines
351 /* hsw/bdw */352 /* hsw/bdw */
352 DPLL_ID_WRPLL1 = 0,353 DPLL_ID_WRPLL1 = 0,
353 DPLL_ID_WRPLL2 = 1,354 DPLL_ID_WRPLL2 = 1,
355 DPLL_ID_SPLL = 2,
356
354 /* skl */357 /* skl */
355 DPLL_ID_SKL_DPLL1 = 0,358 DPLL_ID_SKL_DPLL1 = 0,
356 DPLL_ID_SKL_DPLL2 = 1,359 DPLL_ID_SKL_DPLL2 = 1,
@@ -367,6 +370,7 @@ struct intel_dpll_hw_state { · 10 unmodified lines
367 370
368 /* hsw, bdw */371 /* hsw, bdw */
369 uint32_t wrpll;372 uint32_t wrpll;
373 uint32_t spll;
370 374
371 /* skl */375 /* skl */
372 /*376 /*
@@ -2648,6 +2652,7 @@ struct i915_params { · 2275 unmodified lines
2648 int enable_cmd_parser;2652 int enable_cmd_parser;
2649 /* leave bools at the end to not create holes */2653 /* leave bools at the end to not create holes */
2650 bool enable_hangcheck;2654 bool enable_hangcheck;
2655 bool fastboot;
2651 bool prefault_disable;2656 bool prefault_disable;
2652 bool load_detect_test;2657 bool load_detect_test;
2653 bool reset;2658 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
1210 if (i915_gem_request_completed(req, true))1210 if (i915_gem_request_completed(req, true))
1211 return 0;1211 return 0;
1212 1212
1213 timeout_expire = timeout ?1213 timeout_expire = 0;
1214 jiffies + nsecs_to_jiffies_timeout((u64)*timeout) : 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 }
1215 1223
1216 if (INTEL_INFO(dev_priv)->gen >= 6)1224 if (INTEL_INFO(dev_priv)->gen >= 6)
1217 gen6_rps_boost(dev_priv, rps, req->emitted_jiffies);1225 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
3809int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,3817int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,
3810 struct drm_file *file)3818 struct drm_file *file)
3811{3819{
3820 struct drm_i915_private *dev_priv = dev->dev_private;
3812 struct drm_i915_gem_caching *args = data;3821 struct drm_i915_gem_caching *args = data;
3813 struct drm_i915_gem_object *obj;3822 struct drm_i915_gem_object *obj;
3814 enum i915_cache_level level;3823 enum i915_cache_level level;
@@ -3837,9 +3846,11 @@ int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data, · 22 unmodified lines
3837 return -EINVAL;3846 return -EINVAL;
3838 }3847 }
3839 3848
3849 intel_runtime_pm_get(dev_priv);
3850
3840 ret = i915_mutex_lock_interruptible(dev);3851 ret = i915_mutex_lock_interruptible(dev);
3841 if (ret)3852 if (ret)
3842 return ret;3853 goto rpm_put;
3843 3854
3844 obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle));3855 obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle));
3845 if (&obj->base == NULL) {3856 if (&obj->base == NULL) {
@@ -3852,6 +3863,9 @@ int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data, · 6 unmodified lines
3852 drm_gem_object_unreference(&obj->base);3863 drm_gem_object_unreference(&obj->base);
3853unlock:3864unlock:
3854 mutex_unlock(&dev->struct_mutex);3865 mutex_unlock(&dev->struct_mutex);
3866rpm_put:
3867 intel_runtime_pm_put(dev_priv);
3868
3855 return ret;3869 return ret;
3856}3870}
3857 3871
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
642 }642 }
643 643
644 /* check for L-shaped memory aka modified enhanced addressing */644 /* check for L-shaped memory aka modified enhanced addressing */
645 if (IS_GEN4(dev)) {645 if (IS_GEN4(dev) &&
646 uint32_t ddc2 = I915_READ(DCC2);646 !(I915_READ(DCC2) & DCC2_MODIFIED_ENHANCED_DISABLE)) {
647 647 swizzle_x = I915_BIT_6_SWIZZLE_UNKNOWN;
648 if (!(ddc2 & DCC2_MODIFIED_ENHANCED_DISABLE))648 swizzle_y = I915_BIT_6_SWIZZLE_UNKNOWN;
649 dev_priv->quirks |= QUIRK_PIN_SWIZZLED_PAGES;
650 }649 }
651 650
652 if (dcc == 0xffffffff) {651 if (dcc == 0xffffffff) {
@@ -675,16 +674,35 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev) · 22 unmodified lines
675 * matching, which was the case for the swizzling required in674 * matching, which was the case for the swizzling required in
676 * the table above, or from the 1-ch value being less than675 * the table above, or from the 1-ch value being less than
677 * the minimum size of a rank.676 * 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.
678 */683 */
679 if (I915_READ16(C0DRB3) != I915_READ16(C1DRB3)) {684 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 {
683 swizzle_x = I915_BIT_6_SWIZZLE_9_10;685 swizzle_x = I915_BIT_6_SWIZZLE_9_10;
684 swizzle_y = I915_BIT_6_SWIZZLE_9;686 swizzle_y = I915_BIT_6_SWIZZLE_9;
685 }687 }
686 }688 }
687 689
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
688 dev_priv->mm.bit_6_swizzle_x = swizzle_x;706 dev_priv->mm.bit_6_swizzle_x = swizzle_x;
689 dev_priv->mm.bit_6_swizzle_y = swizzle_y;707 dev_priv->mm.bit_6_swizzle_y = swizzle_y;
690}708}
drivers/gpu/drm/i915/i915_params.c+5−0
@@ -40,6 +40,7 @@ struct i915_params i915 __read_mostly = { · 39 unmodified lines
40 .preliminary_hw_support = IS_ENABLED(CONFIG_DRM_I915_PRELIMINARY_HW_SUPPORT),40 .preliminary_hw_support = IS_ENABLED(CONFIG_DRM_I915_PRELIMINARY_HW_SUPPORT),
41 .disable_power_well = -1,41 .disable_power_well = -1,
42 .enable_ips = 1,42 .enable_ips = 1,
43 .fastboot = 0,
43 .prefault_disable = 0,44 .prefault_disable = 0,
44 .load_detect_test = 0,45 .load_detect_test = 0,
45 .reset = true,46 .reset = true,
@@ -133,6 +134,10 @@ MODULE_PARM_DESC(disable_power_well, · 87 unmodified lines
133module_param_named_unsafe(enable_ips, i915.enable_ips, int, 0600);134module_param_named_unsafe(enable_ips, i915.enable_ips, int, 0600);
134MODULE_PARM_DESC(enable_ips, "Enable IPS (default: true)");135MODULE_PARM_DESC(enable_ips, "Enable IPS (default: true)");
135 136
137module_param_named(fastboot, i915.fastboot, bool, 0600);
138MODULE_PARM_DESC(fastboot,
139 "Try to skip unnecessary mode sets at boot time (default: false)");
140
136module_param_named_unsafe(prefault_disable, i915.prefault_disable, bool, 0600);141module_param_named_unsafe(prefault_disable, i915.prefault_disable, bool, 0600);
137MODULE_PARM_DESC(prefault_disable,142MODULE_PARM_DESC(prefault_disable,
138 "Disable page prefaulting for pread/pwrite/reloc (default:false). "143 "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
138 pipe_config->base.adjusted_mode.flags |= intel_crt_get_flags(encoder);138 pipe_config->base.adjusted_mode.flags |= intel_crt_get_flags(encoder);
139}139}
140 140
141static 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
153/* Note: The caller is required to filter out dpms modes not supported by the141/* Note: The caller is required to filter out dpms modes not supported by the
154 * platform. */142 * platform. */
155static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode)143static 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
216 intel_disable_crt(encoder);204 intel_disable_crt(encoder);
217}205}
218 206
219static 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
232static void intel_enable_crt(struct intel_encoder *encoder)207static void intel_enable_crt(struct intel_encoder *encoder)
233{208{
234 struct intel_crt *crt = intel_encoder_to_crt(encoder);209 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
280 if (HAS_DDI(dev)) {255 if (HAS_DDI(dev)) {
281 pipe_config->ddi_pll_sel = PORT_CLK_SEL_SPLL;256 pipe_config->ddi_pll_sel = PORT_CLK_SEL_SPLL;
282 pipe_config->port_clock = 135000 * 2;257 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;
283 }262 }
284 263
285 return true;264 return true;
@@ -860,8 +839,6 @@ void intel_crt_init(struct drm_device *dev) · 574 unmodified lines
860 if (HAS_DDI(dev)) {839 if (HAS_DDI(dev)) {
861 crt->base.get_config = hsw_crt_get_config;840 crt->base.get_config = hsw_crt_get_config;
862 crt->base.get_hw_state = intel_ddi_get_hw_state;841 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;
865 } else {842 } else {
866 crt->base.get_config = intel_crt_get_config;843 crt->base.get_config = intel_crt_get_config;
867 crt->base.get_hw_state = intel_crt_get_hw_state;844 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
1286 }1286 }
1287 1287
1288 crtc_state->ddi_pll_sel = PORT_CLK_SEL_WRPLL(pll->id);1288 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;
1289 }1301 }
1290 1302
1291 return true;1303 return true;
@@ -2437,7 +2449,7 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder) · 1145 unmodified lines
2437 }2449 }
2438}2450}
2439 2451
2440static void hsw_ddi_pll_enable(struct drm_i915_private *dev_priv,2452static void hsw_ddi_wrpll_enable(struct drm_i915_private *dev_priv,
2441 struct intel_shared_dpll *pll)2453 struct intel_shared_dpll *pll)
2442{2454{
2443 I915_WRITE(WRPLL_CTL(pll->id), pll->config.hw_state.wrpll);2455 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
2445 udelay(20);2457 udelay(20);
2446}2458}
2447 2459
2448static void hsw_ddi_pll_disable(struct drm_i915_private *dev_priv,2460static void hsw_ddi_spll_enable(struct drm_i915_private *dev_priv,
2449 struct intel_shared_dpll *pll)2461 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
2468static void hsw_ddi_wrpll_disable(struct drm_i915_private *dev_priv,
2469 struct intel_shared_dpll *pll)
2450{2470{
2451 uint32_t val;2471 uint32_t val;
2452 2472
@@ -2455,9 +2475,19 @@ static void hsw_ddi_pll_disable(struct drm_i915_private *dev_priv, · 2 unmodified lines
2455 POSTING_READ(WRPLL_CTL(pll->id));2475 POSTING_READ(WRPLL_CTL(pll->id));
2456}2476}
2457 2477
2458static bool hsw_ddi_pll_get_hw_state(struct drm_i915_private *dev_priv,2478static void hsw_ddi_spll_disable(struct drm_i915_private *dev_priv,
2459 struct intel_shared_dpll *pll,2479 struct intel_shared_dpll *pll)
2460 struct intel_dpll_hw_state *hw_state)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
2488static 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)
2461{2491{
2462 uint32_t val;2492 uint32_t val;
2463 2493
@@ -2470,25 +2500,50 @@ static bool hsw_ddi_pll_get_hw_state(struct drm_i915_private *dev_priv, · 6 unmodified lines
2470 return val & WRPLL_PLL_ENABLE;2500 return val & WRPLL_PLL_ENABLE;
2471}2501}
2472 2502
2503static 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
2473static const char * const hsw_ddi_pll_names[] = {2519static const char * const hsw_ddi_pll_names[] = {
2474 "WRPLL 1",2520 "WRPLL 1",
2475 "WRPLL 2",2521 "WRPLL 2",
2522 "SPLL"
2476};2523};
2477 2524
2478static void hsw_shared_dplls_init(struct drm_i915_private *dev_priv)2525static void hsw_shared_dplls_init(struct drm_i915_private *dev_priv)
2479{2526{
2480 int i;2527 int i;
2481 2528
2482 dev_priv->num_shared_dpll = 2;2529 dev_priv->num_shared_dpll = 3;
2483 2530
2484 for (i = 0; i < dev_priv->num_shared_dpll; i++) {2531 for (i = 0; i < 2; i++) {
2485 dev_priv->shared_dplls[i].id = i;2532 dev_priv->shared_dplls[i].id = i;
2486 dev_priv->shared_dplls[i].name = hsw_ddi_pll_names[i];2533 dev_priv->shared_dplls[i].name = hsw_ddi_pll_names[i];
2487 dev_priv->shared_dplls[i].disable = hsw_ddi_pll_disable;2534 dev_priv->shared_dplls[i].disable = hsw_ddi_wrpll_disable;
2488 dev_priv->shared_dplls[i].enable = hsw_ddi_pll_enable;2535 dev_priv->shared_dplls[i].enable = hsw_ddi_wrpll_enable;
2489 dev_priv->shared_dplls[i].get_hw_state =2536 dev_priv->shared_dplls[i].get_hw_state =
2490 hsw_ddi_pll_get_hw_state;2537 hsw_ddi_wrpll_get_hw_state;
2491 }2538 }
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
2492}2547}
2493 2548
2494static const char * const skl_ddi_pll_names[] = {2549static 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
2646 return;2646 return;
2647 2647
2648valid_fb:2648valid_fb:
2649 plane_state->src_x = plane_state->src_y = 0;2649 plane_state->src_x = 0;
2650 plane_state->src_y = 0;
2650 plane_state->src_w = fb->width << 16;2651 plane_state->src_w = fb->width << 16;
2651 plane_state->src_h = fb->height << 16;2652 plane_state->src_h = fb->height << 16;
2652 2653
2653 plane_state->crtc_x = plane_state->src_y = 0;2654 plane_state->crtc_x = 0;
2655 plane_state->crtc_y = 0;
2654 plane_state->crtc_w = fb->width;2656 plane_state->crtc_w = fb->width;
2655 plane_state->crtc_h = fb->height;2657 plane_state->crtc_h = fb->height;
2656 2658
@@ -4237,6 +4239,7 @@ struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc, · 1580 unmodified lines
4237 struct intel_shared_dpll *pll;4239 struct intel_shared_dpll *pll;
4238 struct intel_shared_dpll_config *shared_dpll;4240 struct intel_shared_dpll_config *shared_dpll;
4239 enum intel_dpll_id i;4241 enum intel_dpll_id i;
4242 int max = dev_priv->num_shared_dpll;
4240 4243
4241 shared_dpll = intel_atomic_get_shared_dpll_state(crtc_state->base.state);4244 shared_dpll = intel_atomic_get_shared_dpll_state(crtc_state->base.state);
4242 4245
@@ -4271,9 +4274,11 @@ struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc, · 28 unmodified lines
4271 WARN_ON(shared_dpll[i].crtc_mask);4274 WARN_ON(shared_dpll[i].crtc_mask);
4272 4275
4273 goto found;4276 goto found;
4274 }4277 } else if (INTEL_INFO(dev_priv)->gen < 9 && HAS_DDI(dev_priv))
4278 /* Do not consider SPLL */
4279 max = 2;
4275 4280
4276 for (i = 0; i < dev_priv->num_shared_dpll; i++) {4281 for (i = 0; i < max; i++) {
4277 pll = &dev_priv->shared_dplls[i];4282 pll = &dev_priv->shared_dplls[i];
4278 4283
4279 /* Only want to check enabled timings first */4284 /* 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
5189 case PORT_E:5194 case PORT_E:
5190 return POWER_DOMAIN_PORT_DDI_E_2_LANES;5195 return POWER_DOMAIN_PORT_DDI_E_2_LANES;
5191 default:5196 default:
5192 WARN_ON_ONCE(1);5197 MISSING_CASE(port);
5193 return POWER_DOMAIN_PORT_OTHER;5198 return POWER_DOMAIN_PORT_OTHER;
5194 }5199 }
5195}5200}
5196 5201
5202static 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
5197#define for_each_power_domain(domain, mask) \5222#define for_each_power_domain(domain, mask) \
5198 for ((domain) = 0; (domain) < POWER_DOMAIN_NUM; (domain)++) \5223 for ((domain) = 0; (domain) < POWER_DOMAIN_NUM; (domain)++) \
5199 if ((1 << (domain)) & (mask))5224 if ((1 << (domain)) & (mask))
@@ -5225,6 +5250,36 @@ intel_display_port_power_domain(struct intel_encoder *intel_encoder) · 25 unmodified lines
5225 }5250 }
5226}5251}
5227 5252
5253enum intel_display_power_domain
5254intel_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
5228static unsigned long get_crtc_power_domains(struct drm_crtc *crtc)5283static unsigned long get_crtc_power_domains(struct drm_crtc *crtc)
5229{5284{
5230 struct drm_device *dev = crtc->dev;5285 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
9723 case PORT_CLK_SEL_WRPLL2:9778 case PORT_CLK_SEL_WRPLL2:
9724 pipe_config->shared_dpll = DPLL_ID_WRPLL2;9779 pipe_config->shared_dpll = DPLL_ID_WRPLL2;
9725 break;9780 break;
9781 case PORT_CLK_SEL_SPLL:
9782 pipe_config->shared_dpll = DPLL_ID_SPLL;
9726 }9783 }
9727}9784}
9728 9785
@@ -12003,9 +12060,10 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc, · 2274 unmodified lines
12003 pipe_config->dpll_hw_state.cfgcr1,12060 pipe_config->dpll_hw_state.cfgcr1,
12004 pipe_config->dpll_hw_state.cfgcr2);12061 pipe_config->dpll_hw_state.cfgcr2);
12005 } else if (HAS_DDI(dev)) {12062 } 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",
12007 pipe_config->ddi_pll_sel,12064 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);
12009 } else {12067 } else {
12010 DRM_DEBUG_KMS("dpll_hw_state: dpll: 0x%x, dpll_md: 0x%x, "12068 DRM_DEBUG_KMS("dpll_hw_state: dpll: 0x%x, dpll_md: 0x%x, "
12011 "fp0: 0x%x, fp1: 0x%x\n",12069 "fp0: 0x%x, fp1: 0x%x\n",
@@ -12452,7 +12510,6 @@ intel_pipe_config_compare(struct drm_device *dev, · 440 unmodified lines
12452 if (INTEL_INFO(dev)->gen < 8) {12510 if (INTEL_INFO(dev)->gen < 8) {
12453 PIPE_CONF_CHECK_M_N(dp_m_n);12511 PIPE_CONF_CHECK_M_N(dp_m_n);
12454 12512
12455 PIPE_CONF_CHECK_I(has_drrs);
12456 if (current_config->has_drrs)12513 if (current_config->has_drrs)
12457 PIPE_CONF_CHECK_M_N(dp_m2_n2);12514 PIPE_CONF_CHECK_M_N(dp_m2_n2);
12458 } else12515 } else
@@ -12528,6 +12585,7 @@ intel_pipe_config_compare(struct drm_device *dev, · 69 unmodified lines
12528 PIPE_CONF_CHECK_X(dpll_hw_state.fp0);12585 PIPE_CONF_CHECK_X(dpll_hw_state.fp0);
12529 PIPE_CONF_CHECK_X(dpll_hw_state.fp1);12586 PIPE_CONF_CHECK_X(dpll_hw_state.fp1);
12530 PIPE_CONF_CHECK_X(dpll_hw_state.wrpll);12587 PIPE_CONF_CHECK_X(dpll_hw_state.wrpll);
12588 PIPE_CONF_CHECK_X(dpll_hw_state.spll);
12531 PIPE_CONF_CHECK_X(dpll_hw_state.ctrl1);12589 PIPE_CONF_CHECK_X(dpll_hw_state.ctrl1);
12532 PIPE_CONF_CHECK_X(dpll_hw_state.cfgcr1);12590 PIPE_CONF_CHECK_X(dpll_hw_state.cfgcr1);
12533 PIPE_CONF_CHECK_X(dpll_hw_state.cfgcr2);12591 PIPE_CONF_CHECK_X(dpll_hw_state.cfgcr2);
@@ -13032,6 +13090,9 @@ static int intel_atomic_check(struct drm_device *dev, · 498 unmodified lines
13032 struct intel_crtc_state *pipe_config =13090 struct intel_crtc_state *pipe_config =
13033 to_intel_crtc_state(crtc_state);13091 to_intel_crtc_state(crtc_state);
13034 13092
13093 memset(&to_intel_crtc(crtc)->atomic, 0,
13094 sizeof(struct intel_crtc_atomic_commit));
13095
13035 /* Catch I915_MODE_FLAG_INHERITED */13096 /* Catch I915_MODE_FLAG_INHERITED */
13036 if (crtc_state->mode.private_flags != crtc->state->mode.private_flags)13097 if (crtc_state->mode.private_flags != crtc->state->mode.private_flags)
13037 crtc_state->mode_changed = true;13098 crtc_state->mode_changed = true;
@@ -13056,7 +13117,8 @@ static int intel_atomic_check(struct drm_device *dev, · 18 unmodified lines
13056 if (ret)13117 if (ret)
13057 return ret;13118 return ret;
13058 13119
13059 if (intel_pipe_config_compare(state->dev,13120 if (i915.fastboot &&
13121 intel_pipe_config_compare(state->dev,
13060 to_intel_crtc_state(crtc->state),13122 to_intel_crtc_state(crtc->state),
13061 pipe_config, true)) {13123 pipe_config, true)) {
13062 crtc_state->mode_changed = false;13124 crtc_state->mode_changed = false;
@@ -14364,16 +14426,17 @@ static int intel_framebuffer_init(struct drm_device *dev, · 1301 unmodified lines
14364static struct drm_framebuffer *14426static struct drm_framebuffer *
14365intel_user_framebuffer_create(struct drm_device *dev,14427intel_user_framebuffer_create(struct drm_device *dev,
14366 struct drm_file *filp,14428 struct drm_file *filp,
14367 struct drm_mode_fb_cmd2 *mode_cmd)14429 struct drm_mode_fb_cmd2 *user_mode_cmd)
14368{14430{
14369 struct drm_i915_gem_object *obj;14431 struct drm_i915_gem_object *obj;
14432 struct drm_mode_fb_cmd2 mode_cmd = *user_mode_cmd;
14370 14433
14371 obj = to_intel_bo(drm_gem_object_lookup(dev, filp,14434 obj = to_intel_bo(drm_gem_object_lookup(dev, filp,
14372 mode_cmd->handles[0]));14435 mode_cmd.handles[0]));
14373 if (&obj->base == NULL)14436 if (&obj->base == NULL)
14374 return ERR_PTR(-ENOENT);14437 return ERR_PTR(-ENOENT);
14375 14438
14376 return intel_framebuffer_create(dev, mode_cmd, obj);14439 return intel_framebuffer_create(dev, &mode_cmd, obj);
14377}14440}
14378 14441
14379#ifndef CONFIG_DRM_FBDEV_EMULATION14442#ifndef CONFIG_DRM_FBDEV_EMULATION
@@ -14705,6 +14768,9 @@ static struct intel_quirk intel_quirks[] = { · 325 unmodified lines
14705 /* Apple Macbook 2,1 (Core 2 T7400) */14768 /* Apple Macbook 2,1 (Core 2 T7400) */
14706 { 0x27a2, 0x8086, 0x7270, quirk_backlight_present },14769 { 0x27a2, 0x8086, 0x7270, quirk_backlight_present },
14707 14770
14771 /* Apple Macbook 4,1 */
14772 { 0x2a02, 0x106b, 0x00a1, quirk_backlight_present },
14773
14708 /* Toshiba CB35 Chromebook (Celeron 2955U) */14774 /* Toshiba CB35 Chromebook (Celeron 2955U) */
14709 { 0x0a06, 0x1179, 0x0a88, quirk_backlight_present },14775 { 0x0a06, 0x1179, 0x0a88, quirk_backlight_present },
14710 14776
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
277 * See vlv_power_sequencer_reset() why we need277 * See vlv_power_sequencer_reset() why we need
278 * a power domain reference here.278 * a power domain reference here.
279 */279 */
280 power_domain = intel_display_port_power_domain(encoder);280 power_domain = intel_display_port_aux_power_domain(encoder);
281 intel_display_power_get(dev_priv, power_domain);281 intel_display_power_get(dev_priv, power_domain);
282 282
283 mutex_lock(&dev_priv->pps_mutex);283 mutex_lock(&dev_priv->pps_mutex);
@@ -293,7 +293,7 @@ static void pps_unlock(struct intel_dp *intel_dp) · 9 unmodified lines
293 293
294 mutex_unlock(&dev_priv->pps_mutex);294 mutex_unlock(&dev_priv->pps_mutex);
295 295
296 power_domain = intel_display_port_power_domain(encoder);296 power_domain = intel_display_port_aux_power_domain(encoder);
297 intel_display_power_put(dev_priv, power_domain);297 intel_display_power_put(dev_priv, power_domain);
298}298}
299 299
@@ -816,8 +816,6 @@ intel_dp_aux_ch(struct intel_dp *intel_dp, · 516 unmodified lines
816 816
817 intel_dp_check_edp(intel_dp);817 intel_dp_check_edp(intel_dp);
818 818
819 intel_aux_display_runtime_get(dev_priv);
820
821 /* Try to wait for any previous AUX channel activity */819 /* Try to wait for any previous AUX channel activity */
822 for (try = 0; try < 3; try++) {820 for (try = 0; try < 3; try++) {
823 status = I915_READ_NOTRACE(ch_ctl);821 status = I915_READ_NOTRACE(ch_ctl);
@@ -926,7 +924,6 @@ done: · 102 unmodified lines
926 ret = recv_bytes;924 ret = recv_bytes;
927out:925out:
928 pm_qos_update_request(&dev_priv->pm_qos, PM_QOS_DEFAULT_VALUE);926 pm_qos_update_request(&dev_priv->pm_qos, PM_QOS_DEFAULT_VALUE);
929 intel_aux_display_runtime_put(dev_priv);
930 927
931 if (vdd)928 if (vdd)
932 edp_panel_vdd_off(intel_dp, false);929 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
1784 if (edp_have_panel_vdd(intel_dp))1781 if (edp_have_panel_vdd(intel_dp))
1785 return need_to_disable;1782 return need_to_disable;
1786 1783
1787 power_domain = intel_display_port_power_domain(intel_encoder);1784 power_domain = intel_display_port_aux_power_domain(intel_encoder);
1788 intel_display_power_get(dev_priv, power_domain);1785 intel_display_power_get(dev_priv, power_domain);
1789 1786
1790 DRM_DEBUG_KMS("Turning eDP port %c VDD on\n",1787 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
1874 if ((pp & POWER_TARGET_ON) == 0)1871 if ((pp & POWER_TARGET_ON) == 0)
1875 intel_dp->last_power_cycle = jiffies;1872 intel_dp->last_power_cycle = jiffies;
1876 1873
1877 power_domain = intel_display_port_power_domain(intel_encoder);1874 power_domain = intel_display_port_aux_power_domain(intel_encoder);
1878 intel_display_power_put(dev_priv, power_domain);1875 intel_display_power_put(dev_priv, power_domain);
1879}1876}
1880 1877
@@ -2025,7 +2022,7 @@ static void edp_panel_off(struct intel_dp *intel_dp) · 144 unmodified lines
2025 wait_panel_off(intel_dp);2022 wait_panel_off(intel_dp);
2026 2023
2027 /* We got a reference when we enabled the VDD. */2024 /* 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);
2029 intel_display_power_put(dev_priv, power_domain);2026 intel_display_power_put(dev_priv, power_domain);
2030}2027}
2031 2028
@@ -4765,26 +4762,6 @@ intel_dp_unset_edid(struct intel_dp *intel_dp) · 2733 unmodified lines
4765 intel_dp->has_audio = false;4762 intel_dp->has_audio = false;
4766}4763}
4767 4764
4768static enum intel_display_power_domain
4769intel_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
4780static void
4781intel_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
4788static enum drm_connector_status4765static enum drm_connector_status
4789intel_dp_detect(struct drm_connector *connector, bool force)4766intel_dp_detect(struct drm_connector *connector, bool force)
4790{4767{
@@ -4808,7 +4785,8 @@ intel_dp_detect(struct drm_connector *connector, bool force) · 17 unmodified lines
4808 return connector_status_disconnected;4785 return connector_status_disconnected;
4809 }4786 }
4810 4787
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);
4812 4790
4813 /* Can't disconnect eDP, but you can close the lid... */4791 /* Can't disconnect eDP, but you can close the lid... */
4814 if (is_edp(intel_dp))4792 if (is_edp(intel_dp))
@@ -4853,7 +4831,7 @@ intel_dp_detect(struct drm_connector *connector, bool force) · 38 unmodified lines
4853 }4831 }
4854 4832
4855out:4833out:
4856 intel_dp_power_put(intel_dp, power_domain);4834 intel_display_power_put(to_i915(dev), power_domain);
4857 return status;4835 return status;
4858}4836}
4859 4837
@@ -4862,6 +4840,7 @@ intel_dp_force(struct drm_connector *connector) · 2 unmodified lines
4862{4840{
4863 struct intel_dp *intel_dp = intel_attached_dp(connector);4841 struct intel_dp *intel_dp = intel_attached_dp(connector);
4864 struct intel_encoder *intel_encoder = &dp_to_dig_port(intel_dp)->base;4842 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);
4865 enum intel_display_power_domain power_domain;4844 enum intel_display_power_domain power_domain;
4866 4845
4867 DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",4846 DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
@@ -4871,11 +4850,12 @@ intel_dp_force(struct drm_connector *connector) · 3 unmodified lines
4871 if (connector->status != connector_status_connected)4850 if (connector->status != connector_status_connected)
4872 return;4851 return;
4873 4852
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);
4875 4855
4876 intel_dp_set_edid(intel_dp);4856 intel_dp_set_edid(intel_dp);
4877 4857
4878 intel_dp_power_put(intel_dp, power_domain);4858 intel_display_power_put(dev_priv, power_domain);
4879 4859
4880 if (intel_encoder->type != INTEL_OUTPUT_EDP)4860 if (intel_encoder->type != INTEL_OUTPUT_EDP)
4881 intel_encoder->type = INTEL_OUTPUT_DISPLAYPORT;4861 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
5091 * indefinitely.5071 * indefinitely.
5092 */5072 */
5093 DRM_DEBUG_KMS("VDD left on by BIOS, adjusting state tracking\n");5073 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);
5095 intel_display_power_get(dev_priv, power_domain);5075 intel_display_power_get(dev_priv, power_domain);
5096 5076
5097 edp_panel_vdd_schedule_off(intel_dp);5077 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
5153 enum intel_display_power_domain power_domain;5133 enum intel_display_power_domain power_domain;
5154 enum irqreturn ret = IRQ_NONE;5134 enum irqreturn ret = IRQ_NONE;
5155 5135
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)
5157 intel_dig_port->base.type = INTEL_OUTPUT_DISPLAYPORT;5138 intel_dig_port->base.type = INTEL_OUTPUT_DISPLAYPORT;
5158 5139
5159 if (long_hpd && intel_dig_port->base.type == INTEL_OUTPUT_EDP) {5140 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
5172 port_name(intel_dig_port->port),5153 port_name(intel_dig_port->port),
5173 long_hpd ? "long" : "short");5154 long_hpd ? "long" : "short");
5174 5155
5175 power_domain = intel_display_port_power_domain(intel_encoder);5156 power_domain = intel_display_port_aux_power_domain(intel_encoder);
5176 intel_display_power_get(dev_priv, power_domain);5157 intel_display_power_get(dev_priv, power_domain);
5177 5158
5178 if (long_hpd) {5159 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
1169void hsw_disable_ips(struct intel_crtc *crtc);1169void hsw_disable_ips(struct intel_crtc *crtc);
1170enum intel_display_power_domain1170enum intel_display_power_domain
1171intel_display_port_power_domain(struct intel_encoder *intel_encoder);1171intel_display_port_power_domain(struct intel_encoder *intel_encoder);
1172enum intel_display_power_domain
1173intel_display_port_aux_power_domain(struct intel_encoder *intel_encoder);
1172void intel_mode_from_pipe_config(struct drm_display_mode *mode,1174void intel_mode_from_pipe_config(struct drm_display_mode *mode,
1173 struct intel_crtc_state *pipe_config);1175 struct intel_crtc_state *pipe_config);
1174void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc);1176void 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
1377 enum intel_display_power_domain domain);1379 enum intel_display_power_domain domain);
1378void intel_display_power_put(struct drm_i915_private *dev_priv,1380void intel_display_power_put(struct drm_i915_private *dev_priv,
1379 enum intel_display_power_domain domain);1381 enum intel_display_power_domain domain);
1380void intel_aux_display_runtime_get(struct drm_i915_private *dev_priv);
1381void intel_aux_display_runtime_put(struct drm_i915_private *dev_priv);
1382void intel_runtime_pm_get(struct drm_i915_private *dev_priv);1382void intel_runtime_pm_get(struct drm_i915_private *dev_priv);
1383void intel_runtime_pm_get_noresume(struct drm_i915_private *dev_priv);1383void intel_runtime_pm_get_noresume(struct drm_i915_private *dev_priv);
1384void intel_runtime_pm_put(struct drm_i915_private *dev_priv);1384void 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
1335{1335{
1336 struct drm_i915_private *dev_priv = to_i915(connector->dev);1336 struct drm_i915_private *dev_priv = to_i915(connector->dev);
1337 struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);1337 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;
1341 struct edid *edid = NULL;1338 struct edid *edid = NULL;
1342 bool connected = false;1339 bool connected = false;
1343 1340
1344 power_domain = intel_display_port_power_domain(intel_encoder);1341 intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
1345 intel_display_power_get(dev_priv, power_domain);
1346 1342
1347 if (force)1343 if (force)
1348 edid = drm_get_edid(connector,1344 edid = drm_get_edid(connector,
1349 intel_gmbus_get_adapter(dev_priv,1345 intel_gmbus_get_adapter(dev_priv,
1350 intel_hdmi->ddc_bus));1346 intel_hdmi->ddc_bus));
1351 1347
1352 intel_display_power_put(dev_priv, power_domain);1348 intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
1353 1349
1354 to_intel_connector(connector)->detect_edid = edid;1350 to_intel_connector(connector)->detect_edid = edid;
1355 if (edid && edid->input & DRM_EDID_INPUT_DIGITAL) {1351 if (edid && edid->input & DRM_EDID_INPUT_DIGITAL) {
@@ -1383,6 +1379,8 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) · 27 unmodified lines
1383 DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",1379 DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
1384 connector->base.id, connector->name);1380 connector->base.id, connector->name);
1385 1381
1382 intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
1383
1386 while (!live_status && --retry) {1384 while (!live_status && --retry) {
1387 live_status = intel_digital_port_connected(dev_priv,1385 live_status = intel_digital_port_connected(dev_priv,
1388 hdmi_to_dig_port(intel_hdmi));1386 hdmi_to_dig_port(intel_hdmi));
@@ -1402,6 +1400,8 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) · 13 unmodified lines
1402 } else1400 } else
1403 status = connector_status_disconnected;1401 status = connector_status_disconnected;
1404 1402
1403 intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
1404
1405 return status;1405 return status;
1406}1406}
1407 1407
drivers/gpu/drm/i915/intel_i2c.c+4−2
@@ -483,7 +483,7 @@ gmbus_xfer(struct i2c_adapter *adapter, · 482 unmodified lines
483 int i = 0, inc, try = 0;483 int i = 0, inc, try = 0;
484 int ret = 0;484 int ret = 0;
485 485
486 intel_aux_display_runtime_get(dev_priv);486 intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
487 mutex_lock(&dev_priv->gmbus_mutex);487 mutex_lock(&dev_priv->gmbus_mutex);
488 488
489 if (bus->force_bit) {489 if (bus->force_bit) {
@@ -595,7 +595,9 @@ timeout: · 105 unmodified lines
595 595
596out:596out:
597 mutex_unlock(&dev_priv->gmbus_mutex);597 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
599 return ret;601 return ret;
600}602}
601 603
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
4449 POSTING_READ(GEN6_RPNSWREQ);4449 POSTING_READ(GEN6_RPNSWREQ);
4450 4450
4451 dev_priv->rps.cur_freq = val;4451 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));
4453}4453}
4454 4454
4455static void valleyview_set_rps(struct drm_device *dev, u8 val)4455static 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
7255int intel_gpu_freq(struct drm_i915_private *dev_priv, int val)7255int intel_gpu_freq(struct drm_i915_private *dev_priv, int val)
7256{7256{
7257 if (IS_GEN9(dev_priv->dev))7257 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);
7259 else if (IS_CHERRYVIEW(dev_priv->dev))7260 else if (IS_CHERRYVIEW(dev_priv->dev))
7260 return chv_gpu_freq(dev_priv, val);7261 return chv_gpu_freq(dev_priv, val);
7261 else if (IS_VALLEYVIEW(dev_priv->dev))7262 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
7267int intel_freq_opcode(struct drm_i915_private *dev_priv, int val)7268int intel_freq_opcode(struct drm_i915_private *dev_priv, int val)
7268{7269{
7269 if (IS_GEN9(dev_priv->dev))7270 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);
7271 else if (IS_CHERRYVIEW(dev_priv->dev))7273 else if (IS_CHERRYVIEW(dev_priv->dev))
7272 return chv_freq_opcode(dev_priv, val);7274 return chv_freq_opcode(dev_priv, val);
7273 else if (IS_VALLEYVIEW(dev_priv->dev))7275 else if (IS_VALLEYVIEW(dev_priv->dev))
7274 return byt_freq_opcode(dev_priv, val);7276 return byt_freq_opcode(dev_priv, val);
7275 else7277 else
7276 return val / GT_FREQUENCY_MULTIPLIER;7278 return DIV_ROUND_CLOSEST(val, GT_FREQUENCY_MULTIPLIER);
7277}7279}
7278 7280
7279struct request_boost {7281struct 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
362 BIT(POWER_DOMAIN_AUX_C) | \362 BIT(POWER_DOMAIN_AUX_C) | \
363 BIT(POWER_DOMAIN_AUDIO) | \363 BIT(POWER_DOMAIN_AUDIO) | \
364 BIT(POWER_DOMAIN_VGA) | \364 BIT(POWER_DOMAIN_VGA) | \
365 BIT(POWER_DOMAIN_GMBUS) | \
365 BIT(POWER_DOMAIN_INIT))366 BIT(POWER_DOMAIN_INIT))
366#define BXT_DISPLAY_POWERWELL_1_POWER_DOMAINS ( \367#define BXT_DISPLAY_POWERWELL_1_POWER_DOMAINS ( \
367 BXT_DISPLAY_POWERWELL_2_POWER_DOMAINS | \368 BXT_DISPLAY_POWERWELL_2_POWER_DOMAINS | \
@@ -1483,6 +1484,7 @@ void intel_display_power_put(struct drm_i915_private *dev_priv, · 1115 unmodified lines
1483 BIT(POWER_DOMAIN_AUX_B) | \1484 BIT(POWER_DOMAIN_AUX_B) | \
1484 BIT(POWER_DOMAIN_AUX_C) | \1485 BIT(POWER_DOMAIN_AUX_C) | \
1485 BIT(POWER_DOMAIN_AUX_D) | \1486 BIT(POWER_DOMAIN_AUX_D) | \
1487 BIT(POWER_DOMAIN_GMBUS) | \
1486 BIT(POWER_DOMAIN_INIT))1488 BIT(POWER_DOMAIN_INIT))
1487#define HSW_DISPLAY_POWER_DOMAINS ( \1489#define HSW_DISPLAY_POWER_DOMAINS ( \
1488 (POWER_DOMAIN_MASK & ~HSW_ALWAYS_ON_POWER_DOMAINS) | \1490 (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
1845 i915.disable_power_well = sanitize_disable_power_well_option(dev_priv,1847 i915.disable_power_well = sanitize_disable_power_well_option(dev_priv,
1846 i915.disable_power_well);1848 i915.disable_power_well);
1847 1849
1850 BUILD_BUG_ON(POWER_DOMAIN_NUM > 31);
1851
1848 mutex_init(&power_domains->lock);1852 mutex_init(&power_domains->lock);
1849 1853
1850 /*1854 /*
@@ -2063,36 +2067,6 @@ void intel_power_domains_init_hw(struct drm_i915_private *dev_priv) · 212 unmodified lines
2063 power_domains->initializing = false;2067 power_domains->initializing = false;
2064}2068}
2065 2069
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 */
2078void 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 */
2091void intel_aux_display_runtime_put(struct drm_i915_private *dev_priv)
2092{
2093 intel_runtime_pm_put(dev_priv);
2094}
2095
2096/**2070/**
2097 * intel_runtime_pm_get - grab a runtime pm reference2071 * intel_runtime_pm_get - grab a runtime pm reference
2098 * @dev_priv: i915 device instance2072 * @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
63#if IS_ENABLED(CONFIG_DRM_IMX_FB_HELPER)63#if IS_ENABLED(CONFIG_DRM_IMX_FB_HELPER)
64 struct imx_drm_device *imxdrm = drm->dev_private;64 struct imx_drm_device *imxdrm = drm->dev_private;
65 65
66 if (imxdrm->fbhelper)66 drm_fbdev_cma_restore_mode(imxdrm->fbhelper);
67 drm_fbdev_cma_restore_mode(imxdrm->fbhelper);
68#endif67#endif
69}68}
70 69
@@ -340,7 +339,7 @@ err_kms: · 269 unmodified lines
340 * imx_drm_add_crtc - add a new crtc339 * imx_drm_add_crtc - add a new crtc
341 */340 */
342int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc,341int 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,
344 const struct imx_drm_crtc_helper_funcs *imx_drm_helper_funcs,343 const struct imx_drm_crtc_helper_funcs *imx_drm_helper_funcs,
345 struct device_node *port)344 struct device_node *port)
346{345{
@@ -379,7 +378,7 @@ int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc, · 32 unmodified lines
379 drm_crtc_helper_add(crtc,378 drm_crtc_helper_add(crtc,
380 imx_drm_crtc->imx_drm_helper_funcs.crtc_helper_funcs);379 imx_drm_crtc->imx_drm_helper_funcs.crtc_helper_funcs);
381 380
382 drm_crtc_init(drm, crtc,381 drm_crtc_init_with_planes(drm, crtc, primary_plane, NULL,
383 imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs);382 imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs);
384 383
385 return 0;384 return 0;
drivers/gpu/drm/imx/imx-drm.h+2−1
@@ -9,6 +9,7 @@ struct drm_display_mode; · 8 unmodified lines
9struct drm_encoder;9struct drm_encoder;
10struct drm_fbdev_cma;10struct drm_fbdev_cma;
11struct drm_framebuffer;11struct drm_framebuffer;
12struct drm_plane;
12struct imx_drm_crtc;13struct imx_drm_crtc;
13struct platform_device;14struct platform_device;
14 15
@@ -24,7 +25,7 @@ struct imx_drm_crtc_helper_funcs { · 9 unmodified lines
24};25};
25 26
26int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc,27int 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,
28 const struct imx_drm_crtc_helper_funcs *imx_helper_funcs,29 const struct imx_drm_crtc_helper_funcs *imx_helper_funcs,
29 struct device_node *port);30 struct device_node *port);
30int imx_drm_remove_crtc(struct imx_drm_crtc *);31int 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
721 { .compatible = "fsl,imx53-tve", },721 { .compatible = "fsl,imx53-tve", },
722 { /* sentinel */ }722 { /* sentinel */ }
723};723};
724MODULE_DEVICE_TABLE(of, imx_tve_dt_ids);
724 725
725static struct platform_driver imx_tve_driver = {726static struct platform_driver imx_tve_driver = {
726 .probe = imx_tve_probe,727 .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
212 212
213 spin_lock_irqsave(&drm->event_lock, flags);213 spin_lock_irqsave(&drm->event_lock, flags);
214 if (ipu_crtc->page_flip_event)214 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);
216 ipu_crtc->page_flip_event = NULL;217 ipu_crtc->page_flip_event = NULL;
217 imx_drm_crtc_vblank_put(ipu_crtc->imx_crtc);218 imx_drm_crtc_vblank_put(ipu_crtc->imx_crtc);
218 spin_unlock_irqrestore(&drm->event_lock, flags);219 spin_unlock_irqrestore(&drm->event_lock, flags);
@@ -349,7 +350,6 @@ static int ipu_crtc_init(struct ipu_crtc *ipu_crtc, · 130 unmodified lines
349 struct ipu_soc *ipu = dev_get_drvdata(ipu_crtc->dev->parent);350 struct ipu_soc *ipu = dev_get_drvdata(ipu_crtc->dev->parent);
350 int dp = -EINVAL;351 int dp = -EINVAL;
351 int ret;352 int ret;
352 int id;
353 353
354 ret = ipu_get_resources(ipu_crtc, pdata);354 ret = ipu_get_resources(ipu_crtc, pdata);
355 if (ret) {355 if (ret) {
@@ -358,18 +358,23 @@ static int ipu_crtc_init(struct ipu_crtc *ipu_crtc, · 2 unmodified lines
358 return ret;358 return ret;
359 }359 }
360 360
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
361 ret = imx_drm_add_crtc(drm, &ipu_crtc->base, &ipu_crtc->imx_crtc,370 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);
363 if (ret) {373 if (ret) {
364 dev_err(ipu_crtc->dev, "adding crtc failed with %d.\n", ret);374 dev_err(ipu_crtc->dev, "adding crtc failed with %d.\n", ret);
365 goto err_put_resources;375 goto err_put_resources;
366 }376 }
367 377
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);
373 ret = ipu_plane_get_resources(ipu_crtc->plane[0]);378 ret = ipu_plane_get_resources(ipu_crtc->plane[0]);
374 if (ret) {379 if (ret) {
375 dev_err(ipu_crtc->dev, "getting plane 0 resources failed with %d.\n",380 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
379 384
380 /* If this crtc is using the DP, add an overlay plane */385 /* If this crtc is using the DP, add an overlay plane */
381 if (pdata->dp >= 0 && pdata->dma[1] > 0) {386 if (pdata->dp >= 0 && pdata->dma[1] > 0) {
382 ipu_crtc->plane[1] = ipu_plane_init(ipu_crtc->base.dev, ipu,387 ipu_crtc->plane[1] = ipu_plane_init(drm, ipu, pdata->dma[1],
383 pdata->dma[1],388 IPU_DP_FLOW_SYNC_FG,
384 IPU_DP_FLOW_SYNC_FG,389 drm_crtc_mask(&ipu_crtc->base),
385 BIT(id), false);390 DRM_PLANE_TYPE_OVERLAY);
386 if (IS_ERR(ipu_crtc->plane[1]))391 if (IS_ERR(ipu_crtc->plane[1]))
387 ipu_crtc->plane[1] = NULL;392 ipu_crtc->plane[1] = NULL;
388 }393 }
@@ -407,28 +412,6 @@ err_put_resources: · 18 unmodified lines
407 return ret;412 return ret;
408}413}
409 414
410static 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
432static int ipu_drm_bind(struct device *dev, struct device *master, void *data)415static int ipu_drm_bind(struct device *dev, struct device *master, void *data)
433{416{
434 struct ipu_client_platformdata *pdata = dev->platform_data;417 struct ipu_client_platformdata *pdata = dev->platform_data;
@@ -470,23 +453,11 @@ static const struct component_ops ipu_crtc_ops = { · 35 unmodified lines
470static int ipu_drm_probe(struct platform_device *pdev)453static int ipu_drm_probe(struct platform_device *pdev)
471{454{
472 struct device *dev = &pdev->dev;455 struct device *dev = &pdev->dev;
473 struct ipu_client_platformdata *pdata = dev->platform_data;
474 int ret;456 int ret;
475 457
476 if (!dev->platform_data)458 if (!dev->platform_data)
477 return -EINVAL;459 return -EINVAL;
478 460
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
490 ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));461 ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
491 if (ret)462 if (ret)
492 return ret;463 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
381 381
382struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu,382struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu,
383 int dma, int dp, unsigned int possible_crtcs,383 int dma, int dp, unsigned int possible_crtcs,
384 bool priv)384 enum drm_plane_type type)
385{385{
386 struct ipu_plane *ipu_plane;386 struct ipu_plane *ipu_plane;
387 int ret;387 int ret;
@@ -399,10 +399,9 @@ struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu, · 11 unmodified lines
399 ipu_plane->dma = dma;399 ipu_plane->dma = dma;
400 ipu_plane->dp_flow = dp;400 ipu_plane->dp_flow = dp;
401 401
402 ret = drm_plane_init(dev, &ipu_plane->base, possible_crtcs,402 ret = drm_universal_plane_init(dev, &ipu_plane->base, possible_crtcs,
403 &ipu_plane_funcs, ipu_plane_formats,403 &ipu_plane_funcs, ipu_plane_formats,
404 ARRAY_SIZE(ipu_plane_formats),404 ARRAY_SIZE(ipu_plane_formats), type);
405 priv);
406 if (ret) {405 if (ret) {
407 DRM_ERROR("failed to initialize plane\n");406 DRM_ERROR("failed to initialize plane\n");
408 kfree(ipu_plane);407 kfree(ipu_plane);
drivers/gpu/drm/imx/ipuv3-plane.h+1−1
@@ -34,7 +34,7 @@ struct ipu_plane { · 33 unmodified lines
34 34
35struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu,35struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu,
36 int dma, int dp, unsigned int possible_crtcs,36 int dma, int dp, unsigned int possible_crtcs,
37 bool priv);37 enum drm_plane_type type);
38 38
39/* Init IDMAC, DMFC, DP */39/* Init IDMAC, DMFC, DP */
40int ipu_plane_mode_set(struct ipu_plane *plane, struct drm_crtc *crtc,40int 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
54 54
55 if (imxpd->panel && imxpd->panel->funcs &&55 if (imxpd->panel && imxpd->panel->funcs &&
56 imxpd->panel->funcs->get_modes) {56 imxpd->panel->funcs->get_modes) {
57 struct drm_display_info *di = &connector->display_info;
58
57 num_modes = imxpd->panel->funcs->get_modes(imxpd->panel);59 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];
58 if (num_modes > 0)62 if (num_modes > 0)
59 return num_modes;63 return num_modes;
60 }64 }
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
70 BUG_ON(pixels_2 != pixels_current && pixels_2 != pixels_prev);70 BUG_ON(pixels_2 != pixels_current && pixels_2 != pixels_prev);
71 BUG_ON(pixels_current == pixels_prev);71 BUG_ON(pixels_current == pixels_prev);
72 72
73 if (!handle || !file_priv) {
74 mga_hide_cursor(mdev);
75 return 0;
76 }
77
73 obj = drm_gem_object_lookup(dev, file_priv, handle);78 obj = drm_gem_object_lookup(dev, file_priv, handle);
74 if (!obj)79 if (!obj)
75 return -ENOENT;80 return -ENOENT;
@@ -88,12 +93,6 @@ int mga_crtc_cursor_set(struct drm_crtc *crtc, · 12 unmodified lines
88 goto out_unreserve1;93 goto out_unreserve1;
89 }94 }
90 95
91 if (!handle) {
92 mga_hide_cursor(mdev);
93 ret = 0;
94 goto out1;
95 }
96
97 /* Move cursor buffers into VRAM if they aren't already */96 /* Move cursor buffers into VRAM if they aren't already */
98 if (!pixels_1->pin_count) {97 if (!pixels_1->pin_count) {
99 ret = mgag200_bo_pin(pixels_1, TTM_PL_FLAG_VRAM,98 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
7 const struct nvkm_instmem_func *func;7 const struct nvkm_instmem_func *func;
8 struct nvkm_subdev subdev;8 struct nvkm_subdev subdev;
9 9
10 spinlock_t lock;
10 struct list_head list;11 struct list_head list;
11 u32 reserved;12 u32 reserved;
12 13
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
367 return -ENODEV;367 return -ENODEV;
368 }368 }
369 obj = (union acpi_object *)buffer.pointer;369 obj = (union acpi_object *)buffer.pointer;
370 len = min(len, (int)obj->buffer.length);
370 memcpy(bios+offset, obj->buffer.pointer, len);371 memcpy(bios+offset, obj->buffer.pointer, len);
371 kfree(buffer.pointer);372 kfree(buffer.pointer);
372 return len;373 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
829 struct drm_device *dev = drm->dev;829 struct drm_device *dev = drm->dev;
830 struct nouveau_page_flip_state *s;830 struct nouveau_page_flip_state *s;
831 unsigned long flags;831 unsigned long flags;
832 int crtcid = -1;
833 832
834 spin_lock_irqsave(&dev->event_lock, flags);833 spin_lock_irqsave(&dev->event_lock, flags);
835 834
@@ -841,15 +840,19 @@ nouveau_finish_page_flip(struct nouveau_channel *chan, · 5 unmodified lines
841 840
842 s = list_first_entry(&fctx->flip, struct nouveau_page_flip_state, head);841 s = list_first_entry(&fctx->flip, struct nouveau_page_flip_state, head);
843 if (s->event) {842 if (s->event) {
844 /* Vblank timestamps/counts are only correct on >= NV-50 */843 if (drm->device.info.family < NV_DEVICE_INFO_V0_TESLA) {
845 if (drm->device.info.family >= NV_DEVICE_INFO_V0_TESLA)844 drm_arm_vblank_event(dev, s->crtc, s->event);
846 crtcid = s->crtc;845 } else {
846 drm_send_vblank_event(dev, s->crtc, s->event);
847 847
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);
849 }855 }
850
851 /* Give up ownership of vblank for page-flipped crtc */
852 drm_vblank_put(dev, s->crtc);
853 856
854 list_del(&s->head);857 list_del(&s->head);
855 if (ps)858 if (ps)
drivers/gpu/drm/nouveau/nouveau_drm.h+3−1
@@ -39,6 +39,7 @@ · 38 unmodified lines
39 39
40#include <nvif/client.h>40#include <nvif/client.h>
41#include <nvif/device.h>41#include <nvif/device.h>
42#include <nvif/ioctl.h>
42 43
43#include <drmP.h>44#include <drmP.h>
44 45
@@ -65,9 +66,10 @@ struct nouveau_drm_tile { · 20 unmodified lines
65};66};
66 67
67enum nouveau_drm_object_route {68enum nouveau_drm_object_route {
68 NVDRM_OBJECT_NVIF = 0,69 NVDRM_OBJECT_NVIF = NVIF_IOCTL_V0_OWNER_NVIF,
69 NVDRM_OBJECT_USIF,70 NVDRM_OBJECT_USIF,
70 NVDRM_OBJECT_ABI16,71 NVDRM_OBJECT_ABI16,
72 NVDRM_OBJECT_ANY = NVIF_IOCTL_V0_OWNER_ANY,
71};73};
72 74
73enum nouveau_drm_notify_route {75enum 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
313 if (nvif_unpack(argv->v0, 0, 0, true)) {313 if (nvif_unpack(argv->v0, 0, 0, true)) {
314 /* block access to objects not created via this interface */314 /* block access to objects not created via this interface */
315 owner = argv->v0.owner;315 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;
317 } else320 } else
318 goto done;321 goto done;
319 322
drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c+14−2
@@ -278,6 +278,12 @@ nvkm_device_pci_10de_0fe3[] = { · 277 unmodified lines
278 {}278 {}
279};279};
280 280
281static const struct nvkm_device_pci_vendor
282nvkm_device_pci_10de_0fe4[] = {
283 { 0x144d, 0xc740, NULL, { .War00C800_0 = true } },
284 {}
285};
286
281static const struct nvkm_device_pci_vendor287static const struct nvkm_device_pci_vendor
282nvkm_device_pci_10de_104b[] = {288nvkm_device_pci_10de_104b[] = {
283 { 0x1043, 0x844c, "GeForce GT 625" },289 { 0x1043, 0x844c, "GeForce GT 625" },
@@ -688,6 +694,12 @@ nvkm_device_pci_10de_1199[] = { · 404 unmodified lines
688 {}694 {}
689};695};
690 696
697static const struct nvkm_device_pci_vendor
698nvkm_device_pci_10de_11e0[] = {
699 { 0x1558, 0x5106, NULL, { .War00C800_0 = true } },
700 {}
701};
702
691static const struct nvkm_device_pci_vendor703static const struct nvkm_device_pci_vendor
692nvkm_device_pci_10de_11e3[] = {704nvkm_device_pci_10de_11e3[] = {
693 { 0x17aa, 0x3683, "GeForce GTX 760A" },705 { 0x17aa, 0x3683, "GeForce GTX 760A" },
@@ -1370,7 +1382,7 @@ nvkm_device_pci_10de[] = { · 676 unmodified lines
1370 { 0x0fe1, "GeForce GT 730M" },1382 { 0x0fe1, "GeForce GT 730M" },
1371 { 0x0fe2, "GeForce GT 745M" },1383 { 0x0fe2, "GeForce GT 745M" },
1372 { 0x0fe3, "GeForce GT 745M", nvkm_device_pci_10de_0fe3 },1384 { 0x0fe3, "GeForce GT 745M", nvkm_device_pci_10de_0fe3 },
1373 { 0x0fe4, "GeForce GT 750M" },1385 { 0x0fe4, "GeForce GT 750M", nvkm_device_pci_10de_0fe4 },
1374 { 0x0fe9, "GeForce GT 750M" },1386 { 0x0fe9, "GeForce GT 750M" },
1375 { 0x0fea, "GeForce GT 755M" },1387 { 0x0fea, "GeForce GT 755M" },
1376 { 0x0fec, "GeForce 710A" },1388 { 0x0fec, "GeForce 710A" },
@@ -1485,7 +1497,7 @@ nvkm_device_pci_10de[] = { · 108 unmodified lines
1485 { 0x11c6, "GeForce GTX 650 Ti" },1497 { 0x11c6, "GeForce GTX 650 Ti" },
1486 { 0x11c8, "GeForce GTX 650" },1498 { 0x11c8, "GeForce GTX 650" },
1487 { 0x11cb, "GeForce GT 740" },1499 { 0x11cb, "GeForce GT 740" },
1488 { 0x11e0, "GeForce GTX 770M" },1500 { 0x11e0, "GeForce GTX 770M", nvkm_device_pci_10de_11e0 },
1489 { 0x11e1, "GeForce GTX 765M" },1501 { 0x11e1, "GeForce GTX 765M" },
1490 { 0x11e2, "GeForce GTX 765M" },1502 { 0x11e2, "GeForce GTX 765M" },
1491 { 0x11e3, "GeForce GTX 760M", nvkm_device_pci_10de_11e3 },1503 { 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
207 const u32 b = beta * gr->ppc_tpc_nr[gpc][ppc];207 const u32 b = beta * gr->ppc_tpc_nr[gpc][ppc];
208 const u32 t = timeslice_mode;208 const u32 t = timeslice_mode;
209 const u32 o = PPC_UNIT(gpc, ppc, 0);209 const u32 o = PPC_UNIT(gpc, ppc, 0);
210 if (!(gr->ppc_mask[gpc] & (1 << ppc)))
211 continue;
210 mmio_skip(info, o + 0xc0, (t << 28) | (b << 16) | ++bo);212 mmio_skip(info, o + 0xc0, (t << 28) | (b << 16) | ++bo);
211 mmio_wr32(info, o + 0xc0, (t << 28) | (b << 16) | --bo);213 mmio_wr32(info, o + 0xc0, (t << 28) | (b << 16) | --bo);
212 bo += grctx->attrib_nr_max * gr->ppc_tpc_nr[gpc][ppc];214 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
52#endif52#endif
53 53
54#ifdef INCLUDE_CODE54#ifdef INCLUDE_CODE
55#define gpc_addr(reg,addr) /*
56*/ imm32(reg,addr) /*
57*/ or reg NV_PGRAPH_GPCX_GPCCS_MMIO_CTRL_BASE_ENABLE
55#define gpc_wr32(addr,reg) /*58#define gpc_wr32(addr,reg) /*
59*/ gpc_addr($r14,addr) /*
56*/ mov b32 $r15 reg /*60*/ mov b32 $r15 reg /*
57*/ imm32($r14, addr) /*
58*/ or $r14 NV_PGRAPH_GPCX_GPCCS_MMIO_CTRL_BASE_ENABLE /*
59*/ call(nv_wr32)61*/ call(nv_wr32)
60 62
61// reports an exception to the host63// reports an exception to the host
@@ -161,7 +163,7 @@ init: · 99 unmodified lines
161 163
162#if NV_PGRAPH_GPCX_UNK__SIZE > 0164#if NV_PGRAPH_GPCX_UNK__SIZE > 0
163 // figure out which, and how many, UNKs are actually present165 // figure out which, and how many, UNKs are actually present
164 imm32($r14, 0x500c30)166 gpc_addr($r14, 0x500c30)
165 clear b32 $r2167 clear b32 $r2
166 clear b32 $r3168 clear b32 $r3
167 clear b32 $r4169 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
314 0x03f01200,314 0x03f01200,
315 0x0002d000,315 0x0002d000,
316 0x17f104bd,316 0x17f104bd,
317 0x10fe0542,317 0x10fe0545,
318 0x0007f100,318 0x0007f100,
319 0x0003f007,319 0x0003f007,
320 0xbd0000d0,320 0xbd0000d0,
@@ -338,184 +338,184 @@ uint32_t gf117_grgpc_code[] = { · 17 unmodified lines
338 0x02d00103,338 0x02d00103,
339 0xf104bd00,339 0xf104bd00,
340 0xf00c30e7,340 0xf00c30e7,
341 0x24bd50e3,341 0xe5f050e3,
342 0x44bd34bd,342 0xbd24bd01,
343/* 0x0430: init_unk_loop */343/* 0x0433: init_unk_loop */
344 0xb06821f4,344 0xf444bd34,
345 0x0bf400f6,345 0xf6b06821,
346 0x01f7f00f,346 0x0f0bf400,
347 0xfd04f2bb,347 0xbb01f7f0,
348 0x30b6054f,348 0x4ffd04f2,
349/* 0x0445: init_unk_next */349 0x0130b605,
350 0x0120b601,350/* 0x0448: init_unk_next */
351 0xb004e0b6,351 0xb60120b6,
352 0x1bf40126,352 0x26b004e0,
353/* 0x0451: init_unk_done */353 0xe21bf401,
354 0x070380e2,354/* 0x0454: init_unk_done */
355 0xf1080480,355 0x80070380,
356 0xf0010027,356 0x27f10804,
357 0x22cf0223,357 0x23f00100,
358 0x9534bd00,358 0x0022cf02,
359 0x07f10825,359 0x259534bd,
360 0x03f0c000,360 0x0007f108,
361 0x0005d001,361 0x0103f0c0,
362 0x07f104bd,362 0xbd0005d0,
363 0x03f0c100,363 0x0007f104,
364 0x0005d001,364 0x0103f0c1,
365 0x0e9804bd,365 0xbd0005d0,
366 0x010f9800,366 0x000e9804,
367 0x015021f5,367 0xf5010f98,
368 0xbb002fbb,368 0xbb015021,
369 0x0e98003f,369 0x3fbb002f,
370 0x020f9801,370 0x010e9800,
371 0x015021f5,371 0xf5020f98,
372 0xfd050e98,372 0x98015021,
373 0x2ebb00ef,373 0xeffd050e,
374 0x003ebb00,374 0x002ebb00,
375 0x98020e98,375 0x98003ebb,
376 0x21f5030f,376 0x0f98020e,
377 0x0e980150,377 0x5021f503,
378 0x00effd07,378 0x070e9801,
379 0xbb002ebb,379 0xbb00effd,
380 0x35b6003e,380 0x3ebb002e,
381 0x0007f102,381 0x0235b600,
382 0x0103f0d3,382 0xd30007f1,
383 0xbd0003d0,383 0xd00103f0,
384 0x0825b604,
385 0xb60635b6,
386 0x30b60120,
387 0x0824b601,
388 0xb90834b6,
389 0x21f5022f,
390 0x2fbb02d3,
391 0x003fbb00,
392 0x010007f1,
393 0xd00203f0,
394 0x04bd0003,384 0x04bd0003,
395 0x29f024bd,385 0xb60825b6,
396 0x0007f11f,386 0x20b60635,
397 0x0203f008,387 0x0130b601,
398 0xbd0002d0,388 0xb60824b6,
399/* 0x0505: main */389 0x2fb90834,
400 0x0031f404,390 0xd321f502,
401 0xf00028f4,391 0x002fbb02,
402 0x21f424d7,392 0xf1003fbb,
403 0xf401f439,393 0xf0010007,
404 0xf404e4b0,394 0x03d00203,
405 0x81fe1e18,395 0xbd04bd00,
406 0x0627f001,396 0x1f29f024,
407 0x12fd20bd,397 0x080007f1,
408 0x01e4b604,398 0xd00203f0,
409 0xfe051efd,399 0x04bd0002,
410 0x21f50018,400/* 0x0508: main */
411 0x0ef405fa,401 0xf40031f4,
412/* 0x0535: main_not_ctx_xfer */402 0xd7f00028,
413 0x10ef94d3,403 0x3921f424,
414 0xf501f5f0,404 0xb0f401f4,
415 0xf4037e21,405 0x18f404e4,
416/* 0x0542: ih */406 0x0181fe1e,
417 0x80f9c60e,407 0xbd0627f0,
418 0xf90188fe,408 0x0412fd20,
419 0xf990f980,409 0xfd01e4b6,
420 0xf9b0f9a0,410 0x18fe051e,
421 0xf9e0f9d0,411 0xfd21f500,
422 0xf104bdf0,412 0xd30ef405,
423 0xf00200a7,413/* 0x0538: main_not_ctx_xfer */
424 0xaacf00a3,414 0xf010ef94,
425 0x04abc400,415 0x21f501f5,
426 0xf02c0bf4,416 0x0ef4037e,
427 0xe7f124d7,417/* 0x0545: ih */
428 0xe3f01a00,418 0xfe80f9c6,
429 0x00eecf00,419 0x80f90188,
430 0x1900f7f1,420 0xa0f990f9,
431 0xcf00f3f0,421 0xd0f9b0f9,
432 0x21f400ff,422 0xf0f9e0f9,
433 0x01e7f004,423 0xa7f104bd,
434 0x1d0007f1,424 0xa3f00200,
435 0xd00003f0,425 0x00aacf00,
436 0x04bd000e,426 0xf404abc4,
437/* 0x0590: ih_no_fifo */427 0xd7f02c0b,
438 0x010007f1,428 0x00e7f124,
439 0xd00003f0,429 0x00e3f01a,
440 0x04bd000a,430 0xf100eecf,
441 0xe0fcf0fc,431 0xf01900f7,
442 0xb0fcd0fc,432 0xffcf00f3,
443 0x90fca0fc,433 0x0421f400,
444 0x88fe80fc,434 0xf101e7f0,
445 0xf480fc00,435 0xf01d0007,
446 0x01f80032,436 0x0ed00003,
447/* 0x05b4: hub_barrier_done */437/* 0x0593: ih_no_fifo */
448 0x9801f7f0,438 0xf104bd00,
449 0xfebb040e,439 0xf0010007,
450 0x02ffb904,440 0x0ad00003,
451 0x9418e7f1,441 0xfc04bd00,
452 0xf440e3f0,442 0xfce0fcf0,
453 0x00f89d21,443 0xfcb0fcd0,
454/* 0x05cc: ctx_redswitch */444 0xfc90fca0,
455 0xf120f7f0,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,
456 0xf0850007,465 0xf0850007,
457 0x0fd00103,466 0x0fd00103,
458 0xf004bd00,467 0xf804bd00,
459/* 0x05de: ctx_redswitch_delay */468/* 0x05fd: ctx_xfer */
460 0xe2b608e7,469 0x0007f100,
461 0xfd1bf401,470 0x0203f081,
462 0x0800f5f1,471 0xbd000fd0,
463 0x0200f5f1,472 0x0711f404,
464 0x850007f1,473 0x05cf21f5,
465 0xd00103f0,474/* 0x0610: ctx_xfer_not_load */
466 0x04bd000f,475 0x026a21f5,
467/* 0x05fa: ctx_xfer */476 0x07f124bd,
468 0x07f100f8,477 0x03f047fc,
469 0x03f08100,478 0x0002d002,
470 0x000fd002,479 0x2cf004bd,
471 0x11f404bd,480 0x0320b601,
472 0xcc21f507,481 0x4afc07f1,
473/* 0x060d: ctx_xfer_not_load */482 0xd00203f0,
474 0x6a21f505,483 0x04bd0002,
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,
501 0xf001acf0,484 0xf001acf0,
502 0xb7f104a5,485 0xb7f102a5,
503 0xb3f03000,486 0xb3f00000,
504 0x040c9850,487 0x040c9850,
505 0xbb0fc4b6,488 0xbb0fc4b6,
506 0x0c9800bc,489 0x0c9800bc,
507 0x030d9802,490 0x010d9800,
508 0xf1080f98,491 0xf500e7f0,
509 0xf50200e7,492 0xf0016f21,
510 0xf5016f21,493 0xb7f101ac,
511 0xf4025e21,494 0xb3f04000,
512 0x12f40601,495 0x040c9850,
513/* 0x06a9: ctx_xfer_post */496 0xbb0fc4b6,
514 0x7f21f507,497 0x0c9800bc,
515/* 0x06ad: ctx_xfer_done */498 0x020d9801,
516 0xb421f502,499 0xf1060f98,
517 0x0000f805,500 0xf50800e7,
518 0x00000000,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,
519 0x00000000,519 0x00000000,
520 0x00000000,520 0x00000000,
521 0x00000000,521 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
314 0x03f01200,314 0x03f01200,
315 0x0002d000,315 0x0002d000,
316 0x17f104bd,316 0x17f104bd,
317 0x10fe0542,317 0x10fe0545,
318 0x0007f100,318 0x0007f100,
319 0x0003f007,319 0x0003f007,
320 0xbd0000d0,320 0xbd0000d0,
@@ -338,184 +338,184 @@ uint32_t gk104_grgpc_code[] = { · 17 unmodified lines
338 0x02d00103,338 0x02d00103,
339 0xf104bd00,339 0xf104bd00,
340 0xf00c30e7,340 0xf00c30e7,
341 0x24bd50e3,341 0xe5f050e3,
342 0x44bd34bd,342 0xbd24bd01,
343/* 0x0430: init_unk_loop */343/* 0x0433: init_unk_loop */
344 0xb06821f4,344 0xf444bd34,
345 0x0bf400f6,345 0xf6b06821,
346 0x01f7f00f,346 0x0f0bf400,
347 0xfd04f2bb,347 0xbb01f7f0,
348 0x30b6054f,348 0x4ffd04f2,
349/* 0x0445: init_unk_next */349 0x0130b605,
350 0x0120b601,350/* 0x0448: init_unk_next */
351 0xb004e0b6,351 0xb60120b6,
352 0x1bf40126,352 0x26b004e0,
353/* 0x0451: init_unk_done */353 0xe21bf401,
354 0x070380e2,354/* 0x0454: init_unk_done */
355 0xf1080480,355 0x80070380,
356 0xf0010027,356 0x27f10804,
357 0x22cf0223,357 0x23f00100,
358 0x9534bd00,358 0x0022cf02,
359 0x07f10825,359 0x259534bd,
360 0x03f0c000,360 0x0007f108,
361 0x0005d001,361 0x0103f0c0,
362 0x07f104bd,362 0xbd0005d0,
363 0x03f0c100,363 0x0007f104,
364 0x0005d001,364 0x0103f0c1,
365 0x0e9804bd,365 0xbd0005d0,
366 0x010f9800,366 0x000e9804,
367 0x015021f5,367 0xf5010f98,
368 0xbb002fbb,368 0xbb015021,
369 0x0e98003f,369 0x3fbb002f,
370 0x020f9801,370 0x010e9800,
371 0x015021f5,371 0xf5020f98,
372 0xfd050e98,372 0x98015021,
373 0x2ebb00ef,373 0xeffd050e,
374 0x003ebb00,374 0x002ebb00,
375 0x98020e98,375 0x98003ebb,
376 0x21f5030f,376 0x0f98020e,
377 0x0e980150,377 0x5021f503,
378 0x00effd07,378 0x070e9801,
379 0xbb002ebb,379 0xbb00effd,
380 0x35b6003e,380 0x3ebb002e,
381 0x0007f102,381 0x0235b600,
382 0x0103f0d3,382 0xd30007f1,
383 0xbd0003d0,383 0xd00103f0,
384 0x0825b604,
385 0xb60635b6,
386 0x30b60120,
387 0x0824b601,
388 0xb90834b6,
389 0x21f5022f,
390 0x2fbb02d3,
391 0x003fbb00,
392 0x010007f1,
393 0xd00203f0,
394 0x04bd0003,384 0x04bd0003,
395 0x29f024bd,385 0xb60825b6,
396 0x0007f11f,386 0x20b60635,
397 0x0203f008,387 0x0130b601,
398 0xbd0002d0,388 0xb60824b6,
399/* 0x0505: main */389 0x2fb90834,
400 0x0031f404,390 0xd321f502,
401 0xf00028f4,391 0x002fbb02,
402 0x21f424d7,392 0xf1003fbb,
403 0xf401f439,393 0xf0010007,
404 0xf404e4b0,394 0x03d00203,
405 0x81fe1e18,395 0xbd04bd00,
406 0x0627f001,396 0x1f29f024,
407 0x12fd20bd,397 0x080007f1,
408 0x01e4b604,398 0xd00203f0,
409 0xfe051efd,399 0x04bd0002,
410 0x21f50018,400/* 0x0508: main */
411 0x0ef405fa,401 0xf40031f4,
412/* 0x0535: main_not_ctx_xfer */402 0xd7f00028,
413 0x10ef94d3,403 0x3921f424,
414 0xf501f5f0,404 0xb0f401f4,
415 0xf4037e21,405 0x18f404e4,
416/* 0x0542: ih */406 0x0181fe1e,
417 0x80f9c60e,407 0xbd0627f0,
418 0xf90188fe,408 0x0412fd20,
419 0xf990f980,409 0xfd01e4b6,
420 0xf9b0f9a0,410 0x18fe051e,
421 0xf9e0f9d0,411 0xfd21f500,
422 0xf104bdf0,412 0xd30ef405,
423 0xf00200a7,413/* 0x0538: main_not_ctx_xfer */
424 0xaacf00a3,414 0xf010ef94,
425 0x04abc400,415 0x21f501f5,
426 0xf02c0bf4,416 0x0ef4037e,
427 0xe7f124d7,417/* 0x0545: ih */
428 0xe3f01a00,418 0xfe80f9c6,
429 0x00eecf00,419 0x80f90188,
430 0x1900f7f1,420 0xa0f990f9,
431 0xcf00f3f0,421 0xd0f9b0f9,
432 0x21f400ff,422 0xf0f9e0f9,
433 0x01e7f004,423 0xa7f104bd,
434 0x1d0007f1,424 0xa3f00200,
435 0xd00003f0,425 0x00aacf00,
436 0x04bd000e,426 0xf404abc4,
437/* 0x0590: ih_no_fifo */427 0xd7f02c0b,
438 0x010007f1,428 0x00e7f124,
439 0xd00003f0,429 0x00e3f01a,
440 0x04bd000a,430 0xf100eecf,
441 0xe0fcf0fc,431 0xf01900f7,
442 0xb0fcd0fc,432 0xffcf00f3,
443 0x90fca0fc,433 0x0421f400,
444 0x88fe80fc,434 0xf101e7f0,
445 0xf480fc00,435 0xf01d0007,
446 0x01f80032,436 0x0ed00003,
447/* 0x05b4: hub_barrier_done */437/* 0x0593: ih_no_fifo */
448 0x9801f7f0,438 0xf104bd00,
449 0xfebb040e,439 0xf0010007,
450 0x02ffb904,440 0x0ad00003,
451 0x9418e7f1,441 0xfc04bd00,
452 0xf440e3f0,442 0xfce0fcf0,
453 0x00f89d21,443 0xfcb0fcd0,
454/* 0x05cc: ctx_redswitch */444 0xfc90fca0,
455 0xf120f7f0,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,
456 0xf0850007,465 0xf0850007,
457 0x0fd00103,466 0x0fd00103,
458 0xf004bd00,467 0xf804bd00,
459/* 0x05de: ctx_redswitch_delay */468/* 0x05fd: ctx_xfer */
460 0xe2b608e7,469 0x0007f100,
461 0xfd1bf401,470 0x0203f081,
462 0x0800f5f1,471 0xbd000fd0,
463 0x0200f5f1,472 0x0711f404,
464 0x850007f1,473 0x05cf21f5,
465 0xd00103f0,474/* 0x0610: ctx_xfer_not_load */
466 0x04bd000f,475 0x026a21f5,
467/* 0x05fa: ctx_xfer */476 0x07f124bd,
468 0x07f100f8,477 0x03f047fc,
469 0x03f08100,478 0x0002d002,
470 0x000fd002,479 0x2cf004bd,
471 0x11f404bd,480 0x0320b601,
472 0xcc21f507,481 0x4afc07f1,
473/* 0x060d: ctx_xfer_not_load */482 0xd00203f0,
474 0x6a21f505,483 0x04bd0002,
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,
501 0xf001acf0,484 0xf001acf0,
502 0xb7f104a5,485 0xb7f102a5,
503 0xb3f03000,486 0xb3f00000,
504 0x040c9850,487 0x040c9850,
505 0xbb0fc4b6,488 0xbb0fc4b6,
506 0x0c9800bc,489 0x0c9800bc,
507 0x030d9802,490 0x010d9800,
508 0xf1080f98,491 0xf500e7f0,
509 0xf50200e7,492 0xf0016f21,
510 0xf5016f21,493 0xb7f101ac,
511 0xf4025e21,494 0xb3f04000,
512 0x12f40601,495 0x040c9850,
513/* 0x06a9: ctx_xfer_post */496 0xbb0fc4b6,
514 0x7f21f507,497 0x0c9800bc,
515/* 0x06ad: ctx_xfer_done */498 0x020d9801,
516 0xb421f502,499 0xf1060f98,
517 0x0000f805,500 0xf50800e7,
518 0x00000000,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,
519 0x00000000,519 0x00000000,
520 0x00000000,520 0x00000000,
521 0x00000000,521 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
314 0x03f01200,314 0x03f01200,
315 0x0002d000,315 0x0002d000,
316 0x17f104bd,316 0x17f104bd,
317 0x10fe0542,317 0x10fe0545,
318 0x0007f100,318 0x0007f100,
319 0x0003f007,319 0x0003f007,
320 0xbd0000d0,320 0xbd0000d0,
@@ -338,184 +338,184 @@ uint32_t gk110_grgpc_code[] = { · 17 unmodified lines
338 0x02d00103,338 0x02d00103,
339 0xf104bd00,339 0xf104bd00,
340 0xf00c30e7,340 0xf00c30e7,
341 0x24bd50e3,341 0xe5f050e3,
342 0x44bd34bd,342 0xbd24bd01,
343/* 0x0430: init_unk_loop */343/* 0x0433: init_unk_loop */
344 0xb06821f4,344 0xf444bd34,
345 0x0bf400f6,345 0xf6b06821,
346 0x01f7f00f,346 0x0f0bf400,
347 0xfd04f2bb,347 0xbb01f7f0,
348 0x30b6054f,348 0x4ffd04f2,
349/* 0x0445: init_unk_next */349 0x0130b605,
350 0x0120b601,350/* 0x0448: init_unk_next */
351 0xb004e0b6,351 0xb60120b6,
352 0x1bf40226,352 0x26b004e0,
353/* 0x0451: init_unk_done */353 0xe21bf402,
354 0x070380e2,354/* 0x0454: init_unk_done */
355 0xf1080480,355 0x80070380,
356 0xf0010027,356 0x27f10804,
357 0x22cf0223,357 0x23f00100,
358 0x9534bd00,358 0x0022cf02,
359 0x07f10825,359 0x259534bd,
360 0x03f0c000,360 0x0007f108,
361 0x0005d001,361 0x0103f0c0,
362 0x07f104bd,362 0xbd0005d0,
363 0x03f0c100,363 0x0007f104,
364 0x0005d001,364 0x0103f0c1,
365 0x0e9804bd,365 0xbd0005d0,
366 0x010f9800,366 0x000e9804,
367 0x015021f5,367 0xf5010f98,
368 0xbb002fbb,368 0xbb015021,
369 0x0e98003f,369 0x3fbb002f,
370 0x020f9801,370 0x010e9800,
371 0x015021f5,371 0xf5020f98,
372 0xfd050e98,372 0x98015021,
373 0x2ebb00ef,373 0xeffd050e,
374 0x003ebb00,374 0x002ebb00,
375 0x98020e98,375 0x98003ebb,
376 0x21f5030f,376 0x0f98020e,
377 0x0e980150,377 0x5021f503,
378 0x00effd07,378 0x070e9801,
379 0xbb002ebb,379 0xbb00effd,
380 0x35b6003e,380 0x3ebb002e,
381 0x0007f102,381 0x0235b600,
382 0x0103f0d3,382 0xd30007f1,
383 0xbd0003d0,383 0xd00103f0,
384 0x0825b604,
385 0xb60635b6,
386 0x30b60120,
387 0x0824b601,
388 0xb90834b6,
389 0x21f5022f,
390 0x2fbb02d3,
391 0x003fbb00,
392 0x010007f1,
393 0xd00203f0,
394 0x04bd0003,384 0x04bd0003,
395 0x29f024bd,385 0xb60825b6,
396 0x0007f11f,386 0x20b60635,
397 0x0203f030,387 0x0130b601,
398 0xbd0002d0,388 0xb60824b6,
399/* 0x0505: main */389 0x2fb90834,
400 0x0031f404,390 0xd321f502,
401 0xf00028f4,391 0x002fbb02,
402 0x21f424d7,392 0xf1003fbb,
403 0xf401f439,393 0xf0010007,
404 0xf404e4b0,394 0x03d00203,
405 0x81fe1e18,395 0xbd04bd00,
406 0x0627f001,396 0x1f29f024,
407 0x12fd20bd,397 0x300007f1,
408 0x01e4b604,398 0xd00203f0,
409 0xfe051efd,399 0x04bd0002,
410 0x21f50018,400/* 0x0508: main */
411 0x0ef405fa,401 0xf40031f4,
412/* 0x0535: main_not_ctx_xfer */402 0xd7f00028,
413 0x10ef94d3,403 0x3921f424,
414 0xf501f5f0,404 0xb0f401f4,
415 0xf4037e21,405 0x18f404e4,
416/* 0x0542: ih */406 0x0181fe1e,
417 0x80f9c60e,407 0xbd0627f0,
418 0xf90188fe,408 0x0412fd20,
419 0xf990f980,409 0xfd01e4b6,
420 0xf9b0f9a0,410 0x18fe051e,
421 0xf9e0f9d0,411 0xfd21f500,
422 0xf104bdf0,412 0xd30ef405,
423 0xf00200a7,413/* 0x0538: main_not_ctx_xfer */
424 0xaacf00a3,414 0xf010ef94,
425 0x04abc400,415 0x21f501f5,
426 0xf02c0bf4,416 0x0ef4037e,
427 0xe7f124d7,417/* 0x0545: ih */
428 0xe3f01a00,418 0xfe80f9c6,
429 0x00eecf00,419 0x80f90188,
430 0x1900f7f1,420 0xa0f990f9,
431 0xcf00f3f0,421 0xd0f9b0f9,
432 0x21f400ff,422 0xf0f9e0f9,
433 0x01e7f004,423 0xa7f104bd,
434 0x1d0007f1,424 0xa3f00200,
435 0xd00003f0,425 0x00aacf00,
436 0x04bd000e,426 0xf404abc4,
437/* 0x0590: ih_no_fifo */427 0xd7f02c0b,
438 0x010007f1,428 0x00e7f124,
439 0xd00003f0,429 0x00e3f01a,
440 0x04bd000a,430 0xf100eecf,
441 0xe0fcf0fc,431 0xf01900f7,
442 0xb0fcd0fc,432 0xffcf00f3,
443 0x90fca0fc,433 0x0421f400,
444 0x88fe80fc,434 0xf101e7f0,
445 0xf480fc00,435 0xf01d0007,
446 0x01f80032,436 0x0ed00003,
447/* 0x05b4: hub_barrier_done */437/* 0x0593: ih_no_fifo */
448 0x9801f7f0,438 0xf104bd00,
449 0xfebb040e,439 0xf0010007,
450 0x02ffb904,440 0x0ad00003,
451 0x9418e7f1,441 0xfc04bd00,
452 0xf440e3f0,442 0xfce0fcf0,
453 0x00f89d21,443 0xfcb0fcd0,
454/* 0x05cc: ctx_redswitch */444 0xfc90fca0,
455 0xf120f7f0,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,
456 0xf0850007,465 0xf0850007,
457 0x0fd00103,466 0x0fd00103,
458 0xf004bd00,467 0xf804bd00,
459/* 0x05de: ctx_redswitch_delay */468/* 0x05fd: ctx_xfer */
460 0xe2b608e7,469 0x0007f100,
461 0xfd1bf401,470 0x0203f081,
462 0x0800f5f1,471 0xbd000fd0,
463 0x0200f5f1,472 0x0711f404,
464 0x850007f1,473 0x05cf21f5,
465 0xd00103f0,474/* 0x0610: ctx_xfer_not_load */
466 0x04bd000f,475 0x026a21f5,
467/* 0x05fa: ctx_xfer */476 0x07f124bd,
468 0x07f100f8,477 0x03f047fc,
469 0x03f08100,478 0x0002d002,
470 0x000fd002,479 0x2cf004bd,
471 0x11f404bd,480 0x0320b601,
472 0xcc21f507,481 0x4afc07f1,
473/* 0x060d: ctx_xfer_not_load */482 0xd00203f0,
474 0x6a21f505,483 0x04bd0002,
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,
501 0xf001acf0,484 0xf001acf0,
502 0xb7f104a5,485 0xb7f102a5,
503 0xb3f03000,486 0xb3f00000,
504 0x040c9850,487 0x040c9850,
505 0xbb0fc4b6,488 0xbb0fc4b6,
506 0x0c9800bc,489 0x0c9800bc,
507 0x030d9802,490 0x010d9800,
508 0xf1080f98,491 0xf500e7f0,
509 0xf50200e7,492 0xf0016f21,
510 0xf5016f21,493 0xb7f101ac,
511 0xf4025e21,494 0xb3f04000,
512 0x12f40601,495 0x040c9850,
513/* 0x06a9: ctx_xfer_post */496 0xbb0fc4b6,
514 0x7f21f507,497 0x0c9800bc,
515/* 0x06ad: ctx_xfer_done */498 0x020d9801,
516 0xb421f502,499 0xf1060f98,
517 0x0000f805,500 0xf50800e7,
518 0x00000000,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,
519 0x00000000,519 0x00000000,
520 0x00000000,520 0x00000000,
521 0x00000000,521 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
276 0x02020014,276 0x02020014,
277 0xf6120040,277 0xf6120040,
278 0x04bd0002,278 0x04bd0002,
279 0xfe048141,279 0xfe048441,
280 0x00400010,280 0x00400010,
281 0x0000f607,281 0x0000f607,
282 0x040204bd,282 0x040204bd,
@@ -295,165 +295,165 @@ uint32_t gk208_grgpc_code[] = { · 12 unmodified lines
295 0x01c90080,295 0x01c90080,
296 0xbd0002f6,296 0xbd0002f6,
297 0x0c308e04,297 0x0c308e04,
298 0xbd24bd50,298 0x01e5f050,
299/* 0x0383: init_unk_loop */299 0x34bd24bd,
300 0x7e44bd34,300/* 0x0386: init_unk_loop */
301 0xb0000065,301 0x657e44bd,
302 0x0bf400f6,302 0xf6b00000,
303 0xbb010f0e,303 0x0e0bf400,
304 0x4ffd04f2,304 0xf2bb010f,
305 0x0130b605,305 0x054ffd04,
306/* 0x0398: init_unk_next */306/* 0x039b: init_unk_next */
307 0xb60120b6,307 0xb60130b6,
308 0x26b004e0,308 0xe0b60120,
309 0xe21bf401,309 0x0126b004,
310/* 0x03a4: init_unk_done */310/* 0x03a7: init_unk_done */
311 0xb50703b5,311 0xb5e21bf4,
312 0x00820804,312 0x04b50703,
313 0x22cf0201,313 0x01008208,
314 0x9534bd00,314 0x0022cf02,
315 0x00800825,315 0x259534bd,
316 0x05f601c0,316 0xc0008008,
317 0x8004bd00,317 0x0005f601,
318 0xf601c100,318 0x008004bd,
319 0x04bd0005,319 0x05f601c1,
320 0x98000e98,320 0x9804bd00,
321 0x207e010f,321 0x0f98000e,
322 0x2fbb0001,322 0x01207e01,
323 0x003fbb00,323 0x002fbb00,
324 0x98010e98,324 0x98003fbb,
325 0x207e020f,325 0x0f98010e,
326 0x0e980001,326 0x01207e02,
327 0x00effd05,327 0x050e9800,
328 0xbb002ebb,328 0xbb00effd,
329 0x0e98003e,329 0x3ebb002e,
330 0x030f9802,330 0x020e9800,
331 0x0001207e,331 0x7e030f98,
332 0xfd070e98,332 0x98000120,
333 0x2ebb00ef,333 0xeffd070e,
334 0x003ebb00,334 0x002ebb00,
335 0x800235b6,335 0xb6003ebb,
336 0xf601d300,336 0x00800235,
337 0x04bd0003,337 0x03f601d3,
338 0xb60825b6,338 0xb604bd00,
339 0x20b60635,339 0x35b60825,
340 0x0130b601,340 0x0120b606,
341 0xb60824b6,341 0xb60130b6,
342 0x2fb20834,342 0x34b60824,
343 0x0002687e,343 0x7e2fb208,
344 0xbb002fbb,344 0xbb000268,
345 0x0080003f,345 0x3fbb002f,
346 0x03f60201,346 0x01008000,
347 0xbd04bd00,347 0x0003f602,
348 0x1f29f024,348 0x24bd04bd,
349 0x02300080,349 0x801f29f0,
350 0xbd0002f6,350 0xf6023000,
351/* 0x0445: main */351 0x04bd0002,
352 0x0031f404,352/* 0x0448: main */
353 0x0d0028f4,353 0xf40031f4,
354 0x00377e24,354 0x240d0028,
355 0xf401f400,355 0x0000377e,
356 0xf404e4b0,356 0xb0f401f4,
357 0x81fe1d18,357 0x18f404e4,
358 0xbd060201,358 0x0181fe1d,
359 0x0412fd20,359 0x20bd0602,
360 0xfd01e4b6,360 0xb60412fd,
361 0x18fe051e,361 0x1efd01e4,
362 0x05187e00,362 0x0018fe05,
363 0xd40ef400,363 0x00051b7e,
364/* 0x0474: main_not_ctx_xfer */364/* 0x0477: main_not_ctx_xfer */
365 0xf010ef94,365 0x94d40ef4,
366 0xf87e01f5,366 0xf5f010ef,
367 0x0ef40002,367 0x02f87e01,
368/* 0x0481: ih */368 0xc70ef400,
369 0xfe80f9c7,369/* 0x0484: ih */
370 0x80f90188,370 0x88fe80f9,
371 0xa0f990f9,371 0xf980f901,
372 0xd0f9b0f9,372 0xf9a0f990,
373 0xf0f9e0f9,373 0xf9d0f9b0,
374 0x004a04bd,374 0xbdf0f9e0,
375 0x00aacf02,375 0x02004a04,
376 0xf404abc4,376 0xc400aacf,
377 0x240d1f0b,377 0x0bf404ab,
378 0xcf1a004e,378 0x4e240d1f,
379 0x004f00ee,379 0xeecf1a00,
380 0x00ffcf19,380 0x19004f00,
381 0x0000047e,381 0x7e00ffcf,
382 0x0040010e,382 0x0e000004,
383 0x000ef61d,383 0x1d004001,
384/* 0x04be: ih_no_fifo */384 0xbd000ef6,
385 0x004004bd,385/* 0x04c1: ih_no_fifo */
386 0x000af601,386 0x01004004,
387 0xf0fc04bd,387 0xbd000af6,
388 0xd0fce0fc,388 0xfcf0fc04,
389 0xa0fcb0fc,389 0xfcd0fce0,
390 0x80fc90fc,390 0xfca0fcb0,
391 0xfc0088fe,391 0xfe80fc90,
392 0x0032f480,392 0x80fc0088,
393/* 0x04de: hub_barrier_done */393 0xf80032f4,
394 0x010f01f8,394/* 0x04e1: hub_barrier_done */
395 0xbb040e98,395 0x98010f01,
396 0xffb204fe,396 0xfebb040e,
397 0x4094188e,397 0x8effb204,
398 0x00008f7e,398 0x7e409418,
399/* 0x04f2: ctx_redswitch */399 0xf800008f,
400 0x200f00f8,400/* 0x04f5: ctx_redswitch */
401 0x80200f00,
402 0xf6018500,
403 0x04bd000f,
404/* 0x0502: ctx_redswitch_delay */
405 0xe2b6080e,
406 0xfd1bf401,
407 0x0800f5f1,
408 0x0200f5f1,
401 0x01850080,409 0x01850080,
402 0xbd000ff6,410 0xbd000ff6,
403/* 0x04ff: ctx_redswitch_delay */411/* 0x051b: ctx_xfer */
404 0xb6080e04,412 0x8000f804,
405 0x1bf401e2,413 0xf6028100,
406 0x00f5f1fd,414 0x04bd000f,
407 0x00f5f108,415 0x7e0711f4,
408 0x85008002,416/* 0x052b: ctx_xfer_not_load */
409 0x000ff601,417 0x7e0004f5,
410 0x00f804bd,418 0xbd000216,
411/* 0x0518: ctx_xfer */419 0x47fc8024,
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,
423 0x0002f602,420 0x0002f602,
424 0xacf004bd,421 0x2cf004bd,
425 0x02a5f001,422 0x0320b601,
426 0x5000008b,423 0x024afc80,
427 0xb6040c98,424 0xbd0002f6,
428 0xbcbb0fc4,425 0x01acf004,
429 0x000c9800,426 0x8b02a5f0,
430 0x0e010d98,427 0x98500000,
431 0x013d7e00,
432 0x01acf000,
433 0x5040008b,
434 0xb6040c98,
435 0xbcbb0fc4,
436 0x010c9800,
437 0x98020d98,
438 0x004e060f,
439 0x013d7e08,
440 0x01acf000,
441 0x8b04a5f0,
442 0x98503000,
443 0xc4b6040c,428 0xc4b6040c,
444 0x00bcbb0f,429 0x00bcbb0f,
445 0x98020c98,430 0x98000c98,
446 0x0f98030d,431 0x000e010d,
447 0x02004e08,
448 0x00013d7e,432 0x00013d7e,
449 0x00020a7e,433 0x8b01acf0,
450 0xf40601f4,434 0x98504000,
451/* 0x05b2: ctx_xfer_post */435 0xc4b6040c,
452 0x277e0712,436 0x00bcbb0f,
453/* 0x05b6: ctx_xfer_done */437 0x98010c98,
454 0xde7e0002,438 0x0f98020d,
455 0x00f80004,439 0x08004e06,
456 0x00000000,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,
457 0x00000000,457 0x00000000,
458 0x00000000,458 0x00000000,
459 0x00000000,459 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
289 0x020014fe,289 0x020014fe,
290 0x12004002,290 0x12004002,
291 0xbd0002f6,291 0xbd0002f6,
292 0x05b04104,292 0x05b34104,
293 0x400010fe,293 0x400010fe,
294 0x00f60700,294 0x00f60700,
295 0x0204bd00,295 0x0204bd00,
@@ -308,259 +308,259 @@ uint32_t gm107_grgpc_code[] = { · 12 unmodified lines
308 0xc900800f,308 0xc900800f,
309 0x0002f601,309 0x0002f601,
310 0x308e04bd,310 0x308e04bd,
311 0x24bd500c,311 0xe5f0500c,
312 0x44bd34bd,312 0xbd24bd01,
313/* 0x03b0: init_unk_loop */313/* 0x03b3: init_unk_loop */
314 0x0000657e,314 0x7e44bd34,
315 0xf400f6b0,315 0xb0000065,
316 0x010f0e0b,316 0x0bf400f6,
317 0xfd04f2bb,317 0xbb010f0e,
318 0x30b6054f,318 0x4ffd04f2,
319/* 0x03c5: init_unk_next */319 0x0130b605,
320 0x0120b601,320/* 0x03c8: init_unk_next */
321 0xb004e0b6,321 0xb60120b6,
322 0x1bf40226,322 0x26b004e0,
323/* 0x03d1: init_unk_done */323 0xe21bf402,
324 0x0703b5e2,324/* 0x03d4: init_unk_done */
325 0x820804b5,325 0xb50703b5,
326 0xcf020100,326 0x00820804,
327 0x34bd0022,327 0x22cf0201,
328 0x80082595,328 0x9534bd00,
329 0xf601c000,329 0x00800825,
330 0x05f601c0,
331 0x8004bd00,
332 0xf601c100,
330 0x04bd0005,333 0x04bd0005,
331 0x01c10080,334 0x98000e98,
332 0xbd0005f6,335 0x207e010f,
333 0x000e9804,336 0x2fbb0001,
334 0x7e010f98,337 0x003fbb00,
335 0xbb000120,338 0x98010e98,
336 0x3fbb002f,339 0x207e020f,
337 0x010e9800,340 0x0e980001,
338 0x7e020f98,341 0x00effd05,
339 0x98000120,342 0xbb002ebb,
340 0xeffd050e,343 0x0e98003e,
341 0x002ebb00,344 0x030f9802,
342 0x98003ebb,345 0x0001207e,
343 0x0f98020e,346 0xfd070e98,
344 0x01207e03,347 0x2ebb00ef,
345 0x070e9800,348 0x003ebb00,
346 0xbb00effd,349 0x800235b6,
347 0x3ebb002e,350 0xf601d300,
348 0x0235b600,351 0x04bd0003,
349 0x01d30080,352 0xb60825b6,
350 0xbd0003f6,353 0x20b60635,
351 0x0825b604,354 0x0130b601,
352 0xb60635b6,355 0xb60824b6,
353 0x30b60120,356 0x2fb20834,
354 0x0824b601,357 0x0002687e,
355 0xb20834b6,358 0xbb002fbb,
356 0x02687e2f,359 0x3f0f003f,
357 0x002fbb00,360 0x501d608e,
358 0x0f003fbb,361 0xb201e5f0,
359 0x8effb23f,362 0x008f7eff,
360 0xf0501d60,363 0x8e0c0f00,
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,
377 0xf0501da8,364 0xf0501da8,
378 0x8f7e01e5,365 0xffb201e5,
379 0xff0f0000,366 0x00008f7e,
380 0x988effb2,367 0x0003147e,
368 0x608e3f0f,
381 0xe5f0501d,369 0xe5f0501d,
382 0x008f7e01,370 0x7effb201,
383 0xb2020f00,371 0x0f00008f,
384 0x1da88eff,372 0x1d9c8e00,
385 0x01e5f050,373 0x01e5f050,
386 0x00008f7e,374 0x8f7effb2,
375 0x010f0000,
387 0x0003147e,376 0x0003147e,
388 0x85050498,377 0x501da88e,
389 0x98504000,378 0xb201e5f0,
390 0x64b60406,379 0x008f7eff,
391 0x0056bb0f,380 0x8eff0f00,
392/* 0x04e0: tpc_strand_init_tpc_loop */381 0xf0501d98,
393 0x05705eb8,382 0xffb201e5,
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,
405 0x00008f7e,383 0x00008f7e,
406 0x05905eb8,384 0xa88e020f,
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,
422 0xe5f0501d,385 0xe5f0501d,
423 0x008f7e01,386 0x7effb201,
424 0x03147e00,387 0x7e00008f,
425 0x01008000,388 0x98000314,
426 0x0003f602,389 0x00850504,
427 0x24bd04bd,390 0x06985040,
428 0x801f29f0,391 0x0f64b604,
429 0xf6023000,392/* 0x04e3: tpc_strand_init_tpc_loop */
430 0x04bd0002,393 0xb80056bb,
431/* 0x0574: main */394 0x0005705e,
432 0xf40031f4,395 0x0000657e,
433 0x240d0028,396 0x74bdf6b2,
434 0x0000377e,397/* 0x04f0: tpc_strand_init_idx_loop */
435 0xb0f401f4,398 0x05605eb8,
436 0x18f404e4,399 0x7e7fb200,
437 0x0181fe1d,400 0xb800008f,
438 0x20bd0602,401 0x0005885e,
439 0xb60412fd,402 0x7e082f95,
440 0x1efd01e4,403 0xb800008f,
441 0x0018fe05,404 0x00058c5e,
442 0x0006477e,405 0x7e082f95,
443/* 0x05a3: main_not_ctx_xfer */406 0xb800008f,
444 0x94d40ef4,407 0x0005905e,
445 0xf5f010ef,408 0x0000657e,
446 0x02f87e01,409 0xb606f5b6,
447 0xc70ef400,410 0xf4b601f0,
448/* 0x05b0: ih */411 0x002fbb08,
449 0x88fe80f9,412 0xb6003fbb,
450 0xf980f901,413 0x62b60170,
451 0xf9a0f990,414 0xbf1bf401,
452 0xf9d0f9b0,415 0x080050b7,
453 0xbdf0f9e0,416 0xf40142b6,
454 0x02004a04,417 0x3f0fa81b,
455 0xc400aacf,418 0x501d608e,
456 0x0bf404ab,419 0xb201e5f0,
457 0x4e240d1f,420 0x008f7eff,
458 0xeecf1a00,421 0x8e0d0f00,
459 0x19004f00,422 0xf0501da8,
460 0x7e00ffcf,423 0xffb201e5,
461 0x0e000004,424 0x00008f7e,
462 0x1d004001,425 0x0003147e,
463 0xbd000ef6,426 0x02010080,
464/* 0x05ed: ih_no_fifo */427 0xbd0003f6,
465 0x01004004,428 0xf024bd04,
466 0xbd000af6,429 0x00801f29,
467 0xfcf0fc04,430 0x02f60230,
468 0xfcd0fce0,431/* 0x0577: main */
469 0xfca0fcb0,432 0xf404bd00,
470 0xfe80fc90,433 0x28f40031,
471 0x80fc0088,434 0x7e240d00,
472 0xf80032f4,435 0xf4000037,
473/* 0x060d: hub_barrier_done */436 0xe4b0f401,
474 0x98010f01,437 0x1d18f404,
475 0xfebb040e,438 0x020181fe,
476 0x8effb204,439 0xfd20bd06,
477 0x7e409418,440 0xe4b60412,
478 0xf800008f,441 0x051efd01,
479/* 0x0621: ctx_redswitch */442 0x7e0018fe,
480 0x80200f00,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,
481 0xf6018500,489 0xf6018500,
482 0x04bd000f,490 0x04bd000f,
483/* 0x062e: ctx_redswitch_delay */491/* 0x064a: ctx_xfer */
484 0xe2b6080e,492 0x008000f8,
485 0xfd1bf401,493 0x0ff60281,
486 0x0800f5f1,494 0x8e04bd00,
487 0x0200f5f1,495 0xf0501dc4,
488 0x01850080,496 0xffb201e5,
489 0xbd000ff6,497 0x00008f7e,
490/* 0x0647: ctx_xfer */498 0x7e0711f4,
491 0x8000f804,499/* 0x0667: ctx_xfer_not_load */
492 0xf6028100,500 0x7e000624,
493 0x04bd000f,501 0xbd000216,
494 0xc48effb2,502 0x47fc8024,
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,
506 0x0002f602,503 0x0002f602,
507 0x0c0f04bd,504 0x2cf004bd,
508 0xa88effb2,505 0x0320b601,
509 0xe5f0501d,506 0x024afc80,
510 0x008f7e01,507 0xbd0002f6,
511 0x03147e00,508 0x8e0c0f04,
512 0xb23f0f00,509 0xf0501da8,
513 0x1d608eff,510 0xffb201e5,
514 0x01e5f050,
515 0x00008f7e,511 0x00008f7e,
516 0xffb2000f,512 0x0003147e,
517 0x501d9c8e,513 0x608e3f0f,
518 0x7e01e5f0,514 0xe5f0501d,
515 0x7effb201,
519 0x0f00008f,516 0x0f00008f,
520 0x03147e01,517 0x1d9c8e00,
521 0x01fcf000,
522 0xb203f0b6,
523 0x1da88eff,
524 0x01e5f050,518 0x01e5f050,
525 0x00008f7e,519 0x8f7effb2,
526 0xf001acf0,520 0x010f0000,
527 0x008b02a5,521 0x0003147e,
528 0x0c985000,522 0xb601fcf0,
529 0x0fc4b604,523 0xa88e03f0,
530 0x9800bcbb,524 0xe5f0501d,
531 0x0d98000c,525 0x7effb201,
532 0x7e000e01,526 0xf000008f,
533 0xf000013d,
534 0x008b01ac,
535 0x0c985040,
536 0x0fc4b604,
537 0x9800bcbb,
538 0x0d98010c,
539 0x060f9802,
540 0x7e08004e,
541 0xf000013d,
542 0xa5f001ac,527 0xa5f001ac,
543 0x30008b04,528 0x00008b02,
544 0x040c9850,529 0x040c9850,
545 0xbb0fc4b6,530 0xbb0fc4b6,
546 0x0c9800bc,531 0x0c9800bc,
547 0x030d9802,532 0x010d9800,
548 0x4e080f98,533 0x3d7e000e,
549 0x3d7e0200,534 0xacf00001,
550 0x0a7e0001,535 0x40008b01,
551 0x147e0002,536 0x040c9850,
552 0x01f40003,537 0xbb0fc4b6,
553 0x1a12f406,538 0x0c9800bc,
554/* 0x073c: ctx_xfer_post */539 0x020d9801,
555 0x0002277e,540 0x4e060f98,
556 0xffb20d0f,541 0x3d7e0800,
557 0x501da88e,542 0xacf00001,
558 0x7e01e5f0,543 0x04a5f001,
559 0x7e00008f,544 0x5030008b,
560/* 0x0753: ctx_xfer_done */545 0xb6040c98,
561 0x7e000314,546 0xbcbb0fc4,
562 0xf800060d,547 0x020c9800,
563 0x00000000,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,
564 0x00000000,564 0x00000000,
565 0x00000000,565 0x00000000,
566 0x00000000,566 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
143static int143static int
144gf100_fermi_mthd_zbc_color(struct nvkm_object *object, void *data, u32 size)144gf100_fermi_mthd_zbc_color(struct nvkm_object *object, void *data, u32 size)
145{145{
146 struct gf100_gr *gr = (void *)object->engine;146 struct gf100_gr *gr = gf100_gr(nvkm_gr(object->engine));
147 union {147 union {
148 struct fermi_a_zbc_color_v0 v0;148 struct fermi_a_zbc_color_v0 v0;
149 } *args = data;149 } *args = data;
@@ -189,7 +189,7 @@ gf100_fermi_mthd_zbc_color(struct nvkm_object *object, void *data, u32 size) · 39 unmodified lines
189static int189static int
190gf100_fermi_mthd_zbc_depth(struct nvkm_object *object, void *data, u32 size)190gf100_fermi_mthd_zbc_depth(struct nvkm_object *object, void *data, u32 size)
191{191{
192 struct gf100_gr *gr = (void *)object->engine;192 struct gf100_gr *gr = gf100_gr(nvkm_gr(object->engine));
193 union {193 union {
194 struct fermi_a_zbc_depth_v0 v0;194 struct fermi_a_zbc_depth_v0 v0;
195 } *args = data;195 } *args = data;
@@ -1530,6 +1530,8 @@ gf100_gr_oneinit(struct nvkm_gr *base) · 1334 unmodified lines
1530 gr->ppc_nr[i] = gr->func->ppc_nr;1530 gr->ppc_nr[i] = gr->func->ppc_nr;
1531 for (j = 0; j < gr->ppc_nr[i]; j++) {1531 for (j = 0; j < gr->ppc_nr[i]; j++) {
1532 u8 mask = nvkm_rd32(device, GPC_UNIT(i, 0x0c30 + (j * 4)));1532 u8 mask = nvkm_rd32(device, GPC_UNIT(i, 0x0c30 + (j * 4)));
1533 if (mask)
1534 gr->ppc_mask[i] |= (1 << j);
1533 gr->ppc_tpc_nr[i][j] = hweight8(mask);1535 gr->ppc_tpc_nr[i][j] = hweight8(mask);
1534 }1536 }
1535 }1537 }
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h+1−0
@@ -97,6 +97,7 @@ struct gf100_gr { · 96 unmodified lines
97 u8 tpc_nr[GPC_MAX];97 u8 tpc_nr[GPC_MAX];
98 u8 tpc_total;98 u8 tpc_total;
99 u8 ppc_nr[GPC_MAX];99 u8 ppc_nr[GPC_MAX];
100 u8 ppc_mask[GPC_MAX];
100 u8 ppc_tpc_nr[GPC_MAX][4];101 u8 ppc_tpc_nr[GPC_MAX][4];
101 102
102 struct nvkm_memory *unk4188b4;103 struct nvkm_memory *unk4188b4;
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/base.c+5−0
@@ -97,7 +97,9 @@ static void * · 96 unmodified lines
97nvkm_instobj_dtor(struct nvkm_memory *memory)97nvkm_instobj_dtor(struct nvkm_memory *memory)
98{98{
99 struct nvkm_instobj *iobj = nvkm_instobj(memory);99 struct nvkm_instobj *iobj = nvkm_instobj(memory);
100 spin_lock(&iobj->imem->lock);
100 list_del(&iobj->head);101 list_del(&iobj->head);
102 spin_unlock(&iobj->imem->lock);
101 nvkm_memory_del(&iobj->parent);103 nvkm_memory_del(&iobj->parent);
102 return iobj;104 return iobj;
103}105}
@@ -190,7 +192,9 @@ nvkm_instobj_new(struct nvkm_instmem *imem, u32 size, u32 align, bool zero, · 86 unmodified lines
190 nvkm_memory_ctor(&nvkm_instobj_func_slow, &iobj->memory);192 nvkm_memory_ctor(&nvkm_instobj_func_slow, &iobj->memory);
191 iobj->parent = memory;193 iobj->parent = memory;
192 iobj->imem = imem;194 iobj->imem = imem;
195 spin_lock(&iobj->imem->lock);
193 list_add_tail(&iobj->head, &imem->list);196 list_add_tail(&iobj->head, &imem->list);
197 spin_unlock(&iobj->imem->lock);
194 memory = &iobj->memory;198 memory = &iobj->memory;
195 }199 }
196 200
@@ -309,5 +313,6 @@ nvkm_instmem_ctor(const struct nvkm_instmem_func *func, · 112 unmodified lines
309{313{
310 nvkm_subdev_ctor(&nvkm_instmem, device, index, 0, &imem->subdev);314 nvkm_subdev_ctor(&nvkm_instmem, device, index, 0, &imem->subdev);
311 imem->func = func;315 imem->func = func;
316 spin_lock_init(&imem->lock);
312 INIT_LIST_HEAD(&imem->list);317 INIT_LIST_HEAD(&imem->list);
313}318}
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
59 duty = (uv - bios->base) * div / bios->pwm_range;59 duty = (uv - bios->base) * div / bios->pwm_range;
60 60
61 nvkm_wr32(device, 0x20340, div);61 nvkm_wr32(device, 0x20340, div);
62 nvkm_wr32(device, 0x20344, 0x8000000 | duty);62 nvkm_wr32(device, 0x20344, 0x80000000 | duty);
63 63
64 return 0;64 return 0;
65}65}
drivers/gpu/drm/radeon/cik.c+4−1
@@ -8472,7 +8472,7 @@ restart_ih: · 8471 unmodified lines
8472 if (queue_dp)8472 if (queue_dp)
8473 schedule_work(&rdev->dp_work);8473 schedule_work(&rdev->dp_work);
8474 if (queue_hotplug)8474 if (queue_hotplug)
8475 schedule_work(&rdev->hotplug_work);8475 schedule_delayed_work(&rdev->hotplug_work, 0);
8476 if (queue_reset) {8476 if (queue_reset) {
8477 rdev->needs_reset = true;8477 rdev->needs_reset = true;
8478 wake_up_all(&rdev->fence_queue);8478 wake_up_all(&rdev->fence_queue);
@@ -9630,6 +9630,9 @@ static void dce8_program_watermarks(struct radeon_device *rdev, · 1151 unmodified lines
9630 (rdev->disp_priority == 2)) {9630 (rdev->disp_priority == 2)) {
9631 DRM_DEBUG_KMS("force priority to high\n");9631 DRM_DEBUG_KMS("force priority to high\n");
9632 }9632 }
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);
9633 }9636 }
9634 9637
9635 /* select wm A */9638 /* 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
2372 c.full = dfixed_div(c, a);2372 c.full = dfixed_div(c, a);
2373 priority_b_mark = dfixed_trunc(c);2373 priority_b_mark = dfixed_trunc(c);
2374 priority_b_cnt |= priority_b_mark & PRIORITY_MARK_MASK;2374 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);
2375 }2378 }
2376 2379
2377 /* select wm A */2380 /* select wm A */
@@ -5344,7 +5347,7 @@ restart_ih: · 2966 unmodified lines
5344 if (queue_dp)5347 if (queue_dp)
5345 schedule_work(&rdev->dp_work);5348 schedule_work(&rdev->dp_work);
5346 if (queue_hotplug)5349 if (queue_hotplug)
5347 schedule_work(&rdev->hotplug_work);5350 schedule_delayed_work(&rdev->hotplug_work, 0);
5348 if (queue_hdmi)5351 if (queue_hdmi)
5349 schedule_work(&rdev->audio_work);5352 schedule_work(&rdev->audio_work);
5350 if (queue_thermal && rdev->pm.dpm_enabled)5353 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
806 status = r100_irq_ack(rdev);806 status = r100_irq_ack(rdev);
807 }807 }
808 if (queue_hotplug)808 if (queue_hotplug)
809 schedule_work(&rdev->hotplug_work);809 schedule_delayed_work(&rdev->hotplug_work, 0);
810 if (rdev->msi_enabled) {810 if (rdev->msi_enabled) {
811 switch (rdev->family) {811 switch (rdev->family) {
812 case CHIP_RS400:812 case CHIP_RS400:
@@ -3217,6 +3217,9 @@ void r100_bandwidth_update(struct radeon_device *rdev) · 2404 unmodified lines
3217 uint32_t pixel_bytes1 = 0;3217 uint32_t pixel_bytes1 = 0;
3218 uint32_t pixel_bytes2 = 0;3218 uint32_t pixel_bytes2 = 0;
3219 3219
3220 /* Guess line buffer size to be 8192 pixels */
3221 u32 lb_size = 8192;
3222
3220 if (!rdev->mode_info.mode_config_initialized)3223 if (!rdev->mode_info.mode_config_initialized)
3221 return;3224 return;
3222 3225
@@ -3631,6 +3634,13 @@ void r100_bandwidth_update(struct radeon_device *rdev) · 408 unmodified lines
3631 DRM_DEBUG_KMS("GRPH2_BUFFER_CNTL from to %x\n",3634 DRM_DEBUG_KMS("GRPH2_BUFFER_CNTL from to %x\n",
3632 (unsigned int)RREG32(RADEON_GRPH2_BUFFER_CNTL));3635 (unsigned int)RREG32(RADEON_GRPH2_BUFFER_CNTL));
3633 }3636 }
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);
3634}3644}
3635 3645
3636int r100_ring_test(struct radeon_device *rdev, struct radeon_ring *ring)3646int 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
4276 WREG32(IH_RB_RPTR, rptr);4276 WREG32(IH_RB_RPTR, rptr);
4277 }4277 }
4278 if (queue_hotplug)4278 if (queue_hotplug)
4279 schedule_work(&rdev->hotplug_work);4279 schedule_delayed_work(&rdev->hotplug_work, 0);
4280 if (queue_hdmi)4280 if (queue_hdmi)
4281 schedule_work(&rdev->audio_work);4281 schedule_work(&rdev->audio_work);
4282 if (queue_thermal && rdev->pm.dpm_enabled)4282 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
2414 struct r600_ih ih; /* r6/700 interrupt ring */2414 struct r600_ih ih; /* r6/700 interrupt ring */
2415 struct radeon_rlc rlc;2415 struct radeon_rlc rlc;
2416 struct radeon_mec mec;2416 struct radeon_mec mec;
2417 struct work_struct hotplug_work;2417 struct delayed_work hotplug_work;
2418 struct work_struct dp_work;2418 struct work_struct dp_work;
2419 struct work_struct audio_work;2419 struct work_struct audio_work;
2420 int num_crtc; /* number of crtcs */2420 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
54 /* Intel 82855PM host bridge / Mobility 9600 M10 RV350 Needs AGPMode 1 (lp #195051) */54 /* Intel 82855PM host bridge / Mobility 9600 M10 RV350 Needs AGPMode 1 (lp #195051) */
55 { PCI_VENDOR_ID_INTEL, 0x3340, PCI_VENDOR_ID_ATI, 0x4e50,55 { PCI_VENDOR_ID_INTEL, 0x3340, PCI_VENDOR_ID_ATI, 0x4e50,
56 PCI_VENDOR_ID_IBM, 0x0550, 1},56 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},
57 /* Intel 82855PM host bridge / Mobility M7 needs AGPMode 1 */60 /* Intel 82855PM host bridge / Mobility M7 needs AGPMode 1 */
58 { PCI_VENDOR_ID_INTEL, 0x3340, PCI_VENDOR_ID_ATI, 0x4c57,61 { PCI_VENDOR_ID_INTEL, 0x3340, PCI_VENDOR_ID_ATI, 0x4c57,
59 PCI_VENDOR_ID_IBM, 0x0530, 1},62 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
1234 if (r < 0)1234 if (r < 0)
1235 return connector_status_disconnected;1235 return connector_status_disconnected;
1236 1236
1237 if (radeon_connector->detected_hpd_without_ddc) {
1238 force = true;
1239 radeon_connector->detected_hpd_without_ddc = false;
1240 }
1241
1237 if (!force && radeon_check_hpd_status_unchanged(connector)) {1242 if (!force && radeon_check_hpd_status_unchanged(connector)) {
1238 ret = connector->status;1243 ret = connector->status;
1239 goto exit;1244 goto exit;
1240 }1245 }
1241 1246
1242 if (radeon_connector->ddc_bus)1247 if (radeon_connector->ddc_bus) {
1243 dret = radeon_ddc_probe(radeon_connector, false);1248 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 }
1244 if (dret) {1263 if (dret) {
1245 radeon_connector->detected_by_load = false;1264 radeon_connector->detected_by_load = false;
1246 radeon_connector_free_edid(connector);1265 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
322 * to complete in this vblank?322 * to complete in this vblank?
323 */323 */
324 if (update_pending &&324 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,
326 &vpos, &hpos, NULL, NULL,328 &vpos, &hpos, NULL, NULL,
327 &rdev->mode_info.crtcs[crtc_id]->base.hwmode)) &&329 &rdev->mode_info.crtcs[crtc_id]->base.hwmode)) &&
328 ((vpos >= (99 * rdev->mode_info.crtcs[crtc_id]->base.hwmode.crtc_vdisplay)/100) ||330 ((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
401 struct drm_crtc *crtc = &radeon_crtc->base;403 struct drm_crtc *crtc = &radeon_crtc->base;
402 unsigned long flags;404 unsigned long flags;
403 int r;405 int r;
406 int vpos, hpos, stat, min_udelay;
407 struct drm_vblank_crtc *vblank = &crtc->dev->vblank[work->crtc_id];
404 408
405 down_read(&rdev->exclusive_lock);409 down_read(&rdev->exclusive_lock);
406 if (work->fence) {410 if (work->fence) {
@@ -437,6 +441,41 @@ static void radeon_flip_work_func(struct work_struct *__work) · 30 unmodified lines
437 /* set the proper interrupt */441 /* set the proper interrupt */
438 radeon_irq_kms_pflip_irq_get(rdev, radeon_crtc->crtc_id);442 radeon_irq_kms_pflip_irq_get(rdev, radeon_crtc->crtc_id);
439 443
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
440 /* do the flip (mmio) */479 /* do the flip (mmio) */
441 radeon_page_flip(rdev, radeon_crtc->crtc_id, work->base);480 radeon_page_flip(rdev, radeon_crtc->crtc_id, work->base);
442 481
@@ -1768,6 +1807,15 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc, · 1325 unmodified lines
1768 * \param dev Device to query.1807 * \param dev Device to query.
1769 * \param crtc Crtc to query.1808 * \param crtc Crtc to query.
1770 * \param flags Flags from caller (DRM_CALLED_FROM_VBLIRQ or 0).1809 * \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 *
1771 * \param *vpos Location where vertical scanout position should be stored.1819 * \param *vpos Location where vertical scanout position should be stored.
1772 * \param *hpos Location where horizontal scanout position should go.1820 * \param *hpos Location where horizontal scanout position should go.
1773 * \param *stime Target location for timestamp taken immediately before1821 * \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
1911 vbl_end = 0;1959 vbl_end = 0;
1912 }1960 }
1913 1961
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
1914 /* Test scanout position against vblank region. */1981 /* Test scanout position against vblank region. */
1915 if ((*vpos < vbl_start) && (*vpos >= vbl_end))1982 if ((*vpos < vbl_start) && (*vpos >= vbl_end))
1916 in_vbl = false;1983 in_vbl = false;
1917 1984
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
1918 /* Check if inside vblank area and apply corrective offsets:1996 /* Check if inside vblank area and apply corrective offsets:
1919 * vpos will then be >=0 in video scanout area, but negative1997 * vpos will then be >=0 in video scanout area, but negative
1920 * within vblank area, counting down the number of lines until1998 * 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
1930 /* Correct for shifted end of vbl at vbl_end. */2008 /* Correct for shifted end of vbl at vbl_end. */
1931 *vpos = *vpos - vbl_end;2009 *vpos = *vpos - vbl_end;
1932 2010
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
1959 return ret;2011 return ret;
1960}2012}
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
74static void radeon_hotplug_work_func(struct work_struct *work)74static void radeon_hotplug_work_func(struct work_struct *work)
75{75{
76 struct radeon_device *rdev = container_of(work, struct radeon_device,76 struct radeon_device *rdev = container_of(work, struct radeon_device,
77 hotplug_work);77 hotplug_work.work);
78 struct drm_device *dev = rdev->ddev;78 struct drm_device *dev = rdev->ddev;
79 struct drm_mode_config *mode_config = &dev->mode_config;79 struct drm_mode_config *mode_config = &dev->mode_config;
80 struct drm_connector *connector;80 struct drm_connector *connector;
@@ -302,7 +302,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev) · 221 unmodified lines
302 }302 }
303 }303 }
304 304
305 INIT_WORK(&rdev->hotplug_work, radeon_hotplug_work_func);305 INIT_DELAYED_WORK(&rdev->hotplug_work, radeon_hotplug_work_func);
306 INIT_WORK(&rdev->dp_work, radeon_dp_work_func);306 INIT_WORK(&rdev->dp_work, radeon_dp_work_func);
307 INIT_WORK(&rdev->audio_work, r600_audio_update_hdmi);307 INIT_WORK(&rdev->audio_work, r600_audio_update_hdmi);
308 308
@@ -310,7 +310,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev) · 1 unmodified line
310 r = drm_irq_install(rdev->ddev, rdev->ddev->pdev->irq);310 r = drm_irq_install(rdev->ddev, rdev->ddev->pdev->irq);
311 if (r) {311 if (r) {
312 rdev->irq.installed = false;312 rdev->irq.installed = false;
313 flush_work(&rdev->hotplug_work);313 flush_delayed_work(&rdev->hotplug_work);
314 return r;314 return r;
315 }315 }
316 316
@@ -333,7 +333,7 @@ void radeon_irq_kms_fini(struct radeon_device *rdev) · 16 unmodified lines
333 rdev->irq.installed = false;333 rdev->irq.installed = false;
334 if (rdev->msi_enabled)334 if (rdev->msi_enabled)
335 pci_disable_msi(rdev->pdev);335 pci_disable_msi(rdev->pdev);
336 flush_work(&rdev->hotplug_work);336 flush_delayed_work(&rdev->hotplug_work);
337 }337 }
338}338}
339 339
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
755 */755 */
756u32 radeon_get_vblank_counter_kms(struct drm_device *dev, int crtc)756u32 radeon_get_vblank_counter_kms(struct drm_device *dev, int crtc)
757{757{
758 int vpos, hpos, stat;
759 u32 count;
758 struct radeon_device *rdev = dev->dev_private;760 struct radeon_device *rdev = dev->dev_private;
759 761
760 if (crtc < 0 || crtc >= rdev->num_crtc) {762 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
762 return -EINVAL;764 return -EINVAL;
763 }765 }
764 766
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;
766}814}
767 815
768/**816/**
drivers/gpu/drm/radeon/radeon_mode.h+5−0
@@ -367,6 +367,7 @@ struct radeon_crtc { · 366 unmodified lines
367 u32 line_time;367 u32 line_time;
368 u32 wm_low;368 u32 wm_low;
369 u32 wm_high;369 u32 wm_high;
370 u32 lb_vblank_lead_lines;
370 struct drm_display_mode hw_mode;371 struct drm_display_mode hw_mode;
371 enum radeon_output_csc output_csc;372 enum radeon_output_csc output_csc;
372};373};
@@ -553,6 +554,7 @@ struct radeon_connector { · 180 unmodified lines
553 void *con_priv;554 void *con_priv;
554 bool dac_load_detect;555 bool dac_load_detect;
555 bool detected_by_load; /* if the connection status was determined by load */556 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 */
556 uint16_t connector_object_id;558 uint16_t connector_object_id;
557 struct radeon_hpd hpd;559 struct radeon_hpd hpd;
558 struct radeon_router router;560 struct radeon_router router;
@@ -686,6 +688,9 @@ struct atom_voltage_table · 127 unmodified lines
686 struct atom_voltage_table_entry entries[MAX_VOLTAGE_ENTRIES];688 struct atom_voltage_table_entry entries[MAX_VOLTAGE_ENTRIES];
687};689};
688 690
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)
689 694
690extern void695extern void
691radeon_add_atom_connector(struct drm_device *dev,696radeon_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
221 if (!(rdev->flags & RADEON_IS_PCIE))221 if (!(rdev->flags & RADEON_IS_PCIE))
222 bo->flags &= ~(RADEON_GEM_GTT_WC | RADEON_GEM_GTT_UC);222 bo->flags &= ~(RADEON_GEM_GTT_WC | RADEON_GEM_GTT_UC);
223 223
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
224#ifdef CONFIG_X86_32230#ifdef CONFIG_X86_32
225 /* XXX: Write-combined CPU mappings of GTT seem broken on 32-bit231 /* XXX: Write-combined CPU mappings of GTT seem broken on 32-bit
226 * See https://bugs.freedesktop.org/show_bug.cgi?id=84627232 * See https://bugs.freedesktop.org/show_bug.cgi?id=84627
227 */233 */
228 bo->flags &= ~RADEON_GEM_GTT_WC;234 bo->flags &= ~(RADEON_GEM_GTT_WC | RADEON_GEM_GTT_UC);
229#elif defined(CONFIG_X86) && !defined(CONFIG_X86_PAT)235#elif defined(CONFIG_X86) && !defined(CONFIG_X86_PAT)
230 /* Don't try to enable write-combining when it can't work, or things236 /* Don't try to enable write-combining when it can't work, or things
231 * may be slow237 * may be slow
@@ -235,9 +241,10 @@ int radeon_bo_create(struct radeon_device *rdev, · 3 unmodified lines
235#warning Please enable CONFIG_MTRR and CONFIG_X86_PAT for better performance \241#warning Please enable CONFIG_MTRR and CONFIG_X86_PAT for better performance \
236 thanks to write-combining242 thanks to write-combining
237 243
238 DRM_INFO_ONCE("Please enable CONFIG_MTRR and CONFIG_X86_PAT for "244 if (bo->flags & RADEON_GEM_GTT_WC)
239 "better performance thanks to write-combining\n");245 DRM_INFO_ONCE("Please enable CONFIG_MTRR and CONFIG_X86_PAT for "
240 bo->flags &= ~RADEON_GEM_GTT_WC;246 "better performance thanks to write-combining\n");
247 bo->flags &= ~(RADEON_GEM_GTT_WC | RADEON_GEM_GTT_UC);
241#endif248#endif
242 249
243 radeon_ttm_placement_from_domain(bo, domain);250 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
1542 ret = device_create_file(rdev->dev, &dev_attr_power_method);1542 ret = device_create_file(rdev->dev, &dev_attr_power_method);
1543 if (ret)1543 if (ret)
1544 DRM_ERROR("failed to create device file for power method\n");1544 DRM_ERROR("failed to create device file for power method\n");
1545 if (!ret)1545 rdev->pm.sysfs_initialized = true;
1546 rdev->pm.sysfs_initialized = true;
1547 }1546 }
1548 1547
1549 mutex_lock(&rdev->pm.mutex);1548 mutex_lock(&rdev->pm.mutex);
@@ -1757,7 +1756,9 @@ static bool radeon_pm_in_vbl(struct radeon_device *rdev) · 207 unmodified lines
1757 */1756 */
1758 for (crtc = 0; (crtc < rdev->num_crtc) && in_vbl; crtc++) {1757 for (crtc = 0; (crtc < rdev->num_crtc) && in_vbl; crtc++) {
1759 if (rdev->pm.active_crtcs & (1 << crtc)) {1758 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,
1761 &vpos, &hpos, NULL, NULL,1762 &vpos, &hpos, NULL, NULL,
1762 &rdev->mode_info.crtcs[crtc]->base.hwmode);1763 &rdev->mode_info.crtcs[crtc]->base.hwmode);
1763 if ((vbl_status & DRM_SCANOUTPOS_VALID) &&1764 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
813 status = rs600_irq_ack(rdev);813 status = rs600_irq_ack(rdev);
814 }814 }
815 if (queue_hotplug)815 if (queue_hotplug)
816 schedule_work(&rdev->hotplug_work);816 schedule_delayed_work(&rdev->hotplug_work, 0);
817 if (queue_hdmi)817 if (queue_hdmi)
818 schedule_work(&rdev->audio_work);818 schedule_work(&rdev->audio_work);
819 if (rdev->msi_enabled) {819 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
207{207{
208 u32 tmp;208 u32 tmp;
209 209
210 /* Guess line buffer size to be 8192 pixels */
211 u32 lb_size = 8192;
212
210 /*213 /*
211 * Line Buffer Setup214 * Line Buffer Setup
212 * There is a single line buffer shared by both display controllers.215 * 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
243 tmp |= V_006520_DC_LB_MEMORY_SPLIT_D1_1Q_D2_3Q;246 tmp |= V_006520_DC_LB_MEMORY_SPLIT_D1_1Q_D2_3Q;
244 }247 }
245 WREG32(R_006520_DC_LB_MEMORY_SPLIT, tmp);248 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);
246}256}
247 257
248struct rs690_watermark {258struct 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
464 result = rv770_send_msg_to_smc(rdev, PPSMC_MSG_TwoLevelsDisabled);464 result = rv770_send_msg_to_smc(rdev, PPSMC_MSG_TwoLevelsDisabled);
465 465
466 if (result != PPSMC_Result_OK)466 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");
468 468
469 WREG32_P(GENERAL_PWRMGT, 0, ~GLOBAL_PWRMGT_EN);469 WREG32_P(GENERAL_PWRMGT, 0, ~GLOBAL_PWRMGT_EN);
470 470
drivers/gpu/drm/radeon/rv770_dpm.c+2−2
@@ -193,7 +193,7 @@ void rv770_stop_dpm(struct radeon_device *rdev) · 192 unmodified lines
193 result = rv770_send_msg_to_smc(rdev, PPSMC_MSG_TwoLevelsDisabled);193 result = rv770_send_msg_to_smc(rdev, PPSMC_MSG_TwoLevelsDisabled);
194 194
195 if (result != PPSMC_Result_OK)195 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");
197 197
198 WREG32_P(GENERAL_PWRMGT, 0, ~GLOBAL_PWRMGT_EN);198 WREG32_P(GENERAL_PWRMGT, 0, ~GLOBAL_PWRMGT_EN);
199 199
@@ -1418,7 +1418,7 @@ int rv770_resume_smc(struct radeon_device *rdev) · 1218 unmodified lines
1418int rv770_set_sw_state(struct radeon_device *rdev)1418int rv770_set_sw_state(struct radeon_device *rdev)
1419{1419{
1420 if (rv770_send_msg_to_smc(rdev, PPSMC_MSG_SwitchToSwState) != PPSMC_Result_OK)1420 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");
1422 return 0;1422 return 0;
1423}1423}
1424 1424
drivers/gpu/drm/radeon/si.c+4−1
@@ -2376,6 +2376,9 @@ static void dce6_program_watermarks(struct radeon_device *rdev, · 2375 unmodified lines
2376 c.full = dfixed_div(c, a);2376 c.full = dfixed_div(c, a);
2377 priority_b_mark = dfixed_trunc(c);2377 priority_b_mark = dfixed_trunc(c);
2378 priority_b_cnt |= priority_b_mark & PRIORITY_MARK_MASK;2378 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);
2379 }2382 }
2380 2383
2381 /* select wm A */2384 /* select wm A */
@@ -6848,7 +6851,7 @@ restart_ih: · 4466 unmodified lines
6848 if (queue_dp)6851 if (queue_dp)
6849 schedule_work(&rdev->dp_work);6852 schedule_work(&rdev->dp_work);
6850 if (queue_hotplug)6853 if (queue_hotplug)
6851 schedule_work(&rdev->hotplug_work);6854 schedule_delayed_work(&rdev->hotplug_work, 0);
6852 if (queue_thermal && rdev->pm.dpm_enabled)6855 if (queue_thermal && rdev->pm.dpm_enabled)
6853 schedule_work(&rdev->pm.dpm.thermal.work);6856 schedule_work(&rdev->pm.dpm.thermal.work);
6854 rdev->ih.rptr = rptr;6857 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
2927 { PCI_VENDOR_ID_ATI, 0x6810, 0x1462, 0x3036, 0, 120000 },2927 { PCI_VENDOR_ID_ATI, 0x6810, 0x1462, 0x3036, 0, 120000 },
2928 { PCI_VENDOR_ID_ATI, 0x6811, 0x174b, 0xe271, 0, 120000 },2928 { PCI_VENDOR_ID_ATI, 0x6811, 0x174b, 0xe271, 0, 120000 },
2929 { PCI_VENDOR_ID_ATI, 0x6810, 0x174b, 0xe271, 85000, 90000 },2929 { 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 },
2931 { PCI_VENDOR_ID_ATI, 0x6811, 0x1043, 0x2015, 0, 120000 },2931 { PCI_VENDOR_ID_ATI, 0x6811, 0x1043, 0x2015, 0, 120000 },
2932 { 0, 0, 0, 0 },2932 { 0, 0, 0, 0 },
2933};2933};
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
67 * VM_PFNMAP flag that was set by drm_gem_mmap_obj()/drm_gem_mmap().67 * VM_PFNMAP flag that was set by drm_gem_mmap_obj()/drm_gem_mmap().
68 */68 */
69 vma->vm_flags &= ~VM_PFNMAP;69 vma->vm_flags &= ~VM_PFNMAP;
70 vma->vm_pgoff = 0;
70 71
71 ret = dma_mmap_attrs(drm->dev, vma, rk_obj->kvaddr, rk_obj->dma_addr,72 ret = dma_mmap_attrs(drm->dev, vma, rk_obj->kvaddr, rk_obj->dma_addr,
72 obj->size, &rk_obj->dma_attrs);73 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
374 .data = &rk3288_vop },374 .data = &rk3288_vop },
375 {},375 {},
376};376};
377MODULE_DEVICE_TABLE(of, vop_driver_dt_match);
377 378
378static inline void vop_writel(struct vop *vop, uint32_t offset, uint32_t v)379static inline void vop_writel(struct vop *vop, uint32_t offset, uint32_t v)
379{380{
@@ -959,8 +960,8 @@ static int vop_update_plane_event(struct drm_plane *plane, · 579 unmodified lines
959 val = (dest.y2 - dest.y1 - 1) << 16;960 val = (dest.y2 - dest.y1 - 1) << 16;
960 val |= (dest.x2 - dest.x1 - 1) & 0xffff;961 val |= (dest.x2 - dest.x1 - 1) & 0xffff;
961 VOP_WIN_SET(vop, win, dsp_info, val);962 VOP_WIN_SET(vop, win, dsp_info, val);
962 val = (dsp_sty - 1) << 16;963 val = dsp_sty << 16;
963 val |= (dsp_stx - 1) & 0xffff;964 val |= dsp_stx & 0xffff;
964 VOP_WIN_SET(vop, win, dsp_st, val);965 VOP_WIN_SET(vop, win, dsp_st, val);
965 VOP_WIN_SET(vop, win, rb_swap, rb_swap);966 VOP_WIN_SET(vop, win, rb_swap, rb_swap);
966 967
@@ -1289,7 +1290,7 @@ static void vop_win_state_complete(struct vop_win *vop_win, · 322 unmodified lines
1289 1290
1290 if (state->event) {1291 if (state->event) {
1291 spin_lock_irqsave(&drm->event_lock, flags);1292 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);
1293 spin_unlock_irqrestore(&drm->event_lock, flags);1294 spin_unlock_irqrestore(&drm->event_lock, flags);
1294 }1295 }
1295 1296
@@ -1575,32 +1576,25 @@ static int vop_initial(struct vop *vop) · 279 unmodified lines
1575 return PTR_ERR(vop->dclk);1576 return PTR_ERR(vop->dclk);
1576 }1577 }
1577 1578
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
1584 ret = clk_prepare(vop->dclk);1579 ret = clk_prepare(vop->dclk);
1585 if (ret < 0) {1580 if (ret < 0) {
1586 dev_err(vop->dev, "failed to prepare dclk\n");1581 dev_err(vop->dev, "failed to prepare dclk\n");
1587 goto err_unprepare_hclk;1582 return ret;
1588 }1583 }
1589 1584
1590 ret = clk_prepare(vop->aclk);1585 /* Enable both the hclk and aclk to setup the vop */
1586 ret = clk_prepare_enable(vop->hclk);
1591 if (ret < 0) {1587 if (ret < 0) {
1592 dev_err(vop->dev, "failed to prepare aclk\n");1588 dev_err(vop->dev, "failed to prepare/enable hclk\n");
1593 goto err_unprepare_dclk;1589 goto err_unprepare_dclk;
1594 }1590 }
1595 1591
1596 /*1592 ret = clk_prepare_enable(vop->aclk);
1597 * enable hclk, so that we can config vop register.
1598 */
1599 ret = clk_enable(vop->hclk);
1600 if (ret < 0) {1593 if (ret < 0) {
1601 dev_err(vop->dev, "failed to prepare aclk\n");1594 dev_err(vop->dev, "failed to prepare/enable aclk\n");
1602 goto err_unprepare_aclk;1595 goto err_disable_hclk;
1603 }1596 }
1597
1604 /*1598 /*
1605 * do hclk_reset, reset all vop registers.1599 * do hclk_reset, reset all vop registers.
1606 */1600 */
@@ -1608,7 +1602,7 @@ static int vop_initial(struct vop *vop) · 1 unmodified line
1608 if (IS_ERR(ahb_rst)) {1602 if (IS_ERR(ahb_rst)) {
1609 dev_err(vop->dev, "failed to get ahb reset\n");1603 dev_err(vop->dev, "failed to get ahb reset\n");
1610 ret = PTR_ERR(ahb_rst);1604 ret = PTR_ERR(ahb_rst);
1611 goto err_disable_hclk;1605 goto err_disable_aclk;
1612 }1606 }
1613 reset_control_assert(ahb_rst);1607 reset_control_assert(ahb_rst);
1614 usleep_range(10, 20);1608 usleep_range(10, 20);
@@ -1634,26 +1628,25 @@ static int vop_initial(struct vop *vop) · 19 unmodified lines
1634 if (IS_ERR(vop->dclk_rst)) {1628 if (IS_ERR(vop->dclk_rst)) {
1635 dev_err(vop->dev, "failed to get dclk reset\n");1629 dev_err(vop->dev, "failed to get dclk reset\n");
1636 ret = PTR_ERR(vop->dclk_rst);1630 ret = PTR_ERR(vop->dclk_rst);
1637 goto err_unprepare_aclk;1631 goto err_disable_aclk;
1638 }1632 }
1639 reset_control_assert(vop->dclk_rst);1633 reset_control_assert(vop->dclk_rst);
1640 usleep_range(10, 20);1634 usleep_range(10, 20);
1641 reset_control_deassert(vop->dclk_rst);1635 reset_control_deassert(vop->dclk_rst);
1642 1636
1643 clk_disable(vop->hclk);1637 clk_disable(vop->hclk);
1638 clk_disable(vop->aclk);
1644 1639
1645 vop->is_enabled = false;1640 vop->is_enabled = false;
1646 1641
1647 return 0;1642 return 0;
1648 1643
1644err_disable_aclk:
1645 clk_disable_unprepare(vop->aclk);
1649err_disable_hclk:1646err_disable_hclk:
1650 clk_disable(vop->hclk);1647 clk_disable_unprepare(vop->hclk);
1651err_unprepare_aclk:
1652 clk_unprepare(vop->aclk);
1653err_unprepare_dclk:1648err_unprepare_dclk:
1654 clk_unprepare(vop->dclk);1649 clk_unprepare(vop->dclk);
1655err_unprepare_hclk:
1656 clk_unprepare(vop->hclk);
1657 return ret;1650 return ret;
1658}1651}
1659 1652
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
168 struct drm_connector *connector;168 struct drm_connector *connector;
169 169
170 drm_for_each_connector(connector, crtc->dev) {170 drm_for_each_connector(connector, crtc->dev) {
171 if (connector && connector->state->crtc == crtc) {171 if (connector->state->crtc == crtc) {
172 struct drm_encoder *encoder = connector->encoder;172 struct drm_encoder *encoder = connector->encoder;
173 struct vc4_encoder *vc4_encoder =173 struct vc4_encoder *vc4_encoder =
174 to_vc4_encoder(encoder);174 to_vc4_encoder(encoder);
@@ -401,7 +401,8 @@ static void vc4_crtc_atomic_flush(struct drm_crtc *crtc, · 226 unmodified lines
401 dlist_next++;401 dlist_next++;
402 402
403 HVS_WRITE(SCALER_DISPLISTX(vc4_crtc->channel),403 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);
405 406
406 /* Make the next display list start after ours. */407 /* Make the next display list start after ours. */
407 vc4_crtc->dlist_size -= (dlist_next - vc4_crtc->dlist);408 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
591 * that will take too much.592 * that will take too much.
592 */593 */
593 primary_plane = vc4_plane_init(drm, DRM_PLANE_TYPE_PRIMARY);594 primary_plane = vc4_plane_init(drm, DRM_PLANE_TYPE_PRIMARY);
594 if (!primary_plane) {595 if (IS_ERR(primary_plane)) {
595 dev_err(dev, "failed to construct primary plane\n");596 dev_err(dev, "failed to construct primary plane\n");
596 ret = PTR_ERR(primary_plane);597 ret = PTR_ERR(primary_plane);
597 goto err;598 goto err;
598 }599 }
599 600
600 cursor_plane = vc4_plane_init(drm, DRM_PLANE_TYPE_CURSOR);601 cursor_plane = vc4_plane_init(drm, DRM_PLANE_TYPE_CURSOR);
601 if (!cursor_plane) {602 if (IS_ERR(cursor_plane)) {
602 dev_err(dev, "failed to construct cursor plane\n");603 dev_err(dev, "failed to construct cursor plane\n");
603 ret = PTR_ERR(cursor_plane);604 ret = PTR_ERR(cursor_plane);
604 goto err_primary;605 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
259 .remove = vc4_platform_drm_remove,259 .remove = vc4_platform_drm_remove,
260 .driver = {260 .driver = {
261 .name = "vc4-drm",261 .name = "vc4-drm",
262 .owner = THIS_MODULE,
263 .of_match_table = vc4_of_match,262 .of_match_table = vc4_of_match,
264 },263 },
265};264};
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
75 for (i = 0; i < 64; i += 4) {75 for (i = 0; i < 64; i += 4) {
76 DRM_INFO("0x%08x (%s): 0x%08x 0x%08x 0x%08x 0x%08x\n",76 DRM_INFO("0x%08x (%s): 0x%08x 0x%08x 0x%08x 0x%08x\n",
77 i * 4, i < HVS_BOOTLOADER_DLIST_END ? "B" : "D",77 i * 4, i < HVS_BOOTLOADER_DLIST_END ? "B" : "D",
78 ((uint32_t *)vc4->hvs->dlist)[i + 0],78 readl((u32 __iomem *)vc4->hvs->dlist + i + 0),
79 ((uint32_t *)vc4->hvs->dlist)[i + 1],79 readl((u32 __iomem *)vc4->hvs->dlist + i + 1),
80 ((uint32_t *)vc4->hvs->dlist)[i + 2],80 readl((u32 __iomem *)vc4->hvs->dlist + i + 2),
81 ((uint32_t *)vc4->hvs->dlist)[i + 3]);81 readl((u32 __iomem *)vc4->hvs->dlist + i + 3));
82 }82 }
83}83}
84 84
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
70 return state->fb && state->crtc;70 return state->fb && state->crtc;
71}71}
72 72
73struct drm_plane_state *vc4_plane_duplicate_state(struct drm_plane *plane)73static struct drm_plane_state *vc4_plane_duplicate_state(struct drm_plane *plane)
74{74{
75 struct vc4_plane_state *vc4_state;75 struct vc4_plane_state *vc4_state;
76 76
@@ -97,8 +97,8 @@ struct drm_plane_state *vc4_plane_duplicate_state(struct drm_plane *plane) · 20 unmodified lines
97 return &vc4_state->base;97 return &vc4_state->base;
98}98}
99 99
100void vc4_plane_destroy_state(struct drm_plane *plane,100static void vc4_plane_destroy_state(struct drm_plane *plane,
101 struct drm_plane_state *state)101 struct drm_plane_state *state)
102{102{
103 struct vc4_plane_state *vc4_state = to_vc4_plane_state(state);103 struct vc4_plane_state *vc4_state = to_vc4_plane_state(state);
104 104
@@ -108,7 +108,7 @@ void vc4_plane_destroy_state(struct drm_plane *plane, · 3 unmodified lines
108}108}
109 109
110/* Called during init to allocate the plane's atomic state. */110/* Called during init to allocate the plane's atomic state. */
111void vc4_plane_reset(struct drm_plane *plane)111static void vc4_plane_reset(struct drm_plane *plane)
112{112{
113 struct vc4_plane_state *vc4_state;113 struct vc4_plane_state *vc4_state;
114 114
@@ -157,6 +157,16 @@ static int vc4_plane_mode_set(struct drm_plane *plane, · 42 unmodified lines
157 int crtc_w = state->crtc_w;157 int crtc_w = state->crtc_w;
158 int crtc_h = state->crtc_h;158 int crtc_h = state->crtc_h;
159 159
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
160 if (crtc_x < 0) {170 if (crtc_x < 0) {
161 offset += drm_format_plane_cpp(fb->pixel_format, 0) * -crtc_x;171 offset += drm_format_plane_cpp(fb->pixel_format, 0) * -crtc_x;
162 crtc_w += crtc_x;172 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
412 .save = virtio_gpu_conn_save,412 .save = virtio_gpu_conn_save,
413 .restore = virtio_gpu_conn_restore,413 .restore = virtio_gpu_conn_restore,
414 .detect = virtio_gpu_conn_detect,414 .detect = virtio_gpu_conn_detect,
415 .fill_modes = drm_helper_probe_single_connector_modes,415 .fill_modes = drm_helper_probe_single_connector_modes_nomerge,
416 .destroy = virtio_gpu_conn_destroy,416 .destroy = virtio_gpu_conn_destroy,
417 .reset = drm_atomic_helper_connector_reset,417 .reset = drm_atomic_helper_connector_reset,
418 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,418 .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
28#include <linux/irqchip/chained_irq.h>28#include <linux/irqchip/chained_irq.h>
29#include <linux/irqdomain.h>29#include <linux/irqdomain.h>
30#include <linux/of_device.h>30#include <linux/of_device.h>
31#include <linux/of_graph.h>
31 32
32#include <drm/drm_fourcc.h>33#include <drm/drm_fourcc.h>
33 34
@@ -993,11 +994,25 @@ static void platform_device_unregister_children(struct platform_device *pdev) · 959 unmodified lines
993struct ipu_platform_reg {994struct ipu_platform_reg {
994 struct ipu_client_platformdata pdata;995 struct ipu_client_platformdata pdata;
995 const char *name;996 const char *name;
996 int reg_offset;
997};997};
998 998
999/* These must be in the order of the corresponding device tree port nodes */
999static const struct ipu_platform_reg client_reg[] = {1000static const struct ipu_platform_reg client_reg[] = {
1000 {1001 {
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 }, {
1001 .pdata = {1016 .pdata = {
1002 .di = 0,1017 .di = 0,
1003 .dc = 5,1018 .dc = 5,
@@ -1015,22 +1030,6 @@ static const struct ipu_platform_reg client_reg[] = { · 11 unmodified lines
1015 .dma[1] = -EINVAL,1030 .dma[1] = -EINVAL,
1016 },1031 },
1017 .name = "imx-ipuv3-crtc",1032 .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",
1034 },1033 },
1035};1034};
1036 1035
@@ -1051,22 +1050,30 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base) · 14 unmodified lines
1051 for (i = 0; i < ARRAY_SIZE(client_reg); i++) {1050 for (i = 0; i < ARRAY_SIZE(client_reg); i++) {
1052 const struct ipu_platform_reg *reg = &client_reg[i];1051 const struct ipu_platform_reg *reg = &client_reg[i];
1053 struct platform_device *pdev;1052 struct platform_device *pdev;
1054 struct resource res;1053
1055 1054 pdev = platform_device_alloc(reg->name, id++);
1056 if (reg->reg_offset) {1055 if (!pdev) {
1057 memset(&res, 0, sizeof(res));1056 ret = -ENOMEM;
1058 res.flags = IORESOURCE_MEM;1057 goto err_register;
1059 res.start = ipu_base + ipu->devtype->cm_ofs + reg->reg_offset;1058 }
1060 res.end = res.start + PAGE_SIZE - 1;1059
1061 pdev = platform_device_register_resndata(dev, reg->name,1060 pdev->dev.parent = dev;
1062 id++, &res, 1, &reg->pdata, sizeof(reg->pdata));1061
1063 } else {1062 /* Associate subdevice with the corresponding port node */
1064 pdev = platform_device_register_data(dev, reg->name,1063 pdev->dev.of_node = of_graph_get_port_by_id(dev->of_node, i);
1065 id++, &reg->pdata, sizeof(reg->pdata));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;
1066 }1069 }
1067 1070
1068 if (IS_ERR(pdev)) {1071 ret = platform_device_add_data(pdev, &reg->pdata,
1069 ret = PTR_ERR(pdev);1072 sizeof(reg->pdata));
1073 if (!ret)
1074 ret = platform_device_add(pdev);
1075 if (ret) {
1076 platform_device_put(pdev);
1070 goto err_register;1077 goto err_register;
1071 }1078 }
1072 }1079 }
drivers/hid/hid-ids.h+1−0
@@ -609,6 +609,7 @@ · 608 unmodified lines
609#define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110609#define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110
610#define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f610#define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f
611#define USB_DEVICE_ID_LOGITECH_HARMONY_PS3 0x0306611#define USB_DEVICE_ID_LOGITECH_HARMONY_PS3 0x0306
612#define USB_DEVICE_ID_LOGITECH_KEYBOARD_G710_PLUS 0xc24d
612#define USB_DEVICE_ID_LOGITECH_MOUSE_C01A 0xc01a613#define USB_DEVICE_ID_LOGITECH_MOUSE_C01A 0xc01a
613#define USB_DEVICE_ID_LOGITECH_MOUSE_C05A 0xc05a614#define USB_DEVICE_ID_LOGITECH_MOUSE_C05A 0xc05a
614#define USB_DEVICE_ID_LOGITECH_MOUSE_C06A 0xc06a615#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
665 struct lg_drv_data *drv_data;665 struct lg_drv_data *drv_data;
666 int ret;666 int ret;
667 667
668 /* Only work with the 1st interface (G29 presents multiple) */668 /* G29 only work with the 1st interface */
669 if (iface_num != 0) {669 if ((hdev->product == USB_DEVICE_ID_LOGITECH_G29_WHEEL) &&
670 (iface_num != 0)) {
670 dbg_hid("%s: ignoring ifnum %d\n", __func__, iface_num);671 dbg_hid("%s: ignoring ifnum %d\n", __func__, iface_num);
671 return -ENODEV;672 return -ENODEV;
672 }673 }
drivers/hid/usbhid/hid-quirks.c+1−0
@@ -84,6 +84,7 @@ static const struct hid_blacklist { · 83 unmodified lines
84 { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A, HID_QUIRK_ALWAYS_POLL },84 { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A, HID_QUIRK_ALWAYS_POLL },
85 { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },85 { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
86 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077, HID_QUIRK_ALWAYS_POLL },86 { 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 },
87 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C01A, HID_QUIRK_ALWAYS_POLL },88 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C01A, HID_QUIRK_ALWAYS_POLL },
88 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C05A, HID_QUIRK_ALWAYS_POLL },89 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C05A, HID_QUIRK_ALWAYS_POLL },
89 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C06A, HID_QUIRK_ALWAYS_POLL },90 { 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
2481 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {2481 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
2482 if (features->touch_max)2482 if (features->touch_max)
2483 features->device_type |= WACOM_DEVICETYPE_TOUCH;2483 features->device_type |= WACOM_DEVICETYPE_TOUCH;
2484 if (features->type >= INTUOSHT || features->type <= BAMBOO_PT)2484 if (features->type >= INTUOSHT && features->type <= BAMBOO_PT)
2485 features->device_type |= WACOM_DEVICETYPE_PAD;2485 features->device_type |= WACOM_DEVICETYPE_PAD;
2486 2486
2487 features->x_max = 4096;2487 features->x_max = 4096;
@@ -3213,7 +3213,8 @@ static const struct wacom_features wacom_features_0x32F = · 725 unmodified lines
3213 WACOM_DTU_OFFSET, WACOM_DTU_OFFSET };3213 WACOM_DTU_OFFSET, WACOM_DTU_OFFSET };
3214static const struct wacom_features wacom_features_0x336 =3214static const struct wacom_features wacom_features_0x336 =
3215 { "Wacom DTU1141", 23472, 13203, 1023, 0,3215 { "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 };
3217static const struct wacom_features wacom_features_0x57 =3218static const struct wacom_features wacom_features_0x57 =
3218 { "Wacom DTK2241", 95640, 54060, 2047, 63,3219 { "Wacom DTK2241", 95640, 54060, 2047, 63,
3219 DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 6,3220 DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 6,
drivers/hwmon/Kconfig+2−0
@@ -324,6 +324,7 @@ config SENSORS_APPLESMC · 323 unmodified lines
324config SENSORS_ARM_SCPI324config SENSORS_ARM_SCPI
325 tristate "ARM SCPI Sensors"325 tristate "ARM SCPI Sensors"
326 depends on ARM_SCPI_PROTOCOL326 depends on ARM_SCPI_PROTOCOL
327 depends on THERMAL || !THERMAL_OF
327 help328 help
328 This driver provides support for temperature, voltage, current329 This driver provides support for temperature, voltage, current
329 and power sensors available on ARM Ltd's SCP based platforms. The330 and power sensors available on ARM Ltd's SCP based platforms. The
@@ -1471,6 +1472,7 @@ config SENSORS_INA209 · 1141 unmodified lines
1471config SENSORS_INA2XX1472config SENSORS_INA2XX
1472 tristate "Texas Instruments INA219 and compatibles"1473 tristate "Texas Instruments INA219 and compatibles"
1473 depends on I2C1474 depends on I2C
1475 select REGMAP_I2C
1474 help1476 help
1475 If you say yes here you get support for INA219, INA220, INA226,1477 If you say yes here you get support for INA219, INA220, INA226,
1476 INA230, and INA231 power monitor chips.1478 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
537static int applesmc_init_smcreg_try(void)537static int applesmc_init_smcreg_try(void)
538{538{
539 struct applesmc_registers *s = &smcreg;539 struct applesmc_registers *s = &smcreg;
540 bool left_light_sensor, right_light_sensor;540 bool left_light_sensor = 0, right_light_sensor = 0;
541 unsigned int count;541 unsigned int count;
542 u8 tmp[1];542 u8 tmp[1];
543 int ret;543 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
117 struct scpi_ops *scpi_ops;117 struct scpi_ops *scpi_ops;
118 struct device *hwdev, *dev = &pdev->dev;118 struct device *hwdev, *dev = &pdev->dev;
119 struct scpi_sensors *scpi_sensors;119 struct scpi_sensors *scpi_sensors;
120 int ret;120 int ret, idx;
121 121
122 scpi_ops = get_scpi_ops();122 scpi_ops = get_scpi_ops();
123 if (!scpi_ops)123 if (!scpi_ops)
@@ -146,8 +146,8 @@ static int scpi_hwmon_probe(struct platform_device *pdev) · 22 unmodified lines
146 146
147 scpi_sensors->scpi_ops = scpi_ops;147 scpi_sensors->scpi_ops = scpi_ops;
148 148
149 for (i = 0; i < nr_sensors; i++) {149 for (i = 0, idx = 0; i < nr_sensors; i++) {
150 struct sensor_data *sensor = &scpi_sensors->data[i];150 struct sensor_data *sensor = &scpi_sensors->data[idx];
151 151
152 ret = scpi_ops->sensor_get_info(i, &sensor->info);152 ret = scpi_ops->sensor_get_info(i, &sensor->info);
153 if (ret)153 if (ret)
@@ -183,7 +183,7 @@ static int scpi_hwmon_probe(struct platform_device *pdev) · 29 unmodified lines
183 num_power++;183 num_power++;
184 break;184 break;
185 default:185 default:
186 break;186 continue;
187 }187 }
188 188
189 sensor->dev_attr_input.attr.mode = S_IRUGO;189 sensor->dev_attr_input.attr.mode = S_IRUGO;
@@ -194,11 +194,12 @@ static int scpi_hwmon_probe(struct platform_device *pdev) · 4 unmodified lines
194 sensor->dev_attr_label.show = scpi_show_label;194 sensor->dev_attr_label.show = scpi_show_label;
195 sensor->dev_attr_label.attr.name = sensor->label;195 sensor->dev_attr_label.attr.name = sensor->label;
196 196
197 scpi_sensors->attrs[i << 1] = &sensor->dev_attr_input.attr;197 scpi_sensors->attrs[idx << 1] = &sensor->dev_attr_input.attr;
198 scpi_sensors->attrs[(i << 1) + 1] = &sensor->dev_attr_label.attr;198 scpi_sensors->attrs[(idx << 1) + 1] = &sensor->dev_attr_label.attr;
199 199
200 sysfs_attr_init(scpi_sensors->attrs[i << 1]);200 sysfs_attr_init(scpi_sensors->attrs[idx << 1]);
201 sysfs_attr_init(scpi_sensors->attrs[(i << 1) + 1]);201 sysfs_attr_init(scpi_sensors->attrs[(idx << 1) + 1]);
202 idx++;
202 }203 }
203 204
204 scpi_sensors->group.attrs = scpi_sensors->attrs;205 scpi_sensors->group.attrs = scpi_sensors->attrs;
@@ -236,8 +237,8 @@ static int scpi_hwmon_probe(struct platform_device *pdev) · 31 unmodified lines
236 237
237 zone->sensor_id = i;238 zone->sensor_id = i;
238 zone->scpi_sensors = scpi_sensors;239 zone->scpi_sensors = scpi_sensors;
239 zone->tzd = thermal_zone_of_sensor_register(dev, i, zone,240 zone->tzd = thermal_zone_of_sensor_register(dev,
240 &scpi_sensor_ops);241 sensor->info.sensor_id, zone, &scpi_sensor_ops);
241 /*242 /*
242 * The call to thermal_zone_of_sensor_register returns243 * The call to thermal_zone_of_sensor_register returns
243 * an error for sensors that are not associated with244 * 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
126 Sunrise Point-LP (PCH)126 Sunrise Point-LP (PCH)
127 DNV (SOC)127 DNV (SOC)
128 Broxton (SOC)128 Broxton (SOC)
129 Lewisburg (PCH)
129 130
130 This driver can also be built as a module. If so, the module131 This driver can also be built as a module. If so, the module
131 will be called i2c-i801.132 will be called i2c-i801.
drivers/i2c/busses/i2c-i801.c+6−0
@@ -62,6 +62,8 @@ · 61 unmodified lines
62 * Sunrise Point-LP (PCH) 0x9d23 32 hard yes yes yes62 * Sunrise Point-LP (PCH) 0x9d23 32 hard yes yes yes
63 * DNV (SOC) 0x19df 32 hard yes yes yes63 * DNV (SOC) 0x19df 32 hard yes yes yes
64 * Broxton (SOC) 0x5ad4 32 hard yes yes yes64 * 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
65 *67 *
66 * Features supported by this driver:68 * Features supported by this driver:
67 * Software PEC no69 * Software PEC no
@@ -206,6 +208,8 @@ · 138 unmodified lines
206#define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_SMBUS 0x9d23208#define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_SMBUS 0x9d23
207#define PCI_DEVICE_ID_INTEL_DNV_SMBUS 0x19df209#define PCI_DEVICE_ID_INTEL_DNV_SMBUS 0x19df
208#define PCI_DEVICE_ID_INTEL_BROXTON_SMBUS 0x5ad4210#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
209 213
210struct i801_mux_config {214struct i801_mux_config {
211 char *gpio_chip;215 char *gpio_chip;
@@ -869,6 +873,8 @@ static const struct pci_device_id i801_ids[] = { · 657 unmodified lines
869 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_SMBUS) },873 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_SMBUS) },
870 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_DNV_SMBUS) },874 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_DNV_SMBUS) },
871 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BROXTON_SMBUS) },875 { 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) },
872 { 0, }878 { 0, }
873};879};
874 880
drivers/i2c/busses/i2c-imx.c+1−0
@@ -50,6 +50,7 @@ · 49 unmodified lines
50#include <linux/of_device.h>50#include <linux/of_device.h>
51#include <linux/of_dma.h>51#include <linux/of_dma.h>
52#include <linux/of_gpio.h>52#include <linux/of_gpio.h>
53#include <linux/pinctrl/consumer.h>
53#include <linux/platform_data/i2c-imx.h>54#include <linux/platform_data/i2c-imx.h>
54#include <linux/platform_device.h>55#include <linux/platform_device.h>
55#include <linux/sched.h>56#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
662 662
663static void xiic_start_xfer(struct xiic_i2c *i2c)663static void xiic_start_xfer(struct xiic_i2c *i2c)
664{664{
665 665 spin_lock(&i2c->lock);
666 xiic_reinit(i2c);
666 __xiic_start_xfer(i2c);667 __xiic_start_xfer(i2c);
668 spin_unlock(&i2c->lock);
667}669}
668 670
669static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)671static 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
715 if (wakeirq > 0 && wakeirq != client->irq)715 if (wakeirq > 0 && wakeirq != client->irq)
716 status = dev_pm_set_dedicated_wake_irq(dev, wakeirq);716 status = dev_pm_set_dedicated_wake_irq(dev, wakeirq);
717 else if (client->irq > 0)717 else if (client->irq > 0)
718 status = dev_pm_set_wake_irq(dev, wakeirq);718 status = dev_pm_set_wake_irq(dev, client->irq);
719 else719 else
720 status = 0;720 status = 0;
721 721
drivers/iio/adc/ad7793.c+1−1
@@ -101,7 +101,7 @@ · 100 unmodified lines
101#define AD7795_CH_AIN1M_AIN1M 8 /* AIN1(-) - AIN1(-) */101#define AD7795_CH_AIN1M_AIN1M 8 /* AIN1(-) - AIN1(-) */
102 102
103/* ID Register Bit Designations (AD7793_REG_ID) */103/* ID Register Bit Designations (AD7793_REG_ID) */
104#define AD7785_ID 0xB104#define AD7785_ID 0x3
105#define AD7792_ID 0xA105#define AD7792_ID 0xA
106#define AD7793_ID 0xB106#define AD7793_ID 0xB
107#define AD7794_ID 0xF107#define AD7794_ID 0xF
drivers/iio/adc/vf610_adc.c+16−6
@@ -106,6 +106,13 @@ · 105 unmodified lines
106 106
107#define DEFAULT_SAMPLE_TIME 1000107#define DEFAULT_SAMPLE_TIME 1000
108 108
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
109enum clk_sel {116enum clk_sel {
110 VF610_ADCIOC_BUSCLK_SET,117 VF610_ADCIOC_BUSCLK_SET,
111 VF610_ADCIOC_ALTCLK_SET,118 VF610_ADCIOC_ALTCLK_SET,
@@ -197,6 +204,8 @@ static inline void vf610_adc_calculate_rates(struct vf610_adc *info) · 85 unmodified lines
197 adc_feature->clk_div = 8;204 adc_feature->clk_div = 8;
198 }205 }
199 206
207 adck_rate = ipg_rate / adc_feature->clk_div;
208
200 /*209 /*
201 * Determine the long sample time adder value to be used based210 * Determine the long sample time adder value to be used based
202 * on the default minimum sample time provided.211 * 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
221 * BCT (Base Conversion Time): fixed to 25 ADCK cycles for 12 bit mode230 * BCT (Base Conversion Time): fixed to 25 ADCK cycles for 12 bit mode
222 * LSTAdder(Long Sample Time): 3, 5, 7, 9, 13, 17, 21, 25 ADCK cycles231 * LSTAdder(Long Sample Time): 3, 5, 7, 9, 13, 17, 21, 25 ADCK cycles
223 */232 */
224 adck_rate = ipg_rate / info->adc_feature.clk_div;
225 for (i = 0; i < ARRAY_SIZE(vf610_hw_avgs); i++)233 for (i = 0; i < ARRAY_SIZE(vf610_hw_avgs); i++)
226 info->sample_freq_avail[i] =234 info->sample_freq_avail[i] =
227 adck_rate / (6 + vf610_hw_avgs[i] *235 adck_rate / (6 + vf610_hw_avgs[i] *
@@ -663,11 +671,13 @@ static int vf610_read_raw(struct iio_dev *indio_dev, · 435 unmodified lines
663 break;671 break;
664 case IIO_TEMP:672 case IIO_TEMP:
665 /*673 /*
666 * Calculate in degree Celsius times 1000674 * Calculate in degree Celsius times 1000
667 * Using sensor slope of 1.84 mV/°C and675 * Using the typical sensor slope of 1.84 mV/°C
668 * V at 25°C of 696 mV676 * and VREFH_ADC at 3.3V, V at 25°C of 699 mV
669 */677 */
670 *val = 25000 - ((int)info->value - 864) * 1000000 / 1840;678 *val = 25000 - ((int)info->value - VF610_VTEMP25_3V3) *
679 1000000 / VF610_TEMP_SLOPE_COEFF;
680
671 break;681 break;
672 default:682 default:
673 mutex_unlock(&indio_dev->mlock);683 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
841 case XADC_REG_VCCINT:841 case XADC_REG_VCCINT:
842 case XADC_REG_VCCAUX:842 case XADC_REG_VCCAUX:
843 case XADC_REG_VREFP:843 case XADC_REG_VREFP:
844 case XADC_REG_VREFN:
844 case XADC_REG_VCCBRAM:845 case XADC_REG_VCCBRAM:
845 case XADC_REG_VCCPINT:846 case XADC_REG_VCCPINT:
846 case XADC_REG_VCCPAUX:847 case XADC_REG_VCCPAUX:
drivers/iio/dac/ad5064.c+64−27
@@ -113,12 +113,16 @@ enum ad5064_type { · 112 unmodified lines
113 ID_AD5065,113 ID_AD5065,
114 ID_AD5628_1,114 ID_AD5628_1,
115 ID_AD5628_2,115 ID_AD5628_2,
116 ID_AD5629_1,
117 ID_AD5629_2,
116 ID_AD5648_1,118 ID_AD5648_1,
117 ID_AD5648_2,119 ID_AD5648_2,
118 ID_AD5666_1,120 ID_AD5666_1,
119 ID_AD5666_2,121 ID_AD5666_2,
120 ID_AD5668_1,122 ID_AD5668_1,
121 ID_AD5668_2,123 ID_AD5668_2,
124 ID_AD5669_1,
125 ID_AD5669_2,
122};126};
123 127
124static int ad5064_write(struct ad5064_state *st, unsigned int cmd,128static 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
291 { },295 { },
292};296};
293 297
294#define AD5064_CHANNEL(chan, addr, bits) { \298#define AD5064_CHANNEL(chan, addr, bits, _shift) { \
295 .type = IIO_VOLTAGE, \299 .type = IIO_VOLTAGE, \
296 .indexed = 1, \300 .indexed = 1, \
297 .output = 1, \301 .output = 1, \
@@ -303,36 +307,39 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info[] = { · 5 unmodified lines
303 .sign = 'u', \307 .sign = 'u', \
304 .realbits = (bits), \308 .realbits = (bits), \
305 .storagebits = 16, \309 .storagebits = 16, \
306 .shift = 20 - bits, \310 .shift = (_shift), \
307 }, \311 }, \
308 .ext_info = ad5064_ext_info, \312 .ext_info = ad5064_ext_info, \
309}313}
310 314
311#define DECLARE_AD5064_CHANNELS(name, bits) \315#define DECLARE_AD5064_CHANNELS(name, bits, shift) \
312const struct iio_chan_spec name[] = { \316const struct iio_chan_spec name[] = { \
313 AD5064_CHANNEL(0, 0, bits), \317 AD5064_CHANNEL(0, 0, bits, shift), \
314 AD5064_CHANNEL(1, 1, bits), \318 AD5064_CHANNEL(1, 1, bits, shift), \
315 AD5064_CHANNEL(2, 2, bits), \319 AD5064_CHANNEL(2, 2, bits, shift), \
316 AD5064_CHANNEL(3, 3, bits), \320 AD5064_CHANNEL(3, 3, bits, shift), \
317 AD5064_CHANNEL(4, 4, bits), \321 AD5064_CHANNEL(4, 4, bits, shift), \
318 AD5064_CHANNEL(5, 5, bits), \322 AD5064_CHANNEL(5, 5, bits, shift), \
319 AD5064_CHANNEL(6, 6, bits), \323 AD5064_CHANNEL(6, 6, bits, shift), \
320 AD5064_CHANNEL(7, 7, bits), \324 AD5064_CHANNEL(7, 7, bits, shift), \
321}325}
322 326
323#define DECLARE_AD5065_CHANNELS(name, bits) \327#define DECLARE_AD5065_CHANNELS(name, bits, shift) \
324const struct iio_chan_spec name[] = { \328const struct iio_chan_spec name[] = { \
325 AD5064_CHANNEL(0, 0, bits), \329 AD5064_CHANNEL(0, 0, bits, shift), \
326 AD5064_CHANNEL(1, 3, bits), \330 AD5064_CHANNEL(1, 3, bits, shift), \
327}331}
328 332
329static DECLARE_AD5064_CHANNELS(ad5024_channels, 12);333static DECLARE_AD5064_CHANNELS(ad5024_channels, 12, 8);
330static DECLARE_AD5064_CHANNELS(ad5044_channels, 14);334static DECLARE_AD5064_CHANNELS(ad5044_channels, 14, 6);
331static DECLARE_AD5064_CHANNELS(ad5064_channels, 16);335static DECLARE_AD5064_CHANNELS(ad5064_channels, 16, 4);
332 336
333static DECLARE_AD5065_CHANNELS(ad5025_channels, 12);337static DECLARE_AD5065_CHANNELS(ad5025_channels, 12, 8);
334static DECLARE_AD5065_CHANNELS(ad5045_channels, 14);338static DECLARE_AD5065_CHANNELS(ad5045_channels, 14, 6);
335static DECLARE_AD5065_CHANNELS(ad5065_channels, 16);339static DECLARE_AD5065_CHANNELS(ad5065_channels, 16, 4);
340
341static DECLARE_AD5064_CHANNELS(ad5629_channels, 12, 4);
342static DECLARE_AD5064_CHANNELS(ad5669_channels, 16, 0);
336 343
337static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {344static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
338 [ID_AD5024] = {345 [ID_AD5024] = {
@@ -382,6 +389,18 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = { · 43 unmodified lines
382 .channels = ad5024_channels,389 .channels = ad5024_channels,
383 .num_channels = 8,390 .num_channels = 8,
384 },391 },
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 },
385 [ID_AD5648_1] = {404 [ID_AD5648_1] = {
386 .shared_vref = true,405 .shared_vref = true,
387 .internal_vref = 2500000,406 .internal_vref = 2500000,
@@ -418,6 +437,18 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = { · 30 unmodified lines
418 .channels = ad5064_channels,437 .channels = ad5064_channels,
419 .num_channels = 8,438 .num_channels = 8,
420 },439 },
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 },
421};452};
422 453
423static inline unsigned int ad5064_num_vref(struct ad5064_state *st)454static 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
597 unsigned int addr, unsigned int val)628 unsigned int addr, unsigned int val)
598{629{
599 struct i2c_client *i2c = to_i2c_client(st->dev);630 struct i2c_client *i2c = to_i2c_client(st->dev);
631 int ret;
600 632
601 st->data.i2c[0] = (cmd << 4) | addr;633 st->data.i2c[0] = (cmd << 4) | addr;
602 put_unaligned_be16(val, &st->data.i2c[1]);634 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;
604}641}
605 642
606static int ad5064_i2c_probe(struct i2c_client *i2c,643static int ad5064_i2c_probe(struct i2c_client *i2c,
@@ -616,12 +653,12 @@ static int ad5064_i2c_remove(struct i2c_client *i2c) · 9 unmodified lines
616}653}
617 654
618static const struct i2c_device_id ad5064_i2c_ids[] = {655static const struct i2c_device_id ad5064_i2c_ids[] = {
619 {"ad5629-1", ID_AD5628_1},656 {"ad5629-1", ID_AD5629_1},
620 {"ad5629-2", ID_AD5628_2},657 {"ad5629-2", ID_AD5629_2},
621 {"ad5629-3", ID_AD5628_2}, /* similar enough to ad5629-2 */658 {"ad5629-3", ID_AD5629_2}, /* similar enough to ad5629-2 */
622 {"ad5669-1", ID_AD5668_1},659 {"ad5669-1", ID_AD5669_1},
623 {"ad5669-2", ID_AD5668_2},660 {"ad5669-2", ID_AD5669_2},
624 {"ad5669-3", ID_AD5668_2}, /* similar enough to ad5669-2 */661 {"ad5669-3", ID_AD5669_2}, /* similar enough to ad5669-2 */
625 {}662 {}
626};663};
627MODULE_DEVICE_TABLE(i2c, ad5064_i2c_ids);664MODULE_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
50 50
51 switch (mask) {51 switch (mask) {
52 case IIO_CHAN_INFO_RAW:52 case IIO_CHAN_INFO_RAW:
53 ret = i2c_smbus_read_word_data(*client,53 ret = i2c_smbus_read_word_swapped(*client,
54 chan->type == IIO_TEMP ?54 chan->type == IIO_TEMP ?
55 SI7020CMD_TEMP_HOLD :55 SI7020CMD_TEMP_HOLD :
56 SI7020CMD_RH_HOLD);56 SI7020CMD_RH_HOLD);
57 if (ret < 0)57 if (ret < 0)
58 return ret;58 return ret;
59 *val = ret >> 2;59 *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
216 u8 *page_addr = (u8 *) (pa & PAGE_MASK);216 u8 *page_addr = (u8 *) (pa & PAGE_MASK);
217 dma_addr_t start_dma_addr = dma_addr;217 dma_addr_t start_dma_addr = dma_addr;
218 unsigned long irq_flags, nr_pages, i;218 unsigned long irq_flags, nr_pages, i;
219 unsigned long *entry;
219 int rc = 0;220 int rc = 0;
220 221
221 if (dma_addr < s390_domain->domain.geometry.aperture_start ||222 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
228 229
229 spin_lock_irqsave(&s390_domain->dma_table_lock, irq_flags);230 spin_lock_irqsave(&s390_domain->dma_table_lock, irq_flags);
230 for (i = 0; i < nr_pages; i++) {231 for (i = 0; i < nr_pages; i++) {
231 dma_update_cpu_trans(s390_domain->dma_table, page_addr,232 entry = dma_walk_cpu_trans(s390_domain->dma_table, dma_addr);
232 dma_addr, flags);233 if (!entry) {
234 rc = -ENOMEM;
235 goto undo_cpu_trans;
236 }
237 dma_update_cpu_trans(entry, page_addr, flags);
233 page_addr += PAGE_SIZE;238 page_addr += PAGE_SIZE;
234 dma_addr += PAGE_SIZE;239 dma_addr += PAGE_SIZE;
235 }240 }
@@ -242,6 +247,20 @@ static int s390_iommu_update_trans(struct s390_domain *s390_domain, · 6 unmodified lines
242 break;247 break;
243 }248 }
244 spin_unlock(&s390_domain->list_lock);249 spin_unlock(&s390_domain->list_lock);
250
251undo_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 }
245 spin_unlock_irqrestore(&s390_domain->dma_table_lock, irq_flags);264 spin_unlock_irqrestore(&s390_domain->dma_table_lock, irq_flags);
246 265
247 return rc;266 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
84 writel_relaxed(GICD_INT_DEF_PRI_X4, base + GIC_DIST_PRI + i);84 writel_relaxed(GICD_INT_DEF_PRI_X4, base + GIC_DIST_PRI + i);
85 85
86 /*86 /*
87 * Disable all interrupts. Leave the PPI and SGIs alone87 * Deactivate and disable all SPIs. Leave the PPI and SGIs
88 * as they are enabled by redistributor registers.88 * alone as they are in the redistributor registers on GICv3.
89 */89 */
90 for (i = 32; i < gic_irqs; i += 32)90 for (i = 32; i < gic_irqs; i += 32) {
91 writel_relaxed(GICD_INT_EN_CLR_X32,91 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 }
93 96
94 if (sync_access)97 if (sync_access)
95 sync_access();98 sync_access();
@@ -102,7 +105,9 @@ void gic_cpu_config(void __iomem *base, void (*sync_access)(void)) · 6 unmodified lines
102 /*105 /*
103 * Deal with the banked PPI and SGI interrupts - disable all106 * Deal with the banked PPI and SGI interrupts - disable all
104 * PPI interrupts, ensure all SGI interrupts are enabled.107 * PPI interrupts, ensure all SGI interrupts are enabled.
108 * Make sure everything is deactivated.
105 */109 */
110 writel_relaxed(GICD_INT_EN_CLR_X32, base + GIC_DIST_ACTIVE_CLEAR);
106 writel_relaxed(GICD_INT_EN_CLR_PPI, base + GIC_DIST_ENABLE_CLEAR);111 writel_relaxed(GICD_INT_EN_CLR_PPI, base + GIC_DIST_ENABLE_CLEAR);
107 writel_relaxed(GICD_INT_EN_SET_SGI, base + GIC_DIST_ENABLE_SET);112 writel_relaxed(GICD_INT_EN_SET_SGI, base + GIC_DIST_ENABLE_SET);
108 113
drivers/irqchip/irq-gic.c+36−2
@@ -73,9 +73,11 @@ struct gic_chip_data { · 72 unmodified lines
73 union gic_base cpu_base;73 union gic_base cpu_base;
74#ifdef CONFIG_CPU_PM74#ifdef CONFIG_CPU_PM
75 u32 saved_spi_enable[DIV_ROUND_UP(1020, 32)];75 u32 saved_spi_enable[DIV_ROUND_UP(1020, 32)];
76 u32 saved_spi_active[DIV_ROUND_UP(1020, 32)];
76 u32 saved_spi_conf[DIV_ROUND_UP(1020, 16)];77 u32 saved_spi_conf[DIV_ROUND_UP(1020, 16)];
77 u32 saved_spi_target[DIV_ROUND_UP(1020, 4)];78 u32 saved_spi_target[DIV_ROUND_UP(1020, 4)];
78 u32 __percpu *saved_ppi_enable;79 u32 __percpu *saved_ppi_enable;
80 u32 __percpu *saved_ppi_active;
79 u32 __percpu *saved_ppi_conf;81 u32 __percpu *saved_ppi_conf;
80#endif82#endif
81 struct irq_domain *domain;83 struct irq_domain *domain;
@@ -566,6 +568,10 @@ static void gic_dist_save(unsigned int gic_nr) · 484 unmodified lines
566 for (i = 0; i < DIV_ROUND_UP(gic_irqs, 32); i++)568 for (i = 0; i < DIV_ROUND_UP(gic_irqs, 32); i++)
567 gic_data[gic_nr].saved_spi_enable[i] =569 gic_data[gic_nr].saved_spi_enable[i] =
568 readl_relaxed(dist_base + GIC_DIST_ENABLE_SET + i * 4);570 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);
569}575}
570 576
571/*577/*
@@ -604,9 +610,19 @@ static void gic_dist_restore(unsigned int gic_nr) · 32 unmodified lines
604 writel_relaxed(gic_data[gic_nr].saved_spi_target[i],610 writel_relaxed(gic_data[gic_nr].saved_spi_target[i],
605 dist_base + GIC_DIST_TARGET + i * 4);611 dist_base + GIC_DIST_TARGET + i * 4);
606 612
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);
608 writel_relaxed(gic_data[gic_nr].saved_spi_enable[i],616 writel_relaxed(gic_data[gic_nr].saved_spi_enable[i],
609 dist_base + GIC_DIST_ENABLE_SET + i * 4);617 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 }
610 626
611 writel_relaxed(GICD_ENABLE, dist_base + GIC_DIST_CTRL);627 writel_relaxed(GICD_ENABLE, dist_base + GIC_DIST_CTRL);
612}628}
@@ -631,6 +647,10 @@ static void gic_cpu_save(unsigned int gic_nr) · 18 unmodified lines
631 for (i = 0; i < DIV_ROUND_UP(32, 32); i++)647 for (i = 0; i < DIV_ROUND_UP(32, 32); i++)
632 ptr[i] = readl_relaxed(dist_base + GIC_DIST_ENABLE_SET + i * 4);648 ptr[i] = readl_relaxed(dist_base + GIC_DIST_ENABLE_SET + i * 4);
633 649
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
634 ptr = raw_cpu_ptr(gic_data[gic_nr].saved_ppi_conf);654 ptr = raw_cpu_ptr(gic_data[gic_nr].saved_ppi_conf);
635 for (i = 0; i < DIV_ROUND_UP(32, 16); i++)655 for (i = 0; i < DIV_ROUND_UP(32, 16); i++)
636 ptr[i] = readl_relaxed(dist_base + GIC_DIST_CONFIG + i * 4);656 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
654 return;674 return;
655 675
656 ptr = raw_cpu_ptr(gic_data[gic_nr].saved_ppi_enable);676 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);
658 writel_relaxed(ptr[i], dist_base + GIC_DIST_ENABLE_SET + i * 4);680 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 }
659 689
660 ptr = raw_cpu_ptr(gic_data[gic_nr].saved_ppi_conf);690 ptr = raw_cpu_ptr(gic_data[gic_nr].saved_ppi_conf);
661 for (i = 0; i < DIV_ROUND_UP(32, 16); i++)691 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
710 sizeof(u32));740 sizeof(u32));
711 BUG_ON(!gic->saved_ppi_enable);741 BUG_ON(!gic->saved_ppi_enable);
712 742
743 gic->saved_ppi_active = __alloc_percpu(DIV_ROUND_UP(32, 32) * 4,
744 sizeof(u32));
745 BUG_ON(!gic->saved_ppi_active);
746
713 gic->saved_ppi_conf = __alloc_percpu(DIV_ROUND_UP(32, 16) * 4,747 gic->saved_ppi_conf = __alloc_percpu(DIV_ROUND_UP(32, 16) * 4,
714 sizeof(u32));748 sizeof(u32));
715 BUG_ON(!gic->saved_ppi_conf);749 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
1896 ptr--;1896 ptr--;
1897 *ptr++ = '\n';1897 *ptr++ = '\n';
1898 *ptr = 0;1898 *ptr = 0;
1899 HiSax_putstatus(cs, NULL, "%s", cs->dlog);1899 HiSax_putstatus(cs, NULL, cs->dlog);
1900 } else1900 } else
1901 HiSax_putstatus(cs, "LogEcho: ",1901 HiSax_putstatus(cs, "LogEcho: ",
1902 "warning Frame too big (%d)",1902 "warning Frame too big (%d)",
drivers/isdn/hisax/hfc_pci.c+1−1
@@ -901,7 +901,7 @@ Begin: · 900 unmodified lines
901 ptr--;901 ptr--;
902 *ptr++ = '\n';902 *ptr++ = '\n';
903 *ptr = 0;903 *ptr = 0;
904 HiSax_putstatus(cs, NULL, "%s", cs->dlog);904 HiSax_putstatus(cs, NULL, cs->dlog);
905 } else905 } else
906 HiSax_putstatus(cs, "LogEcho: ", "warning Frame too big (%d)", total - 3);906 HiSax_putstatus(cs, "LogEcho: ", "warning Frame too big (%d)", total - 3);
907 }907 }
drivers/isdn/hisax/hfc_sx.c+1−1
@@ -674,7 +674,7 @@ receive_emsg(struct IsdnCardState *cs) · 673 unmodified lines
674 ptr--;674 ptr--;
675 *ptr++ = '\n';675 *ptr++ = '\n';
676 *ptr = 0;676 *ptr = 0;
677 HiSax_putstatus(cs, NULL, "%s", cs->dlog);677 HiSax_putstatus(cs, NULL, cs->dlog);
678 } else678 } else
679 HiSax_putstatus(cs, "LogEcho: ", "warning Frame too big (%d)", skb->len);679 HiSax_putstatus(cs, "LogEcho: ", "warning Frame too big (%d)", skb->len);
680 }680 }
drivers/isdn/hisax/q931.c+3−3
@@ -1179,7 +1179,7 @@ LogFrame(struct IsdnCardState *cs, u_char *buf, int size) · 1178 unmodified lines
1179 dp--;1179 dp--;
1180 *dp++ = '\n';1180 *dp++ = '\n';
1181 *dp = 0;1181 *dp = 0;
1182 HiSax_putstatus(cs, NULL, "%s", cs->dlog);1182 HiSax_putstatus(cs, NULL, cs->dlog);
1183 } else1183 } else
1184 HiSax_putstatus(cs, "LogFrame: ", "warning Frame too big (%d)", size);1184 HiSax_putstatus(cs, "LogFrame: ", "warning Frame too big (%d)", size);
1185}1185}
@@ -1246,7 +1246,7 @@ dlogframe(struct IsdnCardState *cs, struct sk_buff *skb, int dir) · 60 unmodified lines
1246 }1246 }
1247 if (finish) {1247 if (finish) {
1248 *dp = 0;1248 *dp = 0;
1249 HiSax_putstatus(cs, NULL, "%s", cs->dlog);1249 HiSax_putstatus(cs, NULL, cs->dlog);
1250 return;1250 return;
1251 }1251 }
1252 if ((0xfe & buf[0]) == PROTO_DIS_N0) { /* 1TR6 */1252 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
1509 dp += sprintf(dp, "Unknown protocol %x!", buf[0]);1509 dp += sprintf(dp, "Unknown protocol %x!", buf[0]);
1510 }1510 }
1511 *dp = 0;1511 *dp = 0;
1512 HiSax_putstatus(cs, NULL, "%s", cs->dlog);1512 HiSax_putstatus(cs, NULL, cs->dlog);
1513}1513}
drivers/lightnvm/core.c+79−60
@@ -123,6 +123,26 @@ void nvm_unregister_mgr(struct nvmm_type *mt) · 122 unmodified lines
123}123}
124EXPORT_SYMBOL(nvm_unregister_mgr);124EXPORT_SYMBOL(nvm_unregister_mgr);
125 125
126/* register with device with a supported manager */
127static 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
126static struct nvm_dev *nvm_find_nvm_dev(const char *name)146static struct nvm_dev *nvm_find_nvm_dev(const char *name)
127{147{
128 struct nvm_dev *dev;148 struct nvm_dev *dev;
@@ -160,11 +180,6 @@ int nvm_erase_blk(struct nvm_dev *dev, struct nvm_block *blk) · 31 unmodified lines
160}180}
161EXPORT_SYMBOL(nvm_erase_blk);181EXPORT_SYMBOL(nvm_erase_blk);
162 182
163static void nvm_core_free(struct nvm_dev *dev)
164{
165 kfree(dev);
166}
167
168static int nvm_core_init(struct nvm_dev *dev)183static int nvm_core_init(struct nvm_dev *dev)
169{184{
170 struct nvm_id *id = &dev->identity;185 struct nvm_id *id = &dev->identity;
@@ -179,12 +194,21 @@ static int nvm_core_init(struct nvm_dev *dev) · 8 unmodified lines
179 dev->sec_size = grp->csecs;194 dev->sec_size = grp->csecs;
180 dev->oob_size = grp->sos;195 dev->oob_size = grp->sos;
181 dev->sec_per_pg = grp->fpg_sz / grp->csecs;196 dev->sec_per_pg = grp->fpg_sz / grp->csecs;
182 dev->addr_mode = id->ppat;197 memcpy(&dev->ppaf, &id->ppaf, sizeof(struct nvm_addr_format));
183 dev->addr_format = id->ppaf;
184 198
185 dev->plane_mode = NVM_PLANE_SINGLE;199 dev->plane_mode = NVM_PLANE_SINGLE;
186 dev->max_rq_size = dev->ops->max_phys_sect * dev->sec_size;200 dev->max_rq_size = dev->ops->max_phys_sect * dev->sec_size;
187 201
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
188 if (grp->mpos & 0x020202)212 if (grp->mpos & 0x020202)
189 dev->plane_mode = NVM_PLANE_DOUBLE;213 dev->plane_mode = NVM_PLANE_DOUBLE;
190 if (grp->mpos & 0x040404)214 if (grp->mpos & 0x040404)
@@ -213,21 +237,17 @@ static void nvm_free(struct nvm_dev *dev) · 22 unmodified lines
213 237
214 if (dev->mt)238 if (dev->mt)
215 dev->mt->unregister_mgr(dev);239 dev->mt->unregister_mgr(dev);
216
217 nvm_core_free(dev);
218}240}
219 241
220static int nvm_init(struct nvm_dev *dev)242static int nvm_init(struct nvm_dev *dev)
221{243{
222 struct nvmm_type *mt;244 int ret = -EINVAL;
223 int ret = 0;
224 245
225 if (!dev->q || !dev->ops)246 if (!dev->q || !dev->ops)
226 return -EINVAL;247 return ret;
227 248
228 if (dev->ops->identity(dev->q, &dev->identity)) {249 if (dev->ops->identity(dev->q, &dev->identity)) {
229 pr_err("nvm: device could not be identified\n");250 pr_err("nvm: device could not be identified\n");
230 ret = -EINVAL;
231 goto err;251 goto err;
232 }252 }
233 253
@@ -251,21 +271,13 @@ static int nvm_init(struct nvm_dev *dev) · 17 unmodified lines
251 goto err;271 goto err;
252 }272 }
253 273
254 /* register with device with a supported manager */274 down_write(&nvm_lock);
255 list_for_each_entry(mt, &nvm_mgrs, list) {275 ret = register_mgr(dev);
256 ret = mt->register_mgr(dev);276 up_write(&nvm_lock);
257 if (ret < 0)277 if (ret < 0)
258 goto err; /* initialization failed */278 goto err;
259 if (ret > 0) {279 if (!ret)
260 dev->mt = mt;
261 break; /* successfully initialized */
262 }
263 }
264
265 if (!ret) {
266 pr_info("nvm: no compatible manager found.\n");
267 return 0;280 return 0;
268 }
269 281
270 pr_info("nvm: registered %s [%u/%u/%u/%u/%u/%u]\n",282 pr_info("nvm: registered %s [%u/%u/%u/%u/%u/%u]\n",
271 dev->name, dev->sec_per_pg, dev->nr_planes,283 dev->name, dev->sec_per_pg, dev->nr_planes,
@@ -273,7 +285,6 @@ static int nvm_init(struct nvm_dev *dev) · 1 unmodified line
273 dev->nr_chnls);285 dev->nr_chnls);
274 return 0;286 return 0;
275err:287err:
276 nvm_free(dev);
277 pr_err("nvm: failed to initialize nvm\n");288 pr_err("nvm: failed to initialize nvm\n");
278 return ret;289 return ret;
279}290}
@@ -308,22 +319,26 @@ int nvm_register(struct request_queue *q, char *disk_name, · 28 unmodified lines
308 if (ret)319 if (ret)
309 goto err_init;320 goto err_init;
310 321
311 down_write(&nvm_lock);322 if (dev->ops->max_phys_sect > 256) {
312 list_add(&dev->devices, &nvm_devices);323 pr_info("nvm: max sectors supported is 256.\n");
313 up_write(&nvm_lock);324 ret = -EINVAL;
325 goto err_init;
326 }
314 327
315 if (dev->ops->max_phys_sect > 1) {328 if (dev->ops->max_phys_sect > 1) {
316 dev->ppalist_pool = dev->ops->create_dma_pool(dev->q,329 dev->ppalist_pool = dev->ops->create_dma_pool(dev->q,
317 "ppalist");330 "ppalist");
318 if (!dev->ppalist_pool) {331 if (!dev->ppalist_pool) {
319 pr_err("nvm: could not create ppa pool\n");332 pr_err("nvm: could not create ppa pool\n");
320 return -ENOMEM;333 ret = -ENOMEM;
334 goto err_init;
321 }335 }
322 } else if (dev->ops->max_phys_sect > 256) {
323 pr_info("nvm: max sectors supported is 256.\n");
324 return -EINVAL;
325 }336 }
326 337
338 down_write(&nvm_lock);
339 list_add(&dev->devices, &nvm_devices);
340 up_write(&nvm_lock);
341
327 return 0;342 return 0;
328err_init:343err_init:
329 kfree(dev);344 kfree(dev);
@@ -333,19 +348,22 @@ EXPORT_SYMBOL(nvm_register); · 3 unmodified lines
333 348
334void nvm_unregister(char *disk_name)349void nvm_unregister(char *disk_name)
335{350{
336 struct nvm_dev *dev = nvm_find_nvm_dev(disk_name);351 struct nvm_dev *dev;
337 352
353 down_write(&nvm_lock);
354 dev = nvm_find_nvm_dev(disk_name);
338 if (!dev) {355 if (!dev) {
339 pr_err("nvm: could not find device %s to unregister\n",356 pr_err("nvm: could not find device %s to unregister\n",
340 disk_name);357 disk_name);
358 up_write(&nvm_lock);
341 return;359 return;
342 }360 }
343 361
344 nvm_exit(dev);
345
346 down_write(&nvm_lock);
347 list_del(&dev->devices);362 list_del(&dev->devices);
348 up_write(&nvm_lock);363 up_write(&nvm_lock);
364
365 nvm_exit(dev);
366 kfree(dev);
349}367}
350EXPORT_SYMBOL(nvm_unregister);368EXPORT_SYMBOL(nvm_unregister);
351 369
@@ -358,38 +376,30 @@ static int nvm_create_target(struct nvm_dev *dev, · 6 unmodified lines
358{376{
359 struct nvm_ioctl_create_simple *s = &create->conf.s;377 struct nvm_ioctl_create_simple *s = &create->conf.s;
360 struct request_queue *tqueue;378 struct request_queue *tqueue;
361 struct nvmm_type *mt;
362 struct gendisk *tdisk;379 struct gendisk *tdisk;
363 struct nvm_tgt_type *tt;380 struct nvm_tgt_type *tt;
364 struct nvm_target *t;381 struct nvm_target *t;
365 void *targetdata;382 void *targetdata;
366 int ret = 0;383 int ret = 0;
367 384
385 down_write(&nvm_lock);
368 if (!dev->mt) {386 if (!dev->mt) {
369 /* register with device with a supported NVM manager */387 ret = register_mgr(dev);
370 list_for_each_entry(mt, &nvm_mgrs, list) {388 if (!ret)
371 ret = mt->register_mgr(dev);389 ret = -ENODEV;
372 if (ret < 0)390 if (ret < 0) {
373 return ret; /* initialization failed */391 up_write(&nvm_lock);
374 if (ret > 0) {392 return ret;
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;
383 }393 }
384 }394 }
385 395
386 tt = nvm_find_target_type(create->tgttype);396 tt = nvm_find_target_type(create->tgttype);
387 if (!tt) {397 if (!tt) {
388 pr_err("nvm: target type %s not found\n", create->tgttype);398 pr_err("nvm: target type %s not found\n", create->tgttype);
399 up_write(&nvm_lock);
389 return -EINVAL;400 return -EINVAL;
390 }401 }
391 402
392 down_write(&nvm_lock);
393 list_for_each_entry(t, &dev->online_targets, list) {403 list_for_each_entry(t, &dev->online_targets, list) {
394 if (!strcmp(create->tgtname, t->disk->disk_name)) {404 if (!strcmp(create->tgtname, t->disk->disk_name)) {
395 pr_err("nvm: target name already exists.\n");405 pr_err("nvm: target name already exists.\n");
@@ -457,11 +467,11 @@ static void nvm_remove_target(struct nvm_target *t) · 61 unmodified lines
457 lockdep_assert_held(&nvm_lock);467 lockdep_assert_held(&nvm_lock);
458 468
459 del_gendisk(tdisk);469 del_gendisk(tdisk);
470 blk_cleanup_queue(q);
471
460 if (tt->exit)472 if (tt->exit)
461 tt->exit(tdisk->private_data);473 tt->exit(tdisk->private_data);
462 474
463 blk_cleanup_queue(q);
464
465 put_disk(tdisk);475 put_disk(tdisk);
466 476
467 list_del(&t->list);477 list_del(&t->list);
@@ -473,7 +483,9 @@ static int __nvm_configure_create(struct nvm_ioctl_create *create) · 5 unmodified lines
473 struct nvm_dev *dev;483 struct nvm_dev *dev;
474 struct nvm_ioctl_create_simple *s;484 struct nvm_ioctl_create_simple *s;
475 485
486 down_write(&nvm_lock);
476 dev = nvm_find_nvm_dev(create->dev);487 dev = nvm_find_nvm_dev(create->dev);
488 up_write(&nvm_lock);
477 if (!dev) {489 if (!dev) {
478 pr_err("nvm: device not found\n");490 pr_err("nvm: device not found\n");
479 return -EINVAL;491 return -EINVAL;
@@ -532,7 +544,9 @@ static int nvm_configure_show(const char *val) · 52 unmodified lines
532 return -EINVAL;544 return -EINVAL;
533 }545 }
534 546
547 down_write(&nvm_lock);
535 dev = nvm_find_nvm_dev(devname);548 dev = nvm_find_nvm_dev(devname);
549 up_write(&nvm_lock);
536 if (!dev) {550 if (!dev) {
537 pr_err("nvm: device not found\n");551 pr_err("nvm: device not found\n");
538 return -EINVAL;552 return -EINVAL;
@@ -541,7 +555,7 @@ static int nvm_configure_show(const char *val) · 2 unmodified lines
541 if (!dev->mt)555 if (!dev->mt)
542 return 0;556 return 0;
543 557
544 dev->mt->free_blocks_print(dev);558 dev->mt->lun_info_print(dev);
545 559
546 return 0;560 return 0;
547}561}
@@ -677,8 +691,10 @@ static long nvm_ioctl_info(struct file *file, void __user *arg) · 129 unmodified lines
677 info->tgtsize = tgt_iter;691 info->tgtsize = tgt_iter;
678 up_write(&nvm_lock);692 up_write(&nvm_lock);
679 693
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);
681 return -EFAULT;696 return -EFAULT;
697 }
682 698
683 kfree(info);699 kfree(info);
684 return 0;700 return 0;
@@ -721,8 +737,11 @@ static long nvm_ioctl_get_devices(struct file *file, void __user *arg) · 36 unmodified lines
721 737
722 devices->nr_devices = i;738 devices->nr_devices = i;
723 739
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);
725 return -EFAULT;743 return -EFAULT;
744 }
726 745
727 kfree(devices);746 kfree(devices);
728 return 0;747 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
60 lun->vlun.lun_id = i % dev->luns_per_chnl;60 lun->vlun.lun_id = i % dev->luns_per_chnl;
61 lun->vlun.chnl_id = i / dev->luns_per_chnl;61 lun->vlun.chnl_id = i / dev->luns_per_chnl;
62 lun->vlun.nr_free_blocks = dev->blks_per_lun;62 lun->vlun.nr_free_blocks = dev->blks_per_lun;
63 lun->vlun.nr_inuse_blocks = 0;
64 lun->vlun.nr_bad_blocks = 0;
63 }65 }
64 return 0;66 return 0;
65}67}
66 68
67static int gennvm_block_bb(u32 lun_id, void *bb_bitmap, unsigned int nr_blocks,69static int gennvm_block_bb(struct ppa_addr ppa, int nr_blocks, u8 *blks,
68 void *private)70 void *private)
69{71{
70 struct gen_nvm *gn = private;72 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;
72 struct nvm_block *blk;75 struct nvm_block *blk;
73 int i;76 int i;
74 77
75 if (unlikely(bitmap_empty(bb_bitmap, nr_blocks)))78 lun = &gn->luns[(dev->nr_luns * ppa.g.ch) + ppa.g.lun];
76 return 0;79
80 for (i = 0; i < nr_blocks; i++) {
81 if (blks[i] == 0)
82 continue;
77 83
78 i = -1;
79 while ((i = find_next_bit(bb_bitmap, nr_blocks, i + 1)) < nr_blocks) {
80 blk = &lun->vlun.blocks[i];84 blk = &lun->vlun.blocks[i];
81 if (!blk) {85 if (!blk) {
82 pr_err("gennvm: BB data is out of bounds.\n");86 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
84 }88 }
85 89
86 list_move_tail(&blk->list, &lun->bb_list);90 list_move_tail(&blk->list, &lun->bb_list);
91 lun->vlun.nr_bad_blocks++;
87 }92 }
88 93
89 return 0;94 return 0;
@@ -136,6 +141,7 @@ static int gennvm_block_map(u64 slba, u32 nlb, __le64 *entries, void *private) · 46 unmodified lines
136 list_move_tail(&blk->list, &lun->used_list);141 list_move_tail(&blk->list, &lun->used_list);
137 blk->type = 1;142 blk->type = 1;
138 lun->vlun.nr_free_blocks--;143 lun->vlun.nr_free_blocks--;
144 lun->vlun.nr_inuse_blocks++;
139 }145 }
140 }146 }
141 147
@@ -164,15 +170,25 @@ static int gennvm_blocks_init(struct nvm_dev *dev, struct gen_nvm *gn) · 22 unmodified lines
164 block->id = cur_block_id++;170 block->id = cur_block_id++;
165 171
166 /* First block is reserved for device */172 /* 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--;
168 continue;175 continue;
176 }
169 177
170 list_add_tail(&block->list, &lun->free_list);178 list_add_tail(&block->list, &lun->free_list);
171 }179 }
172 180
173 if (dev->ops->get_bb_tbl) {181 if (dev->ops->get_bb_tbl) {
174 ret = dev->ops->get_bb_tbl(dev->q, lun->vlun.id,182 struct ppa_addr ppa;
175 dev->blks_per_lun, gennvm_block_bb, gn);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);
176 if (ret)192 if (ret)
177 pr_err("gennvm: could not read BB table\n");193 pr_err("gennvm: could not read BB table\n");
178 }194 }
@@ -190,6 +206,14 @@ static int gennvm_blocks_init(struct nvm_dev *dev, struct gen_nvm *gn) · 11 unmodified lines
190 return 0;206 return 0;
191}207}
192 208
209static 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
193static int gennvm_register(struct nvm_dev *dev)217static int gennvm_register(struct nvm_dev *dev)
194{218{
195 struct gen_nvm *gn;219 struct gen_nvm *gn;
@@ -199,6 +223,7 @@ static int gennvm_register(struct nvm_dev *dev) · 3 unmodified lines
199 if (!gn)223 if (!gn)
200 return -ENOMEM;224 return -ENOMEM;
201 225
226 gn->dev = dev;
202 gn->nr_luns = dev->nr_luns;227 gn->nr_luns = dev->nr_luns;
203 dev->mp = gn;228 dev->mp = gn;
204 229
@@ -216,16 +241,13 @@ static int gennvm_register(struct nvm_dev *dev) · 11 unmodified lines
216 241
217 return 1;242 return 1;
218err:243err:
219 kfree(gn);244 gennvm_free(dev);
220 return ret;245 return ret;
221}246}
222 247
223static void gennvm_unregister(struct nvm_dev *dev)248static void gennvm_unregister(struct nvm_dev *dev)
224{249{
225 gennvm_blocks_free(dev);250 gennvm_free(dev);
226 gennvm_luns_free(dev);
227 kfree(dev->mp);
228 dev->mp = NULL;
229}251}
230 252
231static struct nvm_block *gennvm_get_blk(struct nvm_dev *dev,253static 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
254 blk->type = 1;276 blk->type = 1;
255 277
256 lun->vlun.nr_free_blocks--;278 lun->vlun.nr_free_blocks--;
279 lun->vlun.nr_inuse_blocks++;
257 280
258 spin_unlock(&vlun->lock);281 spin_unlock(&vlun->lock);
259out:282out:
@@ -271,16 +294,21 @@ static void gennvm_put_blk(struct nvm_dev *dev, struct nvm_block *blk) · 11 unmodified lines
271 case 1:294 case 1:
272 list_move_tail(&blk->list, &lun->free_list);295 list_move_tail(&blk->list, &lun->free_list);
273 lun->vlun.nr_free_blocks++;296 lun->vlun.nr_free_blocks++;
297 lun->vlun.nr_inuse_blocks--;
274 blk->type = 0;298 blk->type = 0;
275 break;299 break;
276 case 2:300 case 2:
277 list_move_tail(&blk->list, &lun->bb_list);301 list_move_tail(&blk->list, &lun->bb_list);
302 lun->vlun.nr_bad_blocks++;
303 lun->vlun.nr_inuse_blocks--;
278 break;304 break;
279 default:305 default:
280 WARN_ON_ONCE(1);306 WARN_ON_ONCE(1);
281 pr_err("gennvm: erroneous block type (%lu -> %u)\n",307 pr_err("gennvm: erroneous block type (%lu -> %u)\n",
282 blk->id, blk->type);308 blk->id, blk->type);
283 list_move_tail(&blk->list, &lun->bb_list);309 list_move_tail(&blk->list, &lun->bb_list);
310 lun->vlun.nr_bad_blocks++;
311 lun->vlun.nr_inuse_blocks--;
284 }312 }
285 313
286 spin_unlock(&vlun->lock);314 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
292 320
293 if (rqd->nr_pages > 1) {321 if (rqd->nr_pages > 1) {
294 for (i = 0; i < rqd->nr_pages; i++)322 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,
296 rqd->ppa_list[i]);324 rqd->ppa_list[i]);
297 } else {325 } 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);
299 }327 }
300}328}
301 329
@@ -305,10 +333,10 @@ static void gennvm_generic_to_addr_mode(struct nvm_dev *dev, struct nvm_rq *rqd) · 3 unmodified lines
305 333
306 if (rqd->nr_pages > 1) {334 if (rqd->nr_pages > 1) {
307 for (i = 0; i < rqd->nr_pages; i++)335 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,
309 rqd->ppa_list[i]);337 rqd->ppa_list[i]);
310 } else {338 } 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);
312 }340 }
313}341}
314 342
@@ -354,10 +382,10 @@ static void gennvm_mark_blk_bad(struct nvm_dev *dev, struct nvm_rq *rqd) · 39 unmodified lines
354{382{
355 int i;383 int i;
356 384
357 if (!dev->ops->set_bb)385 if (!dev->ops->set_bb_tbl)
358 return;386 return;
359 387
360 if (dev->ops->set_bb(dev->q, rqd, 1))388 if (dev->ops->set_bb_tbl(dev->q, rqd, 1))
361 return;389 return;
362 390
363 gennvm_addr_to_generic_mode(dev, rqd);391 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
440 return &gn->luns[lunid].vlun;468 return &gn->luns[lunid].vlun;
441}469}
442 470
443static void gennvm_free_blocks_print(struct nvm_dev *dev)471static void gennvm_lun_info_print(struct nvm_dev *dev)
444{472{
445 struct gen_nvm *gn = dev->mp;473 struct gen_nvm *gn = dev->mp;
446 struct gen_lun *lun;474 struct gen_lun *lun;
447 unsigned int i;475 unsigned int i;
448 476
449 gennvm_for_each_lun(gn, lun, i)477
450 pr_info("%s: lun%8u\t%u\n",478 gennvm_for_each_lun(gn, lun, i) {
451 dev->name, i, lun->vlun.nr_free_blocks);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 }
452}489}
453 490
454static struct nvmm_type gennvm = {491static struct nvmm_type gennvm = {
@@ -466,7 +503,7 @@ static struct nvmm_type gennvm = { · 11 unmodified lines
466 .erase_blk = gennvm_erase_blk,503 .erase_blk = gennvm_erase_blk,
467 504
468 .get_lun = gennvm_get_lun,505 .get_lun = gennvm_get_lun,
469 .free_blocks_print = gennvm_free_blocks_print,506 .lun_info_print = gennvm_lun_info_print,
470};507};
471 508
472static int __init gennvm_module_init(void)509static int __init gennvm_module_init(void)
drivers/lightnvm/gennvm.h+2−0
@@ -35,6 +35,8 @@ struct gen_lun { · 34 unmodified lines
35};35};
36 36
37struct gen_nvm {37struct gen_nvm {
38 struct nvm_dev *dev;
39
38 int nr_luns;40 int nr_luns;
39 struct gen_lun *luns;41 struct gen_lun *luns;
40};42};
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
123 return blk->id * rrpc->dev->pgs_per_blk;123 return blk->id * rrpc->dev->pgs_per_blk;
124}124}
125 125
126static 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
126static struct ppa_addr rrpc_ppa_to_gaddr(struct nvm_dev *dev, u64 addr)156static struct ppa_addr rrpc_ppa_to_gaddr(struct nvm_dev *dev, u64 addr)
127{157{
128 struct ppa_addr paddr;158 struct ppa_addr paddr;
129 159
130 paddr.ppa = addr;160 paddr.ppa = addr;
131 return __linear_to_generic_addr(dev, paddr);161 return linear_to_generic_addr(dev, paddr);
132}162}
133 163
134/* requires lun->lock taken */164/* requires lun->lock taken */
drivers/md/dm-crypt.c+13−9
@@ -112,7 +112,8 @@ struct iv_tcw_private { · 111 unmodified lines
112 * and encrypts / decrypts at the same time.112 * and encrypts / decrypts at the same time.
113 */113 */
114enum flags { DM_CRYPT_SUSPENDED, DM_CRYPT_KEY_VALID,114enum 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};
116 117
117/*118/*
118 * The fields in here must be read only after initialization.119 * The fields in here must be read only after initialization.
@@ -1203,20 +1204,18 @@ continue_locked: · 1084 unmodified lines
1203 if (!RB_EMPTY_ROOT(&cc->write_tree))1204 if (!RB_EMPTY_ROOT(&cc->write_tree))
1204 goto pop_from_list;1205 goto pop_from_list;
1205 1206
1207 if (unlikely(test_bit(DM_CRYPT_EXIT_THREAD, &cc->flags))) {
1208 spin_unlock_irq(&cc->write_thread_wait.lock);
1209 break;
1210 }
1211
1206 __set_current_state(TASK_INTERRUPTIBLE);1212 __set_current_state(TASK_INTERRUPTIBLE);
1207 __add_wait_queue(&cc->write_thread_wait, &wait);1213 __add_wait_queue(&cc->write_thread_wait, &wait);
1208 1214
1209 spin_unlock_irq(&cc->write_thread_wait.lock);1215 spin_unlock_irq(&cc->write_thread_wait.lock);
1210 1216
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
1217 schedule();1217 schedule();
1218 1218
1219 set_task_state(current, TASK_RUNNING);
1220 spin_lock_irq(&cc->write_thread_wait.lock);1219 spin_lock_irq(&cc->write_thread_wait.lock);
1221 __remove_wait_queue(&cc->write_thread_wait, &wait);1220 __remove_wait_queue(&cc->write_thread_wait, &wait);
1222 goto continue_locked;1221 goto continue_locked;
@@ -1531,8 +1530,13 @@ static void crypt_dtr(struct dm_target *ti) · 308 unmodified lines
1531 if (!cc)1530 if (!cc)
1532 return;1531 return;
1533 1532
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);
1535 kthread_stop(cc->write_thread);1538 kthread_stop(cc->write_thread);
1539 }
1536 1540
1537 if (cc->io_queue)1541 if (cc->io_queue)
1538 destroy_workqueue(cc->io_queue);1542 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
1537 struct block_device **bdev, fmode_t *mode)1537 struct block_device **bdev, fmode_t *mode)
1538{1538{
1539 struct multipath *m = ti->private;1539 struct multipath *m = ti->private;
1540 struct pgpath *pgpath;
1541 unsigned long flags;1540 unsigned long flags;
1542 int r;1541 int r;
1543 1542
1544 r = 0;
1545
1546 spin_lock_irqsave(&m->lock, flags);1543 spin_lock_irqsave(&m->lock, flags);
1547 1544
1548 if (!m->current_pgpath)1545 if (!m->current_pgpath)
1549 __choose_pgpath(m, 0);1546 __choose_pgpath(m, 0);
1550 1547
1551 pgpath = m->current_pgpath;1548 if (m->current_pgpath) {
1552 1549 if (!m->queue_io) {
1553 if (pgpath) {1550 *bdev = m->current_pgpath->path.dev->bdev;
1554 *bdev = pgpath->path.dev->bdev;1551 *mode = m->current_pgpath->path.dev->mode;
1555 *mode = 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;
1556 }1563 }
1557 1564
1558 if ((pgpath && m->queue_io) || (!pgpath && m->queue_if_no_path))
1559 r = -ENOTCONN;
1560 else if (!*bdev)
1561 r = -EIO;
1562
1563 spin_unlock_irqrestore(&m->lock, flags);1565 spin_unlock_irqrestore(&m->lock, flags);
1564 1566
1565 if (r == -ENOTCONN && !fatal_signal_pending(current)) {1567 if (r == -ENOTCONN) {
1566 spin_lock_irqsave(&m->lock, flags);1568 spin_lock_irqsave(&m->lock, flags);
1567 if (!m->current_pg) {1569 if (!m->current_pg) {
1568 /* Path status changed, redo selection */1570 /* 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
2432 case PM_WRITE:2432 case PM_WRITE:
2433 if (old_mode != new_mode)2433 if (old_mode != new_mode)
2434 notify_of_pool_mode_change(pool, "write");2434 notify_of_pool_mode_change(pool, "write");
2435 pool->pf.error_if_no_space = pt->requested_pf.error_if_no_space;
2435 dm_pool_metadata_read_write(pool->pmd);2436 dm_pool_metadata_read_write(pool->pmd);
2436 pool->process_bio = process_bio;2437 pool->process_bio = process_bio;
2437 pool->process_discard = process_discard_bio;2438 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
4249{4250{
4250 struct thin_c *tc = ti->private;4251 struct thin_c *tc = ti->private;
4251 struct pool *pool = tc->pool;4252 struct pool *pool = tc->pool;
4252 struct queue_limits *pool_limits = dm_get_queue_limits(pool->pool_md);
4253 4253
4254 if (!pool_limits->discard_granularity)4254 if (!pool->pf.discard_enabled)
4255 return; /* pool's discard support is disabled */4255 return;
4256 4256
4257 limits->discard_granularity = pool->sectors_per_block << SECTOR_SHIFT;4257 limits->discard_granularity = pool->sectors_per_block << SECTOR_SHIFT;
4258 limits->max_discard_sectors = 2048 * 1024 * 16; /* 16G */4258 limits->max_discard_sectors = 2048 * 1024 * 16; /* 16G */
drivers/md/dm.c+4−3
@@ -591,7 +591,7 @@ retry: · 590 unmodified lines
591 591
592out:592out:
593 dm_put_live_table(md, *srcu_idx);593 dm_put_live_table(md, *srcu_idx);
594 if (r == -ENOTCONN) {594 if (r == -ENOTCONN && !fatal_signal_pending(current)) {
595 msleep(10);595 msleep(10);
596 goto retry;596 goto retry;
597 }597 }
@@ -603,9 +603,10 @@ static int dm_blk_ioctl(struct block_device *bdev, fmode_t mode, · 5 unmodified lines
603{603{
604 struct mapped_device *md = bdev->bd_disk->private_data;604 struct mapped_device *md = bdev->bd_disk->private_data;
605 struct dm_target *tgt;605 struct dm_target *tgt;
606 struct block_device *tgt_bdev = NULL;
606 int srcu_idx, r;607 int srcu_idx, r;
607 608
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);
609 if (r < 0)610 if (r < 0)
610 return r;611 return r;
611 612
@@ -620,7 +621,7 @@ static int dm_blk_ioctl(struct block_device *bdev, fmode_t mode, · 8 unmodified lines
620 goto out;621 goto out;
621 }622 }
622 623
623 r = __blkdev_driver_ioctl(bdev, mode, cmd, arg);624 r = __blkdev_driver_ioctl(tgt_bdev, mode, cmd, arg);
624out:625out:
625 dm_put_live_table(md, srcu_idx);626 dm_put_live_table(md, srcu_idx);
626 return r;627 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
1992 (unsigned long long)pci_resource_start(pci_dev, 0));1992 (unsigned long long)pci_resource_start(pci_dev, 0));
1993 1993
1994 pci_set_master(pci_dev);1994 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) {
1996 printk("%s/0: Oops: no 32bit PCI DMA ???\n", dev->name);1997 printk("%s/0: Oops: no 32bit PCI DMA ???\n", dev->name);
1997 err = -EIO;
1998 goto fail_context;1998 goto fail_context;
1999 }1999 }
2000 2000
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
1319 dev->pci_lat, (unsigned long long)dev->base_io_addr);1319 dev->pci_lat, (unsigned long long)dev->base_io_addr);
1320 1320
1321 pci_set_master(pci_dev);1321 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) {
1323 pr_err("%s/0: Oops: no 32bit PCI DMA ???\n", dev->name);1324 pr_err("%s/0: Oops: no 32bit PCI DMA ???\n", dev->name);
1324 err = -EIO;1325 err = -EIO;
1325 goto fail_irq;1326 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
890 return err;890 return err;
891 }891 }
892 892
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) {
894 dprintk(0, "%s/1: Oops: no 32bit PCI DMA ???\n",core->name);895 dprintk(0, "%s/1: Oops: no 32bit PCI DMA ???\n",core->name);
895 err = -EIO;
896 cx88_core_put(core, pci);896 cx88_core_put(core, pci);
897 return err;897 return err;
898 }898 }
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
393 if (pci_enable_device(dev->pci))393 if (pci_enable_device(dev->pci))
394 return -EIO;394 return -EIO;
395 pci_set_master(dev->pci);395 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) {
397 printk("%s/2: Oops: no 32bit PCI DMA ???\n",dev->core->name);398 printk("%s/2: Oops: no 32bit PCI DMA ???\n",dev->core->name);
398 return -EIO;399 return -EIO;
399 }400 }
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
1314 dev->pci_lat,(unsigned long long)pci_resource_start(pci_dev,0));1314 dev->pci_lat,(unsigned long long)pci_resource_start(pci_dev,0));
1315 1315
1316 pci_set_master(pci_dev);1316 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) {
1318 printk("%s/0: Oops: no 32bit PCI DMA ???\n",core->name);1319 printk("%s/0: Oops: no 32bit PCI DMA ???\n",core->name);
1319 err = -EIO;
1320 goto fail_core;1320 goto fail_core;
1321 }1321 }
1322 dev->alloc_ctx = vb2_dma_sg_init_ctx(&pci_dev->dev);1322 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
810 "%s(): board vendor 0x%x, revision 0x%x\n",810 "%s(): board vendor 0x%x, revision 0x%x\n",
811 __func__, board_vendor, board_revision);811 __func__, board_vendor, board_revision);
812 pci_set_master(pci_dev);812 pci_set_master(pci_dev);
813 if (!pci_set_dma_mask(pci_dev, 0xffffffff)) {813 if (pci_set_dma_mask(pci_dev, 0xffffffff) < 0) {
814 dev_err(&pci_dev->dev,814 dev_err(&pci_dev->dev,
815 "%s(): 32bit PCI DMA is not supported\n", __func__);815 "%s(): 32bit PCI DMA is not supported\n", __func__);
816 goto pci_detect_err;816 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
951 pci_name(pci_dev), dev->pci_rev, pci_dev->irq,951 pci_name(pci_dev), dev->pci_rev, pci_dev->irq,
952 dev->pci_lat,(unsigned long long)pci_resource_start(pci_dev,0));952 dev->pci_lat,(unsigned long long)pci_resource_start(pci_dev,0));
953 pci_set_master(pci_dev);953 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) {
955 pr_warn("%s: Oops: no 32bit PCI DMA ???\n", dev->name);956 pr_warn("%s: Oops: no 32bit PCI DMA ???\n", dev->name);
956 err = -EIO;
957 goto fail1;957 goto fail1;
958 }958 }
959 959
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
1264 1264
1265 pci_set_master(pci_dev);1265 pci_set_master(pci_dev);
1266 /* TODO */1266 /* TODO */
1267 if (!pci_set_dma_mask(pci_dev, 0xffffffff)) {1267 err = pci_set_dma_mask(pci_dev, 0xffffffff);
1268 if (err) {
1268 printk("%s/0: Oops: no 32bit PCI DMA ???\n", dev->name);1269 printk("%s/0: Oops: no 32bit PCI DMA ???\n", dev->name);
1269 err = -EIO;
1270 goto fail_irq;1270 goto fail_irq;
1271 }1271 }
1272 1272
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
257 dev->name, pci_name(pci_dev), dev->pci_rev, pci_dev->irq,257 dev->name, pci_name(pci_dev), dev->pci_rev, pci_dev->irq,
258 dev->pci_lat, (u64)pci_resource_start(pci_dev, 0));258 dev->pci_lat, (u64)pci_resource_start(pci_dev, 0));
259 pci_set_master(pci_dev);259 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) {
261 pr_info("%s: Oops: no 32bit PCI DMA ???\n", dev->name);262 pr_info("%s: Oops: no 32bit PCI DMA ???\n", dev->name);
262 err = -EIO;
263 goto fail1;263 goto fail1;
264 }264 }
265 265
drivers/mmc/card/block.c+3−8
@@ -65,8 +65,7 @@ MODULE_ALIAS("mmc:block"); · 64 unmodified lines
65#define MMC_SANITIZE_REQ_TIMEOUT 24000065#define MMC_SANITIZE_REQ_TIMEOUT 240000
66#define MMC_EXTRACT_INDEX_FROM_ARG(x) ((x & 0x00FF0000) >> 16)66#define MMC_EXTRACT_INDEX_FROM_ARG(x) ((x & 0x00FF0000) >> 16)
67 67
68#define mmc_req_rel_wr(req) (((req->cmd_flags & REQ_FUA) || \68#define mmc_req_rel_wr(req) ((req->cmd_flags & REQ_FUA) && \
69 (req->cmd_flags & REQ_META)) && \
70 (rq_data_dir(req) == WRITE))69 (rq_data_dir(req) == WRITE))
71#define PACKED_CMD_VER 0x0170#define PACKED_CMD_VER 0x01
72#define PACKED_CMD_WR 0x0271#define PACKED_CMD_WR 0x02
@@ -1467,13 +1466,9 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, · 1394 unmodified lines
1467 1466
1468 /*1467 /*
1469 * Reliable writes are used to implement Forced Unit Access and1468 * Reliable writes are used to implement Forced Unit Access and
1470 * REQ_META accesses, and are supported only on MMCs.1469 * are supported only on MMCs.
1471 *
1472 * XXX: this really needs a good explanation of why REQ_META
1473 * is treated special.
1474 */1470 */
1475 bool do_rel_wr = ((req->cmd_flags & REQ_FUA) ||1471 bool do_rel_wr = (req->cmd_flags & REQ_FUA) &&
1476 (req->cmd_flags & REQ_META)) &&
1477 (rq_data_dir(req) == WRITE) &&1472 (rq_data_dir(req) == WRITE) &&
1478 (md->flags & MMC_BLK_REL_WR);1473 (md->flags & MMC_BLK_REL_WR);
1479 1474
drivers/mmc/core/mmc.c+69−24
@@ -1040,9 +1040,24 @@ static int mmc_select_hs_ddr(struct mmc_card *card) · 1039 unmodified lines
1040 return err;1040 return err;
1041}1041}
1042 1042
1043/* Caller must hold re-tuning */
1044static 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
1043static int mmc_select_hs400(struct mmc_card *card)1056static int mmc_select_hs400(struct mmc_card *card)
1044{1057{
1045 struct mmc_host *host = card->host;1058 struct mmc_host *host = card->host;
1059 bool send_status = true;
1060 unsigned int max_dtr;
1046 int err = 0;1061 int err = 0;
1047 u8 val;1062 u8 val;
1048 1063
@@ -1053,25 +1068,36 @@ static int mmc_select_hs400(struct mmc_card *card) · 4 unmodified lines
1053 host->ios.bus_width == MMC_BUS_WIDTH_8))1068 host->ios.bus_width == MMC_BUS_WIDTH_8))
1054 return 0;1069 return 0;
1055 1070
1056 /*1071 if (host->caps & MMC_CAP_WAIT_WHILE_BUSY)
1057 * Before switching to dual data rate operation for HS400,1072 send_status = false;
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);
1062 1073
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 */
1063 val = EXT_CSD_TIMING_HS |1079 val = EXT_CSD_TIMING_HS |
1064 card->drive_strength << EXT_CSD_DRV_STR_SHIFT;1080 card->drive_strength << EXT_CSD_DRV_STR_SHIFT;
1065 err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,1081 err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
1066 EXT_CSD_HS_TIMING, val,1082 EXT_CSD_HS_TIMING, val,
1067 card->ext_csd.generic_cmd6_time,1083 card->ext_csd.generic_cmd6_time,
1068 true, true, true);1084 true, send_status, true);
1069 if (err) {1085 if (err) {
1070 pr_err("%s: switch to high-speed from hs200 failed, err:%d\n",1086 pr_err("%s: switch to high-speed from hs200 failed, err:%d\n",
1071 mmc_hostname(host), err);1087 mmc_hostname(host), err);
1072 return err;1088 return err;
1073 }1089 }
1074 1090
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 */
1075 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,1101 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
1076 EXT_CSD_BUS_WIDTH,1102 EXT_CSD_BUS_WIDTH,
1077 EXT_CSD_DDR_BUS_WIDTH_8,1103 EXT_CSD_DDR_BUS_WIDTH_8,
@@ -1082,22 +1108,35 @@ static int mmc_select_hs400(struct mmc_card *card) · 4 unmodified lines
1082 return err;1108 return err;
1083 }1109 }
1084 1110
1111 /* Switch card to HS400 */
1085 val = EXT_CSD_TIMING_HS400 |1112 val = EXT_CSD_TIMING_HS400 |
1086 card->drive_strength << EXT_CSD_DRV_STR_SHIFT;1113 card->drive_strength << EXT_CSD_DRV_STR_SHIFT;
1087 err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,1114 err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
1088 EXT_CSD_HS_TIMING, val,1115 EXT_CSD_HS_TIMING, val,
1089 card->ext_csd.generic_cmd6_time,1116 card->ext_csd.generic_cmd6_time,
1090 true, true, true);1117 true, send_status, true);
1091 if (err) {1118 if (err) {
1092 pr_err("%s: switch to hs400 failed, err:%d\n",1119 pr_err("%s: switch to hs400 failed, err:%d\n",
1093 mmc_hostname(host), err);1120 mmc_hostname(host), err);
1094 return err;1121 return err;
1095 }1122 }
1096 1123
1124 /* Set host controller to HS400 timing and frequency */
1097 mmc_set_timing(host, MMC_TIMING_MMC_HS400);1125 mmc_set_timing(host, MMC_TIMING_MMC_HS400);
1098 mmc_set_bus_speed(card);1126 mmc_set_bus_speed(card);
1099 1127
1128 if (!send_status) {
1129 err = mmc_switch_status(card);
1130 if (err)
1131 goto out_err;
1132 }
1133
1100 return 0;1134 return 0;
1135
1136out_err:
1137 pr_err("%s: %s failed, error %d\n", mmc_hostname(card->host),
1138 __func__, err);
1139 return err;
1101}1140}
1102 1141
1103int mmc_hs200_to_hs400(struct mmc_card *card)1142int mmc_hs200_to_hs400(struct mmc_card *card)
@@ -1105,19 +1144,6 @@ int mmc_hs200_to_hs400(struct mmc_card *card) · 1 unmodified line
1105 return mmc_select_hs400(card);1144 return mmc_select_hs400(card);
1106}1145}
1107 1146
1108/* Caller must hold re-tuning */
1109static 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
1121int mmc_hs400_to_hs200(struct mmc_card *card)1147int mmc_hs400_to_hs200(struct mmc_card *card)
1122{1148{
1123 struct mmc_host *host = card->host;1149 struct mmc_host *host = card->host;
@@ -1219,6 +1245,8 @@ static void mmc_select_driver_type(struct mmc_card *card) · 95 unmodified lines
1219static int mmc_select_hs200(struct mmc_card *card)1245static int mmc_select_hs200(struct mmc_card *card)
1220{1246{
1221 struct mmc_host *host = card->host;1247 struct mmc_host *host = card->host;
1248 bool send_status = true;
1249 unsigned int old_timing;
1222 int err = -EINVAL;1250 int err = -EINVAL;
1223 u8 val;1251 u8 val;
1224 1252
@@ -1234,6 +1262,9 @@ static int mmc_select_hs200(struct mmc_card *card) · 9 unmodified lines
1234 1262
1235 mmc_select_driver_type(card);1263 mmc_select_driver_type(card);
1236 1264
1265 if (host->caps & MMC_CAP_WAIT_WHILE_BUSY)
1266 send_status = false;
1267
1237 /*1268 /*
1238 * Set the bus width(4 or 8) with host's support and1269 * Set the bus width(4 or 8) with host's support and
1239 * switch to HS200 mode if bus width is set successfully.1270 * 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
1245 err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,1276 err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
1246 EXT_CSD_HS_TIMING, val,1277 EXT_CSD_HS_TIMING, val,
1247 card->ext_csd.generic_cmd6_time,1278 card->ext_csd.generic_cmd6_time,
1248 true, true, true);1279 true, send_status, true);
1249 if (!err)1280 if (err)
1250 mmc_set_timing(host, MMC_TIMING_MMC_HS200);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 }
1251 }1293 }
1252err:1294err:
1295 if (err)
1296 pr_err("%s: %s failed, error %d\n", mmc_hostname(card->host),
1297 __func__, err);
1253 return err;1298 return err;
1254}1299}
1255 1300
drivers/mmc/host/Kconfig+1−0
@@ -473,6 +473,7 @@ config MMC_DAVINCI · 472 unmodified lines
473 473
474config MMC_GOLDFISH474config MMC_GOLDFISH
475 tristate "goldfish qemu Multimedia Card Interface support"475 tristate "goldfish qemu Multimedia Card Interface support"
476 depends on HAS_DMA
476 depends on GOLDFISH || COMPILE_TEST477 depends on GOLDFISH || COMPILE_TEST
477 help478 help
478 This selects the Goldfish Multimedia card Interface emulation479 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
1276 int start = 0, len = 0;1276 int start = 0, len = 0;
1277 int start_final = 0, len_final = 0;1277 int start_final = 0, len_final = 0;
1278 u8 final_phase = 0xff;1278 u8 final_phase = 0xff;
1279 struct msdc_delay_phase delay_phase;1279 struct msdc_delay_phase delay_phase = { 0, };
1280 1280
1281 if (delay == 0) {1281 if (delay == 0) {
1282 dev_err(host->dev, "phase error: [map:%x]\n", delay);1282 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
805 goto out;805 goto out;
806 } else {806 } else {
807 mmc->caps |= host->pdata->gpio_card_ro_invert ?807 mmc->caps |= host->pdata->gpio_card_ro_invert ?
808 MMC_CAP2_RO_ACTIVE_HIGH : 0;808 0 : MMC_CAP2_RO_ACTIVE_HIGH;
809 }809 }
810 810
811 if (gpio_is_valid(gpio_cd))811 if (gpio_is_valid(gpio_cd))
drivers/mtd/nand/jz4740_nand.c+1−0
@@ -25,6 +25,7 @@ · 24 unmodified lines
25 25
26#include <linux/gpio.h>26#include <linux/gpio.h>
27 27
28#include <asm/mach-jz4740/gpio.h>
28#include <asm/mach-jz4740/jz4740_nand.h>29#include <asm/mach-jz4740/jz4740_nand.h>
29 30
30#define JZ_REG_NAND_CTRL 0x5031#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
3110 */3110 */
3111static void nand_shutdown(struct mtd_info *mtd)3111static void nand_shutdown(struct mtd_info *mtd)
3112{3112{
3113 nand_get_device(mtd, FL_SHUTDOWN);3113 nand_get_device(mtd, FL_PM_SUSPENDED);
3114}3114}
3115 3115
3116/* Set default functions */3116/* 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
501 cf->data[2] |= CAN_ERR_PROT_FORM;501 cf->data[2] |= CAN_ERR_PROT_FORM;
502 else if (status & SER)502 else if (status & SER)
503 cf->data[2] |= CAN_ERR_PROT_STUFF;503 cf->data[2] |= CAN_ERR_PROT_STUFF;
504 else
505 cf->data[2] |= CAN_ERR_PROT_UNSPEC;
506 }504 }
507 505
508 priv->can.state = state;506 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
962 * type of the last error to occur on the CAN bus962 * type of the last error to occur on the CAN bus
963 */963 */
964 cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;964 cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
965 cf->data[2] |= CAN_ERR_PROT_UNSPEC;
966 965
967 switch (lec_type) {966 switch (lec_type) {
968 case LEC_STUFF_ERROR:967 case LEC_STUFF_ERROR:
@@ -975,8 +974,7 @@ static int c_can_handle_bus_err(struct net_device *dev, · 6 unmodified lines
975 break;974 break;
976 case LEC_ACK_ERROR:975 case LEC_ACK_ERROR:
977 netdev_dbg(dev, "ack error\n");976 netdev_dbg(dev, "ack error\n");
978 cf->data[3] |= (CAN_ERR_PROT_LOC_ACK |977 cf->data[3] = CAN_ERR_PROT_LOC_ACK;
979 CAN_ERR_PROT_LOC_ACK_DEL);
980 break;978 break;
981 case LEC_BIT1_ERROR:979 case LEC_BIT1_ERROR:
982 netdev_dbg(dev, "bit1 error\n");980 netdev_dbg(dev, "bit1 error\n");
@@ -988,8 +986,7 @@ static int c_can_handle_bus_err(struct net_device *dev, · 5 unmodified lines
988 break;986 break;
989 case LEC_CRC_ERROR:987 case LEC_CRC_ERROR:
990 netdev_dbg(dev, "CRC error\n");988 netdev_dbg(dev, "CRC error\n");
991 cf->data[3] |= (CAN_ERR_PROT_LOC_CRC_SEQ |989 cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
992 CAN_ERR_PROT_LOC_CRC_DEL);
993 break;990 break;
994 default:991 default:
995 break;992 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
578 cf->data[2] |= CAN_ERR_PROT_BIT0;578 cf->data[2] |= CAN_ERR_PROT_BIT0;
579 break;579 break;
580 case STAT_LEC_CRC:580 case STAT_LEC_CRC:
581 cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ;581 cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
582 break;582 break;
583 }583 }
584 }584 }
drivers/net/can/flexcan.c+2−2
@@ -535,13 +535,13 @@ static void do_bus_err(struct net_device *dev, · 534 unmodified lines
535 if (reg_esr & FLEXCAN_ESR_ACK_ERR) {535 if (reg_esr & FLEXCAN_ESR_ACK_ERR) {
536 netdev_dbg(dev, "ACK_ERR irq\n");536 netdev_dbg(dev, "ACK_ERR irq\n");
537 cf->can_id |= CAN_ERR_ACK;537 cf->can_id |= CAN_ERR_ACK;
538 cf->data[3] |= CAN_ERR_PROT_LOC_ACK;538 cf->data[3] = CAN_ERR_PROT_LOC_ACK;
539 tx_errors = 1;539 tx_errors = 1;
540 }540 }
541 if (reg_esr & FLEXCAN_ESR_CRC_ERR) {541 if (reg_esr & FLEXCAN_ESR_CRC_ERR) {
542 netdev_dbg(dev, "CRC_ERR irq\n");542 netdev_dbg(dev, "CRC_ERR irq\n");
543 cf->data[2] |= CAN_ERR_PROT_BIT;543 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;
545 rx_errors = 1;545 rx_errors = 1;
546 }546 }
547 if (reg_esr & FLEXCAN_ESR_FRM_ERR) {547 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
1096 cf->data[2] |= CAN_ERR_PROT_STUFF;1096 cf->data[2] |= CAN_ERR_PROT_STUFF;
1097 break;1097 break;
1098 default:1098 default:
1099 cf->data[2] |= CAN_ERR_PROT_UNSPEC;
1100 cf->data[3] = ecc & ECC_SEG;1099 cf->data[3] = ecc & ECC_SEG;
1101 break;1100 break;
1102 }1101 }
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
487 * type of the last error to occur on the CAN bus487 * type of the last error to occur on the CAN bus
488 */488 */
489 cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;489 cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
490 cf->data[2] |= CAN_ERR_PROT_UNSPEC;
491 490
492 switch (lec_type) {491 switch (lec_type) {
493 case LEC_STUFF_ERROR:492 case LEC_STUFF_ERROR:
@@ -500,8 +499,7 @@ static int m_can_handle_lec_err(struct net_device *dev, · 6 unmodified lines
500 break;499 break;
501 case LEC_ACK_ERROR:500 case LEC_ACK_ERROR:
502 netdev_dbg(dev, "ack error\n");501 netdev_dbg(dev, "ack error\n");
503 cf->data[3] |= (CAN_ERR_PROT_LOC_ACK |502 cf->data[3] = CAN_ERR_PROT_LOC_ACK;
504 CAN_ERR_PROT_LOC_ACK_DEL);
505 break;503 break;
506 case LEC_BIT1_ERROR:504 case LEC_BIT1_ERROR:
507 netdev_dbg(dev, "bit1 error\n");505 netdev_dbg(dev, "bit1 error\n");
@@ -513,8 +511,7 @@ static int m_can_handle_lec_err(struct net_device *dev, · 5 unmodified lines
513 break;511 break;
514 case LEC_CRC_ERROR:512 case LEC_CRC_ERROR:
515 netdev_dbg(dev, "CRC error\n");513 netdev_dbg(dev, "CRC error\n");
516 cf->data[3] |= (CAN_ERR_PROT_LOC_CRC_SEQ |514 cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
517 CAN_ERR_PROT_LOC_CRC_DEL);
518 break;515 break;
519 default:516 default:
520 break;517 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
559 stats->rx_errors++;559 stats->rx_errors++;
560 break;560 break;
561 case PCH_CRC_ERR:561 case PCH_CRC_ERR:
562 cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ |562 cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
563 CAN_ERR_PROT_LOC_CRC_DEL;
564 priv->can.can_stats.bus_error++;563 priv->can.can_stats.bus_error++;
565 stats->rx_errors++;564 stats->rx_errors++;
566 break;565 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
241 u8 ecsr;241 u8 ecsr;
242 242
243 netdev_dbg(priv->ndev, "Bus error interrupt:\n");243 netdev_dbg(priv->ndev, "Bus error interrupt:\n");
244 if (skb) {244 if (skb)
245 cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT;245 cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT;
246 cf->data[2] = CAN_ERR_PROT_UNSPEC;246
247 }
248 ecsr = readb(&priv->regs->ecsr);247 ecsr = readb(&priv->regs->ecsr);
249 if (ecsr & RCAR_CAN_ECSR_ADEF) {248 if (ecsr & RCAR_CAN_ECSR_ADEF) {
250 netdev_dbg(priv->ndev, "ACK Delimiter Error\n");249 netdev_dbg(priv->ndev, "ACK Delimiter Error\n");
251 tx_errors++;250 tx_errors++;
252 writeb(~RCAR_CAN_ECSR_ADEF, &priv->regs->ecsr);251 writeb(~RCAR_CAN_ECSR_ADEF, &priv->regs->ecsr);
253 if (skb)252 if (skb)
254 cf->data[3] |= CAN_ERR_PROT_LOC_ACK_DEL;253 cf->data[3] = CAN_ERR_PROT_LOC_ACK_DEL;
255 }254 }
256 if (ecsr & RCAR_CAN_ECSR_BE0F) {255 if (ecsr & RCAR_CAN_ECSR_BE0F) {
257 netdev_dbg(priv->ndev, "Bit Error (dominant)\n");256 netdev_dbg(priv->ndev, "Bit Error (dominant)\n");
@@ -272,7 +271,7 @@ static void rcar_can_error(struct net_device *ndev) · 14 unmodified lines
272 rx_errors++;271 rx_errors++;
273 writeb(~RCAR_CAN_ECSR_CEF, &priv->regs->ecsr);272 writeb(~RCAR_CAN_ECSR_CEF, &priv->regs->ecsr);
274 if (skb)273 if (skb)
275 cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ;274 cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
276 }275 }
277 if (ecsr & RCAR_CAN_ECSR_AEF) {276 if (ecsr & RCAR_CAN_ECSR_AEF) {
278 netdev_dbg(priv->ndev, "ACK Error\n");277 netdev_dbg(priv->ndev, "ACK Error\n");
@@ -280,7 +279,7 @@ static void rcar_can_error(struct net_device *ndev) · 1 unmodified line
280 writeb(~RCAR_CAN_ECSR_AEF, &priv->regs->ecsr);279 writeb(~RCAR_CAN_ECSR_AEF, &priv->regs->ecsr);
281 if (skb) {280 if (skb) {
282 cf->can_id |= CAN_ERR_ACK;281 cf->can_id |= CAN_ERR_ACK;
283 cf->data[3] |= CAN_ERR_PROT_LOC_ACK;282 cf->data[3] = CAN_ERR_PROT_LOC_ACK;
284 }283 }
285 }284 }
286 if (ecsr & RCAR_CAN_ECSR_FEF) {285 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
218 priv->write_reg(priv, SJA1000_RXERR, 0x0);218 priv->write_reg(priv, SJA1000_RXERR, 0x0);
219 priv->read_reg(priv, SJA1000_ECC);219 priv->read_reg(priv, SJA1000_ECC);
220 220
221 /* clear interrupt flags */
222 priv->read_reg(priv, SJA1000_IR);
223
221 /* leave reset mode */224 /* leave reset mode */
222 set_normal_mode(dev);225 set_normal_mode(dev);
223}226}
@@ -446,7 +449,6 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) · 222 unmodified lines
446 cf->data[2] |= CAN_ERR_PROT_STUFF;449 cf->data[2] |= CAN_ERR_PROT_STUFF;
447 break;450 break;
448 default:451 default:
449 cf->data[2] |= CAN_ERR_PROT_UNSPEC;
450 cf->data[3] = ecc & ECC_SEG;452 cf->data[3] = ecc & ECC_SEG;
451 break;453 break;
452 }454 }
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
575 cf->data[2] |= CAN_ERR_PROT_STUFF;575 cf->data[2] |= CAN_ERR_PROT_STUFF;
576 break;576 break;
577 default:577 default:
578 cf->data[2] |= CAN_ERR_PROT_UNSPEC;
579 cf->data[3] = (ecc & SUN4I_STA_ERR_SEG_CODE)578 cf->data[3] = (ecc & SUN4I_STA_ERR_SEG_CODE)
580 >> 16;579 >> 16;
581 break;580 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
722 if (err_status & HECC_BUS_ERROR) {722 if (err_status & HECC_BUS_ERROR) {
723 ++priv->can.can_stats.bus_error;723 ++priv->can.can_stats.bus_error;
724 cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT;724 cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT;
725 cf->data[2] |= CAN_ERR_PROT_UNSPEC;
726 if (err_status & HECC_CANES_FE) {725 if (err_status & HECC_CANES_FE) {
727 hecc_set_bit(priv, HECC_CANES, HECC_CANES_FE);726 hecc_set_bit(priv, HECC_CANES, HECC_CANES_FE);
728 cf->data[2] |= CAN_ERR_PROT_FORM;727 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
737 }736 }
738 if (err_status & HECC_CANES_CRCE) {737 if (err_status & HECC_CANES_CRCE) {
739 hecc_set_bit(priv, HECC_CANES, HECC_CANES_CRCE);738 hecc_set_bit(priv, HECC_CANES, HECC_CANES_CRCE);
740 cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ |739 cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
741 CAN_ERR_PROT_LOC_CRC_DEL;
742 }740 }
743 if (err_status & HECC_CANES_ACKE) {741 if (err_status & HECC_CANES_ACKE) {
744 hecc_set_bit(priv, HECC_CANES, HECC_CANES_ACKE);742 hecc_set_bit(priv, HECC_CANES, HECC_CANES_ACKE);
745 cf->data[3] |= CAN_ERR_PROT_LOC_ACK |743 cf->data[3] = CAN_ERR_PROT_LOC_ACK;
746 CAN_ERR_PROT_LOC_ACK_DEL;
747 }744 }
748 }745 }
749 746
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
377 cf->data[2] |= CAN_ERR_PROT_STUFF;377 cf->data[2] |= CAN_ERR_PROT_STUFF;
378 break;378 break;
379 default:379 default:
380 cf->data[2] |= CAN_ERR_PROT_UNSPEC;
381 cf->data[3] = ecc & SJA1000_ECC_SEG;380 cf->data[3] = ecc & SJA1000_ECC_SEG;
382 break;381 break;
383 }382 }
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
282 cf->data[2] |= CAN_ERR_PROT_STUFF;282 cf->data[2] |= CAN_ERR_PROT_STUFF;
283 break;283 break;
284 default:284 default:
285 cf->data[2] |= CAN_ERR_PROT_UNSPEC;
286 cf->data[3] = ecc & SJA1000_ECC_SEG;285 cf->data[3] = ecc & SJA1000_ECC_SEG;
287 break;286 break;
288 }287 }
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
944 cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT;944 cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT;
945 945
946 if (es->leaf.error_factor & M16C_EF_ACKE)946 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;
948 if (es->leaf.error_factor & M16C_EF_CRCE)948 if (es->leaf.error_factor & M16C_EF_CRCE)
949 cf->data[3] |= (CAN_ERR_PROT_LOC_CRC_SEQ |949 cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
950 CAN_ERR_PROT_LOC_CRC_DEL);
951 if (es->leaf.error_factor & M16C_EF_FORME)950 if (es->leaf.error_factor & M16C_EF_FORME)
952 cf->data[2] |= CAN_ERR_PROT_FORM;951 cf->data[2] |= CAN_ERR_PROT_FORM;
953 if (es->leaf.error_factor & M16C_EF_STFE)952 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
401 tx_errors = 1;401 tx_errors = 1;
402 break;402 break;
403 case USB_8DEV_STATUSMSG_CRC:403 case USB_8DEV_STATUSMSG_CRC:
404 cf->data[2] |= CAN_ERR_PROT_UNSPEC;404 cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
405 cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ |
406 CAN_ERR_PROT_LOC_CRC_DEL;
407 rx_errors = 1;405 rx_errors = 1;
408 break;406 break;
409 case USB_8DEV_STATUSMSG_BIT0:407 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
608 608
609 /* Check for error interrupt */609 /* Check for error interrupt */
610 if (isr & XCAN_IXR_ERROR_MASK) {610 if (isr & XCAN_IXR_ERROR_MASK) {
611 if (skb) {611 if (skb)
612 cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;612 cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
613 cf->data[2] |= CAN_ERR_PROT_UNSPEC;
614 }
615 613
616 /* Check for Ack error interrupt */614 /* Check for Ack error interrupt */
617 if (err_status & XCAN_ESR_ACKER_MASK) {615 if (err_status & XCAN_ESR_ACKER_MASK) {
618 stats->tx_errors++;616 stats->tx_errors++;
619 if (skb) {617 if (skb) {
620 cf->can_id |= CAN_ERR_ACK;618 cf->can_id |= CAN_ERR_ACK;
621 cf->data[3] |= CAN_ERR_PROT_LOC_ACK;619 cf->data[3] = CAN_ERR_PROT_LOC_ACK;
622 }620 }
623 }621 }
624 622
@@ -654,8 +652,7 @@ static void xcan_err_interrupt(struct net_device *ndev, u32 isr) · 29 unmodified lines
654 stats->rx_errors++;652 stats->rx_errors++;
655 if (skb) {653 if (skb) {
656 cf->can_id |= CAN_ERR_PROT;654 cf->can_id |= CAN_ERR_PROT;
657 cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ |655 cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
658 CAN_ERR_PROT_LOC_CRC_DEL;
659 }656 }
660 }657 }
661 priv->can.can_stats.bus_error++;658 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
29source "drivers/net/ethernet/apple/Kconfig"29source "drivers/net/ethernet/apple/Kconfig"
30source "drivers/net/ethernet/arc/Kconfig"30source "drivers/net/ethernet/arc/Kconfig"
31source "drivers/net/ethernet/atheros/Kconfig"31source "drivers/net/ethernet/atheros/Kconfig"
32source "drivers/net/ethernet/aurora/Kconfig"
32source "drivers/net/ethernet/cadence/Kconfig"33source "drivers/net/ethernet/cadence/Kconfig"
33source "drivers/net/ethernet/adi/Kconfig"34source "drivers/net/ethernet/adi/Kconfig"
34source "drivers/net/ethernet/broadcom/Kconfig"35source "drivers/net/ethernet/broadcom/Kconfig"
drivers/net/ethernet/Makefile+1−0
@@ -15,6 +15,7 @@ obj-$(CONFIG_NET_XGENE) += apm/ · 14 unmodified lines
15obj-$(CONFIG_NET_VENDOR_APPLE) += apple/15obj-$(CONFIG_NET_VENDOR_APPLE) += apple/
16obj-$(CONFIG_NET_VENDOR_ARC) += arc/16obj-$(CONFIG_NET_VENDOR_ARC) += arc/
17obj-$(CONFIG_NET_VENDOR_ATHEROS) += atheros/17obj-$(CONFIG_NET_VENDOR_ATHEROS) += atheros/
18obj-$(CONFIG_NET_VENDOR_AURORA) += aurora/
18obj-$(CONFIG_NET_CADENCE) += cadence/19obj-$(CONFIG_NET_CADENCE) += cadence/
19obj-$(CONFIG_NET_BFIN) += adi/20obj-$(CONFIG_NET_BFIN) += adi/
20obj-$(CONFIG_NET_VENDOR_BROADCOM) += broadcom/21obj-$(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
1500 return -ENODEV;1500 return -ENODEV;
1501 }1501 }
1502 1502
1503 if (!pci_set_dma_mask(pdev, PCNET32_DMA_MASK)) {1503 err = pci_set_dma_mask(pdev, PCNET32_DMA_MASK);
1504 if (err) {
1504 if (pcnet32_debug & NETIF_MSG_PROBE)1505 if (pcnet32_debug & NETIF_MSG_PROBE)
1505 pr_err("architecture does not support 32bit PCI busmaster DMA\n");1506 pr_err("architecture does not support 32bit PCI busmaster DMA\n");
1506 return -ENODEV;1507 return err;
1507 }1508 }
1508 if (!request_region(ioaddr, PCNET32_TOTAL_SIZE, "pcnet32_probe_pci")) {1509 if (!request_region(ioaddr, PCNET32_TOTAL_SIZE, "pcnet32_probe_pci")) {
1509 if (pcnet32_debug & NETIF_MSG_PROBE)1510 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
450 return NETDEV_TX_OK;450 return NETDEV_TX_OK;
451 }451 }
452 452
453 pdata->ring_ops->wr_cmd(tx_ring, count);
454 skb_tx_timestamp(skb);453 skb_tx_timestamp(skb);
455 454
456 pdata->stats.tx_packets++;455 pdata->stats.tx_packets++;
457 pdata->stats.tx_bytes += skb->len;456 pdata->stats.tx_bytes += skb->len;
458 457
458 pdata->ring_ops->wr_cmd(tx_ring, count);
459 return NETDEV_TX_OK;459 return NETDEV_TX_OK;
460}460}
461 461
@@ -688,10 +688,10 @@ static int xgene_enet_open(struct net_device *ndev) · 226 unmodified lines
688 mac_ops->tx_enable(pdata);688 mac_ops->tx_enable(pdata);
689 mac_ops->rx_enable(pdata);689 mac_ops->rx_enable(pdata);
690 690
691 xgene_enet_napi_enable(pdata);
691 ret = xgene_enet_register_irq(ndev);692 ret = xgene_enet_register_irq(ndev);
692 if (ret)693 if (ret)
693 return ret;694 return ret;
694 xgene_enet_napi_enable(pdata);
695 695
696 if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII)696 if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII)
697 phy_start(pdata->phy_dev);697 phy_start(pdata->phy_dev);
@@ -715,13 +715,13 @@ static int xgene_enet_close(struct net_device *ndev) · 17 unmodified lines
715 else715 else
716 cancel_delayed_work_sync(&pdata->link_work);716 cancel_delayed_work_sync(&pdata->link_work);
717 717
718 xgene_enet_napi_disable(pdata);
719 xgene_enet_free_irq(ndev);
720 xgene_enet_process_ring(pdata->rx_ring, -1);
721
722 mac_ops->tx_disable(pdata);718 mac_ops->tx_disable(pdata);
723 mac_ops->rx_disable(pdata);719 mac_ops->rx_disable(pdata);
724 720
721 xgene_enet_free_irq(ndev);
722 xgene_enet_napi_disable(pdata);
723 xgene_enet_process_ring(pdata->rx_ring, -1);
724
725 return 0;725 return 0;
726}726}
727 727
@@ -1474,15 +1474,15 @@ static int xgene_enet_probe(struct platform_device *pdev) · 746 unmodified lines
1474 }1474 }
1475 ndev->hw_features = ndev->features;1475 ndev->hw_features = ndev->features;
1476 1476
1477 ret = register_netdev(ndev);1477 ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
1478 if (ret) {1478 if (ret) {
1479 netdev_err(ndev, "Failed to register netdev\n");1479 netdev_err(ndev, "No usable DMA configuration\n");
1480 goto err;1480 goto err;
1481 }1481 }
1482 1482
1483 ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));1483 ret = register_netdev(ndev);
1484 if (ret) {1484 if (ret) {
1485 netdev_err(ndev, "No usable DMA configuration\n");1485 netdev_err(ndev, "Failed to register netdev\n");
1486 goto err;1486 goto err;
1487 }1487 }
1488 1488
@@ -1490,14 +1490,17 @@ static int xgene_enet_probe(struct platform_device *pdev) · 1 unmodified line
1490 if (ret)1490 if (ret)
1491 goto err;1491 goto err;
1492 1492
1493 xgene_enet_napi_add(pdata);
1494 mac_ops = pdata->mac_ops;1493 mac_ops = pdata->mac_ops;
1495 if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII)1494 if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) {
1496 ret = xgene_enet_mdio_config(pdata);1495 ret = xgene_enet_mdio_config(pdata);
1497 else1496 if (ret)
1497 goto err;
1498 } else {
1498 INIT_DELAYED_WORK(&pdata->link_work, mac_ops->link_state);1499 INIT_DELAYED_WORK(&pdata->link_work, mac_ops->link_state);
1500 }
1499 1501
1500 return ret;1502 xgene_enet_napi_add(pdata);
1503 return 0;
1501err:1504err:
1502 unregister_netdev(ndev);1505 unregister_netdev(ndev);
1503 free_netdev(ndev);1506 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
1534 .driver_data = ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG },1534 .driver_data = ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG },
1535 { PCI_VDEVICE(ATTANSIC, ALX_DEV_ID_E2200),1535 { PCI_VDEVICE(ATTANSIC, ALX_DEV_ID_E2200),
1536 .driver_data = ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG },1536 .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 },
1537 { PCI_VDEVICE(ATTANSIC, ALX_DEV_ID_AR8162),1539 { PCI_VDEVICE(ATTANSIC, ALX_DEV_ID_AR8162),
1538 .driver_data = ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG },1540 .driver_data = ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG },
1539 { PCI_VDEVICE(ATTANSIC, ALX_DEV_ID_AR8171) },1541 { PCI_VDEVICE(ATTANSIC, ALX_DEV_ID_AR8171) },
drivers/net/ethernet/atheros/alx/reg.h+1−0
@@ -37,6 +37,7 @@ · 36 unmodified lines
37 37
38#define ALX_DEV_ID_AR8161 0x109138#define ALX_DEV_ID_AR8161 0x1091
39#define ALX_DEV_ID_E2200 0xe09139#define ALX_DEV_ID_E2200 0xe091
40#define ALX_DEV_ID_E2400 0xe0a1
40#define ALX_DEV_ID_AR8162 0x109041#define ALX_DEV_ID_AR8162 0x1090
41#define ALX_DEV_ID_AR8171 0x10A142#define ALX_DEV_ID_AR8171 0x10A1
42#define ALX_DEV_ID_AR8172 0x10A043#define ALX_DEV_ID_AR8172 0x10A0
drivers/net/ethernet/aurora/Kconfig+20−0
@@ -0,0 +1,20 @@
1config 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
12if NET_VENDOR_AURORA
13
14config AURORA_NB8800
15 tristate "Aurora AU-NB8800 support"
16 select PHYLIB
17 help
18 Support for the AU-NB8800 gigabit Ethernet controller.
19
20endif
drivers/net/ethernet/aurora/Makefile+1−0
@@ -0,0 +1 @@
1obj-$(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
42static void nb8800_tx_done(struct net_device *dev);
43static int nb8800_dma_stop(struct net_device *dev);
44
45static inline u8 nb8800_readb(struct nb8800_priv *priv, int reg)
46{
47 return readb_relaxed(priv->base + reg);
48}
49
50static inline u32 nb8800_readl(struct nb8800_priv *priv, int reg)
51{
52 return readl_relaxed(priv->base + reg);
53}
54
55static inline void nb8800_writeb(struct nb8800_priv *priv, int reg, u8 val)
56{
57 writeb_relaxed(val, priv->base + reg);
58}
59
60static inline void nb8800_writew(struct nb8800_priv *priv, int reg, u16 val)
61{
62 writew_relaxed(val, priv->base + reg);
63}
64
65static inline void nb8800_writel(struct nb8800_priv *priv, int reg, u32 val)
66{
67 writel_relaxed(val, priv->base + reg);
68}
69
70static 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
80static 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
90static 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
96static inline void nb8800_setb(struct nb8800_priv *priv, int reg, u8 bits)
97{
98 nb8800_maskb(priv, reg, bits, bits);
99}
100
101static inline void nb8800_clearb(struct nb8800_priv *priv, int reg, u8 bits)
102{
103 nb8800_maskb(priv, reg, bits, 0);
104}
105
106static 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
112static inline void nb8800_setl(struct nb8800_priv *priv, int reg, u32 bits)
113{
114 nb8800_maskl(priv, reg, bits, bits);
115}
116
117static inline void nb8800_clearl(struct nb8800_priv *priv, int reg, u32 bits)
118{
119 nb8800_maskl(priv, reg, bits, 0);
120}
121
122static 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
131static 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
147static 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
164static 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
172static 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
182static 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
187static 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
192static void nb8800_start_rx(struct net_device *dev)
193{
194 nb8800_setl(netdev_priv(dev), NB8800_RXC_CR, RCR_EN);
195}
196
197static 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
230static 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
276static 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
293static 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
304again:
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
359static 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
380static 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
389static 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
398static 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
482static 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
496static 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
546static 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
597static 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
631static 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
664static 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
696static 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
708static 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
721static 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
730static 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
755static 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
790static 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
834static 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
874err_out:
875 nb8800_dma_free(dev);
876
877 return -ENOMEM;
878}
879
880static 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
935static 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
952static 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
989err_free_irq:
990 free_irq(dev->irq, dev);
991err_free_dma:
992 nb8800_dma_free(dev);
993
994 return err;
995}
996
997static 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
1020static 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
1027static 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
1038static 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
1048static 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
1058static 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
1068static 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
1078static 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
1097static 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
1147static 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
1155static 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
1161static 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
1170static 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
1184static 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
1196static 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
1286static 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
1316static 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
1333static const struct nb8800_ops nb8800_tangox_ops = {
1334 .init = nb8800_tangox_init,
1335 .reset = nb8800_tangox_reset,
1336};
1337
1338static 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
1360static const struct nb8800_ops nb8800_tango4_ops = {
1361 .init = nb8800_tango4_init,
1362 .reset = nb8800_tangox_reset,
1363};
1364
1365static 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
1380static 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
1510err_free_dma:
1511 nb8800_dma_free(dev);
1512err_free_bus:
1513 mdiobus_unregister(bus);
1514err_disable_clk:
1515 clk_disable_unprepare(priv->clk);
1516err_free_dev:
1517 free_netdev(dev);
1518
1519 return ret;
1520}
1521
1522static 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
1539static 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
1548module_platform_driver(nb8800_driver);
1549
1550MODULE_DESCRIPTION("Aurora AU-NB8800 Ethernet driver");
1551MODULE_AUTHOR("Mans Rullgard <mans@mansr.com>");
1552MODULE_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 */
168struct 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