History

Merge tag 'drm-misc-next-2021-01-19' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

drm-misc-next for v5.12: UAPI Changes: - Fix fourcc macro for amlogic video fbc. Cross-subsystem Changes: - Export pci_rebar_bytes_to_size. - Add a PCI quirk to increase bar0 for RX 5600 XT Pulse to max possible size. - Convert devicetree bindings to use the OF graph schema. - Update s6e63m0 bindings. - Make omapfb2 DSI_CM incompatible with drm/omap2 DSI-CM because of module conflicts. - Add Zack Rusin as vmwgfx maintainer. - Add CONFIG_DMABUF_DEBUG for validating dma-buf users don't loo kat struct page when importing or detaching. Core Changes: - Remove references to drm_device.pdev - Fix regression in ttm_bo_move_to_lru_tail(). - Assorted docbook updates. - Do not send dp-mst hotplug events on error when probing. - Move some agp macros to agpsupport.c, so it's not always compiled. - Move drm_need_swiotlb.h to drm_cache.c - Only build drm_memory.o for legacy drivers, and move CONFIG_DRM_VM to legacy. - Nuke drm_device.hose - Warn when the ttm resource manager is non-empty when disabling. - Assorted small fixes. Driver Changes: - Small assorted fixes in radeon, v3d, hisilicon, mipi-dbi, panfrost, hibmc, vc4, amdgpu, vkms, vmwgfx. - Move hisilicon to use simple encode. - Add writeback connector to vkms. - Add support for BT2020 to DE3. - Use gem prime mmap helpers in vc4, and move the mmap function upwards. - Use managed drm device, and cleanup error paths and display registers in vmwgfx. - Use correct bus_format and connector_type for innolux_n116bge. - Fix a lot of warnings with W=1 (Lee Jones)

Daniel Vetter committed 5 years ago

Commit 71c46fc2 parents 1777b18 c31eb10229 files · +1500 −2273Browse files

Unified · Split

229 files
  1. Documentation/devicetree/bindings/display/allwinner,sun4i-a10-display-backend.yaml +5 −18
  2. Documentation/devicetree/bindings/display/allwinner,sun4i-a10-display-frontend.yaml +3 −16
  3. Documentation/devicetree/bindings/display/allwinner,sun4i-a10-hdmi.yaml +3 −16
  4. Documentation/devicetree/bindings/display/allwinner,sun4i-a10-tcon.yaml +6 −19
  5. Documentation/devicetree/bindings/display/allwinner,sun4i-a10-tv-encoder.yaml +2 −4
  6. Documentation/devicetree/bindings/display/allwinner,sun6i-a31-drc.yaml +3 −16
  7. Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml +2 −4
  8. Documentation/devicetree/bindings/display/allwinner,sun8i-a83t-de2-mixer.yaml +3 −16
  9. Documentation/devicetree/bindings/display/allwinner,sun8i-a83t-dw-hdmi.yaml +3 −16
  10. Documentation/devicetree/bindings/display/allwinner,sun8i-r40-tcon-top.yaml +7 −103
  11. Documentation/devicetree/bindings/display/allwinner,sun9i-a80-deu.yaml +3 −16
  12. Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml +2 −2
  13. Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml +2 −2
  14. Documentation/devicetree/bindings/display/brcm,bcm2835-dpi.yaml +3 −4
  15. Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml +3 −3
  16. Documentation/devicetree/bindings/display/bridge/analogix,anx7814.yaml +3 −16
  17. Documentation/devicetree/bindings/display/bridge/anx6345.yaml +5 −13
  18. Documentation/devicetree/bindings/display/bridge/cdns,mhdp8546.yaml +6 −16
  19. Documentation/devicetree/bindings/display/bridge/chrontel,ch7033.yaml +3 −3
  20. Documentation/devicetree/bindings/display/bridge/intel,keembay-dsi.yaml +3 −11
  21. Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml +1 −1
  22. Documentation/devicetree/bindings/display/bridge/lontium,lt9611.yaml +7 −63
  23. Documentation/devicetree/bindings/display/bridge/lvds-codec.yaml +4 −14
  24. Documentation/devicetree/bindings/display/bridge/nwl-dsi.yaml +7 −34
  25. Documentation/devicetree/bindings/display/bridge/ps8640.yaml +6 −18
  26. Documentation/devicetree/bindings/display/bridge/renesas,lvds.yaml +3 −15
  27. Documentation/devicetree/bindings/display/bridge/simple-bridge.yaml +4 −14
  28. Documentation/devicetree/bindings/display/bridge/snps,dw-mipi-dsi.yaml +4 −3
  29. Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.yaml +5 −16
  30. Documentation/devicetree/bindings/display/bridge/ti,sn65dsi86.yaml +6 −39
  31. Documentation/devicetree/bindings/display/bridge/ti,tfp410.yaml +6 −18
  32. Documentation/devicetree/bindings/display/bridge/toshiba,tc358762.yaml +5 −47
  33. Documentation/devicetree/bindings/display/bridge/toshiba,tc358768.yaml +6 −42
  34. Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml +5 −14
  35. Documentation/devicetree/bindings/display/connector/analog-tv-connector.yaml +1 −0
  36. Documentation/devicetree/bindings/display/connector/dvi-connector.yaml +1 −0
  37. Documentation/devicetree/bindings/display/connector/hdmi-connector.yaml +1 −0
  38. Documentation/devicetree/bindings/display/connector/vga-connector.yaml +1 −0
  39. Documentation/devicetree/bindings/display/imx/nxp,imx8mq-dcss.yaml +1 −1
  40. Documentation/devicetree/bindings/display/ingenic,ipu.yaml +2 −3
  41. Documentation/devicetree/bindings/display/ingenic,lcd.yaml +5 −5
  42. Documentation/devicetree/bindings/display/intel,keembay-display.yaml +1 −1
  43. Documentation/devicetree/bindings/display/panel/advantech,idk-2121wr.yaml +10 −11
  44. Documentation/devicetree/bindings/display/panel/panel-common.yaml +1 −10
  45. Documentation/devicetree/bindings/display/panel/samsung,s6e63m0.yaml +3 −1
  46. Documentation/devicetree/bindings/display/rockchip/rockchip,rk3066-hdmi.yaml +3 −13
  47. Documentation/devicetree/bindings/display/rockchip/rockchip-vop.yaml +1 −4
  48. Documentation/devicetree/bindings/display/st,stm32-dsi.yaml +4 −8
  49. Documentation/devicetree/bindings/display/st,stm32-ltdc.yaml +3 −5
  50. Documentation/devicetree/bindings/display/ste,mcde.yaml +2 −3
  51. Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +4 −15
  52. Documentation/devicetree/bindings/display/ti/ti,j721e-dss.yaml +6 −17
  53. Documentation/devicetree/bindings/display/ti/ti,k2g-dss.yaml +1 −2
  54. Documentation/gpu/vkms.rst +12 −0
  55. MAINTAINERS +1 −0
  56. drivers/dma-buf/Kconfig +8 −0
  57. drivers/dma-buf/dma-buf.c +42 −4
  58. drivers/gpu/drm/Kconfig +0 −5
  59. drivers/gpu/drm/Makefile +3 −3
  60. drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +16 −14
  61. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 −1
  62. drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +1 −1
  63. drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +5 −5
  64. drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c +1 −1
  65. drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +5 −5
  66. drivers/gpu/drm/ast/ast_drv.c +2 −2
  67. drivers/gpu/drm/ast/ast_main.c +13 −12
  68. drivers/gpu/drm/ast/ast_mm.c +9 −8
  69. drivers/gpu/drm/ast/ast_mode.c +3 −2
  70. drivers/gpu/drm/ast/ast_post.c +5 −3
  71. drivers/gpu/drm/bochs/bochs_drv.c +0 −1
  72. drivers/gpu/drm/bochs/bochs_hw.c +2 −2
  73. drivers/gpu/drm/drm_agpsupport.c +23 −44
  74. drivers/gpu/drm/drm_bufs.c +2 −2
  75. drivers/gpu/drm/drm_cache.c +33 −0
  76. drivers/gpu/drm/drm_dp_helper.c +2 −1
  77. drivers/gpu/drm/drm_dp_mst_topology.c +1 −1
  78. drivers/gpu/drm/drm_drv.c +3 −0
  79. drivers/gpu/drm/drm_edid.c +6 −1
  80. drivers/gpu/drm/drm_file.c +2 −3
  81. drivers/gpu/drm/drm_gem.c +10 −9
  82. drivers/gpu/drm/drm_irq.c +7 −5
  83. drivers/gpu/drm/drm_legacy.h +1 −1
  84. drivers/gpu/drm/drm_memory.c +0 −51
  85. drivers/gpu/drm/drm_modes.c +2 −2
  86. drivers/gpu/drm/drm_pci.c +15 −11
  87. drivers/gpu/drm/drm_prime.c +2 −0
  88. drivers/gpu/drm/drm_vblank.c +1 −1
  89. drivers/gpu/drm/drm_vm.c +1 −1
  90. drivers/gpu/drm/gma500/cdv_device.c +19 −11
  91. drivers/gpu/drm/gma500/cdv_intel_crt.c +2 −3
  92. drivers/gpu/drm/gma500/cdv_intel_display.c +1 −1
  93. drivers/gpu/drm/gma500/cdv_intel_dp.c +2 −2
  94. drivers/gpu/drm/gma500/cdv_intel_lvds.c +6 −5
  95. drivers/gpu/drm/gma500/framebuffer.c +8 −7
  96. drivers/gpu/drm/gma500/gem.c +4 −2
  97. drivers/gpu/drm/gma500/gem.h +2 −0
  98. drivers/gpu/drm/gma500/gma_device.c +3 −1
  99. drivers/gpu/drm/gma500/gma_display.c +6 −6
  100. drivers/gpu/drm/gma500/gtt.c +11 −9
  101. drivers/gpu/drm/gma500/intel_bios.c +4 −4
  102. drivers/gpu/drm/gma500/intel_gmbus.c +2 −2
  103. drivers/gpu/drm/gma500/intel_i2c.c +2 −3
  104. drivers/gpu/drm/gma500/mdfld_device.c +3 −1
  105. drivers/gpu/drm/gma500/mdfld_dsi_dpi.c +4 −4
  106. drivers/gpu/drm/gma500/mdfld_dsi_output.c +2 −2
  107. drivers/gpu/drm/gma500/mdfld_intel_display.c +3 −3
  108. drivers/gpu/drm/gma500/mid_bios.c +6 −3
  109. drivers/gpu/drm/gma500/mmu.c +3 −12
  110. drivers/gpu/drm/gma500/oaktrail_crtc.c +3 −3
  111. drivers/gpu/drm/gma500/oaktrail_device.c +3 −2
  112. drivers/gpu/drm/gma500/oaktrail_lvds.c +3 −2
  113. drivers/gpu/drm/gma500/oaktrail_lvds_i2c.c +5 −5
  114. drivers/gpu/drm/gma500/opregion.c +2 −1
  115. drivers/gpu/drm/gma500/power.c +11 −10
  116. drivers/gpu/drm/gma500/psb_drv.c +8 −8
  117. drivers/gpu/drm/gma500/psb_drv.h +4 −4
  118. drivers/gpu/drm/gma500/psb_intel_display.c +1 −1
  119. drivers/gpu/drm/gma500/psb_intel_lvds.c +4 −3
  120. drivers/gpu/drm/gma500/psb_intel_modes.c +2 −1
  121. drivers/gpu/drm/gma500/psb_intel_sdvo.c +4 −4
  122. drivers/gpu/drm/gma500/psb_irq.c +1 −2
  123. drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c +18 −18
  124. drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +6 −7
  125. drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_i2c.c +1 −1
  126. drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c +4 −14
  127. drivers/gpu/drm/mga/mga_ioc32.c +7 −7
  128. drivers/gpu/drm/mgag200/mgag200_drv.c +11 −9
  129. drivers/gpu/drm/mgag200/mgag200_i2c.c +1 −1
  130. drivers/gpu/drm/mgag200/mgag200_mm.c +6 −4
  131. drivers/gpu/drm/nouveau/dispnv04/arb.c +7 −5
  132. drivers/gpu/drm/nouveau/dispnv04/dfp.c +3 −2
  133. drivers/gpu/drm/nouveau/dispnv04/disp.h +8 −6
  134. drivers/gpu/drm/nouveau/dispnv04/hw.c +6 −4
  135. drivers/gpu/drm/nouveau/nouveau_abi16.c +4 −3
  136. drivers/gpu/drm/nouveau/nouveau_acpi.c +1 −1
  137. drivers/gpu/drm/nouveau/nouveau_bios.c +8 −3
  138. drivers/gpu/drm/nouveau/nouveau_connector.c +6 −4
  139. drivers/gpu/drm/nouveau/nouveau_drm.c +2 −3
  140. drivers/gpu/drm/nouveau/nouveau_fbcon.c +4 −2
  141. drivers/gpu/drm/nouveau/nouveau_vga.c +12 −8
  142. drivers/gpu/drm/panel/panel-simple.c +2 −0
  143. drivers/gpu/drm/panfrost/panfrost_devfreq.c +1 −0
  144. drivers/gpu/drm/qxl/qxl_drv.c +1 −1
  145. drivers/gpu/drm/qxl/qxl_ioctl.c +2 −1
  146. drivers/gpu/drm/qxl/qxl_irq.c +2 −1
  147. drivers/gpu/drm/qxl/qxl_kms.c +0 −1
  148. drivers/gpu/drm/r128/r128_ioc32.c +7 −7
  149. drivers/gpu/drm/radeon/atombios_encoders.c +3 −3
  150. drivers/gpu/drm/radeon/r100.c +13 −14
  151. drivers/gpu/drm/radeon/radeon.h +19 −16
  152. drivers/gpu/drm/radeon/radeon_atombios.c +45 −44
  153. drivers/gpu/drm/radeon/radeon_bios.c +3 −3
  154. drivers/gpu/drm/radeon/radeon_combios.c +29 −26
  155. drivers/gpu/drm/radeon/radeon_cs.c +1 −2
  156. drivers/gpu/drm/radeon/radeon_device.c +10 −7
  157. drivers/gpu/drm/radeon/radeon_display.c +1 −1
  158. drivers/gpu/drm/radeon/radeon_drv.c +1 −6
  159. drivers/gpu/drm/radeon/radeon_fb.c +1 −1
  160. drivers/gpu/drm/radeon/radeon_gem.c +3 −3
  161. drivers/gpu/drm/radeon/radeon_i2c.c +1 −1
  162. drivers/gpu/drm/radeon/radeon_irq_kms.c +1 −1
  163. drivers/gpu/drm/radeon/radeon_kms.c +14 −10
  164. drivers/gpu/drm/radeon/radeon_legacy_encoders.c +3 −3
  165. drivers/gpu/drm/radeon/radeon_ttm.c +1 −1
  166. drivers/gpu/drm/radeon/rs780_dpm.c +3 −4
  167. drivers/gpu/drm/scheduler/sched_main.c +3 −0
  168. drivers/gpu/drm/sun4i/sun4i_tcon.c +2 −19
  169. drivers/gpu/drm/sun4i/sun4i_tcon.h +1 −0
  170. drivers/gpu/drm/sun4i/sun8i_csc.c +44 −65
  171. drivers/gpu/drm/sun4i/sun8i_mixer.h +2 −4
  172. drivers/gpu/drm/sun4i/sun8i_vi_layer.c +2 −0
  173. drivers/gpu/drm/tiny/cirrus.c +0 −1
  174. drivers/gpu/drm/ttm/ttm_bo.c +3 −1
  175. drivers/gpu/drm/v3d/v3d_drv.c +2 −2
  176. drivers/gpu/drm/v3d/v3d_irq.c +2 −5
  177. drivers/gpu/drm/vboxvideo/vbox_drv.c +6 −5
  178. drivers/gpu/drm/vboxvideo/vbox_irq.c +3 −1
  179. drivers/gpu/drm/vboxvideo/vbox_main.c +6 −2
  180. drivers/gpu/drm/vboxvideo/vbox_ttm.c +4 −3
  181. drivers/gpu/drm/vc4/vc4_bo.c +19 −92
  182. drivers/gpu/drm/vc4/vc4_drv.c +2 −17
  183. drivers/gpu/drm/vc4/vc4_drv.h +0 −8
  184. drivers/gpu/drm/virtio/virtgpu_drv.c +0 −1
  185. drivers/gpu/drm/virtio/virtgpu_gem.c +5 −3
  186. drivers/gpu/drm/virtio/virtgpu_vram.c +1 −0
  187. drivers/gpu/drm/vkms/vkms_drv.c +41 −8
  188. drivers/gpu/drm/vkms/vkms_drv.h +10 −2
  189. drivers/gpu/drm/vkms/vkms_output.c +8 −5
  190. drivers/gpu/drm/vmwgfx/Makefile +3 −3
  191. drivers/gpu/drm/vmwgfx/vmwgfx_binding.c +26 −26
  192. drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c +59 −67
  193. drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c +9 −13
  194. drivers/gpu/drm/vmwgfx/vmwgfx_context.c +20 −20
  195. drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c +6 −6
  196. drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +113 −122
  197. drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +33 −60
  198. drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +9 −13
  199. drivers/gpu/drm/vmwgfx/vmwgfx_fb.c +6 −6
  200. drivers/gpu/drm/vmwgfx/vmwgfx_fence.c +12 −16
  201. drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c +4 −4
  202. drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c +7 −8
  203. drivers/gpu/drm/vmwgfx/vmwgfx_irq.c +3 −7
  204. drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +35 −39
  205. drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +4 −5
  206. drivers/gpu/drm/vmwgfx/vmwgfx_marker.c +0 −155
  207. drivers/gpu/drm/vmwgfx/vmwgfx_mob.c +8 −8
  208. drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c +4 −4
  209. drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +2 −2
  210. drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +14 −14
  211. drivers/gpu/drm/vmwgfx/vmwgfx_shader.c +12 −12
  212. drivers/gpu/drm/vmwgfx/vmwgfx_so.c +4 −4
  213. drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +16 −16
  214. drivers/gpu/drm/vmwgfx/vmwgfx_streamoutput.c +4 −4
  215. drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +20 −20
  216. drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +3 −3
  217. drivers/pci/pci.c +10 −2
  218. drivers/pci/pci.h +0 −1
  219. drivers/video/fbdev/omap2/omapfb/displays/Kconfig +1 −0
  220. include/drm/drm_agpsupport.h +0 −18
  221. include/drm/drm_crtc.h +1 −1
  222. include/drm/drm_device.h +5 −4
  223. include/drm/drm_mipi_dbi.h +1 −1
  224. include/drm/drm_property.h +1 −1
  225. include/drm/ttm/ttm_resource.h +4 −0
  226. include/linux/dma-buf.h +6 −0
  227. include/linux/pci.h +9 −0
  228. include/linux/vgaarb.h +3 −3
  229. include/uapi/drm/drm_fourcc.h +2 −2
Documentation/devicetree/bindings/display/allwinner,sun4i-a10-display-backend.yaml+5−18
@@ -84,36 +84,23 @@ properties: · 83 unmodified lines
8484 const: dma-mem
8585
8686 ports:
87− type: object
88− description: |
89− A ports node with endpoint definitions as defined in
90− Documentation/devicetree/bindings/media/video-interfaces.txt.
87+ $ref: /schemas/graph.yaml#/properties/ports
9188
9289 properties:
93− "#address-cells":
94− const: 1
95−
96− "#size-cells":
97− const: 0
98−
9990 port@0:
100− type: object
101− description: |
91+ $ref: /schemas/graph.yaml#/properties/port
92+ description:
10293 Input endpoints of the controller.
10394
10495 port@1:
105− type: object
106− description: |
96+ $ref: /schemas/graph.yaml#/properties/port
97+ description:
10798 Output endpoints of the controller.
10899
109100 required:
110− - "#address-cells"
111− - "#size-cells"
112101 - port@0
113102 - port@1
114103
115− additionalProperties: false
116−
117104 required:
118105 - compatible
119106 - reg
Documentation/devicetree/bindings/display/allwinner,sun4i-a10-display-frontend.yaml+3−16
@@ -57,35 +57,22 @@ properties: · 56 unmodified lines
5757 maxItems: 1
5858
5959 ports:
60− type: object
61− description: |
62− A ports node with endpoint definitions as defined in
63− Documentation/devicetree/bindings/media/video-interfaces.txt.
60+ $ref: /schemas/graph.yaml#/properties/ports
6461
6562 properties:
66− "#address-cells":
67− const: 1
68−
69− "#size-cells":
70− const: 0
71−
7263 port@0:
73− type: object
64+ $ref: /schemas/graph.yaml#/properties/port
7465 description: |
7566 Input endpoints of the controller.
7667
7768 port@1:
78− type: object
69+ $ref: /schemas/graph.yaml#/properties/port
7970 description: |
8071 Output endpoints of the controller.
8172
8273 required:
83− - "#address-cells"
84− - "#size-cells"
8574 - port@1
8675
87− additionalProperties: false
88−
8976 required:
9077 - compatible
9178 - reg
Documentation/devicetree/bindings/display/allwinner,sun4i-a10-hdmi.yaml+3−16
@@ -76,37 +76,24 @@ properties: · 75 unmodified lines
7676 - const: audio-tx
7777
7878 ports:
79− type: object
80− description: |
81− A ports node with endpoint definitions as defined in
82− Documentation/devicetree/bindings/media/video-interfaces.txt.
79+ $ref: /schemas/graph.yaml#/properties/ports
8380
8481 properties:
85− "#address-cells":
86− const: 1
87−
88− "#size-cells":
89− const: 0
90−
9182 port@0:
92− type: object
83+ $ref: /schemas/graph.yaml#/properties/port
9384 description: |
9485 Input endpoints of the controller.
9586
9687 port@1:
97− type: object
88+ $ref: /schemas/graph.yaml#/properties/port
9889 description: |
9990 Output endpoints of the controller. Usually an HDMI
10091 connector.
10192
10293 required:
103− - "#address-cells"
104− - "#size-cells"
10594 - port@0
10695 - port@1
10796
108− additionalProperties: false
109−
11097 required:
11198 - compatible
11299 - reg
Documentation/devicetree/bindings/display/allwinner,sun4i-a10-tcon.yaml+6−19
@@ -115,31 +115,24 @@ properties: · 114 unmodified lines
115115 - const: lvds
116116
117117 ports:
118− type: object
119− description: |
120− A ports node with endpoint definitions as defined in
121− Documentation/devicetree/bindings/media/video-interfaces.txt.
118+ $ref: /schemas/graph.yaml#/properties/ports
122119
123120 properties:
124− "#address-cells":
125− const: 1
126−
127− "#size-cells":
128− const: 0
129−
130121 port@0:
131− type: object
122+ $ref: /schemas/graph.yaml#/properties/port
132123 description: |
133124 Input endpoints of the controller.
134125
135126 port@1:
136− type: object
127+ $ref: /schemas/graph.yaml#/$defs/port-base
128+ unevaluatedProperties: false
137129 description: |
138130 Output endpoints of the controller.
139131
140132 patternProperties:
141133 "^endpoint(@[0-9])$":
142− type: object
134+ $ref: /schemas/graph.yaml#/$defs/endpoint-base
135+ unevaluatedProperties: false
143136
144137 properties:
145138 allwinner,tcon-channel:
@@ -156,16 +149,10 @@ properties: · 10 unmodified lines
156149 property is not present, the endpoint number will be
157150 used as the channel number.
158151
159− unevaluatedProperties: true
160−
161152 required:
162− - "#address-cells"
163− - "#size-cells"
164153 - port@0
165154 - port@1
166155
167− additionalProperties: false
168−
169156 required:
170157 - compatible
171158 - reg
Documentation/devicetree/bindings/display/allwinner,sun4i-a10-tv-encoder.yaml+2−4
@@ -24,11 +24,9 @@ properties: · 23 unmodified lines
2424 maxItems: 1
2525
2626 port:
27− type: object
27+ $ref: /schemas/graph.yaml#/properties/port
2828 description:
29− A port node with endpoint definitions as defined in
30− Documentation/devicetree/bindings/media/video-interfaces.txt. The
31− first port should be the input endpoint, usually coming from the
29+ The first port should be the input endpoint, usually coming from the
3230 associated TCON.
3331
3432 required:
Documentation/devicetree/bindings/display/allwinner,sun6i-a31-drc.yaml+3−16
@@ -46,36 +46,23 @@ properties: · 45 unmodified lines
4646 maxItems: 1
4747
4848 ports:
49− type: object
50− description: |
51− A ports node with endpoint definitions as defined in
52− Documentation/devicetree/bindings/media/video-interfaces.txt.
49+ $ref: /schemas/graph.yaml#/properties/ports
5350
5451 properties:
55− "#address-cells":
56− const: 1
57−
58− "#size-cells":
59− const: 0
60−
6152 port@0:
62− type: object
53+ $ref: /schemas/graph.yaml#/properties/port
6354 description: |
6455 Input endpoints of the controller.
6556
6657 port@1:
67− type: object
58+ $ref: /schemas/graph.yaml#/properties/port
6859 description: |
6960 Output endpoints of the controller.
7061
7162 required:
72− - "#address-cells"
73− - "#size-cells"
7463 - port@0
7564 - port@1
7665
77− additionalProperties: false
78−
7966 required:
8067 - compatible
8168 - reg
Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml+2−4
@@ -47,11 +47,9 @@ properties: · 46 unmodified lines
4747 const: dphy
4848
4949 port:
50− type: object
50+ $ref: /schemas/graph.yaml#/properties/port
5151 description:
52− A port node with endpoint definitions as defined in
53− Documentation/devicetree/bindings/media/video-interfaces.txt. That
54− port should be the input endpoint, usually coming from the
52+ The port should be the input endpoint, usually coming from the
5553 associated TCON.
5654
5755 required:
Documentation/devicetree/bindings/display/allwinner,sun8i-a83t-de2-mixer.yaml+3−16
@@ -43,35 +43,22 @@ properties: · 42 unmodified lines
4343 maxItems: 1
4444
4545 ports:
46− type: object
47− description: |
48− A ports node with endpoint definitions as defined in
49− Documentation/devicetree/bindings/media/video-interfaces.txt.
46+ $ref: /schemas/graph.yaml#/properties/ports
5047
5148 properties:
52− "#address-cells":
53− const: 1
54−
55− "#size-cells":
56− const: 0
57−
5849 port@0:
59− type: object
50+ $ref: /schemas/graph.yaml#/properties/port
6051 description: |
6152 Input endpoints of the controller.
6253
6354 port@1:
64− type: object
55+ $ref: /schemas/graph.yaml#/properties/port
6556 description: |
6657 Output endpoints of the controller.
6758
6859 required:
69− - "#address-cells"
70− - "#size-cells"
7160 - port@1
7261
73− additionalProperties: false
74−
7562 required:
7663 - compatible
7764 - reg
Documentation/devicetree/bindings/display/allwinner,sun8i-a83t-dw-hdmi.yaml+3−16
@@ -93,38 +93,25 @@ properties: · 92 unmodified lines
9393 The VCC power supply of the controller
9494
9595 ports:
96− type: object
97− description: |
98− A ports node with endpoint definitions as defined in
99− Documentation/devicetree/bindings/media/video-interfaces.txt.
96+ $ref: /schemas/graph.yaml#/properties/ports
10097
10198 properties:
102− "#address-cells":
103− const: 1
104−
105− "#size-cells":
106− const: 0
107−
10899 port@0:
109− type: object
100+ $ref: /schemas/graph.yaml#/properties/port
110101 description: |
111102 Input endpoints of the controller. Usually the associated
112103 TCON.
113104
114105 port@1:
115− type: object
106+ $ref: /schemas/graph.yaml#/properties/port
116107 description: |
117108 Output endpoints of the controller. Usually an HDMI
118109 connector.
119110
120111 required:
121− - "#address-cells"
122− - "#size-cells"
123112 - port@0
124113 - port@1
125114
126− additionalProperties: false
127−
128115 required:
129116 - compatible
130117 - reg
Documentation/devicetree/bindings/display/allwinner,sun8i-r40-tcon-top.yaml+7−103
@@ -80,141 +80,45 @@ properties: · 79 unmodified lines
8080 maxItems: 1
8181
8282 ports:
83− type: object
84− description: |
85− A ports node with endpoint definitions as defined in
86− Documentation/devicetree/bindings/media/video-interfaces.txt.
87− All ports should have only one endpoint connected to
88− remote endpoint.
83+ $ref: /schemas/graph.yaml#/properties/ports
8984
9085 properties:
91− "#address-cells":
92− const: 1
93−
94− "#size-cells":
95− const: 0
96−
9786 port@0:
98− type: object
87+ $ref: /schemas/graph.yaml#/properties/port
9988 description: |
10089 Input endpoint for Mixer 0 mux.
10190
10291 port@1:
103− type: object
92+ $ref: /schemas/graph.yaml#/properties/port
10493 description: |
10594 Output endpoint for Mixer 0 mux
10695
107− properties:
108− "#address-cells":
109− const: 1
110−
111− "#size-cells":
112− const: 0
113−
114− reg: true
115−
116− patternProperties:
117− "^endpoint@[0-9]$":
118− type: object
119−
120− properties:
121− reg:
122− description: |
123− ID of the target TCON
124−
125− required:
126− - reg
127−
128− required:
129− - "#address-cells"
130− - "#size-cells"
131−
132− additionalProperties: false
133−
13496 port@2:
135− type: object
97+ $ref: /schemas/graph.yaml#/properties/port
13698 description: |
13799 Input endpoint for Mixer 1 mux.
138100
139101 port@3:
140− type: object
102+ $ref: /schemas/graph.yaml#/properties/port
141103 description: |
142104 Output endpoint for Mixer 1 mux
143105
144− properties:
145− "#address-cells":
146− const: 1
147−
148− "#size-cells":
149− const: 0
150−
151− reg: true
152−
153− patternProperties:
154− "^endpoint@[0-9]$":
155− type: object
156−
157− properties:
158− reg:
159− description: |
160− ID of the target TCON
161−
162− required:
163− - reg
164−
165− required:
166− - "#address-cells"
167− - "#size-cells"
168−
169− additionalProperties: false
170−
171106 port@4:
172− type: object
107+ $ref: /schemas/graph.yaml#/properties/port
173108 description: |
174109 Input endpoint for HDMI mux.
175110
176− properties:
177− "#address-cells":
178− const: 1
179−
180− "#size-cells":
181− const: 0
182−
183− reg: true
184−
185− patternProperties:
186− "^endpoint@[0-9]$":
187− type: object
188−
189− properties:
190− reg:
191− description: |
192− ID of the target TCON
193−
194− required:
195− - reg
196−
197− required:
198− - "#address-cells"
199− - "#size-cells"
200−
201− additionalProperties: false
202−
203111 port@5:
204− type: object
112+ $ref: /schemas/graph.yaml#/properties/port
205113 description: |
206114 Output endpoint for HDMI mux
207115
208116 required:
209− - "#address-cells"
210− - "#size-cells"
211117 - port@0
212118 - port@1
213119 - port@4
214120 - port@5
215121
216− additionalProperties: false
217−
218122 required:
219123 - "#clock-cells"
220124 - compatible
Documentation/devicetree/bindings/display/allwinner,sun9i-a80-deu.yaml+3−16
@@ -40,36 +40,23 @@ properties: · 39 unmodified lines
4040 maxItems: 1
4141
4242 ports:
43− type: object
44− description: |
45− A ports node with endpoint definitions as defined in
46− Documentation/devicetree/bindings/media/video-interfaces.txt.
43+ $ref: /schemas/graph.yaml#/properties/ports
4744
4845 properties:
49− "#address-cells":
50− const: 1
51−
52− "#size-cells":
53− const: 0
54−
5546 port@0:
56− type: object
47+ $ref: /schemas/graph.yaml#/properties/port
5748 description: |
5849 Input endpoints of the controller.
5950
6051 port@1:
61− type: object
52+ $ref: /schemas/graph.yaml#/properties/port
6253 description: |
6354 Output endpoints of the controller.
6455
6556 required:
66− - "#address-cells"
67− - "#size-cells"
6857 - port@0
6958 - port@1
7059
71− additionalProperties: false
72−
7360 required:
7461 - compatible
7562 - reg
Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml+2−2
@@ -81,12 +81,12 @@ properties: · 80 unmodified lines
8181 description: phandle to an external 5V regulator to power the HDMI logic
8282
8383 port@0:
84− type: object
84+ $ref: /schemas/graph.yaml#/properties/port
8585 description:
8686 A port node pointing to the VENC Input port node.
8787
8888 port@1:
89− type: object
89+ $ref: /schemas/graph.yaml#/properties/port
9090 description:
9191 A port node pointing to the TMDS Output port node.
9292
Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml+2−2
@@ -83,12 +83,12 @@ properties: · 82 unmodified lines
8383 description: phandle to the associated power domain
8484
8585 port@0:
86− type: object
86+ $ref: /schemas/graph.yaml#/properties/port
8787 description:
8888 A port node pointing to the CVBS VDAC port node.
8989
9090 port@1:
91− type: object
91+ $ref: /schemas/graph.yaml#/properties/port
9292 description:
9393 A port node pointing to the HDMI-TX port node.
9494
Documentation/devicetree/bindings/display/brcm,bcm2835-dpi.yaml+3−4
@@ -27,10 +27,9 @@ properties: · 26 unmodified lines
2727 - const: pixel
2828
2929 port:
30− type: object
31− description: >
32− Port node with a single endpoint connecting to the panel, as
33− defined in Documentation/devicetree/bindings/media/video-interfaces.txt.
30+ $ref: /schemas/graph.yaml#/properties/port
31+ description:
32+ Port node with a single endpoint connecting to the panel.
3433
3534 required:
3635 - compatible
Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml+3−3
@@ -35,16 +35,16 @@ properties: · 34 unmodified lines
3535 maxItems: 1
3636
3737 ports:
38− type: object
38+ $ref: /schemas/graph.yaml#/properties/ports
3939
4040 properties:
4141 port@0:
42− type: object
42+ $ref: /schemas/graph.yaml#/properties/port
4343 description:
4444 Video port for MIPI DSI input.
4545
4646 port@1:
47− type: object
47+ $ref: /schemas/graph.yaml#/properties/port
4848 description:
4949 Video port for panel or connector.
5050
Documentation/devicetree/bindings/display/bridge/analogix,anx7814.yaml+3−16
@@ -42,31 +42,18 @@ properties: · 41 unmodified lines
4242 description: Regulator for 1.0V digital core power.
4343
4444 ports:
45− type: object
46− description:
47− A node containing input and output port nodes with endpoint
48− definitions as documented in
49− Documentation/devicetree/bindings/media/video-interfaces.txt
50− Documentation/devicetree/bindings/graph.txt
45+ $ref: /schemas/graph.yaml#/properties/ports
5146
5247 properties:
5348 port@0:
54− type: object
49+ $ref: /schemas/graph.yaml#/properties/port
5550 description: Video port for HDMI input.
5651
57− properties:
58− reg:
59− const: 0
60−
6152 port@1:
62− type: object
53+ $ref: /schemas/graph.yaml#/properties/port
6354 description:
6455 Video port for SlimPort, DisplayPort, eDP or MyDP output.
6556
66− properties:
67− reg:
68− const: 1
69−
7057 required:
7158 - port@0
7259 - port@1
Documentation/devicetree/bindings/display/bridge/anx6345.yaml+5−13
@@ -32,31 +32,23 @@ properties: · 31 unmodified lines
3232 description: Regulator for 2.5V digital core power.
3333
3434 ports:
35− type: object
35+ $ref: /schemas/graph.yaml#/properties/ports
3636
3737 properties:
38− '#address-cells':
39− const: 1
40−
41− '#size-cells':
42− const: 0
43−
4438 port@0:
45− type: object
46− description: |
39+ $ref: /schemas/graph.yaml#/properties/port
40+ description:
4741 Video port for LVTTL input
4842
4943 port@1:
50− type: object
51− description: |
44+ $ref: /schemas/graph.yaml#/properties/port
45+ description:
5246 Video port for eDP output (panel or connector).
5347 May be omitted if EDID works reliably.
5448
5549 required:
5650 - port@0
5751
58− additionalProperties: false
59−
6052 required:
6153 - compatible
6254 - reg
Documentation/devicetree/bindings/display/bridge/cdns,mhdp8546.yaml+6−16
@@ -57,47 +57,37 @@ properties: · 56 unmodified lines
5757 maxItems: 1
5858
5959 ports:
60− type: object
61− description:
62− Ports as described in Documentation/devicetree/bindings/graph.txt.
60+ $ref: /schemas/graph.yaml#/properties/ports
6361
6462 properties:
65− '#address-cells':
66− const: 1
67−
68− '#size-cells':
69− const: 0
70−
7163 port@0:
72− type: object
64+ $ref: /schemas/graph.yaml#/properties/port
7365 description:
7466 First input port representing the DP bridge input.
7567
7668 port@1:
77− type: object
69+ $ref: /schemas/graph.yaml#/properties/port
7870 description:
7971 Second input port representing the DP bridge input.
8072
8173 port@2:
82− type: object
74+ $ref: /schemas/graph.yaml#/properties/port
8375 description:
8476 Third input port representing the DP bridge input.
8577
8678 port@3:
87− type: object
79+ $ref: /schemas/graph.yaml#/properties/port
8880 description:
8981 Fourth input port representing the DP bridge input.
9082
9183 port@4:
92− type: object
84+ $ref: /schemas/graph.yaml#/properties/port
9385 description:
9486 Output port representing the DP bridge output.
9587
9688 required:
9789 - port@0
9890 - port@4
99− - '#address-cells'
100− - '#size-cells'
10191
10292 allOf:
10393 - if:
Documentation/devicetree/bindings/display/bridge/chrontel,ch7033.yaml+3−3
@@ -19,16 +19,16 @@ properties: · 18 unmodified lines
1919 description: I2C address of the device
2020
2121 ports:
22− type: object
22+ $ref: /schemas/graph.yaml#/properties/ports
2323
2424 properties:
2525 port@0:
26− type: object
26+ $ref: /schemas/graph.yaml#/properties/port
2727 description: |
2828 Video port for RGB input.
2929
3030 port@1:
31− type: object
31+ $ref: /schemas/graph.yaml#/properties/port
3232 description: |
3333 DVI port, should be connected to a node compatible with the
3434 dvi-connector binding.
Documentation/devicetree/bindings/display/bridge/intel,keembay-dsi.yaml+3−11
@@ -35,29 +35,21 @@ properties: · 34 unmodified lines
3535 - const: clk_mipi_cfg
3636
3737 ports:
38− type: object
38+ $ref: /schemas/graph.yaml#/properties/ports
3939
4040 properties:
41− '#address-cells':
42− const: 1
43−
44− '#size-cells':
45− const: 0
46−
4741 port@0:
48− type: object
42+ $ref: /schemas/graph.yaml#/properties/port
4943 description: MIPI DSI input port.
5044
5145 port@1:
52− type: object
46+ $ref: /schemas/graph.yaml#/properties/port
5347 description: DSI output port.
5448
5549 required:
5650 - port@0
5751 - port@1
5852
59− additionalProperties: false
60−
6153 required:
6254 - compatible
6355 - reg
Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml+1−1
@@ -53,7 +53,7 @@ properties: · 52 unmodified lines
5353 description: extcon specifier for the Power Delivery
5454
5555 port:
56− type: object
56+ $ref: /schemas/graph.yaml#/properties/port
5757 description: A port node pointing to DPI host port node
5858
5959 required:
Documentation/devicetree/bindings/display/bridge/lontium,lt9611.yaml+7−63
@@ -38,82 +38,26 @@ properties: · 37 unmodified lines
3838 description: Regulator for 3.3V IO power.
3939
4040 ports:
41− type: object
41+ $ref: /schemas/graph.yaml#/properties/ports
4242
4343 properties:
44− "#address-cells":
45− const: 1
46−
47− "#size-cells":
48− const: 0
49−
5044 port@0:
51− type: object
52− description: |
45+ $ref: /schemas/graph.yaml#/properties/port
46+ description:
5347 Primary MIPI port-1 for MIPI input
5448
55− properties:
56− reg:
57− const: 0
58−
59− patternProperties:
60− "^endpoint(@[0-9])$":
61− type: object
62− additionalProperties: false
63−
64− properties:
65− remote-endpoint:
66− $ref: /schemas/types.yaml#/definitions/phandle
67−
68− required:
69− - reg
70−
7149 port@1:
72− type: object
73− description: |
50+ $ref: /schemas/graph.yaml#/properties/port
51+ description:
7452 Additional MIPI port-2 for MIPI input, used in combination
7553 with primary MIPI port-1 to drive higher resolution displays
7654
77− properties:
78− reg:
79− const: 1
80−
81− patternProperties:
82− "^endpoint(@[0-9])$":
83− type: object
84− additionalProperties: false
85−
86− properties:
87− remote-endpoint:
88− $ref: /schemas/types.yaml#/definitions/phandle
89−
90− required:
91− - reg
92−
9355 port@2:
94− type: object
95− description: |
56+ $ref: /schemas/graph.yaml#/properties/port
57+ description:
9658 HDMI port for HDMI output
9759
98− properties:
99− reg:
100− const: 2
101−
102− patternProperties:
103− "^endpoint(@[0-9])$":
104− type: object
105− additionalProperties: false
106−
107− properties:
108− remote-endpoint:
109− $ref: /schemas/types.yaml#/definitions/phandle
110−
111− required:
112− - reg
113−
11460 required:
115− - "#address-cells"
116− - "#size-cells"
11761 - port@0
11862 - port@2
11963
Documentation/devicetree/bindings/display/bridge/lvds-codec.yaml+4−14
@@ -45,25 +45,17 @@ properties: · 44 unmodified lines
4545 - thine,thc63lvdm83d # For the THC63LVDM83D LVDS serializer
4646
4747 ports:
48− type: object
49− description: |
50− This device has two video ports. Their connections are modeled using the
51− OF graph bindings specified in Documentation/devicetree/bindings/graph.txt
52− properties:
53− '#address-cells':
54− const: 1
55−
56− '#size-cells':
57− const: 0
48+ $ref: /schemas/graph.yaml#/properties/ports
5849
50+ properties:
5951 port@0:
60− type: object
52+ $ref: /schemas/graph.yaml#/properties/port
6153 description: |
6254 For LVDS encoders, port 0 is the parallel input
6355 For LVDS decoders, port 0 is the LVDS input
6456
6557 port@1:
66− type: object
58+ $ref: /schemas/graph.yaml#/properties/port
6759 description: |
6860 For LVDS encoders, port 1 is the LVDS output
6961 For LVDS decoders, port 1 is the parallel output
@@ -72,8 +64,6 @@ properties: · 2 unmodified lines
7264 - port@0
7365 - port@1
7466
75− additionalProperties: false
76−
7767 powerdown-gpios:
7868 description:
7969 The GPIO used to control the power down line of this device.
Documentation/devicetree/bindings/display/bridge/nwl-dsi.yaml+7−34
@@ -84,40 +84,23 @@ properties: · 83 unmodified lines
8484 - const: pclk
8585
8686 ports:
87− type: object
88− description:
89− A node containing DSI input & output port nodes with endpoint
90− definitions as documented in
91− Documentation/devicetree/bindings/graph.txt.
87+ $ref: /schemas/graph.yaml#/properties/ports
88+
9289 properties:
9390 port@0:
94− type: object
91+ $ref: /schemas/graph.yaml#/$defs/port-base
9592 description:
9693 Input port node to receive pixel data from the
9794 display controller. Exactly one endpoint must be
9895 specified.
9996 properties:
100− '#address-cells':
101− const: 1
102−
103− '#size-cells':
104− const: 0
105−
10697 endpoint@0:
98+ $ref: /schemas/graph.yaml#/properties/endpoint
10799 description: sub-node describing the input from LCDIF
108− type: object
109100
110101 endpoint@1:
102+ $ref: /schemas/graph.yaml#/properties/endpoint
111103 description: sub-node describing the input from DCSS
112− type: object
113−
114− reg:
115− const: 0
116−
117− required:
118− - '#address-cells'
119− - '#size-cells'
120− - reg
121104
122105 oneOf:
123106 - required:
@@ -125,28 +108,18 @@ properties: · 1 unmodified line
125108 - required:
126109 - endpoint@1
127110
128− additionalProperties: false
111+ unevaluatedProperties: false
129112
130113 port@1:
131− type: object
114+ $ref: /schemas/graph.yaml#/properties/port
132115 description:
133116 DSI output port node to the panel or the next bridge
134117 in the chain
135118
136− '#address-cells':
137− const: 1
138−
139− '#size-cells':
140− const: 0
141−
142119 required:
143− - '#address-cells'
144− - '#size-cells'
145120 - port@0
146121 - port@1
147122
148− additionalProperties: false
149−
150123 required:
151124 - '#address-cells'
152125 - '#size-cells'
Documentation/devicetree/bindings/display/bridge/ps8640.yaml+6−18
@@ -41,34 +41,22 @@ properties: · 40 unmodified lines
4141 description: Regulator for 3.3V digital core power.
4242
4343 ports:
44− type: object
45− description:
46− A node containing DSI input & output port nodes with endpoint
47− definitions as documented in
48− Documentation/devicetree/bindings/media/video-interfaces.txt
49− Documentation/devicetree/bindings/graph.txt
50− properties:
51− '#address-cells':
52− const: 1
53−
54− '#size-cells':
55− const: 0
44+ $ref: /schemas/graph.yaml#/properties/ports
5645
46+ properties:
5747 port@0:
58− type: object
59− description: |
48+ $ref: /schemas/graph.yaml#/properties/port
49+ description:
6050 Video port for DSI input
6151
6252 port@1:
63− type: object
64− description: |
53+ $ref: /schemas/graph.yaml#/properties/port
54+ description:
6555 Video port for eDP output (panel or connector).
6656
6757 required:
6858 - port@0
6959
70− additionalProperties: false
71−
7260 required:
7361 - compatible
7462 - reg
Documentation/devicetree/bindings/display/bridge/renesas,lvds.yaml+3−15
@@ -49,33 +49,21 @@ properties: · 48 unmodified lines
4949 maxItems: 1
5050
5151 ports:
52− type: object
53− description: |
54− This device has two video ports. Their connections are modelled using the
55− OF graph bindings specified in Documentation/devicetree/bindings/graph.txt.
56− Each port shall have a single endpoint.
52+ $ref: /schemas/graph.yaml#/properties/ports
5753
5854 properties:
59− '#address-cells':
60− const: 1
61−
62− '#size-cells':
63− const: 0
64−
6555 port@0:
66− type: object
56+ $ref: /schemas/graph.yaml#/properties/port
6757 description: Parallel RGB input port
6858
6959 port@1:
70− type: object
60+ $ref: /schemas/graph.yaml#/properties/port
7161 description: LVDS output port
7262
7363 required:
7464 - port@0
7565 - port@1
7666
77− additionalProperties: false
78−
7967 power-domains:
8068 maxItems: 1
8169
Documentation/devicetree/bindings/display/bridge/simple-bridge.yaml+4−14
@@ -30,31 +30,21 @@ properties: · 29 unmodified lines
3030 - ti,ths8135
3131
3232 ports:
33− type: object
34− description: |
35− This device has two video ports. Their connections are modeled using the
36− OF graph bindings specified in Documentation/devicetree/bindings/graph.txt.
37− properties:
38− '#address-cells':
39− const: 1
40−
41− '#size-cells':
42− const: 0
33+ $ref: /schemas/graph.yaml#/properties/ports
4334
35+ properties:
4436 port@0:
45− type: object
37+ $ref: /schemas/graph.yaml#/properties/port
4638 description: The bridge input
4739
4840 port@1:
49− type: object
41+ $ref: /schemas/graph.yaml#/properties/port
5042 description: The bridge output
5143
5244 required:
5345 - port@0
5446 - port@1
5547
56− additionalProperties: false
57−
5848 enable-gpios:
5949 maxItems: 1
6050 description: GPIO controlling bridge enable
Documentation/devicetree/bindings/display/bridge/snps,dw-mipi-dsi.yaml+4−3
@@ -47,14 +47,15 @@ properties: · 46 unmodified lines
4747 const: apb
4848
4949 ports:
50− type: object
50+ $ref: /schemas/graph.yaml#/properties/ports
5151
5252 properties:
5353 port@0:
54− type: object
54+ $ref: /schemas/graph.yaml#/properties/port
5555 description: Input node to receive pixel data.
56+
5657 port@1:
57− type: object
58+ $ref: /schemas/graph.yaml#/properties/port
5859 description: DSI output node to panel.
5960
6061 required:
Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.yaml+5−16
@@ -25,11 +25,8 @@ properties: · 24 unmodified lines
2525 const: thine,thc63lvd1024
2626
2727 ports:
28− type: object
28+ $ref: /schemas/graph.yaml#/properties/ports
2929 description: |
30− This device has four video ports. Their connections are modeled using the
31− OF graph bindings specified in Documentation/devicetree/bindings/graph.txt.
32−
3330 The device can operate in single or dual input and output modes.
3431
3532 When operating in single input mode, all pixels are received on port@0,
@@ -43,34 +40,26 @@ properties: · 7 unmodified lines
4340 port@3 shall contain endpoints.
4441
4542 properties:
46− '#address-cells':
47− const: 1
48−
49− '#size-cells':
50− const: 0
51−
5243 port@0:
53− type: object
44+ $ref: /schemas/graph.yaml#/properties/port
5445 description: First LVDS input port
5546
5647 port@1:
57− type: object
48+ $ref: /schemas/graph.yaml#/properties/port
5849 description: Second LVDS input port
5950
6051 port@2:
61− type: object
52+ $ref: /schemas/graph.yaml#/properties/port
6253 description: First digital CMOS/TTL parallel output
6354
6455 port@3:
65− type: object
56+ $ref: /schemas/graph.yaml#/properties/port
6657 description: Second digital CMOS/TTL parallel output
6758
6859 required:
6960 - port@0
7061 - port@2
7162
72− additionalProperties: false
73−
7463 oe-gpios:
7564 maxItems: 1
7665 description: Output enable GPIO signal, pin name "OE", active high.
Documentation/devicetree/bindings/display/bridge/ti,sn65dsi86.yaml+6−39
@@ -71,54 +71,26 @@ properties: · 70 unmodified lines
7171 description: See ../../pwm/pwm.yaml for description of the cell formats.
7272
7373 ports:
74− type: object
75− additionalProperties: false
74+ $ref: /schemas/graph.yaml#/properties/ports
7675
7776 properties:
78− "#address-cells":
79− const: 1
80−
81− "#size-cells":
82− const: 0
83−
8477 port@0:
85− type: object
86− additionalProperties: false
87−
78+ $ref: /schemas/graph.yaml#/properties/port
8879 description:
8980 Video port for MIPI DSI input
9081
91− properties:
92− reg:
93− const: 0
94−
95− endpoint:
96− type: object
97− additionalProperties: false
98− properties:
99− remote-endpoint: true
100−
101− required:
102− - reg
103−
10482 port@1:
105− type: object
106− additionalProperties: false
107−
83+ $ref: /schemas/graph.yaml#/$defs/port-base
84+ unevaluatedProperties: false
10885 description:
10986 Video port for eDP output (panel or connector).
11087
11188 properties:
112− reg:
113− const: 1
114−
11589 endpoint:
116− type: object
117− additionalProperties: false
90+ $ref: /schemas/graph.yaml#/$defs/endpoint-base
91+ unevaluatedProperties: false
11892
11993 properties:
120− remote-endpoint: true
121−
12294 data-lanes:
12395 oneOf:
12496 - minItems: 1
@@ -171,12 +143,7 @@ properties: · 46 unmodified lines
171143 dependencies:
172144 lane-polarities: [data-lanes]
173145
174− required:
175− - reg
176−
177146 required:
178− - "#address-cells"
179− - "#size-cells"
180147 - port@0
181148 - port@1
182149
Documentation/devicetree/bindings/display/bridge/ti,tfp410.yaml+6−18
@@ -31,23 +31,18 @@ properties: · 30 unmodified lines
3131 maximum: 7
3232
3333 ports:
34− description:
35− A node containing input and output port nodes with endpoint
36− definitions as documented in
37− Documentation/devicetree/bindings/media/video-interfaces.txt
38− type: object
34+ $ref: /schemas/graph.yaml#/properties/ports
3935
4036 properties:
4137 port@0:
38+ $ref: /schemas/graph.yaml#/$defs/port-base
39+ unevaluatedProperties: false
4240 description: DPI input port.
43− type: object
4441
4542 properties:
46− reg:
47− const: 0
48−
4943 endpoint:
50− type: object
44+ $ref: /schemas/graph.yaml#/$defs/endpoint-base
45+ unevaluatedProperties: false
5146
5247 properties:
5348 pclk-sample:
@@ -67,15 +62,8 @@ properties: · 13 unmodified lines
6762 default: 24
6863
6964 port@1:
65+ $ref: /schemas/graph.yaml#/properties/port
7066 description: DVI output port.
71− type: object
72−
73− properties:
74− reg:
75− const: 1
76−
77− endpoint:
78− type: object
7967
8068 required:
8169 - port@0
Documentation/devicetree/bindings/display/bridge/toshiba,tc358762.yaml+5−47
@@ -25,62 +25,20 @@ properties: · 24 unmodified lines
2525 description: Regulator for 1.2V internal core power.
2626
2727 ports:
28− type: object
28+ $ref: /schemas/graph.yaml#/properties/ports
2929
3030 properties:
31− "#address-cells":
32− const: 1
33−
34− "#size-cells":
35− const: 0
36−
3731 port@0:
38− type: object
39− additionalProperties: false
40−
41− description: |
32+ $ref: /schemas/graph.yaml#/properties/port
33+ description:
4234 Video port for MIPI DSI input
4335
44− properties:
45− reg:
46− const: 0
47−
48− patternProperties:
49− endpoint:
50− type: object
51− additionalProperties: false
52−
53− properties:
54− remote-endpoint: true
55−
56− required:
57− - reg
58−
5936 port@1:
60− type: object
61− additionalProperties: false
62−
63− description: |
37+ $ref: /schemas/graph.yaml#/properties/port
38+ description:
6439 Video port for MIPI DPI output (panel or connector).
6540
66− properties:
67− reg:
68− const: 1
69−
70− patternProperties:
71− endpoint:
72− type: object
73− additionalProperties: false
74−
75− properties:
76− remote-endpoint: true
77−
78− required:
79− - reg
80−
8141 required:
82− - "#address-cells"
83− - "#size-cells"
8442 - port@0
8543 - port@1
8644
Documentation/devicetree/bindings/display/bridge/toshiba,tc358768.yaml+6−42
@@ -42,65 +42,30 @@ properties: · 41 unmodified lines
4242 const: refclk
4343
4444 ports:
45− type: object
45+ $ref: /schemas/graph.yaml#/properties/ports
4646
4747 properties:
48− "#address-cells":
49− const: 1
50−
51− "#size-cells":
52− const: 0
53−
5448 port@0:
55− type: object
56− additionalProperties: false
57−
49+ $ref: /schemas/graph.yaml#/$defs/port-base
50+ unevaluatedProperties: false
5851 description: |
5952 Video port for RGB input
6053
6154 properties:
62− reg:
63− const: 0
64−
65− patternProperties:
6655 endpoint:
67− type: object
68− additionalProperties: false
56+ $ref: /schemas/graph.yaml#/$defs/endpoint-base
57+ unevaluatedProperties: false
6958
7059 properties:
7160 data-lines:
7261 enum: [ 16, 18, 24 ]
7362
74− remote-endpoint: true
75−
76− required:
77− - reg
78−
7963 port@1:
80− type: object
81− additionalProperties: false
82−
64+ $ref: /schemas/graph.yaml#/properties/port
8365 description: |
8466 Video port for DSI output (panel or connector).
8567
86− properties:
87− reg:
88− const: 1
89−
90− patternProperties:
91− endpoint:
92− type: object
93− additionalProperties: false
94−
95− properties:
96− remote-endpoint: true
97−
98− required:
99− - reg
100−
10168 required:
102− - "#address-cells"
103− - "#size-cells"
10469 - port@0
10570 - port@1
10671
@@ -156,4 +121,3 @@ examples: · 49 unmodified lines
156121 };
157122 };
158123 };
159−
Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml+5−14
@@ -42,31 +42,22 @@ properties: · 41 unmodified lines
4242 description: Hardware reset, Low active
4343
4444 ports:
45− type: object
46− description:
47− A node containing input and output port nodes with endpoint definitions
48− as documented in
49− Documentation/devicetree/bindings/media/video-interfaces.txt
50− properties:
51− "#address-cells":
52− const: 1
53−
54− "#size-cells":
55− const: 0
45+ $ref: /schemas/graph.yaml#/properties/ports
5646
47+ properties:
5748 port@0:
58− type: object
49+ $ref: /schemas/graph.yaml#/properties/port
5950 description: |
6051 DSI Input. The remote endpoint phandle should be a
6152 reference to a valid mipi_dsi_host device node.
6253
6354 port@1:
64− type: object
55+ $ref: /schemas/graph.yaml#/properties/port
6556 description: |
6657 Video port for LVDS output (panel or connector).
6758
6859 port@2:
69− type: object
60+ $ref: /schemas/graph.yaml#/properties/port
7061 description: |
7162 Video port for Dual link LVDS output (panel or connector).
7263
Documentation/devicetree/bindings/display/connector/analog-tv-connector.yaml+1−0
@@ -25,6 +25,7 @@ properties: · 24 unmodified lines
2525 $ref: /schemas/types.yaml#/definitions/uint32
2626
2727 port:
28+ $ref: /schemas/graph.yaml#/properties/port
2829 description: Connection to controller providing analog TV signals
2930
3031 required:
Documentation/devicetree/bindings/display/connector/dvi-connector.yaml+1−0
@@ -36,6 +36,7 @@ properties: · 35 unmodified lines
3636 description: the connector has pins for DVI dual-link
3737
3838 port:
39+ $ref: /schemas/graph.yaml#/properties/port
3940 description: Connection to controller providing DVI signals
4041
4142 required:
Documentation/devicetree/bindings/display/connector/hdmi-connector.yaml+1−0
@@ -37,6 +37,7 @@ properties: · 36 unmodified lines
3737 maxItems: 1
3838
3939 port:
40+ $ref: /schemas/graph.yaml#/properties/port
4041 description: Connection to controller providing HDMI signals
4142
4243 required:
Documentation/devicetree/bindings/display/connector/vga-connector.yaml+1−0
@@ -20,6 +20,7 @@ properties: · 19 unmodified lines
2020 $ref: /schemas/types.yaml#/definitions/phandle
2121
2222 port:
23+ $ref: /schemas/graph.yaml#/properties/port
2324 description: Connection to controller providing VGA signals
2425
2526 required:
Documentation/devicetree/bindings/display/imx/nxp,imx8mq-dcss.yaml+1−1
@@ -74,7 +74,7 @@ properties: · 73 unmodified lines
7474 - description: Must be 400 MHz
7575
7676 port:
77− type: object
77+ $ref: /schemas/graph.yaml#/properties/port
7878 description:
7979 A port node pointing to the input port of a HDMI/DP or MIPI display bridge.
8080
Documentation/devicetree/bindings/display/ingenic,ipu.yaml+2−3
@@ -31,9 +31,8 @@ properties: · 30 unmodified lines
3131 clock-names:
3232 const: ipu
3333
34−patternProperties:
35− "^ports?$":
36− description: OF graph bindings (specified in bindings/graph.txt).
34+ port:
35+ $ref: /schemas/graph.yaml#/properties/port
3736
3837 required:
3938 - compatible
Documentation/devicetree/bindings/display/ingenic,lcd.yaml+5−5
@@ -39,18 +39,18 @@ properties: · 38 unmodified lines
3939 minItems: 1
4040
4141 port:
42− description: OF graph bindings (specified in bindings/graph.txt).
42+ $ref: /schemas/graph.yaml#/properties/port
4343
4444 ports:
45− description: OF graph bindings (specified in bindings/graph.txt).
46− type: object
45+ $ref: /schemas/graph.yaml#/properties/ports
46+
4747 properties:
4848 port@0:
49− type: object
49+ $ref: /schemas/graph.yaml#/properties/port
5050 description: DPI output, to interface with TFT panels.
5151
5252 port@8:
53− type: object
53+ $ref: /schemas/graph.yaml#/properties/port
5454 description: Link to the Image Processing Unit (IPU).
5555 (See ingenic,ipu.yaml).
5656
Documentation/devicetree/bindings/display/intel,keembay-display.yaml+1−1
@@ -36,7 +36,7 @@ properties: · 35 unmodified lines
3636 maxItems: 1
3737
3838 port:
39− type: object
39+ $ref: /schemas/graph.yaml#/properties/port
4040 description: Display output node to DSI.
4141
4242 required:
Documentation/devicetree/bindings/display/panel/advantech,idk-2121wr.yaml+10−11
@@ -37,34 +37,33 @@ properties: · 36 unmodified lines
3737 panel-timing: true
3838
3939 ports:
40− type: object
40+ $ref: /schemas/graph.yaml#/properties/ports
41+
4142 properties:
4243 port@0:
43− type: object
44+ $ref: /schemas/graph.yaml#/$defs/port-base
45+ unevaluatedProperties: false
4446 description: The sink for odd pixels.
4547 properties:
46− reg:
47− const: 0
48−
4948 dual-lvds-odd-pixels: true
5049
5150 required:
52− - reg
5351 - dual-lvds-odd-pixels
5452
5553 port@1:
56− type: object
54+ $ref: /schemas/graph.yaml#/$defs/port-base
55+ unevaluatedProperties: false
5756 description: The sink for even pixels.
5857 properties:
59− reg:
60− const: 1
61−
6258 dual-lvds-even-pixels: true
6359
6460 required:
65− - reg
6661 - dual-lvds-even-pixels
6762
63+ required:
64+ - port@0
65+ - port@1
66+
6867 additionalProperties: false
6968
7069 required:
Documentation/devicetree/bindings/display/panel/panel-common.yaml+1−10
@@ -68,16 +68,7 @@ properties: · 67 unmodified lines
6868
6969 # Connectivity
7070 port:
71− type: object
72−
73− ports:
74− type: object
75− description:
76− Panels receive video data through one or multiple connections. While
77− the nature of those connections is specific to the panel type, the
78− connectivity is expressed in a standard fashion using ports as specified
79− in the device graph bindings defined in
80− Documentation/devicetree/bindings/graph.txt.
71+ $ref: /schemas/graph.yaml#/properties/port
8172
8273 ddc-i2c-bus:
8374 $ref: /schemas/types.yaml#/definitions/phandle
Documentation/devicetree/bindings/display/panel/samsung,s6e63m0.yaml+3−1
@@ -11,6 +11,7 @@ maintainers: · 10 unmodified lines
1111
1212 allOf:
1313 - $ref: panel-common.yaml#
14+ - $ref: /schemas/leds/backlight/common.yaml#
1415
1516 properties:
1617 compatible:
@@ -19,6 +20,8 @@ properties: · 2 unmodified lines
1920 reg: true
2021 reset-gpios: true
2122 port: true
23+ default-brightness: true
24+ max-brightness: true
2225
2326 vdd3-supply:
2427 description: VDD regulator
@@ -31,7 +34,6 @@ required: · 6 unmodified lines
3134 - reset-gpios
3235 - vdd3-supply
3336 - vci-supply
34− - port
3537
3638 unevaluatedProperties: false
3739
Documentation/devicetree/bindings/display/rockchip/rockchip,rk3066-hdmi.yaml+3−13
@@ -43,34 +43,24 @@ properties: · 42 unmodified lines
4343 This soc uses GRF regs to switch the HDMI TX input between vop0 and vop1.
4444
4545 ports:
46− type: object
46+ $ref: /schemas/graph.yaml#/properties/ports
4747
4848 properties:
49− "#address-cells":
50− const: 1
51−
52− "#size-cells":
53− const: 0
54−
5549 port@0:
56− type: object
50+ $ref: /schemas/graph.yaml#/properties/port
5751 description:
5852 Port node with two endpoints, numbered 0 and 1,
5953 connected respectively to vop0 and vop1.
6054
6155 port@1:
62− type: object
56+ $ref: /schemas/graph.yaml#/properties/port
6357 description:
6458 Port node with one endpoint connected to a hdmi-connector node.
6559
6660 required:
67− - "#address-cells"
68− - "#size-cells"
6961 - port@0
7062 - port@1
7163
72− additionalProperties: false
73−
7464 required:
7565 - compatible
7666 - reg
Documentation/devicetree/bindings/display/rockchip/rockchip-vop.yaml+1−4
@@ -70,10 +70,7 @@ properties: · 69 unmodified lines
7070 - const: dclk
7171
7272 port:
73− type: object
74− description:
75− A port node with endpoint definitions as defined in
76− Documentation/devicetree/bindings/media/video-interfaces.txt.
73+ $ref: /schemas/graph.yaml#/properties/port
7774
7875 assigned-clocks:
7976 maxItems: 2
Documentation/devicetree/bindings/display/st,stm32-dsi.yaml+4−8
@@ -51,20 +51,16 @@ properties: · 50 unmodified lines
5151 Phandle of the regulator that provides the supply voltage.
5252
5353 ports:
54− type: object
55− description:
56− A node containing DSI input & output port nodes with endpoint
57− definitions as documented in
58− Documentation/devicetree/bindings/media/video-interfaces.txt
59− Documentation/devicetree/bindings/graph.txt
54+ $ref: /schemas/graph.yaml#/properties/ports
55+
6056 properties:
6157 port@0:
62− type: object
58+ $ref: /schemas/graph.yaml#/properties/port
6359 description:
6460 DSI input port node, connected to the ltdc rgb output port.
6561
6662 port@1:
67− type: object
63+ $ref: /schemas/graph.yaml#/properties/port
6864 description:
6965 DSI output port node, connected to a panel or a bridge input port"
7066
Documentation/devicetree/bindings/display/st,stm32-ltdc.yaml+3−5
@@ -35,15 +35,13 @@ properties: · 34 unmodified lines
3535 maxItems: 1
3636
3737 port:
38− type: object
39− description:
40− "Video port for DPI RGB output.
38+ $ref: /schemas/graph.yaml#/properties/port
39+ description: |
40+ Video port for DPI RGB output.
4141 ltdc has one video port with up to 2 endpoints:
4242 - for external dpi rgb panel or bridge, using gpios.
4343 - for internal dpi input of the MIPI DSI host controller.
4444 Note: These 2 endpoints cannot be activated simultaneously.
45− Please refer to the bindings defined in
46− Documentation/devicetree/bindings/media/video-interfaces.txt."
4745
4846 required:
4947 - compatible
Documentation/devicetree/bindings/display/ste,mcde.yaml+2−3
@@ -42,10 +42,9 @@ properties: · 41 unmodified lines
4242 description: a phandle to the analog voltage regulator
4343
4444 port:
45− type: object
45+ $ref: /schemas/graph.yaml#/properties/port
4646 description:
47− A DPI port node with endpoint definitions as defined in
48− Documentation/devicetree/bindings/media/video-interfaces.txt
47+ A DPI port node
4948
5049 "#address-cells":
5150 const: 1
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml+4−15
@@ -74,30 +74,19 @@ properties: · 73 unmodified lines
7474 type: boolean
7575
7676 ports:
77− type: object
78− description:
79− Ports as described in Documentation/devicetree/bindings/graph.txt
80− properties:
81− "#address-cells":
82− const: 1
83−
84− "#size-cells":
85− const: 0
77+ $ref: /schemas/graph.yaml#/properties/ports
8678
79+ properties:
8780 port@0:
88− type: object
81+ $ref: /schemas/graph.yaml#/properties/port
8982 description:
9083 The DSS OLDI output port node form video port 1
9184
9285 port@1:
93− type: object
86+ $ref: /schemas/graph.yaml#/properties/port
9487 description:
9588 The DSS DPI output port node from video port 2
9689
97− required:
98− - "#address-cells"
99− - "#size-cells"
100−
10190 ti,am65x-oldi-io-ctrl:
10291 $ref: "/schemas/types.yaml#/definitions/phandle-array"
10392 maxItems: 1
Documentation/devicetree/bindings/display/ti/ti,j721e-dss.yaml+6−17
@@ -107,40 +107,29 @@ properties: · 106 unmodified lines
107107 type: boolean
108108
109109 ports:
110− type: object
111− description:
112− Ports as described in Documentation/devicetree/bindings/graph.txt
113− properties:
114− "#address-cells":
115− const: 1
116−
117− "#size-cells":
118− const: 0
110+ $ref: /schemas/graph.yaml#/properties/ports
119111
112+ properties:
120113 port@0:
121− type: object
114+ $ref: /schemas/graph.yaml#/properties/port
122115 description:
123116 The output port node form video port 1
124117
125118 port@1:
126− type: object
119+ $ref: /schemas/graph.yaml#/properties/port
127120 description:
128121 The output port node from video port 2
129122
130123 port@2:
131− type: object
124+ $ref: /schemas/graph.yaml#/properties/port
132125 description:
133126 The output port node from video port 3
134127
135128 port@3:
136− type: object
129+ $ref: /schemas/graph.yaml#/properties/port
137130 description:
138131 The output port node from video port 4
139132
140− required:
141− - "#address-cells"
142− - "#size-cells"
143−
144133 max-memory-bandwidth:
145134 $ref: /schemas/types.yaml#/definitions/uint32
146135 description:
Documentation/devicetree/bindings/display/ti/ti,k2g-dss.yaml+1−2
@@ -54,9 +54,8 @@ properties: · 53 unmodified lines
5454 description: phandle to the associated power domain
5555
5656 port:
57− type: object
57+ $ref: /schemas/graph.yaml#/properties/port
5858 description:
59− Port as described in Documentation/devicetree/bindings/graph.txt.
6059 The DSS DPI output port node
6160
6261 max-memory-bandwidth:
Documentation/gpu/vkms.rst+12−0
@@ -35,6 +35,18 @@ Now, to load the driver, use:: · 34 unmodified lines
3535 On running the lsmod command now, the VKMS driver will appear listed.
3636 You can also observe the driver being loaded in the dmesg logs.
3737
38+The VKMS driver has optional features to simulate different kinds of hardware,
39+which are exposed as module options. You can use the `modinfo` command
40+to see the module options for vkms::
41+
42+ modinfo vkms
43+
44+Module options are helpful when testing, and enabling modules
45+can be done while loading vkms. For example, to load vkms with cursor enabled,
46+use::
47+
48+ sudo modprobe vkms enable_cursor=1
49+
3850 To disable the driver, use ::
3951
4052 sudo modprobe -r vkms
MAINTAINERS+1−0
@@ -5784,6 +5784,7 @@ F: drivers/gpu/drm/vboxvideo/ · 5783 unmodified lines
57845784 DRM DRIVER FOR VMWARE VIRTUAL GPU
57855785 M: "VMware Graphics" <linux-graphics-maintainer@vmware.com>
57865786 M: Roland Scheidegger <sroland@vmware.com>
5787+M: Zack Rusin <zackr@vmware.com>
57875788 L: dri-devel@lists.freedesktop.org
57885789 S: Supported
57895790 T: git git://people.freedesktop.org/~sroland/linux
drivers/dma-buf/Kconfig+8−0
@@ -50,6 +50,14 @@ config DMABUF_MOVE_NOTIFY · 49 unmodified lines
5050 This is marked experimental because we don't yet have a consistent
5151 execution context and memory management between drivers.
5252
53+config DMABUF_DEBUG
54+ bool "DMA-BUF debug checks"
55+ default y if DMA_API_DEBUG
56+ help
57+ This option enables additional checks for DMA-BUF importers and
58+ exporters. Specifically it validates that importers do not peek at the
59+ underlying struct page when they import a buffer.
60+
5361 config DMABUF_SELFTESTS
5462 tristate "Selftests for the dma-buf interfaces"
5563 default n
drivers/dma-buf/dma-buf.c+42−4
@@ -653,6 +653,34 @@ void dma_buf_put(struct dma_buf *dmabuf) · 652 unmodified lines
653653 }
654654 EXPORT_SYMBOL_GPL(dma_buf_put);
655655
656+static void mangle_sg_table(struct sg_table *sg_table)
657+{
658+#ifdef CONFIG_DMABUF_DEBUG
659+ int i;
660+ struct scatterlist *sg;
661+
662+ /* To catch abuse of the underlying struct page by importers mix
663+ * up the bits, but take care to preserve the low SG_ bits to
664+ * not corrupt the sgt. The mixing is undone in __unmap_dma_buf
665+ * before passing the sgt back to the exporter. */
666+ for_each_sgtable_sg(sg_table, sg, i)
667+ sg->page_link ^= ~0xffUL;
668+#endif
669+
670+}
671+static struct sg_table * __map_dma_buf(struct dma_buf_attachment *attach,
672+ enum dma_data_direction direction)
673+{
674+ struct sg_table *sg_table;
675+
676+ sg_table = attach->dmabuf->ops->map_dma_buf(attach, direction);
677+
678+ if (!IS_ERR_OR_NULL(sg_table))
679+ mangle_sg_table(sg_table);
680+
681+ return sg_table;
682+}
683+
656684 /**
657685 * dma_buf_dynamic_attach - Add the device to dma_buf's attachments list
658686 * @dmabuf: [in] buffer to attach device to.
@@ -724,7 +752,7 @@ dma_buf_dynamic_attach(struct dma_buf *dmabuf, struct device *dev, · 65 unmodified lines
724752 goto err_unlock;
725753 }
726754
727− sgt = dmabuf->ops->map_dma_buf(attach, DMA_BIDIRECTIONAL);
755+ sgt = __map_dma_buf(attach, DMA_BIDIRECTIONAL);
728756 if (!sgt)
729757 sgt = ERR_PTR(-ENOMEM);
730758 if (IS_ERR(sgt)) {
@@ -771,6 +799,16 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, · 40 unmodified lines
771799 }
772800 EXPORT_SYMBOL_GPL(dma_buf_attach);
773801
802+static void __unmap_dma_buf(struct dma_buf_attachment *attach,
803+ struct sg_table *sg_table,
804+ enum dma_data_direction direction)
805+{
806+ /* uses XOR, hence this unmangles */
807+ mangle_sg_table(sg_table);
808+
809+ attach->dmabuf->ops->unmap_dma_buf(attach, sg_table, direction);
810+}
811+
774812 /**
775813 * dma_buf_detach - Remove the given attachment from dmabuf's attachments list
776814 * @dmabuf: [in] buffer to detach from.
@@ -789,7 +827,7 @@ void dma_buf_detach(struct dma_buf *dmabuf, struct dma_buf_attachment *attach) · 12 unmodified lines
789827 if (dma_buf_is_dynamic(attach->dmabuf))
790828 dma_resv_lock(attach->dmabuf->resv, NULL);
791829
792− dmabuf->ops->unmap_dma_buf(attach, attach->sgt, attach->dir);
830+ __unmap_dma_buf(attach, attach->sgt, attach->dir);
793831
794832 if (dma_buf_is_dynamic(attach->dmabuf)) {
795833 dma_buf_unpin(attach);
@@ -911,7 +949,7 @@ struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach, · 115 unmodified lines
911949 }
912950 }
913951
914− sg_table = attach->dmabuf->ops->map_dma_buf(attach, direction);
952+ sg_table = __map_dma_buf(attach, direction);
915953 if (!sg_table)
916954 sg_table = ERR_PTR(-ENOMEM);
917955
@@ -974,7 +1012,7 @@ void dma_buf_unmap_attachment(struct dma_buf_attachment *attach, · 56 unmodified lines
9741012 if (dma_buf_is_dynamic(attach->dmabuf))
9751013 dma_resv_assert_held(attach->dmabuf->resv);
9761014
977− attach->dmabuf->ops->unmap_dma_buf(attach, sg_table, direction);
1015+ __unmap_dma_buf(attach, sg_table, direction);
9781016
9791017 if (dma_buf_is_dynamic(attach->dmabuf) &&
9801018 !IS_ENABLED(CONFIG_DMABUF_MOVE_NOTIFY))
drivers/gpu/drm/Kconfig+0−5
@@ -214,10 +214,6 @@ config DRM_GEM_SHMEM_HELPER · 213 unmodified lines
214214 help
215215 Choose this if you need the GEM shmem helper functions
216216
217−config DRM_VM
218− bool
219− depends on DRM && MMU
220−
221217 config DRM_SCHED
222218 tristate
223219 depends on DRM
@@ -391,7 +387,6 @@ source "drivers/gpu/drm/xlnx/Kconfig" · 167 unmodified lines
391387 menuconfig DRM_LEGACY
392388 bool "Enable legacy drivers (DANGEROUS)"
393389 depends on DRM && MMU
394− select DRM_VM
395390 help
396391 Enable legacy DRI1 drivers. Those drivers expose unsafe and dangerous
397392 APIs to user-space, which can be used to circumvent access
drivers/gpu/drm/Makefile+3−3
@@ -5,7 +5,7 @@ · 4 unmodified lines
55
66 drm-y := drm_auth.o drm_cache.o \
77 drm_file.o drm_gem.o drm_ioctl.o drm_irq.o \
8− drm_memory.o drm_drv.o \
8+ drm_drv.o \
99 drm_sysfs.o drm_hashtab.o drm_mm.o \
1010 drm_crtc.o drm_fourcc.o drm_modes.o drm_edid.o \
1111 drm_encoder_slave.o \
@@ -20,9 +20,9 @@ drm-y := drm_auth.o drm_cache.o \ · 8 unmodified lines
2020 drm_client_modeset.o drm_atomic_uapi.o drm_hdcp.o \
2121 drm_managed.o drm_vblank_work.o
2222
23−drm-$(CONFIG_DRM_LEGACY) += drm_legacy_misc.o drm_bufs.o drm_context.o drm_dma.o drm_scatter.o drm_lock.o
23+drm-$(CONFIG_DRM_LEGACY) += drm_bufs.o drm_context.o drm_dma.o drm_legacy_misc.o drm_lock.o \
24+ drm_memory.o drm_scatter.o drm_vm.o
2425 drm-$(CONFIG_DRM_LIB_RANDOM) += lib/drm_random.o
25−drm-$(CONFIG_DRM_VM) += drm_vm.o
2626 drm-$(CONFIG_COMPAT) += drm_ioc32.o
2727 drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
2828 drm-$(CONFIG_DRM_GEM_SHMEM_HELPER) += drm_gem_shmem_helper.o
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c+16−14
@@ -1106,8 +1106,7 @@ void amdgpu_device_wb_free(struct amdgpu_device *adev, u32 wb) · 1105 unmodified lines
11061106 */
11071107 int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
11081108 {
1109− u64 space_needed = roundup_pow_of_two(adev->gmc.real_vram_size);
1110− u32 rbar_size = order_base_2(((space_needed >> 20) | 1)) - 1;
1109+ int rbar_size = pci_rebar_bytes_to_size(adev->gmc.real_vram_size);
11111110 struct pci_bus *root;
11121111 struct resource *res;
11131112 unsigned i;
@@ -1138,6 +1137,10 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev) · 24 unmodified lines
11381137 if (!res)
11391138 return 0;
11401139
1140+ /* Limit the BAR size to what is available */
1141+ rbar_size = min(fls(pci_rebar_get_possible_sizes(adev->pdev, 0)) - 1,
1142+ rbar_size);
1143+
11411144 /* Disable memory decoding while we change the BAR addresses and size */
11421145 pci_read_config_word(adev->pdev, PCI_COMMAND, &cmd);
11431146 pci_write_config_word(adev->pdev, PCI_COMMAND,
@@ -1423,9 +1426,9 @@ static void amdgpu_switcheroo_set_state(struct pci_dev *pdev, · 279 unmodified lines
14231426 /* don't suspend or resume card normally */
14241427 dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
14251428
1426− pci_set_power_state(dev->pdev, PCI_D0);
1427− amdgpu_device_load_pci_state(dev->pdev);
1428− r = pci_enable_device(dev->pdev);
1429+ pci_set_power_state(pdev, PCI_D0);
1430+ amdgpu_device_load_pci_state(pdev);
1431+ r = pci_enable_device(pdev);
14291432 if (r)
14301433 DRM_WARN("pci_enable_device failed (%d)\n", r);
14311434 amdgpu_device_resume(dev, true);
@@ -1437,10 +1440,10 @@ static void amdgpu_switcheroo_set_state(struct pci_dev *pdev, · 5 unmodified lines
14371440 drm_kms_helper_poll_disable(dev);
14381441 dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
14391442 amdgpu_device_suspend(dev, true);
1440− amdgpu_device_cache_pci_state(dev->pdev);
1443+ amdgpu_device_cache_pci_state(pdev);
14411444 /* Shut down the device */
1442− pci_disable_device(dev->pdev);
1443− pci_set_power_state(dev->pdev, PCI_D3cold);
1445+ pci_disable_device(pdev);
1446+ pci_set_power_state(pdev, PCI_D3cold);
14441447 dev->switch_power_state = DRM_SWITCH_POWER_OFF;
14451448 }
14461449 }
@@ -1703,8 +1706,7 @@ static void amdgpu_device_enable_virtual_display(struct amdgpu_device *adev) · 256 unmodified lines
17031706 adev->enable_virtual_display = false;
17041707
17051708 if (amdgpu_virtual_display) {
1706− struct drm_device *ddev = adev_to_drm(adev);
1707− const char *pci_address_name = pci_name(ddev->pdev);
1709+ const char *pci_address_name = pci_name(adev->pdev);
17081710 char *pciaddstr, *pciaddstr_tmp, *pciaddname_tmp, *pciaddname;
17091711
17101712 pciaddstr = kstrdup(amdgpu_virtual_display, GFP_KERNEL);
@@ -3397,7 +3399,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, · 1686 unmodified lines
33973399 }
33983400 }
33993401
3400− pci_enable_pcie_error_reporting(adev->ddev.pdev);
3402+ pci_enable_pcie_error_reporting(adev->pdev);
34013403
34023404 /* Post card if necessary */
34033405 if (amdgpu_device_need_post(adev)) {
@@ -4950,8 +4952,8 @@ pci_ers_result_t amdgpu_pci_error_detected(struct pci_dev *pdev, pci_channel_sta · 1546 unmodified lines
49504952 case pci_channel_io_normal:
49514953 return PCI_ERS_RESULT_CAN_RECOVER;
49524954 /* Fatal error, prepare for slot reset */
4953− case pci_channel_io_frozen:
4954− /*
4955+ case pci_channel_io_frozen:
4956+ /*
49554957 * Cancel and wait for all TDRs in progress if failing to
49564958 * set adev->in_gpu_reset in amdgpu_device_lock_adev
49574959 *
@@ -5042,7 +5044,7 @@ pci_ers_result_t amdgpu_pci_slot_reset(struct pci_dev *pdev) · 84 unmodified lines
50425044 goto out;
50435045 }
50445046
5045− adev->in_pci_err_recovery = true;
5047+ adev->in_pci_err_recovery = true;
50465048 r = amdgpu_device_pre_asic_reset(adev, NULL, &need_full_reset);
50475049 adev->in_pci_err_recovery = false;
50485050 if (r)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+0−1
@@ -1204,7 +1204,6 @@ static int amdgpu_pci_probe(struct pci_dev *pdev, · 1203 unmodified lines
12041204 if (ret)
12051205 return ret;
12061206
1207− ddev->pdev = pdev;
12081207 pci_set_drvdata(pdev, ddev);
12091208
12101209 ret = amdgpu_driver_load_kms(adev, ent->driver_data);
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c+1−1
@@ -271,7 +271,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper, · 270 unmodified lines
271271 DRM_INFO("fb depth is %d\n", fb->format->depth);
272272 DRM_INFO(" pitch is %d\n", fb->pitches[0]);
273273
274− vga_switcheroo_client_fb_set(adev_to_drm(adev)->pdev, info);
274+ vga_switcheroo_client_fb_set(adev->pdev, info);
275275 return 0;
276276
277277 out:
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c+5−5
@@ -619,7 +619,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data, · 618 unmodified lines
619619 int r = 0;
620620
621621 if (args->va_address < AMDGPU_VA_RESERVED_SIZE) {
622− dev_dbg(&dev->pdev->dev,
622+ dev_dbg(dev->dev,
623623 "va_address 0x%LX is in reserved area 0x%LX\n",
624624 args->va_address, AMDGPU_VA_RESERVED_SIZE);
625625 return -EINVAL;
@@ -627,7 +627,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data, · 1 unmodified line
627627
628628 if (args->va_address >= AMDGPU_GMC_HOLE_START &&
629629 args->va_address < AMDGPU_GMC_HOLE_END) {
630− dev_dbg(&dev->pdev->dev,
630+ dev_dbg(dev->dev,
631631 "va_address 0x%LX is in VA hole 0x%LX-0x%LX\n",
632632 args->va_address, AMDGPU_GMC_HOLE_START,
633633 AMDGPU_GMC_HOLE_END);
@@ -639,14 +639,14 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data, · 5 unmodified lines
639639 vm_size = adev->vm_manager.max_pfn * AMDGPU_GPU_PAGE_SIZE;
640640 vm_size -= AMDGPU_VA_RESERVED_SIZE;
641641 if (args->va_address + args->map_size > vm_size) {
642− dev_dbg(&dev->pdev->dev,
642+ dev_dbg(dev->dev,
643643 "va_address 0x%llx is in top reserved area 0x%llx\n",
644644 args->va_address + args->map_size, vm_size);
645645 return -EINVAL;
646646 }
647647
648648 if ((args->flags & ~valid_flags) && (args->flags & ~prt_flags)) {
649− dev_dbg(&dev->pdev->dev, "invalid flags combination 0x%08X\n",
649+ dev_dbg(dev->dev, "invalid flags combination 0x%08X\n",
650650 args->flags);
651651 return -EINVAL;
652652 }
@@ -658,7 +658,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data, · 5 unmodified lines
658658 case AMDGPU_VA_OP_REPLACE:
659659 break;
660660 default:
661− dev_dbg(&dev->pdev->dev, "unsupported operation %d\n",
661+ dev_dbg(dev->dev, "unsupported operation %d\n",
662662 args->operation);
663663 return -EINVAL;
664664 }
drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c+1−1
@@ -176,7 +176,7 @@ struct amdgpu_i2c_chan *amdgpu_i2c_create(struct drm_device *dev, · 175 unmodified lines
176176 i2c->rec = *rec;
177177 i2c->adapter.owner = THIS_MODULE;
178178 i2c->adapter.class = I2C_CLASS_DDC;
179− i2c->adapter.dev.parent = &dev->pdev->dev;
179+ i2c->adapter.dev.parent = dev->dev;
180180 i2c->dev = dev;
181181 i2c_set_adapdata(&i2c->adapter, i2c);
182182 mutex_init(&i2c->mutex);
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c+5−5
@@ -142,7 +142,7 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) · 141 unmodified lines
142142 (amdgpu_is_atpx_hybrid() ||
143143 amdgpu_has_atpx_dgpu_power_cntl()) &&
144144 ((flags & AMD_IS_APU) == 0) &&
145− !pci_is_thunderbolt_attached(dev->pdev))
145+ !pci_is_thunderbolt_attached(to_pci_dev(dev->dev)))
146146 flags |= AMD_IS_PX;
147147
148148 parent = pci_upstream_bridge(adev->pdev);
@@ -156,7 +156,7 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) · 7 unmodified lines
156156 */
157157 r = amdgpu_device_init(adev, flags);
158158 if (r) {
159− dev_err(&dev->pdev->dev, "Fatal error during GPU init\n");
159+ dev_err(dev->dev, "Fatal error during GPU init\n");
160160 goto out;
161161 }
162162
@@ -199,7 +199,7 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) · 36 unmodified lines
199199
200200 acpi_status = amdgpu_acpi_init(adev);
201201 if (acpi_status)
202− dev_dbg(&dev->pdev->dev, "Error during ACPI methods call\n");
202+ dev_dbg(dev->dev, "Error during ACPI methods call\n");
203203
204204 if (adev->runpm) {
205205 /* only need to skip on ATPX */
@@ -735,10 +735,10 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 529 unmodified lines
735735 if (!dev_info)
736736 return -ENOMEM;
737737
738− dev_info->device_id = dev->pdev->device;
738+ dev_info->device_id = adev->pdev->device;
739739 dev_info->chip_rev = adev->rev_id;
740740 dev_info->external_rev = adev->external_rev_id;
741− dev_info->pci_rev = dev->pdev->revision;
741+ dev_info->pci_rev = adev->pdev->revision;
742742 dev_info->family = adev->family;
743743 dev_info->num_shader_engines = adev->gfx.config.max_shader_engines;
744744 dev_info->num_shader_arrays_per_engine = adev->gfx.config.max_sh_per_se;
drivers/gpu/drm/ast/ast_drv.c+2−2
@@ -147,7 +147,7 @@ static int ast_drm_freeze(struct drm_device *dev) · 146 unmodified lines
147147 error = drm_mode_config_helper_suspend(dev);
148148 if (error)
149149 return error;
150− pci_save_state(dev->pdev);
150+ pci_save_state(to_pci_dev(dev->dev));
151151 return 0;
152152 }
153153
@@ -162,7 +162,7 @@ static int ast_drm_resume(struct drm_device *dev) · 8 unmodified lines
162162 {
163163 int ret;
164164
165− if (pci_enable_device(dev->pdev))
165+ if (pci_enable_device(to_pci_dev(dev->dev)))
166166 return -EIO;
167167
168168 ret = ast_drm_thaw(dev);
drivers/gpu/drm/ast/ast_main.c+13−12
@@ -67,8 +67,9 @@ uint8_t ast_get_index_reg_mask(struct ast_private *ast, · 66 unmodified lines
6767
6868 static void ast_detect_config_mode(struct drm_device *dev, u32 *scu_rev)
6969 {
70− struct device_node *np = dev->pdev->dev.of_node;
70+ struct device_node *np = dev->dev->of_node;
7171 struct ast_private *ast = to_ast_private(dev);
72+ struct pci_dev *pdev = to_pci_dev(dev->dev);
7273 uint32_t data, jregd0, jregd1;
7374
7475 /* Defaults */
@@ -85,7 +86,7 @@ static void ast_detect_config_mode(struct drm_device *dev, u32 *scu_rev) · 10 unmodified lines
8586 }
8687
8788 /* Not all families have a P2A bridge */
88− if (dev->pdev->device != PCI_CHIP_AST2000)
89+ if (pdev->device != PCI_CHIP_AST2000)
8990 return;
9091
9192 /*
@@ -119,6 +120,7 @@ static void ast_detect_config_mode(struct drm_device *dev, u32 *scu_rev) · 27 unmodified lines
119120 static int ast_detect_chip(struct drm_device *dev, bool *need_post)
120121 {
121122 struct ast_private *ast = to_ast_private(dev);
123+ struct pci_dev *pdev = to_pci_dev(dev->dev);
122124 uint32_t jreg, scu_rev;
123125
124126 /*
@@ -143,19 +145,19 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post) · 18 unmodified lines
143145 ast_detect_config_mode(dev, &scu_rev);
144146
145147 /* Identify chipset */
146− if (dev->pdev->revision >= 0x50) {
148+ if (pdev->revision >= 0x50) {
147149 ast->chip = AST2600;
148150 drm_info(dev, "AST 2600 detected\n");
149− } else if (dev->pdev->revision >= 0x40) {
151+ } else if (pdev->revision >= 0x40) {
150152 ast->chip = AST2500;
151153 drm_info(dev, "AST 2500 detected\n");
152− } else if (dev->pdev->revision >= 0x30) {
154+ } else if (pdev->revision >= 0x30) {
153155 ast->chip = AST2400;
154156 drm_info(dev, "AST 2400 detected\n");
155− } else if (dev->pdev->revision >= 0x20) {
157+ } else if (pdev->revision >= 0x20) {
156158 ast->chip = AST2300;
157159 drm_info(dev, "AST 2300 detected\n");
158− } else if (dev->pdev->revision >= 0x10) {
160+ } else if (pdev->revision >= 0x10) {
159161 switch (scu_rev & 0x0300) {
160162 case 0x0200:
161163 ast->chip = AST1100;
@@ -265,7 +267,7 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post) · 103 unmodified lines
265267
266268 static int ast_get_dram_info(struct drm_device *dev)
267269 {
268− struct device_node *np = dev->pdev->dev.of_node;
270+ struct device_node *np = dev->dev->of_node;
269271 struct ast_private *ast = to_ast_private(dev);
270272 uint32_t mcr_cfg, mcr_scu_mpll, mcr_scu_strap;
271273 uint32_t denum, num, div, ref_pll, dsel;
@@ -409,10 +411,9 @@ struct ast_private *ast_device_create(const struct drm_driver *drv, · 137 unmodified lines
409411 return ast;
410412 dev = &ast->base;
411413
412− dev->pdev = pdev;
413414 pci_set_drvdata(pdev, dev);
414415
415− ast->regs = pci_iomap(dev->pdev, 1, 0);
416+ ast->regs = pci_iomap(pdev, 1, 0);
416417 if (!ast->regs)
417418 return ERR_PTR(-EIO);
418419
@@ -421,14 +422,14 @@ struct ast_private *ast_device_create(const struct drm_driver *drv, · 2 unmodified lines
421422 * assume the chip has MMIO enabled by default (rev 0x20
422423 * and higher).
423424 */
424− if (!(pci_resource_flags(dev->pdev, 2) & IORESOURCE_IO)) {
425+ if (!(pci_resource_flags(pdev, 2) & IORESOURCE_IO)) {
425426 drm_info(dev, "platform has no IO space, trying MMIO\n");
426427 ast->ioregs = ast->regs + AST_IO_MM_OFFSET;
427428 }
428429
429430 /* "map" IO regs if the above hasn't done so already */
430431 if (!ast->ioregs) {
431− ast->ioregs = pci_iomap(dev->pdev, 2, 0);
432+ ast->ioregs = pci_iomap(pdev, 2, 0);
432433 if (!ast->ioregs)
433434 return ERR_PTR(-EIO);
434435 }
drivers/gpu/drm/ast/ast_mm.c+9−8
@@ -77,31 +77,32 @@ static u32 ast_get_vram_size(struct ast_private *ast) · 76 unmodified lines
7777 static void ast_mm_release(struct drm_device *dev, void *ptr)
7878 {
7979 struct ast_private *ast = to_ast_private(dev);
80+ struct pci_dev *pdev = to_pci_dev(dev->dev);
8081
8182 arch_phys_wc_del(ast->fb_mtrr);
82− arch_io_free_memtype_wc(pci_resource_start(dev->pdev, 0),
83− pci_resource_len(dev->pdev, 0));
83+ arch_io_free_memtype_wc(pci_resource_start(pdev, 0),
84+ pci_resource_len(pdev, 0));
8485 }
8586
8687 int ast_mm_init(struct ast_private *ast)
8788 {
8889 struct drm_device *dev = &ast->base;
90+ struct pci_dev *pdev = to_pci_dev(dev->dev);
8991 u32 vram_size;
9092 int ret;
9193
9294 vram_size = ast_get_vram_size(ast);
9395
94− ret = drmm_vram_helper_init(dev, pci_resource_start(dev->pdev, 0),
95− vram_size);
96+ ret = drmm_vram_helper_init(dev, pci_resource_start(pdev, 0), vram_size);
9697 if (ret) {
9798 drm_err(dev, "Error initializing VRAM MM; %d\n", ret);
9899 return ret;
99100 }
100101
101− arch_io_reserve_memtype_wc(pci_resource_start(dev->pdev, 0),
102− pci_resource_len(dev->pdev, 0));
103− ast->fb_mtrr = arch_phys_wc_add(pci_resource_start(dev->pdev, 0),
104− pci_resource_len(dev->pdev, 0));
102+ arch_io_reserve_memtype_wc(pci_resource_start(pdev, 0),
103+ pci_resource_len(pdev, 0));
104+ ast->fb_mtrr = arch_phys_wc_add(pci_resource_start(pdev, 0),
105+ pci_resource_len(pdev, 0));
105106
106107 return drmm_add_action_or_reset(dev, ast_mm_release, NULL);
107108 }
drivers/gpu/drm/ast/ast_mode.c+3−2
@@ -1106,6 +1106,7 @@ static const struct drm_mode_config_funcs ast_mode_config_funcs = { · 1105 unmodified lines
11061106 int ast_mode_config_init(struct ast_private *ast)
11071107 {
11081108 struct drm_device *dev = &ast->base;
1109+ struct pci_dev *pdev = to_pci_dev(dev->dev);
11091110 int ret;
11101111
11111112 ret = ast_cursor_init(ast);
@@ -1121,7 +1122,7 @@ int ast_mode_config_init(struct ast_private *ast) · 9 unmodified lines
11211122 dev->mode_config.min_height = 0;
11221123 dev->mode_config.preferred_depth = 24;
11231124 dev->mode_config.prefer_shadow = 1;
1124− dev->mode_config.fb_base = pci_resource_start(dev->pdev, 0);
1125+ dev->mode_config.fb_base = pci_resource_start(pdev, 0);
11251126
11261127 if (ast->chip == AST2100 ||
11271128 ast->chip == AST2200 ||
@@ -1258,7 +1259,7 @@ static struct ast_i2c_chan *ast_i2c_create(struct drm_device *dev) · 130 unmodified lines
12581259
12591260 i2c->adapter.owner = THIS_MODULE;
12601261 i2c->adapter.class = I2C_CLASS_DDC;
1261− i2c->adapter.dev.parent = &dev->pdev->dev;
1262+ i2c->adapter.dev.parent = dev->dev;
12621263 i2c->dev = dev;
12631264 i2c_set_adapdata(&i2c->adapter, i2c);
12641265 snprintf(i2c->adapter.name, sizeof(i2c->adapter.name),
drivers/gpu/drm/ast/ast_post.c+5−3
@@ -71,6 +71,7 @@ static void · 70 unmodified lines
7171 ast_set_def_ext_reg(struct drm_device *dev)
7272 {
7373 struct ast_private *ast = to_ast_private(dev);
74+ struct pci_dev *pdev = to_pci_dev(dev->dev);
7475 u8 i, index, reg;
7576 const u8 *ext_reg_info;
7677
@@ -80,7 +81,7 @@ ast_set_def_ext_reg(struct drm_device *dev) · 3 unmodified lines
8081
8182 if (ast->chip == AST2300 || ast->chip == AST2400 ||
8283 ast->chip == AST2500) {
83− if (dev->pdev->revision >= 0x20)
84+ if (pdev->revision >= 0x20)
8485 ext_reg_info = extreginfo_ast2300;
8586 else
8687 ext_reg_info = extreginfo_ast2300a0;
@@ -366,11 +367,12 @@ static void ast_init_dram_reg(struct drm_device *dev) · 279 unmodified lines
366367 void ast_post_gpu(struct drm_device *dev)
367368 {
368369 struct ast_private *ast = to_ast_private(dev);
370+ struct pci_dev *pdev = to_pci_dev(dev->dev);
369371 u32 reg;
370372
371− pci_read_config_dword(dev->pdev, 0x04, &reg);
373+ pci_read_config_dword(pdev, 0x04, &reg);
372374 reg |= 0x3;
373− pci_write_config_dword(dev->pdev, 0x04, reg);
375+ pci_write_config_dword(pdev, 0x04, reg);
374376
375377 ast_enable_vga(dev);
376378 ast_open_key(ast);
drivers/gpu/drm/bochs/bochs_drv.c+0−1
@@ -121,7 +121,6 @@ static int bochs_pci_probe(struct pci_dev *pdev, · 120 unmodified lines
121121 if (ret)
122122 goto err_free_dev;
123123
124− dev->pdev = pdev;
125124 pci_set_drvdata(pdev, dev);
126125
127126 ret = bochs_load(dev);
drivers/gpu/drm/bochs/bochs_hw.c+2−2
@@ -110,7 +110,7 @@ int bochs_hw_load_edid(struct bochs_device *bochs) · 109 unmodified lines
110110 int bochs_hw_init(struct drm_device *dev)
111111 {
112112 struct bochs_device *bochs = dev->dev_private;
113− struct pci_dev *pdev = dev->pdev;
113+ struct pci_dev *pdev = to_pci_dev(dev->dev);
114114 unsigned long addr, size, mem, ioaddr, iosize;
115115 u16 id;
116116
@@ -201,7 +201,7 @@ void bochs_hw_fini(struct drm_device *dev) · 84 unmodified lines
201201 release_region(VBE_DISPI_IOPORT_INDEX, 2);
202202 if (bochs->fb_map)
203203 iounmap(bochs->fb_map);
204− pci_release_regions(dev->pdev);
204+ pci_release_regions(to_pci_dev(dev->dev));
205205 kfree(bochs->edid);
206206 }
207207
drivers/gpu/drm/drm_agpsupport.c+23−44
@@ -45,13 +45,9 @@ · 44 unmodified lines
4545
4646 #include "drm_legacy.h"
4747
48−/**
48+/*
4949 * Get AGP information.
5050 *
51− * \param inode device inode.
52− * \param file_priv DRM file private.
53− * \param cmd command.
54− * \param arg pointer to a (output) drm_agp_info structure.
5551 * \return zero on success or a negative number on failure.
5652 *
5753 * Verifies the AGP device has been initialized and acquired and fills in the
@@ -92,7 +88,7 @@ int drm_agp_info_ioctl(struct drm_device *dev, void *data, · 34 unmodified lines
9288 return 0;
9389 }
9490
95−/**
91+/*
9692 * Acquire the AGP device.
9793 *
9894 * \param dev DRM device that is to acquire AGP.
@@ -103,11 +99,13 @@ int drm_agp_info_ioctl(struct drm_device *dev, void *data, · 4 unmodified lines
10399 */
104100 int drm_agp_acquire(struct drm_device *dev)
105101 {
102+ struct pci_dev *pdev = to_pci_dev(dev->dev);
103+
106104 if (!dev->agp)
107105 return -ENODEV;
108106 if (dev->agp->acquired)
109107 return -EBUSY;
110− dev->agp->bridge = agp_backend_acquire(dev->pdev);
108+ dev->agp->bridge = agp_backend_acquire(pdev);
111109 if (!dev->agp->bridge)
112110 return -ENODEV;
113111 dev->agp->acquired = 1;
@@ -115,13 +113,9 @@ int drm_agp_acquire(struct drm_device *dev) · 1 unmodified line
115113 }
116114 EXPORT_SYMBOL(drm_agp_acquire);
117115
118−/**
116+/*
119117 * Acquire the AGP device (ioctl).
120118 *
121− * \param inode device inode.
122− * \param file_priv DRM file private.
123− * \param cmd command.
124− * \param arg user argument.
125119 * \return zero on success or a negative number on failure.
126120 *
127121 * Verifies the AGP device hasn't been acquired before and calls
@@ -133,7 +127,7 @@ int drm_agp_acquire_ioctl(struct drm_device *dev, void *data, · 5 unmodified lines
133127 return drm_agp_acquire((struct drm_device *) file_priv->minor->dev);
134128 }
135129
136−/**
130+/*
137131 * Release the AGP device.
138132 *
139133 * \param dev DRM device that is to release AGP.
@@ -157,7 +151,7 @@ int drm_agp_release_ioctl(struct drm_device *dev, void *data, · 17 unmodified lines
157151 return drm_agp_release(dev);
158152 }
159153
160−/**
154+/*
161155 * Enable the AGP bus.
162156 *
163157 * \param dev DRM device that has previously acquired AGP.
@@ -187,13 +181,9 @@ int drm_agp_enable_ioctl(struct drm_device *dev, void *data, · 23 unmodified lines
187181 return drm_agp_enable(dev, *mode);
188182 }
189183
190−/**
184+/*
191185 * Allocate AGP memory.
192186 *
193− * \param inode device inode.
194− * \param file_priv file private pointer.
195− * \param cmd command.
196− * \param arg pointer to a drm_agp_buffer structure.
197187 * \return zero on success or a negative number on failure.
198188 *
199189 * Verifies the AGP device is present and has been acquired, allocates the
@@ -242,7 +232,7 @@ int drm_agp_alloc_ioctl(struct drm_device *dev, void *data, · 42 unmodified lines
242232 return drm_agp_alloc(dev, request);
243233 }
244234
245−/**
235+/*
246236 * Search for the AGP memory entry associated with a handle.
247237 *
248238 * \param dev DRM device structure.
@@ -263,13 +253,9 @@ static struct drm_agp_mem *drm_agp_lookup_entry(struct drm_device *dev, · 14 unmodified lines
263253 return NULL;
264254 }
265255
266−/**
256+/*
267257 * Unbind AGP memory from the GATT (ioctl).
268258 *
269− * \param inode device inode.
270− * \param file_priv DRM file private.
271− * \param cmd command.
272− * \param arg pointer to a drm_agp_binding structure.
273259 * \return zero on success or a negative number on failure.
274260 *
275261 * Verifies the AGP device is present and acquired, looks-up the AGP memory
@@ -285,7 +271,7 @@ int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request) · 9 unmodified lines
285271 entry = drm_agp_lookup_entry(dev, request->handle);
286272 if (!entry || !entry->bound)
287273 return -EINVAL;
288− ret = drm_unbind_agp(entry->memory);
274+ ret = agp_unbind_memory(entry->memory);
289275 if (ret == 0)
290276 entry->bound = 0;
291277 return ret;
@@ -301,13 +287,9 @@ int drm_agp_unbind_ioctl(struct drm_device *dev, void *data, · 9 unmodified lines
301287 return drm_agp_unbind(dev, request);
302288 }
303289
304−/**
290+/*
305291 * Bind AGP memory into the GATT (ioctl)
306292 *
307− * \param inode device inode.
308− * \param file_priv DRM file private.
309− * \param cmd command.
310− * \param arg pointer to a drm_agp_binding structure.
311293 * \return zero on success or a negative number on failure.
312294 *
313295 * Verifies the AGP device is present and has been acquired and that no memory
@@ -326,7 +308,7 @@ int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request) · 12 unmodified lines
326308 if (!entry || entry->bound)
327309 return -EINVAL;
328310 page = DIV_ROUND_UP(request->offset, PAGE_SIZE);
329− retcode = drm_bind_agp(entry->memory, page);
311+ retcode = agp_bind_memory(entry->memory, page);
330312 if (retcode)
331313 return retcode;
332314 entry->bound = dev->agp->base + (page << PAGE_SHIFT);
@@ -345,13 +327,9 @@ int drm_agp_bind_ioctl(struct drm_device *dev, void *data, · 12 unmodified lines
345327 return drm_agp_bind(dev, request);
346328 }
347329
348−/**
330+/*
349331 * Free AGP memory (ioctl).
350332 *
351− * \param inode device inode.
352− * \param file_priv DRM file private.
353− * \param cmd command.
354− * \param arg pointer to a drm_agp_buffer structure.
355333 * \return zero on success or a negative number on failure.
356334 *
357335 * Verifies the AGP device is present and has been acquired and looks up the
@@ -369,11 +347,11 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request) · 11 unmodified lines
369347 if (!entry)
370348 return -EINVAL;
371349 if (entry->bound)
372− drm_unbind_agp(entry->memory);
350+ agp_unbind_memory(entry->memory);
373351
374352 list_del(&entry->head);
375353
376− drm_free_agp(entry->memory, entry->pages);
354+ agp_free_memory(entry->memory);
377355 kfree(entry);
378356 return 0;
379357 }
@@ -388,7 +366,7 @@ int drm_agp_free_ioctl(struct drm_device *dev, void *data, · 8 unmodified lines
388366 return drm_agp_free(dev, request);
389367 }
390368
391−/**
369+/*
392370 * Initialize the AGP resources.
393371 *
394372 * \return pointer to a drm_agp_head structure.
@@ -402,14 +380,15 @@ int drm_agp_free_ioctl(struct drm_device *dev, void *data, · 7 unmodified lines
402380 */
403381 struct drm_agp_head *drm_agp_init(struct drm_device *dev)
404382 {
383+ struct pci_dev *pdev = to_pci_dev(dev->dev);
405384 struct drm_agp_head *head = NULL;
406385
407386 head = kzalloc(sizeof(*head), GFP_KERNEL);
408387 if (!head)
409388 return NULL;
410− head->bridge = agp_find_bridge(dev->pdev);
389+ head->bridge = agp_find_bridge(pdev);
411390 if (!head->bridge) {
412− head->bridge = agp_backend_acquire(dev->pdev);
391+ head->bridge = agp_backend_acquire(pdev);
413392 if (!head->bridge) {
414393 kfree(head);
415394 return NULL;
@@ -453,8 +432,8 @@ void drm_legacy_agp_clear(struct drm_device *dev) · 37 unmodified lines
453432
454433 list_for_each_entry_safe(entry, tempe, &dev->agp->memory, head) {
455434 if (entry->bound)
456− drm_unbind_agp(entry->memory);
457− drm_free_agp(entry->memory, entry->pages);
435+ agp_unbind_memory(entry->memory);
436+ agp_free_memory(entry->memory);
458437 kfree(entry);
459438 }
460439 INIT_LIST_HEAD(&dev->agp->memory);
drivers/gpu/drm/drm_bufs.c+2−2
@@ -326,7 +326,7 @@ static int drm_addmap_core(struct drm_device *dev, resource_size_t offset, · 325 unmodified lines
326326 * As we're limiting the address to 2^32-1 (or less),
327327 * casting it down to 32 bits is no problem, but we
328328 * need to point to a 64bit variable first. */
329− map->handle = dma_alloc_coherent(&dev->pdev->dev,
329+ map->handle = dma_alloc_coherent(dev->dev,
330330 map->size,
331331 &map->offset,
332332 GFP_KERNEL);
@@ -556,7 +556,7 @@ int drm_legacy_rmmap_locked(struct drm_device *dev, struct drm_local_map *map) · 223 unmodified lines
556556 case _DRM_SCATTER_GATHER:
557557 break;
558558 case _DRM_CONSISTENT:
559− dma_free_coherent(&dev->pdev->dev,
559+ dma_free_coherent(dev->dev,
560560 map->size,
561561 map->handle,
562562 map->offset);
drivers/gpu/drm/drm_cache.c+33−0
@@ -30,6 +30,8 @@ · 29 unmodified lines
3030
3131 #include <linux/export.h>
3232 #include <linux/highmem.h>
33+#include <linux/mem_encrypt.h>
34+#include <xen/xen.h>
3335
3436 #include <drm/drm_cache.h>
3537
@@ -176,3 +178,34 @@ drm_clflush_virt_range(void *addr, unsigned long length) · 140 unmodified lines
176178 #endif
177179 }
178180 EXPORT_SYMBOL(drm_clflush_virt_range);
181+
182+bool drm_need_swiotlb(int dma_bits)
183+{
184+ struct resource *tmp;
185+ resource_size_t max_iomem = 0;
186+
187+ /*
188+ * Xen paravirtual hosts require swiotlb regardless of requested dma
189+ * transfer size.
190+ *
191+ * NOTE: Really, what it requires is use of the dma_alloc_coherent
192+ * allocator used in ttm_dma_populate() instead of
193+ * ttm_populate_and_map_pages(), which bounce buffers so much in
194+ * Xen it leads to swiotlb buffer exhaustion.
195+ */
196+ if (xen_pv_domain())
197+ return true;
198+
199+ /*
200+ * Enforce dma_alloc_coherent when memory encryption is active as well
201+ * for the same reasons as for Xen paravirtual hosts.
202+ */
203+ if (mem_encrypt_active())
204+ return true;
205+
206+ for (tmp = iomem_resource.child; tmp; tmp = tmp->sibling)
207+ max_iomem = max(max_iomem, tmp->end);
208+
209+ return max_iomem > ((u64)1 << dma_bits);
210+}
211+EXPORT_SYMBOL(drm_need_swiotlb);
drivers/gpu/drm/drm_dp_helper.c+2−1
@@ -954,7 +954,7 @@ EXPORT_SYMBOL(drm_dp_downstream_444_to_420_conversion); · 953 unmodified lines
954954 * RGB->YCbCr conversion capability
955955 * @dpcd: DisplayPort configuration data
956956 * @port_cap: downstream facing port capabilities
957− * @colorspc: Colorspace for which conversion cap is sought
957+ * @color_spc: Colorspace for which conversion cap is sought
958958 *
959959 * Returns: whether the downstream facing port can convert RGB->YCbCr for a given
960960 * colorspace.
@@ -2671,6 +2671,7 @@ EXPORT_SYMBOL(drm_dp_get_pcon_max_frl_bw); · 1710 unmodified lines
26712671 /**
26722672 * drm_dp_pcon_frl_prepare() - Prepare PCON for FRL.
26732673 * @aux: DisplayPort AUX channel
2674+ * @enable_frl_ready_hpd: Configure DP_PCON_ENABLE_HPD_READY.
26742675 *
26752676 * Returns 0 if success, else returns negative error code.
26762677 */
drivers/gpu/drm/drm_dp_mst_topology.c+1−1
@@ -2751,7 +2751,7 @@ static void drm_dp_mst_link_probe_work(struct work_struct *work) · 2750 unmodified lines
27512751 drm_dp_mst_topology_put_mstb(mstb);
27522752
27532753 mutex_unlock(&mgr->probe_lock);
2754− if (ret)
2754+ if (ret > 0)
27552755 drm_kms_helper_hotplug_event(dev);
27562756 }
27572757
drivers/gpu/drm/drm_drv.c+3−0
@@ -469,6 +469,9 @@ void drm_dev_unplug(struct drm_device *dev) · 468 unmodified lines
469469 synchronize_srcu(&drm_unplug_srcu);
470470
471471 drm_dev_unregister(dev);
472+
473+ /* Clear all CPU mappings pointing to this device */
474+ unmap_mapping_range(dev->anon_inode->i_mapping, 0, 0, 1);
472475 }
473476 EXPORT_SYMBOL(drm_dev_unplug);
474477
drivers/gpu/drm/drm_edid.c+6−1
@@ -32,6 +32,7 @@ · 31 unmodified lines
3232 #include <linux/i2c.h>
3333 #include <linux/kernel.h>
3434 #include <linux/module.h>
35+#include <linux/pci.h>
3536 #include <linux/slab.h>
3637 #include <linux/vga_switcheroo.h>
3738
@@ -2075,9 +2076,13 @@ EXPORT_SYMBOL(drm_get_edid); · 2037 unmodified lines
20752076 struct edid *drm_get_edid_switcheroo(struct drm_connector *connector,
20762077 struct i2c_adapter *adapter)
20772078 {
2078− struct pci_dev *pdev = connector->dev->pdev;
2079+ struct drm_device *dev = connector->dev;
2080+ struct pci_dev *pdev = to_pci_dev(dev->dev);
20792081 struct edid *edid;
20802082
2083+ if (drm_WARN_ON_ONCE(dev, !dev_is_pci(dev->dev)))
2084+ return NULL;
2085+
20812086 vga_switcheroo_lock_ddc(pdev);
20822087 edid = drm_get_edid(connector, adapter);
20832088 vga_switcheroo_unlock_ddc(pdev);
drivers/gpu/drm/drm_file.c+2−3
@@ -239,9 +239,6 @@ static void drm_events_release(struct drm_file *file_priv) · 238 unmodified lines
239239 * before calling this.
240240 *
241241 * If NULL is passed, this is a no-op.
242− *
243− * RETURNS:
244− * 0 on success, or error code on failure.
245242 */
246243 void drm_file_free(struct drm_file *file)
247244 {
@@ -370,6 +367,7 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor) · 122 unmodified lines
370367 list_add(&priv->lhead, &dev->filelist);
371368 mutex_unlock(&dev->filelist_mutex);
372369
370+#ifdef CONFIG_DRM_LEGACY
373371 #ifdef __alpha__
374372 /*
375373 * Default the hose
@@ -389,6 +387,7 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor) · 13 unmodified lines
389387 dev->hose = b->sysdata;
390388 }
391389 }
390+#endif
392391 #endif
393392
394393 return 0;
drivers/gpu/drm/drm_gem.c+10−9
@@ -1068,20 +1068,17 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size, · 1067 unmodified lines
10681068 drm_gem_object_get(obj);
10691069
10701070 vma->vm_private_data = obj;
1071+ vma->vm_ops = obj->funcs->vm_ops;
10711072
10721073 if (obj->funcs->mmap) {
10731074 ret = obj->funcs->mmap(obj, vma);
1074− if (ret) {
1075− drm_gem_object_put(obj);
1076− return ret;
1077− }
1075+ if (ret)
1076+ goto err_drm_gem_object_put;
10781077 WARN_ON(!(vma->vm_flags & VM_DONTEXPAND));
10791078 } else {
1080− if (obj->funcs->vm_ops)
1081− vma->vm_ops = obj->funcs->vm_ops;
1082− else {
1083− drm_gem_object_put(obj);
1084− return -EINVAL;
1079+ if (!vma->vm_ops) {
1080+ ret = -EINVAL;
1081+ goto err_drm_gem_object_put;
10851082 }
10861083
10871084 vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP;
@@ -1090,6 +1087,10 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size, · 2 unmodified lines
10901087 }
10911088
10921089 return 0;
1090+
1091+err_drm_gem_object_put:
1092+ drm_gem_object_put(obj);
1093+ return ret;
10931094 }
10941095 EXPORT_SYMBOL(drm_gem_mmap_obj);
10951096
drivers/gpu/drm/drm_irq.c+7−5
@@ -122,7 +122,7 @@ int drm_irq_install(struct drm_device *dev, int irq) · 121 unmodified lines
122122 dev->driver->irq_preinstall(dev);
123123
124124 /* PCI devices require shared interrupts. */
125− if (dev->pdev)
125+ if (dev_is_pci(dev->dev))
126126 sh_flags = IRQF_SHARED;
127127
128128 ret = request_irq(irq, dev->driver->irq_handler,
@@ -140,7 +140,7 @@ int drm_irq_install(struct drm_device *dev, int irq) · 11 unmodified lines
140140 if (ret < 0) {
141141 dev->irq_enabled = false;
142142 if (drm_core_check_feature(dev, DRIVER_LEGACY))
143− vga_client_register(dev->pdev, NULL, NULL, NULL);
143+ vga_client_register(to_pci_dev(dev->dev), NULL, NULL, NULL);
144144 free_irq(irq, dev);
145145 } else {
146146 dev->irq = irq;
@@ -203,7 +203,7 @@ int drm_irq_uninstall(struct drm_device *dev) · 56 unmodified lines
203203 DRM_DEBUG("irq=%d\n", dev->irq);
204204
205205 if (drm_core_check_feature(dev, DRIVER_LEGACY))
206− vga_client_register(dev->pdev, NULL, NULL, NULL);
206+ vga_client_register(to_pci_dev(dev->dev), NULL, NULL, NULL);
207207
208208 if (dev->driver->irq_uninstall)
209209 dev->driver->irq_uninstall(dev);
@@ -252,6 +252,7 @@ int drm_legacy_irq_control(struct drm_device *dev, void *data, · 42 unmodified lines
252252 {
253253 struct drm_control *ctl = data;
254254 int ret = 0, irq;
255+ struct pci_dev *pdev;
255256
256257 /* if we haven't irq we fallback for compatibility reasons -
257258 * this used to be a separate function in drm_dma.h
@@ -262,12 +263,13 @@ int drm_legacy_irq_control(struct drm_device *dev, void *data, · 4 unmodified lines
262263 if (!drm_core_check_feature(dev, DRIVER_LEGACY))
263264 return 0;
264265 /* UMS was only ever supported on pci devices. */
265− if (WARN_ON(!dev->pdev))
266+ if (WARN_ON(!dev_is_pci(dev->dev)))
266267 return -EINVAL;
267268
268269 switch (ctl->func) {
269270 case DRM_INST_HANDLER:
270− irq = dev->pdev->irq;
271+ pdev = to_pci_dev(dev->dev);
272+ irq = pdev->irq;
271273
272274 if (dev->if_version < DRM_IF_VERSION(1, 2) &&
273275 ctl->irq != irq)
drivers/gpu/drm/drm_legacy.h+1−1
@@ -127,7 +127,7 @@ static inline void drm_legacy_master_rmmaps(struct drm_device *dev, · 126 unmodified lines
127127 static inline void drm_legacy_rmmaps(struct drm_device *dev) {}
128128 #endif
129129
130−#if IS_ENABLED(CONFIG_DRM_VM) && IS_ENABLED(CONFIG_DRM_LEGACY)
130+#if IS_ENABLED(CONFIG_DRM_LEGACY)
131131 void drm_legacy_vma_flush(struct drm_device *d);
132132 #else
133133 static inline void drm_legacy_vma_flush(struct drm_device *d)
drivers/gpu/drm/drm_memory.c+0−51
@@ -37,7 +37,6 @@ · 36 unmodified lines
3737 #include <linux/highmem.h>
3838 #include <linux/pci.h>
3939 #include <linux/vmalloc.h>
40−#include <xen/xen.h>
4140
4241 #include <drm/drm_agpsupport.h>
4342 #include <drm/drm_cache.h>
@@ -100,24 +99,6 @@ static void *agp_remap(unsigned long offset, unsigned long size, · 56 unmodified lines
10099 return addr;
101100 }
102101
103−/** Wrapper around agp_free_memory() */
104−void drm_free_agp(struct agp_memory *handle, int pages)
105−{
106− agp_free_memory(handle);
107−}
108−
109−/** Wrapper around agp_bind_memory() */
110−int drm_bind_agp(struct agp_memory *handle, unsigned int start)
111−{
112− return agp_bind_memory(handle, start);
113−}
114−
115−/** Wrapper around agp_unbind_memory() */
116−int drm_unbind_agp(struct agp_memory *handle)
117−{
118− return agp_unbind_memory(handle);
119−}
120−
121102 #else /* CONFIG_AGP */
122103 static inline void *agp_remap(unsigned long offset, unsigned long size,
123104 struct drm_device *dev)
@@ -156,35 +137,3 @@ void drm_legacy_ioremapfree(struct drm_local_map *map, struct drm_device *dev) · 32 unmodified lines
156137 iounmap(map->handle);
157138 }
158139 EXPORT_SYMBOL(drm_legacy_ioremapfree);
159−
160−bool drm_need_swiotlb(int dma_bits)
161−{
162− struct resource *tmp;
163− resource_size_t max_iomem = 0;
164−
165− /*
166− * Xen paravirtual hosts require swiotlb regardless of requested dma
167− * transfer size.
168− *
169− * NOTE: Really, what it requires is use of the dma_alloc_coherent
170− * allocator used in ttm_dma_populate() instead of
171− * ttm_populate_and_map_pages(), which bounce buffers so much in
172− * Xen it leads to swiotlb buffer exhaustion.
173− */
174− if (xen_pv_domain())
175− return true;
176−
177− /*
178− * Enforce dma_alloc_coherent when memory encryption is active as well
179− * for the same reasons as for Xen paravirtual hosts.
180− */
181− if (mem_encrypt_active())
182− return true;
183−
184− for (tmp = iomem_resource.child; tmp; tmp = tmp->sibling) {
185− max_iomem = max(max_iomem, tmp->end);
186− }
187−
188− return max_iomem > ((u64)1 << dma_bits);
189−}
190−EXPORT_SYMBOL(drm_need_swiotlb);
drivers/gpu/drm/drm_modes.c+2−2
@@ -762,7 +762,7 @@ int drm_mode_vrefresh(const struct drm_display_mode *mode) · 761 unmodified lines
762762 if (mode->htotal == 0 || mode->vtotal == 0)
763763 return 0;
764764
765− num = mode->clock * 1000;
765+ num = mode->clock;
766766 den = mode->htotal * mode->vtotal;
767767
768768 if (mode->flags & DRM_MODE_FLAG_INTERLACE)
@@ -772,7 +772,7 @@ int drm_mode_vrefresh(const struct drm_display_mode *mode) · 3 unmodified lines
772772 if (mode->vscan > 1)
773773 den *= mode->vscan;
774774
775− return DIV_ROUND_CLOSEST(num, den);
775+ return DIV_ROUND_CLOSEST_ULL(mul_u32_u32(num, 1000), den);
776776 }
777777 EXPORT_SYMBOL(drm_mode_vrefresh);
778778
drivers/gpu/drm/drm_pci.c+15−11
@@ -70,7 +70,7 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t ali · 69 unmodified lines
7070 return NULL;
7171
7272 dmah->size = size;
73− dmah->vaddr = dma_alloc_coherent(&dev->pdev->dev, size,
73+ dmah->vaddr = dma_alloc_coherent(dev->dev, size,
7474 &dmah->busaddr,
7575 GFP_KERNEL);
7676
@@ -93,7 +93,7 @@ EXPORT_SYMBOL(drm_pci_alloc); · 16 unmodified lines
9393 */
9494 void drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah)
9595 {
96− dma_free_coherent(&dev->pdev->dev, dmah->size, dmah->vaddr,
96+ dma_free_coherent(dev->dev, dmah->size, dmah->vaddr,
9797 dmah->busaddr);
9898 kfree(dmah);
9999 }
@@ -112,16 +112,18 @@ static int drm_get_pci_domain(struct drm_device *dev) · 12 unmodified lines
112112 return 0;
113113 #endif /* __alpha__ */
114114
115− return pci_domain_nr(dev->pdev->bus);
115+ return pci_domain_nr(to_pci_dev(dev->dev)->bus);
116116 }
117117
118118 int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master)
119119 {
120+ struct pci_dev *pdev = to_pci_dev(dev->dev);
121+
120122 master->unique = kasprintf(GFP_KERNEL, "pci:%04x:%02x:%02x.%d",
121123 drm_get_pci_domain(dev),
122− dev->pdev->bus->number,
123− PCI_SLOT(dev->pdev->devfn),
124− PCI_FUNC(dev->pdev->devfn));
124+ pdev->bus->number,
125+ PCI_SLOT(pdev->devfn),
126+ PCI_FUNC(pdev->devfn));
125127 if (!master->unique)
126128 return -ENOMEM;
127129
@@ -131,12 +133,14 @@ int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master) · 3 unmodified lines
131133
132134 static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p)
133135 {
136+ struct pci_dev *pdev = to_pci_dev(dev->dev);
137+
134138 if ((p->busnum >> 8) != drm_get_pci_domain(dev) ||
135− (p->busnum & 0xff) != dev->pdev->bus->number ||
136− p->devnum != PCI_SLOT(dev->pdev->devfn) || p->funcnum != PCI_FUNC(dev->pdev->devfn))
139+ (p->busnum & 0xff) != pdev->bus->number ||
140+ p->devnum != PCI_SLOT(pdev->devfn) || p->funcnum != PCI_FUNC(pdev->devfn))
137141 return -EINVAL;
138142
139− p->irq = dev->pdev->irq;
143+ p->irq = pdev->irq;
140144
141145 DRM_DEBUG("%d:%d:%d => IRQ %d\n", p->busnum, p->devnum, p->funcnum,
142146 p->irq);
@@ -164,7 +168,7 @@ int drm_legacy_irq_by_busid(struct drm_device *dev, void *data, · 21 unmodified lines
164168 return -EOPNOTSUPP;
165169
166170 /* UMS was only ever support on PCI devices. */
167− if (WARN_ON(!dev->pdev))
171+ if (WARN_ON(!dev_is_pci(dev->dev)))
168172 return -EINVAL;
169173
170174 if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
@@ -188,7 +192,7 @@ void drm_pci_agp_destroy(struct drm_device *dev) · 17 unmodified lines
188192 static void drm_pci_agp_init(struct drm_device *dev)
189193 {
190194 if (drm_core_check_feature(dev, DRIVER_USE_AGP)) {
191− if (pci_find_capability(dev->pdev, PCI_CAP_ID_AGP))
195+ if (pci_find_capability(to_pci_dev(dev->dev), PCI_CAP_ID_AGP))
192196 dev->agp = drm_agp_init(dev);
193197 if (dev->agp) {
194198 dev->agp->agp_mtrr = arch_phys_wc_add(
drivers/gpu/drm/drm_prime.c+2−0
@@ -717,6 +717,8 @@ int drm_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma) · 716 unmodified lines
717717 vma->vm_pgoff += drm_vma_node_start(&obj->vma_node);
718718
719719 if (obj->funcs && obj->funcs->mmap) {
720+ vma->vm_ops = obj->funcs->vm_ops;
721+
720722 ret = obj->funcs->mmap(obj, vma);
721723 if (ret)
722724 return ret;
drivers/gpu/drm/drm_vblank.c+1−1
@@ -74,7 +74,7 @@ · 73 unmodified lines
7474 * |↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓| updates the
7575 * | | frame as it
7676 * | | travels down
77− * | | ("sacn out")
77+ * | | ("scan out")
7878 * | Old frame |
7979 * | |
8080 * | |
drivers/gpu/drm/drm_vm.c+1−1
@@ -278,7 +278,7 @@ static void drm_vm_shm_close(struct vm_area_struct *vma) · 277 unmodified lines
278278 case _DRM_SCATTER_GATHER:
279279 break;
280280 case _DRM_CONSISTENT:
281− dma_free_coherent(&dev->pdev->dev,
281+ dma_free_coherent(dev->dev,
282282 map->size,
283283 map->handle,
284284 map->offset);
drivers/gpu/drm/gma500/cdv_device.c+19−11
@@ -95,13 +95,14 @@ static u32 cdv_get_max_backlight(struct drm_device *dev) · 94 unmodified lines
9595 static int cdv_get_brightness(struct backlight_device *bd)
9696 {
9797 struct drm_device *dev = bl_get_data(bd);
98+ struct pci_dev *pdev = to_pci_dev(dev->dev);
9899 u32 val = REG_READ(BLC_PWM_CTL) & BACKLIGHT_DUTY_CYCLE_MASK;
99100
100101 if (cdv_backlight_combination_mode(dev)) {
101102 u8 lbpc;
102103
103104 val &= ~1;
104− pci_read_config_byte(dev->pdev, 0xF4, &lbpc);
105+ pci_read_config_byte(pdev, 0xF4, &lbpc);
105106 val *= lbpc;
106107 }
107108 return (val * 100)/cdv_get_max_backlight(dev);
@@ -111,6 +112,7 @@ static int cdv_get_brightness(struct backlight_device *bd) · 3 unmodified lines
111112 static int cdv_set_brightness(struct backlight_device *bd)
112113 {
113114 struct drm_device *dev = bl_get_data(bd);
115+ struct pci_dev *pdev = to_pci_dev(dev->dev);
114116 int level = bd->props.brightness;
115117 u32 blc_pwm_ctl;
116118
@@ -128,7 +130,7 @@ static int cdv_set_brightness(struct backlight_device *bd) · 11 unmodified lines
128130 lbpc = level * 0xfe / max + 1;
129131 level /= lbpc;
130132
131− pci_write_config_byte(dev->pdev, 0xF4, lbpc);
133+ pci_write_config_byte(pdev, 0xF4, lbpc);
132134 }
133135
134136 blc_pwm_ctl = REG_READ(BLC_PWM_CTL) & ~BACKLIGHT_DUTY_CYCLE_MASK;
@@ -205,8 +207,9 @@ static inline void CDV_MSG_WRITE32(int domain, uint port, uint offset, · 70 unmodified lines
205207 static void cdv_init_pm(struct drm_device *dev)
206208 {
207209 struct drm_psb_private *dev_priv = dev->dev_private;
210+ struct pci_dev *pdev = to_pci_dev(dev->dev);
208211 u32 pwr_cnt;
209− int domain = pci_domain_nr(dev->pdev->bus);
212+ int domain = pci_domain_nr(pdev->bus);
210213 int i;
211214
212215 dev_priv->apm_base = CDV_MSG_READ32(domain, PSB_PUNIT_PORT,
@@ -234,6 +237,8 @@ static void cdv_init_pm(struct drm_device *dev) · 21 unmodified lines
234237
235238 static void cdv_errata(struct drm_device *dev)
236239 {
240+ struct pci_dev *pdev = to_pci_dev(dev->dev);
241+
237242 /* Disable bonus launch.
238243 * CPU and GPU competes for memory and display misses updates and
239244 * flickers. Worst with dual core, dual displays.
@@ -242,7 +247,7 @@ static void cdv_errata(struct drm_device *dev) · 2 unmodified lines
242247 * Bonus Launch to work around the issue, by degrading
243248 * performance.
244249 */
245− CDV_MSG_WRITE32(pci_domain_nr(dev->pdev->bus), 3, 0x30, 0x08027108);
250+ CDV_MSG_WRITE32(pci_domain_nr(pdev->bus), 3, 0x30, 0x08027108);
246251 }
247252
248253 /**
@@ -255,12 +260,13 @@ static void cdv_errata(struct drm_device *dev) · 6 unmodified lines
255260 static int cdv_save_display_registers(struct drm_device *dev)
256261 {
257262 struct drm_psb_private *dev_priv = dev->dev_private;
263+ struct pci_dev *pdev = to_pci_dev(dev->dev);
258264 struct psb_save_area *regs = &dev_priv->regs;
259265 struct drm_connector *connector;
260266
261267 dev_dbg(dev->dev, "Saving GPU registers.\n");
262268
263− pci_read_config_byte(dev->pdev, 0xF4, &regs->cdv.saveLBB);
269+ pci_read_config_byte(pdev, 0xF4, &regs->cdv.saveLBB);
264270
265271 regs->cdv.saveDSPCLK_GATE_D = REG_READ(DSPCLK_GATE_D);
266272 regs->cdv.saveRAMCLK_GATE_D = REG_READ(RAMCLK_GATE_D);
@@ -309,11 +315,12 @@ static int cdv_save_display_registers(struct drm_device *dev) · 42 unmodified lines
309315 static int cdv_restore_display_registers(struct drm_device *dev)
310316 {
311317 struct drm_psb_private *dev_priv = dev->dev_private;
318+ struct pci_dev *pdev = to_pci_dev(dev->dev);
312319 struct psb_save_area *regs = &dev_priv->regs;
313320 struct drm_connector *connector;
314321 u32 temp;
315322
316− pci_write_config_byte(dev->pdev, 0xF4, regs->cdv.saveLBB);
323+ pci_write_config_byte(pdev, 0xF4, regs->cdv.saveLBB);
317324
318325 REG_WRITE(DSPCLK_GATE_D, regs->cdv.saveDSPCLK_GATE_D);
319326 REG_WRITE(RAMCLK_GATE_D, regs->cdv.saveRAMCLK_GATE_D);
@@ -421,16 +428,16 @@ static int cdv_power_up(struct drm_device *dev) · 101 unmodified lines
421428 static void cdv_hotplug_work_func(struct work_struct *work)
422429 {
423430 struct drm_psb_private *dev_priv = container_of(work, struct drm_psb_private,
424− hotplug_work);
431+ hotplug_work);
425432 struct drm_device *dev = dev_priv->dev;
426433
427434 /* Just fire off a uevent and let userspace tell us what to do */
428435 drm_helper_hpd_irq_event(dev);
429−}
436+}
430437
431438 /* The core driver has received a hotplug IRQ. We are in IRQ context
432439 so extract the needed information and kick off queued processing */
433−
440+
434441 static int cdv_hotplug_event(struct drm_device *dev)
435442 {
436443 struct drm_psb_private *dev_priv = dev->dev_private;
@@ -449,7 +456,7 @@ static void cdv_hotplug_enable(struct drm_device *dev, bool on) · 12 unmodified lines
449456 } else {
450457 REG_WRITE(PORT_HOTPLUG_EN, 0);
451458 REG_WRITE(PORT_HOTPLUG_STAT, REG_READ(PORT_HOTPLUG_STAT));
452− }
459+ }
453460 }
454461
455462 static const char *force_audio_names[] = {
@@ -568,9 +575,10 @@ static const struct psb_offset cdv_regmap[2] = { · 112 unmodified lines
568575 static int cdv_chip_setup(struct drm_device *dev)
569576 {
570577 struct drm_psb_private *dev_priv = dev->dev_private;
578+ struct pci_dev *pdev = to_pci_dev(dev->dev);
571579 INIT_WORK(&dev_priv->hotplug_work, cdv_hotplug_work_func);
572580
573− if (pci_enable_msi(dev->pdev))
581+ if (pci_enable_msi(pdev))
574582 dev_warn(dev->dev, "Enabling MSI failed!\n");
575583 dev_priv->regmap = cdv_regmap;
576584 gma_get_core_freq(dev);
drivers/gpu/drm/gma500/cdv_intel_crt.c+2−3
@@ -127,7 +127,7 @@ static void cdv_intel_crt_mode_set(struct drm_encoder *encoder, · 126 unmodified lines
127127 }
128128
129129
130−/**
130+/*
131131 * Uses CRT_HOTPLUG_EN and CRT_HOTPLUG_STAT to detect CRT presence.
132132 *
133133 * \return true if CRT is connected.
@@ -278,8 +278,7 @@ void cdv_intel_crt_init(struct drm_device *dev, · 144 unmodified lines
278278 gma_encoder->ddc_bus = psb_intel_i2c_create(dev,
279279 i2c_reg, "CRTDDC_A");
280280 if (!gma_encoder->ddc_bus) {
281− dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration "
282− "failed.\n");
281+ dev_printk(KERN_ERR, dev->dev, "DDC bus registration failed.\n");
283282 goto failed_ddc;
284283 }
285284
drivers/gpu/drm/gma500/cdv_intel_display.c+1−1
@@ -551,7 +551,7 @@ void cdv_update_wm(struct drm_device *dev, struct drm_crtc *crtc) · 550 unmodified lines
551551 }
552552 }
553553
554−/**
554+/*
555555 * Return the pipe currently connected to the panel fitter,
556556 * or -1 if the panel fitter is not present or not in use
557557 */
drivers/gpu/drm/gma500/cdv_intel_dp.c+2−2
@@ -306,7 +306,7 @@ static uint32_t dp_vswing_premph_table[] = { · 305 unmodified lines
306306 };
307307 /**
308308 * is_edp - is the given port attached to an eDP panel (either CPU or PCH)
309− * @intel_dp: DP struct
309+ * @encoder: GMA encoder struct
310310 *
311311 * If a CPU or PCH DP output is attached to an eDP panel, this function
312312 * will return true, and false otherwise.
@@ -1687,7 +1687,7 @@ static enum drm_connector_status cdv_dp_detect(struct gma_encoder *encoder) · 1374 unmodified lines
16871687 return status;
16881688 }
16891689
1690−/**
1690+/*
16911691 * Uses CRT_HOTPLUG_EN and CRT_HOTPLUG_STAT to detect DP connection.
16921692 *
16931693 * \return true if DP port is connected.
drivers/gpu/drm/gma500/cdv_intel_lvds.c+6−5
@@ -74,7 +74,7 @@ static u32 cdv_intel_lvds_get_max_backlight(struct drm_device *dev) · 73 unmodified lines
7474 return retval;
7575 }
7676
77−/**
77+/*
7878 * Sets the backlight level.
7979 *
8080 * level backlight level, from 0 to cdv_intel_lvds_get_max_backlight().
@@ -99,7 +99,7 @@ static void cdv_intel_lvds_set_backlight(struct drm_device *dev, int level) · 18 unmodified lines
9999 }
100100 }
101101
102−/**
102+/*
103103 * Sets the power state for the panel.
104104 */
105105 static void cdv_intel_lvds_set_power(struct drm_device *dev,
@@ -291,7 +291,7 @@ static void cdv_intel_lvds_mode_set(struct drm_encoder *encoder, · 185 unmodified lines
291291 REG_WRITE(PFIT_CONTROL, pfit_control);
292292 }
293293
294−/**
294+/*
295295 * Return the list of DDC modes if available, or the BIOS fixed mode otherwise.
296296 */
297297 static int cdv_intel_lvds_get_modes(struct drm_connector *connector)
@@ -471,6 +471,7 @@ static bool lvds_is_present_in_vbt(struct drm_device *dev, · 173 unmodified lines
471471 /**
472472 * cdv_intel_lvds_init - setup LVDS connectors on this device
473473 * @dev: drm device
474+ * @mode_dev: PSB mode device
474475 *
475476 * Create the connector, register the LVDS DDC bus, and try to figure out what
476477 * modes we can display on the LVDS panel (if present).
@@ -554,7 +555,7 @@ void cdv_intel_lvds_init(struct drm_device *dev, · 77 unmodified lines
554555 "LVDSBLC_B");
555556 if (!gma_encoder->i2c_bus) {
556557 dev_printk(KERN_ERR,
557− &dev->pdev->dev, "I2C bus registration failed.\n");
558+ dev->dev, "I2C bus registration failed.\n");
558559 goto failed_blc_i2c;
559560 }
560561 gma_encoder->i2c_bus->slave_addr = 0x2C;
@@ -575,7 +576,7 @@ void cdv_intel_lvds_init(struct drm_device *dev, · 14 unmodified lines
575576 GPIOC,
576577 "LVDSDDC_C");
577578 if (!gma_encoder->ddc_bus) {
578− dev_printk(KERN_ERR, &dev->pdev->dev,
579+ dev_printk(KERN_ERR, dev->dev,
579580 "DDC bus registration " "failed.\n");
580581 goto failed_ddc;
581582 }
drivers/gpu/drm/gma500/framebuffer.c+8−7
@@ -159,7 +159,7 @@ static const struct fb_ops psbfb_unaccel_ops = { · 158 unmodified lines
159159 * @dev: our DRM device
160160 * @fb: framebuffer to set up
161161 * @mode_cmd: mode description
162− * @gt: backing object
162+ * @obj: backing object
163163 *
164164 * Configure and fill in the boilerplate for our frame buffer. Return
165165 * 0 on success or an error code if we fail.
@@ -197,7 +197,7 @@ static int psb_framebuffer_init(struct drm_device *dev, · 31 unmodified lines
197197 * psb_framebuffer_create - create a framebuffer backed by gt
198198 * @dev: our DRM device
199199 * @mode_cmd: the description of the requested mode
200− * @gt: the backing object
200+ * @obj: the backing object
201201 *
202202 * Create a framebuffer object backed by the gt, and fill in the
203203 * boilerplate required
@@ -252,7 +252,7 @@ static struct gtt_range *psbfb_alloc(struct drm_device *dev, int aligned_size) · 48 unmodified lines
252252
253253 /**
254254 * psbfb_create - create a framebuffer
255− * @fbdev: the framebuffer device
255+ * @fb_helper: the framebuffer helper
256256 * @sizes: specification of the layout
257257 *
258258 * Create a framebuffer to the specifications provided
@@ -262,6 +262,7 @@ static int psbfb_create(struct drm_fb_helper *fb_helper, · 3 unmodified lines
262262 {
263263 struct drm_device *dev = fb_helper->dev;
264264 struct drm_psb_private *dev_priv = dev->dev_private;
265+ struct pci_dev *pdev = to_pci_dev(dev->dev);
265266 struct fb_info *info;
266267 struct drm_framebuffer *fb;
267268 struct drm_mode_fb_cmd2 mode_cmd;
@@ -325,8 +326,8 @@ static int psbfb_create(struct drm_fb_helper *fb_helper, · 57 unmodified lines
325326
326327 drm_fb_helper_fill_info(info, fb_helper, sizes);
327328
328− info->fix.mmio_start = pci_resource_start(dev->pdev, 0);
329− info->fix.mmio_len = pci_resource_len(dev->pdev, 0);
329+ info->fix.mmio_start = pci_resource_start(pdev, 0);
330+ info->fix.mmio_len = pci_resource_len(pdev, 0);
330331
331332 /* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */
332333
@@ -529,6 +530,7 @@ void psb_modeset_init(struct drm_device *dev) · 196 unmodified lines
529530 {
530531 struct drm_psb_private *dev_priv = dev->dev_private;
531532 struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev;
533+ struct pci_dev *pdev = to_pci_dev(dev->dev);
532534 int i;
533535
534536 drm_mode_config_init(dev);
@@ -540,8 +542,7 @@ void psb_modeset_init(struct drm_device *dev) · 5 unmodified lines
540542
541543 /* set memory base */
542544 /* Oaktrail and Poulsbo should use BAR 2*/
543− pci_read_config_dword(dev->pdev, PSB_BSM, (u32 *)
544− &(dev->mode_config.fb_base));
545+ pci_read_config_dword(pdev, PSB_BSM, (u32 *)&(dev->mode_config.fb_base));
545546
546547 /* num pipes is 2 for PSB but 1 for Mrst */
547548 for (i = 0; i < dev_priv->num_pipe; i++)
drivers/gpu/drm/gma500/gem.c+4−2
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #include <drm/drm.h>
1717 #include <drm/drm_vma_manager.h>
1818
19+#include "gem.h"
1920 #include "psb_drv.h"
2021
2122 static vm_fault_t psb_gem_fault(struct vm_fault *vmf);
@@ -49,6 +50,8 @@ const struct drm_gem_object_funcs psb_gem_object_funcs = { · 27 unmodified lines
4950 * @dev: our device
5051 * @size: the size requested
5152 * @handlep: returned handle (opaque number)
53+ * @stolen: unused
54+ * @align: unused
5255 *
5356 * Create a GEM object, fill in the boilerplate and attach a handle to
5457 * it so that userspace can speak about it. This does the core work
@@ -97,7 +100,7 @@ int psb_gem_create(struct drm_file *file, struct drm_device *dev, u64 size, · 42 unmodified lines
97100
98101 /**
99102 * psb_gem_dumb_create - create a dumb buffer
100− * @drm_file: our client file
103+ * @file: our client file
101104 * @dev: our device
102105 * @args: the requested arguments copied from userspace
103106 *
@@ -116,7 +119,6 @@ int psb_gem_dumb_create(struct drm_file *file, struct drm_device *dev, · 12 unmodified lines
116119
117120 /**
118121 * psb_gem_fault - pagefault handler for GEM objects
119− * @vma: the VMA of the GEM object
120122 * @vmf: fault detail
121123 *
122124 * Invoked when a fault occurs on an mmap of a GEM managed area. GEM
drivers/gpu/drm/gma500/gem.h+2−0
@@ -8,6 +8,8 @@ · 7 unmodified lines
88 #ifndef _GEM_H
99 #define _GEM_H
1010
11+struct drm_device;
12+
1113 extern const struct drm_gem_object_funcs psb_gem_object_funcs;
1214
1315 extern int psb_gem_create(struct drm_file *file, struct drm_device *dev,
drivers/gpu/drm/gma500/gma_device.c+3−1
@@ -6,12 +6,14 @@ · 5 unmodified lines
66 **************************************************************************/
77
88 #include "psb_drv.h"
9+#include "gma_device.h"
910
1011 void gma_get_core_freq(struct drm_device *dev)
1112 {
1213 uint32_t clock;
14+ struct pci_dev *pdev = to_pci_dev(dev->dev);
1315 struct pci_dev *pci_root =
14− pci_get_domain_bus_and_slot(pci_domain_nr(dev->pdev->bus),
16+ pci_get_domain_bus_and_slot(pci_domain_nr(pdev->bus),
1517 0, 0);
1618 struct drm_psb_private *dev_priv = dev->dev_private;
1719
drivers/gpu/drm/gma500/gma_display.c+6−6
@@ -20,7 +20,7 @@ · 19 unmodified lines
2020 #include "psb_intel_drv.h"
2121 #include "psb_intel_reg.h"
2222
23−/**
23+/*
2424 * Returns whether any output on the specified pipe is of the specified type
2525 */
2626 bool gma_pipe_has_type(struct drm_crtc *crtc, int type)
@@ -180,7 +180,7 @@ int gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue, · 153 unmodified lines
180180 return 0;
181181 }
182182
183−/**
183+/*
184184 * Sets the power management mode of the pipe and plane.
185185 *
186186 * This code should probably grow support for turning the cursor off and back
@@ -559,14 +559,14 @@ int gma_crtc_set_config(struct drm_mode_set *set, · 372 unmodified lines
559559 if (!dev_priv->rpm_enabled)
560560 return drm_crtc_helper_set_config(set, ctx);
561561
562− pm_runtime_forbid(&dev->pdev->dev);
562+ pm_runtime_forbid(dev->dev);
563563 ret = drm_crtc_helper_set_config(set, ctx);
564− pm_runtime_allow(&dev->pdev->dev);
564+ pm_runtime_allow(dev->dev);
565565
566566 return ret;
567567 }
568568
569−/**
569+/*
570570 * Save HW states of given crtc
571571 */
572572 void gma_crtc_save(struct drm_crtc *crtc)
@@ -609,7 +609,7 @@ void gma_crtc_save(struct drm_crtc *crtc) · 36 unmodified lines
609609 crtc_state->savePalette[i] = REG_READ(palette_reg + (i << 2));
610610 }
611611
612−/**
612+/*
613613 * Restore HW states of given crtc
614614 */
615615 void gma_crtc_restore(struct drm_crtc *crtc)
drivers/gpu/drm/gma500/gtt.c+11−9
@@ -340,13 +340,14 @@ static void psb_gtt_alloc(struct drm_device *dev) · 339 unmodified lines
340340 void psb_gtt_takedown(struct drm_device *dev)
341341 {
342342 struct drm_psb_private *dev_priv = dev->dev_private;
343+ struct pci_dev *pdev = to_pci_dev(dev->dev);
343344
344345 if (dev_priv->gtt_map) {
345346 iounmap(dev_priv->gtt_map);
346347 dev_priv->gtt_map = NULL;
347348 }
348349 if (dev_priv->gtt_initialized) {
349− pci_write_config_word(dev->pdev, PSB_GMCH_CTRL,
350+ pci_write_config_word(pdev, PSB_GMCH_CTRL,
350351 dev_priv->gmch_ctrl);
351352 PSB_WVDC32(dev_priv->pge_ctl, PSB_PGETBL_CTL);
352353 (void) PSB_RVDC32(PSB_PGETBL_CTL);
@@ -358,6 +359,7 @@ void psb_gtt_takedown(struct drm_device *dev) · 5 unmodified lines
358359 int psb_gtt_init(struct drm_device *dev, int resume)
359360 {
360361 struct drm_psb_private *dev_priv = dev->dev_private;
362+ struct pci_dev *pdev = to_pci_dev(dev->dev);
361363 unsigned gtt_pages;
362364 unsigned long stolen_size, vram_stolen_size;
363365 unsigned i, num_pages;
@@ -376,8 +378,8 @@ int psb_gtt_init(struct drm_device *dev, int resume) · 12 unmodified lines
376378 pg = &dev_priv->gtt;
377379
378380 /* Enable the GTT */
379− pci_read_config_word(dev->pdev, PSB_GMCH_CTRL, &dev_priv->gmch_ctrl);
380− pci_write_config_word(dev->pdev, PSB_GMCH_CTRL,
381+ pci_read_config_word(pdev, PSB_GMCH_CTRL, &dev_priv->gmch_ctrl);
382+ pci_write_config_word(pdev, PSB_GMCH_CTRL,
381383 dev_priv->gmch_ctrl | _PSB_GMCH_ENABLED);
382384
383385 dev_priv->pge_ctl = PSB_RVDC32(PSB_PGETBL_CTL);
@@ -397,8 +399,8 @@ int psb_gtt_init(struct drm_device *dev, int resume) · 13 unmodified lines
397399 */
398400 pg->mmu_gatt_start = 0xE0000000;
399401
400− pg->gtt_start = pci_resource_start(dev->pdev, PSB_GTT_RESOURCE);
401− gtt_pages = pci_resource_len(dev->pdev, PSB_GTT_RESOURCE)
402+ pg->gtt_start = pci_resource_start(pdev, PSB_GTT_RESOURCE);
403+ gtt_pages = pci_resource_len(pdev, PSB_GTT_RESOURCE)
402404 >> PAGE_SHIFT;
403405 /* CDV doesn't report this. In which case the system has 64 gtt pages */
404406 if (pg->gtt_start == 0 || gtt_pages == 0) {
@@ -407,10 +409,10 @@ int psb_gtt_init(struct drm_device *dev, int resume) · 2 unmodified lines
407409 pg->gtt_start = dev_priv->pge_ctl;
408410 }
409411
410− pg->gatt_start = pci_resource_start(dev->pdev, PSB_GATT_RESOURCE);
411− pg->gatt_pages = pci_resource_len(dev->pdev, PSB_GATT_RESOURCE)
412+ pg->gatt_start = pci_resource_start(pdev, PSB_GATT_RESOURCE);
413+ pg->gatt_pages = pci_resource_len(pdev, PSB_GATT_RESOURCE)
412414 >> PAGE_SHIFT;
413− dev_priv->gtt_mem = &dev->pdev->resource[PSB_GATT_RESOURCE];
415+ dev_priv->gtt_mem = &pdev->resource[PSB_GATT_RESOURCE];
414416
415417 if (pg->gatt_pages == 0 || pg->gatt_start == 0) {
416418 static struct resource fudge; /* Preferably peppermint */
@@ -431,7 +433,7 @@ int psb_gtt_init(struct drm_device *dev, int resume) · 14 unmodified lines
431433 dev_priv->gtt_mem = &fudge;
432434 }
433435
434− pci_read_config_dword(dev->pdev, PSB_BSM, &dev_priv->stolen_base);
436+ pci_read_config_dword(pdev, PSB_BSM, &dev_priv->stolen_base);
435437 vram_stolen_size = pg->gtt_phys_start - dev_priv->stolen_base
436438 - PAGE_SIZE;
437439
drivers/gpu/drm/gma500/intel_bios.c+4−4
@@ -50,7 +50,7 @@ parse_edp(struct drm_psb_private *dev_priv, struct bdb_header *bdb) · 49 unmodified lines
5050 uint8_t panel_type;
5151
5252 edp = find_section(bdb, BDB_EDP);
53−
53+
5454 dev_priv->edp.bpp = 18;
5555 if (!edp) {
5656 if (dev_priv->edp.support) {
@@ -80,7 +80,7 @@ parse_edp(struct drm_psb_private *dev_priv, struct bdb_header *bdb) · 23 unmodified lines
8080 dev_priv->edp.pps = *edp_pps;
8181
8282 DRM_DEBUG_KMS("EDP timing in vbt t1_t3 %d t8 %d t9 %d t10 %d t11_t12 %d\n",
83− dev_priv->edp.pps.t1_t3, dev_priv->edp.pps.t8,
83+ dev_priv->edp.pps.t1_t3, dev_priv->edp.pps.t8,
8484 dev_priv->edp.pps.t9, dev_priv->edp.pps.t10,
8585 dev_priv->edp.pps.t11_t12);
8686
@@ -516,7 +516,7 @@ parse_device_mapping(struct drm_psb_private *dev_priv, · 429 unmodified lines
516516 int psb_intel_init_bios(struct drm_device *dev)
517517 {
518518 struct drm_psb_private *dev_priv = dev->dev_private;
519− struct pci_dev *pdev = dev->pdev;
519+ struct pci_dev *pdev = to_pci_dev(dev->dev);
520520 struct vbt_header *vbt = NULL;
521521 struct bdb_header *bdb = NULL;
522522 u8 __iomem *bios = NULL;
@@ -574,7 +574,7 @@ int psb_intel_init_bios(struct drm_device *dev) · 51 unmodified lines
574574 return 0;
575575 }
576576
577−/**
577+/*
578578 * Destroy and free VBT data
579579 */
580580 void psb_intel_destroy_bios(struct drm_device *dev)
drivers/gpu/drm/gma500/intel_gmbus.c+2−2
@@ -196,7 +196,7 @@ intel_gpio_create(struct drm_psb_private *dev_priv, u32 pin) · 195 unmodified lines
196196 "gma500 GPIO%c", "?BACDE?F"[pin]);
197197 gpio->adapter.owner = THIS_MODULE;
198198 gpio->adapter.algo_data = &gpio->algo;
199− gpio->adapter.dev.parent = &dev_priv->dev->pdev->dev;
199+ gpio->adapter.dev.parent = dev_priv->dev->dev;
200200 gpio->algo.setsda = set_data;
201201 gpio->algo.setscl = set_clock;
202202 gpio->algo.getsda = get_data;
@@ -417,7 +417,7 @@ int gma_intel_setup_gmbus(struct drm_device *dev) · 214 unmodified lines
417417 "gma500 gmbus %s",
418418 names[i]);
419419
420− bus->adapter.dev.parent = &dev->pdev->dev;
420+ bus->adapter.dev.parent = dev->dev;
421421 bus->adapter.algo_data = dev_priv;
422422
423423 bus->adapter.algo = &gmbus_algorithm;
drivers/gpu/drm/gma500/intel_i2c.c+2−3
@@ -85,7 +85,6 @@ static void set_data(void *data, int state_high) · 84 unmodified lines
8585 /**
8686 * psb_intel_i2c_create - instantiate an Intel i2c bus using the specified GPIO reg
8787 * @dev: DRM device
88− * @output: driver specific output device
8988 * @reg: GPIO reg to use
9089 * @name: name for this bus
9190 *
@@ -117,7 +116,7 @@ struct psb_intel_i2c_chan *psb_intel_i2c_create(struct drm_device *dev, · 25 unmodified lines
117116 snprintf(chan->adapter.name, I2C_NAME_SIZE, "intel drm %s", name);
118117 chan->adapter.owner = THIS_MODULE;
119118 chan->adapter.algo_data = &chan->algo;
120− chan->adapter.dev.parent = &dev->pdev->dev;
119+ chan->adapter.dev.parent = dev->dev;
121120 chan->algo.setsda = set_data;
122121 chan->algo.setscl = set_clock;
123122 chan->algo.getsda = get_data;
@@ -145,7 +144,7 @@ out_free: · 21 unmodified lines
145144
146145 /**
147146 * psb_intel_i2c_destroy - unregister and free i2c bus resources
148− * @output: channel to free
147+ * @chan: channel to free
149148 *
150149 * Unregister the adapter from the i2c layer, then free the structure.
151150 */
drivers/gpu/drm/gma500/mdfld_device.c+3−1
@@ -523,7 +523,9 @@ static struct gpiod_lookup_table mdfld_dsi_pipe_gpio_table = { · 522 unmodified lines
523523 static int mdfld_chip_setup(struct drm_device *dev)
524524 {
525525 struct drm_psb_private *dev_priv = dev->dev_private;
526− if (pci_enable_msi(dev->pdev))
526+ struct pci_dev *pdev = to_pci_dev(dev->dev);
527+
528+ if (pci_enable_msi(pdev))
527529 dev_warn(dev->dev, "Enabling MSI failed!\n");
528530 dev_priv->regmap = mdfld_regmap;
529531
drivers/gpu/drm/gma500/mdfld_dsi_dpi.c+4−4
@@ -138,7 +138,7 @@ static void dsi_set_pipe_plane_enable_state(struct drm_device *dev, · 137 unmodified lines
138138 REG_WRITE(pipeconf_reg, BIT(31));
139139
140140 if (REG_BIT_WAIT(pipeconf_reg, 1, 30))
141− dev_err(&dev->pdev->dev, "%s: Pipe enable timeout\n",
141+ dev_err(dev->dev, "%s: Pipe enable timeout\n",
142142 __func__);
143143
144144 /*Set up display plane */
@@ -165,11 +165,11 @@ static void dsi_set_pipe_plane_enable_state(struct drm_device *dev, · 20 unmodified lines
165165 REG_FLD_MOD(pipeconf_reg, 0, 31, 31);
166166
167167 if (REG_BIT_WAIT(pipeconf_reg, 0, 30))
168− dev_err(&dev->pdev->dev, "%s: Pipe disable timeout\n",
168+ dev_err(dev->dev, "%s: Pipe disable timeout\n",
169169 __func__);
170170
171171 if (REG_BIT_WAIT(MIPI_GEN_FIFO_STAT_REG(pipe), 1, 28))
172− dev_err(&dev->pdev->dev, "%s: FIFO not empty\n",
172+ dev_err(dev->dev, "%s: FIFO not empty\n",
173173 __func__);
174174 }
175175 }
@@ -867,7 +867,7 @@ void mdfld_dsi_dpi_mode_set(struct drm_encoder *encoder, · 691 unmodified lines
867867 REG_WRITE(MRST_DPLL_A, 0x80800000);
868868
869869 if (REG_BIT_WAIT(pipeconf_reg, 1, 29))
870− dev_err(&dev->pdev->dev, "%s: DSI PLL lock timeout\n",
870+ dev_err(dev->dev, "%s: DSI PLL lock timeout\n",
871871 __func__);
872872
873873 REG_WRITE(MIPI_DPHY_PARAM_REG(pipe), 0x2A0c6008);
drivers/gpu/drm/gma500/mdfld_dsi_output.c+2−2
@@ -63,7 +63,7 @@ static int __init parse_LABC_control(char *arg) · 62 unmodified lines
6363 early_param("LABC", parse_LABC_control);
6464 #endif
6565
66−/**
66+/*
6767 * Check and see if the generic control or data buffer is empty and ready.
6868 */
6969 void mdfld_dsi_gen_fifo_ready(struct drm_device *dev, u32 gen_fifo_stat_reg,
@@ -85,7 +85,7 @@ void mdfld_dsi_gen_fifo_ready(struct drm_device *dev, u32 gen_fifo_stat_reg, · 15 unmodified lines
8585 gen_fifo_stat_reg);
8686 }
8787
88−/**
88+/*
8989 * Manage the DSI MIPI keyboard and display brightness.
9090 * FIXME: this is exported to OSPM code. should work out an specific
9191 * display interface to OSPM.
drivers/gpu/drm/gma500/mdfld_intel_display.c+3−3
@@ -95,7 +95,7 @@ void mdfldWaitForPipeEnable(struct drm_device *dev, int pipe) · 94 unmodified lines
9595 }
9696 }
9797
98−/**
98+/*
9999 * Return the pipe currently connected to the panel fitter,
100100 * or -1 if the panel fitter is not present or not in use
101101 */
@@ -263,7 +263,7 @@ void mdfld_disable_crtc(struct drm_device *dev, int pipe) · 161 unmodified lines
263263
264264 }
265265
266−/**
266+/*
267267 * Sets the power management mode of the pipe and plane.
268268 *
269269 * This code should probably grow support for turning the cursor off and back
@@ -599,7 +599,7 @@ static void mdfld_clock(int refclk, struct mrst_clock_t *clock) · 329 unmodified lines
599599 clock->dot = (refclk * clock->m) / clock->p1;
600600 }
601601
602−/**
602+/*
603603 * Returns a set of divisors for the desired target clock with the given refclk,
604604 * or FALSE. Divisor values are the actual divisors for
605605 */
drivers/gpu/drm/gma500/mid_bios.c+6−3
@@ -19,8 +19,9 @@ · 18 unmodified lines
1919 static void mid_get_fuse_settings(struct drm_device *dev)
2020 {
2121 struct drm_psb_private *dev_priv = dev->dev_private;
22+ struct pci_dev *pdev = to_pci_dev(dev->dev);
2223 struct pci_dev *pci_root =
23− pci_get_domain_bus_and_slot(pci_domain_nr(dev->pdev->bus),
24+ pci_get_domain_bus_and_slot(pci_domain_nr(pdev->bus),
2425 0, 0);
2526 uint32_t fuse_value = 0;
2627 uint32_t fuse_value_tmp = 0;
@@ -93,7 +94,8 @@ static void mid_get_fuse_settings(struct drm_device *dev) · 66 unmodified lines
9394 static void mid_get_pci_revID(struct drm_psb_private *dev_priv)
9495 {
9596 uint32_t platform_rev_id = 0;
96− int domain = pci_domain_nr(dev_priv->dev->pdev->bus);
97+ struct pci_dev *pdev = to_pci_dev(dev_priv->dev->dev);
98+ int domain = pci_domain_nr(pdev->bus);
9799 struct pci_dev *pci_gfx_root =
98100 pci_get_domain_bus_and_slot(domain, 0, PCI_DEVFN(2, 0));
99101
@@ -269,11 +271,12 @@ out: · 169 unmodified lines
269271 static void mid_get_vbt_data(struct drm_psb_private *dev_priv)
270272 {
271273 struct drm_device *dev = dev_priv->dev;
274+ struct pci_dev *pdev = to_pci_dev(dev->dev);
272275 u32 addr;
273276 u8 __iomem *vbt_virtual;
274277 struct mid_vbt_header vbt_header;
275278 struct pci_dev *pci_gfx_root =
276− pci_get_domain_bus_and_slot(pci_domain_nr(dev->pdev->bus),
279+ pci_get_domain_bus_and_slot(pci_domain_nr(pdev->bus),
277280 0, PCI_DEVFN(2, 0));
278281 int ret = -1;
279282
drivers/gpu/drm/gma500/mmu.c+3−12
@@ -313,8 +313,8 @@ static struct psb_mmu_pt *psb_mmu_alloc_pt(struct psb_mmu_pd *pd) · 312 unmodified lines
313313 return pt;
314314 }
315315
316−struct psb_mmu_pt *psb_mmu_pt_alloc_map_lock(struct psb_mmu_pd *pd,
317− unsigned long addr)
316+static struct psb_mmu_pt *psb_mmu_pt_alloc_map_lock(struct psb_mmu_pd *pd,
317+ unsigned long addr)
318318 {
319319 uint32_t index = psb_mmu_pd_index(addr);
320320 struct psb_mmu_pt *pt;
@@ -416,15 +416,6 @@ struct psb_mmu_pd *psb_mmu_get_default_pd(struct psb_mmu_driver *driver) · 95 unmodified lines
416416 return pd;
417417 }
418418
419−/* Returns the physical address of the PD shared by sgx/msvdx */
420−uint32_t psb_get_default_pd_addr(struct psb_mmu_driver *driver)
421−{
422− struct psb_mmu_pd *pd;
423−
424− pd = psb_mmu_get_default_pd(driver);
425− return page_to_pfn(pd->p) << PAGE_SHIFT;
426−}
427−
428419 void psb_mmu_driver_takedown(struct psb_mmu_driver *driver)
429420 {
430421 struct drm_device *dev = driver->dev;
@@ -690,7 +681,7 @@ out: · 259 unmodified lines
690681 if (pd->hw_context != -1)
691682 psb_mmu_flush(pd->driver);
692683
693− return 0;
684+ return ret;
694685 }
695686
696687 int psb_mmu_insert_pages(struct psb_mmu_pd *pd, struct page **pages,
drivers/gpu/drm/gma500/oaktrail_crtc.c+3−3
@@ -174,7 +174,7 @@ static bool mrst_sdvo_find_best_pll(const struct gma_limit_t *limit, · 173 unmodified lines
174174 return min_error == 0;
175175 }
176176
177−/**
177+/*
178178 * Returns a set of divisors for the desired target clock with the given refclk,
179179 * or FALSE. Divisor values are the actual divisors for
180180 */
@@ -205,7 +205,7 @@ static bool mrst_lvds_find_best_pll(const struct gma_limit_t *limit, · 24 unmodified lines
205205 return err != target;
206206 }
207207
208−/**
208+/*
209209 * Sets the power management mode of the pipe and plane.
210210 *
211211 * This code should probably grow support for turning the cursor off and back
@@ -337,7 +337,7 @@ static void oaktrail_crtc_dpms(struct drm_crtc *crtc, int mode) · 125 unmodified lines
337337 gma_power_end(dev);
338338 }
339339
340−/**
340+/*
341341 * Return the pipe currently connected to the panel fitter,
342342 * or -1 if the panel fitter is not present or not in use
343343 */
drivers/gpu/drm/gma500/oaktrail_device.c+3−2
@@ -504,9 +504,10 @@ static const struct psb_offset oaktrail_regmap[2] = { · 503 unmodified lines
504504 static int oaktrail_chip_setup(struct drm_device *dev)
505505 {
506506 struct drm_psb_private *dev_priv = dev->dev_private;
507+ struct pci_dev *pdev = to_pci_dev(dev->dev);
507508 int ret;
508−
509− if (pci_enable_msi(dev->pdev))
509+
510+ if (pci_enable_msi(pdev))
510511 dev_warn(dev->dev, "Enabling MSI failed!\n");
511512
512513 dev_priv->regmap = oaktrail_regmap;
drivers/gpu/drm/gma500/oaktrail_lvds.c+3−2
@@ -29,7 +29,7 @@ · 28 unmodified lines
2929 #define MRST_BLC_MAX_PWM_REG_FREQ 0xFFFF
3030 #define BRIGHTNESS_MAX_LEVEL 100
3131
32−/**
32+/*
3333 * Sets the power state for the panel.
3434 */
3535 static void oaktrail_lvds_set_power(struct drm_device *dev,
@@ -60,7 +60,7 @@ static void oaktrail_lvds_set_power(struct drm_device *dev, · 24 unmodified lines
6060 pp_status = REG_READ(PP_STATUS);
6161 } while (pp_status & PP_ON);
6262 dev_priv->is_lvds_on = false;
63− pm_request_idle(&dev->pdev->dev);
63+ pm_request_idle(dev->dev);
6464 }
6565 gma_power_end(dev);
6666 }
@@ -282,6 +282,7 @@ static void oaktrail_lvds_get_configuration_mode(struct drm_device *dev, · 215 unmodified lines
282282 /**
283283 * oaktrail_lvds_init - setup LVDS connectors on this device
284284 * @dev: drm device
285+ * @mode_dev: PSB mode device
285286 *
286287 * Create the connector, register the LVDS DDC bus, and try to figure out what
287288 * modes we can display on the LVDS panel (if present).
drivers/gpu/drm/gma500/oaktrail_lvds_i2c.c+5−5
@@ -66,12 +66,12 @@ · 65 unmodified lines
6666 static int get_clock(void *data)
6767 {
6868 struct psb_intel_i2c_chan *chan = data;
69− u32 val, tmp;
69+ u32 val;
7070
7171 val = LPC_READ_REG(chan, RGIO);
7272 val |= GPIO_CLOCK;
7373 LPC_WRITE_REG(chan, RGIO, val);
74− tmp = LPC_READ_REG(chan, RGLVL);
74+ LPC_READ_REG(chan, RGLVL);
7575 val = (LPC_READ_REG(chan, RGLVL) & GPIO_CLOCK) ? 1 : 0;
7676
7777 return val;
@@ -80,12 +80,12 @@ static int get_clock(void *data) · 2 unmodified lines
8080 static int get_data(void *data)
8181 {
8282 struct psb_intel_i2c_chan *chan = data;
83− u32 val, tmp;
83+ u32 val;
8484
8585 val = LPC_READ_REG(chan, RGIO);
8686 val |= GPIO_DATA;
8787 LPC_WRITE_REG(chan, RGIO, val);
88− tmp = LPC_READ_REG(chan, RGLVL);
88+ LPC_READ_REG(chan, RGLVL);
8989 val = (LPC_READ_REG(chan, RGLVL) & GPIO_DATA) ? 1 : 0;
9090
9191 return val;
@@ -145,7 +145,7 @@ void oaktrail_lvds_i2c_init(struct drm_encoder *encoder) · 53 unmodified lines
145145 strncpy(chan->adapter.name, "gma500 LPC", I2C_NAME_SIZE - 1);
146146 chan->adapter.owner = THIS_MODULE;
147147 chan->adapter.algo_data = &chan->algo;
148− chan->adapter.dev.parent = &dev->pdev->dev;
148+ chan->adapter.dev.parent = dev->dev;
149149 chan->algo.setsda = set_data;
150150 chan->algo.setscl = set_clock;
151151 chan->algo.getsda = get_data;
drivers/gpu/drm/gma500/opregion.c+2−1
@@ -305,12 +305,13 @@ void psb_intel_opregion_fini(struct drm_device *dev) · 304 unmodified lines
305305 int psb_intel_opregion_setup(struct drm_device *dev)
306306 {
307307 struct drm_psb_private *dev_priv = dev->dev_private;
308+ struct pci_dev *pdev = to_pci_dev(dev->dev);
308309 struct psb_intel_opregion *opregion = &dev_priv->opregion;
309310 u32 opregion_phy, mboxes;
310311 void __iomem *base;
311312 int err = 0;
312313
313− pci_read_config_dword(dev->pdev, PCI_ASLS, &opregion_phy);
314+ pci_read_config_dword(pdev, PCI_ASLS, &opregion_phy);
314315 if (opregion_phy == 0) {
315316 DRM_DEBUG_DRIVER("ACPI Opregion not supported\n");
316317 return -ENOTSUPP;
drivers/gpu/drm/gma500/power.c+11−10
@@ -70,8 +70,8 @@ void gma_power_init(struct drm_device *dev) · 69 unmodified lines
7070 */
7171 void gma_power_uninit(struct drm_device *dev)
7272 {
73− pm_runtime_disable(&dev->pdev->dev);
74− pm_runtime_set_suspended(&dev->pdev->dev);
73+ pm_runtime_disable(dev->dev);
74+ pm_runtime_set_suspended(dev->dev);
7575 }
7676
7777 /**
@@ -93,6 +93,7 @@ static void gma_suspend_display(struct drm_device *dev) · 15 unmodified lines
9393
9494 /**
9595 * gma_resume_display - resume display side logic
96+ * @pdev: PCI device
9697 *
9798 * Resume the display hardware restoring state and enabling
9899 * as necessary.
@@ -146,7 +147,7 @@ static void gma_suspend_pci(struct pci_dev *pdev) · 47 unmodified lines
146147
147148 /**
148149 * gma_resume_pci - resume helper
149− * @dev: our PCI device
150+ * @pdev: our PCI device
150151 *
151152 * Perform the resume processing on our PCI device state - rewrite
152153 * register state and re-enable the PCI device
@@ -178,8 +179,7 @@ static bool gma_resume_pci(struct pci_dev *pdev) · 25 unmodified lines
178179
179180 /**
180181 * gma_power_suspend - bus callback for suspend
181− * @pdev: our PCI device
182− * @state: suspend type
182+ * @_dev: our device
183183 *
184184 * Called back by the PCI layer during a suspend of the system. We
185185 * perform the necessary shut down steps and save enough state that
@@ -208,7 +208,7 @@ int gma_power_suspend(struct device *_dev) · 22 unmodified lines
208208
209209 /**
210210 * gma_power_resume - resume power
211− * @pdev: PCI device
211+ * @_dev: our device
212212 *
213213 * Resume the PCI side of the graphics and then the displays
214214 */
@@ -249,6 +249,7 @@ bool gma_power_is_on(struct drm_device *dev) · 34 unmodified lines
249249 bool gma_power_begin(struct drm_device *dev, bool force_on)
250250 {
251251 struct drm_psb_private *dev_priv = dev->dev_private;
252+ struct pci_dev *pdev = to_pci_dev(dev->dev);
252253 int ret;
253254 unsigned long flags;
254255
@@ -256,7 +257,7 @@ bool gma_power_begin(struct drm_device *dev, bool force_on) · 1 unmodified line
256257 /* Power already on ? */
257258 if (dev_priv->display_power) {
258259 dev_priv->display_count++;
259− pm_runtime_get(&dev->pdev->dev);
260+ pm_runtime_get(dev->dev);
260261 spin_unlock_irqrestore(&power_ctrl_lock, flags);
261262 return true;
262263 }
@@ -264,11 +265,11 @@ bool gma_power_begin(struct drm_device *dev, bool force_on) · 1 unmodified line
264265 goto out_false;
265266
266267 /* Ok power up needed */
267− ret = gma_resume_pci(dev->pdev);
268+ ret = gma_resume_pci(pdev);
268269 if (ret == 0) {
269270 psb_irq_preinstall(dev);
270271 psb_irq_postinstall(dev);
271− pm_runtime_get(&dev->pdev->dev);
272+ pm_runtime_get(dev->dev);
272273 dev_priv->display_count++;
273274 spin_unlock_irqrestore(&power_ctrl_lock, flags);
274275 return true;
@@ -293,7 +294,7 @@ void gma_power_end(struct drm_device *dev) · 18 unmodified lines
293294 dev_priv->display_count--;
294295 WARN_ON(dev_priv->display_count < 0);
295296 spin_unlock_irqrestore(&power_ctrl_lock, flags);
296− pm_runtime_put(&dev->pdev->dev);
297+ pm_runtime_put(dev->dev);
297298 }
298299
299300 int psb_runtime_suspend(struct device *dev)
drivers/gpu/drm/gma500/psb_drv.c+8−8
@@ -208,6 +208,7 @@ static void psb_driver_unload(struct drm_device *dev) · 207 unmodified lines
208208
209209 static int psb_driver_load(struct drm_device *dev, unsigned long flags)
210210 {
211+ struct pci_dev *pdev = to_pci_dev(dev->dev);
211212 struct drm_psb_private *dev_priv;
212213 unsigned long resource_start, resource_len;
213214 unsigned long irqflags;
@@ -227,11 +228,11 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags) · 13 unmodified lines
227228
228229 pg = &dev_priv->gtt;
229230
230− pci_set_master(dev->pdev);
231+ pci_set_master(pdev);
231232
232233 dev_priv->num_pipe = dev_priv->ops->pipes;
233234
234− resource_start = pci_resource_start(dev->pdev, PSB_MMIO_RESOURCE);
235+ resource_start = pci_resource_start(pdev, PSB_MMIO_RESOURCE);
235236
236237 dev_priv->vdc_reg =
237238 ioremap(resource_start + PSB_VDC_OFFSET, PSB_VDC_SIZE);
@@ -244,7 +245,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags) · 6 unmodified lines
244245 goto out_err;
245246
246247 if (IS_MRST(dev)) {
247− int domain = pci_domain_nr(dev->pdev->bus);
248+ int domain = pci_domain_nr(pdev->bus);
248249
249250 dev_priv->aux_pdev =
250251 pci_get_domain_bus_and_slot(domain, 0,
@@ -361,7 +362,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags) · 110 unmodified lines
361362 PSB_WVDC32(0xFFFFFFFF, PSB_INT_MASK_R);
362363 spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags);
363364
364− drm_irq_install(dev, dev->pdev->irq);
365+ drm_irq_install(dev, pdev->irq);
365366
366367 dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
367368
@@ -387,8 +388,8 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags) · 19 unmodified lines
387388 psb_intel_opregion_enable_asle(dev);
388389 #if 0
389390 /* Enable runtime pm at last */
390− pm_runtime_enable(&dev->pdev->dev);
391− pm_runtime_set_active(&dev->pdev->dev);
391+ pm_runtime_enable(dev->dev);
392+ pm_runtime_set_active(dev->dev);
392393 #endif
393394 /* Intel drm driver load is done, continue doing pvr load */
394395 return 0;
@@ -417,7 +418,7 @@ static long psb_unlocked_ioctl(struct file *filp, unsigned int cmd, · 22 unmodified lines
417418
418419 if (runtime_allowed == 1 && dev_priv->is_lvds_on) {
419420 runtime_allowed++;
420− pm_runtime_allow(&dev->pdev->dev);
421+ pm_runtime_allow(dev->dev);
421422 dev_priv->rpm_enabled = 1;
422423 }
423424 return drm_ioctl(filp, cmd, arg);
@@ -439,7 +440,6 @@ static int psb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 15 unmodified lines
439440 goto err_pci_disable_device;
440441 }
441442
442− dev->pdev = pdev;
443443 pci_set_drvdata(pdev, dev);
444444
445445 ret = psb_driver_load(dev, ent->driver_data);
drivers/gpu/drm/gma500/psb_drv.h+4−4
@@ -43,10 +43,10 @@ enum { · 42 unmodified lines
4343 CHIP_MFLD_0130 = 3, /* Medfield */
4444 };
4545
46−#define IS_PSB(dev) (((dev)->pdev->device & 0xfffe) == 0x8108)
47−#define IS_MRST(dev) (((dev)->pdev->device & 0xfff0) == 0x4100)
48−#define IS_MFLD(dev) (((dev)->pdev->device & 0xfff8) == 0x0130)
49−#define IS_CDV(dev) (((dev)->pdev->device & 0xfff0) == 0x0be0)
46+#define IS_PSB(drm) ((to_pci_dev((drm)->dev)->device & 0xfffe) == 0x8108)
47+#define IS_MRST(drm) ((to_pci_dev((drm)->dev)->device & 0xfff0) == 0x4100)
48+#define IS_MFLD(drm) ((to_pci_dev((drm)->dev)->device & 0xfff8) == 0x0130)
49+#define IS_CDV(drm) ((to_pci_dev((drm)->dev)->device & 0xfff0) == 0x0be0)
5050
5151 /* Hardware offsets */
5252 #define PSB_VDC_OFFSET 0x00000000
drivers/gpu/drm/gma500/psb_intel_display.c+1−1
@@ -71,7 +71,7 @@ static void psb_intel_clock(int refclk, struct gma_clock_t *clock) · 70 unmodified lines
7171 clock->dot = clock->vco / clock->p;
7272 }
7373
74−/**
74+/*
7575 * Return the pipe currently connected to the panel fitter,
7676 * or -1 if the panel fitter is not present or not in use
7777 */
drivers/gpu/drm/gma500/psb_intel_lvds.c+4−3
@@ -216,7 +216,7 @@ static void psb_intel_lvds_set_power(struct drm_device *dev, bool on) · 215 unmodified lines
216216 dev_err(dev->dev, "set power, chip off!\n");
217217 return;
218218 }
219−
219+
220220 if (on) {
221221 REG_WRITE(PP_CONTROL, REG_READ(PP_CONTROL) |
222222 POWER_TARGET_ON);
@@ -626,6 +626,7 @@ const struct drm_connector_funcs psb_intel_lvds_connector_funcs = { · 403 unmodified lines
626626 /**
627627 * psb_intel_lvds_init - setup LVDS connectors on this device
628628 * @dev: drm device
629+ * @mode_dev: mode device
629630 *
630631 * Create the connector, register the LVDS DDC bus, and try to figure out what
631632 * modes we can display on the LVDS panel (if present).
@@ -700,7 +701,7 @@ void psb_intel_lvds_init(struct drm_device *dev, · 68 unmodified lines
700701 lvds_priv->i2c_bus = psb_intel_i2c_create(dev, GPIOB, "LVDSBLC_B");
701702 if (!lvds_priv->i2c_bus) {
702703 dev_printk(KERN_ERR,
703− &dev->pdev->dev, "I2C bus registration failed.\n");
704+ dev->dev, "I2C bus registration failed.\n");
704705 goto failed_blc_i2c;
705706 }
706707 lvds_priv->i2c_bus->slave_addr = 0x2C;
@@ -719,7 +720,7 @@ void psb_intel_lvds_init(struct drm_device *dev, · 12 unmodified lines
719720 /* Set up the DDC bus. */
720721 lvds_priv->ddc_bus = psb_intel_i2c_create(dev, GPIOC, "LVDSDDC_C");
721722 if (!lvds_priv->ddc_bus) {
722− dev_printk(KERN_ERR, &dev->pdev->dev,
723+ dev_printk(KERN_ERR, dev->dev,
723724 "DDC bus registration " "failed.\n");
724725 goto failed_ddc;
725726 }
drivers/gpu/drm/gma500/psb_intel_modes.c+2−1
@@ -11,7 +11,7 @@ · 10 unmodified lines
1111
1212 /**
1313 * psb_intel_ddc_probe
14− *
14+ * @adapter: Associated I2C adaptor
1515 */
1616 bool psb_intel_ddc_probe(struct i2c_adapter *adapter)
1717 {
@@ -43,6 +43,7 @@ bool psb_intel_ddc_probe(struct i2c_adapter *adapter) · 25 unmodified lines
4343 /**
4444 * psb_intel_ddc_get_modes - get modelist from monitor
4545 * @connector: DRM connector device to use
46+ * @adapter: Associated I2C adaptor
4647 *
4748 * Fetch the EDID information from @connector using the DDC bus.
4849 */
drivers/gpu/drm/gma500/psb_intel_sdvo.c+4−4
@@ -221,7 +221,7 @@ static bool · 220 unmodified lines
221221 psb_intel_sdvo_create_enhance_property(struct psb_intel_sdvo *psb_intel_sdvo,
222222 struct psb_intel_sdvo_connector *psb_intel_sdvo_connector);
223223
224−/**
224+/*
225225 * Writes the SDVOB or SDVOC with the given value, but always writes both
226226 * SDVOB and SDVOC to work around apparent hardware issues (according to
227227 * comments in the BIOS).
@@ -588,7 +588,7 @@ static bool psb_intel_sdvo_set_target_input(struct psb_intel_sdvo *psb_intel_sdv · 360 unmodified lines
588588 &targets, sizeof(targets));
589589 }
590590
591−/**
591+/*
592592 * Return whether each input is trained.
593593 *
594594 * This function is making an assumption about the layout of the response,
@@ -1818,7 +1818,7 @@ psb_intel_sdvo_guess_ddc_bus(struct psb_intel_sdvo *sdvo) · 1223 unmodified lines
18181818 #endif
18191819 }
18201820
1821−/**
1821+/*
18221822 * Choose the appropriate DDC bus for control bus switch command for this
18231823 * SDVO output based on the controlled output.
18241824 *
@@ -2406,7 +2406,7 @@ psb_intel_sdvo_init_ddc_proxy(struct psb_intel_sdvo *sdvo, · 581 unmodified lines
24062406 sdvo->ddc.owner = THIS_MODULE;
24072407 sdvo->ddc.class = I2C_CLASS_DDC;
24082408 snprintf(sdvo->ddc.name, I2C_NAME_SIZE, "SDVO DDC proxy");
2409− sdvo->ddc.dev.parent = &dev->pdev->dev;
2409+ sdvo->ddc.dev.parent = dev->dev;
24102410 sdvo->ddc.algo_data = sdvo;
24112411 sdvo->ddc.algo = &psb_intel_sdvo_ddc_proxy;
24122412
drivers/gpu/drm/gma500/psb_irq.c+1−2
@@ -126,9 +126,8 @@ static void mid_disable_pipe_event(struct drm_psb_private *dev_priv, int pipe) · 125 unmodified lines
126126 }
127127 }
128128
129−/**
129+/*
130130 * Display controller interrupt handler for pipe event.
131− *
132131 */
133132 static void mid_pipe_event_handler(struct drm_device *dev, int pipe)
134133 {
drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c+18−18
@@ -454,13 +454,13 @@ static void tc35876x_brightness_init(struct drm_device *dev) · 453 unmodified lines
454454 ret = intel_scu_ipc_ioread8(GPIOPWMCTRL, &pwmctrl);
455455 if (ret || pwmctrl != 0x01) {
456456 if (ret)
457− dev_err(&dev->pdev->dev, "GPIOPWMCTRL read failed\n");
457+ dev_err(dev->dev, "GPIOPWMCTRL read failed\n");
458458 else
459− dev_warn(&dev->pdev->dev, "GPIOPWMCTRL was not set to system clock (pwmctrl = 0x%02x)\n", pwmctrl);
459+ dev_warn(dev->dev, "GPIOPWMCTRL was not set to system clock (pwmctrl = 0x%02x)\n", pwmctrl);
460460
461461 ret = intel_scu_ipc_iowrite8(GPIOPWMCTRL, 0x01);
462462 if (ret)
463− dev_err(&dev->pdev->dev, "GPIOPWMCTRL set failed\n");
463+ dev_err(dev->dev, "GPIOPWMCTRL set failed\n");
464464 }
465465
466466 clkdiv = calc_clkdiv(SYSTEMCLK, PWM_FREQUENCY);
@@ -470,9 +470,9 @@ static void tc35876x_brightness_init(struct drm_device *dev) · 3 unmodified lines
470470 ret = intel_scu_ipc_iowrite8(PWM0CLKDIV0, clkdiv & 0xff);
471471
472472 if (ret)
473− dev_err(&dev->pdev->dev, "PWM0CLKDIV set failed\n");
473+ dev_err(dev->dev, "PWM0CLKDIV set failed\n");
474474 else
475− dev_dbg(&dev->pdev->dev, "PWM0CLKDIV set to 0x%04x (%d Hz)\n",
475+ dev_dbg(dev->dev, "PWM0CLKDIV set to 0x%04x (%d Hz)\n",
476476 clkdiv, PWM_FREQUENCY);
477477 }
478478
@@ -575,7 +575,7 @@ static struct drm_display_mode *tc35876x_get_config_mode(struct drm_device *dev) · 96 unmodified lines
575575 {
576576 struct drm_display_mode *mode;
577577
578− dev_dbg(&dev->pdev->dev, "%s\n", __func__);
578+ dev_dbg(dev->dev, "%s\n", __func__);
579579
580580 mode = kzalloc(sizeof(*mode), GFP_KERNEL);
581581 if (!mode)
@@ -592,15 +592,15 @@ static struct drm_display_mode *tc35876x_get_config_mode(struct drm_device *dev) · 10 unmodified lines
592592 mode->vtotal = 838;
593593 mode->clock = 33324 << 1;
594594
595− dev_info(&dev->pdev->dev, "hdisplay(w) = %d\n", mode->hdisplay);
596− dev_info(&dev->pdev->dev, "vdisplay(h) = %d\n", mode->vdisplay);
597− dev_info(&dev->pdev->dev, "HSS = %d\n", mode->hsync_start);
598− dev_info(&dev->pdev->dev, "HSE = %d\n", mode->hsync_end);
599− dev_info(&dev->pdev->dev, "htotal = %d\n", mode->htotal);
600− dev_info(&dev->pdev->dev, "VSS = %d\n", mode->vsync_start);
601− dev_info(&dev->pdev->dev, "VSE = %d\n", mode->vsync_end);
602− dev_info(&dev->pdev->dev, "vtotal = %d\n", mode->vtotal);
603− dev_info(&dev->pdev->dev, "clock = %d\n", mode->clock);
595+ dev_info(dev->dev, "hdisplay(w) = %d\n", mode->hdisplay);
596+ dev_info(dev->dev, "vdisplay(h) = %d\n", mode->vdisplay);
597+ dev_info(dev->dev, "HSS = %d\n", mode->hsync_start);
598+ dev_info(dev->dev, "HSE = %d\n", mode->hsync_end);
599+ dev_info(dev->dev, "htotal = %d\n", mode->htotal);
600+ dev_info(dev->dev, "VSS = %d\n", mode->vsync_start);
601+ dev_info(dev->dev, "VSE = %d\n", mode->vsync_end);
602+ dev_info(dev->dev, "vtotal = %d\n", mode->vtotal);
603+ dev_info(dev->dev, "clock = %d\n", mode->clock);
604604
605605 drm_mode_set_name(mode);
606606 drm_mode_set_crtcinfo(mode, 0);
@@ -775,19 +775,19 @@ void tc35876x_init(struct drm_device *dev) · 168 unmodified lines
775775 {
776776 int r;
777777
778− dev_dbg(&dev->pdev->dev, "%s\n", __func__);
778+ dev_dbg(dev->dev, "%s\n", __func__);
779779
780780 cmi_lcd_hack_create_device();
781781
782782 r = i2c_add_driver(&cmi_lcd_i2c_driver);
783783 if (r < 0)
784− dev_err(&dev->pdev->dev,
784+ dev_err(dev->dev,
785785 "%s: i2c_add_driver() for %s failed (%d)\n",
786786 __func__, cmi_lcd_i2c_driver.driver.name, r);
787787
788788 r = i2c_add_driver(&tc35876x_bridge_i2c_driver);
789789 if (r < 0)
790− dev_err(&dev->pdev->dev,
790+ dev_err(dev->dev,
791791 "%s: i2c_add_driver() for %s failed (%d)\n",
792792 __func__, tc35876x_bridge_i2c_driver.driver.name, r);
793793
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c+6−7
@@ -211,7 +211,7 @@ static void hibmc_hw_config(struct hibmc_drm_private *priv) · 210 unmodified lines
211211 static int hibmc_hw_map(struct hibmc_drm_private *priv)
212212 {
213213 struct drm_device *dev = &priv->dev;
214− struct pci_dev *pdev = dev->pdev;
214+ struct pci_dev *pdev = to_pci_dev(dev->dev);
215215 resource_size_t addr, size, ioaddr, iosize;
216216
217217 ioaddr = pci_resource_start(pdev, 1);
@@ -255,13 +255,14 @@ static int hibmc_unload(struct drm_device *dev) · 37 unmodified lines
255255 if (dev->irq_enabled)
256256 drm_irq_uninstall(dev);
257257
258− pci_disable_msi(dev->pdev);
258+ pci_disable_msi(to_pci_dev(dev->dev));
259259
260260 return 0;
261261 }
262262
263263 static int hibmc_load(struct drm_device *dev)
264264 {
265+ struct pci_dev *pdev = to_pci_dev(dev->dev);
265266 struct hibmc_drm_private *priv = to_hibmc_drm_private(dev);
266267 int ret;
267268
@@ -269,8 +270,7 @@ static int hibmc_load(struct drm_device *dev) · 1 unmodified line
269270 if (ret)
270271 goto err;
271272
272− ret = drmm_vram_helper_init(dev, pci_resource_start(dev->pdev, 0),
273− priv->fb_size);
273+ ret = drmm_vram_helper_init(dev, pci_resource_start(pdev, 0), priv->fb_size);
274274 if (ret) {
275275 drm_err(dev, "Error initializing VRAM MM; %d\n", ret);
276276 goto err;
@@ -286,11 +286,11 @@ static int hibmc_load(struct drm_device *dev) · 9 unmodified lines
286286 goto err;
287287 }
288288
289− ret = pci_enable_msi(dev->pdev);
289+ ret = pci_enable_msi(pdev);
290290 if (ret) {
291291 drm_warn(dev, "enabling MSI failed: %d\n", ret);
292292 } else {
293− ret = drm_irq_install(dev, dev->pdev->irq);
293+ ret = drm_irq_install(dev, pdev->irq);
294294 if (ret)
295295 drm_warn(dev, "install irq failed: %d\n", ret);
296296 }
@@ -326,7 +326,6 @@ static int hibmc_pci_probe(struct pci_dev *pdev, · 29 unmodified lines
326326 }
327327
328328 dev = &priv->dev;
329− dev->pdev = pdev;
330329 pci_set_drvdata(pdev, dev);
331330
332331 ret = pcim_enable_device(pdev);
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_i2c.c+1−1
@@ -83,7 +83,7 @@ int hibmc_ddc_create(struct drm_device *drm_dev, · 82 unmodified lines
8383 connector->adapter.owner = THIS_MODULE;
8484 connector->adapter.class = I2C_CLASS_DDC;
8585 snprintf(connector->adapter.name, I2C_NAME_SIZE, "HIS i2c bit bus");
86− connector->adapter.dev.parent = &drm_dev->pdev->dev;
86+ connector->adapter.dev.parent = drm_dev->dev;
8787 i2c_set_adapdata(&connector->adapter, connector);
8888 connector->adapter.algo_data = &connector->bit_data;
8989
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c+4−14
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #include <drm/drm_atomic_helper.h>
1515 #include <drm/drm_probe_helper.h>
1616 #include <drm/drm_print.h>
17+#include <drm/drm_simple_kms_helper.h>
1718
1819 #include "hibmc_drm_drv.h"
1920 #include "hibmc_drm_regs.h"
@@ -42,12 +43,6 @@ out: · 22 unmodified lines
4243 return count;
4344 }
4445
45−static enum drm_mode_status hibmc_connector_mode_valid(struct drm_connector *connector,
46− struct drm_display_mode *mode)
47−{
48− return MODE_OK;
49−}
50−
5146 static void hibmc_connector_destroy(struct drm_connector *connector)
5247 {
5348 struct hibmc_connector *hibmc_connector = to_hibmc_connector(connector);
@@ -59,7 +54,6 @@ static void hibmc_connector_destroy(struct drm_connector *connector) · 5 unmodified lines
5954 static const struct drm_connector_helper_funcs
6055 hibmc_connector_helper_funcs = {
6156 .get_modes = hibmc_connector_get_modes,
62− .mode_valid = hibmc_connector_mode_valid,
6357 };
6458
6559 static const struct drm_connector_funcs hibmc_connector_funcs = {
@@ -90,15 +84,12 @@ static const struct drm_encoder_helper_funcs hibmc_encoder_helper_funcs = { · 24 unmodified lines
9084 .mode_set = hibmc_encoder_mode_set,
9185 };
9286
93−static const struct drm_encoder_funcs hibmc_encoder_funcs = {
94− .destroy = drm_encoder_cleanup,
95−};
96−
9787 int hibmc_vdac_init(struct hibmc_drm_private *priv)
9888 {
9989 struct drm_device *dev = &priv->dev;
10090 struct hibmc_connector *hibmc_connector = &priv->connector;
10191 struct drm_encoder *encoder = &priv->encoder;
92+ struct drm_crtc *crtc = &priv->crtc;
10293 struct drm_connector *connector = &hibmc_connector->base;
10394 int ret;
10495
@@ -108,9 +99,8 @@ int hibmc_vdac_init(struct hibmc_drm_private *priv) · 3 unmodified lines
10899 return ret;
109100 }
110101
111− encoder->possible_crtcs = 0x1;
112− ret = drm_encoder_init(dev, encoder, &hibmc_encoder_funcs,
113− DRM_MODE_ENCODER_DAC, NULL);
102+ encoder->possible_crtcs = drm_crtc_mask(crtc);
103+ ret = drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_DAC);
114104 if (ret) {
115105 drm_err(dev, "failed to init encoder: %d\n", ret);
116106 return ret;
drivers/gpu/drm/mga/mga_ioc32.c+7−7
@@ -1,4 +1,4 @@
1−/**
1+/*
22 * \file mga_ioc32.c
33 *
44 * 32-bit ioctl compatibility routines for the MGA DRM.
@@ -159,13 +159,13 @@ static struct { · 154 unmodified lines
159159 };
160160
161161 /**
162− * Called whenever a 32-bit process running under a 64-bit kernel
163− * performs an ioctl on /dev/dri/card<n>.
162+ * mga_compat_ioctl - Called whenever a 32-bit process running under
163+ * a 64-bit kernel performs an ioctl on /dev/dri/card<n>.
164164 *
165− * \param filp file pointer.
166− * \param cmd command.
167− * \param arg user argument.
168− * \return zero on success or negative number on failure.
165+ * @filp: file pointer.
166+ * @cmd: command.
167+ * @arg: user argument.
168+ * return: zero on success or negative number on failure.
169169 */
170170 long mga_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
171171 {
drivers/gpu/drm/mgag200/mgag200_drv.c+11−9
@@ -47,10 +47,11 @@ static const struct drm_driver mgag200_driver = { · 46 unmodified lines
4747 static bool mgag200_has_sgram(struct mga_device *mdev)
4848 {
4949 struct drm_device *dev = &mdev->base;
50+ struct pci_dev *pdev = to_pci_dev(dev->dev);
5051 u32 option;
5152 int ret;
5253
53− ret = pci_read_config_dword(dev->pdev, PCI_MGA_OPTION, &option);
54+ ret = pci_read_config_dword(pdev, PCI_MGA_OPTION, &option);
5455 if (drm_WARN(dev, ret, "failed to read PCI config dword: %d\n", ret))
5556 return false;
5657
@@ -60,6 +61,7 @@ static bool mgag200_has_sgram(struct mga_device *mdev) · 3 unmodified lines
6061 static int mgag200_regs_init(struct mga_device *mdev)
6162 {
6263 struct drm_device *dev = &mdev->base;
64+ struct pci_dev *pdev = to_pci_dev(dev->dev);
6365 u32 option, option2;
6466 u8 crtcext3;
6567
@@ -99,13 +101,13 @@ static int mgag200_regs_init(struct mga_device *mdev) · 33 unmodified lines
99101 }
100102
101103 if (option)
102− pci_write_config_dword(dev->pdev, PCI_MGA_OPTION, option);
104+ pci_write_config_dword(pdev, PCI_MGA_OPTION, option);
103105 if (option2)
104− pci_write_config_dword(dev->pdev, PCI_MGA_OPTION2, option2);
106+ pci_write_config_dword(pdev, PCI_MGA_OPTION2, option2);
105107
106108 /* BAR 1 contains registers */
107− mdev->rmmio_base = pci_resource_start(dev->pdev, 1);
108− mdev->rmmio_size = pci_resource_len(dev->pdev, 1);
109+ mdev->rmmio_base = pci_resource_start(pdev, 1);
110+ mdev->rmmio_size = pci_resource_len(pdev, 1);
109111
110112 if (!devm_request_mem_region(dev->dev, mdev->rmmio_base,
111113 mdev->rmmio_size, "mgadrmfb_mmio")) {
@@ -113,7 +115,7 @@ static int mgag200_regs_init(struct mga_device *mdev) · 1 unmodified line
113115 return -ENOMEM;
114116 }
115117
116− mdev->rmmio = pcim_iomap(dev->pdev, 1, 0);
118+ mdev->rmmio = pcim_iomap(pdev, 1, 0);
117119 if (mdev->rmmio == NULL)
118120 return -ENOMEM;
119121
@@ -218,6 +220,7 @@ static void mgag200_g200_interpret_bios(struct mga_device *mdev, · 98 unmodified lines
218220 static void mgag200_g200_init_refclk(struct mga_device *mdev)
219221 {
220222 struct drm_device *dev = &mdev->base;
223+ struct pci_dev *pdev = to_pci_dev(dev->dev);
221224 unsigned char __iomem *rom;
222225 unsigned char *bios;
223226 size_t size;
@@ -226,7 +229,7 @@ static void mgag200_g200_init_refclk(struct mga_device *mdev) · 2 unmodified lines
226229 mdev->model.g200.pclk_max = 230000;
227230 mdev->model.g200.ref_clk = 27050;
228231
229− rom = pci_map_rom(dev->pdev, &size);
232+ rom = pci_map_rom(pdev, &size);
230233 if (!rom)
231234 return;
232235
@@ -244,7 +247,7 @@ static void mgag200_g200_init_refclk(struct mga_device *mdev) · 11 unmodified lines
244247
245248 vfree(bios);
246249 out:
247− pci_unmap_rom(dev->pdev, rom);
250+ pci_unmap_rom(pdev, rom);
248251 }
249252
250253 static void mgag200_g200se_init_unique_id(struct mga_device *mdev)
@@ -301,7 +304,6 @@ mgag200_device_create(struct pci_dev *pdev, unsigned long flags) · 50 unmodified lines
301304 return mdev;
302305 dev = &mdev->base;
303306
304− dev->pdev = pdev;
305307 pci_set_drvdata(pdev, dev);
306308
307309 ret = mgag200_device_init(mdev, flags);
drivers/gpu/drm/mgag200/mgag200_i2c.c+1−1
@@ -126,7 +126,7 @@ struct mga_i2c_chan *mgag200_i2c_create(struct drm_device *dev) · 125 unmodified lines
126126 i2c->clock = clock;
127127 i2c->adapter.owner = THIS_MODULE;
128128 i2c->adapter.class = I2C_CLASS_DDC;
129− i2c->adapter.dev.parent = &dev->pdev->dev;
129+ i2c->adapter.dev.parent = dev->dev;
130130 i2c->dev = dev;
131131 i2c_set_adapdata(&i2c->adapter, i2c);
132132 snprintf(i2c->adapter.name, sizeof(i2c->adapter.name), "mga i2c");
drivers/gpu/drm/mgag200/mgag200_mm.c+6−4
@@ -78,11 +78,12 @@ static size_t mgag200_probe_vram(struct mga_device *mdev, void __iomem *mem, · 77 unmodified lines
7878 static void mgag200_mm_release(struct drm_device *dev, void *ptr)
7979 {
8080 struct mga_device *mdev = to_mga_device(dev);
81+ struct pci_dev *pdev = to_pci_dev(dev->dev);
8182
8283 mdev->vram_fb_available = 0;
8384 iounmap(mdev->vram);
84− arch_io_free_memtype_wc(pci_resource_start(dev->pdev, 0),
85− pci_resource_len(dev->pdev, 0));
85+ arch_io_free_memtype_wc(pci_resource_start(pdev, 0),
86+ pci_resource_len(pdev, 0));
8687 arch_phys_wc_del(mdev->fb_mtrr);
8788 mdev->fb_mtrr = 0;
8889 }
@@ -90,6 +91,7 @@ static void mgag200_mm_release(struct drm_device *dev, void *ptr) · 1 unmodified line
9091 int mgag200_mm_init(struct mga_device *mdev)
9192 {
9293 struct drm_device *dev = &mdev->base;
94+ struct pci_dev *pdev = to_pci_dev(dev->dev);
9395 u8 misc;
9496 resource_size_t start, len;
9597 int ret;
@@ -102,8 +104,8 @@ int mgag200_mm_init(struct mga_device *mdev) · 6 unmodified lines
102104 WREG8(MGA_MISC_OUT, misc);
103105
104106 /* BAR 0 is VRAM */
105− start = pci_resource_start(dev->pdev, 0);
106− len = pci_resource_len(dev->pdev, 0);
107+ start = pci_resource_start(pdev, 0);
108+ len = pci_resource_len(pdev, 0);
107109
108110 if (!devm_request_mem_region(dev->dev, start, len, "mgadrmfb_vram")) {
109111 drm_err(dev, "can't reserve VRAM\n");
drivers/gpu/drm/nouveau/dispnv04/arb.c+7−5
@@ -200,16 +200,17 @@ nv04_update_arb(struct drm_device *dev, int VClk, int bpp, · 199 unmodified lines
200200 int MClk = nouveau_hw_get_clock(dev, PLL_MEMORY);
201201 int NVClk = nouveau_hw_get_clock(dev, PLL_CORE);
202202 uint32_t cfg1 = nvif_rd32(device, NV04_PFB_CFG1);
203+ struct pci_dev *pdev = to_pci_dev(dev->dev);
203204
204205 sim_data.pclk_khz = VClk;
205206 sim_data.mclk_khz = MClk;
206207 sim_data.nvclk_khz = NVClk;
207208 sim_data.bpp = bpp;
208209 sim_data.two_heads = nv_two_heads(dev);
209− if ((dev->pdev->device & 0xffff) == 0x01a0 /*CHIPSET_NFORCE*/ ||
210− (dev->pdev->device & 0xffff) == 0x01f0 /*CHIPSET_NFORCE2*/) {
210+ if ((pdev->device & 0xffff) == 0x01a0 /*CHIPSET_NFORCE*/ ||
211+ (pdev->device & 0xffff) == 0x01f0 /*CHIPSET_NFORCE2*/) {
211212 uint32_t type;
212− int domain = pci_domain_nr(dev->pdev->bus);
213+ int domain = pci_domain_nr(pdev->bus);
213214
214215 pci_read_config_dword(pci_get_domain_bus_and_slot(domain, 0, 1),
215216 0x7c, &type);
@@ -251,11 +252,12 @@ void · 35 unmodified lines
251252 nouveau_calc_arb(struct drm_device *dev, int vclk, int bpp, int *burst, int *lwm)
252253 {
253254 struct nouveau_drm *drm = nouveau_drm(dev);
255+ struct pci_dev *pdev = to_pci_dev(dev->dev);
254256
255257 if (drm->client.device.info.family < NV_DEVICE_INFO_V0_KELVIN)
256258 nv04_update_arb(dev, vclk, bpp, burst, lwm);
257− else if ((dev->pdev->device & 0xfff0) == 0x0240 /*CHIPSET_C51*/ ||
258− (dev->pdev->device & 0xfff0) == 0x03d0 /*CHIPSET_C512*/) {
259+ else if ((pdev->device & 0xfff0) == 0x0240 /*CHIPSET_C51*/ ||
260+ (pdev->device & 0xfff0) == 0x03d0 /*CHIPSET_C512*/) {
259261 *burst = 128;
260262 *lwm = 0x0480;
261263 } else
drivers/gpu/drm/nouveau/dispnv04/dfp.c+3−2
@@ -488,12 +488,13 @@ static void nv04_dfp_update_backlight(struct drm_encoder *encoder, int mode) · 487 unmodified lines
488488 #ifdef __powerpc__
489489 struct drm_device *dev = encoder->dev;
490490 struct nvif_object *device = &nouveau_drm(dev)->client.device.object;
491+ struct pci_dev *pdev = to_pci_dev(dev->dev);
491492
492493 /* BIOS scripts usually take care of the backlight, thanks
493494 * Apple for your consistency.
494495 */
495− if (dev->pdev->device == 0x0174 || dev->pdev->device == 0x0179 ||
496− dev->pdev->device == 0x0189 || dev->pdev->device == 0x0329) {
496+ if (pdev->device == 0x0174 || pdev->device == 0x0179 ||
497+ pdev->device == 0x0189 || pdev->device == 0x0329) {
497498 if (mode == DRM_MODE_DPMS_ON) {
498499 nvif_mask(device, NV_PBUS_DEBUG_DUALHEAD_CTL, 1 << 31, 1 << 31);
499500 nvif_mask(device, NV_PCRTC_GPIO_EXT, 3, 1);
drivers/gpu/drm/nouveau/dispnv04/disp.h+8−6
@@ -130,7 +130,7 @@ static inline bool · 129 unmodified lines
130130 nv_two_heads(struct drm_device *dev)
131131 {
132132 struct nouveau_drm *drm = nouveau_drm(dev);
133− const int impl = dev->pdev->device & 0x0ff0;
133+ const int impl = to_pci_dev(dev->dev)->device & 0x0ff0;
134134
135135 if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_CELSIUS && impl != 0x0100 &&
136136 impl != 0x0150 && impl != 0x01a0 && impl != 0x0200)
@@ -142,14 +142,14 @@ nv_two_heads(struct drm_device *dev) · 5 unmodified lines
142142 static inline bool
143143 nv_gf4_disp_arch(struct drm_device *dev)
144144 {
145− return nv_two_heads(dev) && (dev->pdev->device & 0x0ff0) != 0x0110;
145+ return nv_two_heads(dev) && (to_pci_dev(dev->dev)->device & 0x0ff0) != 0x0110;
146146 }
147147
148148 static inline bool
149149 nv_two_reg_pll(struct drm_device *dev)
150150 {
151151 struct nouveau_drm *drm = nouveau_drm(dev);
152− const int impl = dev->pdev->device & 0x0ff0;
152+ const int impl = to_pci_dev(dev->dev)->device & 0x0ff0;
153153
154154 if (impl == 0x0310 || impl == 0x0340 || drm->client.device.info.family >= NV_DEVICE_INFO_V0_CURIE)
155155 return true;
@@ -160,9 +160,11 @@ static inline bool · 4 unmodified lines
160160 nv_match_device(struct drm_device *dev, unsigned device,
161161 unsigned sub_vendor, unsigned sub_device)
162162 {
163− return dev->pdev->device == device &&
164− dev->pdev->subsystem_vendor == sub_vendor &&
165− dev->pdev->subsystem_device == sub_device;
163+ struct pci_dev *pdev = to_pci_dev(dev->dev);
164+
165+ return pdev->device == device &&
166+ pdev->subsystem_vendor == sub_vendor &&
167+ pdev->subsystem_device == sub_device;
166168 }
167169
168170 #include <subdev/bios/init.h>
drivers/gpu/drm/nouveau/dispnv04/hw.c+6−4
@@ -214,14 +214,15 @@ nouveau_hw_pllvals_to_clk(struct nvkm_pll_vals *pv) · 213 unmodified lines
214214 int
215215 nouveau_hw_get_clock(struct drm_device *dev, enum nvbios_pll_type plltype)
216216 {
217+ struct pci_dev *pdev = to_pci_dev(dev->dev);
217218 struct nvkm_pll_vals pllvals;
218219 int ret;
219220 int domain;
220221
221− domain = pci_domain_nr(dev->pdev->bus);
222+ domain = pci_domain_nr(pdev->bus);
222223
223224 if (plltype == PLL_MEMORY &&
224− (dev->pdev->device & 0x0ff0) == CHIPSET_NFORCE) {
225+ (pdev->device & 0x0ff0) == CHIPSET_NFORCE) {
225226 uint32_t mpllP;
226227 pci_read_config_dword(pci_get_domain_bus_and_slot(domain, 0, 3),
227228 0x6c, &mpllP);
@@ -232,7 +233,7 @@ nouveau_hw_get_clock(struct drm_device *dev, enum nvbios_pll_type plltype) · 4 unmodified lines
232233 return 400000 / mpllP;
233234 } else
234235 if (plltype == PLL_MEMORY &&
235− (dev->pdev->device & 0xff0) == CHIPSET_NFORCE2) {
236+ (pdev->device & 0xff0) == CHIPSET_NFORCE2) {
236237 uint32_t clock;
237238
238239 pci_read_config_dword(pci_get_domain_bus_and_slot(domain, 0, 5),
@@ -309,6 +310,7 @@ void · 70 unmodified lines
309310 nouveau_hw_save_vga_fonts(struct drm_device *dev, bool save)
310311 {
311312 struct nouveau_drm *drm = nouveau_drm(dev);
313+ struct pci_dev *pdev = to_pci_dev(dev->dev);
312314 uint8_t misc, gr4, gr5, gr6, seq2, seq4;
313315 bool graphicsmode;
314316 unsigned plane;
@@ -327,7 +329,7 @@ nouveau_hw_save_vga_fonts(struct drm_device *dev, bool save) · 12 unmodified lines
327329 NV_INFO(drm, "%sing VGA fonts\n", save ? "Sav" : "Restor");
328330
329331 /* map first 64KiB of VRAM, holds VGA fonts etc */
330− iovram = ioremap(pci_resource_start(dev->pdev, 1), 65536);
332+ iovram = ioremap(pci_resource_start(pdev, 1), 65536);
331333 if (!iovram) {
332334 NV_ERROR(drm, "Failed to map VRAM, "
333335 "cannot save/restore VGA fonts.\n");
drivers/gpu/drm/nouveau/nouveau_abi16.c+4−3
@@ -181,6 +181,7 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS) · 180 unmodified lines
181181 struct nvif_device *device = &drm->client.device;
182182 struct nvkm_gr *gr = nvxx_gr(device);
183183 struct drm_nouveau_getparam *getparam = data;
184+ struct pci_dev *pdev = to_pci_dev(dev->dev);
184185
185186 switch (getparam->param) {
186187 case NOUVEAU_GETPARAM_CHIPSET_ID:
@@ -188,13 +189,13 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS) · 1 unmodified line
188189 break;
189190 case NOUVEAU_GETPARAM_PCI_VENDOR:
190191 if (device->info.platform != NV_DEVICE_INFO_V0_SOC)
191− getparam->value = dev->pdev->vendor;
192+ getparam->value = pdev->vendor;
192193 else
193194 getparam->value = 0;
194195 break;
195196 case NOUVEAU_GETPARAM_PCI_DEVICE:
196197 if (device->info.platform != NV_DEVICE_INFO_V0_SOC)
197− getparam->value = dev->pdev->device;
198+ getparam->value = pdev->device;
198199 else
199200 getparam->value = 0;
200201 break;
@@ -205,7 +206,7 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS) · 4 unmodified lines
205206 case NV_DEVICE_INFO_V0_PCIE: getparam->value = 2; break;
206207 case NV_DEVICE_INFO_V0_SOC : getparam->value = 3; break;
207208 case NV_DEVICE_INFO_V0_IGP :
208− if (!pci_is_pcie(dev->pdev))
209+ if (!pci_is_pcie(pdev))
209210 getparam->value = 1;
210211 else
211212 getparam->value = 2;
drivers/gpu/drm/nouveau/nouveau_acpi.c+1−1
@@ -377,7 +377,7 @@ nouveau_acpi_edid(struct drm_device *dev, struct drm_connector *connector) · 376 unmodified lines
377377 return NULL;
378378 }
379379
380− handle = ACPI_HANDLE(&dev->pdev->dev);
380+ handle = ACPI_HANDLE(dev->dev);
381381 if (!handle)
382382 return NULL;
383383
drivers/gpu/drm/nouveau/nouveau_bios.c+8−3
@@ -110,6 +110,9 @@ static int call_lvds_manufacturer_script(struct drm_device *dev, struct dcb_outp · 109 unmodified lines
110110 struct nvbios *bios = &drm->vbios;
111111 uint8_t sub = bios->data[bios->fp.xlated_entry + script] + (bios->fp.link_c_increment && dcbent->or & DCB_OUTPUT_C ? 1 : 0);
112112 uint16_t scriptofs = ROM16(bios->data[bios->init_script_tbls_ptr + sub * 2]);
113+#ifdef __powerpc__
114+ struct pci_dev *pdev = to_pci_dev(dev->dev);
115+#endif
113116
114117 if (!bios->fp.xlated_entry || !sub || !scriptofs)
115118 return -EINVAL;
@@ -123,8 +126,8 @@ static int call_lvds_manufacturer_script(struct drm_device *dev, struct dcb_outp · 7 unmodified lines
123126 #ifdef __powerpc__
124127 /* Powerbook specific quirks */
125128 if (script == LVDS_RESET &&
126− (dev->pdev->device == 0x0179 || dev->pdev->device == 0x0189 ||
127− dev->pdev->device == 0x0329))
129+ (pdev->device == 0x0179 || pdev->device == 0x0189 ||
130+ pdev->device == 0x0329))
128131 nv_write_tmds(dev, dcbent->or, 0, 0x02, 0x72);
129132 #endif
130133
@@ -2080,11 +2083,13 @@ nouveau_bios_init(struct drm_device *dev) · 1949 unmodified lines
20802083 {
20812084 struct nouveau_drm *drm = nouveau_drm(dev);
20822085 struct nvbios *bios = &drm->vbios;
2086+ struct pci_dev *pdev;
20832087 int ret;
20842088
20852089 /* only relevant for PCI devices */
2086− if (!dev->pdev)
2090+ if (!dev_is_pci(dev->dev))
20872091 return 0;
2092+ pdev = to_pci_dev(dev->dev);
20882093
20892094 if (!NVInitVBIOS(dev))
20902095 return -ENODEV;
drivers/gpu/drm/nouveau/nouveau_connector.c+6−4
@@ -411,6 +411,7 @@ static struct nouveau_encoder * · 410 unmodified lines
411411 nouveau_connector_ddc_detect(struct drm_connector *connector)
412412 {
413413 struct drm_device *dev = connector->dev;
414+ struct pci_dev *pdev = to_pci_dev(dev->dev);
414415 struct nouveau_encoder *nv_encoder = NULL, *found = NULL;
415416 struct drm_encoder *encoder;
416417 int ret;
@@ -438,11 +439,11 @@ nouveau_connector_ddc_detect(struct drm_connector *connector) · 21 unmodified lines
438439 break;
439440
440441 if (switcheroo_ddc)
441− vga_switcheroo_lock_ddc(dev->pdev);
442+ vga_switcheroo_lock_ddc(pdev);
442443 if (nvkm_probe_i2c(nv_encoder->i2c, 0x50))
443444 found = nv_encoder;
444445 if (switcheroo_ddc)
445− vga_switcheroo_unlock_ddc(dev->pdev);
446+ vga_switcheroo_unlock_ddc(pdev);
446447
447448 break;
448449 }
@@ -490,6 +491,7 @@ nouveau_connector_set_encoder(struct drm_connector *connector, · 41 unmodified lines
490491 struct nouveau_connector *nv_connector = nouveau_connector(connector);
491492 struct nouveau_drm *drm = nouveau_drm(connector->dev);
492493 struct drm_device *dev = connector->dev;
494+ struct pci_dev *pdev = to_pci_dev(dev->dev);
493495
494496 if (nv_connector->detected_encoder == nv_encoder)
495497 return;
@@ -511,8 +513,8 @@ nouveau_connector_set_encoder(struct drm_connector *connector, · 15 unmodified lines
511513 connector->doublescan_allowed = true;
512514 if (drm->client.device.info.family == NV_DEVICE_INFO_V0_KELVIN ||
513515 (drm->client.device.info.family == NV_DEVICE_INFO_V0_CELSIUS &&
514− (dev->pdev->device & 0x0ff0) != 0x0100 &&
515− (dev->pdev->device & 0x0ff0) != 0x0150))
516+ (pdev->device & 0x0ff0) != 0x0100 &&
517+ (pdev->device & 0x0ff0) != 0x0150))
516518 /* HW is broken */
517519 connector->interlace_allowed = false;
518520 else
drivers/gpu/drm/nouveau/nouveau_drm.c+2−3
@@ -115,8 +115,8 @@ nouveau_platform_name(struct platform_device *platformdev) · 114 unmodified lines
115115 static u64
116116 nouveau_name(struct drm_device *dev)
117117 {
118− if (dev->pdev)
119− return nouveau_pci_name(dev->pdev);
118+ if (dev_is_pci(dev->dev))
119+ return nouveau_pci_name(to_pci_dev(dev->dev));
120120 else
121121 return nouveau_platform_name(to_platform_device(dev->dev));
122122 }
@@ -760,7 +760,6 @@ static int nouveau_drm_probe(struct pci_dev *pdev, · 637 unmodified lines
760760 if (ret)
761761 goto fail_drm;
762762
763− drm_dev->pdev = pdev;
764763 pci_set_drvdata(pdev, drm_dev);
765764
766765 ret = nouveau_drm_device_init(drm_dev);
drivers/gpu/drm/nouveau/nouveau_fbcon.c+4−2
@@ -396,7 +396,9 @@ nouveau_fbcon_create(struct drm_fb_helper *helper, · 395 unmodified lines
396396 NV_INFO(drm, "allocated %dx%d fb: 0x%llx, bo %p\n",
397397 fb->width, fb->height, nvbo->offset, nvbo);
398398
399− vga_switcheroo_client_fb_set(dev->pdev, info);
399+ if (dev_is_pci(dev->dev))
400+ vga_switcheroo_client_fb_set(to_pci_dev(dev->dev), info);
401+
400402 return 0;
401403
402404 out_unlock:
@@ -548,7 +550,7 @@ nouveau_fbcon_init(struct drm_device *dev) · 145 unmodified lines
548550 int ret;
549551
550552 if (!dev->mode_config.num_crtc ||
551− (dev->pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
553+ (to_pci_dev(dev->dev)->class >> 8) != PCI_CLASS_DISPLAY_VGA)
552554 return 0;
553555
554556 fbcon = kzalloc(sizeof(struct nouveau_fbdev), GFP_KERNEL);
drivers/gpu/drm/nouveau/nouveau_vga.c+12−8
@@ -87,18 +87,20 @@ nouveau_vga_init(struct nouveau_drm *drm) · 86 unmodified lines
8787 {
8888 struct drm_device *dev = drm->dev;
8989 bool runtime = nouveau_pmops_runtime();
90+ struct pci_dev *pdev;
9091
9192 /* only relevant for PCI devices */
92− if (!dev->pdev)
93+ if (!dev_is_pci(dev->dev))
9394 return;
95+ pdev = to_pci_dev(dev->dev);
9496
95− vga_client_register(dev->pdev, dev, NULL, nouveau_vga_set_decode);
97+ vga_client_register(pdev, dev, NULL, nouveau_vga_set_decode);
9698
9799 /* don't register Thunderbolt eGPU with vga_switcheroo */
98− if (pci_is_thunderbolt_attached(dev->pdev))
100+ if (pci_is_thunderbolt_attached(pdev))
99101 return;
100102
101− vga_switcheroo_register_client(dev->pdev, &nouveau_switcheroo_ops, runtime);
103+ vga_switcheroo_register_client(pdev, &nouveau_switcheroo_ops, runtime);
102104
103105 if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus())
104106 vga_switcheroo_init_domain_pm_ops(drm->dev->dev, &drm->vga_pm_domain);
@@ -109,17 +111,19 @@ nouveau_vga_fini(struct nouveau_drm *drm) · 4 unmodified lines
109111 {
110112 struct drm_device *dev = drm->dev;
111113 bool runtime = nouveau_pmops_runtime();
114+ struct pci_dev *pdev;
112115
113116 /* only relevant for PCI devices */
114− if (!dev->pdev)
117+ if (!dev_is_pci(dev->dev))
115118 return;
119+ pdev = to_pci_dev(dev->dev);
116120
117− vga_client_register(dev->pdev, NULL, NULL, NULL);
121+ vga_client_register(pdev, NULL, NULL, NULL);
118122
119− if (pci_is_thunderbolt_attached(dev->pdev))
123+ if (pci_is_thunderbolt_attached(pdev))
120124 return;
121125
122− vga_switcheroo_unregister_client(dev->pdev);
126+ vga_switcheroo_unregister_client(pdev);
123127 if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus())
124128 vga_switcheroo_fini_domain_pm_ops(drm->dev->dev);
125129 }
drivers/gpu/drm/panel/panel-simple.c+2−0
@@ -2399,6 +2399,8 @@ static const struct panel_desc innolux_n116bge = { · 2398 unmodified lines
23992399 .width = 256,
24002400 .height = 144,
24012401 },
2402+ .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
2403+ .connector_type = DRM_MODE_CONNECTOR_eDP,
24022404 };
24032405
24042406 static const struct drm_display_mode innolux_n125hce_gn1_mode = {
drivers/gpu/drm/panfrost/panfrost_devfreq.c+1−0
@@ -76,6 +76,7 @@ static int panfrost_devfreq_get_dev_status(struct device *dev, · 75 unmodified lines
7676 }
7777
7878 static struct devfreq_dev_profile panfrost_devfreq_profile = {
79+ .timer = DEVFREQ_TIMER_DELAYED,
7980 .polling_ms = 50, /* ~3 frames */
8081 .target = panfrost_devfreq_target,
8182 .get_dev_status = panfrost_devfreq_get_dev_status,
drivers/gpu/drm/qxl/qxl_drv.c+1−1
@@ -163,7 +163,7 @@ DEFINE_DRM_GEM_FOPS(qxl_fops); · 162 unmodified lines
163163
164164 static int qxl_drm_freeze(struct drm_device *dev)
165165 {
166− struct pci_dev *pdev = dev->pdev;
166+ struct pci_dev *pdev = to_pci_dev(dev->dev);
167167 struct qxl_device *qdev = to_qxl(dev);
168168 int ret;
169169
drivers/gpu/drm/qxl/qxl_ioctl.c+2−1
@@ -370,13 +370,14 @@ static int qxl_clientcap_ioctl(struct drm_device *dev, void *data, · 369 unmodified lines
370370 struct drm_file *file_priv)
371371 {
372372 struct qxl_device *qdev = to_qxl(dev);
373+ struct pci_dev *pdev = to_pci_dev(dev->dev);
373374 struct drm_qxl_clientcap *param = data;
374375 int byte, idx;
375376
376377 byte = param->index / 8;
377378 idx = param->index % 8;
378379
379− if (dev->pdev->revision < 4)
380+ if (pdev->revision < 4)
380381 return -ENOSYS;
381382
382383 if (byte >= 58)
drivers/gpu/drm/qxl/qxl_irq.c+2−1
@@ -81,6 +81,7 @@ static void qxl_client_monitors_config_work_func(struct work_struct *work) · 80 unmodified lines
8181
8282 int qxl_irq_init(struct qxl_device *qdev)
8383 {
84+ struct pci_dev *pdev = to_pci_dev(qdev->ddev.dev);
8485 int ret;
8586
8687 init_waitqueue_head(&qdev->display_event);
@@ -93,7 +94,7 @@ int qxl_irq_init(struct qxl_device *qdev) · 6 unmodified lines
9394 atomic_set(&qdev->irq_received_cursor, 0);
9495 atomic_set(&qdev->irq_received_io_cmd, 0);
9596 qdev->irq_received_error = 0;
96− ret = drm_irq_install(&qdev->ddev, qdev->ddev.pdev->irq);
97+ ret = drm_irq_install(&qdev->ddev, pdev->irq);
9798 qdev->ram_header->int_mask = QXL_INTERRUPT_MASK;
9899 if (unlikely(ret != 0)) {
99100 DRM_ERROR("Failed installing irq: %d\n", ret);
drivers/gpu/drm/qxl/qxl_kms.c+0−1
@@ -111,7 +111,6 @@ int qxl_device_init(struct qxl_device *qdev, · 110 unmodified lines
111111 {
112112 int r, sb;
113113
114− qdev->ddev.pdev = pdev;
115114 pci_set_drvdata(pdev, &qdev->ddev);
116115
117116 mutex_init(&qdev->gem.mutex);
drivers/gpu/drm/r128/r128_ioc32.c+7−7
@@ -1,4 +1,4 @@
1−/**
1+/*
22 * \file r128_ioc32.c
33 *
44 * 32-bit ioctl compatibility routines for the R128 DRM.
@@ -170,13 +170,13 @@ drm_ioctl_compat_t *r128_compat_ioctls[] = { · 165 unmodified lines
170170 };
171171
172172 /**
173− * Called whenever a 32-bit process running under a 64-bit kernel
174− * performs an ioctl on /dev/dri/card<n>.
173+ * r128_compat_ioctl - Called whenever a 32-bit process running under
174+ * a 64-bit kernel performs an ioctl on /dev/dri/card<n>.
175175 *
176− * \param filp file pointer.
177− * \param cmd command.
178− * \param arg user argument.
179− * \return zero on success or negative number on failure.
176+ * @filp: file pointer.
177+ * @cmd: command.
178+ * @arg: user argument.
179+ * return: zero on success or negative number on failure.
180180 */
181181 long r128_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
182182 {
drivers/gpu/drm/radeon/atombios_encoders.c+3−3
@@ -2062,9 +2062,9 @@ atombios_apply_encoder_quirks(struct drm_encoder *encoder, · 2061 unmodified lines
20622062 struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc);
20632063
20642064 /* Funky macbooks */
2065− if ((dev->pdev->device == 0x71C5) &&
2066− (dev->pdev->subsystem_vendor == 0x106b) &&
2067− (dev->pdev->subsystem_device == 0x0080)) {
2065+ if ((rdev->pdev->device == 0x71C5) &&
2066+ (rdev->pdev->subsystem_vendor == 0x106b) &&
2067+ (rdev->pdev->subsystem_device == 0x0080)) {
20682068 if (radeon_encoder->devices & ATOM_DEVICE_LCD1_SUPPORT) {
20692069 uint32_t lvtma_bit_depth_control = RREG32(AVIVO_LVTMA_BIT_DEPTH_CONTROL);
20702070
drivers/gpu/drm/radeon/r100.c+13−14
@@ -2612,7 +2612,6 @@ int r100_asic_reset(struct radeon_device *rdev, bool hard) · 2611 unmodified lines
26122612
26132613 void r100_set_common_regs(struct radeon_device *rdev)
26142614 {
2615− struct drm_device *dev = rdev->ddev;
26162615 bool force_dac2 = false;
26172616 u32 tmp;
26182617
@@ -2630,7 +2629,7 @@ void r100_set_common_regs(struct radeon_device *rdev) · 11 unmodified lines
26302629 * don't report it in the bios connector
26312630 * table.
26322631 */
2633− switch (dev->pdev->device) {
2632+ switch (rdev->pdev->device) {
26342633 /* RN50 */
26352634 case 0x515e:
26362635 case 0x5969:
@@ -2640,17 +2639,17 @@ void r100_set_common_regs(struct radeon_device *rdev) · 3 unmodified lines
26402639 case 0x5159:
26412640 case 0x515a:
26422641 /* DELL triple head servers */
2643− if ((dev->pdev->subsystem_vendor == 0x1028 /* DELL */) &&
2644− ((dev->pdev->subsystem_device == 0x016c) ||
2645− (dev->pdev->subsystem_device == 0x016d) ||
2646− (dev->pdev->subsystem_device == 0x016e) ||
2647− (dev->pdev->subsystem_device == 0x016f) ||
2648− (dev->pdev->subsystem_device == 0x0170) ||
2649− (dev->pdev->subsystem_device == 0x017d) ||
2650− (dev->pdev->subsystem_device == 0x017e) ||
2651− (dev->pdev->subsystem_device == 0x0183) ||
2652− (dev->pdev->subsystem_device == 0x018a) ||
2653− (dev->pdev->subsystem_device == 0x019a)))
2642+ if ((rdev->pdev->subsystem_vendor == 0x1028 /* DELL */) &&
2643+ ((rdev->pdev->subsystem_device == 0x016c) ||
2644+ (rdev->pdev->subsystem_device == 0x016d) ||
2645+ (rdev->pdev->subsystem_device == 0x016e) ||
2646+ (rdev->pdev->subsystem_device == 0x016f) ||
2647+ (rdev->pdev->subsystem_device == 0x0170) ||
2648+ (rdev->pdev->subsystem_device == 0x017d) ||
2649+ (rdev->pdev->subsystem_device == 0x017e) ||
2650+ (rdev->pdev->subsystem_device == 0x0183) ||
2651+ (rdev->pdev->subsystem_device == 0x018a) ||
2652+ (rdev->pdev->subsystem_device == 0x019a)))
26542653 force_dac2 = true;
26552654 break;
26562655 }
@@ -2798,7 +2797,7 @@ void r100_vram_init_sizes(struct radeon_device *rdev) · 141 unmodified lines
27982797 rdev->mc.real_vram_size = 8192 * 1024;
27992798 WREG32(RADEON_CONFIG_MEMSIZE, rdev->mc.real_vram_size);
28002799 }
2801− /* Fix for RN50, M6, M7 with 8/16/32(??) MBs of VRAM -
2800+ /* Fix for RN50, M6, M7 with 8/16/32(??) MBs of VRAM -
28022801 * Novell bug 204882 + along with lots of ubuntu ones
28032802 */
28042803 if (rdev->mc.aper_size > config_aper_size)
drivers/gpu/drm/radeon/radeon.h+19−16
@@ -2313,6 +2313,9 @@ struct radeon_device { · 2312 unmodified lines
23132313 struct device *dev;
23142314 struct drm_device *ddev;
23152315 struct pci_dev *pdev;
2316+#ifdef __alpha__
2317+ struct pci_controller *hose;
2318+#endif
23162319 struct rw_semaphore exclusive_lock;
23172320 /* ASIC */
23182321 union radeon_asic_config config;
@@ -2622,14 +2625,14 @@ void r100_pll_errata_after_index(struct radeon_device *rdev); · 303 unmodified lines
26222625 (rdev->family == CHIP_RV410) || \
26232626 (rdev->family == CHIP_RS400) || \
26242627 (rdev->family == CHIP_RS480))
2625−#define ASIC_IS_X2(rdev) ((rdev->ddev->pdev->device == 0x9441) || \
2626− (rdev->ddev->pdev->device == 0x9443) || \
2627− (rdev->ddev->pdev->device == 0x944B) || \
2628− (rdev->ddev->pdev->device == 0x9506) || \
2629− (rdev->ddev->pdev->device == 0x9509) || \
2630− (rdev->ddev->pdev->device == 0x950F) || \
2631− (rdev->ddev->pdev->device == 0x689C) || \
2632− (rdev->ddev->pdev->device == 0x689D))
2628+#define ASIC_IS_X2(rdev) ((rdev->pdev->device == 0x9441) || \
2629+ (rdev->pdev->device == 0x9443) || \
2630+ (rdev->pdev->device == 0x944B) || \
2631+ (rdev->pdev->device == 0x9506) || \
2632+ (rdev->pdev->device == 0x9509) || \
2633+ (rdev->pdev->device == 0x950F) || \
2634+ (rdev->pdev->device == 0x689C) || \
2635+ (rdev->pdev->device == 0x689D))
26332636 #define ASIC_IS_AVIVO(rdev) ((rdev->family >= CHIP_RS600))
26342637 #define ASIC_IS_DCE2(rdev) ((rdev->family == CHIP_RS600) || \
26352638 (rdev->family == CHIP_RS690) || \
@@ -2652,14 +2655,14 @@ void r100_pll_errata_after_index(struct radeon_device *rdev); · 16 unmodified lines
26522655 #define ASIC_IS_DCE83(rdev) ((rdev->family == CHIP_KABINI) || \
26532656 (rdev->family == CHIP_MULLINS))
26542657
2655−#define ASIC_IS_LOMBOK(rdev) ((rdev->ddev->pdev->device == 0x6849) || \
2656− (rdev->ddev->pdev->device == 0x6850) || \
2657− (rdev->ddev->pdev->device == 0x6858) || \
2658− (rdev->ddev->pdev->device == 0x6859) || \
2659− (rdev->ddev->pdev->device == 0x6840) || \
2660− (rdev->ddev->pdev->device == 0x6841) || \
2661− (rdev->ddev->pdev->device == 0x6842) || \
2662− (rdev->ddev->pdev->device == 0x6843))
2658+#define ASIC_IS_LOMBOK(rdev) ((rdev->pdev->device == 0x6849) || \
2659+ (rdev->pdev->device == 0x6850) || \
2660+ (rdev->pdev->device == 0x6858) || \
2661+ (rdev->pdev->device == 0x6859) || \
2662+ (rdev->pdev->device == 0x6840) || \
2663+ (rdev->pdev->device == 0x6841) || \
2664+ (rdev->pdev->device == 0x6842) || \
2665+ (rdev->pdev->device == 0x6843))
26632666
26642667 /*
26652668 * BIOS helpers.
drivers/gpu/drm/radeon/radeon_atombios.c+45−44
@@ -284,46 +284,47 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, · 283 unmodified lines
284284 uint16_t *line_mux,
285285 struct radeon_hpd *hpd)
286286 {
287+ struct pci_dev *pdev = to_pci_dev(dev->dev);
287288
288289 /* Asus M2A-VM HDMI board lists the DVI port as HDMI */
289− if ((dev->pdev->device == 0x791e) &&
290− (dev->pdev->subsystem_vendor == 0x1043) &&
291− (dev->pdev->subsystem_device == 0x826d)) {
290+ if ((pdev->device == 0x791e) &&
291+ (pdev->subsystem_vendor == 0x1043) &&
292+ (pdev->subsystem_device == 0x826d)) {
292293 if ((*connector_type == DRM_MODE_CONNECTOR_HDMIA) &&
293294 (supported_device == ATOM_DEVICE_DFP3_SUPPORT))
294295 *connector_type = DRM_MODE_CONNECTOR_DVID;
295296 }
296297
297298 /* Asrock RS600 board lists the DVI port as HDMI */
298− if ((dev->pdev->device == 0x7941) &&
299− (dev->pdev->subsystem_vendor == 0x1849) &&
300− (dev->pdev->subsystem_device == 0x7941)) {
299+ if ((pdev->device == 0x7941) &&
300+ (pdev->subsystem_vendor == 0x1849) &&
301+ (pdev->subsystem_device == 0x7941)) {
301302 if ((*connector_type == DRM_MODE_CONNECTOR_HDMIA) &&
302303 (supported_device == ATOM_DEVICE_DFP3_SUPPORT))
303304 *connector_type = DRM_MODE_CONNECTOR_DVID;
304305 }
305306
306307 /* MSI K9A2GM V2/V3 board has no HDMI or DVI */
307− if ((dev->pdev->device == 0x796e) &&
308− (dev->pdev->subsystem_vendor == 0x1462) &&
309− (dev->pdev->subsystem_device == 0x7302)) {
308+ if ((pdev->device == 0x796e) &&
309+ (pdev->subsystem_vendor == 0x1462) &&
310+ (pdev->subsystem_device == 0x7302)) {
310311 if ((supported_device == ATOM_DEVICE_DFP2_SUPPORT) ||
311312 (supported_device == ATOM_DEVICE_DFP3_SUPPORT))
312313 return false;
313314 }
314315
315316 /* a-bit f-i90hd - ciaranm on #radeonhd - this board has no DVI */
316− if ((dev->pdev->device == 0x7941) &&
317− (dev->pdev->subsystem_vendor == 0x147b) &&
318− (dev->pdev->subsystem_device == 0x2412)) {
317+ if ((pdev->device == 0x7941) &&
318+ (pdev->subsystem_vendor == 0x147b) &&
319+ (pdev->subsystem_device == 0x2412)) {
319320 if (*connector_type == DRM_MODE_CONNECTOR_DVII)
320321 return false;
321322 }
322323
323324 /* Falcon NW laptop lists vga ddc line for LVDS */
324− if ((dev->pdev->device == 0x5653) &&
325− (dev->pdev->subsystem_vendor == 0x1462) &&
326− (dev->pdev->subsystem_device == 0x0291)) {
325+ if ((pdev->device == 0x5653) &&
326+ (pdev->subsystem_vendor == 0x1462) &&
327+ (pdev->subsystem_device == 0x0291)) {
327328 if (*connector_type == DRM_MODE_CONNECTOR_LVDS) {
328329 i2c_bus->valid = false;
329330 *line_mux = 53;
@@ -331,26 +332,26 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, · 1 unmodified line
331332 }
332333
333334 /* HIS X1300 is DVI+VGA, not DVI+DVI */
334− if ((dev->pdev->device == 0x7146) &&
335− (dev->pdev->subsystem_vendor == 0x17af) &&
336− (dev->pdev->subsystem_device == 0x2058)) {
335+ if ((pdev->device == 0x7146) &&
336+ (pdev->subsystem_vendor == 0x17af) &&
337+ (pdev->subsystem_device == 0x2058)) {
337338 if (supported_device == ATOM_DEVICE_DFP1_SUPPORT)
338339 return false;
339340 }
340341
341342 /* Gigabyte X1300 is DVI+VGA, not DVI+DVI */
342− if ((dev->pdev->device == 0x7142) &&
343− (dev->pdev->subsystem_vendor == 0x1458) &&
344− (dev->pdev->subsystem_device == 0x2134)) {
343+ if ((pdev->device == 0x7142) &&
344+ (pdev->subsystem_vendor == 0x1458) &&
345+ (pdev->subsystem_device == 0x2134)) {
345346 if (supported_device == ATOM_DEVICE_DFP1_SUPPORT)
346347 return false;
347348 }
348349
349350
350351 /* Funky macbooks */
351− if ((dev->pdev->device == 0x71C5) &&
352− (dev->pdev->subsystem_vendor == 0x106b) &&
353− (dev->pdev->subsystem_device == 0x0080)) {
352+ if ((pdev->device == 0x71C5) &&
353+ (pdev->subsystem_vendor == 0x106b) &&
354+ (pdev->subsystem_device == 0x0080)) {
354355 if ((supported_device == ATOM_DEVICE_CRT1_SUPPORT) ||
355356 (supported_device == ATOM_DEVICE_DFP2_SUPPORT))
356357 return false;
@@ -366,27 +367,27 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, · 9 unmodified lines
366367 }
367368
368369 /* ASUS HD 3600 XT board lists the DVI port as HDMI */
369− if ((dev->pdev->device == 0x9598) &&
370− (dev->pdev->subsystem_vendor == 0x1043) &&
371− (dev->pdev->subsystem_device == 0x01da)) {
370+ if ((pdev->device == 0x9598) &&
371+ (pdev->subsystem_vendor == 0x1043) &&
372+ (pdev->subsystem_device == 0x01da)) {
372373 if (*connector_type == DRM_MODE_CONNECTOR_HDMIA) {
373374 *connector_type = DRM_MODE_CONNECTOR_DVII;
374375 }
375376 }
376377
377378 /* ASUS HD 3600 board lists the DVI port as HDMI */
378− if ((dev->pdev->device == 0x9598) &&
379− (dev->pdev->subsystem_vendor == 0x1043) &&
380− (dev->pdev->subsystem_device == 0x01e4)) {
379+ if ((pdev->device == 0x9598) &&
380+ (pdev->subsystem_vendor == 0x1043) &&
381+ (pdev->subsystem_device == 0x01e4)) {
381382 if (*connector_type == DRM_MODE_CONNECTOR_HDMIA) {
382383 *connector_type = DRM_MODE_CONNECTOR_DVII;
383384 }
384385 }
385386
386387 /* ASUS HD 3450 board lists the DVI port as HDMI */
387− if ((dev->pdev->device == 0x95C5) &&
388− (dev->pdev->subsystem_vendor == 0x1043) &&
389− (dev->pdev->subsystem_device == 0x01e2)) {
388+ if ((pdev->device == 0x95C5) &&
389+ (pdev->subsystem_vendor == 0x1043) &&
390+ (pdev->subsystem_device == 0x01e2)) {
390391 if (*connector_type == DRM_MODE_CONNECTOR_HDMIA) {
391392 *connector_type = DRM_MODE_CONNECTOR_DVII;
392393 }
@@ -411,9 +412,9 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, · 18 unmodified lines
411412 * with different crtcs which isn't possible on the hardware
412413 * side and leaves no crtcs for LVDS or VGA.
413414 */
414− if (((dev->pdev->device == 0x95c4) || (dev->pdev->device == 0x9591)) &&
415− (dev->pdev->subsystem_vendor == 0x1025) &&
416− (dev->pdev->subsystem_device == 0x013c)) {
415+ if (((pdev->device == 0x95c4) || (pdev->device == 0x9591)) &&
416+ (pdev->subsystem_vendor == 0x1025) &&
417+ (pdev->subsystem_device == 0x013c)) {
417418 if ((*connector_type == DRM_MODE_CONNECTOR_DVII) &&
418419 (supported_device == ATOM_DEVICE_DFP1_SUPPORT)) {
419420 /* actually it's a DVI-D port not DVI-I */
@@ -425,9 +426,9 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, · 5 unmodified lines
425426 /* XFX Pine Group device rv730 reports no VGA DDC lines
426427 * even though they are wired up to record 0x93
427428 */
428− if ((dev->pdev->device == 0x9498) &&
429− (dev->pdev->subsystem_vendor == 0x1682) &&
430− (dev->pdev->subsystem_device == 0x2452) &&
429+ if ((pdev->device == 0x9498) &&
430+ (pdev->subsystem_vendor == 0x1682) &&
431+ (pdev->subsystem_device == 0x2452) &&
431432 (i2c_bus->valid == false) &&
432433 !(supported_device & (ATOM_DEVICE_TV_SUPPORT | ATOM_DEVICE_CV_SUPPORT))) {
433434 struct radeon_device *rdev = dev->dev_private;
@@ -435,11 +436,11 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, · 1 unmodified line
435436 }
436437
437438 /* Fujitsu D3003-S2 board lists DVI-I as DVI-D and VGA */
438− if (((dev->pdev->device == 0x9802) ||
439− (dev->pdev->device == 0x9805) ||
440− (dev->pdev->device == 0x9806)) &&
441− (dev->pdev->subsystem_vendor == 0x1734) &&
442− (dev->pdev->subsystem_device == 0x11bd)) {
439+ if (((pdev->device == 0x9802) ||
440+ (pdev->device == 0x9805) ||
441+ (pdev->device == 0x9806)) &&
442+ (pdev->subsystem_vendor == 0x1734) &&
443+ (pdev->subsystem_device == 0x11bd)) {
443444 if (*connector_type == DRM_MODE_CONNECTOR_VGA) {
444445 *connector_type = DRM_MODE_CONNECTOR_DVII;
445446 *line_mux = 0x3103;
drivers/gpu/drm/radeon/radeon_bios.c+3−3
@@ -528,7 +528,7 @@ static bool legacy_read_disabled_bios(struct radeon_device *rdev) · 527 unmodified lines
528528 crtc_ext_cntl = RREG32(RADEON_CRTC_EXT_CNTL);
529529 fp2_gen_cntl = 0;
530530
531− if (rdev->ddev->pdev->device == PCI_DEVICE_ID_ATI_RADEON_QY) {
531+ if (rdev->pdev->device == PCI_DEVICE_ID_ATI_RADEON_QY) {
532532 fp2_gen_cntl = RREG32(RADEON_FP2_GEN_CNTL);
533533 }
534534
@@ -565,7 +565,7 @@ static bool legacy_read_disabled_bios(struct radeon_device *rdev) · 30 unmodified lines
565565 (RADEON_CRTC_SYNC_TRISTAT |
566566 RADEON_CRTC_DISPLAY_DIS)));
567567
568− if (rdev->ddev->pdev->device == PCI_DEVICE_ID_ATI_RADEON_QY) {
568+ if (rdev->pdev->device == PCI_DEVICE_ID_ATI_RADEON_QY) {
569569 WREG32(RADEON_FP2_GEN_CNTL, (fp2_gen_cntl & ~RADEON_FP2_ON));
570570 }
571571
@@ -583,7 +583,7 @@ static bool legacy_read_disabled_bios(struct radeon_device *rdev) · 11 unmodified lines
583583 WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl);
584584 }
585585 WREG32(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl);
586− if (rdev->ddev->pdev->device == PCI_DEVICE_ID_ATI_RADEON_QY) {
586+ if (rdev->pdev->device == PCI_DEVICE_ID_ATI_RADEON_QY) {
587587 WREG32(RADEON_FP2_GEN_CNTL, fp2_gen_cntl);
588588 }
589589 return r;
drivers/gpu/drm/radeon/radeon_combios.c+29−26
@@ -894,13 +894,13 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct · 893 unmodified lines
894894
895895 /* quirks */
896896 /* Radeon 7000 (RV100) */
897− if (((dev->pdev->device == 0x5159) &&
898− (dev->pdev->subsystem_vendor == 0x174B) &&
899− (dev->pdev->subsystem_device == 0x7c28)) ||
897+ if (((rdev->pdev->device == 0x5159) &&
898+ (rdev->pdev->subsystem_vendor == 0x174B) &&
899+ (rdev->pdev->subsystem_device == 0x7c28)) ||
900900 /* Radeon 9100 (R200) */
901− ((dev->pdev->device == 0x514D) &&
902− (dev->pdev->subsystem_vendor == 0x174B) &&
903− (dev->pdev->subsystem_device == 0x7149))) {
901+ ((rdev->pdev->device == 0x514D) &&
902+ (rdev->pdev->subsystem_vendor == 0x174B) &&
903+ (rdev->pdev->subsystem_device == 0x7149))) {
904904 /* vbios value is bad, use the default */
905905 found = 0;
906906 }
@@ -2221,20 +2221,21 @@ static bool radeon_apply_legacy_quirks(struct drm_device *dev, · 1314 unmodified lines
22212221 struct radeon_i2c_bus_rec *ddc_i2c,
22222222 struct radeon_hpd *hpd)
22232223 {
2224+ struct radeon_device *rdev = dev->dev_private;
22242225
22252226 /* Certain IBM chipset RN50s have a BIOS reporting two VGAs,
22262227 one with VGA DDC and one with CRT2 DDC. - kill the CRT2 DDC one */
2227− if (dev->pdev->device == 0x515e &&
2228− dev->pdev->subsystem_vendor == 0x1014) {
2228+ if (rdev->pdev->device == 0x515e &&
2229+ rdev->pdev->subsystem_vendor == 0x1014) {
22292230 if (*legacy_connector == CONNECTOR_CRT_LEGACY &&
22302231 ddc_i2c->mask_clk_reg == RADEON_GPIO_CRT2_DDC)
22312232 return false;
22322233 }
22332234
22342235 /* X300 card with extra non-existent DVI port */
2235− if (dev->pdev->device == 0x5B60 &&
2236− dev->pdev->subsystem_vendor == 0x17af &&
2237− dev->pdev->subsystem_device == 0x201e && bios_index == 2) {
2236+ if (rdev->pdev->device == 0x5B60 &&
2237+ rdev->pdev->subsystem_vendor == 0x17af &&
2238+ rdev->pdev->subsystem_device == 0x201e && bios_index == 2) {
22382239 if (*legacy_connector == CONNECTOR_DVI_I_LEGACY)
22392240 return false;
22402241 }
@@ -2244,22 +2245,24 @@ static bool radeon_apply_legacy_quirks(struct drm_device *dev, · 3 unmodified lines
22442245
22452246 static bool radeon_apply_legacy_tv_quirks(struct drm_device *dev)
22462247 {
2248+ struct radeon_device *rdev = dev->dev_private;
2249+
22472250 /* Acer 5102 has non-existent TV port */
2248− if (dev->pdev->device == 0x5975 &&
2249− dev->pdev->subsystem_vendor == 0x1025 &&
2250− dev->pdev->subsystem_device == 0x009f)
2251+ if (rdev->pdev->device == 0x5975 &&
2252+ rdev->pdev->subsystem_vendor == 0x1025 &&
2253+ rdev->pdev->subsystem_device == 0x009f)
22512254 return false;
22522255
22532256 /* HP dc5750 has non-existent TV port */
2254− if (dev->pdev->device == 0x5974 &&
2255− dev->pdev->subsystem_vendor == 0x103c &&
2256− dev->pdev->subsystem_device == 0x280a)
2257+ if (rdev->pdev->device == 0x5974 &&
2258+ rdev->pdev->subsystem_vendor == 0x103c &&
2259+ rdev->pdev->subsystem_device == 0x280a)
22572260 return false;
22582261
22592262 /* MSI S270 has non-existent TV port */
2260− if (dev->pdev->device == 0x5955 &&
2261− dev->pdev->subsystem_vendor == 0x1462 &&
2262− dev->pdev->subsystem_device == 0x0131)
2263+ if (rdev->pdev->device == 0x5955 &&
2264+ rdev->pdev->subsystem_vendor == 0x1462 &&
2265+ rdev->pdev->subsystem_device == 0x0131)
22632266 return false;
22642267
22652268 return true;
@@ -2413,9 +2416,9 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) · 147 unmodified lines
24132416 /* RV100 board with external TDMS bit mis-set.
24142417 * Actually uses internal TMDS, clear the bit.
24152418 */
2416− if (dev->pdev->device == 0x5159 &&
2417− dev->pdev->subsystem_vendor == 0x1014 &&
2418− dev->pdev->subsystem_device == 0x029A) {
2419+ if (rdev->pdev->device == 0x5159 &&
2420+ rdev->pdev->subsystem_vendor == 0x1014 &&
2421+ rdev->pdev->subsystem_device == 0x029A) {
24192422 tmp &= ~(1 << 4);
24202423 }
24212424 if ((tmp >> 4) & 0x1) {
@@ -2707,9 +2710,9 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev) · 285 unmodified lines
27072710 /* boards with a thermal chip, but no overdrive table */
27082711
27092712 /* Asus 9600xt has an f75375 on the monid bus */
2710− if ((dev->pdev->device == 0x4152) &&
2711− (dev->pdev->subsystem_vendor == 0x1043) &&
2712− (dev->pdev->subsystem_device == 0xc002)) {
2713+ if ((rdev->pdev->device == 0x4152) &&
2714+ (rdev->pdev->subsystem_vendor == 0x1043) &&
2715+ (rdev->pdev->subsystem_device == 0xc002)) {
27132716 i2c_bus = combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0);
27142717 rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus);
27152718 if (rdev->pm.i2c_bus) {
drivers/gpu/drm/radeon/radeon_cs.c+1−2
@@ -130,8 +130,7 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p) · 129 unmodified lines
130130 * IGP chips to avoid image corruptions
131131 */
132132 if (p->ring == R600_RING_TYPE_UVD_INDEX &&
133− (i <= 0 || pci_find_capability(p->rdev->ddev->pdev,
134− PCI_CAP_ID_AGP) ||
133+ (i <= 0 || pci_find_capability(p->rdev->pdev, PCI_CAP_ID_AGP) ||
135134 p->rdev->family == CHIP_RS780 ||
136135 p->rdev->family == CHIP_RS880)) {
137136
drivers/gpu/drm/radeon/radeon_device.c+10−7
@@ -1562,6 +1562,7 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend, · 1561 unmodified lines
15621562 bool fbcon, bool freeze)
15631563 {
15641564 struct radeon_device *rdev;
1565+ struct pci_dev *pdev;
15651566 struct drm_crtc *crtc;
15661567 struct drm_connector *connector;
15671568 int i, r;
@@ -1571,6 +1572,7 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend, · 3 unmodified lines
15711572 }
15721573
15731574 rdev = dev->dev_private;
1575+ pdev = to_pci_dev(dev->dev);
15741576
15751577 if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
15761578 return 0;
@@ -1636,14 +1638,14 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend, · 59 unmodified lines
16361638
16371639 radeon_agp_suspend(rdev);
16381640
1639− pci_save_state(dev->pdev);
1641+ pci_save_state(pdev);
16401642 if (freeze && rdev->family >= CHIP_CEDAR && !(rdev->flags & RADEON_IS_IGP)) {
16411643 rdev->asic->asic_reset(rdev, true);
1642− pci_restore_state(dev->pdev);
1644+ pci_restore_state(pdev);
16431645 } else if (suspend) {
16441646 /* Shut down the device */
1645− pci_disable_device(dev->pdev);
1646− pci_set_power_state(dev->pdev, PCI_D3hot);
1647+ pci_disable_device(pdev);
1648+ pci_set_power_state(pdev, PCI_D3hot);
16471649 }
16481650
16491651 if (fbcon) {
@@ -1665,6 +1667,7 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon) · 15 unmodified lines
16651667 {
16661668 struct drm_connector *connector;
16671669 struct radeon_device *rdev = dev->dev_private;
1670+ struct pci_dev *pdev = to_pci_dev(dev->dev);
16681671 struct drm_crtc *crtc;
16691672 int r;
16701673
@@ -1675,9 +1678,9 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon) · 4 unmodified lines
16751678 console_lock();
16761679 }
16771680 if (resume) {
1678− pci_set_power_state(dev->pdev, PCI_D0);
1679− pci_restore_state(dev->pdev);
1680− if (pci_enable_device(dev->pdev)) {
1681+ pci_set_power_state(pdev, PCI_D0);
1682+ pci_restore_state(pdev);
1683+ if (pci_enable_device(pdev)) {
16811684 if (fbcon)
16821685 console_unlock();
16831686 return -1;
drivers/gpu/drm/radeon/radeon_display.c+1−1
@@ -1317,7 +1317,7 @@ radeon_user_framebuffer_create(struct drm_device *dev, · 1316 unmodified lines
13171317
13181318 obj = drm_gem_object_lookup(file_priv, mode_cmd->handles[0]);
13191319 if (obj == NULL) {
1320− dev_err(&dev->pdev->dev, "No GEM object associated to handle 0x%08X, "
1320+ dev_err(dev->dev, "No GEM object associated to handle 0x%08X, "
13211321 "can't create framebuffer\n", mode_cmd->handles[0]);
13221322 return ERR_PTR(-ENOENT);
13231323 }
drivers/gpu/drm/radeon/radeon_drv.c+1−6
@@ -342,14 +342,9 @@ static int radeon_pci_probe(struct pci_dev *pdev, · 341 unmodified lines
342342 if (ret)
343343 goto err_free;
344344
345− dev->pdev = pdev;
346−#ifdef __alpha__
347− dev->hose = pdev->sysdata;
348−#endif
349−
350345 pci_set_drvdata(pdev, dev);
351346
352− if (pci_find_capability(dev->pdev, PCI_CAP_ID_AGP))
347+ if (pci_find_capability(pdev, PCI_CAP_ID_AGP))
353348 dev->agp = drm_agp_init(dev);
354349 if (dev->agp) {
355350 dev->agp->agp_mtrr = arch_phys_wc_add(
drivers/gpu/drm/radeon/radeon_fb.c+1−1
@@ -290,7 +290,7 @@ static int radeonfb_create(struct drm_fb_helper *helper, · 289 unmodified lines
290290 DRM_INFO("fb depth is %d\n", fb->format->depth);
291291 DRM_INFO(" pitch is %d\n", fb->pitches[0]);
292292
293− vga_switcheroo_client_fb_set(rdev->ddev->pdev, info);
293+ vga_switcheroo_client_fb_set(rdev->pdev, info);
294294 return 0;
295295
296296 out:
drivers/gpu/drm/radeon/radeon_gem.c+3−3
@@ -651,7 +651,7 @@ int radeon_gem_va_ioctl(struct drm_device *dev, void *data, · 650 unmodified lines
651651 }
652652
653653 if (args->offset < RADEON_VA_RESERVED_SIZE) {
654− dev_err(&dev->pdev->dev,
654+ dev_err(dev->dev,
655655 "offset 0x%lX is in reserved area 0x%X\n",
656656 (unsigned long)args->offset,
657657 RADEON_VA_RESERVED_SIZE);
@@ -665,7 +665,7 @@ int radeon_gem_va_ioctl(struct drm_device *dev, void *data, · 7 unmodified lines
665665 */
666666 invalid_flags = RADEON_VM_PAGE_VALID | RADEON_VM_PAGE_SYSTEM;
667667 if ((args->flags & invalid_flags)) {
668− dev_err(&dev->pdev->dev, "invalid flags 0x%08X vs 0x%08X\n",
668+ dev_err(dev->dev, "invalid flags 0x%08X vs 0x%08X\n",
669669 args->flags, invalid_flags);
670670 args->operation = RADEON_VA_RESULT_ERROR;
671671 return -EINVAL;
@@ -676,7 +676,7 @@ int radeon_gem_va_ioctl(struct drm_device *dev, void *data, · 4 unmodified lines
676676 case RADEON_VA_UNMAP:
677677 break;
678678 default:
679− dev_err(&dev->pdev->dev, "unsupported operation %d\n",
679+ dev_err(dev->dev, "unsupported operation %d\n",
680680 args->operation);
681681 args->operation = RADEON_VA_RESULT_ERROR;
682682 return -EINVAL;
drivers/gpu/drm/radeon/radeon_i2c.c+1−1
@@ -919,7 +919,7 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev, · 918 unmodified lines
919919 i2c->rec = *rec;
920920 i2c->adapter.owner = THIS_MODULE;
921921 i2c->adapter.class = I2C_CLASS_DDC;
922− i2c->adapter.dev.parent = &dev->pdev->dev;
922+ i2c->adapter.dev.parent = dev->dev;
923923 i2c->dev = dev;
924924 i2c_set_adapdata(&i2c->adapter, i2c);
925925 mutex_init(&i2c->mutex);
drivers/gpu/drm/radeon/radeon_irq_kms.c+1−1
@@ -314,7 +314,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev) · 313 unmodified lines
314314 INIT_WORK(&rdev->audio_work, r600_audio_update_hdmi);
315315
316316 rdev->irq.installed = true;
317− r = drm_irq_install(rdev->ddev, rdev->ddev->pdev->irq);
317+ r = drm_irq_install(rdev->ddev, rdev->pdev->irq);
318318 if (r) {
319319 rdev->irq.installed = false;
320320 flush_delayed_work(&rdev->hotplug_work);
drivers/gpu/drm/radeon/radeon_kms.c+14−10
@@ -76,7 +76,7 @@ void radeon_driver_unload_kms(struct drm_device *dev) · 75 unmodified lines
7676 }
7777
7878 radeon_acpi_fini(rdev);
79−
79+
8080 radeon_modeset_fini(rdev);
8181 radeon_device_fini(rdev);
8282
@@ -105,6 +105,7 @@ done_free: · 22 unmodified lines
105105 */
106106 int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)
107107 {
108+ struct pci_dev *pdev = to_pci_dev(dev->dev);
108109 struct radeon_device *rdev;
109110 int r, acpi_status;
110111
@@ -114,10 +115,14 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags) · 3 unmodified lines
114115 }
115116 dev->dev_private = (void *)rdev;
116117
118+#ifdef __alpha__
119+ rdev->hose = pdev->sysdata;
120+#endif
121+
117122 /* update BUS flag */
118− if (pci_find_capability(dev->pdev, PCI_CAP_ID_AGP)) {
123+ if (pci_find_capability(pdev, PCI_CAP_ID_AGP)) {
119124 flags |= RADEON_IS_AGP;
120− } else if (pci_is_pcie(dev->pdev)) {
125+ } else if (pci_is_pcie(pdev)) {
121126 flags |= RADEON_IS_PCIE;
122127 } else {
123128 flags |= RADEON_IS_PCI;
@@ -126,7 +131,7 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags) · 2 unmodified lines
126131 if ((radeon_runtime_pm != 0) &&
127132 radeon_has_atpx() &&
128133 ((flags & RADEON_IS_IGP) == 0) &&
129− !pci_is_thunderbolt_attached(dev->pdev))
134+ !pci_is_thunderbolt_attached(pdev))
130135 flags |= RADEON_IS_PX;
131136
132137 /* radeon_device_init should report only fatal error
@@ -135,9 +140,9 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags) · 2 unmodified lines
135140 * properly initialize the GPU MC controller and permit
136141 * VRAM allocation
137142 */
138− r = radeon_device_init(rdev, dev, dev->pdev, flags);
143+ r = radeon_device_init(rdev, dev, pdev, flags);
139144 if (r) {
140− dev_err(&dev->pdev->dev, "Fatal error during GPU init\n");
145+ dev_err(dev->dev, "Fatal error during GPU init\n");
141146 goto out;
142147 }
143148
@@ -147,7 +152,7 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags) · 3 unmodified lines
147152 */
148153 r = radeon_modeset_init(rdev);
149154 if (r)
150− dev_err(&dev->pdev->dev, "Fatal error during modeset init\n");
155+ dev_err(dev->dev, "Fatal error during modeset init\n");
151156
152157 /* Call ACPI methods: require modeset init
153158 * but failure is not fatal
@@ -155,8 +160,7 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags) · 1 unmodified line
155160 if (!r) {
156161 acpi_status = radeon_acpi_init(rdev);
157162 if (acpi_status)
158− dev_dbg(&dev->pdev->dev,
159− "Error during ACPI methods call\n");
163+ dev_dbg(dev->dev, "Error during ACPI methods call\n");
160164 }
161165
162166 if (radeon_is_px(dev)) {
@@ -239,7 +243,7 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 76 unmodified lines
239243
240244 switch (info->request) {
241245 case RADEON_INFO_DEVICE_ID:
242− *value = dev->pdev->device;
246+ *value = to_pci_dev(dev->dev)->device;
243247 break;
244248 case RADEON_INFO_NUM_GB_PIPES:
245249 *value = rdev->num_gb_pipes;
drivers/gpu/drm/radeon/radeon_legacy_encoders.c+3−3
@@ -974,9 +974,9 @@ static void radeon_legacy_tmds_ext_mode_set(struct drm_encoder *encoder, · 973 unmodified lines
974974
975975 /* XXX: these are oem specific */
976976 if (ASIC_IS_R300(rdev)) {
977− if ((dev->pdev->device == 0x4850) &&
978− (dev->pdev->subsystem_vendor == 0x1028) &&
979− (dev->pdev->subsystem_device == 0x2001)) /* Dell Inspiron 8600 */
977+ if ((rdev->pdev->device == 0x4850) &&
978+ (rdev->pdev->subsystem_vendor == 0x1028) &&
979+ (rdev->pdev->subsystem_device == 0x2001)) /* Dell Inspiron 8600 */
980980 fp2_gen_cntl |= R300_FP2_DVO_CLOCK_MODE_SINGLE;
981981 else
982982 fp2_gen_cntl |= RADEON_FP2_PAD_FLOP_EN | R300_FP2_DVO_CLOCK_MODE_SINGLE;
drivers/gpu/drm/radeon/radeon_ttm.c+1−1
@@ -324,7 +324,7 @@ static int radeon_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_reso · 323 unmodified lines
324324 * access, as done in ttm_bo_vm_fault().
325325 */
326326 mem->bus.offset = (mem->bus.offset & 0x0ffffffffUL) +
327− rdev->ddev->hose->dense_mem_base;
327+ rdev->hose->dense_mem_base;
328328 #endif
329329 break;
330330 default:
drivers/gpu/drm/radeon/rs780_dpm.c+3−4
@@ -223,16 +223,15 @@ static void rs780_preset_starting_fbdiv(struct radeon_device *rdev) · 222 unmodified lines
223223 static void rs780_voltage_scaling_init(struct radeon_device *rdev)
224224 {
225225 struct igp_power_info *pi = rs780_get_pi(rdev);
226− struct drm_device *dev = rdev->ddev;
227226 u32 fv_throt_pwm_fb_div_range[3];
228227 u32 fv_throt_pwm_range[4];
229228
230− if (dev->pdev->device == 0x9614) {
229+ if (rdev->pdev->device == 0x9614) {
231230 fv_throt_pwm_fb_div_range[0] = RS780D_FVTHROTPWMFBDIVRANGEREG0_DFLT;
232231 fv_throt_pwm_fb_div_range[1] = RS780D_FVTHROTPWMFBDIVRANGEREG1_DFLT;
233232 fv_throt_pwm_fb_div_range[2] = RS780D_FVTHROTPWMFBDIVRANGEREG2_DFLT;
234− } else if ((dev->pdev->device == 0x9714) ||
235− (dev->pdev->device == 0x9715)) {
233+ } else if ((rdev->pdev->device == 0x9714) ||
234+ (rdev->pdev->device == 0x9715)) {
236235 fv_throt_pwm_fb_div_range[0] = RS880D_FVTHROTPWMFBDIVRANGEREG0_DFLT;
237236 fv_throt_pwm_fb_div_range[1] = RS880D_FVTHROTPWMFBDIVRANGEREG1_DFLT;
238237 fv_throt_pwm_fb_div_range[2] = RS880D_FVTHROTPWMFBDIVRANGEREG2_DFLT;
drivers/gpu/drm/scheduler/sched_main.c+3−0
@@ -899,6 +899,9 @@ void drm_sched_fini(struct drm_gpu_scheduler *sched) · 898 unmodified lines
899899 if (sched->thread)
900900 kthread_stop(sched->thread);
901901
902+ /* Confirm no work left behind accessing device structures */
903+ cancel_delayed_work_sync(&sched->work_tdr);
904+
902905 sched->ready = false;
903906 }
904907 EXPORT_SYMBOL(drm_sched_fini);
drivers/gpu/drm/sun4i/sun4i_tcon.c+2−19
@@ -569,30 +569,13 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, · 568 unmodified lines
569569 if (info->bus_flags & DRM_BUS_FLAG_DE_LOW)
570570 val |= SUN4I_TCON0_IO_POL_DE_NEGATIVE;
571571
572− /*
573− * On A20 and similar SoCs, the only way to achieve Positive Edge
574− * (Rising Edge), is setting dclk clock phase to 2/3(240°).
575− * By default TCON works in Negative Edge(Falling Edge),
576− * this is why phase is set to 0 in that case.
577− * Unfortunately there's no way to logically invert dclk through
578− * IO_POL register.
579− * The only acceptable way to work, triple checked with scope,
580− * is using clock phase set to 0° for Negative Edge and set to 240°
581− * for Positive Edge.
582− * On A33 and similar SoCs there would be a 90° phase option,
583− * but it divides also dclk by 2.
584− * Following code is a way to avoid quirks all around TCON
585− * and DOTCLOCK drivers.
586− */
587− if (info->bus_flags & DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE)
588− clk_set_phase(tcon->dclk, 240);
589−
590572 if (info->bus_flags & DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE)
591− clk_set_phase(tcon->dclk, 0);
573+ val |= SUN4I_TCON0_IO_POL_DCLK_DRIVE_NEGEDGE;
592574
593575 regmap_update_bits(tcon->regs, SUN4I_TCON0_IO_POL_REG,
594576 SUN4I_TCON0_IO_POL_HSYNC_POSITIVE |
595577 SUN4I_TCON0_IO_POL_VSYNC_POSITIVE |
578+ SUN4I_TCON0_IO_POL_DCLK_DRIVE_NEGEDGE |
596579 SUN4I_TCON0_IO_POL_DE_NEGATIVE,
597580 val);
598581
drivers/gpu/drm/sun4i/sun4i_tcon.h+1−0
@@ -113,6 +113,7 @@ · 112 unmodified lines
113113 #define SUN4I_TCON0_IO_POL_REG 0x88
114114 #define SUN4I_TCON0_IO_POL_DCLK_PHASE(phase) ((phase & 3) << 28)
115115 #define SUN4I_TCON0_IO_POL_DE_NEGATIVE BIT(27)
116+#define SUN4I_TCON0_IO_POL_DCLK_DRIVE_NEGEDGE BIT(26)
116117 #define SUN4I_TCON0_IO_POL_HSYNC_POSITIVE BIT(25)
117118 #define SUN4I_TCON0_IO_POL_VSYNC_POSITIVE BIT(24)
118119
drivers/gpu/drm/sun4i/sun8i_csc.c+44−65
@@ -46,33 +46,6 @@ static const u32 yuv2rgb[2][2][12] = { · 45 unmodified lines
4646 },
4747 };
4848
49−static const u32 yvu2rgb[2][2][12] = {
50− [DRM_COLOR_YCBCR_LIMITED_RANGE] = {
51− [DRM_COLOR_YCBCR_BT601] = {
52− 0x000004A8, 0x00000662, 0x00000000, 0xFFFC8451,
53− 0x000004A8, 0xFFFFFCC0, 0xFFFFFE6F, 0x00021E4D,
54− 0x000004A8, 0x00000000, 0x00000811, 0xFFFBACA9,
55− },
56− [DRM_COLOR_YCBCR_BT709] = {
57− 0x000004A8, 0x0000072B, 0x00000000, 0xFFFC1F99,
58− 0x000004A8, 0xFFFFFDDF, 0xFFFFFF26, 0x00013383,
59− 0x000004A8, 0x00000000, 0x00000873, 0xFFFB7BEF,
60− }
61− },
62− [DRM_COLOR_YCBCR_FULL_RANGE] = {
63− [DRM_COLOR_YCBCR_BT601] = {
64− 0x00000400, 0x0000059B, 0x00000000, 0xFFFD322E,
65− 0x00000400, 0xFFFFFD25, 0xFFFFFEA0, 0x00021DD5,
66− 0x00000400, 0x00000000, 0x00000716, 0xFFFC74BD,
67− },
68− [DRM_COLOR_YCBCR_BT709] = {
69− 0x00000400, 0x0000064C, 0x00000000, 0xFFFCD9B4,
70− 0x00000400, 0xFFFFFE21, 0xFFFFFF41, 0x00014F96,
71− 0x00000400, 0x00000000, 0x0000076C, 0xFFFC49EF,
72− }
73− },
74−};
75−
7649 /*
7750 * DE3 has a bit different CSC units. Factors are in two's complement format.
7851 * First three factors in a row are multiplication factors which have 17 bits
@@ -96,7 +69,7 @@ static const u32 yvu2rgb[2][2][12] = { · 17 unmodified lines
9669 * c20 c21 c22 [d2 const2]
9770 */
9871
99−static const u32 yuv2rgb_de3[2][2][12] = {
72+static const u32 yuv2rgb_de3[2][3][12] = {
10073 [DRM_COLOR_YCBCR_LIMITED_RANGE] = {
10174 [DRM_COLOR_YCBCR_BT601] = {
10275 0x0002542A, 0x00000000, 0x0003312A, 0xFFC00000,
@@ -107,6 +80,11 @@ static const u32 yuv2rgb_de3[2][2][12] = { · 4 unmodified lines
10780 0x0002542A, 0x00000000, 0x000395E2, 0xFFC00000,
10881 0x0002542A, 0xFFFF92D2, 0xFFFEEF27, 0xFE000000,
10982 0x0002542A, 0x0004398C, 0x00000000, 0xFE000000,
83+ },
84+ [DRM_COLOR_YCBCR_BT2020] = {
85+ 0x0002542A, 0x00000000, 0x00035B7B, 0xFFC00000,
86+ 0x0002542A, 0xFFFFA017, 0xFFFEB2FC, 0xFE000000,
87+ 0x0002542A, 0x00044896, 0x00000000, 0xFE000000,
11088 }
11189 },
11290 [DRM_COLOR_YCBCR_FULL_RANGE] = {
@@ -119,33 +97,11 @@ static const u32 yuv2rgb_de3[2][2][12] = { · 6 unmodified lines
11997 0x00020000, 0x00000000, 0x0003264C, 0x00000000,
12098 0x00020000, 0xFFFFA018, 0xFFFF1053, 0xFE000000,
12199 0x00020000, 0x0003B611, 0x00000000, 0xFE000000,
122− }
123− },
124−};
125−
126−static const u32 yvu2rgb_de3[2][2][12] = {
127− [DRM_COLOR_YCBCR_LIMITED_RANGE] = {
128− [DRM_COLOR_YCBCR_BT601] = {
129− 0x0002542A, 0x0003312A, 0x00000000, 0xFFC00000,
130− 0x0002542A, 0xFFFE5FC3, 0xFFFF376B, 0xFE000000,
131− 0x0002542A, 0x00000000, 0x000408D2, 0xFE000000,
132100 },
133− [DRM_COLOR_YCBCR_BT709] = {
134− 0x0002542A, 0x000395E2, 0x00000000, 0xFFC00000,
135− 0x0002542A, 0xFFFEEF27, 0xFFFF92D2, 0xFE000000,
136− 0x0002542A, 0x00000000, 0x0004398C, 0xFE000000,
137− }
138− },
139− [DRM_COLOR_YCBCR_FULL_RANGE] = {
140− [DRM_COLOR_YCBCR_BT601] = {
141− 0x00020000, 0x0002CDD2, 0x00000000, 0x00000000,
142− 0x00020000, 0xFFFE925D, 0xFFFF4FCE, 0xFE000000,
143− 0x00020000, 0x00000000, 0x00038B43, 0xFE000000,
144− },
145− [DRM_COLOR_YCBCR_BT709] = {
146− 0x00020000, 0x0003264C, 0x00000000, 0x00000000,
147− 0x00020000, 0xFFFF1053, 0xFFFFA018, 0xFE000000,
148− 0x00020000, 0x00000000, 0x0003B611, 0xFE000000,
101+ [DRM_COLOR_YCBCR_BT2020] = {
102+ 0x00020000, 0x00000000, 0x0002F2FE, 0x00000000,
103+ 0x00020000, 0xFFFFABC0, 0xFFFEDB78, 0xFE000000,
104+ 0x00020000, 0x0003C346, 0x00000000, 0xFE000000,
149105 }
150106 },
151107 };
@@ -157,21 +113,30 @@ static void sun8i_csc_set_coefficients(struct regmap *map, u32 base, · 5 unmodified lines
157113 {
158114 const u32 *table;
159115 u32 base_reg;
116+ int i;
117+
118+ table = yuv2rgb[range][encoding];
160119
161120 switch (mode) {
162121 case SUN8I_CSC_MODE_YUV2RGB:
163− table = yuv2rgb[range][encoding];
122+ base_reg = SUN8I_CSC_COEFF(base, 0);
123+ regmap_bulk_write(map, base_reg, table, 12);
164124 break;
165125 case SUN8I_CSC_MODE_YVU2RGB:
166− table = yvu2rgb[range][encoding];
126+ for (i = 0; i < 12; i++) {
127+ if ((i & 3) == 1)
128+ base_reg = SUN8I_CSC_COEFF(base, i + 1);
129+ else if ((i & 3) == 2)
130+ base_reg = SUN8I_CSC_COEFF(base, i - 1);
131+ else
132+ base_reg = SUN8I_CSC_COEFF(base, i);
133+ regmap_write(map, base_reg, table[i]);
134+ }
167135 break;
168136 default:
169137 DRM_WARN("Wrong CSC mode specified.\n");
170138 return;
171139 }
172−
173− base_reg = SUN8I_CSC_COEFF(base, 0);
174− regmap_bulk_write(map, base_reg, table, 12);
175140 }
176141
177142 static void sun8i_de3_ccsc_set_coefficients(struct regmap *map, int layer,
@@ -180,22 +145,36 @@ static void sun8i_de3_ccsc_set_coefficients(struct regmap *map, int layer, · 2 unmodified lines
180145 enum drm_color_range range)
181146 {
182147 const u32 *table;
183− u32 base_reg;
148+ u32 addr;
149+ int i;
150+
151+ table = yuv2rgb_de3[range][encoding];
184152
185153 switch (mode) {
186154 case SUN8I_CSC_MODE_YUV2RGB:
187− table = yuv2rgb_de3[range][encoding];
155+ addr = SUN50I_MIXER_BLEND_CSC_COEFF(DE3_BLD_BASE, layer, 0);
156+ regmap_bulk_write(map, addr, table, 12);
188157 break;
189158 case SUN8I_CSC_MODE_YVU2RGB:
190− table = yvu2rgb_de3[range][encoding];
159+ for (i = 0; i < 12; i++) {
160+ if ((i & 3) == 1)
161+ addr = SUN50I_MIXER_BLEND_CSC_COEFF(DE3_BLD_BASE,
162+ layer,
163+ i + 1);
164+ else if ((i & 3) == 2)
165+ addr = SUN50I_MIXER_BLEND_CSC_COEFF(DE3_BLD_BASE,
166+ layer,
167+ i - 1);
168+ else
169+ addr = SUN50I_MIXER_BLEND_CSC_COEFF(DE3_BLD_BASE,
170+ layer, i);
171+ regmap_write(map, addr, table[i]);
172+ }
191173 break;
192174 default:
193175 DRM_WARN("Wrong CSC mode specified.\n");
194176 return;
195177 }
196−
197− base_reg = SUN50I_MIXER_BLEND_CSC_COEFF(DE3_BLD_BASE, layer, 0, 0);
198− regmap_bulk_write(map, base_reg, table, 12);
199178 }
200179
201180 static void sun8i_csc_enable(struct regmap *map, u32 base, bool enable)
drivers/gpu/drm/sun4i/sun8i_mixer.h+2−4
@@ -50,10 +50,8 @@ · 49 unmodified lines
5050 #define SUN8I_MIXER_BLEND_CK_MIN(base, x) ((base) + 0xe0 + 0x04 * (x))
5151 #define SUN8I_MIXER_BLEND_OUTCTL(base) ((base) + 0xfc)
5252 #define SUN50I_MIXER_BLEND_CSC_CTL(base) ((base) + 0x100)
53−#define SUN50I_MIXER_BLEND_CSC_COEFF(base, layer, x, y) \
54− ((base) + 0x110 + (layer) * 0x30 + (x) * 0x10 + 4 * (y))
55−#define SUN50I_MIXER_BLEND_CSC_CONST(base, layer, i) \
56− ((base) + 0x110 + (layer) * 0x30 + (i) * 0x10 + 0x0c)
53+#define SUN50I_MIXER_BLEND_CSC_COEFF(base, layer, x) \
54+ ((base) + 0x110 + (layer) * 0x30 + (x) * 4)
5755
5856 #define SUN8I_MIXER_BLEND_PIPE_CTL_EN_MSK GENMASK(12, 8)
5957 #define SUN8I_MIXER_BLEND_PIPE_CTL_EN(pipe) BIT(8 + pipe)
drivers/gpu/drm/sun4i/sun8i_vi_layer.c+2−0
@@ -543,6 +543,8 @@ struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct drm_device *drm, · 542 unmodified lines
543543
544544 supported_encodings = BIT(DRM_COLOR_YCBCR_BT601) |
545545 BIT(DRM_COLOR_YCBCR_BT709);
546+ if (mixer->cfg->is_de3)
547+ supported_encodings |= BIT(DRM_COLOR_YCBCR_BT2020);
546548
547549 supported_ranges = BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) |
548550 BIT(DRM_COLOR_YCBCR_FULL_RANGE);
drivers/gpu/drm/tiny/cirrus.c+0−1
@@ -602,7 +602,6 @@ static int cirrus_pci_probe(struct pci_dev *pdev, · 601 unmodified lines
602602
603603 drm_mode_config_reset(dev);
604604
605− dev->pdev = pdev;
606605 pci_set_drvdata(pdev, dev);
607606 ret = drm_dev_register(dev, 0);
608607 if (ret)
drivers/gpu/drm/ttm/ttm_bo.c+3−1
@@ -138,8 +138,10 @@ void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo, · 137 unmodified lines
138138
139139 dma_resv_assert_held(bo->base.resv);
140140
141− if (bo->pin_count)
141+ if (bo->pin_count) {
142+ ttm_bo_del_from_lru(bo);
142143 return;
144+ }
143145
144146 man = ttm_manager_type(bdev, mem->mem_type);
145147 list_move_tail(&bo->lru, &man->lru[bo->priority]);
drivers/gpu/drm/v3d/v3d_drv.c+2−2
@@ -232,8 +232,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev) · 231 unmodified lines
232232 return ret;
233233
234234 mmu_debug = V3D_READ(V3D_MMU_DEBUG_INFO);
235− dev->coherent_dma_mask =
236− DMA_BIT_MASK(30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_PA_WIDTH));
235+ dma_set_mask_and_coherent(dev,
236+ DMA_BIT_MASK(30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_PA_WIDTH)));
237237 v3d->va_width = 30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_VA_WIDTH);
238238
239239 ident1 = V3D_READ(V3D_HUB_IDENT1);
drivers/gpu/drm/v3d/v3d_irq.c+2−5
@@ -178,10 +178,7 @@ v3d_hub_irq(int irq, void *arg) · 177 unmodified lines
178178 };
179179 const char *client = "?";
180180
181− V3D_WRITE(V3D_MMU_CTL,
182− V3D_READ(V3D_MMU_CTL) & (V3D_MMU_CTL_CAP_EXCEEDED |
183− V3D_MMU_CTL_PT_INVALID |
184− V3D_MMU_CTL_WRITE_VIOLATION));
181+ V3D_WRITE(V3D_MMU_CTL, V3D_READ(V3D_MMU_CTL));
185182
186183 if (v3d->ver >= 41) {
187184 axi_id = axi_id >> 5;
@@ -217,7 +214,7 @@ v3d_irq_init(struct v3d_dev *v3d) · 29 unmodified lines
217214 V3D_CORE_WRITE(core, V3D_CTL_INT_CLR, V3D_CORE_IRQS);
218215 V3D_WRITE(V3D_HUB_INT_CLR, V3D_HUB_IRQS);
219216
220− irq1 = platform_get_irq(v3d_to_pdev(v3d), 1);
217+ irq1 = platform_get_irq_optional(v3d_to_pdev(v3d), 1);
221218 if (irq1 == -EPROBE_DEFER)
222219 return irq1;
223220 if (irq1 > 0) {
drivers/gpu/drm/vboxvideo/vbox_drv.c+6−5
@@ -51,7 +51,6 @@ static int vbox_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 50 unmodified lines
5151 if (IS_ERR(vbox))
5252 return PTR_ERR(vbox);
5353
54− vbox->ddev.pdev = pdev;
5554 pci_set_drvdata(pdev, vbox);
5655 mutex_init(&vbox->hw_mutex);
5756
@@ -109,15 +108,16 @@ static void vbox_pci_remove(struct pci_dev *pdev) · 51 unmodified lines
109108 static int vbox_pm_suspend(struct device *dev)
110109 {
111110 struct vbox_private *vbox = dev_get_drvdata(dev);
111+ struct pci_dev *pdev = to_pci_dev(dev);
112112 int error;
113113
114114 error = drm_mode_config_helper_suspend(&vbox->ddev);
115115 if (error)
116116 return error;
117117
118− pci_save_state(vbox->ddev.pdev);
119− pci_disable_device(vbox->ddev.pdev);
120− pci_set_power_state(vbox->ddev.pdev, PCI_D3hot);
118+ pci_save_state(pdev);
119+ pci_disable_device(pdev);
120+ pci_set_power_state(pdev, PCI_D3hot);
121121
122122 return 0;
123123 }
@@ -125,8 +125,9 @@ static int vbox_pm_suspend(struct device *dev) · 1 unmodified line
125125 static int vbox_pm_resume(struct device *dev)
126126 {
127127 struct vbox_private *vbox = dev_get_drvdata(dev);
128+ struct pci_dev *pdev = to_pci_dev(dev);
128129
129− if (pci_enable_device(vbox->ddev.pdev))
130+ if (pci_enable_device(pdev))
130131 return -EIO;
131132
132133 return drm_mode_config_helper_resume(&vbox->ddev);
drivers/gpu/drm/vboxvideo/vbox_irq.c+3−1
@@ -170,10 +170,12 @@ static void vbox_hotplug_worker(struct work_struct *work) · 169 unmodified lines
170170
171171 int vbox_irq_init(struct vbox_private *vbox)
172172 {
173+ struct pci_dev *pdev = to_pci_dev(vbox->ddev.dev);
174+
173175 INIT_WORK(&vbox->hotplug_work, vbox_hotplug_worker);
174176 vbox_update_mode_hints(vbox);
175177
176− return drm_irq_install(&vbox->ddev, vbox->ddev.pdev->irq);
178+ return drm_irq_install(&vbox->ddev, pdev->irq);
177179 }
178180
179181 void vbox_irq_fini(struct vbox_private *vbox)
drivers/gpu/drm/vboxvideo/vbox_main.c+6−2
@@ -8,7 +8,9 @@ · 7 unmodified lines
88 * Hans de Goede <hdegoede@redhat.com>
99 */
1010
11+#include <linux/pci.h>
1112 #include <linux/vbox_err.h>
13+
1214 #include <drm/drm_fb_helper.h>
1315 #include <drm/drm_crtc_helper.h>
1416 #include <drm/drm_damage_helper.h>
@@ -30,6 +32,7 @@ void vbox_report_caps(struct vbox_private *vbox) · 15 unmodified lines
3032
3133 static int vbox_accel_init(struct vbox_private *vbox)
3234 {
35+ struct pci_dev *pdev = to_pci_dev(vbox->ddev.dev);
3336 struct vbva_buffer *vbva;
3437 unsigned int i;
3538
@@ -41,7 +44,7 @@ static int vbox_accel_init(struct vbox_private *vbox) · 5 unmodified lines
4144 /* Take a command buffer for each screen from the end of usable VRAM. */
4245 vbox->available_vram_size -= vbox->num_crtcs * VBVA_MIN_BUFFER_SIZE;
4346
44− vbox->vbva_buffers = pci_iomap_range(vbox->ddev.pdev, 0,
47+ vbox->vbva_buffers = pci_iomap_range(pdev, 0,
4548 vbox->available_vram_size,
4649 vbox->num_crtcs *
4750 VBVA_MIN_BUFFER_SIZE);
@@ -106,6 +109,7 @@ bool vbox_check_supported(u16 id) · 58 unmodified lines
106109
107110 int vbox_hw_init(struct vbox_private *vbox)
108111 {
112+ struct pci_dev *pdev = to_pci_dev(vbox->ddev.dev);
109113 int ret = -ENOMEM;
110114
111115 vbox->full_vram_size = inl(VBE_DISPI_IOPORT_DATA);
@@ -115,7 +119,7 @@ int vbox_hw_init(struct vbox_private *vbox) · 3 unmodified lines
115119
116120 /* Map guest-heap at end of vram */
117121 vbox->guest_heap =
118− pci_iomap_range(vbox->ddev.pdev, 0, GUEST_HEAP_OFFSET(vbox),
122+ pci_iomap_range(pdev, 0, GUEST_HEAP_OFFSET(vbox),
119123 GUEST_HEAP_SIZE);
120124 if (!vbox->guest_heap)
121125 return -ENOMEM;
drivers/gpu/drm/vboxvideo/vbox_ttm.c+4−3
@@ -15,8 +15,9 @@ int vbox_mm_init(struct vbox_private *vbox) · 14 unmodified lines
1515 struct drm_vram_mm *vmm;
1616 int ret;
1717 struct drm_device *dev = &vbox->ddev;
18+ struct pci_dev *pdev = to_pci_dev(dev->dev);
1819
19− vmm = drm_vram_helper_alloc_mm(dev, pci_resource_start(dev->pdev, 0),
20+ vmm = drm_vram_helper_alloc_mm(dev, pci_resource_start(pdev, 0),
2021 vbox->available_vram_size);
2122 if (IS_ERR(vmm)) {
2223 ret = PTR_ERR(vmm);
@@ -24,8 +25,8 @@ int vbox_mm_init(struct vbox_private *vbox) · 1 unmodified line
2425 return ret;
2526 }
2627
27− vbox->fb_mtrr = arch_phys_wc_add(pci_resource_start(dev->pdev, 0),
28− pci_resource_len(dev->pdev, 0));
28+ vbox->fb_mtrr = arch_phys_wc_add(pci_resource_start(pdev, 0),
29+ pci_resource_len(pdev, 0));
2930 return 0;
3031 }
3132
drivers/gpu/drm/vc4/vc4_bo.c+19−92
@@ -21,7 +21,7 @@ · 20 unmodified lines
2121 #include "vc4_drv.h"
2222 #include "uapi/drm/vc4_drm.h"
2323
24−static vm_fault_t vc4_fault(struct vm_fault *vmf);
24+static const struct drm_gem_object_funcs vc4_gem_object_funcs;
2525
2626 static const char * const bo_type_names[] = {
2727 "kernel",
@@ -376,20 +376,6 @@ out: · 348 unmodified lines
376376 return bo;
377377 }
378378
379−static const struct vm_operations_struct vc4_vm_ops = {
380− .fault = vc4_fault,
381− .open = drm_gem_vm_open,
382− .close = drm_gem_vm_close,
383−};
384−
385−static const struct drm_gem_object_funcs vc4_gem_object_funcs = {
386− .free = vc4_free_object,
387− .export = vc4_prime_export,
388− .get_sg_table = drm_gem_cma_get_sg_table,
389− .vmap = vc4_prime_vmap,
390− .vm_ops = &vc4_vm_ops,
391−};
392−
393379 /**
394380 * vc4_create_object - Implementation of driver->gem_create_object.
395381 * @dev: DRM device
@@ -538,7 +524,7 @@ static void vc4_bo_cache_free_old(struct drm_device *dev) · 142 unmodified lines
538524 /* Called on the last userspace/kernel unreference of the BO. Returns
539525 * it to the BO cache if possible, otherwise frees it.
540526 */
541−void vc4_free_object(struct drm_gem_object *gem_bo)
527+static void vc4_free_object(struct drm_gem_object *gem_bo)
542528 {
543529 struct drm_device *dev = gem_bo->dev;
544530 struct vc4_dev *vc4 = to_vc4_dev(dev);
@@ -673,7 +659,7 @@ static void vc4_bo_cache_time_timer(struct timer_list *t) · 128 unmodified lines
673659 schedule_work(&vc4->bo_cache.time_work);
674660 }
675661
676−struct dma_buf * vc4_prime_export(struct drm_gem_object *obj, int flags)
662+static struct dma_buf *vc4_prime_export(struct drm_gem_object *obj, int flags)
677663 {
678664 struct vc4_bo *bo = to_vc4_bo(obj);
679665 struct dma_buf *dmabuf;
@@ -718,19 +704,9 @@ static vm_fault_t vc4_fault(struct vm_fault *vmf) · 38 unmodified lines
718704 return VM_FAULT_SIGBUS;
719705 }
720706
721−int vc4_mmap(struct file *filp, struct vm_area_struct *vma)
707+static int vc4_gem_object_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma)
722708 {
723− struct drm_gem_object *gem_obj;
724− unsigned long vm_pgoff;
725− struct vc4_bo *bo;
726− int ret;
727−
728− ret = drm_gem_mmap(filp, vma);
729− if (ret)
730− return ret;
731−
732− gem_obj = vma->vm_private_data;
733− bo = to_vc4_bo(gem_obj);
709+ struct vc4_bo *bo = to_vc4_bo(obj);
734710
735711 if (bo->validated_shader && (vma->vm_flags & VM_WRITE)) {
736712 DRM_DEBUG("mmaping of shader BOs for writing not allowed.\n");
@@ -744,72 +720,23 @@ int vc4_mmap(struct file *filp, struct vm_area_struct *vma) · 7 unmodified lines
744720 return -EINVAL;
745721 }
746722
747− /*
748− * Clear the VM_PFNMAP flag that was set by drm_gem_mmap(), and set the
749− * vm_pgoff (used as a fake buffer offset by DRM) to 0 as we want to map
750− * the whole buffer.
751− */
752− vma->vm_flags &= ~VM_PFNMAP;
753−
754− /* This ->vm_pgoff dance is needed to make all parties happy:
755− * - dma_mmap_wc() uses ->vm_pgoff as an offset within the allocated
756− * mem-region, hence the need to set it to zero (the value set by
757− * the DRM core is a virtual offset encoding the GEM object-id)
758− * - the mmap() core logic needs ->vm_pgoff to be restored to its
759− * initial value before returning from this function because it
760− * encodes the offset of this GEM in the dev->anon_inode pseudo-file
761− * and this information will be used when we invalidate userspace
762− * mappings with drm_vma_node_unmap() (called from vc4_gem_purge()).
763− */
764− vm_pgoff = vma->vm_pgoff;
765− vma->vm_pgoff = 0;
766− ret = dma_mmap_wc(bo->base.base.dev->dev, vma, bo->base.vaddr,
767− bo->base.paddr, vma->vm_end - vma->vm_start);
768− vma->vm_pgoff = vm_pgoff;
769−
770− if (ret)
771− drm_gem_vm_close(vma);
772−
773− return ret;
774−}
775−
776−int vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma)
777−{
778− struct vc4_bo *bo = to_vc4_bo(obj);
779−
780− if (bo->validated_shader && (vma->vm_flags & VM_WRITE)) {
781− DRM_DEBUG("mmaping of shader BOs for writing not allowed.\n");
782− return -EINVAL;
783− }
784−
785− return drm_gem_prime_mmap(obj, vma);
723+ return drm_gem_cma_mmap(obj, vma);
786724 }
787725
788−int vc4_prime_vmap(struct drm_gem_object *obj, struct dma_buf_map *map)
789−{
790− struct vc4_bo *bo = to_vc4_bo(obj);
791−
792− if (bo->validated_shader) {
793− DRM_DEBUG("mmaping of shader BOs not allowed.\n");
794− return -EINVAL;
795− }
796−
797− return drm_gem_cma_vmap(obj, map);
798−}
799−
800−struct drm_gem_object *
801−vc4_prime_import_sg_table(struct drm_device *dev,
802− struct dma_buf_attachment *attach,
803− struct sg_table *sgt)
804−{
805− struct drm_gem_object *obj;
806−
807− obj = drm_gem_cma_prime_import_sg_table(dev, attach, sgt);
808− if (IS_ERR(obj))
809− return obj;
726+static const struct vm_operations_struct vc4_vm_ops = {
727+ .fault = vc4_fault,
728+ .open = drm_gem_vm_open,
729+ .close = drm_gem_vm_close,
730+};
810731
811− return obj;
812−}
732+static const struct drm_gem_object_funcs vc4_gem_object_funcs = {
733+ .free = vc4_free_object,
734+ .export = vc4_prime_export,
735+ .get_sg_table = drm_gem_cma_get_sg_table,
736+ .vmap = drm_gem_cma_vmap,
737+ .mmap = vc4_gem_object_mmap,
738+ .vm_ops = &vc4_vm_ops,
739+};
813740
814741 static int vc4_grab_bin_bo(struct vc4_dev *vc4, struct vc4_file *vc4file)
815742 {
drivers/gpu/drm/vc4/vc4_drv.c+2−17
@@ -140,17 +140,7 @@ static void vc4_close(struct drm_device *dev, struct drm_file *file) · 139 unmodified lines
140140 kfree(vc4file);
141141 }
142142
143−static const struct file_operations vc4_drm_fops = {
144− .owner = THIS_MODULE,
145− .open = drm_open,
146− .release = drm_release,
147− .unlocked_ioctl = drm_ioctl,
148− .mmap = vc4_mmap,
149− .poll = drm_poll,
150− .read = drm_read,
151− .compat_ioctl = drm_compat_ioctl,
152− .llseek = noop_llseek,
153−};
143+DEFINE_DRM_GEM_FOPS(vc4_drm_fops);
154144
155145 static const struct drm_ioctl_desc vc4_drm_ioctls[] = {
156146 DRM_IOCTL_DEF_DRV(VC4_SUBMIT_CL, vc4_submit_cl_ioctl, DRM_RENDER_ALLOW),
@@ -190,12 +180,7 @@ static struct drm_driver vc4_drm_driver = { · 33 unmodified lines
190180
191181 .gem_create_object = vc4_create_object,
192182
193− .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
194− .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
195− .gem_prime_import_sg_table = vc4_prime_import_sg_table,
196− .gem_prime_mmap = vc4_prime_mmap,
197−
198− .dumb_create = vc4_dumb_create,
183+ DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(vc4_dumb_create),
199184
200185 .ioctls = vc4_drm_ioctls,
201186 .num_ioctls = ARRAY_SIZE(vc4_drm_ioctls),
drivers/gpu/drm/vc4/vc4_drv.h+0−8
@@ -782,13 +782,11 @@ struct vc4_validated_shader_info { · 781 unmodified lines
782782
783783 /* vc4_bo.c */
784784 struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size);
785−void vc4_free_object(struct drm_gem_object *gem_obj);
786785 struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t size,
787786 bool from_cache, enum vc4_kernel_bo_type type);
788787 int vc4_dumb_create(struct drm_file *file_priv,
789788 struct drm_device *dev,
790789 struct drm_mode_create_dumb *args);
791−struct dma_buf *vc4_prime_export(struct drm_gem_object *obj, int flags);
792790 int vc4_create_bo_ioctl(struct drm_device *dev, void *data,
793791 struct drm_file *file_priv);
794792 int vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data,
@@ -803,12 +801,6 @@ int vc4_get_hang_state_ioctl(struct drm_device *dev, void *data, · 8 unmodified lines
803801 struct drm_file *file_priv);
804802 int vc4_label_bo_ioctl(struct drm_device *dev, void *data,
805803 struct drm_file *file_priv);
806−int vc4_mmap(struct file *filp, struct vm_area_struct *vma);
807−int vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma);
808−struct drm_gem_object *vc4_prime_import_sg_table(struct drm_device *dev,
809− struct dma_buf_attachment *attach,
810− struct sg_table *sgt);
811−int vc4_prime_vmap(struct drm_gem_object *obj, struct dma_buf_map *map);
812804 int vc4_bo_cache_init(struct drm_device *dev);
813805 int vc4_bo_inc_usecnt(struct vc4_bo *bo);
814806 void vc4_bo_dec_usecnt(struct vc4_bo *bo);
drivers/gpu/drm/virtio/virtgpu_drv.c+0−1
@@ -54,7 +54,6 @@ static int virtio_gpu_pci_quirk(struct drm_device *dev, struct virtio_device *vd · 53 unmodified lines
5454 DRM_INFO("pci: %s detected at %s\n",
5555 vga ? "virtio-vga" : "virtio-gpu-pci",
5656 pname);
57− dev->pdev = pdev;
5857 if (vga)
5958 drm_fb_helper_remove_conflicting_pci_framebuffers(pdev,
6059 "virtiodrmfb");
drivers/gpu/drm/virtio/virtgpu_gem.c+5−3
@@ -39,9 +39,6 @@ static int virtio_gpu_gem_create(struct drm_file *file, · 38 unmodified lines
3939 int ret;
4040 u32 handle;
4141
42− if (vgdev->has_virgl_3d)
43− virtio_gpu_create_context(dev, file);
44−
4542 ret = virtio_gpu_object_create(vgdev, params, &obj, NULL);
4643 if (ret < 0)
4744 return ret;
@@ -119,6 +116,11 @@ int virtio_gpu_gem_object_open(struct drm_gem_object *obj, · 71 unmodified lines
119116 if (!vgdev->has_virgl_3d)
120117 goto out_notify;
121118
119+ /* the context might still be missing when the first ioctl is
120+ * DRM_IOCTL_MODE_CREATE_DUMB or DRM_IOCTL_PRIME_FD_TO_HANDLE
121+ */
122+ virtio_gpu_create_context(obj->dev, file);
123+
122124 objs = virtio_gpu_array_alloc(1);
123125 if (!objs)
124126 return -ENOMEM;
drivers/gpu/drm/virtio/virtgpu_vram.c+1−0
@@ -69,6 +69,7 @@ static const struct drm_gem_object_funcs virtio_gpu_vram_funcs = { · 68 unmodified lines
6969 .close = virtio_gpu_gem_object_close,
7070 .free = virtio_gpu_vram_free,
7171 .mmap = virtio_gpu_vram_mmap,
72+ .export = virtgpu_gem_prime_export,
7273 };
7374
7475 bool virtio_gpu_is_vram(struct virtio_gpu_object *bo)
drivers/gpu/drm/vkms/vkms_drv.c+41−8
@@ -34,12 +34,16 @@ · 33 unmodified lines
3434 #define DRIVER_MAJOR 1
3535 #define DRIVER_MINOR 0
3636
37−static struct vkms_device *vkms_device;
37+static struct vkms_config *default_config;
3838
39−bool enable_cursor = true;
39+static bool enable_cursor = true;
4040 module_param_named(enable_cursor, enable_cursor, bool, 0444);
4141 MODULE_PARM_DESC(enable_cursor, "Enable/Disable cursor support");
4242
43+static bool enable_writeback = true;
44+module_param_named(enable_writeback, enable_writeback, bool, 0444);
45+MODULE_PARM_DESC(enable_writeback, "Enable/Disable writeback connector support");
46+
4347 DEFINE_DRM_GEM_FOPS(vkms_driver_fops);
4448
4549 static void vkms_release(struct drm_device *dev)
@@ -122,10 +126,11 @@ static int vkms_modeset_init(struct vkms_device *vkmsdev) · 76 unmodified lines
122126 return vkms_output_init(vkmsdev, 0);
123127 }
124128
125−static int __init vkms_init(void)
129+static int vkms_create(struct vkms_config *config)
126130 {
127131 int ret;
128132 struct platform_device *pdev;
133+ struct vkms_device *vkms_device;
129134
130135 pdev = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0);
131136 if (IS_ERR(pdev))
@@ -143,6 +148,8 @@ static int __init vkms_init(void) · 11 unmodified lines
143148 goto out_devres;
144149 }
145150 vkms_device->platform = pdev;
151+ vkms_device->config = config;
152+ config->dev = vkms_device;
146153
147154 ret = dma_coerce_mask_and_coherent(vkms_device->drm.dev,
148155 DMA_BIT_MASK(64));
@@ -179,21 +186,47 @@ out_unregister: · 30 unmodified lines
179186 return ret;
180187 }
181188
182−static void __exit vkms_exit(void)
189+static int __init vkms_init(void)
190+{
191+ struct vkms_config *config;
192+
193+ config = kmalloc(sizeof(*config), GFP_KERNEL);
194+ if (!config)
195+ return -ENOMEM;
196+
197+ default_config = config;
198+
199+ config->cursor = enable_cursor;
200+ config->writeback = enable_writeback;
201+
202+ return vkms_create(config);
203+}
204+
205+static void vkms_destroy(struct vkms_config *config)
183206 {
184207 struct platform_device *pdev;
185208
186− if (!vkms_device) {
209+ if (!config->dev) {
187210 DRM_INFO("vkms_device is NULL.\n");
188211 return;
189212 }
190213
191− pdev = vkms_device->platform;
214+ pdev = config->dev->platform;
192215
193− drm_dev_unregister(&vkms_device->drm);
194− drm_atomic_helper_shutdown(&vkms_device->drm);
216+ drm_dev_unregister(&config->dev->drm);
217+ drm_atomic_helper_shutdown(&config->dev->drm);
195218 devres_release_group(&pdev->dev, NULL);
196219 platform_device_unregister(pdev);
220+
221+ config->dev = NULL;
222+}
223+
224+static void __exit vkms_exit(void)
225+{
226+ if (default_config->dev)
227+ vkms_destroy(default_config);
228+
229+ kfree(default_config);
197230 }
198231
199232 module_init(vkms_init);
drivers/gpu/drm/vkms/vkms_drv.h+10−2
@@ -19,8 +19,6 @@ · 18 unmodified lines
1919 #define XRES_MAX 8192
2020 #define YRES_MAX 8192
2121
22−extern bool enable_cursor;
23−
2422 struct vkms_composer {
2523 struct drm_framebuffer fb;
2624 struct drm_rect src, dst;
@@ -82,10 +80,20 @@ struct vkms_output { · 55 unmodified lines
8280 spinlock_t composer_lock;
8381 };
8482
83+struct vkms_device;
84+
85+struct vkms_config {
86+ bool writeback;
87+ bool cursor;
88+ /* only set when instantiated */
89+ struct vkms_device *dev;
90+};
91+
8592 struct vkms_device {
8693 struct drm_device drm;
8794 struct platform_device *platform;
8895 struct vkms_output output;
96+ const struct vkms_config *config;
8997 };
9098
9199 #define drm_crtc_to_vkms_output(target) \
drivers/gpu/drm/vkms/vkms_output.c+8−5
@@ -41,12 +41,13 @@ int vkms_output_init(struct vkms_device *vkmsdev, int index) · 40 unmodified lines
4141 struct drm_crtc *crtc = &output->crtc;
4242 struct drm_plane *primary, *cursor = NULL;
4343 int ret;
44+ int writeback;
4445
4546 primary = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_PRIMARY, index);
4647 if (IS_ERR(primary))
4748 return PTR_ERR(primary);
4849
49− if (enable_cursor) {
50+ if (vkmsdev->config->cursor) {
5051 cursor = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_CURSOR, index);
5152 if (IS_ERR(cursor)) {
5253 ret = PTR_ERR(cursor);
@@ -80,9 +81,11 @@ int vkms_output_init(struct vkms_device *vkmsdev, int index) · 27 unmodified lines
8081 goto err_attach;
8182 }
8283
83− ret = vkms_enable_writeback_connector(vkmsdev);
84− if (ret)
85− DRM_ERROR("Failed to init writeback connector\n");
84+ if (vkmsdev->config->writeback) {
85+ writeback = vkms_enable_writeback_connector(vkmsdev);
86+ if (writeback)
87+ DRM_ERROR("Failed to init writeback connector\n");
88+ }
8689
8790 drm_mode_config_reset(dev);
8891
@@ -98,7 +101,7 @@ err_connector: · 9 unmodified lines
98101 drm_crtc_cleanup(crtc);
99102
100103 err_crtc:
101− if (enable_cursor)
104+ if (vkmsdev->config->cursor)
102105 drm_plane_cleanup(cursor);
103106
104107 err_cursor:
drivers/gpu/drm/vmwgfx/Makefile+3−3
@@ -1,9 +1,9 @@
11 # SPDX-License-Identifier: GPL-2.0
22 vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr.o vmwgfx_kms.o vmwgfx_drv.o \
33 vmwgfx_fb.o vmwgfx_ioctl.o vmwgfx_resource.o vmwgfx_ttm_buffer.o \
4− vmwgfx_fifo.o vmwgfx_irq.o vmwgfx_ldu.o vmwgfx_ttm_glue.o \
5− vmwgfx_overlay.o vmwgfx_marker.o vmwgfx_gmrid_manager.o \
6− vmwgfx_fence.o vmwgfx_bo.o vmwgfx_scrn.o vmwgfx_context.o \
4+ vmwgfx_cmd.o vmwgfx_irq.o vmwgfx_ldu.o vmwgfx_ttm_glue.o \
5+ vmwgfx_overlay.o vmwgfx_gmrid_manager.o vmwgfx_fence.o \
6+ vmwgfx_bo.o vmwgfx_scrn.o vmwgfx_context.o \
77 vmwgfx_surface.o vmwgfx_prime.o vmwgfx_mob.o vmwgfx_shader.o \
88 vmwgfx_cmdbuf_res.o vmwgfx_cmdbuf.o vmwgfx_stdu.o \
99 vmwgfx_cotable.o vmwgfx_so.o vmwgfx_binding.o vmwgfx_msg.o \
drivers/gpu/drm/vmwgfx/vmwgfx_binding.c+26−26
@@ -555,7 +555,7 @@ static int vmw_binding_scrub_shader(struct vmw_ctx_bindinfo *bi, bool rebind) · 554 unmodified lines
555555 SVGA3dCmdSetShader body;
556556 } *cmd;
557557
558− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
558+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
559559 if (unlikely(cmd == NULL))
560560 return -ENOMEM;
561561
@@ -564,7 +564,7 @@ static int vmw_binding_scrub_shader(struct vmw_ctx_bindinfo *bi, bool rebind) · 2 unmodified lines
564564 cmd->body.cid = bi->ctx->id;
565565 cmd->body.type = binding->shader_slot + SVGA3D_SHADERTYPE_MIN;
566566 cmd->body.shid = ((rebind) ? bi->res->id : SVGA3D_INVALID_ID);
567− vmw_fifo_commit(dev_priv, sizeof(*cmd));
567+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
568568
569569 return 0;
570570 }
@@ -587,7 +587,7 @@ static int vmw_binding_scrub_render_target(struct vmw_ctx_bindinfo *bi, · 16 unmodified lines
587587 SVGA3dCmdSetRenderTarget body;
588588 } *cmd;
589589
590− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
590+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
591591 if (unlikely(cmd == NULL))
592592 return -ENOMEM;
593593
@@ -598,7 +598,7 @@ static int vmw_binding_scrub_render_target(struct vmw_ctx_bindinfo *bi, · 4 unmodified lines
598598 cmd->body.target.sid = ((rebind) ? bi->res->id : SVGA3D_INVALID_ID);
599599 cmd->body.target.face = 0;
600600 cmd->body.target.mipmap = 0;
601− vmw_fifo_commit(dev_priv, sizeof(*cmd));
601+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
602602
603603 return 0;
604604 }
@@ -626,7 +626,7 @@ static int vmw_binding_scrub_texture(struct vmw_ctx_bindinfo *bi, · 21 unmodified lines
626626 } body;
627627 } *cmd;
628628
629− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
629+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
630630 if (unlikely(cmd == NULL))
631631 return -ENOMEM;
632632
@@ -636,7 +636,7 @@ static int vmw_binding_scrub_texture(struct vmw_ctx_bindinfo *bi, · 3 unmodified lines
636636 cmd->body.s1.stage = binding->texture_stage;
637637 cmd->body.s1.name = SVGA3D_TS_BIND_TEXTURE;
638638 cmd->body.s1.value = ((rebind) ? bi->res->id : SVGA3D_INVALID_ID);
639− vmw_fifo_commit(dev_priv, sizeof(*cmd));
639+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
640640
641641 return 0;
642642 }
@@ -657,7 +657,7 @@ static int vmw_binding_scrub_dx_shader(struct vmw_ctx_bindinfo *bi, bool rebind) · 14 unmodified lines
657657 SVGA3dCmdDXSetShader body;
658658 } *cmd;
659659
660− cmd = VMW_FIFO_RESERVE_DX(dev_priv, sizeof(*cmd), bi->ctx->id);
660+ cmd = VMW_CMD_CTX_RESERVE(dev_priv, sizeof(*cmd), bi->ctx->id);
661661 if (unlikely(cmd == NULL))
662662 return -ENOMEM;
663663
@@ -665,7 +665,7 @@ static int vmw_binding_scrub_dx_shader(struct vmw_ctx_bindinfo *bi, bool rebind) · 1 unmodified line
665665 cmd->header.size = sizeof(cmd->body);
666666 cmd->body.type = binding->shader_slot + SVGA3D_SHADERTYPE_MIN;
667667 cmd->body.shaderId = ((rebind) ? bi->res->id : SVGA3D_INVALID_ID);
668− vmw_fifo_commit(dev_priv, sizeof(*cmd));
668+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
669669
670670 return 0;
671671 }
@@ -686,7 +686,7 @@ static int vmw_binding_scrub_cb(struct vmw_ctx_bindinfo *bi, bool rebind) · 14 unmodified lines
686686 SVGA3dCmdDXSetSingleConstantBuffer body;
687687 } *cmd;
688688
689− cmd = VMW_FIFO_RESERVE_DX(dev_priv, sizeof(*cmd), bi->ctx->id);
689+ cmd = VMW_CMD_CTX_RESERVE(dev_priv, sizeof(*cmd), bi->ctx->id);
690690 if (unlikely(cmd == NULL))
691691 return -ENOMEM;
692692
@@ -703,7 +703,7 @@ static int vmw_binding_scrub_cb(struct vmw_ctx_bindinfo *bi, bool rebind) · 10 unmodified lines
703703 cmd->body.sizeInBytes = 0;
704704 cmd->body.sid = SVGA3D_INVALID_ID;
705705 }
706− vmw_fifo_commit(dev_priv, sizeof(*cmd));
706+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
707707
708708 return 0;
709709 }
@@ -810,7 +810,7 @@ static int vmw_emit_set_sr(struct vmw_ctx_binding_state *cbs, · 100 unmodified lines
810810
811811 view_id_size = cbs->bind_cmd_count*sizeof(uint32);
812812 cmd_size = sizeof(*cmd) + view_id_size;
813− cmd = VMW_FIFO_RESERVE_DX(ctx->dev_priv, cmd_size, ctx->id);
813+ cmd = VMW_CMD_CTX_RESERVE(ctx->dev_priv, cmd_size, ctx->id);
814814 if (unlikely(cmd == NULL))
815815 return -ENOMEM;
816816
@@ -821,7 +821,7 @@ static int vmw_emit_set_sr(struct vmw_ctx_binding_state *cbs, · 4 unmodified lines
821821
822822 memcpy(&cmd[1], cbs->bind_cmd_buffer, view_id_size);
823823
824− vmw_fifo_commit(ctx->dev_priv, cmd_size);
824+ vmw_cmd_commit(ctx->dev_priv, cmd_size);
825825 bitmap_clear(cbs->per_shader[shader_slot].dirty_sr,
826826 cbs->bind_first_slot, cbs->bind_cmd_count);
827827
@@ -846,7 +846,7 @@ static int vmw_emit_set_rt(struct vmw_ctx_binding_state *cbs) · 18 unmodified lines
846846 vmw_collect_view_ids(cbs, loc, SVGA3D_MAX_SIMULTANEOUS_RENDER_TARGETS);
847847 view_id_size = cbs->bind_cmd_count*sizeof(uint32);
848848 cmd_size = sizeof(*cmd) + view_id_size;
849− cmd = VMW_FIFO_RESERVE_DX(ctx->dev_priv, cmd_size, ctx->id);
849+ cmd = VMW_CMD_CTX_RESERVE(ctx->dev_priv, cmd_size, ctx->id);
850850 if (unlikely(cmd == NULL))
851851 return -ENOMEM;
852852
@@ -860,7 +860,7 @@ static int vmw_emit_set_rt(struct vmw_ctx_binding_state *cbs) · 7 unmodified lines
860860
861861 memcpy(&cmd[1], cbs->bind_cmd_buffer, view_id_size);
862862
863− vmw_fifo_commit(ctx->dev_priv, cmd_size);
863+ vmw_cmd_commit(ctx->dev_priv, cmd_size);
864864
865865 return 0;
866866
@@ -930,7 +930,7 @@ static int vmw_emit_set_so_target(struct vmw_ctx_binding_state *cbs) · 63 unmodified lines
930930
931931 so_target_size = cbs->bind_cmd_count*sizeof(SVGA3dSoTarget);
932932 cmd_size = sizeof(*cmd) + so_target_size;
933− cmd = VMW_FIFO_RESERVE_DX(ctx->dev_priv, cmd_size, ctx->id);
933+ cmd = VMW_CMD_CTX_RESERVE(ctx->dev_priv, cmd_size, ctx->id);
934934 if (unlikely(cmd == NULL))
935935 return -ENOMEM;
936936
@@ -938,7 +938,7 @@ static int vmw_emit_set_so_target(struct vmw_ctx_binding_state *cbs) · 1 unmodified line
938938 cmd->header.size = sizeof(cmd->body) + so_target_size;
939939 memcpy(&cmd[1], cbs->bind_cmd_buffer, so_target_size);
940940
941− vmw_fifo_commit(ctx->dev_priv, cmd_size);
941+ vmw_cmd_commit(ctx->dev_priv, cmd_size);
942942
943943 return 0;
944944
@@ -1044,7 +1044,7 @@ static int vmw_emit_set_vb(struct vmw_ctx_binding_state *cbs) · 99 unmodified lines
10441044
10451045 set_vb_size = cbs->bind_cmd_count*sizeof(SVGA3dVertexBuffer);
10461046 cmd_size = sizeof(*cmd) + set_vb_size;
1047− cmd = VMW_FIFO_RESERVE_DX(ctx->dev_priv, cmd_size, ctx->id);
1047+ cmd = VMW_CMD_CTX_RESERVE(ctx->dev_priv, cmd_size, ctx->id);
10481048 if (unlikely(cmd == NULL))
10491049 return -ENOMEM;
10501050
@@ -1054,7 +1054,7 @@ static int vmw_emit_set_vb(struct vmw_ctx_binding_state *cbs) · 3 unmodified lines
10541054
10551055 memcpy(&cmd[1], cbs->bind_cmd_buffer, set_vb_size);
10561056
1057− vmw_fifo_commit(ctx->dev_priv, cmd_size);
1057+ vmw_cmd_commit(ctx->dev_priv, cmd_size);
10581058 bitmap_clear(cbs->dirty_vb,
10591059 cbs->bind_first_slot, cbs->bind_cmd_count);
10601060
@@ -1074,7 +1074,7 @@ static int vmw_emit_set_uav(struct vmw_ctx_binding_state *cbs) · 13 unmodified lines
10741074 vmw_collect_view_ids(cbs, loc, SVGA3D_MAX_UAVIEWS);
10751075 view_id_size = cbs->bind_cmd_count*sizeof(uint32);
10761076 cmd_size = sizeof(*cmd) + view_id_size;
1077− cmd = VMW_FIFO_RESERVE_DX(ctx->dev_priv, cmd_size, ctx->id);
1077+ cmd = VMW_CMD_CTX_RESERVE(ctx->dev_priv, cmd_size, ctx->id);
10781078 if (!cmd)
10791079 return -ENOMEM;
10801080
@@ -1086,7 +1086,7 @@ static int vmw_emit_set_uav(struct vmw_ctx_binding_state *cbs) · 5 unmodified lines
10861086
10871087 memcpy(&cmd[1], cbs->bind_cmd_buffer, view_id_size);
10881088
1089− vmw_fifo_commit(ctx->dev_priv, cmd_size);
1089+ vmw_cmd_commit(ctx->dev_priv, cmd_size);
10901090
10911091 return 0;
10921092 }
@@ -1104,7 +1104,7 @@ static int vmw_emit_set_cs_uav(struct vmw_ctx_binding_state *cbs) · 11 unmodified lines
11041104 vmw_collect_view_ids(cbs, loc, SVGA3D_MAX_UAVIEWS);
11051105 view_id_size = cbs->bind_cmd_count*sizeof(uint32);
11061106 cmd_size = sizeof(*cmd) + view_id_size;
1107− cmd = VMW_FIFO_RESERVE_DX(ctx->dev_priv, cmd_size, ctx->id);
1107+ cmd = VMW_CMD_CTX_RESERVE(ctx->dev_priv, cmd_size, ctx->id);
11081108 if (!cmd)
11091109 return -ENOMEM;
11101110
@@ -1116,7 +1116,7 @@ static int vmw_emit_set_cs_uav(struct vmw_ctx_binding_state *cbs) · 5 unmodified lines
11161116
11171117 memcpy(&cmd[1], cbs->bind_cmd_buffer, view_id_size);
11181118
1119− vmw_fifo_commit(ctx->dev_priv, cmd_size);
1119+ vmw_cmd_commit(ctx->dev_priv, cmd_size);
11201120
11211121 return 0;
11221122 }
@@ -1263,7 +1263,7 @@ static int vmw_binding_scrub_ib(struct vmw_ctx_bindinfo *bi, bool rebind) · 140 unmodified lines
12631263 SVGA3dCmdDXSetIndexBuffer body;
12641264 } *cmd;
12651265
1266− cmd = VMW_FIFO_RESERVE_DX(dev_priv, sizeof(*cmd), bi->ctx->id);
1266+ cmd = VMW_CMD_CTX_RESERVE(dev_priv, sizeof(*cmd), bi->ctx->id);
12671267 if (unlikely(cmd == NULL))
12681268 return -ENOMEM;
12691269
@@ -1279,7 +1279,7 @@ static int vmw_binding_scrub_ib(struct vmw_ctx_bindinfo *bi, bool rebind) · 9 unmodified lines
12791279 cmd->body.offset = 0;
12801280 }
12811281
1282− vmw_fifo_commit(dev_priv, sizeof(*cmd));
1282+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
12831283
12841284 return 0;
12851285 }
@@ -1315,14 +1315,14 @@ static int vmw_binding_scrub_so(struct vmw_ctx_bindinfo *bi, bool rebind) · 29 unmodified lines
13151315 SVGA3dCmdDXSetStreamOutput body;
13161316 } *cmd;
13171317
1318− cmd = VMW_FIFO_RESERVE_DX(dev_priv, sizeof(*cmd), bi->ctx->id);
1318+ cmd = VMW_CMD_CTX_RESERVE(dev_priv, sizeof(*cmd), bi->ctx->id);
13191319 if (!cmd)
13201320 return -ENOMEM;
13211321
13221322 cmd->header.id = SVGA_3D_CMD_DX_SET_STREAMOUTPUT;
13231323 cmd->header.size = sizeof(cmd->body);
13241324 cmd->body.soid = rebind ? bi->res->id : SVGA3D_INVALID_ID;
1325− vmw_fifo_commit(dev_priv, sizeof(*cmd));
1325+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
13261326
13271327 return 0;
13281328 }
drivers/gpu/drm/vmwgfx/vmwgfx_cmd.crenamed from drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c+59−67
@@ -1,7 +1,7 @@
11 // SPDX-License-Identifier: GPL-2.0 OR MIT
22 /**************************************************************************
33 *
4− * Copyright 2009-2015 VMware, Inc., Palo Alto, CA., USA
4+ * Copyright 2009-2020 VMware, Inc., Palo Alto, CA., USA
55 *
66 * Permission is hereby granted, free of charge, to any person obtaining a
77 * copy of this software and associated documentation files (the
@@ -36,9 +36,8 @@ struct vmw_temp_set_context { · 28 unmodified lines
3636 SVGA3dCmdDXTempSetContext body;
3737 };
3838
39−bool vmw_fifo_have_3d(struct vmw_private *dev_priv)
39+bool vmw_supports_3d(struct vmw_private *dev_priv)
4040 {
41− u32 *fifo_mem = dev_priv->mmio_virt;
4241 uint32_t fifo_min, hwversion;
4342 const struct vmw_fifo_state *fifo = &dev_priv->fifo;
4443
@@ -62,15 +61,15 @@ bool vmw_fifo_have_3d(struct vmw_private *dev_priv) · 17 unmodified lines
6261 if (!(dev_priv->capabilities & SVGA_CAP_EXTENDED_FIFO))
6362 return false;
6463
65− fifo_min = vmw_mmio_read(fifo_mem + SVGA_FIFO_MIN);
64+ fifo_min = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_MIN);
6665 if (fifo_min <= SVGA_FIFO_3D_HWVERSION * sizeof(unsigned int))
6766 return false;
6867
69− hwversion = vmw_mmio_read(fifo_mem +
70− ((fifo->capabilities &
71− SVGA_FIFO_CAP_3D_HWVERSION_REVISED) ?
72− SVGA_FIFO_3D_HWVERSION_REVISED :
73− SVGA_FIFO_3D_HWVERSION));
68+ hwversion = vmw_fifo_mem_read(dev_priv,
69+ ((fifo->capabilities &
70+ SVGA_FIFO_CAP_3D_HWVERSION_REVISED) ?
71+ SVGA_FIFO_3D_HWVERSION_REVISED :
72+ SVGA_FIFO_3D_HWVERSION));
7473
7574 if (hwversion == 0)
7675 return false;
@@ -87,13 +86,12 @@ bool vmw_fifo_have_3d(struct vmw_private *dev_priv) · 10 unmodified lines
8786
8887 bool vmw_fifo_have_pitchlock(struct vmw_private *dev_priv)
8988 {
90− u32 *fifo_mem = dev_priv->mmio_virt;
9189 uint32_t caps;
9290
9391 if (!(dev_priv->capabilities & SVGA_CAP_EXTENDED_FIFO))
9492 return false;
9593
96− caps = vmw_mmio_read(fifo_mem + SVGA_FIFO_CAPABILITIES);
94+ caps = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_CAPABILITIES);
9795 if (caps & SVGA_FIFO_CAP_PITCHLOCK)
9896 return true;
9997
@@ -102,7 +100,6 @@ bool vmw_fifo_have_pitchlock(struct vmw_private *dev_priv) · 2 unmodified lines
102100
103101 int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo)
104102 {
105− u32 *fifo_mem = dev_priv->mmio_virt;
106103 uint32_t max;
107104 uint32_t min;
108105
@@ -129,6 +126,7 @@ int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo) · 20 unmodified lines
129126
130127 vmw_write(dev_priv, SVGA_REG_ENABLE, SVGA_REG_ENABLE_ENABLE |
131128 SVGA_REG_ENABLE_HIDE);
129+
132130 vmw_write(dev_priv, SVGA_REG_TRACES, 0);
133131
134132 min = 4;
@@ -139,19 +137,19 @@ int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo) · 4 unmodified lines
139137 if (min < PAGE_SIZE)
140138 min = PAGE_SIZE;
141139
142− vmw_mmio_write(min, fifo_mem + SVGA_FIFO_MIN);
143− vmw_mmio_write(dev_priv->mmio_size, fifo_mem + SVGA_FIFO_MAX);
140+ vmw_fifo_mem_write(dev_priv, SVGA_FIFO_MIN, min);
141+ vmw_fifo_mem_write(dev_priv, SVGA_FIFO_MAX, dev_priv->fifo_mem_size);
144142 wmb();
145− vmw_mmio_write(min, fifo_mem + SVGA_FIFO_NEXT_CMD);
146− vmw_mmio_write(min, fifo_mem + SVGA_FIFO_STOP);
147− vmw_mmio_write(0, fifo_mem + SVGA_FIFO_BUSY);
143+ vmw_fifo_mem_write(dev_priv, SVGA_FIFO_NEXT_CMD, min);
144+ vmw_fifo_mem_write(dev_priv, SVGA_FIFO_STOP, min);
145+ vmw_fifo_mem_write(dev_priv, SVGA_FIFO_BUSY, 0);
148146 mb();
149147
150148 vmw_write(dev_priv, SVGA_REG_CONFIG_DONE, 1);
151149
152− max = vmw_mmio_read(fifo_mem + SVGA_FIFO_MAX);
153− min = vmw_mmio_read(fifo_mem + SVGA_FIFO_MIN);
154− fifo->capabilities = vmw_mmio_read(fifo_mem + SVGA_FIFO_CAPABILITIES);
150+ max = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_MAX);
151+ min = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_MIN);
152+ fifo->capabilities = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_CAPABILITIES);
155153
156154 DRM_INFO("Fifo max 0x%08x min 0x%08x cap 0x%08x\n",
157155 (unsigned int) max,
@@ -159,15 +157,14 @@ int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo) · 1 unmodified line
159157 (unsigned int) fifo->capabilities);
160158
161159 atomic_set(&dev_priv->marker_seq, dev_priv->last_read_seqno);
162− vmw_mmio_write(dev_priv->last_read_seqno, fifo_mem + SVGA_FIFO_FENCE);
163− vmw_marker_queue_init(&fifo->marker_queue);
160+ vmw_fifo_mem_write(dev_priv, SVGA_FIFO_FENCE, dev_priv->last_read_seqno);
164161
165162 return 0;
166163 }
167164
168165 void vmw_fifo_ping_host(struct vmw_private *dev_priv, uint32_t reason)
169166 {
170− u32 *fifo_mem = dev_priv->mmio_virt;
167+ u32 *fifo_mem = dev_priv->fifo_mem;
171168
172169 if (cmpxchg(fifo_mem + SVGA_FIFO_BUSY, 0, 1) == 0)
173170 vmw_write(dev_priv, SVGA_REG_SYNC, reason);
@@ -175,13 +172,11 @@ void vmw_fifo_ping_host(struct vmw_private *dev_priv, uint32_t reason) · 1 unmodified line
175172
176173 void vmw_fifo_release(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo)
177174 {
178− u32 *fifo_mem = dev_priv->mmio_virt;
179−
180175 vmw_write(dev_priv, SVGA_REG_SYNC, SVGA_SYNC_GENERIC);
181176 while (vmw_read(dev_priv, SVGA_REG_BUSY) != 0)
182177 ;
183178
184− dev_priv->last_read_seqno = vmw_mmio_read(fifo_mem + SVGA_FIFO_FENCE);
179+ dev_priv->last_read_seqno = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_FENCE);
185180
186181 vmw_write(dev_priv, SVGA_REG_CONFIG_DONE,
187182 dev_priv->config_done_state);
@@ -190,8 +185,6 @@ void vmw_fifo_release(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo) · 2 unmodified lines
190185 vmw_write(dev_priv, SVGA_REG_TRACES,
191186 dev_priv->traces_state);
192187
193− vmw_marker_queue_takedown(&fifo->marker_queue);
194−
195188 if (likely(fifo->static_buffer != NULL)) {
196189 vfree(fifo->static_buffer);
197190 fifo->static_buffer = NULL;
@@ -205,11 +198,10 @@ void vmw_fifo_release(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo) · 7 unmodified lines
205198
206199 static bool vmw_fifo_is_full(struct vmw_private *dev_priv, uint32_t bytes)
207200 {
208− u32 *fifo_mem = dev_priv->mmio_virt;
209− uint32_t max = vmw_mmio_read(fifo_mem + SVGA_FIFO_MAX);
210− uint32_t next_cmd = vmw_mmio_read(fifo_mem + SVGA_FIFO_NEXT_CMD);
211− uint32_t min = vmw_mmio_read(fifo_mem + SVGA_FIFO_MIN);
212− uint32_t stop = vmw_mmio_read(fifo_mem + SVGA_FIFO_STOP);
201+ uint32_t max = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_MAX);
202+ uint32_t next_cmd = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_NEXT_CMD);
203+ uint32_t min = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_MIN);
204+ uint32_t stop = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_STOP);
213205
214206 return ((max - next_cmd) + (stop - min) <= bytes);
215207 }
@@ -298,7 +290,7 @@ static void *vmw_local_fifo_reserve(struct vmw_private *dev_priv, · 82 unmodified lines
298290 uint32_t bytes)
299291 {
300292 struct vmw_fifo_state *fifo_state = &dev_priv->fifo;
301− u32 *fifo_mem = dev_priv->mmio_virt;
293+ u32 *fifo_mem = dev_priv->fifo_mem;
302294 uint32_t max;
303295 uint32_t min;
304296 uint32_t next_cmd;
@@ -306,9 +298,9 @@ static void *vmw_local_fifo_reserve(struct vmw_private *dev_priv, · 1 unmodified line
306298 int ret;
307299
308300 mutex_lock(&fifo_state->fifo_mutex);
309− max = vmw_mmio_read(fifo_mem + SVGA_FIFO_MAX);
310− min = vmw_mmio_read(fifo_mem + SVGA_FIFO_MIN);
311− next_cmd = vmw_mmio_read(fifo_mem + SVGA_FIFO_NEXT_CMD);
301+ max = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_MAX);
302+ min = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_MIN);
303+ next_cmd = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_NEXT_CMD);
312304
313305 if (unlikely(bytes >= (max - min)))
314306 goto out_err;
@@ -319,7 +311,7 @@ static void *vmw_local_fifo_reserve(struct vmw_private *dev_priv, · 4 unmodified lines
319311 fifo_state->reserved_size = bytes;
320312
321313 while (1) {
322− uint32_t stop = vmw_mmio_read(fifo_mem + SVGA_FIFO_STOP);
314+ uint32_t stop = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_STOP);
323315 bool need_bounce = false;
324316 bool reserve_in_place = false;
325317
@@ -353,8 +345,9 @@ static void *vmw_local_fifo_reserve(struct vmw_private *dev_priv, · 27 unmodified lines
353345 fifo_state->using_bounce_buffer = false;
354346
355347 if (reserveable)
356− vmw_mmio_write(bytes, fifo_mem +
357− SVGA_FIFO_RESERVED);
348+ vmw_fifo_mem_write(dev_priv,
349+ SVGA_FIFO_RESERVED,
350+ bytes);
358351 return (void __force *) (fifo_mem +
359352 (next_cmd >> 2));
360353 } else {
@@ -381,7 +374,7 @@ out_err: · 20 unmodified lines
381374 return NULL;
382375 }
383376
384−void *vmw_fifo_reserve_dx(struct vmw_private *dev_priv, uint32_t bytes,
377+void *vmw_cmd_ctx_reserve(struct vmw_private *dev_priv, uint32_t bytes,
385378 int ctx_id)
386379 {
387380 void *ret;
@@ -402,10 +395,11 @@ void *vmw_fifo_reserve_dx(struct vmw_private *dev_priv, uint32_t bytes, · 14 unmodified lines
402395 }
403396
404397 static void vmw_fifo_res_copy(struct vmw_fifo_state *fifo_state,
405− u32 *fifo_mem,
398+ struct vmw_private *vmw,
406399 uint32_t next_cmd,
407400 uint32_t max, uint32_t min, uint32_t bytes)
408401 {
402+ u32 *fifo_mem = vmw->fifo_mem;
409403 uint32_t chunk_size = max - next_cmd;
410404 uint32_t rest;
411405 uint32_t *buffer = (fifo_state->dynamic_buffer != NULL) ?
@@ -414,7 +408,7 @@ static void vmw_fifo_res_copy(struct vmw_fifo_state *fifo_state, · 2 unmodified lines
414408 if (bytes < chunk_size)
415409 chunk_size = bytes;
416410
417− vmw_mmio_write(bytes, fifo_mem + SVGA_FIFO_RESERVED);
411+ vmw_fifo_mem_write(vmw, SVGA_FIFO_RESERVED, bytes);
418412 mb();
419413 memcpy(fifo_mem + (next_cmd >> 2), buffer, chunk_size);
420414 rest = bytes - chunk_size;
@@ -423,7 +417,7 @@ static void vmw_fifo_res_copy(struct vmw_fifo_state *fifo_state, · 2 unmodified lines
423417 }
424418
425419 static void vmw_fifo_slow_copy(struct vmw_fifo_state *fifo_state,
426− u32 *fifo_mem,
420+ struct vmw_private *vmw,
427421 uint32_t next_cmd,
428422 uint32_t max, uint32_t min, uint32_t bytes)
429423 {
@@ -431,12 +425,12 @@ static void vmw_fifo_slow_copy(struct vmw_fifo_state *fifo_state, · 1 unmodified line
431425 fifo_state->dynamic_buffer : fifo_state->static_buffer;
432426
433427 while (bytes > 0) {
434− vmw_mmio_write(*buffer++, fifo_mem + (next_cmd >> 2));
428+ vmw_fifo_mem_write(vmw, (next_cmd >> 2), *buffer++);
435429 next_cmd += sizeof(uint32_t);
436430 if (unlikely(next_cmd == max))
437431 next_cmd = min;
438432 mb();
439− vmw_mmio_write(next_cmd, fifo_mem + SVGA_FIFO_NEXT_CMD);
433+ vmw_fifo_mem_write(vmw, SVGA_FIFO_NEXT_CMD, next_cmd);
440434 mb();
441435 bytes -= sizeof(uint32_t);
442436 }
@@ -445,10 +439,9 @@ static void vmw_fifo_slow_copy(struct vmw_fifo_state *fifo_state, · 2 unmodified lines
445439 static void vmw_local_fifo_commit(struct vmw_private *dev_priv, uint32_t bytes)
446440 {
447441 struct vmw_fifo_state *fifo_state = &dev_priv->fifo;
448− u32 *fifo_mem = dev_priv->mmio_virt;
449− uint32_t next_cmd = vmw_mmio_read(fifo_mem + SVGA_FIFO_NEXT_CMD);
450− uint32_t max = vmw_mmio_read(fifo_mem + SVGA_FIFO_MAX);
451− uint32_t min = vmw_mmio_read(fifo_mem + SVGA_FIFO_MIN);
442+ uint32_t next_cmd = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_NEXT_CMD);
443+ uint32_t max = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_MAX);
444+ uint32_t min = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_MIN);
452445 bool reserveable = fifo_state->capabilities & SVGA_FIFO_CAP_RESERVE;
453446
454447 if (fifo_state->dx)
@@ -462,10 +455,10 @@ static void vmw_local_fifo_commit(struct vmw_private *dev_priv, uint32_t bytes) · 7 unmodified lines
462455
463456 if (fifo_state->using_bounce_buffer) {
464457 if (reserveable)
465− vmw_fifo_res_copy(fifo_state, fifo_mem,
458+ vmw_fifo_res_copy(fifo_state, dev_priv,
466459 next_cmd, max, min, bytes);
467460 else
468− vmw_fifo_slow_copy(fifo_state, fifo_mem,
461+ vmw_fifo_slow_copy(fifo_state, dev_priv,
469462 next_cmd, max, min, bytes);
470463
471464 if (fifo_state->dynamic_buffer) {
@@ -481,18 +474,18 @@ static void vmw_local_fifo_commit(struct vmw_private *dev_priv, uint32_t bytes) · 9 unmodified lines
481474 if (next_cmd >= max)
482475 next_cmd -= max - min;
483476 mb();
484− vmw_mmio_write(next_cmd, fifo_mem + SVGA_FIFO_NEXT_CMD);
477+ vmw_fifo_mem_write(dev_priv, SVGA_FIFO_NEXT_CMD, next_cmd);
485478 }
486479
487480 if (reserveable)
488− vmw_mmio_write(0, fifo_mem + SVGA_FIFO_RESERVED);
481+ vmw_fifo_mem_write(dev_priv, SVGA_FIFO_RESERVED, 0);
489482 mb();
490483 up_write(&fifo_state->rwsem);
491484 vmw_fifo_ping_host(dev_priv, SVGA_SYNC_GENERIC);
492485 mutex_unlock(&fifo_state->fifo_mutex);
493486 }
494487
495−void vmw_fifo_commit(struct vmw_private *dev_priv, uint32_t bytes)
488+void vmw_cmd_commit(struct vmw_private *dev_priv, uint32_t bytes)
496489 {
497490 if (dev_priv->cman)
498491 vmw_cmdbuf_commit(dev_priv->cman, bytes, NULL, false);
@@ -507,7 +500,7 @@ void vmw_fifo_commit(struct vmw_private *dev_priv, uint32_t bytes) · 8 unmodified lines
507500 * @dev_priv: Pointer to device private structure.
508501 * @bytes: Number of bytes to commit.
509502 */
510−void vmw_fifo_commit_flush(struct vmw_private *dev_priv, uint32_t bytes)
503+void vmw_cmd_commit_flush(struct vmw_private *dev_priv, uint32_t bytes)
511504 {
512505 if (dev_priv->cman)
513506 vmw_cmdbuf_commit(dev_priv->cman, bytes, NULL, true);
@@ -522,7 +515,7 @@ void vmw_fifo_commit_flush(struct vmw_private *dev_priv, uint32_t bytes) · 8 unmodified lines
522515 * @dev_priv: Pointer to device private structure.
523516 * @interruptible: Whether to wait interruptible if function needs to sleep.
524517 */
525−int vmw_fifo_flush(struct vmw_private *dev_priv, bool interruptible)
518+int vmw_cmd_flush(struct vmw_private *dev_priv, bool interruptible)
526519 {
527520 might_sleep();
528521
@@ -532,7 +525,7 @@ int vmw_fifo_flush(struct vmw_private *dev_priv, bool interruptible) · 3 unmodified lines
532525 return 0;
533526 }
534527
535−int vmw_fifo_send_fence(struct vmw_private *dev_priv, uint32_t *seqno)
528+int vmw_cmd_send_fence(struct vmw_private *dev_priv, uint32_t *seqno)
536529 {
537530 struct vmw_fifo_state *fifo_state = &dev_priv->fifo;
538531 struct svga_fifo_cmd_fence *cmd_fence;
@@ -540,7 +533,7 @@ int vmw_fifo_send_fence(struct vmw_private *dev_priv, uint32_t *seqno) · 1 unmodified line
540533 int ret = 0;
541534 uint32_t bytes = sizeof(u32) + sizeof(*cmd_fence);
542535
543− fm = VMW_FIFO_RESERVE(dev_priv, bytes);
536+ fm = VMW_CMD_RESERVE(dev_priv, bytes);
544537 if (unlikely(fm == NULL)) {
545538 *seqno = atomic_read(&dev_priv->marker_seq);
546539 ret = -ENOMEM;
@@ -560,15 +553,14 @@ int vmw_fifo_send_fence(struct vmw_private *dev_priv, uint32_t *seqno) · 13 unmodified lines
560553 * waiting code in vmwgfx_irq.c will emulate this.
561554 */
562555
563− vmw_fifo_commit(dev_priv, 0);
556+ vmw_cmd_commit(dev_priv, 0);
564557 return 0;
565558 }
566559
567560 *fm++ = SVGA_CMD_FENCE;
568561 cmd_fence = (struct svga_fifo_cmd_fence *) fm;
569562 cmd_fence->fence = *seqno;
570− vmw_fifo_commit_flush(dev_priv, bytes);
571− (void) vmw_marker_push(&fifo_state->marker_queue, *seqno);
563+ vmw_cmd_commit_flush(dev_priv, bytes);
572564 vmw_update_seqno(dev_priv, fifo_state);
573565
574566 out_err:
@@ -599,7 +591,7 @@ static int vmw_fifo_emit_dummy_legacy_query(struct vmw_private *dev_priv, · 24 unmodified lines
599591 SVGA3dCmdWaitForQuery body;
600592 } *cmd;
601593
602− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
594+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
603595 if (unlikely(cmd == NULL))
604596 return -ENOMEM;
605597
@@ -616,7 +608,7 @@ static int vmw_fifo_emit_dummy_legacy_query(struct vmw_private *dev_priv, · 10 unmodified lines
616608 cmd->body.guestResult.offset = 0;
617609 }
618610
619− vmw_fifo_commit(dev_priv, sizeof(*cmd));
611+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
620612
621613 return 0;
622614 }
@@ -645,7 +637,7 @@ static int vmw_fifo_emit_dummy_gb_query(struct vmw_private *dev_priv, · 22 unmodified lines
645637 SVGA3dCmdWaitForGBQuery body;
646638 } *cmd;
647639
648− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
640+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
649641 if (unlikely(cmd == NULL))
650642 return -ENOMEM;
651643
@@ -657,7 +649,7 @@ static int vmw_fifo_emit_dummy_gb_query(struct vmw_private *dev_priv, · 5 unmodified lines
657649 cmd->body.mobid = bo->mem.start;
658650 cmd->body.offset = 0;
659651
660− vmw_fifo_commit(dev_priv, sizeof(*cmd));
652+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
661653
662654 return 0;
663655 }
@@ -681,7 +673,7 @@ static int vmw_fifo_emit_dummy_gb_query(struct vmw_private *dev_priv, · 17 unmodified lines
681673 *
682674 * Returns -ENOMEM on failure to reserve fifo space.
683675 */
684−int vmw_fifo_emit_dummy_query(struct vmw_private *dev_priv,
676+int vmw_cmd_emit_dummy_query(struct vmw_private *dev_priv,
685677 uint32_t cid)
686678 {
687679 if (dev_priv->has_mob)
drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c+9−13
@@ -610,7 +610,7 @@ static void vmw_cmdbuf_work_func(struct work_struct *work) · 609 unmodified lines
610610
611611 /* Send a new fence in case one was removed */
612612 if (send_fence) {
613− vmw_fifo_send_fence(man->dev_priv, &dummy);
613+ vmw_cmd_send_fence(man->dev_priv, &dummy);
614614 wake_up_all(&man->idle_queue);
615615 }
616616
@@ -1208,18 +1208,14 @@ static int vmw_cmdbuf_startstop(struct vmw_cmdbuf_man *man, u32 context, · 591 unmodified lines
12081208 *
12091209 * @man: The command buffer manager.
12101210 * @size: The size of the main space pool.
1211− * @default_size: The default size of the command buffer for small kernel
1212− * submissions.
12131211 *
1214− * Set the size and allocate the main command buffer space pool,
1215− * as well as the default size of the command buffer for
1216− * small kernel submissions. If successful, this enables large command
1217− * submissions. Note that this function requires that rudimentary command
1212+ * Set the size and allocate the main command buffer space pool.
1213+ * If successful, this enables large command submissions.
1214+ * Note that this function requires that rudimentary command
12181215 * submission is already available and that the MOB memory manager is alive.
12191216 * Returns 0 on success. Negative error code on failure.
12201217 */
1221−int vmw_cmdbuf_set_pool_size(struct vmw_cmdbuf_man *man,
1222− size_t size, size_t default_size)
1218+int vmw_cmdbuf_set_pool_size(struct vmw_cmdbuf_man *man, size_t size)
12231219 {
12241220 struct vmw_private *dev_priv = man->dev_priv;
12251221 bool dummy;
@@ -1230,7 +1226,7 @@ int vmw_cmdbuf_set_pool_size(struct vmw_cmdbuf_man *man, · 4 unmodified lines
12301226
12311227 /* First, try to allocate a huge chunk of DMA memory */
12321228 size = PAGE_ALIGN(size);
1233− man->map = dma_alloc_coherent(&dev_priv->dev->pdev->dev, size,
1229+ man->map = dma_alloc_coherent(dev_priv->drm.dev, size,
12341230 &man->handle, GFP_KERNEL);
12351231 if (man->map) {
12361232 man->using_mob = false;
@@ -1313,7 +1309,7 @@ struct vmw_cmdbuf_man *vmw_cmdbuf_man_create(struct vmw_private *dev_priv) · 76 unmodified lines
13131309 man->num_contexts = (dev_priv->capabilities & SVGA_CAP_HP_CMD_QUEUE) ?
13141310 2 : 1;
13151311 man->headers = dma_pool_create("vmwgfx cmdbuf",
1316− &dev_priv->dev->pdev->dev,
1312+ dev_priv->drm.dev,
13171313 sizeof(SVGACBHeader),
13181314 64, PAGE_SIZE);
13191315 if (!man->headers) {
@@ -1322,7 +1318,7 @@ struct vmw_cmdbuf_man *vmw_cmdbuf_man_create(struct vmw_private *dev_priv) · 2 unmodified lines
13221318 }
13231319
13241320 man->dheaders = dma_pool_create("vmwgfx inline cmdbuf",
1325− &dev_priv->dev->pdev->dev,
1321+ dev_priv->drm.dev,
13261322 sizeof(struct vmw_cmdbuf_dheader),
13271323 64, PAGE_SIZE);
13281324 if (!man->dheaders) {
@@ -1387,7 +1383,7 @@ void vmw_cmdbuf_remove_pool(struct vmw_cmdbuf_man *man) · 58 unmodified lines
13871383 ttm_bo_put(man->cmd_space);
13881384 man->cmd_space = NULL;
13891385 } else {
1390− dma_free_coherent(&man->dev_priv->dev->pdev->dev,
1386+ dma_free_coherent(man->dev_priv->drm.dev,
13911387 man->size, man->map, man->handle);
13921388 }
13931389 }
drivers/gpu/drm/vmwgfx/vmwgfx_context.c+20−20
@@ -163,7 +163,7 @@ static void vmw_hw_context_destroy(struct vmw_resource *res) · 162 unmodified lines
163163 }
164164
165165 vmw_execbuf_release_pinned_bo(dev_priv);
166− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
166+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
167167 if (unlikely(cmd == NULL))
168168 return;
169169
@@ -171,7 +171,7 @@ static void vmw_hw_context_destroy(struct vmw_resource *res) · 1 unmodified line
171171 cmd->header.size = sizeof(cmd->body);
172172 cmd->body.cid = res->id;
173173
174− vmw_fifo_commit(dev_priv, sizeof(*cmd));
174+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
175175 vmw_fifo_resource_dec(dev_priv);
176176 }
177177
@@ -265,7 +265,7 @@ static int vmw_context_init(struct vmw_private *dev_priv, · 87 unmodified lines
265265 return -ENOMEM;
266266 }
267267
268− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
268+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
269269 if (unlikely(cmd == NULL)) {
270270 vmw_resource_unreference(&res);
271271 return -ENOMEM;
@@ -275,7 +275,7 @@ static int vmw_context_init(struct vmw_private *dev_priv, · 3 unmodified lines
275275 cmd->header.size = sizeof(cmd->body);
276276 cmd->body.cid = res->id;
277277
278− vmw_fifo_commit(dev_priv, sizeof(*cmd));
278+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
279279 vmw_fifo_resource_inc(dev_priv);
280280 res->hw_destroy = vmw_hw_context_destroy;
281281 return 0;
@@ -316,7 +316,7 @@ static int vmw_gb_context_create(struct vmw_resource *res) · 34 unmodified lines
316316 goto out_no_fifo;
317317 }
318318
319− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
319+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
320320 if (unlikely(cmd == NULL)) {
321321 ret = -ENOMEM;
322322 goto out_no_fifo;
@@ -325,7 +325,7 @@ static int vmw_gb_context_create(struct vmw_resource *res) · 2 unmodified lines
325325 cmd->header.id = SVGA_3D_CMD_DEFINE_GB_CONTEXT;
326326 cmd->header.size = sizeof(cmd->body);
327327 cmd->body.cid = res->id;
328− vmw_fifo_commit(dev_priv, sizeof(*cmd));
328+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
329329 vmw_fifo_resource_inc(dev_priv);
330330
331331 return 0;
@@ -348,7 +348,7 @@ static int vmw_gb_context_bind(struct vmw_resource *res, · 16 unmodified lines
348348
349349 BUG_ON(bo->mem.mem_type != VMW_PL_MOB);
350350
351− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
351+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
352352 if (unlikely(cmd == NULL))
353353 return -ENOMEM;
354354
@@ -358,7 +358,7 @@ static int vmw_gb_context_bind(struct vmw_resource *res, · 3 unmodified lines
358358 cmd->body.mobid = bo->mem.start;
359359 cmd->body.validContents = res->backup_dirty;
360360 res->backup_dirty = false;
361− vmw_fifo_commit(dev_priv, sizeof(*cmd));
361+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
362362
363363 return 0;
364364 }
@@ -392,7 +392,7 @@ static int vmw_gb_context_unbind(struct vmw_resource *res, · 27 unmodified lines
392392
393393 submit_size = sizeof(*cmd2) + (readback ? sizeof(*cmd1) : 0);
394394
395− cmd = VMW_FIFO_RESERVE(dev_priv, submit_size);
395+ cmd = VMW_CMD_RESERVE(dev_priv, submit_size);
396396 if (unlikely(cmd == NULL)) {
397397 mutex_unlock(&dev_priv->binding_mutex);
398398 return -ENOMEM;
@@ -411,7 +411,7 @@ static int vmw_gb_context_unbind(struct vmw_resource *res, · 12 unmodified lines
411411 cmd2->body.cid = res->id;
412412 cmd2->body.mobid = SVGA3D_INVALID_ID;
413413
414− vmw_fifo_commit(dev_priv, submit_size);
414+ vmw_cmd_commit(dev_priv, submit_size);
415415 mutex_unlock(&dev_priv->binding_mutex);
416416
417417 /*
@@ -440,14 +440,14 @@ static int vmw_gb_context_destroy(struct vmw_resource *res) · 22 unmodified lines
440440 if (likely(res->id == -1))
441441 return 0;
442442
443− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
443+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
444444 if (unlikely(cmd == NULL))
445445 return -ENOMEM;
446446
447447 cmd->header.id = SVGA_3D_CMD_DESTROY_GB_CONTEXT;
448448 cmd->header.size = sizeof(cmd->body);
449449 cmd->body.cid = res->id;
450− vmw_fifo_commit(dev_priv, sizeof(*cmd));
450+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
451451 if (dev_priv->query_cid == res->id)
452452 dev_priv->query_cid_valid = false;
453453 vmw_resource_release_id(res);
@@ -483,7 +483,7 @@ static int vmw_dx_context_create(struct vmw_resource *res) · 29 unmodified lines
483483 goto out_no_fifo;
484484 }
485485
486− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
486+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
487487 if (unlikely(cmd == NULL)) {
488488 ret = -ENOMEM;
489489 goto out_no_fifo;
@@ -492,7 +492,7 @@ static int vmw_dx_context_create(struct vmw_resource *res) · 2 unmodified lines
492492 cmd->header.id = SVGA_3D_CMD_DX_DEFINE_CONTEXT;
493493 cmd->header.size = sizeof(cmd->body);
494494 cmd->body.cid = res->id;
495− vmw_fifo_commit(dev_priv, sizeof(*cmd));
495+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
496496 vmw_fifo_resource_inc(dev_priv);
497497
498498 return 0;
@@ -515,7 +515,7 @@ static int vmw_dx_context_bind(struct vmw_resource *res, · 16 unmodified lines
515515
516516 BUG_ON(bo->mem.mem_type != VMW_PL_MOB);
517517
518− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
518+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
519519 if (unlikely(cmd == NULL))
520520 return -ENOMEM;
521521
@@ -525,7 +525,7 @@ static int vmw_dx_context_bind(struct vmw_resource *res, · 3 unmodified lines
525525 cmd->body.mobid = bo->mem.start;
526526 cmd->body.validContents = res->backup_dirty;
527527 res->backup_dirty = false;
528− vmw_fifo_commit(dev_priv, sizeof(*cmd));
528+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
529529
530530
531531 return 0;
@@ -608,7 +608,7 @@ static int vmw_dx_context_unbind(struct vmw_resource *res, · 76 unmodified lines
608608
609609 submit_size = sizeof(*cmd2) + (readback ? sizeof(*cmd1) : 0);
610610
611− cmd = VMW_FIFO_RESERVE(dev_priv, submit_size);
611+ cmd = VMW_CMD_RESERVE(dev_priv, submit_size);
612612 if (unlikely(cmd == NULL)) {
613613 mutex_unlock(&dev_priv->binding_mutex);
614614 return -ENOMEM;
@@ -627,7 +627,7 @@ static int vmw_dx_context_unbind(struct vmw_resource *res, · 12 unmodified lines
627627 cmd2->body.cid = res->id;
628628 cmd2->body.mobid = SVGA3D_INVALID_ID;
629629
630− vmw_fifo_commit(dev_priv, submit_size);
630+ vmw_cmd_commit(dev_priv, submit_size);
631631 mutex_unlock(&dev_priv->binding_mutex);
632632
633633 /*
@@ -656,14 +656,14 @@ static int vmw_dx_context_destroy(struct vmw_resource *res) · 22 unmodified lines
656656 if (likely(res->id == -1))
657657 return 0;
658658
659− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
659+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
660660 if (unlikely(cmd == NULL))
661661 return -ENOMEM;
662662
663663 cmd->header.id = SVGA_3D_CMD_DX_DESTROY_CONTEXT;
664664 cmd->header.size = sizeof(cmd->body);
665665 cmd->body.cid = res->id;
666− vmw_fifo_commit(dev_priv, sizeof(*cmd));
666+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
667667 if (dev_priv->query_cid == res->id)
668668 dev_priv->query_cid_valid = false;
669669 vmw_resource_release_id(res);
drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c+6−6
@@ -175,7 +175,7 @@ static int vmw_cotable_unscrub(struct vmw_resource *res) · 174 unmodified lines
175175 WARN_ON_ONCE(bo->mem.mem_type != VMW_PL_MOB);
176176 dma_resv_assert_held(bo->base.resv);
177177
178− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
178+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
179179 if (!cmd)
180180 return -ENOMEM;
181181
@@ -188,7 +188,7 @@ static int vmw_cotable_unscrub(struct vmw_resource *res) · 6 unmodified lines
188188 cmd->body.mobid = bo->mem.start;
189189 cmd->body.validSizeInBytes = vcotbl->size_read_back;
190190
191− vmw_fifo_commit_flush(dev_priv, sizeof(*cmd));
191+ vmw_cmd_commit_flush(dev_priv, sizeof(*cmd));
192192 vcotbl->scrubbed = false;
193193
194194 return 0;
@@ -263,7 +263,7 @@ int vmw_cotable_scrub(struct vmw_resource *res, bool readback) · 68 unmodified lines
263263 if (readback)
264264 submit_size += sizeof(*cmd0);
265265
266− cmd1 = VMW_FIFO_RESERVE(dev_priv, submit_size);
266+ cmd1 = VMW_CMD_RESERVE(dev_priv, submit_size);
267267 if (!cmd1)
268268 return -ENOMEM;
269269
@@ -283,7 +283,7 @@ int vmw_cotable_scrub(struct vmw_resource *res, bool readback) · 13 unmodified lines
283283 cmd1->body.type = vcotbl->type;
284284 cmd1->body.mobid = SVGA3D_INVALID_ID;
285285 cmd1->body.validSizeInBytes = 0;
286− vmw_fifo_commit_flush(dev_priv, submit_size);
286+ vmw_cmd_commit_flush(dev_priv, submit_size);
287287 vcotbl->scrubbed = true;
288288
289289 /* Trigger a create() on next validate. */
@@ -349,7 +349,7 @@ static int vmw_cotable_readback(struct vmw_resource *res) · 59 unmodified lines
349349 struct vmw_fence_obj *fence;
350350
351351 if (!vcotbl->scrubbed) {
352− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
352+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
353353 if (!cmd)
354354 return -ENOMEM;
355355
@@ -358,7 +358,7 @@ static int vmw_cotable_readback(struct vmw_resource *res) · 2 unmodified lines
358358 cmd->body.cid = vcotbl->ctx->id;
359359 cmd->body.type = vcotbl->type;
360360 vcotbl->size_read_back = res->backup_size;
361− vmw_fifo_commit(dev_priv, sizeof(*cmd));
361+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
362362 }
363363
364364 (void) vmw_execbuf_fence_commands(NULL, dev_priv, &fence, NULL);
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c+113−122
@@ -32,6 +32,7 @@ · 31 unmodified lines
3232 #include <linux/mem_encrypt.h>
3333
3434 #include <drm/drm_drv.h>
35+#include <drm/drm_fb_helper.h>
3536 #include <drm/drm_ioctl.h>
3637 #include <drm/drm_sysfs.h>
3738 #include <drm/ttm/ttm_bo_driver.h>
@@ -42,8 +43,6 @@ · 4 unmodified lines
4243 #include "vmwgfx_drv.h"
4344
4445 #define VMWGFX_DRIVER_DESC "Linux drm driver for VMware graphics devices"
45−#define VMWGFX_CHIP_SVGAII 0
46−#define VMW_FB_RESERVATION 0
4746
4847 #define VMW_MIN_INITIAL_WIDTH 800
4948 #define VMW_MIN_INITIAL_HEIGHT 600
@@ -252,8 +251,8 @@ static const struct drm_ioctl_desc vmw_ioctls[] = { · 202 unmodified lines
252251 };
253252
254253 static const struct pci_device_id vmw_pci_id_list[] = {
255− {0x15ad, 0x0405, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VMWGFX_CHIP_SVGAII},
256− {0, 0, 0}
254+ { PCI_DEVICE(0x15ad, VMWGFX_PCI_ID_SVGA2) },
255+ { }
257256 };
258257 MODULE_DEVICE_TABLE(pci, vmw_pci_id_list);
259258
@@ -424,8 +423,7 @@ static int vmw_request_device_late(struct vmw_private *dev_priv) · 164 unmodified lines
424423 }
425424
426425 if (dev_priv->cman) {
427− ret = vmw_cmdbuf_set_pool_size(dev_priv->cman,
428− 256*4096, 2*4096);
426+ ret = vmw_cmdbuf_set_pool_size(dev_priv->cman, 256*4096);
429427 if (ret) {
430428 struct vmw_cmdbuf_man *man = dev_priv->cman;
431429
@@ -608,7 +606,7 @@ static int vmw_dma_select_mode(struct vmw_private *dev_priv) · 176 unmodified lines
608606 */
609607 static int vmw_dma_masks(struct vmw_private *dev_priv)
610608 {
611− struct drm_device *dev = dev_priv->dev;
609+ struct drm_device *dev = &dev_priv->drm;
612610 int ret = 0;
613611
614612 ret = dma_set_mask_and_coherent(dev->dev, DMA_BIT_MASK(64));
@@ -643,26 +641,83 @@ static void vmw_vram_manager_fini(struct vmw_private *dev_priv) · 28 unmodified lines
643641 #endif
644642 }
645643
646−static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
644+static int vmw_setup_pci_resources(struct vmw_private *dev,
645+ unsigned long pci_id)
647646 {
648− struct vmw_private *dev_priv;
647+ resource_size_t fifo_start;
648+ resource_size_t fifo_size;
649649 int ret;
650+ struct pci_dev *pdev = to_pci_dev(dev->drm.dev);
651+
652+ pci_set_master(pdev);
653+
654+ ret = pci_request_regions(pdev, "vmwgfx probe");
655+ if (ret)
656+ return ret;
657+
658+ dev->io_start = pci_resource_start(pdev, 0);
659+ dev->vram_start = pci_resource_start(pdev, 1);
660+ dev->vram_size = pci_resource_len(pdev, 1);
661+ fifo_start = pci_resource_start(pdev, 2);
662+ fifo_size = pci_resource_len(pdev, 2);
663+
664+ DRM_INFO("FIFO at %pa size is %llu kiB\n",
665+ &fifo_start, (uint64_t)fifo_size / 1024);
666+ dev->fifo_mem = devm_memremap(dev->drm.dev,
667+ fifo_start,
668+ fifo_size,
669+ MEMREMAP_WB);
670+
671+ if (unlikely(dev->fifo_mem == NULL)) {
672+ DRM_ERROR("Failed mapping FIFO memory.\n");
673+ return -ENOMEM;
674+ }
675+
676+ /*
677+ * This is approximate size of the vram, the exact size will only
678+ * be known after we read SVGA_REG_VRAM_SIZE. The PCI resource
679+ * size will be equal to or bigger than the size reported by
680+ * SVGA_REG_VRAM_SIZE.
681+ */
682+ DRM_INFO("VRAM at %pa size is %llu kiB\n",
683+ &dev->vram_start, (uint64_t)dev->vram_size / 1024);
684+
685+ return 0;
686+}
687+
688+static int vmw_detect_version(struct vmw_private *dev)
689+{
650690 uint32_t svga_id;
691+
692+ vmw_write(dev, SVGA_REG_ID, SVGA_ID_2);
693+ svga_id = vmw_read(dev, SVGA_REG_ID);
694+ if (svga_id != SVGA_ID_2) {
695+ DRM_ERROR("Unsupported SVGA ID 0x%x on chipset 0x%x\n",
696+ svga_id, dev->vmw_chipset);
697+ return -ENOSYS;
698+ }
699+ return 0;
700+}
701+
702+static int vmw_driver_load(struct vmw_private *dev_priv, u32 pci_id)
703+{
704+ int ret;
651705 enum vmw_res_type i;
652706 bool refuse_dma = false;
653707 char host_log[100] = {0};
708+ struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
654709
655− dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL);
656− if (unlikely(!dev_priv)) {
657− DRM_ERROR("Failed allocating a device private struct.\n");
658− return -ENOMEM;
659− }
710+ dev_priv->vmw_chipset = pci_id;
711+ dev_priv->last_read_seqno = (uint32_t) -100;
712+ dev_priv->drm.dev_private = dev_priv;
660713
661− pci_set_master(dev->pdev);
714+ ret = vmw_setup_pci_resources(dev_priv, pci_id);
715+ if (ret)
716+ return ret;
717+ ret = vmw_detect_version(dev_priv);
718+ if (ret)
719+ return ret;
662720
663− dev_priv->dev = dev;
664− dev_priv->vmw_chipset = chipset;
665− dev_priv->last_read_seqno = (uint32_t) -100;
666721 mutex_init(&dev_priv->cmdbuf_mutex);
667722 mutex_init(&dev_priv->release_mutex);
668723 mutex_init(&dev_priv->binding_mutex);
@@ -672,7 +727,6 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) · 3 unmodified lines
672727 spin_lock_init(&dev_priv->hw_lock);
673728 spin_lock_init(&dev_priv->waiter_lock);
674729 spin_lock_init(&dev_priv->cap_lock);
675− spin_lock_init(&dev_priv->svga_lock);
676730 spin_lock_init(&dev_priv->cursor_lock);
677731
678732 for (i = vmw_res_context; i < vmw_res_max; ++i) {
@@ -687,21 +741,10 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) · 8 unmodified lines
687741
688742 dev_priv->used_memory_size = 0;
689743
690− dev_priv->io_start = pci_resource_start(dev->pdev, 0);
691− dev_priv->vram_start = pci_resource_start(dev->pdev, 1);
692− dev_priv->mmio_start = pci_resource_start(dev->pdev, 2);
693−
694744 dev_priv->assume_16bpp = !!vmw_assume_16bpp;
695745
696746 dev_priv->enable_fb = enable_fbdev;
697747
698− vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2);
699− svga_id = vmw_read(dev_priv, SVGA_REG_ID);
700− if (svga_id != SVGA_ID_2) {
701− ret = -ENOSYS;
702− DRM_ERROR("Unsupported SVGA ID 0x%x\n", svga_id);
703− goto out_err0;
704− }
705748
706749 dev_priv->capabilities = vmw_read(dev_priv, SVGA_REG_CAPABILITIES);
707750
@@ -719,7 +762,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) · 11 unmodified lines
719762 }
720763
721764 dev_priv->vram_size = vmw_read(dev_priv, SVGA_REG_VRAM_SIZE);
722− dev_priv->mmio_size = vmw_read(dev_priv, SVGA_REG_MEM_SIZE);
765+ dev_priv->fifo_mem_size = vmw_read(dev_priv, SVGA_REG_MEM_SIZE);
723766 dev_priv->fb_max_width = vmw_read(dev_priv, SVGA_REG_MAX_WIDTH);
724767 dev_priv->fb_max_height = vmw_read(dev_priv, SVGA_REG_MAX_HEIGHT);
725768
@@ -793,7 +836,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) · 67 unmodified lines
793836 if (unlikely(ret != 0))
794837 goto out_err0;
795838
796− dma_set_max_seg_size(dev->dev, U32_MAX);
839+ dma_set_max_seg_size(dev_priv->drm.dev, U32_MAX);
797840
798841 if (dev_priv->capabilities & SVGA_CAP_GMR2) {
799842 DRM_INFO("Max GMR ids is %u\n",
@@ -803,21 +846,8 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) · 3 unmodified lines
803846 DRM_INFO("Max dedicated hypervisor surface memory is %u kiB\n",
804847 (unsigned)dev_priv->memory_size / 1024);
805848 }
806− DRM_INFO("Maximum display memory size is %u kiB\n",
807− dev_priv->prim_bb_mem / 1024);
808− DRM_INFO("VRAM at 0x%08x size is %u kiB\n",
809− dev_priv->vram_start, dev_priv->vram_size / 1024);
810− DRM_INFO("MMIO at 0x%08x size is %u kiB\n",
811− dev_priv->mmio_start, dev_priv->mmio_size / 1024);
812−
813− dev_priv->mmio_virt = memremap(dev_priv->mmio_start,
814− dev_priv->mmio_size, MEMREMAP_WB);
815−
816− if (unlikely(dev_priv->mmio_virt == NULL)) {
817− ret = -ENOMEM;
818− DRM_ERROR("Failed mapping MMIO.\n");
819− goto out_err0;
820− }
849+ DRM_INFO("Maximum display memory size is %llu kiB\n",
850+ (uint64_t)dev_priv->prim_bb_mem / 1024);
821851
822852 /* Need mmio memory to check for fifo pitchlock cap. */
823853 if (!(dev_priv->capabilities & SVGA_CAP_DISPLAY_TOPOLOGY) &&
@@ -825,7 +855,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) · 1 unmodified line
825855 !vmw_fifo_have_pitchlock(dev_priv)) {
826856 ret = -ENOSYS;
827857 DRM_ERROR("Hardware has no pitchlock\n");
828− goto out_err4;
858+ goto out_err0;
829859 }
830860
831861 dev_priv->tdev = ttm_object_device_init(&ttm_mem_glob, 12,
@@ -834,29 +864,11 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) · 2 unmodified lines
834864 if (unlikely(dev_priv->tdev == NULL)) {
835865 DRM_ERROR("Unable to initialize TTM object management.\n");
836866 ret = -ENOMEM;
837− goto out_err4;
838− }
839−
840− dev->dev_private = dev_priv;
841−
842− ret = pci_request_regions(dev->pdev, "vmwgfx probe");
843− dev_priv->stealth = (ret != 0);
844− if (dev_priv->stealth) {
845− /**
846− * Request at least the mmio PCI resource.
847− */
848−
849− DRM_INFO("It appears like vesafb is loaded. "
850− "Ignore above error if any.\n");
851− ret = pci_request_region(dev->pdev, 2, "vmwgfx stealth probe");
852− if (unlikely(ret != 0)) {
853− DRM_ERROR("Failed reserving the SVGA MMIO resource.\n");
854− goto out_no_device;
855− }
867+ goto out_err0;
856868 }
857869
858870 if (dev_priv->capabilities & SVGA_CAP_IRQMASK) {
859− ret = vmw_irq_install(dev, dev->pdev->irq);
871+ ret = vmw_irq_install(&dev_priv->drm, pdev->irq);
860872 if (ret != 0) {
861873 DRM_ERROR("Failed installing irq: %d\n", ret);
862874 goto out_no_irq;
@@ -873,8 +885,8 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) · 10 unmodified lines
873885 DRM_FILE_PAGE_OFFSET_START,
874886 DRM_FILE_PAGE_OFFSET_SIZE);
875887 ret = ttm_bo_device_init(&dev_priv->bdev, &vmw_bo_driver,
876− dev_priv->dev->dev,
877− dev->anon_inode->i_mapping,
888+ dev_priv->drm.dev,
889+ dev_priv->drm.anon_inode->i_mapping,
878890 &dev_priv->vma_manager,
879891 dev_priv->map_mode == vmw_dma_alloc_coherent,
880892 false);
@@ -954,7 +966,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) · 73 unmodified lines
954966 if (ret)
955967 goto out_no_fifo;
956968
957− DRM_INFO("Atomic: %s\n", (dev->driver->driver_features & DRIVER_ATOMIC)
969+ DRM_INFO("Atomic: %s\n", (dev_priv->drm.driver->driver_features & DRIVER_ATOMIC)
958970 ? "yes." : "no.");
959971 if (dev_priv->sm_type == VMW_SM_5)
960972 DRM_INFO("SM5 support available.\n");
@@ -999,16 +1011,10 @@ out_no_bdev: · 38 unmodified lines
9991011 vmw_fence_manager_takedown(dev_priv->fman);
10001012 out_no_fman:
10011013 if (dev_priv->capabilities & SVGA_CAP_IRQMASK)
1002− vmw_irq_uninstall(dev_priv->dev);
1014+ vmw_irq_uninstall(&dev_priv->drm);
10031015 out_no_irq:
1004− if (dev_priv->stealth)
1005− pci_release_region(dev->pdev, 2);
1006− else
1007− pci_release_regions(dev->pdev);
1008−out_no_device:
1016+ pci_release_regions(pdev);
10091017 ttm_object_device_release(&dev_priv->tdev);
1010−out_err4:
1011− memunmap(dev_priv->mmio_virt);
10121018 out_err0:
10131019 for (i = vmw_res_context; i < vmw_res_max; ++i)
10141020 idr_destroy(&dev_priv->res_idr[i]);
@@ -1022,6 +1028,7 @@ out_err0: · 7 unmodified lines
10221028 static void vmw_driver_unload(struct drm_device *dev)
10231029 {
10241030 struct vmw_private *dev_priv = vmw_priv(dev);
1031+ struct pci_dev *pdev = to_pci_dev(dev->dev);
10251032 enum vmw_res_type i;
10261033
10271034 unregister_pm_notifier(&dev_priv->pm_nb);
@@ -1051,14 +1058,10 @@ static void vmw_driver_unload(struct drm_device *dev) · 23 unmodified lines
10511058 vmw_release_device_late(dev_priv);
10521059 vmw_fence_manager_takedown(dev_priv->fman);
10531060 if (dev_priv->capabilities & SVGA_CAP_IRQMASK)
1054− vmw_irq_uninstall(dev_priv->dev);
1055− if (dev_priv->stealth)
1056− pci_release_region(dev->pdev, 2);
1057− else
1058− pci_release_regions(dev->pdev);
1061+ vmw_irq_uninstall(&dev_priv->drm);
1062+ pci_release_regions(pdev);
10591063
10601064 ttm_object_device_release(&dev_priv->tdev);
1061− memunmap(dev_priv->mmio_virt);
10621065 if (dev_priv->ctx.staged_bindings)
10631066 vmw_binding_state_free(dev_priv->ctx.staged_bindings);
10641067
@@ -1189,12 +1192,10 @@ static void __vmw_svga_enable(struct vmw_private *dev_priv) · 124 unmodified lines
11891192 {
11901193 struct ttm_resource_manager *man = ttm_manager_type(&dev_priv->bdev, TTM_PL_VRAM);
11911194
1192− spin_lock(&dev_priv->svga_lock);
11931195 if (!ttm_resource_manager_used(man)) {
11941196 vmw_write(dev_priv, SVGA_REG_ENABLE, SVGA_REG_ENABLE);
11951197 ttm_resource_manager_set_used(man, true);
11961198 }
1197− spin_unlock(&dev_priv->svga_lock);
11981199 }
11991200
12001201 /**
@@ -1220,14 +1221,12 @@ static void __vmw_svga_disable(struct vmw_private *dev_priv) · 19 unmodified lines
12201221 {
12211222 struct ttm_resource_manager *man = ttm_manager_type(&dev_priv->bdev, TTM_PL_VRAM);
12221223
1223− spin_lock(&dev_priv->svga_lock);
12241224 if (ttm_resource_manager_used(man)) {
12251225 ttm_resource_manager_set_used(man, false);
12261226 vmw_write(dev_priv, SVGA_REG_ENABLE,
12271227 SVGA_REG_ENABLE_HIDE |
12281228 SVGA_REG_ENABLE_ENABLE);
12291229 }
1230− spin_unlock(&dev_priv->svga_lock);
12311230 }
12321231
12331232 /**
@@ -1252,19 +1251,16 @@ void vmw_svga_disable(struct vmw_private *dev_priv) · 18 unmodified lines
12521251 * to be inconsistent with the device, causing modesetting problems.
12531252 *
12541253 */
1255− vmw_kms_lost_device(dev_priv->dev);
1254+ vmw_kms_lost_device(&dev_priv->drm);
12561255 ttm_write_lock(&dev_priv->reservation_sem, false);
1257− spin_lock(&dev_priv->svga_lock);
12581256 if (ttm_resource_manager_used(man)) {
1259− ttm_resource_manager_set_used(man, false);
1260− spin_unlock(&dev_priv->svga_lock);
12611257 if (ttm_resource_manager_evict_all(&dev_priv->bdev, man))
12621258 DRM_ERROR("Failed evicting VRAM buffers.\n");
1259+ ttm_resource_manager_set_used(man, false);
12631260 vmw_write(dev_priv, SVGA_REG_ENABLE,
12641261 SVGA_REG_ENABLE_HIDE |
12651262 SVGA_REG_ENABLE_ENABLE);
1266− } else
1267− spin_unlock(&dev_priv->svga_lock);
1263+ }
12681264 ttm_write_unlock(&dev_priv->reservation_sem);
12691265 }
12701266
@@ -1274,8 +1270,6 @@ static void vmw_remove(struct pci_dev *pdev) · 3 unmodified lines
12741270
12751271 drm_dev_unregister(dev);
12761272 vmw_driver_unload(dev);
1277− drm_dev_put(dev);
1278− pci_disable_device(pdev);
12791273 }
12801274
12811275 static unsigned long
@@ -1376,7 +1370,7 @@ static int vmw_pm_freeze(struct device *kdev) · 94 unmodified lines
13761370 * No user-space processes should be running now.
13771371 */
13781372 ttm_suspend_unlock(&dev_priv->reservation_sem);
1379− ret = vmw_kms_suspend(dev_priv->dev);
1373+ ret = vmw_kms_suspend(&dev_priv->drm);
13801374 if (ret) {
13811375 ttm_suspend_lock(&dev_priv->reservation_sem);
13821376 DRM_ERROR("Failed to freeze modesetting.\n");
@@ -1408,7 +1402,7 @@ static int vmw_pm_freeze(struct device *kdev) · 25 unmodified lines
14081402
14091403 vmw_fence_fifo_down(dev_priv->fman);
14101404 __vmw_svga_disable(dev_priv);
1411−
1405+
14121406 vmw_release_device_late(dev_priv);
14131407 return 0;
14141408 }
@@ -1437,7 +1431,7 @@ static int vmw_pm_restore(struct device *kdev) · 22 unmodified lines
14371431 dev_priv->suspend_locked = false;
14381432 ttm_suspend_unlock(&dev_priv->reservation_sem);
14391433 if (dev_priv->suspend_state)
1440− vmw_kms_resume(dev_priv->dev);
1434+ vmw_kms_resume(&dev_priv->drm);
14411435
14421436 if (dev_priv->enable_fb)
14431437 vmw_fb_on(dev_priv);
@@ -1506,39 +1500,36 @@ static struct pci_driver vmw_pci_driver = { · 62 unmodified lines
15061500
15071501 static int vmw_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
15081502 {
1509− struct drm_device *dev;
1503+ struct vmw_private *vmw;
15101504 int ret;
15111505
1512− ret = pci_enable_device(pdev);
1506+ ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, "svgadrmfb");
15131507 if (ret)
15141508 return ret;
15151509
1516− dev = drm_dev_alloc(&driver, &pdev->dev);
1517− if (IS_ERR(dev)) {
1518− ret = PTR_ERR(dev);
1519− goto err_pci_disable_device;
1520− }
1510+ ret = pcim_enable_device(pdev);
1511+ if (ret)
1512+ return ret;
15211513
1522− dev->pdev = pdev;
1523− pci_set_drvdata(pdev, dev);
1514+ vmw = devm_drm_dev_alloc(&pdev->dev, &driver,
1515+ struct vmw_private, drm);
1516+ if (IS_ERR(vmw))
1517+ return PTR_ERR(vmw);
15241518
1525− ret = vmw_driver_load(dev, ent->driver_data);
1526− if (ret)
1527− goto err_drm_dev_put;
1519+ vmw->drm.pdev = pdev;
1520+ pci_set_drvdata(pdev, &vmw->drm);
15281521
1529− ret = drm_dev_register(dev, ent->driver_data);
1522+ ret = vmw_driver_load(vmw, ent->device);
15301523 if (ret)
1531− goto err_vmw_driver_unload;
1524+ return ret;
15321525
1533− return 0;
1526+ ret = drm_dev_register(&vmw->drm, 0);
1527+ if (ret) {
1528+ vmw_driver_unload(&vmw->drm);
1529+ return ret;
1530+ }
15341531
1535−err_vmw_driver_unload:
1536− vmw_driver_unload(dev);
1537−err_drm_dev_put:
1538− drm_dev_put(dev);
1539−err_pci_disable_device:
1540− pci_disable_device(pdev);
1541− return ret;
1532+ return 0;
15421533 }
15431534
15441535 static int __init vmwgfx_init(void)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h+33−60
@@ -66,6 +66,8 @@ · 65 unmodified lines
6666 #define VMWGFX_CMD_BOUNCE_INIT_SIZE 32768
6767 #define VMWGFX_ENABLE_SCREEN_TARGET_OTABLE 1
6868
69+#define VMWGFX_PCI_ID_SVGA2 0x0405
70+
6971 /*
7072 * Perhaps we should have sysfs entries for these.
7173 */
@@ -274,13 +276,6 @@ struct vmw_surface { · 202 unmodified lines
274276 struct list_head view_list;
275277 };
276278
277−struct vmw_marker_queue {
278− struct list_head head;
279− u64 lag;
280− u64 lag_time;
281− spinlock_t lock;
282−};
283−
284279 struct vmw_fifo_state {
285280 unsigned long reserved_size;
286281 u32 *dynamic_buffer;
@@ -290,7 +285,6 @@ struct vmw_fifo_state { · 3 unmodified lines
290285 uint32_t capabilities;
291286 struct mutex fifo_mutex;
292287 struct rw_semaphore rwsem;
293− struct vmw_marker_queue marker_queue;
294288 bool dx;
295289 };
296290
@@ -489,19 +483,19 @@ enum vmw_sm_type { · 192 unmodified lines
489483 };
490484
491485 struct vmw_private {
486+ struct drm_device drm;
492487 struct ttm_bo_device bdev;
493488
494489 struct vmw_fifo_state fifo;
495490
496− struct drm_device *dev;
497491 struct drm_vma_offset_manager vma_manager;
498− unsigned long vmw_chipset;
499− unsigned int io_start;
500− uint32_t vram_start;
501− uint32_t vram_size;
502− uint32_t prim_bb_mem;
503− uint32_t mmio_start;
504− uint32_t mmio_size;
492+ u32 vmw_chipset;
493+ resource_size_t io_start;
494+ resource_size_t vram_start;
495+ resource_size_t vram_size;
496+ resource_size_t prim_bb_mem;
497+ u32 *fifo_mem;
498+ resource_size_t fifo_mem_size;
505499 uint32_t fb_max_width;
506500 uint32_t fb_max_height;
507501 uint32_t texture_max_width;
@@ -510,7 +504,6 @@ struct vmw_private { · 2 unmodified lines
510504 uint32_t stdu_max_height;
511505 uint32_t initial_width;
512506 uint32_t initial_height;
513− u32 *mmio_virt;
514507 uint32_t capabilities;
515508 uint32_t capabilities2;
516509 uint32_t max_gmr_ids;
@@ -590,13 +583,7 @@ struct vmw_private { · 73 unmodified lines
590583 struct mutex cmdbuf_mutex;
591584 struct mutex binding_mutex;
592585
593− /**
594− * Operating mode.
595− */
596−
597− bool stealth;
598586 bool enable_fb;
599− spinlock_t svga_lock;
600587
601588 /**
602589 * PM management.
@@ -966,30 +953,29 @@ extern int vmw_fifo_init(struct vmw_private *dev_priv, · 363 unmodified lines
966953 extern void vmw_fifo_release(struct vmw_private *dev_priv,
967954 struct vmw_fifo_state *fifo);
968955 extern void *
969−vmw_fifo_reserve_dx(struct vmw_private *dev_priv, uint32_t bytes, int ctx_id);
970−extern void vmw_fifo_commit(struct vmw_private *dev_priv, uint32_t bytes);
971−extern void vmw_fifo_commit_flush(struct vmw_private *dev_priv, uint32_t bytes);
972−extern int vmw_fifo_send_fence(struct vmw_private *dev_priv,
973− uint32_t *seqno);
956+vmw_cmd_ctx_reserve(struct vmw_private *dev_priv, uint32_t bytes, int ctx_id);
957+extern void vmw_cmd_commit(struct vmw_private *dev_priv, uint32_t bytes);
958+extern void vmw_cmd_commit_flush(struct vmw_private *dev_priv, uint32_t bytes);
959+extern int vmw_cmd_send_fence(struct vmw_private *dev_priv, uint32_t *seqno);
960+extern bool vmw_supports_3d(struct vmw_private *dev_priv);
974961 extern void vmw_fifo_ping_host(struct vmw_private *dev_priv, uint32_t reason);
975−extern bool vmw_fifo_have_3d(struct vmw_private *dev_priv);
976962 extern bool vmw_fifo_have_pitchlock(struct vmw_private *dev_priv);
977−extern int vmw_fifo_emit_dummy_query(struct vmw_private *dev_priv,
978− uint32_t cid);
979−extern int vmw_fifo_flush(struct vmw_private *dev_priv,
980− bool interruptible);
963+extern int vmw_cmd_emit_dummy_query(struct vmw_private *dev_priv,
964+ uint32_t cid);
965+extern int vmw_cmd_flush(struct vmw_private *dev_priv,
966+ bool interruptible);
981967
982−#define VMW_FIFO_RESERVE_DX(__priv, __bytes, __ctx_id) \
968+#define VMW_CMD_CTX_RESERVE(__priv, __bytes, __ctx_id) \
983969 ({ \
984− vmw_fifo_reserve_dx(__priv, __bytes, __ctx_id) ? : ({ \
970+ vmw_cmd_ctx_reserve(__priv, __bytes, __ctx_id) ? : ({ \
985971 DRM_ERROR("FIFO reserve failed at %s for %u bytes\n", \
986972 __func__, (unsigned int) __bytes); \
987973 NULL; \
988974 }); \
989975 })
990976
991−#define VMW_FIFO_RESERVE(__priv, __bytes) \
992− VMW_FIFO_RESERVE_DX(__priv, __bytes, SVGA3D_INVALID_ID)
977+#define VMW_CMD_RESERVE(__priv, __bytes) \
978+ VMW_CMD_CTX_RESERVE(__priv, __bytes, SVGA3D_INVALID_ID)
993979
994980 /**
995981 * TTM glue - vmwgfx_ttm_glue.c
@@ -1124,19 +1110,6 @@ extern void vmw_generic_waiter_add(struct vmw_private *dev_priv, u32 flag, · 128 unmodified lines
11241110 extern void vmw_generic_waiter_remove(struct vmw_private *dev_priv,
11251111 u32 flag, int *waiter_count);
11261112
1127−/**
1128− * Rudimentary fence-like objects currently used only for throttling -
1129− * vmwgfx_marker.c
1130− */
1131−
1132−extern void vmw_marker_queue_init(struct vmw_marker_queue *queue);
1133−extern void vmw_marker_queue_takedown(struct vmw_marker_queue *queue);
1134−extern int vmw_marker_push(struct vmw_marker_queue *queue,
1135− uint32_t seqno);
1136−extern int vmw_marker_pull(struct vmw_marker_queue *queue,
1137− uint32_t signaled_seqno);
1138−extern int vmw_wait_lag(struct vmw_private *dev_priv,
1139− struct vmw_marker_queue *queue, uint32_t us);
11401113
11411114 /**
11421115 * Kernel framebuffer - vmwgfx_fb.c
@@ -1410,8 +1383,7 @@ struct vmw_cmdbuf_header; · 267 unmodified lines
14101383
14111384 extern struct vmw_cmdbuf_man *
14121385 vmw_cmdbuf_man_create(struct vmw_private *dev_priv);
1413−extern int vmw_cmdbuf_set_pool_size(struct vmw_cmdbuf_man *man,
1414− size_t size, size_t default_size);
1386+extern int vmw_cmdbuf_set_pool_size(struct vmw_cmdbuf_man *man, size_t size);
14151387 extern void vmw_cmdbuf_remove_pool(struct vmw_cmdbuf_man *man);
14161388 extern void vmw_cmdbuf_man_destroy(struct vmw_cmdbuf_man *man);
14171389 extern int vmw_cmdbuf_idle(struct vmw_cmdbuf_man *man, bool interruptible,
@@ -1580,28 +1552,29 @@ static inline void vmw_fifo_resource_dec(struct vmw_private *dev_priv) · 162 unmodified lines
15801552 }
15811553
15821554 /**
1583− * vmw_mmio_read - Perform a MMIO read from volatile memory
1555+ * vmw_fifo_mem_read - Perform a MMIO read from the fifo memory
15841556 *
1585− * @addr: The address to read from
1557+ * @fifo_reg: The fifo register to read from
15861558 *
15871559 * This function is intended to be equivalent to ioread32() on
15881560 * memremap'd memory, but without byteswapping.
15891561 */
1590−static inline u32 vmw_mmio_read(u32 *addr)
1562+static inline u32 vmw_fifo_mem_read(struct vmw_private *vmw, uint32 fifo_reg)
15911563 {
1592− return READ_ONCE(*addr);
1564+ return READ_ONCE(*(vmw->fifo_mem + fifo_reg));
15931565 }
15941566
15951567 /**
1596− * vmw_mmio_write - Perform a MMIO write to volatile memory
1568+ * vmw_fifo_mem_write - Perform a MMIO write to volatile memory
15971569 *
1598− * @addr: The address to write to
1570+ * @addr: The fifo register to write to
15991571 *
16001572 * This function is intended to be equivalent to iowrite32 on
16011573 * memremap'd memory, but without byteswapping.
16021574 */
1603−static inline void vmw_mmio_write(u32 value, u32 *addr)
1575+static inline void vmw_fifo_mem_write(struct vmw_private *vmw, u32 fifo_reg,
1576+ u32 value)
16041577 {
1605− WRITE_ONCE(*addr, value);
1578+ WRITE_ONCE(*(vmw->fifo_mem + fifo_reg), value);
16061579 }
16071580 #endif
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c+9−13
@@ -724,7 +724,7 @@ static int vmw_rebind_all_dx_query(struct vmw_resource *ctx_res) · 723 unmodified lines
724724 if (!dx_query_mob || dx_query_mob->dx_query_ctx)
725725 return 0;
726726
727− cmd = VMW_FIFO_RESERVE_DX(dev_priv, sizeof(*cmd), ctx_res->id);
727+ cmd = VMW_CMD_CTX_RESERVE(dev_priv, sizeof(*cmd), ctx_res->id);
728728 if (cmd == NULL)
729729 return -ENOMEM;
730730
@@ -732,7 +732,7 @@ static int vmw_rebind_all_dx_query(struct vmw_resource *ctx_res) · 1 unmodified line
732732 cmd->header.size = sizeof(cmd->body);
733733 cmd->body.cid = ctx_res->id;
734734 cmd->body.mobid = dx_query_mob->base.mem.start;
735− vmw_fifo_commit(dev_priv, sizeof(*cmd));
735+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
736736
737737 vmw_context_bind_dx_query(ctx_res, dx_query_mob);
738738
@@ -1100,7 +1100,7 @@ static void vmw_query_bo_switch_commit(struct vmw_private *dev_priv, · 361 unmodified lines
11001100 BUG_ON(!ctx_entry->valid);
11011101 ctx = ctx_entry->res;
11021102
1103− ret = vmw_fifo_emit_dummy_query(dev_priv, ctx->id);
1103+ ret = vmw_cmd_emit_dummy_query(dev_priv, ctx->id);
11041104
11051105 if (unlikely(ret != 0))
11061106 VMW_DEBUG_USER("Out of fifo space for dummy query.\n");
@@ -3762,7 +3762,7 @@ int vmw_execbuf_fence_commands(struct drm_file *file_priv, · 2655 unmodified lines
37623762 /* p_handle implies file_priv. */
37633763 BUG_ON(p_handle != NULL && file_priv == NULL);
37643764
3765− ret = vmw_fifo_send_fence(dev_priv, &sequence);
3765+ ret = vmw_cmd_send_fence(dev_priv, &sequence);
37663766 if (unlikely(ret != 0)) {
37673767 VMW_DEBUG_USER("Fence submission error. Syncing.\n");
37683768 synced = true;
@@ -3876,10 +3876,10 @@ static int vmw_execbuf_submit_fifo(struct vmw_private *dev_priv, · 107 unmodified lines
38763876 void *cmd;
38773877
38783878 if (sw_context->dx_ctx_node)
3879− cmd = VMW_FIFO_RESERVE_DX(dev_priv, command_size,
3879+ cmd = VMW_CMD_CTX_RESERVE(dev_priv, command_size,
38803880 sw_context->dx_ctx_node->ctx->id);
38813881 else
3882− cmd = VMW_FIFO_RESERVE(dev_priv, command_size);
3882+ cmd = VMW_CMD_RESERVE(dev_priv, command_size);
38833883
38843884 if (!cmd)
38853885 return -ENOMEM;
@@ -3888,7 +3888,7 @@ static int vmw_execbuf_submit_fifo(struct vmw_private *dev_priv, · 2 unmodified lines
38883888 memcpy(cmd, kernel_commands, command_size);
38893889 vmw_resource_relocations_apply(cmd, &sw_context->res_relocations);
38903890 vmw_resource_relocations_free(&sw_context->res_relocations);
3891− vmw_fifo_commit(dev_priv, command_size);
3891+ vmw_cmd_commit(dev_priv, command_size);
38923892
38933893 return 0;
38943894 }
@@ -4046,11 +4046,7 @@ int vmw_execbuf_process(struct drm_file *file_priv, · 151 unmodified lines
40464046 }
40474047
40484048 if (throttle_us) {
4049− ret = vmw_wait_lag(dev_priv, &dev_priv->fifo.marker_queue,
4050− throttle_us);
4051−
4052− if (ret)
4053− goto out_free_fence_fd;
4049+ VMW_DEBUG_USER("Throttling is no longer supported.\n");
40544050 }
40554051
40564052 kernel_commands = vmw_execbuf_cmdbuf(dev_priv, user_commands,
@@ -4329,7 +4325,7 @@ void __vmw_execbuf_release_pinned_bo(struct vmw_private *dev_priv, · 272 unmodified lines
43294325
43304326 if (dev_priv->query_cid_valid) {
43314327 BUG_ON(fence != NULL);
4332− ret = vmw_fifo_emit_dummy_query(dev_priv, dev_priv->query_cid);
4328+ ret = vmw_cmd_emit_dummy_query(dev_priv, dev_priv->query_cid);
43334329 if (ret)
43344330 goto out_no_emit;
43354331 dev_priv->query_cid_valid = false;
drivers/gpu/drm/vmwgfx/vmwgfx_fb.c+6−6
@@ -258,7 +258,7 @@ out_unreserve: · 257 unmodified lines
258258 if (w && h) {
259259 WARN_ON_ONCE(par->set_fb->funcs->dirty(cur_fb, NULL, 0, 0,
260260 &clip, 1));
261− vmw_fifo_flush(vmw_priv, false);
261+ vmw_cmd_flush(vmw_priv, false);
262262 }
263263 out_unlock:
264264 mutex_unlock(&par->bo_mutex);
@@ -481,7 +481,7 @@ static int vmw_fb_kms_detach(struct vmw_fb_par *par, · 216 unmodified lines
481481 DRM_ERROR("Could not unset a mode.\n");
482482 return ret;
483483 }
484− drm_mode_destroy(par->vmw_priv->dev, par->set_mode);
484+ drm_mode_destroy(&par->vmw_priv->drm, par->set_mode);
485485 par->set_mode = NULL;
486486 }
487487
@@ -567,7 +567,7 @@ static int vmw_fb_set_par(struct fb_info *info) · 79 unmodified lines
567567 struct drm_display_mode *mode;
568568 int ret;
569569
570− mode = drm_mode_duplicate(vmw_priv->dev, &new_mode);
570+ mode = drm_mode_duplicate(&vmw_priv->drm, &new_mode);
571571 if (!mode) {
572572 DRM_ERROR("Could not create new fb mode.\n");
573573 return -ENOMEM;
@@ -581,7 +581,7 @@ static int vmw_fb_set_par(struct fb_info *info) · 7 unmodified lines
581581 mode->hdisplay *
582582 DIV_ROUND_UP(var->bits_per_pixel, 8),
583583 mode->vdisplay)) {
584− drm_mode_destroy(vmw_priv->dev, mode);
584+ drm_mode_destroy(&vmw_priv->drm, mode);
585585 return -EINVAL;
586586 }
587587
@@ -615,7 +615,7 @@ static int vmw_fb_set_par(struct fb_info *info) · 27 unmodified lines
615615
616616 out_unlock:
617617 if (par->set_mode)
618− drm_mode_destroy(vmw_priv->dev, par->set_mode);
618+ drm_mode_destroy(&vmw_priv->drm, par->set_mode);
619619 par->set_mode = mode;
620620
621621 mutex_unlock(&par->bo_mutex);
@@ -638,7 +638,7 @@ static const struct fb_ops vmw_fb_ops = { · 16 unmodified lines
638638
639639 int vmw_fb_init(struct vmw_private *vmw_priv)
640640 {
641− struct device *device = &vmw_priv->dev->pdev->dev;
641+ struct device *device = vmw_priv->drm.dev;
642642 struct vmw_fb_par *par;
643643 struct fb_info *info;
644644 unsigned fb_width, fb_height;
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c+12−16
@@ -141,8 +141,7 @@ static bool vmw_fence_enable_signaling(struct dma_fence *f) · 140 unmodified lines
141141 struct vmw_fence_manager *fman = fman_from_fence(fence);
142142 struct vmw_private *dev_priv = fman->dev_priv;
143143
144− u32 *fifo_mem = dev_priv->mmio_virt;
145− u32 seqno = vmw_mmio_read(fifo_mem + SVGA_FIFO_FENCE);
144+ u32 seqno = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_FENCE);
146145 if (seqno - fence->base.seqno < VMW_FENCE_WRAP)
147146 return false;
148147
@@ -401,14 +400,12 @@ static bool vmw_fence_goal_new_locked(struct vmw_fence_manager *fman, · 252 unmodified lines
401400 u32 passed_seqno)
402401 {
403402 u32 goal_seqno;
404− u32 *fifo_mem;
405403 struct vmw_fence_obj *fence;
406404
407405 if (likely(!fman->seqno_valid))
408406 return false;
409407
410− fifo_mem = fman->dev_priv->mmio_virt;
411− goal_seqno = vmw_mmio_read(fifo_mem + SVGA_FIFO_FENCE_GOAL);
408+ goal_seqno = vmw_fifo_mem_read(fman->dev_priv, SVGA_FIFO_FENCE_GOAL);
412409 if (likely(passed_seqno - goal_seqno >= VMW_FENCE_WRAP))
413410 return false;
414411
@@ -416,8 +413,9 @@ static bool vmw_fence_goal_new_locked(struct vmw_fence_manager *fman, · 1 unmodified line
416413 list_for_each_entry(fence, &fman->fence_list, head) {
417414 if (!list_empty(&fence->seq_passed_actions)) {
418415 fman->seqno_valid = true;
419− vmw_mmio_write(fence->base.seqno,
420− fifo_mem + SVGA_FIFO_FENCE_GOAL);
416+ vmw_fifo_mem_write(fman->dev_priv,
417+ SVGA_FIFO_FENCE_GOAL,
418+ fence->base.seqno);
421419 break;
422420 }
423421 }
@@ -445,18 +443,17 @@ static bool vmw_fence_goal_check_locked(struct vmw_fence_obj *fence) · 21 unmodified lines
445443 {
446444 struct vmw_fence_manager *fman = fman_from_fence(fence);
447445 u32 goal_seqno;
448− u32 *fifo_mem;
449446
450447 if (dma_fence_is_signaled_locked(&fence->base))
451448 return false;
452449
453− fifo_mem = fman->dev_priv->mmio_virt;
454− goal_seqno = vmw_mmio_read(fifo_mem + SVGA_FIFO_FENCE_GOAL);
450+ goal_seqno = vmw_fifo_mem_read(fman->dev_priv, SVGA_FIFO_FENCE_GOAL);
455451 if (likely(fman->seqno_valid &&
456452 goal_seqno - fence->base.seqno < VMW_FENCE_WRAP))
457453 return false;
458454
459− vmw_mmio_write(fence->base.seqno, fifo_mem + SVGA_FIFO_FENCE_GOAL);
455+ vmw_fifo_mem_write(fman->dev_priv, SVGA_FIFO_FENCE_GOAL,
456+ fence->base.seqno);
460457 fman->seqno_valid = true;
461458
462459 return true;
@@ -468,9 +465,8 @@ static void __vmw_fences_update(struct vmw_fence_manager *fman) · 5 unmodified lines
468465 struct list_head action_list;
469466 bool needs_rerun;
470467 uint32_t seqno, new_seqno;
471− u32 *fifo_mem = fman->dev_priv->mmio_virt;
472468
473− seqno = vmw_mmio_read(fifo_mem + SVGA_FIFO_FENCE);
469+ seqno = vmw_fifo_mem_read(fman->dev_priv, SVGA_FIFO_FENCE);
474470 rerun:
475471 list_for_each_entry_safe(fence, next_fence, &fman->fence_list, head) {
476472 if (seqno - fence->base.seqno < VMW_FENCE_WRAP) {
@@ -492,7 +488,7 @@ rerun: · 15 unmodified lines
492488
493489 needs_rerun = vmw_fence_goal_new_locked(fman, seqno);
494490 if (unlikely(needs_rerun)) {
495− new_seqno = vmw_mmio_read(fifo_mem + SVGA_FIFO_FENCE);
491+ new_seqno = vmw_fifo_mem_read(fman->dev_priv, SVGA_FIFO_FENCE);
496492 if (new_seqno != seqno) {
497493 seqno = new_seqno;
498494 goto rerun;
@@ -1033,7 +1029,7 @@ int vmw_event_fence_action_queue(struct drm_file *file_priv, · 534 unmodified lines
10331029 eaction->action.type = VMW_ACTION_EVENT;
10341030
10351031 eaction->fence = vmw_fence_obj_reference(fence);
1036− eaction->dev = fman->dev_priv->dev;
1032+ eaction->dev = &fman->dev_priv->drm;
10371033 eaction->tv_sec = tv_sec;
10381034 eaction->tv_usec = tv_usec;
10391035
@@ -1055,7 +1051,7 @@ static int vmw_event_fence_action_create(struct drm_file *file_priv, · 15 unmodified lines
10551051 {
10561052 struct vmw_event_fence_pending *event;
10571053 struct vmw_fence_manager *fman = fman_from_fence(fence);
1058− struct drm_device *dev = fman->dev_priv->dev;
1054+ struct drm_device *dev = &fman->dev_priv->drm;
10591055 int ret;
10601056
10611057 event = kzalloc(sizeof(*event), GFP_KERNEL);
drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c+4−4
@@ -51,7 +51,7 @@ static int vmw_gmr2_bind(struct vmw_private *dev_priv, · 50 unmodified lines
5151 uint32_t cmd_size = define_size + remap_size;
5252 uint32_t i;
5353
54− cmd_orig = cmd = VMW_FIFO_RESERVE(dev_priv, cmd_size);
54+ cmd_orig = cmd = VMW_CMD_RESERVE(dev_priv, cmd_size);
5555 if (unlikely(cmd == NULL))
5656 return -ENOMEM;
5757
@@ -98,7 +98,7 @@ static int vmw_gmr2_bind(struct vmw_private *dev_priv, · 40 unmodified lines
9898
9999 BUG_ON(cmd != cmd_orig + cmd_size / sizeof(*cmd));
100100
101− vmw_fifo_commit(dev_priv, cmd_size);
101+ vmw_cmd_commit(dev_priv, cmd_size);
102102
103103 return 0;
104104 }
@@ -110,7 +110,7 @@ static void vmw_gmr2_unbind(struct vmw_private *dev_priv, · 5 unmodified lines
110110 uint32_t define_size = sizeof(define_cmd) + 4;
111111 uint32_t *cmd;
112112
113− cmd = VMW_FIFO_RESERVE(dev_priv, define_size);
113+ cmd = VMW_CMD_RESERVE(dev_priv, define_size);
114114 if (unlikely(cmd == NULL))
115115 return;
116116
@@ -120,7 +120,7 @@ static void vmw_gmr2_unbind(struct vmw_private *dev_priv, · 3 unmodified lines
120120 *cmd++ = SVGA_CMD_DEFINE_GMR2;
121121 memcpy(cmd, &define_cmd, sizeof(define_cmd));
122122
123− vmw_fifo_commit(dev_priv, define_size);
123+ vmw_cmd_commit(dev_priv, define_size);
124124 }
125125
126126
drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c+7−8
@@ -51,7 +51,7 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data, · 50 unmodified lines
5151 param->value = vmw_overlay_num_free_overlays(dev_priv);
5252 break;
5353 case DRM_VMW_PARAM_3D:
54− param->value = vmw_fifo_have_3d(dev_priv) ? 1 : 0;
54+ param->value = vmw_supports_3d(dev_priv) ? 1 : 0;
5555 break;
5656 case DRM_VMW_PARAM_HW_CAPS:
5757 param->value = dev_priv->capabilities;
@@ -67,7 +67,6 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data, · 9 unmodified lines
6767 break;
6868 case DRM_VMW_PARAM_FIFO_HW_VERSION:
6969 {
70− u32 *fifo_mem = dev_priv->mmio_virt;
7170 const struct vmw_fifo_state *fifo = &dev_priv->fifo;
7271
7372 if ((dev_priv->capabilities & SVGA_CAP_GBOBJECTS)) {
@@ -76,11 +75,11 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data, · 2 unmodified lines
7675 }
7776
7877 param->value =
79− vmw_mmio_read(fifo_mem +
80− ((fifo->capabilities &
81− SVGA_FIFO_CAP_3D_HWVERSION_REVISED) ?
82− SVGA_FIFO_3D_HWVERSION_REVISED :
83− SVGA_FIFO_3D_HWVERSION));
78+ vmw_fifo_mem_read(dev_priv,
79+ ((fifo->capabilities &
80+ SVGA_FIFO_CAP_3D_HWVERSION_REVISED) ?
81+ SVGA_FIFO_3D_HWVERSION_REVISED :
82+ SVGA_FIFO_3D_HWVERSION));
8483 break;
8584 }
8685 case DRM_VMW_PARAM_MAX_SURF_MEMORY:
@@ -235,7 +234,7 @@ int vmw_get_cap_3d_ioctl(struct drm_device *dev, void *data, · 148 unmodified lines
235234 if (unlikely(ret != 0))
236235 goto out_err;
237236 } else {
238− fifo_mem = dev_priv->mmio_virt;
237+ fifo_mem = dev_priv->fifo_mem;
239238 memcpy(bounce, &fifo_mem[SVGA_FIFO_3D_CAPS], size);
240239 }
241240
drivers/gpu/drm/vmwgfx/vmwgfx_irq.c+3−7
@@ -117,12 +117,10 @@ static bool vmw_fifo_idle(struct vmw_private *dev_priv, uint32_t seqno) · 116 unmodified lines
117117 void vmw_update_seqno(struct vmw_private *dev_priv,
118118 struct vmw_fifo_state *fifo_state)
119119 {
120− u32 *fifo_mem = dev_priv->mmio_virt;
121− uint32_t seqno = vmw_mmio_read(fifo_mem + SVGA_FIFO_FENCE);
120+ uint32_t seqno = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_FENCE);
122121
123122 if (dev_priv->last_read_seqno != seqno) {
124123 dev_priv->last_read_seqno = seqno;
125− vmw_marker_pull(&fifo_state->marker_queue, seqno);
126124 vmw_fences_update(dev_priv->fman);
127125 }
128126 }
@@ -222,11 +220,9 @@ int vmw_fallback_wait(struct vmw_private *dev_priv, · 93 unmodified lines
222220 }
223221 }
224222 finish_wait(&dev_priv->fence_queue, &__wait);
225− if (ret == 0 && fifo_idle) {
226− u32 *fifo_mem = dev_priv->mmio_virt;
223+ if (ret == 0 && fifo_idle)
224+ vmw_fifo_mem_write(dev_priv, SVGA_FIFO_FENCE, signal_seq);
227225
228− vmw_mmio_write(signal_seq, fifo_mem + SVGA_FIFO_FENCE);
229− }
230226 wake_up_all(&dev_priv->fence_queue);
231227 out_err:
232228 if (fifo_idle)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c+35−39
@@ -36,9 +36,6 @@ · 35 unmodified lines
3636
3737 #include "vmwgfx_kms.h"
3838
39−/* Might need a hrtimer here? */
40−#define VMWGFX_PRESENT_RATE ((HZ / 60 > 0) ? HZ / 60 : 1)
41−
4239 void vmw_du_cleanup(struct vmw_display_unit *du)
4340 {
4441 drm_plane_cleanup(&du->primary);
@@ -68,7 +65,7 @@ static int vmw_cursor_update_image(struct vmw_private *dev_priv, · 23 unmodified lines
6865 if (!image)
6966 return -EINVAL;
7067
71− cmd = VMW_FIFO_RESERVE(dev_priv, cmd_size);
68+ cmd = VMW_CMD_RESERVE(dev_priv, cmd_size);
7269 if (unlikely(cmd == NULL))
7370 return -ENOMEM;
7471
@@ -83,7 +80,7 @@ static int vmw_cursor_update_image(struct vmw_private *dev_priv, · 8 unmodified lines
8380 cmd->cursor.hotspotX = hotspotX;
8481 cmd->cursor.hotspotY = hotspotY;
8582
86− vmw_fifo_commit_flush(dev_priv, cmd_size);
83+ vmw_cmd_commit_flush(dev_priv, cmd_size);
8784
8885 return 0;
8986 }
@@ -128,15 +125,14 @@ err_unreserve: · 38 unmodified lines
128125 static void vmw_cursor_update_position(struct vmw_private *dev_priv,
129126 bool show, int x, int y)
130127 {
131− u32 *fifo_mem = dev_priv->mmio_virt;
132128 uint32_t count;
133129
134130 spin_lock(&dev_priv->cursor_lock);
135− vmw_mmio_write(show ? 1 : 0, fifo_mem + SVGA_FIFO_CURSOR_ON);
136− vmw_mmio_write(x, fifo_mem + SVGA_FIFO_CURSOR_X);
137− vmw_mmio_write(y, fifo_mem + SVGA_FIFO_CURSOR_Y);
138− count = vmw_mmio_read(fifo_mem + SVGA_FIFO_CURSOR_COUNT);
139− vmw_mmio_write(++count, fifo_mem + SVGA_FIFO_CURSOR_COUNT);
131+ vmw_fifo_mem_write(dev_priv, SVGA_FIFO_CURSOR_ON, show ? 1 : 0);
132+ vmw_fifo_mem_write(dev_priv, SVGA_FIFO_CURSOR_X, x);
133+ vmw_fifo_mem_write(dev_priv, SVGA_FIFO_CURSOR_Y, y);
134+ count = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_CURSOR_COUNT);
135+ vmw_fifo_mem_write(dev_priv, SVGA_FIFO_CURSOR_COUNT, ++count);
140136 spin_unlock(&dev_priv->cursor_lock);
141137 }
142138
@@ -236,7 +232,7 @@ err_unreserve: · 93 unmodified lines
236232 */
237233 void vmw_kms_legacy_hotspot_clear(struct vmw_private *dev_priv)
238234 {
239− struct drm_device *dev = dev_priv->dev;
235+ struct drm_device *dev = &dev_priv->drm;
240236 struct vmw_display_unit *du;
241237 struct drm_crtc *crtc;
242238
@@ -252,7 +248,7 @@ void vmw_kms_legacy_hotspot_clear(struct vmw_private *dev_priv) · 9 unmodified lines
252248
253249 void vmw_kms_cursor_post_execbuf(struct vmw_private *dev_priv)
254250 {
255− struct drm_device *dev = dev_priv->dev;
251+ struct drm_device *dev = &dev_priv->drm;
256252 struct vmw_display_unit *du;
257253 struct drm_crtc *crtc;
258254
@@ -891,7 +887,7 @@ static int vmw_kms_new_framebuffer_surface(struct vmw_private *dev_priv, · 632 unmodified lines
891887 bool is_bo_proxy)
892888
893889 {
894− struct drm_device *dev = dev_priv->dev;
890+ struct drm_device *dev = &dev_priv->drm;
895891 struct vmw_framebuffer_surface *vfbs;
896892 enum SVGA3dSurfaceFormat format;
897893 int ret;
@@ -1003,11 +999,11 @@ static int vmw_framebuffer_bo_dirty(struct drm_framebuffer *framebuffer, · 105 unmodified lines
1003999 struct drm_clip_rect norect;
10041000 int ret, increment = 1;
10051001
1006− drm_modeset_lock_all(dev_priv->dev);
1002+ drm_modeset_lock_all(&dev_priv->drm);
10071003
10081004 ret = ttm_read_lock(&dev_priv->reservation_sem, true);
10091005 if (unlikely(ret != 0)) {
1010− drm_modeset_unlock_all(dev_priv->dev);
1006+ drm_modeset_unlock_all(&dev_priv->drm);
10111007 return ret;
10121008 }
10131009
@@ -1033,10 +1029,10 @@ static int vmw_framebuffer_bo_dirty(struct drm_framebuffer *framebuffer, · 19 unmodified lines
10331029 break;
10341030 }
10351031
1036− vmw_fifo_flush(dev_priv, false);
1032+ vmw_cmd_flush(dev_priv, false);
10371033 ttm_read_unlock(&dev_priv->reservation_sem);
10381034
1039− drm_modeset_unlock_all(dev_priv->dev);
1035+ drm_modeset_unlock_all(&dev_priv->drm);
10401036
10411037 return ret;
10421038 }
@@ -1213,7 +1209,7 @@ static int vmw_kms_new_framebuffer_bo(struct vmw_private *dev_priv, · 170 unmodified lines
12131209 *mode_cmd)
12141210
12151211 {
1216− struct drm_device *dev = dev_priv->dev;
1212+ struct drm_device *dev = &dev_priv->drm;
12171213 struct vmw_framebuffer_bo *vfbd;
12181214 unsigned int requested_size;
12191215 struct drm_format_name_buf format_name;
@@ -1319,7 +1315,7 @@ vmw_kms_new_framebuffer(struct vmw_private *dev_priv, · 99 unmodified lines
13191315 bo && only_2d &&
13201316 mode_cmd->width > 64 && /* Don't create a proxy for cursor */
13211317 dev_priv->active_display_unit == vmw_du_screen_target) {
1322− ret = vmw_create_bo_proxy(dev_priv->dev, mode_cmd,
1318+ ret = vmw_create_bo_proxy(&dev_priv->drm, mode_cmd,
13231319 bo, &surface);
13241320 if (ret)
13251321 return ERR_PTR(ret);
@@ -1768,7 +1764,7 @@ int vmw_kms_present(struct vmw_private *dev_priv, · 442 unmodified lines
17681764 if (ret)
17691765 return ret;
17701766
1771− vmw_fifo_flush(dev_priv, false);
1767+ vmw_cmd_flush(dev_priv, false);
17721768
17731769 return 0;
17741770 }
@@ -1780,7 +1776,7 @@ vmw_kms_create_hotplug_mode_update_property(struct vmw_private *dev_priv) · 5 unmodified lines
17801776 return;
17811777
17821778 dev_priv->hotplug_mode_update_property =
1783− drm_property_create_range(dev_priv->dev,
1779+ drm_property_create_range(&dev_priv->drm,
17841780 DRM_MODE_PROP_IMMUTABLE,
17851781 "hotplug_mode_update", 0, 1);
17861782
@@ -1791,7 +1787,7 @@ vmw_kms_create_hotplug_mode_update_property(struct vmw_private *dev_priv) · 4 unmodified lines
17911787
17921788 int vmw_kms_init(struct vmw_private *dev_priv)
17931789 {
1794− struct drm_device *dev = dev_priv->dev;
1790+ struct drm_device *dev = &dev_priv->drm;
17951791 int ret;
17961792
17971793 drm_mode_config_init(dev);
@@ -1823,7 +1819,7 @@ int vmw_kms_close(struct vmw_private *dev_priv) · 25 unmodified lines
18231819 * but since it destroys encoders and our destructor calls
18241820 * drm_encoder_cleanup which takes the lock we deadlock.
18251821 */
1826− drm_mode_config_cleanup(dev_priv->dev);
1822+ drm_mode_config_cleanup(&dev_priv->drm);
18271823 if (dev_priv->active_display_unit == vmw_du_legacy)
18281824 ret = vmw_kms_ldu_close_display(dev_priv);
18291825
@@ -1876,11 +1872,11 @@ int vmw_kms_write_svga(struct vmw_private *vmw_priv, · 46 unmodified lines
18761872 if (vmw_priv->capabilities & SVGA_CAP_PITCHLOCK)
18771873 vmw_write(vmw_priv, SVGA_REG_PITCHLOCK, pitch);
18781874 else if (vmw_fifo_have_pitchlock(vmw_priv))
1879− vmw_mmio_write(pitch, vmw_priv->mmio_virt +
1880− SVGA_FIFO_PITCHLOCK);
1875+ vmw_fifo_mem_write(vmw_priv, SVGA_FIFO_PITCHLOCK, pitch);
18811876 vmw_write(vmw_priv, SVGA_REG_WIDTH, width);
18821877 vmw_write(vmw_priv, SVGA_REG_HEIGHT, height);
1883− vmw_write(vmw_priv, SVGA_REG_BITS_PER_PIXEL, bpp);
1878+ if ((vmw_priv->capabilities & SVGA_CAP_8BIT_EMULATION) != 0)
1879+ vmw_write(vmw_priv, SVGA_REG_BITS_PER_PIXEL, bpp);
18841880
18851881 if (vmw_read(vmw_priv, SVGA_REG_DEPTH) != depth) {
18861882 DRM_ERROR("Invalid depth %u for %u bpp, host expects %u\n",
@@ -1934,7 +1930,7 @@ void vmw_disable_vblank(struct drm_crtc *crtc) · 47 unmodified lines
19341930 static int vmw_du_update_layout(struct vmw_private *dev_priv,
19351931 unsigned int num_rects, struct drm_rect *rects)
19361932 {
1937− struct drm_device *dev = dev_priv->dev;
1933+ struct drm_device *dev = &dev_priv->drm;
19381934 struct vmw_display_unit *du;
19391935 struct drm_connector *con;
19401936 struct drm_connector_list_iter conn_iter;
@@ -2366,7 +2362,7 @@ int vmw_kms_helper_dirty(struct vmw_private *dev_priv, · 425 unmodified lines
23662362 if (dirty->crtc) {
23672363 units[num_units++] = vmw_crtc_to_du(dirty->crtc);
23682364 } else {
2369− list_for_each_entry(crtc, &dev_priv->dev->mode_config.crtc_list,
2365+ list_for_each_entry(crtc, &dev_priv->drm.mode_config.crtc_list,
23702366 head) {
23712367 struct drm_plane *plane = crtc->primary;
23722368
@@ -2386,7 +2382,7 @@ int vmw_kms_helper_dirty(struct vmw_private *dev_priv, · 13 unmodified lines
23862382
23872383 dirty->unit = unit;
23882384 if (dirty->fifo_reserve_size > 0) {
2389− dirty->cmd = VMW_FIFO_RESERVE(dev_priv,
2385+ dirty->cmd = VMW_CMD_RESERVE(dev_priv,
23902386 dirty->fifo_reserve_size);
23912387 if (!dirty->cmd)
23922388 return -ENOMEM;
@@ -2520,7 +2516,7 @@ int vmw_kms_update_proxy(struct vmw_resource *res, · 127 unmodified lines
25202516 if (!clips)
25212517 return 0;
25222518
2523− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd) * num_clips);
2519+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd) * num_clips);
25242520 if (!cmd)
25252521 return -ENOMEM;
25262522
@@ -2549,7 +2545,7 @@ int vmw_kms_update_proxy(struct vmw_resource *res, · 22 unmodified lines
25492545 copy_size += sizeof(*cmd);
25502546 }
25512547
2552− vmw_fifo_commit(dev_priv, copy_size);
2548+ vmw_cmd_commit(dev_priv, copy_size);
25532549
25542550 return 0;
25552551 }
@@ -2568,8 +2564,8 @@ int vmw_kms_fbdev_init_data(struct vmw_private *dev_priv, · 12 unmodified lines
25682564 int i = 0;
25692565 int ret = 0;
25702566
2571− mutex_lock(&dev_priv->dev->mode_config.mutex);
2572− list_for_each_entry(con, &dev_priv->dev->mode_config.connector_list,
2567+ mutex_lock(&dev_priv->drm.mode_config.mutex);
2568+ list_for_each_entry(con, &dev_priv->drm.mode_config.connector_list,
25732569 head) {
25742570 if (i == unit)
25752571 break;
@@ -2577,7 +2573,7 @@ int vmw_kms_fbdev_init_data(struct vmw_private *dev_priv, · 1 unmodified line
25772573 ++i;
25782574 }
25792575
2580− if (&con->head == &dev_priv->dev->mode_config.connector_list) {
2576+ if (&con->head == &dev_priv->drm.mode_config.connector_list) {
25812577 DRM_ERROR("Could not find initial display unit.\n");
25822578 ret = -EINVAL;
25832579 goto out_unlock;
@@ -2611,7 +2607,7 @@ int vmw_kms_fbdev_init_data(struct vmw_private *dev_priv, · 27 unmodified lines
26112607 }
26122608
26132609 out_unlock:
2614− mutex_unlock(&dev_priv->dev->mode_config.mutex);
2610+ mutex_unlock(&dev_priv->drm.mode_config.mutex);
26152611
26162612 return ret;
26172613 }
@@ -2631,7 +2627,7 @@ vmw_kms_create_implicit_placement_property(struct vmw_private *dev_priv) · 13 unmodified lines
26312627 return;
26322628
26332629 dev_priv->implicit_placement_property =
2634− drm_property_create_range(dev_priv->dev,
2630+ drm_property_create_range(&dev_priv->drm,
26352631 DRM_MODE_PROP_IMMUTABLE,
26362632 "implicit_placement", 0, 1);
26372633 }
@@ -2752,7 +2748,7 @@ int vmw_du_helper_plane_update(struct vmw_du_update_plane *update) · 114 unmodified lines
27522748 goto out_unref;
27532749
27542750 reserved_size = update->calc_fifo_size(update, num_hits);
2755− cmd_start = VMW_FIFO_RESERVE(update->dev_priv, reserved_size);
2751+ cmd_start = VMW_CMD_RESERVE(update->dev_priv, reserved_size);
27562752 if (!cmd_start) {
27572753 ret = -ENOMEM;
27582754 goto out_revert;
@@ -2801,7 +2797,7 @@ int vmw_du_helper_plane_update(struct vmw_du_update_plane *update) · 42 unmodified lines
28012797 if (reserved_size < submit_size)
28022798 submit_size = 0;
28032799
2804− vmw_fifo_commit(update->dev_priv, submit_size);
2800+ vmw_cmd_commit(update->dev_priv, submit_size);
28052801
28062802 vmw_kms_helper_validation_finish(update->dev_priv, NULL, &val_ctx,
28072803 update->out_fence, NULL);
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c+4−5
@@ -125,7 +125,6 @@ static int vmw_ldu_commit_list(struct vmw_private *dev_priv) · 124 unmodified lines
125125 vmw_write(dev_priv, SVGA_REG_DISPLAY_POSITION_Y, crtc->y);
126126 vmw_write(dev_priv, SVGA_REG_DISPLAY_WIDTH, crtc->mode.hdisplay);
127127 vmw_write(dev_priv, SVGA_REG_DISPLAY_HEIGHT, crtc->mode.vdisplay);
128− vmw_write(dev_priv, SVGA_REG_DISPLAY_ID, SVGA_ID_INVALID);
129128
130129 i++;
131130 }
@@ -355,7 +354,7 @@ static const struct drm_crtc_helper_funcs vmw_ldu_crtc_helper_funcs = { · 223 unmodified lines
355354 static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit)
356355 {
357356 struct vmw_legacy_display_unit *ldu;
358− struct drm_device *dev = dev_priv->dev;
357+ struct drm_device *dev = &dev_priv->drm;
359358 struct drm_connector *connector;
360359 struct drm_encoder *encoder;
361360 struct drm_plane *primary, *cursor;
@@ -479,7 +478,7 @@ err_free: · 117 unmodified lines
479478
480479 int vmw_kms_ldu_init_display(struct vmw_private *dev_priv)
481480 {
482− struct drm_device *dev = dev_priv->dev;
481+ struct drm_device *dev = &dev_priv->drm;
483482 int i, ret;
484483
485484 if (dev_priv->ldu_priv) {
@@ -554,7 +553,7 @@ int vmw_kms_ldu_do_bo_dirty(struct vmw_private *dev_priv, · 68 unmodified lines
554553 } *cmd;
555554
556555 fifo_size = sizeof(*cmd) * num_clips;
557− cmd = VMW_FIFO_RESERVE(dev_priv, fifo_size);
556+ cmd = VMW_CMD_RESERVE(dev_priv, fifo_size);
558557 if (unlikely(cmd == NULL))
559558 return -ENOMEM;
560559
@@ -567,6 +566,6 @@ int vmw_kms_ldu_do_bo_dirty(struct vmw_private *dev_priv, · 6 unmodified lines
567566 cmd[i].body.height = clips->y2 - clips->y1;
568567 }
569568
570− vmw_fifo_commit(dev_priv, fifo_size);
569+ vmw_cmd_commit(dev_priv, fifo_size);
571570 return 0;
572571 }
drivers/gpu/drm/vmwgfx/vmwgfx_marker.c+0−155
@@ -1,155 +0,0 @@
1−// SPDX-License-Identifier: GPL-2.0 OR MIT
2−/**************************************************************************
3− *
4− * Copyright 2010 VMware, Inc., Palo Alto, CA., USA
5− *
6− * Permission is hereby granted, free of charge, to any person obtaining a
7− * copy of this software and associated documentation files (the
8− * "Software"), to deal in the Software without restriction, including
9− * without limitation the rights to use, copy, modify, merge, publish,
10− * distribute, sub license, and/or sell copies of the Software, and to
11− * permit persons to whom the Software is furnished to do so, subject to
12− * the following conditions:
13− *
14− * The above copyright notice and this permission notice (including the
15− * next paragraph) shall be included in all copies or substantial portions
16− * of the Software.
17− *
18− * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19− * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20− * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21− * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22− * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23− * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24− * USE OR OTHER DEALINGS IN THE SOFTWARE.
25− *
26− **************************************************************************/
27−
28−
29−#include "vmwgfx_drv.h"
30−
31−struct vmw_marker {
32− struct list_head head;
33− uint32_t seqno;
34− u64 submitted;
35−};
36−
37−void vmw_marker_queue_init(struct vmw_marker_queue *queue)
38−{
39− INIT_LIST_HEAD(&queue->head);
40− queue->lag = 0;
41− queue->lag_time = ktime_get_raw_ns();
42− spin_lock_init(&queue->lock);
43−}
44−
45−void vmw_marker_queue_takedown(struct vmw_marker_queue *queue)
46−{
47− struct vmw_marker *marker, *next;
48−
49− spin_lock(&queue->lock);
50− list_for_each_entry_safe(marker, next, &queue->head, head) {
51− kfree(marker);
52− }
53− spin_unlock(&queue->lock);
54−}
55−
56−int vmw_marker_push(struct vmw_marker_queue *queue,
57− uint32_t seqno)
58−{
59− struct vmw_marker *marker = kmalloc(sizeof(*marker), GFP_KERNEL);
60−
61− if (unlikely(!marker))
62− return -ENOMEM;
63−
64− marker->seqno = seqno;
65− marker->submitted = ktime_get_raw_ns();
66− spin_lock(&queue->lock);
67− list_add_tail(&marker->head, &queue->head);
68− spin_unlock(&queue->lock);
69−
70− return 0;
71−}
72−
73−int vmw_marker_pull(struct vmw_marker_queue *queue,
74− uint32_t signaled_seqno)
75−{
76− struct vmw_marker *marker, *next;
77− bool updated = false;
78− u64 now;
79−
80− spin_lock(&queue->lock);
81− now = ktime_get_raw_ns();
82−
83− if (list_empty(&queue->head)) {
84− queue->lag = 0;
85− queue->lag_time = now;
86− updated = true;
87− goto out_unlock;
88− }
89−
90− list_for_each_entry_safe(marker, next, &queue->head, head) {
91− if (signaled_seqno - marker->seqno > (1 << 30))
92− continue;
93−
94− queue->lag = now - marker->submitted;
95− queue->lag_time = now;
96− updated = true;
97− list_del(&marker->head);
98− kfree(marker);
99− }
100−
101−out_unlock:
102− spin_unlock(&queue->lock);
103−
104− return (updated) ? 0 : -EBUSY;
105−}
106−
107−static u64 vmw_fifo_lag(struct vmw_marker_queue *queue)
108−{
109− u64 now;
110−
111− spin_lock(&queue->lock);
112− now = ktime_get_raw_ns();
113− queue->lag += now - queue->lag_time;
114− queue->lag_time = now;
115− spin_unlock(&queue->lock);
116− return queue->lag;
117−}
118−
119−
120−static bool vmw_lag_lt(struct vmw_marker_queue *queue,
121− uint32_t us)
122−{
123− u64 cond = (u64) us * NSEC_PER_USEC;
124−
125− return vmw_fifo_lag(queue) <= cond;
126−}
127−
128−int vmw_wait_lag(struct vmw_private *dev_priv,
129− struct vmw_marker_queue *queue, uint32_t us)
130−{
131− struct vmw_marker *marker;
132− uint32_t seqno;
133− int ret;
134−
135− while (!vmw_lag_lt(queue, us)) {
136− spin_lock(&queue->lock);
137− if (list_empty(&queue->head))
138− seqno = atomic_read(&dev_priv->marker_seq);
139− else {
140− marker = list_first_entry(&queue->head,
141− struct vmw_marker, head);
142− seqno = marker->seqno;
143− }
144− spin_unlock(&queue->lock);
145−
146− ret = vmw_wait_seqno(dev_priv, false, seqno, true,
147− 3*HZ);
148−
149− if (unlikely(ret != 0))
150− return ret;
151−
152− (void) vmw_marker_pull(queue, seqno);
153− }
154− return 0;
155−}
drivers/gpu/drm/vmwgfx/vmwgfx_mob.c+8−8
@@ -148,7 +148,7 @@ static int vmw_setup_otable_base(struct vmw_private *dev_priv, · 147 unmodified lines
148148 mob->pt_level += VMW_MOBFMT_PTDEPTH_1 - SVGA3D_MOBFMT_PTDEPTH_1;
149149 }
150150
151− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
151+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
152152 if (unlikely(cmd == NULL)) {
153153 ret = -ENOMEM;
154154 goto out_no_fifo;
@@ -170,7 +170,7 @@ static int vmw_setup_otable_base(struct vmw_private *dev_priv, · 15 unmodified lines
170170 */
171171 BUG_ON(mob->pt_level == VMW_MOBFMT_PTDEPTH_2);
172172
173− vmw_fifo_commit(dev_priv, sizeof(*cmd));
173+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
174174 otable->page_table = mob;
175175
176176 return 0;
@@ -203,7 +203,7 @@ static void vmw_takedown_otable_base(struct vmw_private *dev_priv, · 26 unmodified lines
203203 return;
204204
205205 bo = otable->page_table->pt_bo;
206− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
206+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
207207 if (unlikely(cmd == NULL))
208208 return;
209209
@@ -215,7 +215,7 @@ static void vmw_takedown_otable_base(struct vmw_private *dev_priv, · 5 unmodified lines
215215 cmd->body.sizeInBytes = 0;
216216 cmd->body.validSizeInBytes = 0;
217217 cmd->body.ptDepth = SVGA3D_MOBFMT_INVALID;
218− vmw_fifo_commit(dev_priv, sizeof(*cmd));
218+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
219219
220220 if (bo) {
221221 int ret;
@@ -558,12 +558,12 @@ void vmw_mob_unbind(struct vmw_private *dev_priv, · 336 unmodified lines
558558 BUG_ON(ret != 0);
559559 }
560560
561− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
561+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
562562 if (cmd) {
563563 cmd->header.id = SVGA_3D_CMD_DESTROY_GB_MOB;
564564 cmd->header.size = sizeof(cmd->body);
565565 cmd->body.mobid = mob->id;
566− vmw_fifo_commit(dev_priv, sizeof(*cmd));
566+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
567567 }
568568
569569 if (bo) {
@@ -625,7 +625,7 @@ int vmw_mob_bind(struct vmw_private *dev_priv, · 55 unmodified lines
625625
626626 vmw_fifo_resource_inc(dev_priv);
627627
628− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
628+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
629629 if (unlikely(cmd == NULL))
630630 goto out_no_cmd_space;
631631
@@ -636,7 +636,7 @@ int vmw_mob_bind(struct vmw_private *dev_priv, · 4 unmodified lines
636636 cmd->body.base = mob->pt_root_page >> PAGE_SHIFT;
637637 cmd->body.sizeInBytes = num_data_pages * PAGE_SIZE;
638638
639− vmw_fifo_commit(dev_priv, sizeof(*cmd));
639+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
640640
641641 return 0;
642642
drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c+4−4
@@ -122,7 +122,7 @@ static int vmw_overlay_send_put(struct vmw_private *dev_priv, · 121 unmodified lines
122122
123123 fifo_size = sizeof(*cmds) + sizeof(*flush) + sizeof(*items) * num_items;
124124
125− cmds = VMW_FIFO_RESERVE(dev_priv, fifo_size);
125+ cmds = VMW_CMD_RESERVE(dev_priv, fifo_size);
126126 /* hardware has hung, can't do anything here */
127127 if (!cmds)
128128 return -ENOMEM;
@@ -169,7 +169,7 @@ static int vmw_overlay_send_put(struct vmw_private *dev_priv, · 40 unmodified lines
169169
170170 fill_flush(flush, arg->stream_id);
171171
172− vmw_fifo_commit(dev_priv, fifo_size);
172+ vmw_cmd_commit(dev_priv, fifo_size);
173173
174174 return 0;
175175 }
@@ -192,7 +192,7 @@ static int vmw_overlay_send_stop(struct vmw_private *dev_priv, · 16 unmodified lines
192192 int ret;
193193
194194 for (;;) {
195− cmds = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmds));
195+ cmds = VMW_CMD_RESERVE(dev_priv, sizeof(*cmds));
196196 if (cmds)
197197 break;
198198
@@ -211,7 +211,7 @@ static int vmw_overlay_send_stop(struct vmw_private *dev_priv, · 12 unmodified lines
211211 cmds->body.items[0].value = false;
212212 fill_flush(&cmds->flush, stream_id);
213213
214− vmw_fifo_commit(dev_priv, sizeof(*cmds));
214+ vmw_cmd_commit(dev_priv, sizeof(*cmds));
215215
216216 return 0;
217217 }
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c+2−2
@@ -827,7 +827,7 @@ int vmw_query_readback_all(struct vmw_buffer_object *dx_query_mob) · 826 unmodified lines
827827 dx_query_ctx = dx_query_mob->dx_query_ctx;
828828 dev_priv = dx_query_ctx->dev_priv;
829829
830− cmd = VMW_FIFO_RESERVE_DX(dev_priv, sizeof(*cmd), dx_query_ctx->id);
830+ cmd = VMW_CMD_CTX_RESERVE(dev_priv, sizeof(*cmd), dx_query_ctx->id);
831831 if (unlikely(cmd == NULL))
832832 return -ENOMEM;
833833
@@ -835,7 +835,7 @@ int vmw_query_readback_all(struct vmw_buffer_object *dx_query_mob) · 1 unmodified line
835835 cmd->header.size = sizeof(cmd->body);
836836 cmd->body.cid = dx_query_ctx->id;
837837
838− vmw_fifo_commit(dev_priv, sizeof(*cmd));
838+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
839839
840840 /* Triggers a rebind the next time affected context is bound */
841841 dx_query_mob->dx_query_ctx = NULL;
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c+14−14
@@ -132,7 +132,7 @@ static int vmw_sou_fifo_create(struct vmw_private *dev_priv, · 131 unmodified lines
132132 BUG_ON(!sou->buffer);
133133
134134 fifo_size = sizeof(*cmd);
135− cmd = VMW_FIFO_RESERVE(dev_priv, fifo_size);
135+ cmd = VMW_CMD_RESERVE(dev_priv, fifo_size);
136136 if (unlikely(cmd == NULL))
137137 return -ENOMEM;
138138
@@ -153,7 +153,7 @@ static int vmw_sou_fifo_create(struct vmw_private *dev_priv, · 14 unmodified lines
153153 vmw_bo_get_guest_ptr(&sou->buffer->base, &cmd->obj.backingStore.ptr);
154154 cmd->obj.backingStore.pitch = mode->hdisplay * 4;
155155
156− vmw_fifo_commit(dev_priv, fifo_size);
156+ vmw_cmd_commit(dev_priv, fifo_size);
157157
158158 sou->defined = true;
159159
@@ -181,7 +181,7 @@ static int vmw_sou_fifo_destroy(struct vmw_private *dev_priv, · 21 unmodified lines
181181 return 0;
182182
183183 fifo_size = sizeof(*cmd);
184− cmd = VMW_FIFO_RESERVE(dev_priv, fifo_size);
184+ cmd = VMW_CMD_RESERVE(dev_priv, fifo_size);
185185 if (unlikely(cmd == NULL))
186186 return -ENOMEM;
187187
@@ -189,7 +189,7 @@ static int vmw_sou_fifo_destroy(struct vmw_private *dev_priv, · 1 unmodified line
189189 cmd->header.cmdType = SVGA_CMD_DESTROY_SCREEN;
190190 cmd->body.screenId = sou->base.unit;
191191
192− vmw_fifo_commit(dev_priv, fifo_size);
192+ vmw_cmd_commit(dev_priv, fifo_size);
193193
194194 /* Force sync */
195195 ret = vmw_fallback_wait(dev_priv, false, true, 0, false, 3*HZ);
@@ -829,7 +829,7 @@ static const struct drm_crtc_helper_funcs vmw_sou_crtc_helper_funcs = { · 633 unmodified lines
829829 static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit)
830830 {
831831 struct vmw_screen_object_unit *sou;
832− struct drm_device *dev = dev_priv->dev;
832+ struct drm_device *dev = &dev_priv->drm;
833833 struct drm_connector *connector;
834834 struct drm_encoder *encoder;
835835 struct drm_plane *primary, *cursor;
@@ -946,7 +946,7 @@ err_free: · 110 unmodified lines
946946
947947 int vmw_kms_sou_init_display(struct vmw_private *dev_priv)
948948 {
949− struct drm_device *dev = dev_priv->dev;
949+ struct drm_device *dev = &dev_priv->drm;
950950 int i, ret;
951951
952952 if (!(dev_priv->capabilities & SVGA_CAP_SCREEN_OBJECT_2)) {
@@ -992,7 +992,7 @@ static int do_bo_define_gmrfb(struct vmw_private *dev_priv, · 39 unmodified lines
992992 if (depth == 32)
993993 depth = 24;
994994
995− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
995+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
996996 if (!cmd)
997997 return -ENOMEM;
998998
@@ -1003,7 +1003,7 @@ static int do_bo_define_gmrfb(struct vmw_private *dev_priv, · 4 unmodified lines
10031003 cmd->body.bytesPerLine = framebuffer->base.pitches[0];
10041004 /* Buffer is reserved in vram or GMR */
10051005 vmw_bo_get_guest_ptr(&buf->base, &cmd->body.ptr);
1006− vmw_fifo_commit(dev_priv, sizeof(*cmd));
1006+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
10071007
10081008 return 0;
10091009 }
@@ -1029,7 +1029,7 @@ static void vmw_sou_surface_fifo_commit(struct vmw_kms_dirty *dirty) · 19 unmodified lines
10291029 int i;
10301030
10311031 if (!dirty->num_hits) {
1032− vmw_fifo_commit(dirty->dev_priv, 0);
1032+ vmw_cmd_commit(dirty->dev_priv, 0);
10331033 return;
10341034 }
10351035
@@ -1061,7 +1061,7 @@ static void vmw_sou_surface_fifo_commit(struct vmw_kms_dirty *dirty) · 25 unmodified lines
10611061 blit->bottom -= sdirty->top;
10621062 }
10631063
1064− vmw_fifo_commit(dirty->dev_priv, region_size + sizeof(*cmd));
1064+ vmw_cmd_commit(dirty->dev_priv, region_size + sizeof(*cmd));
10651065
10661066 sdirty->left = sdirty->top = S32_MAX;
10671067 sdirty->right = sdirty->bottom = S32_MIN;
@@ -1185,11 +1185,11 @@ out_unref: · 117 unmodified lines
11851185 static void vmw_sou_bo_fifo_commit(struct vmw_kms_dirty *dirty)
11861186 {
11871187 if (!dirty->num_hits) {
1188− vmw_fifo_commit(dirty->dev_priv, 0);
1188+ vmw_cmd_commit(dirty->dev_priv, 0);
11891189 return;
11901190 }
11911191
1192− vmw_fifo_commit(dirty->dev_priv,
1192+ vmw_cmd_commit(dirty->dev_priv,
11931193 sizeof(struct vmw_kms_sou_bo_blit) *
11941194 dirty->num_hits);
11951195 }
@@ -1295,11 +1295,11 @@ out_unref: · 99 unmodified lines
12951295 static void vmw_sou_readback_fifo_commit(struct vmw_kms_dirty *dirty)
12961296 {
12971297 if (!dirty->num_hits) {
1298− vmw_fifo_commit(dirty->dev_priv, 0);
1298+ vmw_cmd_commit(dirty->dev_priv, 0);
12991299 return;
13001300 }
13011301
1302− vmw_fifo_commit(dirty->dev_priv,
1302+ vmw_cmd_commit(dirty->dev_priv,
13031303 sizeof(struct vmw_kms_sou_readback_blit) *
13041304 dirty->num_hits);
13051305 }
drivers/gpu/drm/vmwgfx/vmwgfx_shader.c+12−12
@@ -222,7 +222,7 @@ static int vmw_gb_shader_create(struct vmw_resource *res) · 221 unmodified lines
222222 goto out_no_fifo;
223223 }
224224
225− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
225+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
226226 if (unlikely(cmd == NULL)) {
227227 ret = -ENOMEM;
228228 goto out_no_fifo;
@@ -233,7 +233,7 @@ static int vmw_gb_shader_create(struct vmw_resource *res) · 4 unmodified lines
233233 cmd->body.shid = res->id;
234234 cmd->body.type = shader->type;
235235 cmd->body.sizeInBytes = shader->size;
236− vmw_fifo_commit(dev_priv, sizeof(*cmd));
236+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
237237 vmw_fifo_resource_inc(dev_priv);
238238
239239 return 0;
@@ -256,7 +256,7 @@ static int vmw_gb_shader_bind(struct vmw_resource *res, · 16 unmodified lines
256256
257257 BUG_ON(bo->mem.mem_type != VMW_PL_MOB);
258258
259− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
259+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
260260 if (unlikely(cmd == NULL))
261261 return -ENOMEM;
262262
@@ -266,7 +266,7 @@ static int vmw_gb_shader_bind(struct vmw_resource *res, · 3 unmodified lines
266266 cmd->body.mobid = bo->mem.start;
267267 cmd->body.offsetInBytes = res->backup_offset;
268268 res->backup_dirty = false;
269− vmw_fifo_commit(dev_priv, sizeof(*cmd));
269+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
270270
271271 return 0;
272272 }
@@ -284,7 +284,7 @@ static int vmw_gb_shader_unbind(struct vmw_resource *res, · 11 unmodified lines
284284
285285 BUG_ON(res->backup->base.mem.mem_type != VMW_PL_MOB);
286286
287− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
287+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
288288 if (unlikely(cmd == NULL))
289289 return -ENOMEM;
290290
@@ -293,7 +293,7 @@ static int vmw_gb_shader_unbind(struct vmw_resource *res, · 2 unmodified lines
293293 cmd->body.shid = res->id;
294294 cmd->body.mobid = SVGA3D_INVALID_ID;
295295 cmd->body.offsetInBytes = 0;
296− vmw_fifo_commit(dev_priv, sizeof(*cmd));
296+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
297297
298298 /*
299299 * Create a fence object and fence the backup buffer.
@@ -324,7 +324,7 @@ static int vmw_gb_shader_destroy(struct vmw_resource *res) · 24 unmodified lines
324324 mutex_lock(&dev_priv->binding_mutex);
325325 vmw_binding_res_list_scrub(&res->binding_head);
326326
327− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
327+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
328328 if (unlikely(cmd == NULL)) {
329329 mutex_unlock(&dev_priv->binding_mutex);
330330 return -ENOMEM;
@@ -333,7 +333,7 @@ static int vmw_gb_shader_destroy(struct vmw_resource *res) · 2 unmodified lines
333333 cmd->header.id = SVGA_3D_CMD_DESTROY_GB_SHADER;
334334 cmd->header.size = sizeof(cmd->body);
335335 cmd->body.shid = res->id;
336− vmw_fifo_commit(dev_priv, sizeof(*cmd));
336+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
337337 mutex_unlock(&dev_priv->binding_mutex);
338338 vmw_resource_release_id(res);
339339 vmw_fifo_resource_dec(dev_priv);
@@ -394,7 +394,7 @@ static int vmw_dx_shader_unscrub(struct vmw_resource *res) · 54 unmodified lines
394394 if (!list_empty(&shader->cotable_head) || !shader->committed)
395395 return 0;
396396
397− cmd = VMW_FIFO_RESERVE_DX(dev_priv, sizeof(*cmd), shader->ctx->id);
397+ cmd = VMW_CMD_CTX_RESERVE(dev_priv, sizeof(*cmd), shader->ctx->id);
398398 if (unlikely(cmd == NULL))
399399 return -ENOMEM;
400400
@@ -404,7 +404,7 @@ static int vmw_dx_shader_unscrub(struct vmw_resource *res) · 3 unmodified lines
404404 cmd->body.shid = shader->id;
405405 cmd->body.mobid = res->backup->base.mem.start;
406406 cmd->body.offsetInBytes = res->backup_offset;
407− vmw_fifo_commit(dev_priv, sizeof(*cmd));
407+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
408408
409409 vmw_cotable_add_resource(shader->cotable, &shader->cotable_head);
410410
@@ -481,7 +481,7 @@ static int vmw_dx_shader_scrub(struct vmw_resource *res) · 70 unmodified lines
481481 return 0;
482482
483483 WARN_ON_ONCE(!shader->committed);
484− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
484+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
485485 if (unlikely(cmd == NULL))
486486 return -ENOMEM;
487487
@@ -491,7 +491,7 @@ static int vmw_dx_shader_scrub(struct vmw_resource *res) · 3 unmodified lines
491491 cmd->body.shid = res->id;
492492 cmd->body.mobid = SVGA3D_INVALID_ID;
493493 cmd->body.offsetInBytes = 0;
494− vmw_fifo_commit(dev_priv, sizeof(*cmd));
494+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
495495 res->id = -1;
496496 list_del_init(&shader->cotable_head);
497497
drivers/gpu/drm/vmwgfx/vmwgfx_so.c+4−4
@@ -170,7 +170,7 @@ static int vmw_view_create(struct vmw_resource *res) · 169 unmodified lines
170170 return 0;
171171 }
172172
173− cmd = VMW_FIFO_RESERVE_DX(res->dev_priv, view->cmd_size, view->ctx->id);
173+ cmd = VMW_CMD_CTX_RESERVE(res->dev_priv, view->cmd_size, view->ctx->id);
174174 if (!cmd) {
175175 mutex_unlock(&dev_priv->binding_mutex);
176176 return -ENOMEM;
@@ -181,7 +181,7 @@ static int vmw_view_create(struct vmw_resource *res) · 4 unmodified lines
181181 /* Sid may have changed due to surface eviction. */
182182 WARN_ON(view->srf->id == SVGA3D_INVALID_ID);
183183 cmd->body.sid = view->srf->id;
184− vmw_fifo_commit(res->dev_priv, view->cmd_size);
184+ vmw_cmd_commit(res->dev_priv, view->cmd_size);
185185 res->id = view->view_id;
186186 list_add_tail(&view->srf_head, &srf->view_list);
187187 vmw_cotable_add_resource(view->cotable, &view->cotable_head);
@@ -213,14 +213,14 @@ static int vmw_view_destroy(struct vmw_resource *res) · 25 unmodified lines
213213 if (!view->committed || res->id == -1)
214214 return 0;
215215
216− cmd = VMW_FIFO_RESERVE_DX(dev_priv, sizeof(*cmd), view->ctx->id);
216+ cmd = VMW_CMD_CTX_RESERVE(dev_priv, sizeof(*cmd), view->ctx->id);
217217 if (!cmd)
218218 return -ENOMEM;
219219
220220 cmd->header.id = vmw_view_destroy_cmds[view->view_type];
221221 cmd->header.size = sizeof(cmd->body);
222222 cmd->body.view_id = view->view_id;
223− vmw_fifo_commit(dev_priv, sizeof(*cmd));
223+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
224224 res->id = -1;
225225 list_del_init(&view->cotable_head);
226226 list_del_init(&view->srf_head);
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c+16−16
@@ -170,7 +170,7 @@ static int vmw_stdu_define_st(struct vmw_private *dev_priv, · 169 unmodified lines
170170 SVGA3dCmdDefineGBScreenTarget body;
171171 } *cmd;
172172
173− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
173+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
174174 if (unlikely(cmd == NULL))
175175 return -ENOMEM;
176176
@@ -188,7 +188,7 @@ static int vmw_stdu_define_st(struct vmw_private *dev_priv, · 11 unmodified lines
188188 stdu->base.set_gui_x = cmd->body.xRoot;
189189 stdu->base.set_gui_y = cmd->body.yRoot;
190190
191− vmw_fifo_commit(dev_priv, sizeof(*cmd));
191+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
192192
193193 stdu->defined = true;
194194 stdu->display_width = mode->hdisplay;
@@ -229,7 +229,7 @@ static int vmw_stdu_bind_st(struct vmw_private *dev_priv, · 34 unmodified lines
229229 memset(&image, 0, sizeof(image));
230230 image.sid = res ? res->id : SVGA3D_INVALID_ID;
231231
232− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
232+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
233233 if (unlikely(cmd == NULL))
234234 return -ENOMEM;
235235
@@ -239,7 +239,7 @@ static int vmw_stdu_bind_st(struct vmw_private *dev_priv, · 3 unmodified lines
239239 cmd->body.stid = stdu->base.unit;
240240 cmd->body.image = image;
241241
242− vmw_fifo_commit(dev_priv, sizeof(*cmd));
242+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
243243
244244 return 0;
245245 }
@@ -293,7 +293,7 @@ static int vmw_stdu_update_st(struct vmw_private *dev_priv, · 47 unmodified lines
293293 return -EINVAL;
294294 }
295295
296− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
296+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
297297 if (unlikely(cmd == NULL))
298298 return -ENOMEM;
299299
@@ -301,7 +301,7 @@ static int vmw_stdu_update_st(struct vmw_private *dev_priv, · 1 unmodified line
301301 0, stdu->display_width,
302302 0, stdu->display_height);
303303
304− vmw_fifo_commit(dev_priv, sizeof(*cmd));
304+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
305305
306306 return 0;
307307 }
@@ -329,7 +329,7 @@ static int vmw_stdu_destroy_st(struct vmw_private *dev_priv, · 21 unmodified lines
329329 if (unlikely(!stdu->defined))
330330 return 0;
331331
332− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
332+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
333333 if (unlikely(cmd == NULL))
334334 return -ENOMEM;
335335
@@ -338,7 +338,7 @@ static int vmw_stdu_destroy_st(struct vmw_private *dev_priv, · 2 unmodified lines
338338
339339 cmd->body.stid = stdu->base.unit;
340340
341− vmw_fifo_commit(dev_priv, sizeof(*cmd));
341+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
342342
343343 /* Force sync */
344344 ret = vmw_fallback_wait(dev_priv, false, true, 0, false, 3*HZ);
@@ -499,7 +499,7 @@ static void vmw_stdu_bo_fifo_commit(struct vmw_kms_dirty *dirty) · 154 unmodified lines
499499 size_t blit_size = sizeof(*blit) * dirty->num_hits + sizeof(*suffix);
500500
501501 if (!dirty->num_hits) {
502− vmw_fifo_commit(dirty->dev_priv, 0);
502+ vmw_cmd_commit(dirty->dev_priv, 0);
503503 return;
504504 }
505505
@@ -522,7 +522,7 @@ static void vmw_stdu_bo_fifo_commit(struct vmw_kms_dirty *dirty) · 16 unmodified lines
522522 ddirty->top, ddirty->bottom);
523523 }
524524
525− vmw_fifo_commit(dirty->dev_priv, sizeof(*cmd) + blit_size);
525+ vmw_cmd_commit(dirty->dev_priv, sizeof(*cmd) + blit_size);
526526
527527 stdu->display_srf->res.res_dirty = true;
528528 ddirty->left = ddirty->top = S32_MAX;
@@ -628,7 +628,7 @@ static void vmw_stdu_bo_cpu_commit(struct vmw_kms_dirty *dirty) · 99 unmodified lines
628628
629629
630630 dev_priv = vmw_priv(stdu->base.crtc.dev);
631− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
631+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
632632 if (!cmd)
633633 goto out_cleanup;
634634
@@ -636,7 +636,7 @@ static void vmw_stdu_bo_cpu_commit(struct vmw_kms_dirty *dirty) · 1 unmodified line
636636 region.x1, region.x2,
637637 region.y1, region.y2);
638638
639− vmw_fifo_commit(dev_priv, sizeof(*cmd));
639+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
640640 }
641641
642642 out_cleanup:
@@ -795,7 +795,7 @@ static void vmw_kms_stdu_surface_fifo_commit(struct vmw_kms_dirty *dirty) · 152 unmodified lines
795795 size_t commit_size;
796796
797797 if (!dirty->num_hits) {
798− vmw_fifo_commit(dirty->dev_priv, 0);
798+ vmw_cmd_commit(dirty->dev_priv, 0);
799799 return;
800800 }
801801
@@ -817,7 +817,7 @@ static void vmw_kms_stdu_surface_fifo_commit(struct vmw_kms_dirty *dirty) · 15 unmodified lines
817817 vmw_stdu_populate_update(update, stdu->base.unit, sdirty->left,
818818 sdirty->right, sdirty->top, sdirty->bottom);
819819
820− vmw_fifo_commit(dirty->dev_priv, commit_size);
820+ vmw_cmd_commit(dirty->dev_priv, commit_size);
821821
822822 sdirty->left = sdirty->top = S32_MAX;
823823 sdirty->right = sdirty->bottom = S32_MIN;
@@ -1713,7 +1713,7 @@ static const struct drm_crtc_helper_funcs vmw_stdu_crtc_helper_funcs = { · 889 unmodified lines
17131713 static int vmw_stdu_init(struct vmw_private *dev_priv, unsigned unit)
17141714 {
17151715 struct vmw_screen_target_display_unit *stdu;
1716− struct drm_device *dev = dev_priv->dev;
1716+ struct drm_device *dev = &dev_priv->drm;
17171717 struct drm_connector *connector;
17181718 struct drm_encoder *encoder;
17191719 struct drm_plane *primary, *cursor;
@@ -1861,7 +1861,7 @@ static void vmw_stdu_destroy(struct vmw_screen_target_display_unit *stdu) · 141 unmodified lines
18611861 */
18621862 int vmw_kms_stdu_init_display(struct vmw_private *dev_priv)
18631863 {
1864− struct drm_device *dev = dev_priv->dev;
1864+ struct drm_device *dev = &dev_priv->drm;
18651865 int i, ret;
18661866
18671867
drivers/gpu/drm/vmwgfx/vmwgfx_streamoutput.c+4−4
@@ -99,7 +99,7 @@ static int vmw_dx_streamoutput_unscrub(struct vmw_resource *res) · 98 unmodified lines
9999 if (!list_empty(&so->cotable_head) || !so->committed )
100100 return 0;
101101
102− cmd = VMW_FIFO_RESERVE_DX(dev_priv, sizeof(*cmd), so->ctx->id);
102+ cmd = VMW_CMD_CTX_RESERVE(dev_priv, sizeof(*cmd), so->ctx->id);
103103 if (!cmd)
104104 return -ENOMEM;
105105
@@ -109,7 +109,7 @@ static int vmw_dx_streamoutput_unscrub(struct vmw_resource *res) · 3 unmodified lines
109109 cmd->body.mobid = res->backup->base.mem.start;
110110 cmd->body.offsetInBytes = res->backup_offset;
111111 cmd->body.sizeInBytes = so->size;
112− vmw_fifo_commit(dev_priv, sizeof(*cmd));
112+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
113113
114114 vmw_cotable_add_resource(so->cotable, &so->cotable_head);
115115
@@ -172,7 +172,7 @@ static int vmw_dx_streamoutput_scrub(struct vmw_resource *res) · 56 unmodified lines
172172
173173 WARN_ON_ONCE(!so->committed);
174174
175− cmd = VMW_FIFO_RESERVE_DX(dev_priv, sizeof(*cmd), so->ctx->id);
175+ cmd = VMW_CMD_CTX_RESERVE(dev_priv, sizeof(*cmd), so->ctx->id);
176176 if (!cmd)
177177 return -ENOMEM;
178178
@@ -182,7 +182,7 @@ static int vmw_dx_streamoutput_scrub(struct vmw_resource *res) · 3 unmodified lines
182182 cmd->body.mobid = SVGA3D_INVALID_ID;
183183 cmd->body.offsetInBytes = 0;
184184 cmd->body.sizeInBytes = so->size;
185− vmw_fifo_commit(dev_priv, sizeof(*cmd));
185+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
186186
187187 res->id = -1;
188188 list_del_init(&so->cotable_head);
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c+20−20
@@ -372,12 +372,12 @@ static void vmw_hw_surface_destroy(struct vmw_resource *res) · 371 unmodified lines
372372
373373 if (res->id != -1) {
374374
375− cmd = VMW_FIFO_RESERVE(dev_priv, vmw_surface_destroy_size());
375+ cmd = VMW_CMD_RESERVE(dev_priv, vmw_surface_destroy_size());
376376 if (unlikely(!cmd))
377377 return;
378378
379379 vmw_surface_destroy_encode(res->id, cmd);
380− vmw_fifo_commit(dev_priv, vmw_surface_destroy_size());
380+ vmw_cmd_commit(dev_priv, vmw_surface_destroy_size());
381381
382382 /*
383383 * used_memory_size_atomic, or separate lock
@@ -440,14 +440,14 @@ static int vmw_legacy_srf_create(struct vmw_resource *res) · 56 unmodified lines
440440 */
441441
442442 submit_size = vmw_surface_define_size(srf);
443− cmd = VMW_FIFO_RESERVE(dev_priv, submit_size);
443+ cmd = VMW_CMD_RESERVE(dev_priv, submit_size);
444444 if (unlikely(!cmd)) {
445445 ret = -ENOMEM;
446446 goto out_no_fifo;
447447 }
448448
449449 vmw_surface_define_encode(srf, cmd);
450− vmw_fifo_commit(dev_priv, submit_size);
450+ vmw_cmd_commit(dev_priv, submit_size);
451451 vmw_fifo_resource_inc(dev_priv);
452452
453453 /*
@@ -492,14 +492,14 @@ static int vmw_legacy_srf_dma(struct vmw_resource *res, · 38 unmodified lines
492492
493493 BUG_ON(!val_buf->bo);
494494 submit_size = vmw_surface_dma_size(srf);
495− cmd = VMW_FIFO_RESERVE(dev_priv, submit_size);
495+ cmd = VMW_CMD_RESERVE(dev_priv, submit_size);
496496 if (unlikely(!cmd))
497497 return -ENOMEM;
498498
499499 vmw_bo_get_guest_ptr(val_buf->bo, &ptr);
500500 vmw_surface_dma_encode(srf, cmd, &ptr, bind);
501501
502− vmw_fifo_commit(dev_priv, submit_size);
502+ vmw_cmd_commit(dev_priv, submit_size);
503503
504504 /*
505505 * Create a fence object and fence the backup buffer.
@@ -578,12 +578,12 @@ static int vmw_legacy_srf_destroy(struct vmw_resource *res) · 72 unmodified lines
578578 */
579579
580580 submit_size = vmw_surface_destroy_size();
581− cmd = VMW_FIFO_RESERVE(dev_priv, submit_size);
581+ cmd = VMW_CMD_RESERVE(dev_priv, submit_size);
582582 if (unlikely(!cmd))
583583 return -ENOMEM;
584584
585585 vmw_surface_destroy_encode(res->id, cmd);
586− vmw_fifo_commit(dev_priv, submit_size);
586+ vmw_cmd_commit(dev_priv, submit_size);
587587
588588 /*
589589 * Surface memory usage accounting.
@@ -1121,7 +1121,7 @@ static int vmw_gb_surface_create(struct vmw_resource *res) · 531 unmodified lines
11211121 submit_len = sizeof(*cmd);
11221122 }
11231123
1124− cmd = VMW_FIFO_RESERVE(dev_priv, submit_len);
1124+ cmd = VMW_CMD_RESERVE(dev_priv, submit_len);
11251125 cmd2 = (typeof(cmd2))cmd;
11261126 cmd3 = (typeof(cmd3))cmd;
11271127 cmd4 = (typeof(cmd4))cmd;
@@ -1188,7 +1188,7 @@ static int vmw_gb_surface_create(struct vmw_resource *res) · 60 unmodified lines
11881188 cmd->body.size.depth = metadata->base_size.depth;
11891189 }
11901190
1191− vmw_fifo_commit(dev_priv, submit_len);
1191+ vmw_cmd_commit(dev_priv, submit_len);
11921192
11931193 return 0;
11941194
@@ -1219,7 +1219,7 @@ static int vmw_gb_surface_bind(struct vmw_resource *res, · 24 unmodified lines
12191219
12201220 submit_size = sizeof(*cmd1) + (res->backup_dirty ? sizeof(*cmd2) : 0);
12211221
1222− cmd1 = VMW_FIFO_RESERVE(dev_priv, submit_size);
1222+ cmd1 = VMW_CMD_RESERVE(dev_priv, submit_size);
12231223 if (unlikely(!cmd1))
12241224 return -ENOMEM;
12251225
@@ -1233,7 +1233,7 @@ static int vmw_gb_surface_bind(struct vmw_resource *res, · 7 unmodified lines
12331233 cmd2->header.size = sizeof(cmd2->body);
12341234 cmd2->body.sid = res->id;
12351235 }
1236− vmw_fifo_commit(dev_priv, submit_size);
1236+ vmw_cmd_commit(dev_priv, submit_size);
12371237
12381238 if (res->backup->dirty && res->backup_dirty) {
12391239 /* We've just made a full upload. Cear dirty regions. */
@@ -1272,7 +1272,7 @@ static int vmw_gb_surface_unbind(struct vmw_resource *res, · 32 unmodified lines
12721272 BUG_ON(bo->mem.mem_type != VMW_PL_MOB);
12731273
12741274 submit_size = sizeof(*cmd3) + (readback ? sizeof(*cmd1) : sizeof(*cmd2));
1275− cmd = VMW_FIFO_RESERVE(dev_priv, submit_size);
1275+ cmd = VMW_CMD_RESERVE(dev_priv, submit_size);
12761276 if (unlikely(!cmd))
12771277 return -ENOMEM;
12781278
@@ -1295,7 +1295,7 @@ static int vmw_gb_surface_unbind(struct vmw_resource *res, · 16 unmodified lines
12951295 cmd3->body.sid = res->id;
12961296 cmd3->body.mobid = SVGA3D_INVALID_ID;
12971297
1298− vmw_fifo_commit(dev_priv, submit_size);
1298+ vmw_cmd_commit(dev_priv, submit_size);
12991299
13001300 /*
13011301 * Create a fence object and fence the backup buffer.
@@ -1328,7 +1328,7 @@ static int vmw_gb_surface_destroy(struct vmw_resource *res) · 26 unmodified lines
13281328 vmw_view_surface_list_destroy(dev_priv, &srf->view_list);
13291329 vmw_binding_res_list_scrub(&res->binding_head);
13301330
1331− cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd));
1331+ cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
13321332 if (unlikely(!cmd)) {
13331333 mutex_unlock(&dev_priv->binding_mutex);
13341334 return -ENOMEM;
@@ -1337,7 +1337,7 @@ static int vmw_gb_surface_destroy(struct vmw_resource *res) · 2 unmodified lines
13371337 cmd->header.id = SVGA_3D_CMD_DESTROY_GB_SURFACE;
13381338 cmd->header.size = sizeof(cmd->body);
13391339 cmd->body.sid = res->id;
1340− vmw_fifo_commit(dev_priv, sizeof(*cmd));
1340+ vmw_cmd_commit(dev_priv, sizeof(*cmd));
13411341 mutex_unlock(&dev_priv->binding_mutex);
13421342 vmw_resource_release_id(res);
13431343 vmw_fifo_resource_dec(dev_priv);
@@ -1895,7 +1895,7 @@ static int vmw_surface_dirty_sync(struct vmw_resource *res) · 551 unmodified lines
18951895 goto out;
18961896
18971897 alloc_size = num_dirty * ((has_dx) ? sizeof(*cmd1) : sizeof(*cmd2));
1898− cmd = VMW_FIFO_RESERVE(dev_priv, alloc_size);
1898+ cmd = VMW_CMD_RESERVE(dev_priv, alloc_size);
18991899 if (!cmd)
19001900 return -ENOMEM;
19011901
@@ -1931,7 +1931,7 @@ static int vmw_surface_dirty_sync(struct vmw_resource *res) · 29 unmodified lines
19311931 }
19321932
19331933 }
1934− vmw_fifo_commit(dev_priv, alloc_size);
1934+ vmw_cmd_commit(dev_priv, alloc_size);
19351935 out:
19361936 memset(&dirty->boxes[0], 0, sizeof(dirty->boxes[0]) *
19371937 dirty->num_subres);
@@ -2031,14 +2031,14 @@ static int vmw_surface_clean(struct vmw_resource *res) · 93 unmodified lines
20312031 } *cmd;
20322032
20332033 alloc_size = sizeof(*cmd);
2034− cmd = VMW_FIFO_RESERVE(dev_priv, alloc_size);
2034+ cmd = VMW_CMD_RESERVE(dev_priv, alloc_size);
20352035 if (!cmd)
20362036 return -ENOMEM;
20372037
20382038 cmd->header.id = SVGA_3D_CMD_READBACK_GB_SURFACE;
20392039 cmd->header.size = sizeof(cmd->body);
20402040 cmd->body.sid = res->id;
2041− vmw_fifo_commit(dev_priv, alloc_size);
2041+ vmw_cmd_commit(dev_priv, alloc_size);
20422042
20432043 return 0;
20442044 }
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c+3−3
@@ -309,7 +309,7 @@ void vmw_piter_start(struct vmw_piter *viter, const struct vmw_sg_table *vsgt, · 308 unmodified lines
309309 */
310310 static void vmw_ttm_unmap_from_dma(struct vmw_ttm_tt *vmw_tt)
311311 {
312− struct device *dev = vmw_tt->dev_priv->dev->dev;
312+ struct device *dev = vmw_tt->dev_priv->drm.dev;
313313
314314 dma_unmap_sgtable(dev, &vmw_tt->sgt, DMA_BIDIRECTIONAL, 0);
315315 vmw_tt->sgt.nents = vmw_tt->sgt.orig_nents;
@@ -330,7 +330,7 @@ static void vmw_ttm_unmap_from_dma(struct vmw_ttm_tt *vmw_tt) · 14 unmodified lines
330330 */
331331 static int vmw_ttm_map_for_dma(struct vmw_ttm_tt *vmw_tt)
332332 {
333− struct device *dev = vmw_tt->dev_priv->dev->dev;
333+ struct device *dev = vmw_tt->dev_priv->drm.dev;
334334
335335 return dma_map_sgtable(dev, &vmw_tt->sgt, DMA_BIDIRECTIONAL, 0);
336336 }
@@ -385,7 +385,7 @@ static int vmw_ttm_map_dma(struct vmw_ttm_tt *vmw_tt) · 48 unmodified lines
385385 sg = __sg_alloc_table_from_pages(&vmw_tt->sgt, vsgt->pages,
386386 vsgt->num_pages, 0,
387387 (unsigned long) vsgt->num_pages << PAGE_SHIFT,
388− dma_get_max_seg_size(dev_priv->dev->dev),
388+ dma_get_max_seg_size(dev_priv->drm.dev),
389389 NULL, 0, GFP_KERNEL);
390390 if (IS_ERR(sg)) {
391391 ret = PTR_ERR(sg);
drivers/pci/pci.c+10−2
@@ -1644,7 +1644,7 @@ static void pci_restore_rebar_state(struct pci_dev *pdev) · 1643 unmodified lines
16441644 pci_read_config_dword(pdev, pos + PCI_REBAR_CTRL, &ctrl);
16451645 bar_idx = ctrl & PCI_REBAR_CTRL_BAR_IDX;
16461646 res = pdev->resource + bar_idx;
1647− size = ilog2(resource_size(res)) - 20;
1647+ size = pci_rebar_bytes_to_size(resource_size(res));
16481648 ctrl &= ~PCI_REBAR_CTRL_BAR_SIZE;
16491649 ctrl |= size << PCI_REBAR_CTRL_BAR_SHIFT;
16501650 pci_write_config_dword(pdev, pos + PCI_REBAR_CTRL, ctrl);
@@ -3603,8 +3603,16 @@ u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar) · 1952 unmodified lines
36033603 return 0;
36043604
36053605 pci_read_config_dword(pdev, pos + PCI_REBAR_CAP, &cap);
3606− return (cap & PCI_REBAR_CAP_SIZES) >> 4;
3606+ cap &= PCI_REBAR_CAP_SIZES;
3607+
3608+ /* Sapphire RX 5600 XT Pulse has an invalid cap dword for BAR 0 */
3609+ if (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x731f &&
3610+ bar == 0 && cap == 0x7000)
3611+ cap = 0x3f000;
3612+
3613+ return cap >> 4;
36073614 }
3615+EXPORT_SYMBOL(pci_rebar_get_possible_sizes);
36083616
36093617 /**
36103618 * pci_rebar_get_current_size - get the current size of a BAR
drivers/pci/pci.h+0−1
@@ -630,7 +630,6 @@ int acpi_get_rc_resources(struct device *dev, const char *hid, u16 segment, · 629 unmodified lines
630630 struct resource *res);
631631 #endif
632632
633−u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar);
634633 int pci_rebar_get_current_size(struct pci_dev *pdev, int bar);
635634 int pci_rebar_set_size(struct pci_dev *pdev, int bar, int size);
636635 static inline u64 pci_rebar_size_to_bytes(int size)
drivers/video/fbdev/omap2/omapfb/displays/Kconfig+1−0
@@ -43,6 +43,7 @@ config FB_OMAP2_PANEL_DPI · 42 unmodified lines
4343 config FB_OMAP2_PANEL_DSI_CM
4444 tristate "Generic DSI Command Mode Panel"
4545 depends on BACKLIGHT_CLASS_DEVICE
46+ depends on DRM_PANEL_DSI_CM = n
4647 help
4748 Driver for generic DSI command mode panels.
4849
include/drm/drm_agpsupport.h+0−18
@@ -28,10 +28,6 @@ struct drm_agp_head { · 27 unmodified lines
2828
2929 #if IS_ENABLED(CONFIG_AGP)
3030
31−void drm_free_agp(struct agp_memory * handle, int pages);
32−int drm_bind_agp(struct agp_memory * handle, unsigned int start);
33−int drm_unbind_agp(struct agp_memory * handle);
34−
3531 struct drm_agp_head *drm_agp_init(struct drm_device *dev);
3632 void drm_legacy_agp_clear(struct drm_device *dev);
3733 int drm_agp_acquire(struct drm_device *dev);
@@ -61,20 +57,6 @@ int drm_agp_bind_ioctl(struct drm_device *dev, void *data, · 23 unmodified lines
6157
6258 #else /* CONFIG_AGP */
6359
64−static inline void drm_free_agp(struct agp_memory * handle, int pages)
65−{
66−}
67−
68−static inline int drm_bind_agp(struct agp_memory * handle, unsigned int start)
69−{
70− return -ENODEV;
71−}
72−
73−static inline int drm_unbind_agp(struct agp_memory * handle)
74−{
75− return -ENODEV;
76−}
77−
7860 static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev)
7961 {
8062 return NULL;
include/drm/drm_crtc.h+1−1
@@ -1232,7 +1232,7 @@ void *__drmm_crtc_alloc_with_planes(struct drm_device *dev, · 1231 unmodified lines
12321232 const char *name, ...);
12331233
12341234 /**
1235− * drm_crtc_alloc_with_planes - Allocate and initialize a new CRTC object with
1235+ * drmm_crtc_alloc_with_planes - Allocate and initialize a new CRTC object with
12361236 * specified primary and cursor planes.
12371237 * @dev: DRM device
12381238 * @type: the type of the struct which contains struct &drm_crtc
include/drm/drm_device.h+5−4
@@ -282,10 +282,6 @@ struct drm_device { · 281 unmodified lines
282282 /** @pdev: PCI device structure */
283283 struct pci_dev *pdev;
284284
285−#ifdef __alpha__
286− /** @hose: PCI hose, only used on ALPHA platforms. */
287− struct pci_controller *hose;
288−#endif
289285 /** @num_crtcs: Number of CRTCs on this device */
290286 unsigned int num_crtcs;
291287
@@ -328,6 +324,11 @@ struct drm_device { · 36 unmodified lines
328324 /* List of devices per driver for stealth attach cleanup */
329325 struct list_head legacy_dev_list;
330326
327+#ifdef __alpha__
328+ /** @hose: PCI hose, only used on ALPHA platforms. */
329+ struct pci_controller *hose;
330+#endif
331+
331332 /* Context handle management - linked list of context handles */
332333 struct list_head ctxlist;
333334
include/drm/drm_mipi_dbi.h+1−1
@@ -172,7 +172,7 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb, · 171 unmodified lines
172172 * mipi_dbi_command - MIPI DCS command with optional parameter(s)
173173 * @dbi: MIPI DBI structure
174174 * @cmd: Command
175− * @seq...: Optional parameter(s)
175+ * @seq: Optional parameter(s)
176176 *
177177 * Send MIPI DCS command to the controller. Use mipi_dbi_command_read() for
178178 * get/read.
include/drm/drm_property.h+1−1
@@ -114,7 +114,7 @@ struct drm_property { · 113 unmodified lines
114114 * by the property. Bitmask properties are created using
115115 * drm_property_create_bitmask().
116116 *
117− * DRM_MODE_PROB_OBJECT
117+ * DRM_MODE_PROP_OBJECT
118118 * Object properties are used to link modeset objects. This is used
119119 * extensively in the atomic support to create the display pipeline,
120120 * by linking &drm_framebuffer to &drm_plane, &drm_plane to
include/drm/ttm/ttm_resource.h+4−0
@@ -190,6 +190,10 @@ struct ttm_resource { · 189 unmodified lines
190190 static inline void
191191 ttm_resource_manager_set_used(struct ttm_resource_manager *man, bool used)
192192 {
193+ int i;
194+
195+ for (i = 0; i < TTM_MAX_BO_PRIORITY; i++)
196+ WARN_ON(!list_empty(&man->lru[i]));
193197 man->use_type = used;
194198 }
195199
include/linux/dma-buf.h+6−0
@@ -154,6 +154,12 @@ struct dma_buf_ops { · 153 unmodified lines
154154 * On failure, returns a negative error value wrapped into a pointer.
155155 * May also return -EINTR when a signal was received while being
156156 * blocked.
157+ *
158+ * Note that exporters should not try to cache the scatter list, or
159+ * return the same one for multiple calls. Caching is done either by the
160+ * DMA-BUF code (for non-dynamic importers) or the importer. Ownership
161+ * of the scatter list is transferred to the caller, and returned by
162+ * @unmap_dma_buf.
157163 */
158164 struct sg_table * (*map_dma_buf)(struct dma_buf_attachment *,
159165 enum dma_data_direction);
include/linux/pci.h+9−0
@@ -1232,6 +1232,15 @@ void pci_update_resource(struct pci_dev *dev, int resno); · 1231 unmodified lines
12321232 int __must_check pci_assign_resource(struct pci_dev *dev, int i);
12331233 int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align);
12341234 void pci_release_resource(struct pci_dev *dev, int resno);
1235+static inline int pci_rebar_bytes_to_size(u64 bytes)
1236+{
1237+ bytes = roundup_pow_of_two(bytes);
1238+
1239+ /* Return BAR size as defined in the resizable BAR specification */
1240+ return max(ilog2(bytes), 20) - 20;
1241+}
1242+
1243+u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar);
12351244 int __must_check pci_resize_resource(struct pci_dev *dev, int i, int size);
12361245 int pci_select_bars(struct pci_dev *dev, unsigned long flags);
12371246 bool pci_device_is_present(struct pci_dev *pdev);
include/linux/vgaarb.h+3−3
@@ -121,9 +121,9 @@ extern struct pci_dev *vga_default_device(void); · 120 unmodified lines
121121 extern void vga_set_default_device(struct pci_dev *pdev);
122122 extern int vga_remove_vgacon(struct pci_dev *pdev);
123123 #else
124−static inline struct pci_dev *vga_default_device(void) { return NULL; };
125−static inline void vga_set_default_device(struct pci_dev *pdev) { };
126−static inline int vga_remove_vgacon(struct pci_dev *pdev) { return 0; };
124+static inline struct pci_dev *vga_default_device(void) { return NULL; }
125+static inline void vga_set_default_device(struct pci_dev *pdev) { }
126+static inline int vga_remove_vgacon(struct pci_dev *pdev) { return 0; }
127127 #endif
128128
129129 /*
include/uapi/drm/drm_fourcc.h+2−2
@@ -1036,9 +1036,9 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier) · 1035 unmodified lines
10361036 * Not all combinations are valid, and different SoCs may support different
10371037 * combinations of layout and options.
10381038 */
1039−#define __fourcc_mod_amlogic_layout_mask 0xf
1039+#define __fourcc_mod_amlogic_layout_mask 0xff
10401040 #define __fourcc_mod_amlogic_options_shift 8
1041−#define __fourcc_mod_amlogic_options_mask 0xf
1041+#define __fourcc_mod_amlogic_options_mask 0xff
10421042
10431043 #define DRM_FORMAT_MOD_AMLOGIC_FBC(__layout, __options) \
10441044 fourcc_mod_code(AMLOGIC, \