aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2017-05-28 16:04:39 -0400
committerDave Airlie <airlied@redhat.com>2017-05-28 16:04:39 -0400
commit1afc45445d15493f3aaadbe2b549b37eaffcc407 (patch)
tree471cdf0619cc75a44a992c0916beb498b3c894d9 /drivers/gpu/drm
parente98c58e55f68f8785aebfab1f8c9a03d8de0afe1 (diff)
parent71ebc9a3795818eab52e81bbcbdfae130ee35d9e (diff)
Merge tag 'drm-misc-next-2017-05-26' of git://anongit.freedesktop.org/git/drm-misc into drm-next
UAPI Changes: - Add DRM_MODE_ROTATE_ and DRM_MODE_REFLECT_ defines to the UAPI (Robert) Cross-subsystem Changes: - Standardize sync_file.txt documentation format (Mauro) Core Changes: - Turf drm_[cm]alloc functions for kvmalloc alternatives (Michal) - Add optional mode_valid() hook to crtc/encoder/bridge (Jose) - Improve documentation around mode validation/alteration (Daniel) - Reduce sync_file construction time by deferring name creation (Chris) Driver Changes: - pl111: Wire up the clock divider and add debugfs (Eric) - various: Fix include notation and remove -Iinclude/drm (Masahiro) - stm: Add Benjamin Gaignard and Vincent Abriou as STM maintainers (Vincent) - various: Miscellaneous trivial fixes to pl111/stm/vgem/vc4 Cc: Michal Hocko <mhocko@suse.com> Cc: Eric Anholt <eric@anholt.net> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Robert Foss <robert.foss@collabora.com> Cc: Vincent Abriou <vincent.abriou@st.com> Cc: Jose Abreu <Jose.Abreu@synopsys.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com> * tag 'drm-misc-next-2017-05-26' of git://anongit.freedesktop.org/git/drm-misc: (55 commits) dma-buf/sync-file: Defer creation of sync_file->name sync_file.txt: standardize document format gpu: drm: gma500: remove two more dead variable drm/doc: Clarify mode_fixup vs. atomic_check a bit more drm/doc: Document adjusted/request modes a bit better drm: Add crtc/encoder/bridge->mode_valid() callbacks MAINTAINERS: update drm/stm maintainers list drm/stm: ltdc: fix duplicated arguments drm/pl111: Fix return value check in pl111_amba_probe() drm/amd: include <linux/delay.h> instead of "linux/delay.h" drm: Add DRM_MODE_ROTATE_ and DRM_MODE_REFLECT_ to UAPI drm/vgem: Fix return value check in vgem_init() drm/blend: Fix comment typ-o drm/stm: remove unneeded -Iinclude/drm compiler flag drm/vc4: fix include notation and remove -Iinclude/drm flag drm/pl111: Add a debugfs node to dump our registers. drm/pl111: make structure mode_config_funcs static drm/pl111: make structure pl111_display_funcs static drm/pl111: Register the clock divider and use it. drm: drop drm_[cm]alloc* helpers ...
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/Makefile2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h10
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c16
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c19
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c10
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c7
-rw-r--r--drivers/gpu/drm/amd/amdgpu/ci_dpm.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/ci_smc.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/cik.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/cik_ih.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/cz_ih.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v10_0.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v11_0.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v6_0.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v8_0.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_virtual.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/iceland_ih.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/kv_dpm.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/kv_smc.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/psp_v3_1.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/si.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/si_dpm.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/si_ih.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/si_smc.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/soc15.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/tonga_ih.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/vega10_ih.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/vi.c2
-rw-r--r--drivers/gpu/drm/amd/amdkfd/Makefile2
-rw-r--r--drivers/gpu/drm/amd/powerplay/Makefile2
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c4
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c2
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c4
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c5
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c8
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c5
-rw-r--r--drivers/gpu/drm/arm/malidp_drv.h2
-rw-r--r--drivers/gpu/drm/arm/malidp_planes.c18
-rw-r--r--drivers/gpu/drm/armada/armada_overlay.c2
-rw-r--r--drivers/gpu/drm/ast/Makefile2
-rw-r--r--drivers/gpu/drm/ast/ast_ttm.c3
-rw-r--r--drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c20
-rw-r--r--drivers/gpu/drm/bochs/Makefile1
-rw-r--r--drivers/gpu/drm/bochs/bochs.h4
-rw-r--r--drivers/gpu/drm/bridge/Makefile2
-rw-r--r--drivers/gpu/drm/bridge/nxp-ptn3460.c12
-rw-r--r--drivers/gpu/drm/bridge/parade-ps8622.c10
-rw-r--r--drivers/gpu/drm/cirrus/Makefile1
-rw-r--r--drivers/gpu/drm/cirrus/cirrus_ttm.c3
-rw-r--r--drivers/gpu/drm/drm_atomic.c2
-rw-r--r--drivers/gpu/drm/drm_atomic_helper.c2
-rw-r--r--drivers/gpu/drm/drm_blend.c45
-rw-r--r--drivers/gpu/drm/drm_fb_helper.c4
-rw-r--r--drivers/gpu/drm/drm_gem.c6
-rw-r--r--drivers/gpu/drm/drm_plane_helper.c2
-rw-r--r--drivers/gpu/drm/drm_rect.c36
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_gem.c12
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c4
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c12
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_gem.c11
-rw-r--r--drivers/gpu/drm/gma500/Makefile1
-rw-r--r--drivers/gpu/drm/gma500/mdfld_tpo_vid.c2
-rw-r--r--drivers/gpu/drm/hisilicon/hibmc/Makefile1
-rw-r--r--drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c2
-rw-r--r--drivers/gpu/drm/i2c/Makefile2
-rw-r--r--drivers/gpu/drm/i810/Makefile1
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c18
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c4
-rw-r--r--drivers/gpu/drm/i915/i915_gem_execbuffer.c34
-rw-r--r--drivers/gpu/drm/i915/i915_gem_gtt.c6
-rw-r--r--drivers/gpu/drm/i915/i915_gem_userptr.c8
-rw-r--r--drivers/gpu/drm/i915/intel_atomic_plane.c6
-rw-r--r--drivers/gpu/drm/i915/intel_display.c50
-rw-r--r--drivers/gpu/drm/i915/intel_fbc.c2
-rw-r--r--drivers/gpu/drm/i915/intel_fbdev.c2
-rw-r--r--drivers/gpu/drm/i915/intel_sprite.c20
-rw-r--r--drivers/gpu/drm/i915/selftests/intel_breadcrumbs.c12
-rw-r--r--drivers/gpu/drm/imx/ipuv3-plane.c2
-rw-r--r--drivers/gpu/drm/mga/Makefile1
-rw-r--r--drivers/gpu/drm/mgag200/Makefile1
-rw-r--r--drivers/gpu/drm/mgag200/mgag200_ttm.c3
-rw-r--r--drivers/gpu/drm/msm/Makefile2
-rw-r--r--drivers/gpu/drm/msm/dsi/dsi.h6
-rw-r--r--drivers/gpu/drm/msm/edp/edp.h4
-rw-r--r--drivers/gpu/drm/msm/edp/edp_ctrl.c6
-rw-r--r--drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c10
-rw-r--r--drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c6
-rw-r--r--drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c7
-rw-r--r--drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h4
-rw-r--r--drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c6
-rw-r--r--drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c6
-rw-r--r--drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c10
-rw-r--r--drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c6
-rw-r--r--drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c30
-rw-r--r--drivers/gpu/drm/msm/msm_fb.c6
-rw-r--r--drivers/gpu/drm/msm/msm_fbdev.c6
-rw-r--r--drivers/gpu/drm/msm/msm_gem.c10
-rw-r--r--drivers/gpu/drm/nouveau/Kbuild1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.c4
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.h2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_ttm.c2
-rw-r--r--drivers/gpu/drm/nouveau/nv50_display.c2
-rw-r--r--drivers/gpu/drm/omapdrm/Makefile1
-rw-r--r--drivers/gpu/drm/omapdrm/omap_drv.c4
-rw-r--r--drivers/gpu/drm/omapdrm/omap_fb.c18
-rw-r--r--drivers/gpu/drm/omapdrm/omap_plane.c16
-rw-r--r--drivers/gpu/drm/pl111/Kconfig1
-rw-r--r--drivers/gpu/drm/pl111/Makefile2
-rw-r--r--drivers/gpu/drm/pl111/pl111_debugfs.c55
-rw-r--r--drivers/gpu/drm/pl111/pl111_display.c164
-rw-r--r--drivers/gpu/drm/pl111/pl111_drm.h11
-rw-r--r--drivers/gpu/drm/pl111/pl111_drv.c21
-rw-r--r--drivers/gpu/drm/qxl/Makefile2
-rw-r--r--drivers/gpu/drm/qxl/qxl_debugfs.c2
-rw-r--r--drivers/gpu/drm/qxl/qxl_display.c9
-rw-r--r--drivers/gpu/drm/qxl/qxl_drv.c6
-rw-r--r--drivers/gpu/drm/qxl/qxl_drv.h18
-rw-r--r--drivers/gpu/drm/qxl/qxl_fb.c11
-rw-r--r--drivers/gpu/drm/qxl/qxl_gem.c5
-rw-r--r--drivers/gpu/drm/qxl/qxl_ttm.c10
-rw-r--r--drivers/gpu/drm/r128/Makefile1
-rw-r--r--drivers/gpu/drm/radeon/Makefile2
-rw-r--r--drivers/gpu/drm/radeon/btc_dpm.c2
-rw-r--r--drivers/gpu/drm/radeon/ci_dpm.c2
-rw-r--r--drivers/gpu/drm/radeon/ci_smc.c2
-rw-r--r--drivers/gpu/drm/radeon/cik.c2
-rw-r--r--drivers/gpu/drm/radeon/cypress_dpm.c2
-rw-r--r--drivers/gpu/drm/radeon/kv_dpm.c2
-rw-r--r--drivers/gpu/drm/radeon/kv_smc.c2
-rw-r--r--drivers/gpu/drm/radeon/ni_dpm.c2
-rw-r--r--drivers/gpu/drm/radeon/r600_dpm.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon.h10
-rw-r--r--drivers/gpu/drm/radeon/radeon_cs.c11
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_gem.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_ring.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_ttm.c10
-rw-r--r--drivers/gpu/drm/radeon/radeon_vm.c4
-rw-r--r--drivers/gpu/drm/radeon/rs780_dpm.c2
-rw-r--r--drivers/gpu/drm/radeon/rv6xx_dpm.c2
-rw-r--r--drivers/gpu/drm/radeon/rv730_dpm.c2
-rw-r--r--drivers/gpu/drm/radeon/rv740_dpm.c2
-rw-r--r--drivers/gpu/drm/radeon/rv770_dpm.c2
-rw-r--r--drivers/gpu/drm/radeon/rv770_smc.c2
-rw-r--r--drivers/gpu/drm/radeon/si_dpm.c2
-rw-r--r--drivers/gpu/drm/radeon/si_smc.c2
-rw-r--r--drivers/gpu/drm/radeon/sumo_dpm.c2
-rw-r--r--drivers/gpu/drm/radeon/sumo_smc.c2
-rw-r--r--drivers/gpu/drm/radeon/trinity_dpm.c2
-rw-r--r--drivers/gpu/drm/radeon/trinity_smc.c2
-rw-r--r--drivers/gpu/drm/savage/Makefile1
-rw-r--r--drivers/gpu/drm/sis/Makefile1
-rw-r--r--drivers/gpu/drm/sti/sti_compositor.c2
-rw-r--r--drivers/gpu/drm/stm/Makefile2
-rw-r--r--drivers/gpu/drm/stm/ltdc.c2
-rw-r--r--drivers/gpu/drm/tdfx/Makefile1
-rw-r--r--drivers/gpu/drm/tilcdc/Makefile1
-rw-r--r--drivers/gpu/drm/tilcdc/tilcdc_drv.c3
-rw-r--r--drivers/gpu/drm/ttm/Makefile1
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo_vm.c6
-rw-r--r--drivers/gpu/drm/ttm/ttm_tt.c13
-rw-r--r--drivers/gpu/drm/udl/Makefile3
-rw-r--r--drivers/gpu/drm/udl/udl_dmabuf.c2
-rw-r--r--drivers/gpu/drm/udl/udl_gem.c2
-rw-r--r--drivers/gpu/drm/vc4/Kconfig2
-rw-r--r--drivers/gpu/drm/vc4/Makefile2
-rw-r--r--drivers/gpu/drm/vc4/vc4_crtc.c14
-rw-r--r--drivers/gpu/drm/vc4/vc4_dpi.c16
-rw-r--r--drivers/gpu/drm/vc4/vc4_drv.c2
-rw-r--r--drivers/gpu/drm/vc4/vc4_drv.h6
-rw-r--r--drivers/gpu/drm/vc4/vc4_dsi.c140
-rw-r--r--drivers/gpu/drm/vc4/vc4_gem.c15
-rw-r--r--drivers/gpu/drm/vc4/vc4_hdmi.c30
-rw-r--r--drivers/gpu/drm/vc4/vc4_hvs.c2
-rw-r--r--drivers/gpu/drm/vc4/vc4_kms.c12
-rw-r--r--drivers/gpu/drm/vc4/vc4_plane.c9
-rw-r--r--drivers/gpu/drm/vc4/vc4_v3d.c6
-rw-r--r--drivers/gpu/drm/vc4/vc4_validate.c3
-rw-r--r--drivers/gpu/drm/vgem/Makefile1
-rw-r--r--drivers/gpu/drm/vgem/vgem_drv.c8
-rw-r--r--drivers/gpu/drm/via/Makefile1
-rw-r--r--drivers/gpu/drm/virtio/Makefile2
-rw-r--r--drivers/gpu/drm/virtio/virtgpu_debugfs.c2
-rw-r--r--drivers/gpu/drm/virtio/virtgpu_drv.c4
-rw-r--r--drivers/gpu/drm/virtio/virtgpu_drv.h8
-rw-r--r--drivers/gpu/drm/virtio/virtgpu_ioctl.c32
-rw-r--r--drivers/gpu/drm/virtio/virtgpu_ttm.c10
-rw-r--r--drivers/gpu/drm/vmwgfx/Makefile3
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c3
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_context.c3
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c3
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_kms.c4
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_msg.c2
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_shader.c3
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_surface.c3
204 files changed, 879 insertions, 644 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile b/drivers/gpu/drm/amd/amdgpu/Makefile
index 660786aba7d2..20bde726419e 100644
--- a/drivers/gpu/drm/amd/amdgpu/Makefile
+++ b/drivers/gpu/drm/amd/amdgpu/Makefile
@@ -4,7 +4,7 @@
4 4
5FULL_AMD_PATH=$(src)/.. 5FULL_AMD_PATH=$(src)/..
6 6
7ccflags-y := -Iinclude/drm -I$(FULL_AMD_PATH)/include/asic_reg \ 7ccflags-y := -I$(FULL_AMD_PATH)/include/asic_reg \
8 -I$(FULL_AMD_PATH)/include \ 8 -I$(FULL_AMD_PATH)/include \
9 -I$(FULL_AMD_PATH)/amdgpu \ 9 -I$(FULL_AMD_PATH)/amdgpu \
10 -I$(FULL_AMD_PATH)/scheduler \ 10 -I$(FULL_AMD_PATH)/scheduler \
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 67cdab9241a4..77ff68f9932b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -36,11 +36,11 @@
36#include <linux/hashtable.h> 36#include <linux/hashtable.h>
37#include <linux/dma-fence.h> 37#include <linux/dma-fence.h>
38 38
39#include <ttm/ttm_bo_api.h> 39#include <drm/ttm/ttm_bo_api.h>
40#include <ttm/ttm_bo_driver.h> 40#include <drm/ttm/ttm_bo_driver.h>
41#include <ttm/ttm_placement.h> 41#include <drm/ttm/ttm_placement.h>
42#include <ttm/ttm_module.h> 42#include <drm/ttm/ttm_module.h>
43#include <ttm/ttm_execbuf_util.h> 43#include <drm/ttm/ttm_execbuf_util.h>
44 44
45#include <drm/drmP.h> 45#include <drm/drmP.h>
46#include <drm/drm_gem.h> 46#include <drm/drm_gem.h>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
index a6649874e6ce..9f0247cdda5e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
@@ -96,7 +96,7 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev,
96 int r; 96 int r;
97 unsigned long total_size = 0; 97 unsigned long total_size = 0;
98 98
99 array = drm_malloc_ab(num_entries, sizeof(struct amdgpu_bo_list_entry)); 99 array = kvmalloc_array(num_entries, sizeof(struct amdgpu_bo_list_entry), GFP_KERNEL);
100 if (!array) 100 if (!array)
101 return -ENOMEM; 101 return -ENOMEM;
102 memset(array, 0, num_entries * sizeof(struct amdgpu_bo_list_entry)); 102 memset(array, 0, num_entries * sizeof(struct amdgpu_bo_list_entry));
@@ -148,7 +148,7 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev,
148 for (i = 0; i < list->num_entries; ++i) 148 for (i = 0; i < list->num_entries; ++i)
149 amdgpu_bo_unref(&list->array[i].robj); 149 amdgpu_bo_unref(&list->array[i].robj);
150 150
151 drm_free_large(list->array); 151 kvfree(list->array);
152 152
153 list->gds_obj = gds_obj; 153 list->gds_obj = gds_obj;
154 list->gws_obj = gws_obj; 154 list->gws_obj = gws_obj;
@@ -163,7 +163,7 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev,
163error_free: 163error_free:
164 while (i--) 164 while (i--)
165 amdgpu_bo_unref(&array[i].robj); 165 amdgpu_bo_unref(&array[i].robj);
166 drm_free_large(array); 166 kvfree(array);
167 return r; 167 return r;
168} 168}
169 169
@@ -224,7 +224,7 @@ void amdgpu_bo_list_free(struct amdgpu_bo_list *list)
224 amdgpu_bo_unref(&list->array[i].robj); 224 amdgpu_bo_unref(&list->array[i].robj);
225 225
226 mutex_destroy(&list->lock); 226 mutex_destroy(&list->lock);
227 drm_free_large(list->array); 227 kvfree(list->array);
228 kfree(list); 228 kfree(list);
229} 229}
230 230
@@ -244,8 +244,8 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data,
244 244
245 int r; 245 int r;
246 246
247 info = drm_malloc_ab(args->in.bo_number, 247 info = kvmalloc_array(args->in.bo_number,
248 sizeof(struct drm_amdgpu_bo_list_entry)); 248 sizeof(struct drm_amdgpu_bo_list_entry), GFP_KERNEL);
249 if (!info) 249 if (!info)
250 return -ENOMEM; 250 return -ENOMEM;
251 251
@@ -311,11 +311,11 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data,
311 311
312 memset(args, 0, sizeof(*args)); 312 memset(args, 0, sizeof(*args));
313 args->out.list_handle = handle; 313 args->out.list_handle = handle;
314 drm_free_large(info); 314 kvfree(info);
315 315
316 return 0; 316 return 0;
317 317
318error_free: 318error_free:
319 drm_free_large(info); 319 kvfree(info);
320 return r; 320 return r;
321} 321}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 4e6b9501ab0a..5b3e0f63a115 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -194,7 +194,7 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)
194 size = p->chunks[i].length_dw; 194 size = p->chunks[i].length_dw;
195 cdata = (void __user *)(uintptr_t)user_chunk.chunk_data; 195 cdata = (void __user *)(uintptr_t)user_chunk.chunk_data;
196 196
197 p->chunks[i].kdata = drm_malloc_ab(size, sizeof(uint32_t)); 197 p->chunks[i].kdata = kvmalloc_array(size, sizeof(uint32_t), GFP_KERNEL);
198 if (p->chunks[i].kdata == NULL) { 198 if (p->chunks[i].kdata == NULL) {
199 ret = -ENOMEM; 199 ret = -ENOMEM;
200 i--; 200 i--;
@@ -247,7 +247,7 @@ free_all_kdata:
247 i = p->nchunks - 1; 247 i = p->nchunks - 1;
248free_partial_kdata: 248free_partial_kdata:
249 for (; i >= 0; i--) 249 for (; i >= 0; i--)
250 drm_free_large(p->chunks[i].kdata); 250 kvfree(p->chunks[i].kdata);
251 kfree(p->chunks); 251 kfree(p->chunks);
252 p->chunks = NULL; 252 p->chunks = NULL;
253 p->nchunks = 0; 253 p->nchunks = 0;
@@ -505,7 +505,7 @@ static int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p,
505 return r; 505 return r;
506 506
507 if (binding_userptr) { 507 if (binding_userptr) {
508 drm_free_large(lobj->user_pages); 508 kvfree(lobj->user_pages);
509 lobj->user_pages = NULL; 509 lobj->user_pages = NULL;
510 } 510 }
511 } 511 }
@@ -571,7 +571,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
571 release_pages(e->user_pages, 571 release_pages(e->user_pages,
572 e->robj->tbo.ttm->num_pages, 572 e->robj->tbo.ttm->num_pages,
573 false); 573 false);
574 drm_free_large(e->user_pages); 574 kvfree(e->user_pages);
575 e->user_pages = NULL; 575 e->user_pages = NULL;
576 } 576 }
577 577
@@ -601,8 +601,9 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
601 list_for_each_entry(e, &need_pages, tv.head) { 601 list_for_each_entry(e, &need_pages, tv.head) {
602 struct ttm_tt *ttm = e->robj->tbo.ttm; 602 struct ttm_tt *ttm = e->robj->tbo.ttm;
603 603
604 e->user_pages = drm_calloc_large(ttm->num_pages, 604 e->user_pages = kvmalloc_array(ttm->num_pages,
605 sizeof(struct page*)); 605 sizeof(struct page*),
606 GFP_KERNEL | __GFP_ZERO);
606 if (!e->user_pages) { 607 if (!e->user_pages) {
607 r = -ENOMEM; 608 r = -ENOMEM;
608 DRM_ERROR("calloc failure in %s\n", __func__); 609 DRM_ERROR("calloc failure in %s\n", __func__);
@@ -612,7 +613,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
612 r = amdgpu_ttm_tt_get_user_pages(ttm, e->user_pages); 613 r = amdgpu_ttm_tt_get_user_pages(ttm, e->user_pages);
613 if (r) { 614 if (r) {
614 DRM_ERROR("amdgpu_ttm_tt_get_user_pages failed.\n"); 615 DRM_ERROR("amdgpu_ttm_tt_get_user_pages failed.\n");
615 drm_free_large(e->user_pages); 616 kvfree(e->user_pages);
616 e->user_pages = NULL; 617 e->user_pages = NULL;
617 goto error_free_pages; 618 goto error_free_pages;
618 } 619 }
@@ -708,7 +709,7 @@ error_free_pages:
708 release_pages(e->user_pages, 709 release_pages(e->user_pages,
709 e->robj->tbo.ttm->num_pages, 710 e->robj->tbo.ttm->num_pages,
710 false); 711 false);
711 drm_free_large(e->user_pages); 712 kvfree(e->user_pages);
712 } 713 }
713 } 714 }
714 715
@@ -761,7 +762,7 @@ static void amdgpu_cs_parser_fini(struct amdgpu_cs_parser *parser, int error, bo
761 amdgpu_bo_list_put(parser->bo_list); 762 amdgpu_bo_list_put(parser->bo_list);
762 763
763 for (i = 0; i < parser->nchunks; i++) 764 for (i = 0; i < parser->nchunks; i++)
764 drm_free_large(parser->chunks[i].kdata); 765 kvfree(parser->chunks[i].kdata);
765 kfree(parser->chunks); 766 kfree(parser->chunks);
766 if (parser->job) 767 if (parser->job)
767 amdgpu_job_free(parser->job); 768 amdgpu_job_free(parser->job);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
index 38e9b0d3659a..1cb52fd19060 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
@@ -22,7 +22,7 @@
22 * Authors: Alex Deucher 22 * Authors: Alex Deucher
23 */ 23 */
24 24
25#include "drmP.h" 25#include <drm/drmP.h>
26#include "amdgpu.h" 26#include "amdgpu.h"
27#include "amdgpu_atombios.h" 27#include "amdgpu_atombios.h"
28#include "amdgpu_i2c.h" 28#include "amdgpu_i2c.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 5cb8f3e68447..31eddd85eb40 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -39,7 +39,7 @@
39#include <linux/module.h> 39#include <linux/module.h>
40#include <linux/pm_runtime.h> 40#include <linux/pm_runtime.h>
41#include <linux/vga_switcheroo.h> 41#include <linux/vga_switcheroo.h>
42#include "drm_crtc_helper.h" 42#include <drm/drm_crtc_helper.h>
43 43
44#include "amdgpu.h" 44#include "amdgpu.h"
45#include "amdgpu_irq.h" 45#include "amdgpu_irq.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index ac5e92e5d59d..596e3957bdd9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -24,7 +24,7 @@
24 */ 24 */
25 25
26#include <linux/firmware.h> 26#include <linux/firmware.h>
27#include "drmP.h" 27#include <drm/drmP.h>
28#include "amdgpu.h" 28#include "amdgpu.h"
29#include "amdgpu_psp.h" 29#include "amdgpu_psp.h"
30#include "amdgpu_ucode.h" 30#include "amdgpu_ucode.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 5db0230e45c6..b5fa003c1341 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -29,11 +29,11 @@
29 * Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> 29 * Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
30 * Dave Airlie 30 * Dave Airlie
31 */ 31 */
32#include <ttm/ttm_bo_api.h> 32#include <drm/ttm/ttm_bo_api.h>
33#include <ttm/ttm_bo_driver.h> 33#include <drm/ttm/ttm_bo_driver.h>
34#include <ttm/ttm_placement.h> 34#include <drm/ttm/ttm_placement.h>
35#include <ttm/ttm_module.h> 35#include <drm/ttm/ttm_module.h>
36#include <ttm/ttm_page_alloc.h> 36#include <drm/ttm/ttm_page_alloc.h>
37#include <drm/drmP.h> 37#include <drm/drmP.h>
38#include <drm/amdgpu_drm.h> 38#include <drm/amdgpu_drm.h>
39#include <linux/seq_file.h> 39#include <linux/seq_file.h>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 07ff3b1514f1..749a6cde7985 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -279,8 +279,9 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev,
279 if (!parent->entries) { 279 if (!parent->entries) {
280 unsigned num_entries = amdgpu_vm_num_entries(adev, level); 280 unsigned num_entries = amdgpu_vm_num_entries(adev, level);
281 281
282 parent->entries = drm_calloc_large(num_entries, 282 parent->entries = kvmalloc_array(num_entries,
283 sizeof(struct amdgpu_vm_pt)); 283 sizeof(struct amdgpu_vm_pt),
284 GFP_KERNEL | __GFP_ZERO);
284 if (!parent->entries) 285 if (!parent->entries)
285 return -ENOMEM; 286 return -ENOMEM;
286 memset(parent->entries, 0 , sizeof(struct amdgpu_vm_pt)); 287 memset(parent->entries, 0 , sizeof(struct amdgpu_vm_pt));
@@ -2198,7 +2199,7 @@ static void amdgpu_vm_free_levels(struct amdgpu_vm_pt *level)
2198 for (i = 0; i <= level->last_entry_used; i++) 2199 for (i = 0; i <= level->last_entry_used; i++)
2199 amdgpu_vm_free_levels(&level->entries[i]); 2200 amdgpu_vm_free_levels(&level->entries[i]);
2200 2201
2201 drm_free_large(level->entries); 2202 kvfree(level->entries);
2202} 2203}
2203 2204
2204/** 2205/**
diff --git a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
index 6dc1410b380f..00e56a28b593 100644
--- a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
@@ -22,7 +22,7 @@
22 */ 22 */
23 23
24#include <linux/firmware.h> 24#include <linux/firmware.h>
25#include "drmP.h" 25#include <drm/drmP.h>
26#include "amdgpu.h" 26#include "amdgpu.h"
27#include "amdgpu_pm.h" 27#include "amdgpu_pm.h"
28#include "amdgpu_ucode.h" 28#include "amdgpu_ucode.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/ci_smc.c b/drivers/gpu/drm/amd/amdgpu/ci_smc.c
index 7eb9069db8e3..b8ba51e045b5 100644
--- a/drivers/gpu/drm/amd/amdgpu/ci_smc.c
+++ b/drivers/gpu/drm/amd/amdgpu/ci_smc.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include <linux/firmware.h> 25#include <linux/firmware.h>
26#include "drmP.h" 26#include <drm/drmP.h>
27#include "amdgpu.h" 27#include "amdgpu.h"
28#include "cikd.h" 28#include "cikd.h"
29#include "ppsmc.h" 29#include "ppsmc.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/cik.c b/drivers/gpu/drm/amd/amdgpu/cik.c
index 9d33e5641419..6b2034533f68 100644
--- a/drivers/gpu/drm/amd/amdgpu/cik.c
+++ b/drivers/gpu/drm/amd/amdgpu/cik.c
@@ -24,7 +24,7 @@
24#include <linux/firmware.h> 24#include <linux/firmware.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include "drmP.h" 27#include <drm/drmP.h>
28#include "amdgpu.h" 28#include "amdgpu.h"
29#include "amdgpu_atombios.h" 29#include "amdgpu_atombios.h"
30#include "amdgpu_ih.h" 30#include "amdgpu_ih.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/cik_ih.c b/drivers/gpu/drm/amd/amdgpu/cik_ih.c
index c57c3f18af01..b8918432c572 100644
--- a/drivers/gpu/drm/amd/amdgpu/cik_ih.c
+++ b/drivers/gpu/drm/amd/amdgpu/cik_ih.c
@@ -20,7 +20,7 @@
20 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
21 * 21 *
22 */ 22 */
23#include "drmP.h" 23#include <drm/drmP.h>
24#include "amdgpu.h" 24#include "amdgpu.h"
25#include "amdgpu_ih.h" 25#include "amdgpu_ih.h"
26#include "cikd.h" 26#include "cikd.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/cz_ih.c b/drivers/gpu/drm/amd/amdgpu/cz_ih.c
index a5f294ebff5c..0c1209cdd1cb 100644
--- a/drivers/gpu/drm/amd/amdgpu/cz_ih.c
+++ b/drivers/gpu/drm/amd/amdgpu/cz_ih.c
@@ -20,7 +20,7 @@
20 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
21 * 21 *
22 */ 22 */
23#include "drmP.h" 23#include <drm/drmP.h>
24#include "amdgpu.h" 24#include "amdgpu.h"
25#include "amdgpu_ih.h" 25#include "amdgpu_ih.h"
26#include "vid.h" 26#include "vid.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index 0cdeb6a2e4a0..3c62c45f43a1 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -20,7 +20,7 @@
20 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
21 * 21 *
22 */ 22 */
23#include "drmP.h" 23#include <drm/drmP.h>
24#include "amdgpu.h" 24#include "amdgpu.h"
25#include "amdgpu_pm.h" 25#include "amdgpu_pm.h"
26#include "amdgpu_i2c.h" 26#include "amdgpu_i2c.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 773654a19749..c8ed0facddcd 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -20,7 +20,7 @@
20 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
21 * 21 *
22 */ 22 */
23#include "drmP.h" 23#include <drm/drmP.h>
24#include "amdgpu.h" 24#include "amdgpu.h"
25#include "amdgpu_pm.h" 25#include "amdgpu_pm.h"
26#include "amdgpu_i2c.h" 26#include "amdgpu_i2c.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index 1f3552967ba3..3f3a25493327 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -20,7 +20,7 @@
20 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
21 * 21 *
22 */ 22 */
23#include "drmP.h" 23#include <drm/drmP.h>
24#include "amdgpu.h" 24#include "amdgpu.h"
25#include "amdgpu_pm.h" 25#include "amdgpu_pm.h"
26#include "amdgpu_i2c.h" 26#include "amdgpu_i2c.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index 3c558c170e5e..3e90c19b9c7f 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -20,7 +20,7 @@
20 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
21 * 21 *
22 */ 22 */
23#include "drmP.h" 23#include <drm/drmP.h>
24#include "amdgpu.h" 24#include "amdgpu.h"
25#include "amdgpu_pm.h" 25#include "amdgpu_pm.h"
26#include "amdgpu_i2c.h" 26#include "amdgpu_i2c.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
index f1b479b6ac98..90bb08309a53 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
@@ -20,7 +20,7 @@
20 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
21 * 21 *
22 */ 22 */
23#include "drmP.h" 23#include <drm/drmP.h>
24#include "amdgpu.h" 24#include "amdgpu.h"
25#include "amdgpu_pm.h" 25#include "amdgpu_pm.h"
26#include "amdgpu_i2c.h" 26#include "amdgpu_i2c.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index ee2f2139e2eb..f7414cabd4ff 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
@@ -21,7 +21,7 @@
21 * 21 *
22 */ 22 */
23#include <linux/firmware.h> 23#include <linux/firmware.h>
24#include "drmP.h" 24#include <drm/drmP.h>
25#include "amdgpu.h" 25#include "amdgpu.h"
26#include "amdgpu_ih.h" 26#include "amdgpu_ih.h"
27#include "amdgpu_gfx.h" 27#include "amdgpu_gfx.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 758d636a6f52..404d12785853 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -21,7 +21,7 @@
21 * 21 *
22 */ 22 */
23#include <linux/firmware.h> 23#include <linux/firmware.h>
24#include "drmP.h" 24#include <drm/drmP.h>
25#include "amdgpu.h" 25#include "amdgpu.h"
26#include "amdgpu_gfx.h" 26#include "amdgpu_gfx.h"
27#include "vi.h" 27#include "vi.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index 0c16b7563b73..125b11950071 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -21,7 +21,7 @@
21 * 21 *
22 */ 22 */
23#include <linux/firmware.h> 23#include <linux/firmware.h>
24#include "drmP.h" 24#include <drm/drmP.h>
25#include "amdgpu.h" 25#include "amdgpu.h"
26#include "amdgpu_gfx.h" 26#include "amdgpu_gfx.h"
27#include "soc15.h" 27#include "soc15.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
index a572979f186c..2a3983036a30 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
@@ -21,7 +21,7 @@
21 * 21 *
22 */ 22 */
23#include <linux/firmware.h> 23#include <linux/firmware.h>
24#include "drmP.h" 24#include <drm/drmP.h>
25#include "amdgpu.h" 25#include "amdgpu.h"
26#include "gmc_v6_0.h" 26#include "gmc_v6_0.h"
27#include "amdgpu_ucode.h" 27#include "amdgpu_ucode.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
index a9083a16a250..6d347c1d2516 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
@@ -21,7 +21,7 @@
21 * 21 *
22 */ 22 */
23#include <linux/firmware.h> 23#include <linux/firmware.h>
24#include "drmP.h" 24#include <drm/drmP.h>
25#include "amdgpu.h" 25#include "amdgpu.h"
26#include "cikd.h" 26#include "cikd.h"
27#include "cik.h" 27#include "cik.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
index 4ac99784160a..2784ff49cf56 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
@@ -21,7 +21,7 @@
21 * 21 *
22 */ 22 */
23#include <linux/firmware.h> 23#include <linux/firmware.h>
24#include "drmP.h" 24#include <drm/drmP.h>
25#include "amdgpu.h" 25#include "amdgpu.h"
26#include "gmc_v8_0.h" 26#include "gmc_v8_0.h"
27#include "amdgpu_ucode.h" 27#include "amdgpu_ucode.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/iceland_ih.c b/drivers/gpu/drm/amd/amdgpu/iceland_ih.c
index cb622add99a7..7a0ea27ac429 100644
--- a/drivers/gpu/drm/amd/amdgpu/iceland_ih.c
+++ b/drivers/gpu/drm/amd/amdgpu/iceland_ih.c
@@ -20,7 +20,7 @@
20 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
21 * 21 *
22 */ 22 */
23#include "drmP.h" 23#include <drm/drmP.h>
24#include "amdgpu.h" 24#include "amdgpu.h"
25#include "amdgpu_ih.h" 25#include "amdgpu_ih.h"
26#include "vid.h" 26#include "vid.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
index 79a52ad2c80d..3bbf2ccfca89 100644
--- a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
@@ -21,7 +21,7 @@
21 * 21 *
22 */ 22 */
23 23
24#include "drmP.h" 24#include <drm/drmP.h>
25#include "amdgpu.h" 25#include "amdgpu.h"
26#include "amdgpu_pm.h" 26#include "amdgpu_pm.h"
27#include "cikd.h" 27#include "cikd.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/kv_smc.c b/drivers/gpu/drm/amd/amdgpu/kv_smc.c
index e6b7b42acfe1..b82e33c01571 100644
--- a/drivers/gpu/drm/amd/amdgpu/kv_smc.c
+++ b/drivers/gpu/drm/amd/amdgpu/kv_smc.c
@@ -22,7 +22,7 @@
22 * Authors: Alex Deucher 22 * Authors: Alex Deucher
23 */ 23 */
24 24
25#include "drmP.h" 25#include <drm/drmP.h>
26#include "amdgpu.h" 26#include "amdgpu.h"
27#include "cikd.h" 27#include "cikd.h"
28#include "kv_dpm.h" 28#include "kv_dpm.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c b/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c
index 60a6407ba267..eef89abc0cee 100644
--- a/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c
@@ -24,7 +24,7 @@
24 */ 24 */
25 25
26#include <linux/firmware.h> 26#include <linux/firmware.h>
27#include "drmP.h" 27#include <drm/drmP.h>
28#include "amdgpu.h" 28#include "amdgpu.h"
29#include "amdgpu_psp.h" 29#include "amdgpu_psp.h"
30#include "amdgpu_ucode.h" 30#include "amdgpu_ucode.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/si.c b/drivers/gpu/drm/amd/amdgpu/si.c
index c0b1aabf282f..2431639baf47 100644
--- a/drivers/gpu/drm/amd/amdgpu/si.c
+++ b/drivers/gpu/drm/amd/amdgpu/si.c
@@ -24,7 +24,7 @@
24#include <linux/firmware.h> 24#include <linux/firmware.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include "drmP.h" 27#include <drm/drmP.h>
28#include "amdgpu.h" 28#include "amdgpu.h"
29#include "amdgpu_atombios.h" 29#include "amdgpu_atombios.h"
30#include "amdgpu_ih.h" 30#include "amdgpu_ih.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/si_dpm.c b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
index 7c1c5d127281..a7ad8390981c 100644
--- a/drivers/gpu/drm/amd/amdgpu/si_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
@@ -21,7 +21,7 @@
21 * 21 *
22 */ 22 */
23 23
24#include "drmP.h" 24#include <drm/drmP.h>
25#include "amdgpu.h" 25#include "amdgpu.h"
26#include "amdgpu_pm.h" 26#include "amdgpu_pm.h"
27#include "amdgpu_dpm.h" 27#include "amdgpu_dpm.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/si_ih.c b/drivers/gpu/drm/amd/amdgpu/si_ih.c
index e66084211c74..ce25e03a077d 100644
--- a/drivers/gpu/drm/amd/amdgpu/si_ih.c
+++ b/drivers/gpu/drm/amd/amdgpu/si_ih.c
@@ -20,7 +20,7 @@
20 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
21 * 21 *
22 */ 22 */
23#include "drmP.h" 23#include <drm/drmP.h>
24#include "amdgpu.h" 24#include "amdgpu.h"
25#include "amdgpu_ih.h" 25#include "amdgpu_ih.h"
26#include "sid.h" 26#include "sid.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/si_smc.c b/drivers/gpu/drm/amd/amdgpu/si_smc.c
index 0726bc3b6f90..4a2fd8b61940 100644
--- a/drivers/gpu/drm/amd/amdgpu/si_smc.c
+++ b/drivers/gpu/drm/amd/amdgpu/si_smc.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include <linux/firmware.h> 25#include <linux/firmware.h>
26#include "drmP.h" 26#include <drm/drmP.h>
27#include "amdgpu.h" 27#include "amdgpu.h"
28#include "sid.h" 28#include "sid.h"
29#include "ppsmc.h" 29#include "ppsmc.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c
index 6b55d451ae7f..e945f8b07487 100644
--- a/drivers/gpu/drm/amd/amdgpu/soc15.c
+++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
@@ -23,7 +23,7 @@
23#include <linux/firmware.h> 23#include <linux/firmware.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include "drmP.h" 26#include <drm/drmP.h>
27#include "amdgpu.h" 27#include "amdgpu.h"
28#include "amdgpu_atomfirmware.h" 28#include "amdgpu_atomfirmware.h"
29#include "amdgpu_ih.h" 29#include "amdgpu_ih.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/tonga_ih.c b/drivers/gpu/drm/amd/amdgpu/tonga_ih.c
index 3a5097ac2bb4..923df2c0e535 100644
--- a/drivers/gpu/drm/amd/amdgpu/tonga_ih.c
+++ b/drivers/gpu/drm/amd/amdgpu/tonga_ih.c
@@ -20,7 +20,7 @@
20 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
21 * 21 *
22 */ 22 */
23#include "drmP.h" 23#include <drm/drmP.h>
24#include "amdgpu.h" 24#include "amdgpu.h"
25#include "amdgpu_ih.h" 25#include "amdgpu_ih.h"
26#include "vid.h" 26#include "vid.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/vega10_ih.c b/drivers/gpu/drm/amd/amdgpu/vega10_ih.c
index 071f56e439bb..3b9740fb2c41 100644
--- a/drivers/gpu/drm/amd/amdgpu/vega10_ih.c
+++ b/drivers/gpu/drm/amd/amdgpu/vega10_ih.c
@@ -20,7 +20,7 @@
20 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
21 * 21 *
22 */ 22 */
23#include "drmP.h" 23#include <drm/drmP.h>
24#include "amdgpu.h" 24#include "amdgpu.h"
25#include "amdgpu_ih.h" 25#include "amdgpu_ih.h"
26#include "soc15.h" 26#include "soc15.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c
index b1132f5e84fc..3a187619286f 100644
--- a/drivers/gpu/drm/amd/amdgpu/vi.c
+++ b/drivers/gpu/drm/amd/amdgpu/vi.c
@@ -21,7 +21,7 @@
21 * 21 *
22 */ 22 */
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include "drmP.h" 24#include <drm/drmP.h>
25#include "amdgpu.h" 25#include "amdgpu.h"
26#include "amdgpu_atombios.h" 26#include "amdgpu_atombios.h"
27#include "amdgpu_ih.h" 27#include "amdgpu_ih.h"
diff --git a/drivers/gpu/drm/amd/amdkfd/Makefile b/drivers/gpu/drm/amd/amdkfd/Makefile
index 7fc9b0f444cb..b400d5664252 100644
--- a/drivers/gpu/drm/amd/amdkfd/Makefile
+++ b/drivers/gpu/drm/amd/amdkfd/Makefile
@@ -2,7 +2,7 @@
2# Makefile for Heterogenous System Architecture support for AMD GPU devices 2# Makefile for Heterogenous System Architecture support for AMD GPU devices
3# 3#
4 4
5ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/amd/include/ \ 5ccflags-y := -Idrivers/gpu/drm/amd/include/ \
6 -Idrivers/gpu/drm/amd/include/asic_reg 6 -Idrivers/gpu/drm/amd/include/asic_reg
7 7
8amdkfd-y := kfd_module.o kfd_device.o kfd_chardev.o kfd_topology.o \ 8amdkfd-y := kfd_module.o kfd_device.o kfd_chardev.o kfd_topology.o \
diff --git a/drivers/gpu/drm/amd/powerplay/Makefile b/drivers/gpu/drm/amd/powerplay/Makefile
index 043e6ebab575..4e132b936e3d 100644
--- a/drivers/gpu/drm/amd/powerplay/Makefile
+++ b/drivers/gpu/drm/amd/powerplay/Makefile
@@ -1,5 +1,5 @@
1 1
2subdir-ccflags-y += -Iinclude/drm \ 2subdir-ccflags-y += \
3 -I$(FULL_AMD_PATH)/powerplay/inc/ \ 3 -I$(FULL_AMD_PATH)/powerplay/inc/ \
4 -I$(FULL_AMD_PATH)/include/asic_reg \ 4 -I$(FULL_AMD_PATH)/include/asic_reg \
5 -I$(FULL_AMD_PATH)/include \ 5 -I$(FULL_AMD_PATH)/include \
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
index ff4ae3de6bb6..963a9e017a28 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
@@ -22,10 +22,10 @@
22 */ 22 */
23 23
24#include "pp_debug.h" 24#include "pp_debug.h"
25#include "linux/delay.h" 25#include <linux/delay.h>
26#include <linux/types.h>
27#include <linux/kernel.h> 26#include <linux/kernel.h>
28#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/types.h>
29#include <drm/amdgpu_drm.h> 29#include <drm/amdgpu_drm.h>
30#include "cgs_common.h" 30#include "cgs_common.h"
31#include "power_state.h" 31#include "power_state.h"
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c
index f5e8fda964f7..f6b4dd96c0ec 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c
@@ -21,8 +21,8 @@
21 * 21 *
22 */ 22 */
23 23
24#include <linux/delay.h>
24#include <linux/errno.h> 25#include <linux/errno.h>
25#include "linux/delay.h"
26#include "hwmgr.h" 26#include "hwmgr.h"
27#include "amd_acpi.h" 27#include "amd_acpi.h"
28#include "pp_acpi.h" 28#include "pp_acpi.h"
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
index a74a3db3056c..975567f6813d 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
@@ -21,11 +21,11 @@
21 * 21 *
22 */ 22 */
23#include "pp_debug.h" 23#include "pp_debug.h"
24#include <linux/delay.h>
25#include <linux/fb.h>
24#include <linux/module.h> 26#include <linux/module.h>
25#include <linux/slab.h> 27#include <linux/slab.h>
26#include <linux/fb.h>
27#include <asm/div64.h> 28#include <asm/div64.h>
28#include "linux/delay.h"
29#include "pp_acpi.h" 29#include "pp_acpi.h"
30#include "ppatomctrl.h" 30#include "ppatomctrl.h"
31#include "atombios.h" 31#include "atombios.h"
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
index ad30f5d3a10d..cd7bf6d3859a 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
@@ -20,10 +20,11 @@
20 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
21 * 21 *
22 */ 22 */
23
24#include <linux/delay.h>
25#include <linux/fb.h>
23#include <linux/module.h> 26#include <linux/module.h>
24#include <linux/slab.h> 27#include <linux/slab.h>
25#include <linux/fb.h>
26#include "linux/delay.h"
27 28
28#include "hwmgr.h" 29#include "hwmgr.h"
29#include "amd_powerplay.h" 30#include "amd_powerplay.h"
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c
index 1f6744a443d4..39c7091866e8 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c
@@ -20,11 +20,13 @@
20 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
21 * 21 *
22 */ 22 */
23#include <linux/types.h> 23
24#include <linux/delay.h>
25#include <linux/gfp.h>
24#include <linux/kernel.h> 26#include <linux/kernel.h>
25#include <linux/slab.h> 27#include <linux/slab.h>
26#include <linux/gfp.h> 28#include <linux/types.h>
27#include "linux/delay.h" 29
28#include "cgs_common.h" 30#include "cgs_common.h"
29#include "smu/smu_8_0_d.h" 31#include "smu/smu_8_0_d.h"
30#include "smu/smu_8_0_sh_mask.h" 32#include "smu/smu_8_0_sh_mask.h"
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c
index c0d75766bbc8..2e954a44bac1 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c
@@ -20,15 +20,16 @@
20 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
21 * 21 *
22 */ 22 */
23#include <linux/types.h> 23
24#include <linux/delay.h>
24#include <linux/kernel.h> 25#include <linux/kernel.h>
25#include <linux/module.h> 26#include <linux/module.h>
26#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/types.h>
27#include <drm/amdgpu_drm.h> 29#include <drm/amdgpu_drm.h>
28#include "pp_instance.h" 30#include "pp_instance.h"
29#include "smumgr.h" 31#include "smumgr.h"
30#include "cgs_common.h" 32#include "cgs_common.h"
31#include "linux/delay.h"
32 33
33MODULE_FIRMWARE("amdgpu/topaz_smc.bin"); 34MODULE_FIRMWARE("amdgpu/topaz_smc.bin");
34MODULE_FIRMWARE("amdgpu/topaz_k_smc.bin"); 35MODULE_FIRMWARE("amdgpu/topaz_k_smc.bin");
diff --git a/drivers/gpu/drm/arm/malidp_drv.h b/drivers/gpu/drm/arm/malidp_drv.h
index 040311ffcaec..2e2033140efc 100644
--- a/drivers/gpu/drm/arm/malidp_drv.h
+++ b/drivers/gpu/drm/arm/malidp_drv.h
@@ -65,6 +65,6 @@ void malidp_de_planes_destroy(struct drm_device *drm);
65int malidp_crtc_init(struct drm_device *drm); 65int malidp_crtc_init(struct drm_device *drm);
66 66
67/* often used combination of rotational bits */ 67/* often used combination of rotational bits */
68#define MALIDP_ROTATED_MASK (DRM_ROTATE_90 | DRM_ROTATE_270) 68#define MALIDP_ROTATED_MASK (DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270)
69 69
70#endif /* __MALIDP_DRV_H__ */ 70#endif /* __MALIDP_DRV_H__ */
diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
index 814fda23cead..063a8d2b0be3 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -80,7 +80,7 @@ static void malidp_plane_reset(struct drm_plane *plane)
80 state = kzalloc(sizeof(*state), GFP_KERNEL); 80 state = kzalloc(sizeof(*state), GFP_KERNEL);
81 if (state) { 81 if (state) {
82 state->base.plane = plane; 82 state->base.plane = plane;
83 state->base.rotation = DRM_ROTATE_0; 83 state->base.rotation = DRM_MODE_ROTATE_0;
84 plane->state = &state->base; 84 plane->state = &state->base;
85 } 85 }
86} 86}
@@ -221,7 +221,7 @@ static int malidp_de_plane_check(struct drm_plane *plane,
221 return ret; 221 return ret;
222 222
223 /* packed RGB888 / BGR888 can't be rotated or flipped */ 223 /* packed RGB888 / BGR888 can't be rotated or flipped */
224 if (state->rotation != DRM_ROTATE_0 && 224 if (state->rotation != DRM_MODE_ROTATE_0 &&
225 (fb->format->format == DRM_FORMAT_RGB888 || 225 (fb->format->format == DRM_FORMAT_RGB888 ||
226 fb->format->format == DRM_FORMAT_BGR888)) 226 fb->format->format == DRM_FORMAT_BGR888))
227 return -EINVAL; 227 return -EINVAL;
@@ -315,12 +315,12 @@ static void malidp_de_plane_update(struct drm_plane *plane,
315 val &= ~LAYER_ROT_MASK; 315 val &= ~LAYER_ROT_MASK;
316 316
317 /* setup the rotation and axis flip bits */ 317 /* setup the rotation and axis flip bits */
318 if (plane->state->rotation & DRM_ROTATE_MASK) 318 if (plane->state->rotation & DRM_MODE_ROTATE_MASK)
319 val |= ilog2(plane->state->rotation & DRM_ROTATE_MASK) << 319 val |= ilog2(plane->state->rotation & DRM_MODE_ROTATE_MASK) <<
320 LAYER_ROT_OFFSET; 320 LAYER_ROT_OFFSET;
321 if (plane->state->rotation & DRM_REFLECT_X) 321 if (plane->state->rotation & DRM_MODE_REFLECT_X)
322 val |= LAYER_H_FLIP; 322 val |= LAYER_H_FLIP;
323 if (plane->state->rotation & DRM_REFLECT_Y) 323 if (plane->state->rotation & DRM_MODE_REFLECT_Y)
324 val |= LAYER_V_FLIP; 324 val |= LAYER_V_FLIP;
325 325
326 /* 326 /*
@@ -370,8 +370,8 @@ int malidp_de_planes_init(struct drm_device *drm)
370 struct malidp_plane *plane = NULL; 370 struct malidp_plane *plane = NULL;
371 enum drm_plane_type plane_type; 371 enum drm_plane_type plane_type;
372 unsigned long crtcs = 1 << drm->mode_config.num_crtc; 372 unsigned long crtcs = 1 << drm->mode_config.num_crtc;
373 unsigned long flags = DRM_ROTATE_0 | DRM_ROTATE_90 | DRM_ROTATE_180 | 373 unsigned long flags = DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_180 |
374 DRM_ROTATE_270 | DRM_REFLECT_X | DRM_REFLECT_Y; 374 DRM_MODE_ROTATE_270 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y;
375 u32 *formats; 375 u32 *formats;
376 int ret, i, j, n; 376 int ret, i, j, n;
377 377
@@ -420,7 +420,7 @@ int malidp_de_planes_init(struct drm_device *drm)
420 continue; 420 continue;
421 } 421 }
422 422
423 drm_plane_create_rotation_property(&plane->base, DRM_ROTATE_0, flags); 423 drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, flags);
424 malidp_hw_write(malidp->dev, MALIDP_ALPHA_LUT, 424 malidp_hw_write(malidp->dev, MALIDP_ALPHA_LUT,
425 plane->layer->base + MALIDP_LAYER_COMPOSE); 425 plane->layer->base + MALIDP_LAYER_COMPOSE);
426 } 426 }
diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
index 424e465ff407..e9a29df4b443 100644
--- a/drivers/gpu/drm/armada/armada_overlay.c
+++ b/drivers/gpu/drm/armada/armada_overlay.c
@@ -125,7 +125,7 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
125 src_x, src_y, src_w, src_h); 125 src_x, src_y, src_w, src_h);
126 126
127 ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest, &clip, 127 ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest, &clip,
128 DRM_ROTATE_0, 128 DRM_MODE_ROTATE_0,
129 0, INT_MAX, true, false, &visible); 129 0, INT_MAX, true, false, &visible);
130 if (ret) 130 if (ret)
131 return ret; 131 return ret;
diff --git a/drivers/gpu/drm/ast/Makefile b/drivers/gpu/drm/ast/Makefile
index 171aa0622b66..617fdd39519c 100644
--- a/drivers/gpu/drm/ast/Makefile
+++ b/drivers/gpu/drm/ast/Makefile
@@ -2,8 +2,6 @@
2# Makefile for the drm device driver. This driver provides support for the 2# Makefile for the drm device driver. This driver provides support for the
3# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. 3# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
4 4
5ccflags-y := -Iinclude/drm
6
7ast-y := ast_drv.o ast_main.o ast_mode.o ast_fb.o ast_ttm.o ast_post.o ast_dp501.o 5ast-y := ast_drv.o ast_main.o ast_mode.o ast_fb.o ast_ttm.o ast_post.o ast_dp501.o
8 6
9obj-$(CONFIG_DRM_AST) := ast.o 7obj-$(CONFIG_DRM_AST) := ast.o
diff --git a/drivers/gpu/drm/ast/ast_ttm.c b/drivers/gpu/drm/ast/ast_ttm.c
index e879496b8a42..58084985e6cf 100644
--- a/drivers/gpu/drm/ast/ast_ttm.c
+++ b/drivers/gpu/drm/ast/ast_ttm.c
@@ -26,8 +26,9 @@
26 * Authors: Dave Airlie <airlied@redhat.com> 26 * Authors: Dave Airlie <airlied@redhat.com>
27 */ 27 */
28#include <drm/drmP.h> 28#include <drm/drmP.h>
29#include <drm/ttm/ttm_page_alloc.h>
30
29#include "ast_drv.h" 31#include "ast_drv.h"
30#include <ttm/ttm_page_alloc.h>
31 32
32static inline struct ast_private * 33static inline struct ast_private *
33ast_bdev(struct ttm_bo_device *bd) 34ast_bdev(struct ttm_bo_device *bd)
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
index 29cc10d053eb..1124200bb280 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
@@ -678,8 +678,8 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
678 if (!state->bpp[i]) 678 if (!state->bpp[i])
679 return -EINVAL; 679 return -EINVAL;
680 680
681 switch (state->base.rotation & DRM_ROTATE_MASK) { 681 switch (state->base.rotation & DRM_MODE_ROTATE_MASK) {
682 case DRM_ROTATE_90: 682 case DRM_MODE_ROTATE_90:
683 offset = ((y_offset + state->src_y + patched_src_w - 1) / 683 offset = ((y_offset + state->src_y + patched_src_w - 1) /
684 ydiv) * fb->pitches[i]; 684 ydiv) * fb->pitches[i];
685 offset += ((x_offset + state->src_x) / xdiv) * 685 offset += ((x_offset + state->src_x) / xdiv) *
@@ -688,7 +688,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
688 fb->pitches[i]; 688 fb->pitches[i];
689 state->pstride[i] = -fb->pitches[i] - state->bpp[i]; 689 state->pstride[i] = -fb->pitches[i] - state->bpp[i];
690 break; 690 break;
691 case DRM_ROTATE_180: 691 case DRM_MODE_ROTATE_180:
692 offset = ((y_offset + state->src_y + patched_src_h - 1) / 692 offset = ((y_offset + state->src_y + patched_src_h - 1) /
693 ydiv) * fb->pitches[i]; 693 ydiv) * fb->pitches[i];
694 offset += ((x_offset + state->src_x + patched_src_w - 1) / 694 offset += ((x_offset + state->src_x + patched_src_w - 1) /
@@ -697,7 +697,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
697 state->bpp[i]) - fb->pitches[i]; 697 state->bpp[i]) - fb->pitches[i];
698 state->pstride[i] = -2 * state->bpp[i]; 698 state->pstride[i] = -2 * state->bpp[i];
699 break; 699 break;
700 case DRM_ROTATE_270: 700 case DRM_MODE_ROTATE_270:
701 offset = ((y_offset + state->src_y) / ydiv) * 701 offset = ((y_offset + state->src_y) / ydiv) *
702 fb->pitches[i]; 702 fb->pitches[i];
703 offset += ((x_offset + state->src_x + patched_src_h - 1) / 703 offset += ((x_offset + state->src_x + patched_src_h - 1) /
@@ -707,7 +707,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
707 (2 * state->bpp[i]); 707 (2 * state->bpp[i]);
708 state->pstride[i] = fb->pitches[i] - state->bpp[i]; 708 state->pstride[i] = fb->pitches[i] - state->bpp[i];
709 break; 709 break;
710 case DRM_ROTATE_0: 710 case DRM_MODE_ROTATE_0:
711 default: 711 default:
712 offset = ((y_offset + state->src_y) / ydiv) * 712 offset = ((y_offset + state->src_y) / ydiv) *
713 fb->pitches[i]; 713 fb->pitches[i];
@@ -864,11 +864,11 @@ static int atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane,
864 int ret; 864 int ret;
865 865
866 ret = drm_plane_create_rotation_property(&plane->base, 866 ret = drm_plane_create_rotation_property(&plane->base,
867 DRM_ROTATE_0, 867 DRM_MODE_ROTATE_0,
868 DRM_ROTATE_0 | 868 DRM_MODE_ROTATE_0 |
869 DRM_ROTATE_90 | 869 DRM_MODE_ROTATE_90 |
870 DRM_ROTATE_180 | 870 DRM_MODE_ROTATE_180 |
871 DRM_ROTATE_270); 871 DRM_MODE_ROTATE_270);
872 if (ret) 872 if (ret)
873 return ret; 873 return ret;
874 } 874 }
diff --git a/drivers/gpu/drm/bochs/Makefile b/drivers/gpu/drm/bochs/Makefile
index 844a55614920..98ef60a19e8f 100644
--- a/drivers/gpu/drm/bochs/Makefile
+++ b/drivers/gpu/drm/bochs/Makefile
@@ -1,4 +1,3 @@
1ccflags-y := -Iinclude/drm
2bochs-drm-y := bochs_drv.o bochs_mm.o bochs_kms.o bochs_fbdev.o bochs_hw.o 1bochs-drm-y := bochs_drv.o bochs_mm.o bochs_kms.o bochs_fbdev.o bochs_hw.o
3 2
4obj-$(CONFIG_DRM_BOCHS) += bochs-drm.o 3obj-$(CONFIG_DRM_BOCHS) += bochs-drm.o
diff --git a/drivers/gpu/drm/bochs/bochs.h b/drivers/gpu/drm/bochs/bochs.h
index f626bab7f5e3..76c490c3cdbc 100644
--- a/drivers/gpu/drm/bochs/bochs.h
+++ b/drivers/gpu/drm/bochs/bochs.h
@@ -9,8 +9,8 @@
9 9
10#include <drm/drm_gem.h> 10#include <drm/drm_gem.h>
11 11
12#include <ttm/ttm_bo_driver.h> 12#include <drm/ttm/ttm_bo_driver.h>
13#include <ttm/ttm_page_alloc.h> 13#include <drm/ttm/ttm_page_alloc.h>
14 14
15/* ---------------------------------------------------------------------- */ 15/* ---------------------------------------------------------------------- */
16 16
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 3fe2226ee2f2..defcf1e7ca1c 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -1,5 +1,3 @@
1ccflags-y := -Iinclude/drm
2
3obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o 1obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
4obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o 2obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o
5obj-$(CONFIG_DRM_LVDS_ENCODER) += lvds-encoder.o 3obj-$(CONFIG_DRM_LVDS_ENCODER) += lvds-encoder.o
diff --git a/drivers/gpu/drm/bridge/nxp-ptn3460.c b/drivers/gpu/drm/bridge/nxp-ptn3460.c
index 351704390d02..4f64e717e01b 100644
--- a/drivers/gpu/drm/bridge/nxp-ptn3460.c
+++ b/drivers/gpu/drm/bridge/nxp-ptn3460.c
@@ -20,15 +20,13 @@
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/of.h> 21#include <linux/of.h>
22#include <linux/of_gpio.h> 22#include <linux/of_gpio.h>
23 23#include <drm/drm_atomic_helper.h>
24#include <drm/drm_crtc.h>
25#include <drm/drm_crtc_helper.h>
26#include <drm/drm_edid.h>
24#include <drm/drm_of.h> 27#include <drm/drm_of.h>
25#include <drm/drm_panel.h> 28#include <drm/drm_panel.h>
26 29#include <drm/drmP.h>
27#include "drm_crtc.h"
28#include "drm_crtc_helper.h"
29#include "drm_atomic_helper.h"
30#include "drm_edid.h"
31#include "drmP.h"
32 30
33#define PTN3460_EDID_ADDR 0x0 31#define PTN3460_EDID_ADDR 0x0
34#define PTN3460_EDID_EMULATION_ADDR 0x84 32#define PTN3460_EDID_EMULATION_ADDR 0x84
diff --git a/drivers/gpu/drm/bridge/parade-ps8622.c b/drivers/gpu/drm/bridge/parade-ps8622.c
index 1dcec3b97e67..6f22f9fec9bf 100644
--- a/drivers/gpu/drm/bridge/parade-ps8622.c
+++ b/drivers/gpu/drm/bridge/parade-ps8622.c
@@ -24,14 +24,12 @@
24#include <linux/of_device.h> 24#include <linux/of_device.h>
25#include <linux/pm.h> 25#include <linux/pm.h>
26#include <linux/regulator/consumer.h> 26#include <linux/regulator/consumer.h>
27 27#include <drm/drm_atomic_helper.h>
28#include <drm/drm_crtc.h>
29#include <drm/drm_crtc_helper.h>
28#include <drm/drm_of.h> 30#include <drm/drm_of.h>
29#include <drm/drm_panel.h> 31#include <drm/drm_panel.h>
30 32#include <drm/drmP.h>
31#include "drmP.h"
32#include "drm_crtc.h"
33#include "drm_crtc_helper.h"
34#include "drm_atomic_helper.h"
35 33
36/* Brightness scale on the Parade chip */ 34/* Brightness scale on the Parade chip */
37#define PS8622_MAX_BRIGHTNESS 0xff 35#define PS8622_MAX_BRIGHTNESS 0xff
diff --git a/drivers/gpu/drm/cirrus/Makefile b/drivers/gpu/drm/cirrus/Makefile
index 69ffe7006d55..919c0a336c97 100644
--- a/drivers/gpu/drm/cirrus/Makefile
+++ b/drivers/gpu/drm/cirrus/Makefile
@@ -1,4 +1,3 @@
1ccflags-y := -Iinclude/drm
2cirrus-y := cirrus_main.o cirrus_mode.o \ 1cirrus-y := cirrus_main.o cirrus_mode.o \
3 cirrus_drv.o cirrus_fbdev.o cirrus_ttm.o 2 cirrus_drv.o cirrus_fbdev.o cirrus_ttm.o
4 3
diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c b/drivers/gpu/drm/cirrus/cirrus_ttm.c
index 93dbcd38355d..1ff1838c0d44 100644
--- a/drivers/gpu/drm/cirrus/cirrus_ttm.c
+++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c
@@ -26,8 +26,9 @@
26 * Authors: Dave Airlie <airlied@redhat.com> 26 * Authors: Dave Airlie <airlied@redhat.com>
27 */ 27 */
28#include <drm/drmP.h> 28#include <drm/drmP.h>
29#include <drm/ttm/ttm_page_alloc.h>
30
29#include "cirrus_drv.h" 31#include "cirrus_drv.h"
30#include <ttm/ttm_page_alloc.h>
31 32
32static inline struct cirrus_device * 33static inline struct cirrus_device *
33cirrus_bdev(struct ttm_bo_device *bd) 34cirrus_bdev(struct ttm_bo_device *bd)
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index cdec19a86af3..e1637011e18a 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -781,7 +781,7 @@ int drm_atomic_plane_set_property(struct drm_plane *plane,
781 } else if (property == config->prop_src_h) { 781 } else if (property == config->prop_src_h) {
782 state->src_h = val; 782 state->src_h = val;
783 } else if (property == plane->rotation_property) { 783 } else if (property == plane->rotation_property) {
784 if (!is_power_of_2(val & DRM_ROTATE_MASK)) 784 if (!is_power_of_2(val & DRM_MODE_ROTATE_MASK))
785 return -EINVAL; 785 return -EINVAL;
786 state->rotation = val; 786 state->rotation = val;
787 } else if (property == plane->zpos_property) { 787 } else if (property == plane->zpos_property) {
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 6426339427a4..636e561486a8 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -3225,7 +3225,7 @@ void drm_atomic_helper_plane_reset(struct drm_plane *plane)
3225 3225
3226 if (plane->state) { 3226 if (plane->state) {
3227 plane->state->plane = plane; 3227 plane->state->plane = plane;
3228 plane->state->rotation = DRM_ROTATE_0; 3228 plane->state->rotation = DRM_MODE_ROTATE_0;
3229 } 3229 }
3230} 3230}
3231EXPORT_SYMBOL(drm_atomic_helper_plane_reset); 3231EXPORT_SYMBOL(drm_atomic_helper_plane_reset);
diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
index a0d0d6843288..db6aeec50b82 100644
--- a/drivers/gpu/drm/drm_blend.c
+++ b/drivers/gpu/drm/drm_blend.c
@@ -119,17 +119,17 @@
119 * drm_property_create_bitmask()) called "rotation" and has the following 119 * drm_property_create_bitmask()) called "rotation" and has the following
120 * bitmask enumaration values: 120 * bitmask enumaration values:
121 * 121 *
122 * DRM_ROTATE_0: 122 * DRM_MODE_ROTATE_0:
123 * "rotate-0" 123 * "rotate-0"
124 * DRM_ROTATE_90: 124 * DRM_MODE_ROTATE_90:
125 * "rotate-90" 125 * "rotate-90"
126 * DRM_ROTATE_180: 126 * DRM_MODE_ROTATE_180:
127 * "rotate-180" 127 * "rotate-180"
128 * DRM_ROTATE_270: 128 * DRM_MODE_ROTATE_270:
129 * "rotate-270" 129 * "rotate-270"
130 * DRM_REFLECT_X: 130 * DRM_MODE_REFLECT_X:
131 * "reflect-x" 131 * "reflect-x"
132 * DRM_REFELCT_Y: 132 * DRM_MODE_REFLECT_Y:
133 * "reflect-y" 133 * "reflect-y"
134 * 134 *
135 * Rotation is the specified amount in degrees in counter clockwise direction, 135 * Rotation is the specified amount in degrees in counter clockwise direction,
@@ -142,17 +142,17 @@ int drm_plane_create_rotation_property(struct drm_plane *plane,
142 unsigned int supported_rotations) 142 unsigned int supported_rotations)
143{ 143{
144 static const struct drm_prop_enum_list props[] = { 144 static const struct drm_prop_enum_list props[] = {
145 { __builtin_ffs(DRM_ROTATE_0) - 1, "rotate-0" }, 145 { __builtin_ffs(DRM_MODE_ROTATE_0) - 1, "rotate-0" },
146 { __builtin_ffs(DRM_ROTATE_90) - 1, "rotate-90" }, 146 { __builtin_ffs(DRM_MODE_ROTATE_90) - 1, "rotate-90" },
147 { __builtin_ffs(DRM_ROTATE_180) - 1, "rotate-180" }, 147 { __builtin_ffs(DRM_MODE_ROTATE_180) - 1, "rotate-180" },
148 { __builtin_ffs(DRM_ROTATE_270) - 1, "rotate-270" }, 148 { __builtin_ffs(DRM_MODE_ROTATE_270) - 1, "rotate-270" },
149 { __builtin_ffs(DRM_REFLECT_X) - 1, "reflect-x" }, 149 { __builtin_ffs(DRM_MODE_REFLECT_X) - 1, "reflect-x" },
150 { __builtin_ffs(DRM_REFLECT_Y) - 1, "reflect-y" }, 150 { __builtin_ffs(DRM_MODE_REFLECT_Y) - 1, "reflect-y" },
151 }; 151 };
152 struct drm_property *prop; 152 struct drm_property *prop;
153 153
154 WARN_ON((supported_rotations & DRM_ROTATE_MASK) == 0); 154 WARN_ON((supported_rotations & DRM_MODE_ROTATE_MASK) == 0);
155 WARN_ON(!is_power_of_2(rotation & DRM_ROTATE_MASK)); 155 WARN_ON(!is_power_of_2(rotation & DRM_MODE_ROTATE_MASK));
156 WARN_ON(rotation & ~supported_rotations); 156 WARN_ON(rotation & ~supported_rotations);
157 157
158 prop = drm_property_create_bitmask(plane->dev, 0, "rotation", 158 prop = drm_property_create_bitmask(plane->dev, 0, "rotation",
@@ -178,14 +178,14 @@ EXPORT_SYMBOL(drm_plane_create_rotation_property);
178 * @supported_rotations: Supported rotations 178 * @supported_rotations: Supported rotations
179 * 179 *
180 * Attempt to simplify the rotation to a form that is supported. 180 * Attempt to simplify the rotation to a form that is supported.
181 * Eg. if the hardware supports everything except DRM_REFLECT_X 181 * Eg. if the hardware supports everything except DRM_MODE_REFLECT_X
182 * one could call this function like this: 182 * one could call this function like this:
183 * 183 *
184 * drm_rotation_simplify(rotation, DRM_ROTATE_0 | 184 * drm_rotation_simplify(rotation, DRM_MODE_ROTATE_0 |
185 * DRM_ROTATE_90 | DRM_ROTATE_180 | 185 * DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_180 |
186 * DRM_ROTATE_270 | DRM_REFLECT_Y); 186 * DRM_MODE_ROTATE_270 | DRM_MODE_REFLECT_Y);
187 * 187 *
188 * to eliminate the DRM_ROTATE_X flag. Depending on what kind of 188 * to eliminate the DRM_MODE_ROTATE_X flag. Depending on what kind of
189 * transforms the hardware supports, this function may not 189 * transforms the hardware supports, this function may not
190 * be able to produce a supported transform, so the caller should 190 * be able to produce a supported transform, so the caller should
191 * check the result afterwards. 191 * check the result afterwards.
@@ -194,9 +194,10 @@ unsigned int drm_rotation_simplify(unsigned int rotation,
194 unsigned int supported_rotations) 194 unsigned int supported_rotations)
195{ 195{
196 if (rotation & ~supported_rotations) { 196 if (rotation & ~supported_rotations) {
197 rotation ^= DRM_REFLECT_X | DRM_REFLECT_Y; 197 rotation ^= DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y;
198 rotation = (rotation & DRM_REFLECT_MASK) | 198 rotation = (rotation & DRM_MODE_REFLECT_MASK) |
199 BIT((ffs(rotation & DRM_ROTATE_MASK) + 1) % 4); 199 BIT((ffs(rotation & DRM_MODE_ROTATE_MASK) + 1)
200 % 4);
200 } 201 }
201 202
202 return rotation; 203 return rotation;
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 1f178b878e42..574af01d3ce9 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -378,7 +378,7 @@ retry:
378 goto fail; 378 goto fail;
379 } 379 }
380 380
381 plane_state->rotation = DRM_ROTATE_0; 381 plane_state->rotation = DRM_MODE_ROTATE_0;
382 382
383 plane->old_fb = plane->fb; 383 plane->old_fb = plane->fb;
384 plane_mask |= 1 << drm_plane_index(plane); 384 plane_mask |= 1 << drm_plane_index(plane);
@@ -431,7 +431,7 @@ static int restore_fbdev_mode_legacy(struct drm_fb_helper *fb_helper)
431 if (plane->rotation_property) 431 if (plane->rotation_property)
432 drm_mode_plane_set_obj_prop(plane, 432 drm_mode_plane_set_obj_prop(plane,
433 plane->rotation_property, 433 plane->rotation_property,
434 DRM_ROTATE_0); 434 DRM_MODE_ROTATE_0);
435 } 435 }
436 436
437 for (i = 0; i < fb_helper->crtc_count; i++) { 437 for (i = 0; i < fb_helper->crtc_count; i++) {
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index b1e28c944637..8dc11064253d 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -521,7 +521,7 @@ struct page **drm_gem_get_pages(struct drm_gem_object *obj)
521 521
522 npages = obj->size >> PAGE_SHIFT; 522 npages = obj->size >> PAGE_SHIFT;
523 523
524 pages = drm_malloc_ab(npages, sizeof(struct page *)); 524 pages = kvmalloc_array(npages, sizeof(struct page *), GFP_KERNEL);
525 if (pages == NULL) 525 if (pages == NULL)
526 return ERR_PTR(-ENOMEM); 526 return ERR_PTR(-ENOMEM);
527 527
@@ -546,7 +546,7 @@ fail:
546 while (i--) 546 while (i--)
547 put_page(pages[i]); 547 put_page(pages[i]);
548 548
549 drm_free_large(pages); 549 kvfree(pages);
550 return ERR_CAST(p); 550 return ERR_CAST(p);
551} 551}
552EXPORT_SYMBOL(drm_gem_get_pages); 552EXPORT_SYMBOL(drm_gem_get_pages);
@@ -582,7 +582,7 @@ void drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages,
582 put_page(pages[i]); 582 put_page(pages[i]);
583 } 583 }
584 584
585 drm_free_large(pages); 585 kvfree(pages);
586} 586}
587EXPORT_SYMBOL(drm_gem_put_pages); 587EXPORT_SYMBOL(drm_gem_put_pages);
588 588
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
index 2c27f6f5a668..06aee1741e96 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -336,7 +336,7 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
336 336
337 ret = drm_plane_helper_check_update(plane, crtc, fb, 337 ret = drm_plane_helper_check_update(plane, crtc, fb,
338 &src, &dest, &clip, 338 &src, &dest, &clip,
339 DRM_ROTATE_0, 339 DRM_MODE_ROTATE_0,
340 DRM_PLANE_HELPER_NO_SCALING, 340 DRM_PLANE_HELPER_NO_SCALING,
341 DRM_PLANE_HELPER_NO_SCALING, 341 DRM_PLANE_HELPER_NO_SCALING,
342 false, false, &visible); 342 false, false, &visible);
diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
index bc5575960ebc..9817c1445ba9 100644
--- a/drivers/gpu/drm/drm_rect.c
+++ b/drivers/gpu/drm/drm_rect.c
@@ -310,38 +310,38 @@ void drm_rect_rotate(struct drm_rect *r,
310{ 310{
311 struct drm_rect tmp; 311 struct drm_rect tmp;
312 312
313 if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) { 313 if (rotation & (DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y)) {
314 tmp = *r; 314 tmp = *r;
315 315
316 if (rotation & DRM_REFLECT_X) { 316 if (rotation & DRM_MODE_REFLECT_X) {
317 r->x1 = width - tmp.x2; 317 r->x1 = width - tmp.x2;
318 r->x2 = width - tmp.x1; 318 r->x2 = width - tmp.x1;
319 } 319 }
320 320
321 if (rotation & DRM_REFLECT_Y) { 321 if (rotation & DRM_MODE_REFLECT_Y) {
322 r->y1 = height - tmp.y2; 322 r->y1 = height - tmp.y2;
323 r->y2 = height - tmp.y1; 323 r->y2 = height - tmp.y1;
324 } 324 }
325 } 325 }
326 326
327 switch (rotation & DRM_ROTATE_MASK) { 327 switch (rotation & DRM_MODE_ROTATE_MASK) {
328 case DRM_ROTATE_0: 328 case DRM_MODE_ROTATE_0:
329 break; 329 break;
330 case DRM_ROTATE_90: 330 case DRM_MODE_ROTATE_90:
331 tmp = *r; 331 tmp = *r;
332 r->x1 = tmp.y1; 332 r->x1 = tmp.y1;
333 r->x2 = tmp.y2; 333 r->x2 = tmp.y2;
334 r->y1 = width - tmp.x2; 334 r->y1 = width - tmp.x2;
335 r->y2 = width - tmp.x1; 335 r->y2 = width - tmp.x1;
336 break; 336 break;
337 case DRM_ROTATE_180: 337 case DRM_MODE_ROTATE_180:
338 tmp = *r; 338 tmp = *r;
339 r->x1 = width - tmp.x2; 339 r->x1 = width - tmp.x2;
340 r->x2 = width - tmp.x1; 340 r->x2 = width - tmp.x1;
341 r->y1 = height - tmp.y2; 341 r->y1 = height - tmp.y2;
342 r->y2 = height - tmp.y1; 342 r->y2 = height - tmp.y1;
343 break; 343 break;
344 case DRM_ROTATE_270: 344 case DRM_MODE_ROTATE_270:
345 tmp = *r; 345 tmp = *r;
346 r->x1 = height - tmp.y2; 346 r->x1 = height - tmp.y2;
347 r->x2 = height - tmp.y1; 347 r->x2 = height - tmp.y1;
@@ -373,8 +373,8 @@ EXPORT_SYMBOL(drm_rect_rotate);
373 * them when doing a rotatation and its inverse. 373 * them when doing a rotatation and its inverse.
374 * That is, if you do :: 374 * That is, if you do ::
375 * 375 *
376 * drm_rotate(&r, width, height, rotation); 376 * DRM_MODE_PROP_ROTATE(&r, width, height, rotation);
377 * drm_rotate_inv(&r, width, height, rotation); 377 * DRM_MODE_ROTATE_inv(&r, width, height, rotation);
378 * 378 *
379 * you will always get back the original rectangle. 379 * you will always get back the original rectangle.
380 */ 380 */
@@ -384,24 +384,24 @@ void drm_rect_rotate_inv(struct drm_rect *r,
384{ 384{
385 struct drm_rect tmp; 385 struct drm_rect tmp;
386 386
387 switch (rotation & DRM_ROTATE_MASK) { 387 switch (rotation & DRM_MODE_ROTATE_MASK) {
388 case DRM_ROTATE_0: 388 case DRM_MODE_ROTATE_0:
389 break; 389 break;
390 case DRM_ROTATE_90: 390 case DRM_MODE_ROTATE_90:
391 tmp = *r; 391 tmp = *r;
392 r->x1 = width - tmp.y2; 392 r->x1 = width - tmp.y2;
393 r->x2 = width - tmp.y1; 393 r->x2 = width - tmp.y1;
394 r->y1 = tmp.x1; 394 r->y1 = tmp.x1;
395 r->y2 = tmp.x2; 395 r->y2 = tmp.x2;
396 break; 396 break;
397 case DRM_ROTATE_180: 397 case DRM_MODE_ROTATE_180:
398 tmp = *r; 398 tmp = *r;
399 r->x1 = width - tmp.x2; 399 r->x1 = width - tmp.x2;
400 r->x2 = width - tmp.x1; 400 r->x2 = width - tmp.x1;
401 r->y1 = height - tmp.y2; 401 r->y1 = height - tmp.y2;
402 r->y2 = height - tmp.y1; 402 r->y2 = height - tmp.y1;
403 break; 403 break;
404 case DRM_ROTATE_270: 404 case DRM_MODE_ROTATE_270:
405 tmp = *r; 405 tmp = *r;
406 r->x1 = tmp.y1; 406 r->x1 = tmp.y1;
407 r->x2 = tmp.y2; 407 r->x2 = tmp.y2;
@@ -412,15 +412,15 @@ void drm_rect_rotate_inv(struct drm_rect *r,
412 break; 412 break;
413 } 413 }
414 414
415 if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) { 415 if (rotation & (DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y)) {
416 tmp = *r; 416 tmp = *r;
417 417
418 if (rotation & DRM_REFLECT_X) { 418 if (rotation & DRM_MODE_REFLECT_X) {
419 r->x1 = width - tmp.x2; 419 r->x1 = width - tmp.x2;
420 r->x2 = width - tmp.x1; 420 r->x2 = width - tmp.x1;
421 } 421 }
422 422
423 if (rotation & DRM_REFLECT_Y) { 423 if (rotation & DRM_MODE_REFLECT_Y) {
424 r->y1 = height - tmp.y2; 424 r->y1 = height - tmp.y2;
425 r->y2 = height - tmp.y1; 425 r->y2 = height - tmp.y1;
426 } 426 }
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
index fd56f92f3469..d6fb724fc3cc 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
@@ -748,7 +748,7 @@ static struct page **etnaviv_gem_userptr_do_get_pages(
748 uintptr_t ptr; 748 uintptr_t ptr;
749 unsigned int flags = 0; 749 unsigned int flags = 0;
750 750
751 pvec = drm_malloc_ab(npages, sizeof(struct page *)); 751 pvec = kvmalloc_array(npages, sizeof(struct page *), GFP_KERNEL);
752 if (!pvec) 752 if (!pvec)
753 return ERR_PTR(-ENOMEM); 753 return ERR_PTR(-ENOMEM);
754 754
@@ -772,7 +772,7 @@ static struct page **etnaviv_gem_userptr_do_get_pages(
772 772
773 if (ret < 0) { 773 if (ret < 0) {
774 release_pages(pvec, pinned, 0); 774 release_pages(pvec, pinned, 0);
775 drm_free_large(pvec); 775 kvfree(pvec);
776 return ERR_PTR(ret); 776 return ERR_PTR(ret);
777 } 777 }
778 778
@@ -823,7 +823,7 @@ static int etnaviv_gem_userptr_get_pages(struct etnaviv_gem_object *etnaviv_obj)
823 mm = get_task_mm(etnaviv_obj->userptr.task); 823 mm = get_task_mm(etnaviv_obj->userptr.task);
824 pinned = 0; 824 pinned = 0;
825 if (mm == current->mm) { 825 if (mm == current->mm) {
826 pvec = drm_malloc_ab(npages, sizeof(struct page *)); 826 pvec = kvmalloc_array(npages, sizeof(struct page *), GFP_KERNEL);
827 if (!pvec) { 827 if (!pvec) {
828 mmput(mm); 828 mmput(mm);
829 return -ENOMEM; 829 return -ENOMEM;
@@ -832,7 +832,7 @@ static int etnaviv_gem_userptr_get_pages(struct etnaviv_gem_object *etnaviv_obj)
832 pinned = __get_user_pages_fast(etnaviv_obj->userptr.ptr, npages, 832 pinned = __get_user_pages_fast(etnaviv_obj->userptr.ptr, npages,
833 !etnaviv_obj->userptr.ro, pvec); 833 !etnaviv_obj->userptr.ro, pvec);
834 if (pinned < 0) { 834 if (pinned < 0) {
835 drm_free_large(pvec); 835 kvfree(pvec);
836 mmput(mm); 836 mmput(mm);
837 return pinned; 837 return pinned;
838 } 838 }
@@ -845,7 +845,7 @@ static int etnaviv_gem_userptr_get_pages(struct etnaviv_gem_object *etnaviv_obj)
845 } 845 }
846 846
847 release_pages(pvec, pinned, 0); 847 release_pages(pvec, pinned, 0);
848 drm_free_large(pvec); 848 kvfree(pvec);
849 849
850 work = kmalloc(sizeof(*work), GFP_KERNEL); 850 work = kmalloc(sizeof(*work), GFP_KERNEL);
851 if (!work) { 851 if (!work) {
@@ -879,7 +879,7 @@ static void etnaviv_gem_userptr_release(struct etnaviv_gem_object *etnaviv_obj)
879 int npages = etnaviv_obj->base.size >> PAGE_SHIFT; 879 int npages = etnaviv_obj->base.size >> PAGE_SHIFT;
880 880
881 release_pages(etnaviv_obj->pages, npages, 0); 881 release_pages(etnaviv_obj->pages, npages, 0);
882 drm_free_large(etnaviv_obj->pages); 882 kvfree(etnaviv_obj->pages);
883 } 883 }
884 put_task_struct(etnaviv_obj->userptr.task); 884 put_task_struct(etnaviv_obj->userptr.task);
885} 885}
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
index 62b47972a52e..367bf952f61a 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
@@ -87,7 +87,7 @@ static void etnaviv_gem_prime_release(struct etnaviv_gem_object *etnaviv_obj)
87 * ours, just free the array we allocated: 87 * ours, just free the array we allocated:
88 */ 88 */
89 if (etnaviv_obj->pages) 89 if (etnaviv_obj->pages)
90 drm_free_large(etnaviv_obj->pages); 90 kvfree(etnaviv_obj->pages);
91 91
92 drm_prime_gem_destroy(&etnaviv_obj->base, etnaviv_obj->sgt); 92 drm_prime_gem_destroy(&etnaviv_obj->base, etnaviv_obj->sgt);
93} 93}
@@ -128,7 +128,7 @@ struct drm_gem_object *etnaviv_gem_prime_import_sg_table(struct drm_device *dev,
128 npages = size / PAGE_SIZE; 128 npages = size / PAGE_SIZE;
129 129
130 etnaviv_obj->sgt = sgt; 130 etnaviv_obj->sgt = sgt;
131 etnaviv_obj->pages = drm_malloc_ab(npages, sizeof(struct page *)); 131 etnaviv_obj->pages = kvmalloc_array(npages, sizeof(struct page *), GFP_KERNEL);
132 if (!etnaviv_obj->pages) { 132 if (!etnaviv_obj->pages) {
133 ret = -ENOMEM; 133 ret = -ENOMEM;
134 goto fail; 134 goto fail;
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
index e1909429837e..a13930e1d8c9 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
@@ -343,9 +343,9 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
343 * Copy the command submission and bo array to kernel space in 343 * Copy the command submission and bo array to kernel space in
344 * one go, and do this outside of any locks. 344 * one go, and do this outside of any locks.
345 */ 345 */
346 bos = drm_malloc_ab(args->nr_bos, sizeof(*bos)); 346 bos = kvmalloc_array(args->nr_bos, sizeof(*bos), GFP_KERNEL);
347 relocs = drm_malloc_ab(args->nr_relocs, sizeof(*relocs)); 347 relocs = kvmalloc_array(args->nr_relocs, sizeof(*relocs), GFP_KERNEL);
348 stream = drm_malloc_ab(1, args->stream_size); 348 stream = kvmalloc_array(1, args->stream_size, GFP_KERNEL);
349 cmdbuf = etnaviv_cmdbuf_new(gpu->cmdbuf_suballoc, 349 cmdbuf = etnaviv_cmdbuf_new(gpu->cmdbuf_suballoc,
350 ALIGN(args->stream_size, 8) + 8, 350 ALIGN(args->stream_size, 8) + 8,
351 args->nr_bos); 351 args->nr_bos);
@@ -487,11 +487,11 @@ err_submit_cmds:
487 if (cmdbuf) 487 if (cmdbuf)
488 etnaviv_cmdbuf_free(cmdbuf); 488 etnaviv_cmdbuf_free(cmdbuf);
489 if (stream) 489 if (stream)
490 drm_free_large(stream); 490 kvfree(stream);
491 if (bos) 491 if (bos)
492 drm_free_large(bos); 492 kvfree(bos);
493 if (relocs) 493 if (relocs)
494 drm_free_large(relocs); 494 kvfree(relocs);
495 495
496 return ret; 496 return ret;
497} 497}
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
index 55a1579d11b3..c23479be4850 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
@@ -59,7 +59,8 @@ static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem)
59 59
60 nr_pages = exynos_gem->size >> PAGE_SHIFT; 60 nr_pages = exynos_gem->size >> PAGE_SHIFT;
61 61
62 exynos_gem->pages = drm_calloc_large(nr_pages, sizeof(struct page *)); 62 exynos_gem->pages = kvmalloc_array(nr_pages, sizeof(struct page *),
63 GFP_KERNEL | __GFP_ZERO);
63 if (!exynos_gem->pages) { 64 if (!exynos_gem->pages) {
64 DRM_ERROR("failed to allocate pages.\n"); 65 DRM_ERROR("failed to allocate pages.\n");
65 return -ENOMEM; 66 return -ENOMEM;
@@ -101,7 +102,7 @@ err_dma_free:
101 dma_free_attrs(to_dma_dev(dev), exynos_gem->size, exynos_gem->cookie, 102 dma_free_attrs(to_dma_dev(dev), exynos_gem->size, exynos_gem->cookie,
102 exynos_gem->dma_addr, exynos_gem->dma_attrs); 103 exynos_gem->dma_addr, exynos_gem->dma_attrs);
103err_free: 104err_free:
104 drm_free_large(exynos_gem->pages); 105 kvfree(exynos_gem->pages);
105 106
106 return ret; 107 return ret;
107} 108}
@@ -122,7 +123,7 @@ static void exynos_drm_free_buf(struct exynos_drm_gem *exynos_gem)
122 (dma_addr_t)exynos_gem->dma_addr, 123 (dma_addr_t)exynos_gem->dma_addr,
123 exynos_gem->dma_attrs); 124 exynos_gem->dma_attrs);
124 125
125 drm_free_large(exynos_gem->pages); 126 kvfree(exynos_gem->pages);
126} 127}
127 128
128static int exynos_drm_gem_handle_create(struct drm_gem_object *obj, 129static int exynos_drm_gem_handle_create(struct drm_gem_object *obj,
@@ -559,7 +560,7 @@ exynos_drm_gem_prime_import_sg_table(struct drm_device *dev,
559 exynos_gem->dma_addr = sg_dma_address(sgt->sgl); 560 exynos_gem->dma_addr = sg_dma_address(sgt->sgl);
560 561
561 npages = exynos_gem->size >> PAGE_SHIFT; 562 npages = exynos_gem->size >> PAGE_SHIFT;
562 exynos_gem->pages = drm_malloc_ab(npages, sizeof(struct page *)); 563 exynos_gem->pages = kvmalloc_array(npages, sizeof(struct page *), GFP_KERNEL);
563 if (!exynos_gem->pages) { 564 if (!exynos_gem->pages) {
564 ret = -ENOMEM; 565 ret = -ENOMEM;
565 goto err; 566 goto err;
@@ -588,7 +589,7 @@ exynos_drm_gem_prime_import_sg_table(struct drm_device *dev,
588 return &exynos_gem->base; 589 return &exynos_gem->base;
589 590
590err_free_large: 591err_free_large:
591 drm_free_large(exynos_gem->pages); 592 kvfree(exynos_gem->pages);
592err: 593err:
593 drm_gem_object_release(&exynos_gem->base); 594 drm_gem_object_release(&exynos_gem->base);
594 kfree(exynos_gem); 595 kfree(exynos_gem);
diff --git a/drivers/gpu/drm/gma500/Makefile b/drivers/gpu/drm/gma500/Makefile
index 190e55f2f891..c1c8dc18aa53 100644
--- a/drivers/gpu/drm/gma500/Makefile
+++ b/drivers/gpu/drm/gma500/Makefile
@@ -1,7 +1,6 @@
1# 1#
2# KMS driver for the GMA500 2# KMS driver for the GMA500
3# 3#
4ccflags-y += -I$(srctree)/include/drm
5 4
6gma500_gfx-y += \ 5gma500_gfx-y += \
7 accel_2d.o \ 6 accel_2d.o \
diff --git a/drivers/gpu/drm/gma500/mdfld_tpo_vid.c b/drivers/gpu/drm/gma500/mdfld_tpo_vid.c
index d40628e6810d..a9420bf9a419 100644
--- a/drivers/gpu/drm/gma500/mdfld_tpo_vid.c
+++ b/drivers/gpu/drm/gma500/mdfld_tpo_vid.c
@@ -30,8 +30,6 @@
30static struct drm_display_mode *tpo_vid_get_config_mode(struct drm_device *dev) 30static struct drm_display_mode *tpo_vid_get_config_mode(struct drm_device *dev)
31{ 31{
32 struct drm_display_mode *mode; 32 struct drm_display_mode *mode;
33 struct drm_psb_private *dev_priv = dev->dev_private;
34 struct oaktrail_timing_info *ti = &dev_priv->gct_data.DTD;
35 33
36 mode = kzalloc(sizeof(*mode), GFP_KERNEL); 34 mode = kzalloc(sizeof(*mode), GFP_KERNEL);
37 if (!mode) 35 if (!mode)
diff --git a/drivers/gpu/drm/hisilicon/hibmc/Makefile b/drivers/gpu/drm/hisilicon/hibmc/Makefile
index f2e04c035673..3df726696372 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/Makefile
+++ b/drivers/gpu/drm/hisilicon/hibmc/Makefile
@@ -1,4 +1,3 @@
1ccflags-y := -Iinclude/drm
2hibmc-drm-y := hibmc_drm_drv.o hibmc_drm_de.o hibmc_drm_vdac.o hibmc_drm_fbdev.o hibmc_ttm.o 1hibmc-drm-y := hibmc_drm_drv.o hibmc_drm_de.o hibmc_drm_vdac.o hibmc_drm_fbdev.o hibmc_ttm.o
3 2
4obj-$(CONFIG_DRM_HISI_HIBMC) += hibmc-drm.o 3obj-$(CONFIG_DRM_HISI_HIBMC) += hibmc-drm.o
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
index 20732b62d4c9..ac457c779caa 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
@@ -17,7 +17,7 @@
17 */ 17 */
18 18
19#include <drm/drm_atomic_helper.h> 19#include <drm/drm_atomic_helper.h>
20#include <ttm/ttm_page_alloc.h> 20#include <drm/ttm/ttm_page_alloc.h>
21 21
22#include "hibmc_drm_drv.h" 22#include "hibmc_drm_drv.h"
23 23
diff --git a/drivers/gpu/drm/i2c/Makefile b/drivers/gpu/drm/i2c/Makefile
index 43aa33baebed..a77acfc1852e 100644
--- a/drivers/gpu/drm/i2c/Makefile
+++ b/drivers/gpu/drm/i2c/Makefile
@@ -1,5 +1,3 @@
1ccflags-y := -Iinclude/drm
2
3ch7006-y := ch7006_drv.o ch7006_mode.o 1ch7006-y := ch7006_drv.o ch7006_mode.o
4obj-$(CONFIG_DRM_I2C_CH7006) += ch7006.o 2obj-$(CONFIG_DRM_I2C_CH7006) += ch7006.o
5 3
diff --git a/drivers/gpu/drm/i810/Makefile b/drivers/gpu/drm/i810/Makefile
index 43844ecafcc5..639f8596c978 100644
--- a/drivers/gpu/drm/i810/Makefile
+++ b/drivers/gpu/drm/i810/Makefile
@@ -2,7 +2,6 @@
2# Makefile for the drm device driver. This driver provides support for the 2# Makefile for the drm device driver. This driver provides support for the
3# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. 3# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
4 4
5ccflags-y := -Iinclude/drm
6i810-y := i810_drv.o i810_dma.o 5i810-y := i810_drv.o i810_dma.o
7 6
8obj-$(CONFIG_DRM_I810) += i810.o 7obj-$(CONFIG_DRM_I810) += i810.o
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index d689e511744e..1c66108f4333 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -229,7 +229,7 @@ static int i915_gem_stolen_list_info(struct seq_file *m, void *data)
229 int ret; 229 int ret;
230 230
231 total = READ_ONCE(dev_priv->mm.object_count); 231 total = READ_ONCE(dev_priv->mm.object_count);
232 objects = drm_malloc_ab(total, sizeof(*objects)); 232 objects = kvmalloc_array(total, sizeof(*objects), GFP_KERNEL);
233 if (!objects) 233 if (!objects)
234 return -ENOMEM; 234 return -ENOMEM;
235 235
@@ -274,7 +274,7 @@ static int i915_gem_stolen_list_info(struct seq_file *m, void *data)
274 274
275 mutex_unlock(&dev->struct_mutex); 275 mutex_unlock(&dev->struct_mutex);
276out: 276out:
277 drm_free_large(objects); 277 kvfree(objects);
278 return ret; 278 return ret;
279} 279}
280 280
@@ -3095,17 +3095,17 @@ static const char *plane_rotation(unsigned int rotation)
3095{ 3095{
3096 static char buf[48]; 3096 static char buf[48];
3097 /* 3097 /*
3098 * According to doc only one DRM_ROTATE_ is allowed but this 3098 * According to doc only one DRM_MODE_ROTATE_ is allowed but this
3099 * will print them all to visualize if the values are misused 3099 * will print them all to visualize if the values are misused
3100 */ 3100 */
3101 snprintf(buf, sizeof(buf), 3101 snprintf(buf, sizeof(buf),
3102 "%s%s%s%s%s%s(0x%08x)", 3102 "%s%s%s%s%s%s(0x%08x)",
3103 (rotation & DRM_ROTATE_0) ? "0 " : "", 3103 (rotation & DRM_MODE_ROTATE_0) ? "0 " : "",
3104 (rotation & DRM_ROTATE_90) ? "90 " : "", 3104 (rotation & DRM_MODE_ROTATE_90) ? "90 " : "",
3105 (rotation & DRM_ROTATE_180) ? "180 " : "", 3105 (rotation & DRM_MODE_ROTATE_180) ? "180 " : "",
3106 (rotation & DRM_ROTATE_270) ? "270 " : "", 3106 (rotation & DRM_MODE_ROTATE_270) ? "270 " : "",
3107 (rotation & DRM_REFLECT_X) ? "FLIPX " : "", 3107 (rotation & DRM_MODE_REFLECT_X) ? "FLIPX " : "",
3108 (rotation & DRM_REFLECT_Y) ? "FLIPY " : "", 3108 (rotation & DRM_MODE_REFLECT_Y) ? "FLIPY " : "",
3109 rotation); 3109 rotation);
3110 3110
3111 return buf; 3111 return buf;
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index b6ac3df18b58..0e07f35e270c 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2504,7 +2504,7 @@ static void *i915_gem_object_map(const struct drm_i915_gem_object *obj,
2504 2504
2505 if (n_pages > ARRAY_SIZE(stack_pages)) { 2505 if (n_pages > ARRAY_SIZE(stack_pages)) {
2506 /* Too big for stack -- allocate temporary array instead */ 2506 /* Too big for stack -- allocate temporary array instead */
2507 pages = drm_malloc_gfp(n_pages, sizeof(*pages), GFP_TEMPORARY); 2507 pages = kvmalloc_array(n_pages, sizeof(*pages), GFP_TEMPORARY);
2508 if (!pages) 2508 if (!pages)
2509 return NULL; 2509 return NULL;
2510 } 2510 }
@@ -2526,7 +2526,7 @@ static void *i915_gem_object_map(const struct drm_i915_gem_object *obj,
2526 addr = vmap(pages, n_pages, 0, pgprot); 2526 addr = vmap(pages, n_pages, 0, pgprot);
2527 2527
2528 if (pages != stack_pages) 2528 if (pages != stack_pages)
2529 drm_free_large(pages); 2529 kvfree(pages);
2530 2530
2531 return addr; 2531 return addr;
2532} 2532}
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index a3e59c8ef27b..4ee2dc38b7c9 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -1019,11 +1019,11 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev,
1019 for (i = 0; i < count; i++) 1019 for (i = 0; i < count; i++)
1020 total += exec[i].relocation_count; 1020 total += exec[i].relocation_count;
1021 1021
1022 reloc_offset = drm_malloc_ab(count, sizeof(*reloc_offset)); 1022 reloc_offset = kvmalloc_array(count, sizeof(*reloc_offset), GFP_KERNEL);
1023 reloc = drm_malloc_ab(total, sizeof(*reloc)); 1023 reloc = kvmalloc_array(total, sizeof(*reloc), GFP_KERNEL);
1024 if (reloc == NULL || reloc_offset == NULL) { 1024 if (reloc == NULL || reloc_offset == NULL) {
1025 drm_free_large(reloc); 1025 kvfree(reloc);
1026 drm_free_large(reloc_offset); 1026 kvfree(reloc_offset);
1027 mutex_lock(&dev->struct_mutex); 1027 mutex_lock(&dev->struct_mutex);
1028 return -ENOMEM; 1028 return -ENOMEM;
1029 } 1029 }
@@ -1099,8 +1099,8 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev,
1099 */ 1099 */
1100 1100
1101err: 1101err:
1102 drm_free_large(reloc); 1102 kvfree(reloc);
1103 drm_free_large(reloc_offset); 1103 kvfree(reloc_offset);
1104 return ret; 1104 return ret;
1105} 1105}
1106 1106
@@ -1859,13 +1859,13 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
1859 } 1859 }
1860 1860
1861 /* Copy in the exec list from userland */ 1861 /* Copy in the exec list from userland */
1862 exec_list = drm_malloc_ab(sizeof(*exec_list), args->buffer_count); 1862 exec_list = kvmalloc_array(sizeof(*exec_list), args->buffer_count, GFP_KERNEL);
1863 exec2_list = drm_malloc_ab(sizeof(*exec2_list), args->buffer_count); 1863 exec2_list = kvmalloc_array(sizeof(*exec2_list), args->buffer_count, GFP_KERNEL);
1864 if (exec_list == NULL || exec2_list == NULL) { 1864 if (exec_list == NULL || exec2_list == NULL) {
1865 DRM_DEBUG("Failed to allocate exec list for %d buffers\n", 1865 DRM_DEBUG("Failed to allocate exec list for %d buffers\n",
1866 args->buffer_count); 1866 args->buffer_count);
1867 drm_free_large(exec_list); 1867 kvfree(exec_list);
1868 drm_free_large(exec2_list); 1868 kvfree(exec2_list);
1869 return -ENOMEM; 1869 return -ENOMEM;
1870 } 1870 }
1871 ret = copy_from_user(exec_list, 1871 ret = copy_from_user(exec_list,
@@ -1874,8 +1874,8 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
1874 if (ret != 0) { 1874 if (ret != 0) {
1875 DRM_DEBUG("copy %d exec entries failed %d\n", 1875 DRM_DEBUG("copy %d exec entries failed %d\n",
1876 args->buffer_count, ret); 1876 args->buffer_count, ret);
1877 drm_free_large(exec_list); 1877 kvfree(exec_list);
1878 drm_free_large(exec2_list); 1878 kvfree(exec2_list);
1879 return -EFAULT; 1879 return -EFAULT;
1880 } 1880 }
1881 1881
@@ -1924,8 +1924,8 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
1924 } 1924 }
1925 } 1925 }
1926 1926
1927 drm_free_large(exec_list); 1927 kvfree(exec_list);
1928 drm_free_large(exec2_list); 1928 kvfree(exec2_list);
1929 return ret; 1929 return ret;
1930} 1930}
1931 1931
@@ -1943,7 +1943,7 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data,
1943 return -EINVAL; 1943 return -EINVAL;
1944 } 1944 }
1945 1945
1946 exec2_list = drm_malloc_gfp(args->buffer_count, 1946 exec2_list = kvmalloc_array(args->buffer_count,
1947 sizeof(*exec2_list), 1947 sizeof(*exec2_list),
1948 GFP_TEMPORARY); 1948 GFP_TEMPORARY);
1949 if (exec2_list == NULL) { 1949 if (exec2_list == NULL) {
@@ -1957,7 +1957,7 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data,
1957 if (ret != 0) { 1957 if (ret != 0) {
1958 DRM_DEBUG("copy %d exec entries failed %d\n", 1958 DRM_DEBUG("copy %d exec entries failed %d\n",
1959 args->buffer_count, ret); 1959 args->buffer_count, ret);
1960 drm_free_large(exec2_list); 1960 kvfree(exec2_list);
1961 return -EFAULT; 1961 return -EFAULT;
1962 } 1962 }
1963 1963
@@ -1984,6 +1984,6 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data,
1984 } 1984 }
1985 } 1985 }
1986 1986
1987 drm_free_large(exec2_list); 1987 kvfree(exec2_list);
1988 return ret; 1988 return ret;
1989} 1989}
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 2aa6b97fd22f..7e3193aa7da1 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -3102,7 +3102,7 @@ intel_rotate_pages(struct intel_rotation_info *rot_info,
3102 int ret = -ENOMEM; 3102 int ret = -ENOMEM;
3103 3103
3104 /* Allocate a temporary list of source pages for random access. */ 3104 /* Allocate a temporary list of source pages for random access. */
3105 page_addr_list = drm_malloc_gfp(n_pages, 3105 page_addr_list = kvmalloc_array(n_pages,
3106 sizeof(dma_addr_t), 3106 sizeof(dma_addr_t),
3107 GFP_TEMPORARY); 3107 GFP_TEMPORARY);
3108 if (!page_addr_list) 3108 if (!page_addr_list)
@@ -3135,14 +3135,14 @@ intel_rotate_pages(struct intel_rotation_info *rot_info,
3135 DRM_DEBUG_KMS("Created rotated page mapping for object size %zu (%ux%u tiles, %u pages)\n", 3135 DRM_DEBUG_KMS("Created rotated page mapping for object size %zu (%ux%u tiles, %u pages)\n",
3136 obj->base.size, rot_info->plane[0].width, rot_info->plane[0].height, size); 3136 obj->base.size, rot_info->plane[0].width, rot_info->plane[0].height, size);
3137 3137
3138 drm_free_large(page_addr_list); 3138 kvfree(page_addr_list);
3139 3139
3140 return st; 3140 return st;
3141 3141
3142err_sg_alloc: 3142err_sg_alloc:
3143 kfree(st); 3143 kfree(st);
3144err_st_alloc: 3144err_st_alloc:
3145 drm_free_large(page_addr_list); 3145 kvfree(page_addr_list);
3146 3146
3147 DRM_DEBUG_KMS("Failed to create rotated mapping for object size %zu! (%ux%u tiles, %u pages)\n", 3147 DRM_DEBUG_KMS("Failed to create rotated mapping for object size %zu! (%ux%u tiles, %u pages)\n",
3148 obj->base.size, rot_info->plane[0].width, rot_info->plane[0].height, size); 3148 obj->base.size, rot_info->plane[0].width, rot_info->plane[0].height, size);
diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c
index 58ccf8b8ca1c..1a0ce1dc68f5 100644
--- a/drivers/gpu/drm/i915/i915_gem_userptr.c
+++ b/drivers/gpu/drm/i915/i915_gem_userptr.c
@@ -507,7 +507,7 @@ __i915_gem_userptr_get_pages_worker(struct work_struct *_work)
507 ret = -ENOMEM; 507 ret = -ENOMEM;
508 pinned = 0; 508 pinned = 0;
509 509
510 pvec = drm_malloc_gfp(npages, sizeof(struct page *), GFP_TEMPORARY); 510 pvec = kvmalloc_array(npages, sizeof(struct page *), GFP_TEMPORARY);
511 if (pvec != NULL) { 511 if (pvec != NULL) {
512 struct mm_struct *mm = obj->userptr.mm->mm; 512 struct mm_struct *mm = obj->userptr.mm->mm;
513 unsigned int flags = 0; 513 unsigned int flags = 0;
@@ -555,7 +555,7 @@ __i915_gem_userptr_get_pages_worker(struct work_struct *_work)
555 mutex_unlock(&obj->mm.lock); 555 mutex_unlock(&obj->mm.lock);
556 556
557 release_pages(pvec, pinned, 0); 557 release_pages(pvec, pinned, 0);
558 drm_free_large(pvec); 558 kvfree(pvec);
559 559
560 i915_gem_object_put(obj); 560 i915_gem_object_put(obj);
561 put_task_struct(work->task); 561 put_task_struct(work->task);
@@ -642,7 +642,7 @@ i915_gem_userptr_get_pages(struct drm_i915_gem_object *obj)
642 pinned = 0; 642 pinned = 0;
643 643
644 if (mm == current->mm) { 644 if (mm == current->mm) {
645 pvec = drm_malloc_gfp(num_pages, sizeof(struct page *), 645 pvec = kvmalloc_array(num_pages, sizeof(struct page *),
646 GFP_TEMPORARY | 646 GFP_TEMPORARY |
647 __GFP_NORETRY | 647 __GFP_NORETRY |
648 __GFP_NOWARN); 648 __GFP_NOWARN);
@@ -669,7 +669,7 @@ i915_gem_userptr_get_pages(struct drm_i915_gem_object *obj)
669 669
670 if (IS_ERR(pages)) 670 if (IS_ERR(pages))
671 release_pages(pvec, pinned, 0); 671 release_pages(pvec, pinned, 0);
672 drm_free_large(pvec); 672 kvfree(pvec);
673 673
674 return pages; 674 return pages;
675} 675}
diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
index cfb47293fd53..a40c82c65450 100644
--- a/drivers/gpu/drm/i915/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
@@ -55,7 +55,7 @@ intel_create_plane_state(struct drm_plane *plane)
55 return NULL; 55 return NULL;
56 56
57 state->base.plane = plane; 57 state->base.plane = plane;
58 state->base.rotation = DRM_ROTATE_0; 58 state->base.rotation = DRM_MODE_ROTATE_0;
59 state->ckey.flags = I915_SET_COLORKEY_NONE; 59 state->ckey.flags = I915_SET_COLORKEY_NONE;
60 60
61 return state; 61 return state;
@@ -178,8 +178,8 @@ int intel_plane_atomic_check_with_state(struct intel_crtc_state *crtc_state,
178 178
179 /* CHV ignores the mirror bit when the rotate bit is set :( */ 179 /* CHV ignores the mirror bit when the rotate bit is set :( */
180 if (IS_CHERRYVIEW(dev_priv) && 180 if (IS_CHERRYVIEW(dev_priv) &&
181 state->rotation & DRM_ROTATE_180 && 181 state->rotation & DRM_MODE_ROTATE_180 &&
182 state->rotation & DRM_REFLECT_X) { 182 state->rotation & DRM_MODE_REFLECT_X) {
183 DRM_DEBUG_KMS("Cannot rotate and reflect at the same time\n"); 183 DRM_DEBUG_KMS("Cannot rotate and reflect at the same time\n");
184 return -EINVAL; 184 return -EINVAL;
185 } 185 }
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 2f2bb623cf5f..6a037b856d96 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2468,7 +2468,7 @@ intel_fill_fb_info(struct drm_i915_private *dev_priv,
2468 2468
2469 offset = _intel_compute_tile_offset(dev_priv, &x, &y, 2469 offset = _intel_compute_tile_offset(dev_priv, &x, &y,
2470 fb, i, fb->pitches[i], 2470 fb, i, fb->pitches[i],
2471 DRM_ROTATE_0, tile_size); 2471 DRM_MODE_ROTATE_0, tile_size);
2472 offset /= tile_size; 2472 offset /= tile_size;
2473 2473
2474 if (fb->modifier != DRM_FORMAT_MOD_LINEAR) { 2474 if (fb->modifier != DRM_FORMAT_MOD_LINEAR) {
@@ -2503,7 +2503,7 @@ intel_fill_fb_info(struct drm_i915_private *dev_priv,
2503 drm_rect_rotate(&r, 2503 drm_rect_rotate(&r,
2504 rot_info->plane[i].width * tile_width, 2504 rot_info->plane[i].width * tile_width,
2505 rot_info->plane[i].height * tile_height, 2505 rot_info->plane[i].height * tile_height,
2506 DRM_ROTATE_270); 2506 DRM_MODE_ROTATE_270);
2507 x = r.x1; 2507 x = r.x1;
2508 y = r.y1; 2508 y = r.y1;
2509 2509
@@ -2939,7 +2939,7 @@ int skl_check_plane_surface(struct intel_plane_state *plane_state)
2939 if (drm_rotation_90_or_270(rotation)) 2939 if (drm_rotation_90_or_270(rotation))
2940 drm_rect_rotate(&plane_state->base.src, 2940 drm_rect_rotate(&plane_state->base.src,
2941 fb->width << 16, fb->height << 16, 2941 fb->width << 16, fb->height << 16,
2942 DRM_ROTATE_270); 2942 DRM_MODE_ROTATE_270);
2943 2943
2944 /* 2944 /*
2945 * Handle the AUX surface first since 2945 * Handle the AUX surface first since
@@ -3017,10 +3017,10 @@ static u32 i9xx_plane_ctl(const struct intel_crtc_state *crtc_state,
3017 fb->modifier == I915_FORMAT_MOD_X_TILED) 3017 fb->modifier == I915_FORMAT_MOD_X_TILED)
3018 dspcntr |= DISPPLANE_TILED; 3018 dspcntr |= DISPPLANE_TILED;
3019 3019
3020 if (rotation & DRM_ROTATE_180) 3020 if (rotation & DRM_MODE_ROTATE_180)
3021 dspcntr |= DISPPLANE_ROTATE_180; 3021 dspcntr |= DISPPLANE_ROTATE_180;
3022 3022
3023 if (rotation & DRM_REFLECT_X) 3023 if (rotation & DRM_MODE_REFLECT_X)
3024 dspcntr |= DISPPLANE_MIRROR; 3024 dspcntr |= DISPPLANE_MIRROR;
3025 3025
3026 return dspcntr; 3026 return dspcntr;
@@ -3048,10 +3048,10 @@ int i9xx_check_plane_surface(struct intel_plane_state *plane_state)
3048 int src_w = drm_rect_width(&plane_state->base.src) >> 16; 3048 int src_w = drm_rect_width(&plane_state->base.src) >> 16;
3049 int src_h = drm_rect_height(&plane_state->base.src) >> 16; 3049 int src_h = drm_rect_height(&plane_state->base.src) >> 16;
3050 3050
3051 if (rotation & DRM_ROTATE_180) { 3051 if (rotation & DRM_MODE_ROTATE_180) {
3052 src_x += src_w - 1; 3052 src_x += src_w - 1;
3053 src_y += src_h - 1; 3053 src_y += src_h - 1;
3054 } else if (rotation & DRM_REFLECT_X) { 3054 } else if (rotation & DRM_MODE_REFLECT_X) {
3055 src_x += src_w - 1; 3055 src_x += src_w - 1;
3056 } 3056 }
3057 } 3057 }
@@ -3271,17 +3271,17 @@ static u32 skl_plane_ctl_tiling(uint64_t fb_modifier)
3271static u32 skl_plane_ctl_rotation(unsigned int rotation) 3271static u32 skl_plane_ctl_rotation(unsigned int rotation)
3272{ 3272{
3273 switch (rotation) { 3273 switch (rotation) {
3274 case DRM_ROTATE_0: 3274 case DRM_MODE_ROTATE_0:
3275 break; 3275 break;
3276 /* 3276 /*
3277 * DRM_ROTATE_ is counter clockwise to stay compatible with Xrandr 3277 * DRM_MODE_ROTATE_ is counter clockwise to stay compatible with Xrandr
3278 * while i915 HW rotation is clockwise, thats why this swapping. 3278 * while i915 HW rotation is clockwise, thats why this swapping.
3279 */ 3279 */
3280 case DRM_ROTATE_90: 3280 case DRM_MODE_ROTATE_90:
3281 return PLANE_CTL_ROTATE_270; 3281 return PLANE_CTL_ROTATE_270;
3282 case DRM_ROTATE_180: 3282 case DRM_MODE_ROTATE_180:
3283 return PLANE_CTL_ROTATE_180; 3283 return PLANE_CTL_ROTATE_180;
3284 case DRM_ROTATE_270: 3284 case DRM_MODE_ROTATE_270:
3285 return PLANE_CTL_ROTATE_90; 3285 return PLANE_CTL_ROTATE_90;
3286 default: 3286 default:
3287 MISSING_CASE(rotation); 3287 MISSING_CASE(rotation);
@@ -4671,7 +4671,7 @@ int skl_update_scaler_crtc(struct intel_crtc_state *state)
4671 const struct drm_display_mode *adjusted_mode = &state->base.adjusted_mode; 4671 const struct drm_display_mode *adjusted_mode = &state->base.adjusted_mode;
4672 4672
4673 return skl_update_scaler(state, !state->base.active, SKL_CRTC_INDEX, 4673 return skl_update_scaler(state, !state->base.active, SKL_CRTC_INDEX,
4674 &state->scaler_state.scaler_id, DRM_ROTATE_0, 4674 &state->scaler_state.scaler_id, DRM_MODE_ROTATE_0,
4675 state->pipe_src_w, state->pipe_src_h, 4675 state->pipe_src_w, state->pipe_src_h,
4676 adjusted_mode->crtc_hdisplay, adjusted_mode->crtc_vdisplay); 4676 adjusted_mode->crtc_hdisplay, adjusted_mode->crtc_vdisplay);
4677} 4677}
@@ -9239,7 +9239,7 @@ static u32 i9xx_cursor_ctl(const struct intel_crtc_state *crtc_state,
9239 return 0; 9239 return 0;
9240 } 9240 }
9241 9241
9242 if (plane_state->base.rotation & DRM_ROTATE_180) 9242 if (plane_state->base.rotation & DRM_MODE_ROTATE_180)
9243 cntl |= CURSOR_ROTATE_180; 9243 cntl |= CURSOR_ROTATE_180;
9244 9244
9245 return cntl; 9245 return cntl;
@@ -9300,7 +9300,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
9300 9300
9301 /* ILK+ do this automagically */ 9301 /* ILK+ do this automagically */
9302 if (HAS_GMCH_DISPLAY(dev_priv) && 9302 if (HAS_GMCH_DISPLAY(dev_priv) &&
9303 plane_state->base.rotation & DRM_ROTATE_180) { 9303 plane_state->base.rotation & DRM_MODE_ROTATE_180) {
9304 base += (plane_state->base.crtc_h * 9304 base += (plane_state->base.crtc_h *
9305 plane_state->base.crtc_w - 1) * 4; 9305 plane_state->base.crtc_w - 1) * 4;
9306 } 9306 }
@@ -13607,22 +13607,22 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
13607 13607
13608 if (INTEL_GEN(dev_priv) >= 9) { 13608 if (INTEL_GEN(dev_priv) >= 9) {
13609 supported_rotations = 13609 supported_rotations =
13610 DRM_ROTATE_0 | DRM_ROTATE_90 | 13610 DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 |
13611 DRM_ROTATE_180 | DRM_ROTATE_270; 13611 DRM_MODE_ROTATE_180 | DRM_MODE_ROTATE_270;
13612 } else if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_B) { 13612 } else if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_B) {
13613 supported_rotations = 13613 supported_rotations =
13614 DRM_ROTATE_0 | DRM_ROTATE_180 | 13614 DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_180 |
13615 DRM_REFLECT_X; 13615 DRM_MODE_REFLECT_X;
13616 } else if (INTEL_GEN(dev_priv) >= 4) { 13616 } else if (INTEL_GEN(dev_priv) >= 4) {
13617 supported_rotations = 13617 supported_rotations =
13618 DRM_ROTATE_0 | DRM_ROTATE_180; 13618 DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_180;
13619 } else { 13619 } else {
13620 supported_rotations = DRM_ROTATE_0; 13620 supported_rotations = DRM_MODE_ROTATE_0;
13621 } 13621 }
13622 13622
13623 if (INTEL_GEN(dev_priv) >= 4) 13623 if (INTEL_GEN(dev_priv) >= 4)
13624 drm_plane_create_rotation_property(&primary->base, 13624 drm_plane_create_rotation_property(&primary->base,
13625 DRM_ROTATE_0, 13625 DRM_MODE_ROTATE_0,
13626 supported_rotations); 13626 supported_rotations);
13627 13627
13628 drm_plane_helper_add(&primary->base, &intel_plane_helper_funcs); 13628 drm_plane_helper_add(&primary->base, &intel_plane_helper_funcs);
@@ -13777,9 +13777,9 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
13777 13777
13778 if (INTEL_GEN(dev_priv) >= 4) 13778 if (INTEL_GEN(dev_priv) >= 4)
13779 drm_plane_create_rotation_property(&cursor->base, 13779 drm_plane_create_rotation_property(&cursor->base,
13780 DRM_ROTATE_0, 13780 DRM_MODE_ROTATE_0,
13781 DRM_ROTATE_0 | 13781 DRM_MODE_ROTATE_0 |
13782 DRM_ROTATE_180); 13782 DRM_MODE_ROTATE_180);
13783 13783
13784 if (INTEL_GEN(dev_priv) >= 9) 13784 if (INTEL_GEN(dev_priv) >= 9)
13785 state->scaler_id = -1; 13785 state->scaler_id = -1;
diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
index ded2add18b26..db7f8f0a1f36 100644
--- a/drivers/gpu/drm/i915/intel_fbc.c
+++ b/drivers/gpu/drm/i915/intel_fbc.c
@@ -801,7 +801,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
801 return false; 801 return false;
802 } 802 }
803 if (INTEL_GEN(dev_priv) <= 4 && !IS_G4X(dev_priv) && 803 if (INTEL_GEN(dev_priv) <= 4 && !IS_G4X(dev_priv) &&
804 cache->plane.rotation != DRM_ROTATE_0) { 804 cache->plane.rotation != DRM_MODE_ROTATE_0) {
805 fbc->no_fbc_reason = "rotation unsupported"; 805 fbc->no_fbc_reason = "rotation unsupported";
806 return false; 806 return false;
807 } 807 }
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 332254a8eebe..03347c6ae599 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -211,7 +211,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
211 * This also validates that any existing fb inherited from the 211 * This also validates that any existing fb inherited from the
212 * BIOS is suitable for own access. 212 * BIOS is suitable for own access.
213 */ 213 */
214 vma = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0); 214 vma = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, DRM_MODE_ROTATE_0);
215 if (IS_ERR(vma)) { 215 if (IS_ERR(vma)) {
216 ret = PTR_ERR(vma); 216 ret = PTR_ERR(vma);
217 goto out_unlock; 217 goto out_unlock;
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 8c87c717c7cd..191e14ddde0c 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -398,10 +398,10 @@ static u32 vlv_sprite_ctl(const struct intel_crtc_state *crtc_state,
398 if (fb->modifier == I915_FORMAT_MOD_X_TILED) 398 if (fb->modifier == I915_FORMAT_MOD_X_TILED)
399 sprctl |= SP_TILED; 399 sprctl |= SP_TILED;
400 400
401 if (rotation & DRM_ROTATE_180) 401 if (rotation & DRM_MODE_ROTATE_180)
402 sprctl |= SP_ROTATE_180; 402 sprctl |= SP_ROTATE_180;
403 403
404 if (rotation & DRM_REFLECT_X) 404 if (rotation & DRM_MODE_REFLECT_X)
405 sprctl |= SP_MIRROR; 405 sprctl |= SP_MIRROR;
406 406
407 if (key->flags & I915_SET_COLORKEY_SOURCE) 407 if (key->flags & I915_SET_COLORKEY_SOURCE)
@@ -533,7 +533,7 @@ static u32 ivb_sprite_ctl(const struct intel_crtc_state *crtc_state,
533 if (fb->modifier == I915_FORMAT_MOD_X_TILED) 533 if (fb->modifier == I915_FORMAT_MOD_X_TILED)
534 sprctl |= SPRITE_TILED; 534 sprctl |= SPRITE_TILED;
535 535
536 if (rotation & DRM_ROTATE_180) 536 if (rotation & DRM_MODE_ROTATE_180)
537 sprctl |= SPRITE_ROTATE_180; 537 sprctl |= SPRITE_ROTATE_180;
538 538
539 if (key->flags & I915_SET_COLORKEY_DESTINATION) 539 if (key->flags & I915_SET_COLORKEY_DESTINATION)
@@ -674,7 +674,7 @@ static u32 ilk_sprite_ctl(const struct intel_crtc_state *crtc_state,
674 if (fb->modifier == I915_FORMAT_MOD_X_TILED) 674 if (fb->modifier == I915_FORMAT_MOD_X_TILED)
675 dvscntr |= DVS_TILED; 675 dvscntr |= DVS_TILED;
676 676
677 if (rotation & DRM_ROTATE_180) 677 if (rotation & DRM_MODE_ROTATE_180)
678 dvscntr |= DVS_ROTATE_180; 678 dvscntr |= DVS_ROTATE_180;
679 679
680 if (key->flags & I915_SET_COLORKEY_DESTINATION) 680 if (key->flags & I915_SET_COLORKEY_DESTINATION)
@@ -1145,15 +1145,15 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,
1145 1145
1146 if (INTEL_GEN(dev_priv) >= 9) { 1146 if (INTEL_GEN(dev_priv) >= 9) {
1147 supported_rotations = 1147 supported_rotations =
1148 DRM_ROTATE_0 | DRM_ROTATE_90 | 1148 DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 |
1149 DRM_ROTATE_180 | DRM_ROTATE_270; 1149 DRM_MODE_ROTATE_180 | DRM_MODE_ROTATE_270;
1150 } else if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_B) { 1150 } else if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_B) {
1151 supported_rotations = 1151 supported_rotations =
1152 DRM_ROTATE_0 | DRM_ROTATE_180 | 1152 DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_180 |
1153 DRM_REFLECT_X; 1153 DRM_MODE_REFLECT_X;
1154 } else { 1154 } else {
1155 supported_rotations = 1155 supported_rotations =
1156 DRM_ROTATE_0 | DRM_ROTATE_180; 1156 DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_180;
1157 } 1157 }
1158 1158
1159 intel_plane->pipe = pipe; 1159 intel_plane->pipe = pipe;
@@ -1180,7 +1180,7 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,
1180 goto fail; 1180 goto fail;
1181 1181
1182 drm_plane_create_rotation_property(&intel_plane->base, 1182 drm_plane_create_rotation_property(&intel_plane->base,
1183 DRM_ROTATE_0, 1183 DRM_MODE_ROTATE_0,
1184 supported_rotations); 1184 supported_rotations);
1185 1185
1186 drm_plane_helper_add(&intel_plane->base, &intel_plane_helper_funcs); 1186 drm_plane_helper_add(&intel_plane->base, &intel_plane_helper_funcs);
diff --git a/drivers/gpu/drm/i915/selftests/intel_breadcrumbs.c b/drivers/gpu/drm/i915/selftests/intel_breadcrumbs.c
index 19860a372d90..7276194c04f7 100644
--- a/drivers/gpu/drm/i915/selftests/intel_breadcrumbs.c
+++ b/drivers/gpu/drm/i915/selftests/intel_breadcrumbs.c
@@ -117,7 +117,7 @@ static int igt_random_insert_remove(void *arg)
117 117
118 mock_engine_reset(engine); 118 mock_engine_reset(engine);
119 119
120 waiters = drm_malloc_gfp(count, sizeof(*waiters), GFP_TEMPORARY); 120 waiters = kvmalloc_array(count, sizeof(*waiters), GFP_TEMPORARY);
121 if (!waiters) 121 if (!waiters)
122 goto out_engines; 122 goto out_engines;
123 123
@@ -169,7 +169,7 @@ out_order:
169out_bitmap: 169out_bitmap:
170 kfree(bitmap); 170 kfree(bitmap);
171out_waiters: 171out_waiters:
172 drm_free_large(waiters); 172 kvfree(waiters);
173out_engines: 173out_engines:
174 mock_engine_flush(engine); 174 mock_engine_flush(engine);
175 return err; 175 return err;
@@ -187,7 +187,7 @@ static int igt_insert_complete(void *arg)
187 187
188 mock_engine_reset(engine); 188 mock_engine_reset(engine);
189 189
190 waiters = drm_malloc_gfp(count, sizeof(*waiters), GFP_TEMPORARY); 190 waiters = kvmalloc_array(count, sizeof(*waiters), GFP_TEMPORARY);
191 if (!waiters) 191 if (!waiters)
192 goto out_engines; 192 goto out_engines;
193 193
@@ -254,7 +254,7 @@ static int igt_insert_complete(void *arg)
254out_bitmap: 254out_bitmap:
255 kfree(bitmap); 255 kfree(bitmap);
256out_waiters: 256out_waiters:
257 drm_free_large(waiters); 257 kvfree(waiters);
258out_engines: 258out_engines:
259 mock_engine_flush(engine); 259 mock_engine_flush(engine);
260 return err; 260 return err;
@@ -368,7 +368,7 @@ static int igt_wakeup(void *arg)
368 368
369 mock_engine_reset(engine); 369 mock_engine_reset(engine);
370 370
371 waiters = drm_malloc_gfp(count, sizeof(*waiters), GFP_TEMPORARY); 371 waiters = kvmalloc_array(count, sizeof(*waiters), GFP_TEMPORARY);
372 if (!waiters) 372 if (!waiters)
373 goto out_engines; 373 goto out_engines;
374 374
@@ -454,7 +454,7 @@ out_waiters:
454 put_task_struct(waiters[n].tsk); 454 put_task_struct(waiters[n].tsk);
455 } 455 }
456 456
457 drm_free_large(waiters); 457 kvfree(waiters);
458out_engines: 458out_engines:
459 mock_engine_flush(engine); 459 mock_engine_flush(engine);
460 return err; 460 return err;
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c
index d63e853a0300..49546222c6d3 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -273,7 +273,7 @@ void ipu_plane_state_reset(struct drm_plane *plane)
273 273
274 if (ipu_state) { 274 if (ipu_state) {
275 ipu_state->base.plane = plane; 275 ipu_state->base.plane = plane;
276 ipu_state->base.rotation = DRM_ROTATE_0; 276 ipu_state->base.rotation = DRM_MODE_ROTATE_0;
277 } 277 }
278 278
279 plane->state = &ipu_state->base; 279 plane->state = &ipu_state->base;
diff --git a/drivers/gpu/drm/mga/Makefile b/drivers/gpu/drm/mga/Makefile
index 60684785c203..49e972c2f787 100644
--- a/drivers/gpu/drm/mga/Makefile
+++ b/drivers/gpu/drm/mga/Makefile
@@ -2,7 +2,6 @@
2# Makefile for the drm device driver. This driver provides support for the 2# Makefile for the drm device driver. This driver provides support for the
3# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. 3# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
4 4
5ccflags-y := -Iinclude/drm
6mga-y := mga_drv.o mga_dma.o mga_state.o mga_warp.o mga_irq.o 5mga-y := mga_drv.o mga_dma.o mga_state.o mga_warp.o mga_irq.o
7 6
8mga-$(CONFIG_COMPAT) += mga_ioc32.o 7mga-$(CONFIG_COMPAT) += mga_ioc32.o
diff --git a/drivers/gpu/drm/mgag200/Makefile b/drivers/gpu/drm/mgag200/Makefile
index a9a0300f09fc..3d91d1d6c45d 100644
--- a/drivers/gpu/drm/mgag200/Makefile
+++ b/drivers/gpu/drm/mgag200/Makefile
@@ -1,4 +1,3 @@
1ccflags-y := -Iinclude/drm
2mgag200-y := mgag200_main.o mgag200_mode.o mgag200_cursor.o \ 1mgag200-y := mgag200_main.o mgag200_mode.o mgag200_cursor.o \
3 mgag200_drv.o mgag200_fb.o mgag200_i2c.o mgag200_ttm.o 2 mgag200_drv.o mgag200_fb.o mgag200_i2c.o mgag200_ttm.o
4 3
diff --git a/drivers/gpu/drm/mgag200/mgag200_ttm.c b/drivers/gpu/drm/mgag200/mgag200_ttm.c
index 565a217b46f2..3e7e1cd31395 100644
--- a/drivers/gpu/drm/mgag200/mgag200_ttm.c
+++ b/drivers/gpu/drm/mgag200/mgag200_ttm.c
@@ -26,8 +26,9 @@
26 * Authors: Dave Airlie <airlied@redhat.com> 26 * Authors: Dave Airlie <airlied@redhat.com>
27 */ 27 */
28#include <drm/drmP.h> 28#include <drm/drmP.h>
29#include <drm/ttm/ttm_page_alloc.h>
30
29#include "mgag200_drv.h" 31#include "mgag200_drv.h"
30#include <ttm/ttm_page_alloc.h>
31 32
32static inline struct mga_device * 33static inline struct mga_device *
33mgag200_bdev(struct ttm_bo_device *bd) 34mgag200_bdev(struct ttm_bo_device *bd)
diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile
index 5241ac8803ba..33008fa1be9b 100644
--- a/drivers/gpu/drm/msm/Makefile
+++ b/drivers/gpu/drm/msm/Makefile
@@ -1,4 +1,4 @@
1ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/msm 1ccflags-y := -Idrivers/gpu/drm/msm
2ccflags-$(CONFIG_DRM_MSM_DSI) += -Idrivers/gpu/drm/msm/dsi 2ccflags-$(CONFIG_DRM_MSM_DSI) += -Idrivers/gpu/drm/msm/dsi
3 3
4msm-y := \ 4msm-y := \
diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h
index 32369975d155..9e6017387efb 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.h
+++ b/drivers/gpu/drm/msm/dsi/dsi.h
@@ -17,9 +17,9 @@
17#include <linux/of_platform.h> 17#include <linux/of_platform.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19 19
20#include "drm_crtc.h" 20#include <drm/drm_crtc.h>
21#include "drm_mipi_dsi.h" 21#include <drm/drm_mipi_dsi.h>
22#include "drm_panel.h" 22#include <drm/drm_panel.h>
23 23
24#include "msm_drv.h" 24#include "msm_drv.h"
25 25
diff --git a/drivers/gpu/drm/msm/edp/edp.h b/drivers/gpu/drm/msm/edp/edp.h
index ba5bedde5241..e0f5818ec9ca 100644
--- a/drivers/gpu/drm/msm/edp/edp.h
+++ b/drivers/gpu/drm/msm/edp/edp.h
@@ -18,9 +18,9 @@
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <drm/drm_crtc.h>
22#include <drm/drm_dp_helper.h>
21 23
22#include "drm_crtc.h"
23#include "drm_dp_helper.h"
24#include "msm_drv.h" 24#include "msm_drv.h"
25 25
26#define edp_read(offset) msm_readl((offset)) 26#define edp_read(offset) msm_readl((offset))
diff --git a/drivers/gpu/drm/msm/edp/edp_ctrl.c b/drivers/gpu/drm/msm/edp/edp_ctrl.c
index 149bfe7ddd82..e32a4a4f3797 100644
--- a/drivers/gpu/drm/msm/edp/edp_ctrl.c
+++ b/drivers/gpu/drm/msm/edp/edp_ctrl.c
@@ -14,10 +14,10 @@
14#include <linux/clk.h> 14#include <linux/clk.h>
15#include <linux/gpio/consumer.h> 15#include <linux/gpio/consumer.h>
16#include <linux/regulator/consumer.h> 16#include <linux/regulator/consumer.h>
17#include <drm/drm_crtc.h>
18#include <drm/drm_dp_helper.h>
19#include <drm/drm_edid.h>
17 20
18#include "drm_crtc.h"
19#include "drm_dp_helper.h"
20#include "drm_edid.h"
21#include "edp.h" 21#include "edp.h"
22#include "edp.xml.h" 22#include "edp.xml.h"
23 23
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
index f29194a74a19..698e514203c6 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
@@ -15,12 +15,12 @@
15 * this program. If not, see <http://www.gnu.org/licenses/>. 15 * this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18#include "mdp4_kms.h" 18#include <drm/drm_crtc.h>
19 19#include <drm/drm_crtc_helper.h>
20#include <drm/drm_flip_work.h>
20#include <drm/drm_mode.h> 21#include <drm/drm_mode.h>
21#include "drm_crtc.h" 22
22#include "drm_crtc_helper.h" 23#include "mdp4_kms.h"
23#include "drm_flip_work.h"
24 24
25struct mdp4_crtc { 25struct mdp4_crtc {
26 struct drm_crtc base; 26 struct drm_crtc base;
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c
index 106f0e772595..6a1ebdace391 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c
@@ -17,10 +17,10 @@
17 * this program. If not, see <http://www.gnu.org/licenses/>. 17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */ 18 */
19 19
20#include "mdp4_kms.h" 20#include <drm/drm_crtc.h>
21#include <drm/drm_crtc_helper.h>
21 22
22#include "drm_crtc.h" 23#include "mdp4_kms.h"
23#include "drm_crtc_helper.h"
24 24
25struct mdp4_dsi_encoder { 25struct mdp4_dsi_encoder {
26 struct drm_encoder base; 26 struct drm_encoder base;
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c
index 24258e3025e3..ba8e587f734b 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c
@@ -15,11 +15,10 @@
15 * this program. If not, see <http://www.gnu.org/licenses/>. 15 * this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18#include "mdp4_kms.h" 18#include <drm/drm_crtc.h>
19 19#include <drm/drm_crtc_helper.h>
20#include "drm_crtc.h"
21#include "drm_crtc_helper.h"
22 20
21#include "mdp4_kms.h"
23 22
24struct mdp4_dtv_encoder { 23struct mdp4_dtv_encoder {
25 struct drm_encoder base; 24 struct drm_encoder base;
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h
index 62712ca164ee..c413779d488a 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h
@@ -18,12 +18,14 @@
18#ifndef __MDP4_KMS_H__ 18#ifndef __MDP4_KMS_H__
19#define __MDP4_KMS_H__ 19#define __MDP4_KMS_H__
20 20
21#include <drm/drm_panel.h>
22
21#include "msm_drv.h" 23#include "msm_drv.h"
22#include "msm_kms.h" 24#include "msm_kms.h"
23#include "mdp/mdp_kms.h" 25#include "mdp/mdp_kms.h"
24#include "mdp4.xml.h" 26#include "mdp4.xml.h"
25 27
26#include "drm_panel.h" 28struct device_node;
27 29
28struct mdp4_kms { 30struct mdp4_kms {
29 struct mdp_kms base; 31 struct mdp_kms base;
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c
index a06b064f86c1..4a645926edb7 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c
@@ -16,10 +16,10 @@
16 * this program. If not, see <http://www.gnu.org/licenses/>. 16 * this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 18
19#include "mdp4_kms.h" 19#include <drm/drm_crtc.h>
20#include <drm/drm_crtc_helper.h>
20 21
21#include "drm_crtc.h" 22#include "mdp4_kms.h"
22#include "drm_crtc_helper.h"
23 23
24struct mdp4_lcdc_encoder { 24struct mdp4_lcdc_encoder {
25 struct drm_encoder base; 25 struct drm_encoder base;
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c
index 8dafc7bdba48..aa7402e03f67 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c
@@ -11,10 +11,10 @@
11 * GNU General Public License for more details. 11 * GNU General Public License for more details.
12 */ 12 */
13 13
14#include "mdp5_kms.h" 14#include <drm/drm_crtc.h>
15#include <drm/drm_crtc_helper.h>
15 16
16#include "drm_crtc.h" 17#include "mdp5_kms.h"
17#include "drm_crtc_helper.h"
18 18
19static struct mdp5_kms *get_kms(struct drm_encoder *encoder) 19static struct mdp5_kms *get_kms(struct drm_encoder *encoder)
20{ 20{
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
index 9217e0d6e93e..0764a6498110 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
@@ -16,13 +16,13 @@
16 * this program. If not, see <http://www.gnu.org/licenses/>. 16 * this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 18
19#include "mdp5_kms.h"
20
21#include <linux/sort.h> 19#include <linux/sort.h>
22#include <drm/drm_mode.h> 20#include <drm/drm_mode.h>
23#include "drm_crtc.h" 21#include <drm/drm_crtc.h>
24#include "drm_crtc_helper.h" 22#include <drm/drm_crtc_helper.h>
25#include "drm_flip_work.h" 23#include <drm/drm_flip_work.h>
24
25#include "mdp5_kms.h"
26 26
27#define CURSOR_WIDTH 64 27#define CURSOR_WIDTH 64
28#define CURSOR_HEIGHT 64 28#define CURSOR_HEIGHT 64
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c
index c2ab0f033031..97f3294fbfc6 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c
@@ -16,10 +16,10 @@
16 * this program. If not, see <http://www.gnu.org/licenses/>. 16 * this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 18
19#include "mdp5_kms.h" 19#include <drm/drm_crtc.h>
20#include <drm/drm_crtc_helper.h>
20 21
21#include "drm_crtc.h" 22#include "mdp5_kms.h"
22#include "drm_crtc_helper.h"
23 23
24static struct mdp5_kms *get_kms(struct drm_encoder *encoder) 24static struct mdp5_kms *get_kms(struct drm_encoder *encoder)
25{ 25{
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
index a38c5fe6cc19..5e7d9af4cba8 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
@@ -67,11 +67,11 @@ static void mdp5_plane_install_rotation_property(struct drm_device *dev,
67 struct drm_plane *plane) 67 struct drm_plane *plane)
68{ 68{
69 drm_plane_create_rotation_property(plane, 69 drm_plane_create_rotation_property(plane,
70 DRM_ROTATE_0, 70 DRM_MODE_ROTATE_0,
71 DRM_ROTATE_0 | 71 DRM_MODE_ROTATE_0 |
72 DRM_ROTATE_180 | 72 DRM_MODE_ROTATE_180 |
73 DRM_REFLECT_X | 73 DRM_MODE_REFLECT_X |
74 DRM_REFLECT_Y); 74 DRM_MODE_REFLECT_Y);
75} 75}
76 76
77/* helper to install properties which are common to planes and crtcs */ 77/* helper to install properties which are common to planes and crtcs */
@@ -369,14 +369,14 @@ static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state,
369 caps |= MDP_PIPE_CAP_SCALE; 369 caps |= MDP_PIPE_CAP_SCALE;
370 370
371 rotation = drm_rotation_simplify(state->rotation, 371 rotation = drm_rotation_simplify(state->rotation,
372 DRM_ROTATE_0 | 372 DRM_MODE_ROTATE_0 |
373 DRM_REFLECT_X | 373 DRM_MODE_REFLECT_X |
374 DRM_REFLECT_Y); 374 DRM_MODE_REFLECT_Y);
375 375
376 if (rotation & DRM_REFLECT_X) 376 if (rotation & DRM_MODE_REFLECT_X)
377 caps |= MDP_PIPE_CAP_HFLIP; 377 caps |= MDP_PIPE_CAP_HFLIP;
378 378
379 if (rotation & DRM_REFLECT_Y) 379 if (rotation & DRM_MODE_REFLECT_Y)
380 caps |= MDP_PIPE_CAP_VFLIP; 380 caps |= MDP_PIPE_CAP_VFLIP;
381 381
382 if (plane->type == DRM_PLANE_TYPE_CURSOR) 382 if (plane->type == DRM_PLANE_TYPE_CURSOR)
@@ -970,11 +970,11 @@ static int mdp5_plane_mode_set(struct drm_plane *plane,
970 DBG("scale config = %x", config); 970 DBG("scale config = %x", config);
971 971
972 rotation = drm_rotation_simplify(pstate->rotation, 972 rotation = drm_rotation_simplify(pstate->rotation,
973 DRM_ROTATE_0 | 973 DRM_MODE_ROTATE_0 |
974 DRM_REFLECT_X | 974 DRM_MODE_REFLECT_X |
975 DRM_REFLECT_Y); 975 DRM_MODE_REFLECT_Y);
976 hflip = !!(rotation & DRM_REFLECT_X); 976 hflip = !!(rotation & DRM_MODE_REFLECT_X);
977 vflip = !!(rotation & DRM_REFLECT_Y); 977 vflip = !!(rotation & DRM_MODE_REFLECT_Y);
978 978
979 spin_lock_irqsave(&mdp5_plane->pipe_lock, flags); 979 spin_lock_irqsave(&mdp5_plane->pipe_lock, flags);
980 980
diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c
index 5cf165c9c3a9..ba2733a95a4f 100644
--- a/drivers/gpu/drm/msm/msm_fb.c
+++ b/drivers/gpu/drm/msm/msm_fb.c
@@ -15,12 +15,12 @@
15 * this program. If not, see <http://www.gnu.org/licenses/>. 15 * this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18#include <drm/drm_crtc.h>
19#include <drm/drm_crtc_helper.h>
20
18#include "msm_drv.h" 21#include "msm_drv.h"
19#include "msm_kms.h" 22#include "msm_kms.h"
20 23
21#include "drm_crtc.h"
22#include "drm_crtc_helper.h"
23
24struct msm_framebuffer { 24struct msm_framebuffer {
25 struct drm_framebuffer base; 25 struct drm_framebuffer base;
26 const struct msm_format *format; 26 const struct msm_format *format;
diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
index 951e40faf6e8..feea8ba4e05b 100644
--- a/drivers/gpu/drm/msm/msm_fbdev.c
+++ b/drivers/gpu/drm/msm/msm_fbdev.c
@@ -15,10 +15,10 @@
15 * this program. If not, see <http://www.gnu.org/licenses/>. 15 * this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18#include "msm_drv.h" 18#include <drm/drm_crtc.h>
19#include <drm/drm_fb_helper.h>
19 20
20#include "drm_crtc.h" 21#include "msm_drv.h"
21#include "drm_fb_helper.h"
22#include "msm_gem.h" 22#include "msm_gem.h"
23 23
24extern int msm_gem_mmap_obj(struct drm_gem_object *obj, 24extern int msm_gem_mmap_obj(struct drm_gem_object *obj,
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
index 68e509b3b9e4..465dab942afa 100644
--- a/drivers/gpu/drm/msm/msm_gem.c
+++ b/drivers/gpu/drm/msm/msm_gem.c
@@ -50,13 +50,13 @@ static struct page **get_pages_vram(struct drm_gem_object *obj,
50 struct page **p; 50 struct page **p;
51 int ret, i; 51 int ret, i;
52 52
53 p = drm_malloc_ab(npages, sizeof(struct page *)); 53 p = kvmalloc_array(npages, sizeof(struct page *), GFP_KERNEL);
54 if (!p) 54 if (!p)
55 return ERR_PTR(-ENOMEM); 55 return ERR_PTR(-ENOMEM);
56 56
57 ret = drm_mm_insert_node(&priv->vram.mm, msm_obj->vram_node, npages); 57 ret = drm_mm_insert_node(&priv->vram.mm, msm_obj->vram_node, npages);
58 if (ret) { 58 if (ret) {
59 drm_free_large(p); 59 kvfree(p);
60 return ERR_PTR(ret); 60 return ERR_PTR(ret);
61 } 61 }
62 62
@@ -127,7 +127,7 @@ static void put_pages(struct drm_gem_object *obj)
127 drm_gem_put_pages(obj, msm_obj->pages, true, false); 127 drm_gem_put_pages(obj, msm_obj->pages, true, false);
128 else { 128 else {
129 drm_mm_remove_node(msm_obj->vram_node); 129 drm_mm_remove_node(msm_obj->vram_node);
130 drm_free_large(msm_obj->pages); 130 kvfree(msm_obj->pages);
131 } 131 }
132 132
133 msm_obj->pages = NULL; 133 msm_obj->pages = NULL;
@@ -707,7 +707,7 @@ void msm_gem_free_object(struct drm_gem_object *obj)
707 * ours, just free the array we allocated: 707 * ours, just free the array we allocated:
708 */ 708 */
709 if (msm_obj->pages) 709 if (msm_obj->pages)
710 drm_free_large(msm_obj->pages); 710 kvfree(msm_obj->pages);
711 711
712 drm_prime_gem_destroy(obj, msm_obj->sgt); 712 drm_prime_gem_destroy(obj, msm_obj->sgt);
713 } else { 713 } else {
@@ -863,7 +863,7 @@ struct drm_gem_object *msm_gem_import(struct drm_device *dev,
863 863
864 msm_obj = to_msm_bo(obj); 864 msm_obj = to_msm_bo(obj);
865 msm_obj->sgt = sgt; 865 msm_obj->sgt = sgt;
866 msm_obj->pages = drm_malloc_ab(npages, sizeof(struct page *)); 866 msm_obj->pages = kvmalloc_array(npages, sizeof(struct page *), GFP_KERNEL);
867 if (!msm_obj->pages) { 867 if (!msm_obj->pages) {
868 ret = -ENOMEM; 868 ret = -ENOMEM;
869 goto fail; 869 goto fail;
diff --git a/drivers/gpu/drm/nouveau/Kbuild b/drivers/gpu/drm/nouveau/Kbuild
index fde6e3656636..2e9ce53ae3a8 100644
--- a/drivers/gpu/drm/nouveau/Kbuild
+++ b/drivers/gpu/drm/nouveau/Kbuild
@@ -1,4 +1,3 @@
1ccflags-y := -Iinclude/drm
2ccflags-y += -I$(src)/include 1ccflags-y += -I$(src)/include
3ccflags-y += -I$(src)/include/nvkm 2ccflags-y += -I$(src)/include/nvkm
4ccflags-y += -I$(src)/nvkm 3ccflags-y += -I$(src)/nvkm
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 1f751a3f570c..c3dc75fee700 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -29,8 +29,8 @@
29#include <linux/pm_runtime.h> 29#include <linux/pm_runtime.h>
30#include <linux/vga_switcheroo.h> 30#include <linux/vga_switcheroo.h>
31 31
32#include "drmP.h" 32#include <drm/drmP.h>
33#include "drm_crtc_helper.h" 33#include <drm/drm_crtc_helper.h>
34 34
35#include <core/gpuobj.h> 35#include <core/gpuobj.h>
36#include <core/option.h> 36#include <core/option.h>
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index eadec2f49ad3..aaa25641fed6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -43,7 +43,7 @@
43#include <nvif/device.h> 43#include <nvif/device.h>
44#include <nvif/ioctl.h> 44#include <nvif/ioctl.h>
45 45
46#include <drmP.h> 46#include <drm/drmP.h>
47 47
48#include <drm/ttm/ttm_bo_api.h> 48#include <drm/ttm/ttm_bo_api.h>
49#include <drm/ttm/ttm_bo_driver.h> 49#include <drm/ttm/ttm_bo_driver.h>
diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c b/drivers/gpu/drm/nouveau/nouveau_ttm.c
index 13e5cc5f07fe..999c35a25498 100644
--- a/drivers/gpu/drm/nouveau/nouveau_ttm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c
@@ -28,7 +28,7 @@
28#include "nouveau_ttm.h" 28#include "nouveau_ttm.h"
29#include "nouveau_gem.h" 29#include "nouveau_gem.h"
30 30
31#include "drm_legacy.h" 31#include <drm/drm_legacy.h>
32 32
33#include <core/tegra.h> 33#include <core/tegra.h>
34 34
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index a7663249b3ba..9303daa79aba 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -1033,7 +1033,7 @@ nv50_wndw_reset(struct drm_plane *plane)
1033 plane->funcs->atomic_destroy_state(plane, plane->state); 1033 plane->funcs->atomic_destroy_state(plane, plane->state);
1034 plane->state = &asyw->state; 1034 plane->state = &asyw->state;
1035 plane->state->plane = plane; 1035 plane->state->plane = plane;
1036 plane->state->rotation = DRM_ROTATE_0; 1036 plane->state->rotation = DRM_MODE_ROTATE_0;
1037} 1037}
1038 1038
1039static void 1039static void
diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
index 48b7b750c05c..b391be7ecb6c 100644
--- a/drivers/gpu/drm/omapdrm/Makefile
+++ b/drivers/gpu/drm/omapdrm/Makefile
@@ -6,7 +6,6 @@
6obj-y += dss/ 6obj-y += dss/
7obj-y += displays/ 7obj-y += displays/
8 8
9ccflags-y := -Iinclude/drm
10omapdrm-y := omap_drv.o \ 9omapdrm-y := omap_drv.o \
11 omap_irq.o \ 10 omap_irq.o \
12 omap_debugfs.o \ 11 omap_debugfs.o \
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index e1f47f0b3ccf..663e930a7b0f 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -577,7 +577,7 @@ static void dev_lastclose(struct drm_device *dev)
577 577
578 drm_object_property_set_value(&crtc->base, 578 drm_object_property_set_value(&crtc->base,
579 crtc->primary->rotation_property, 579 crtc->primary->rotation_property,
580 DRM_ROTATE_0); 580 DRM_MODE_ROTATE_0);
581 } 581 }
582 582
583 for (i = 0; i < priv->num_planes; i++) { 583 for (i = 0; i < priv->num_planes; i++) {
@@ -588,7 +588,7 @@ static void dev_lastclose(struct drm_device *dev)
588 588
589 drm_object_property_set_value(&plane->base, 589 drm_object_property_set_value(&plane->base,
590 plane->rotation_property, 590 plane->rotation_property,
591 DRM_ROTATE_0); 591 DRM_MODE_ROTATE_0);
592 } 592 }
593 593
594 if (priv->fbdev) { 594 if (priv->fbdev) {
diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
index 29dc677dd4d3..5ca0537bb427 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -167,30 +167,30 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
167 uint32_t w = win->src_w; 167 uint32_t w = win->src_w;
168 uint32_t h = win->src_h; 168 uint32_t h = win->src_h;
169 169
170 switch (win->rotation & DRM_ROTATE_MASK) { 170 switch (win->rotation & DRM_MODE_ROTATE_MASK) {
171 default: 171 default:
172 dev_err(fb->dev->dev, "invalid rotation: %02x", 172 dev_err(fb->dev->dev, "invalid rotation: %02x",
173 (uint32_t)win->rotation); 173 (uint32_t)win->rotation);
174 /* fallthru to default to no rotation */ 174 /* fallthru to default to no rotation */
175 case 0: 175 case 0:
176 case DRM_ROTATE_0: 176 case DRM_MODE_ROTATE_0:
177 orient = 0; 177 orient = 0;
178 break; 178 break;
179 case DRM_ROTATE_90: 179 case DRM_MODE_ROTATE_90:
180 orient = MASK_XY_FLIP | MASK_X_INVERT; 180 orient = MASK_XY_FLIP | MASK_X_INVERT;
181 break; 181 break;
182 case DRM_ROTATE_180: 182 case DRM_MODE_ROTATE_180:
183 orient = MASK_X_INVERT | MASK_Y_INVERT; 183 orient = MASK_X_INVERT | MASK_Y_INVERT;
184 break; 184 break;
185 case DRM_ROTATE_270: 185 case DRM_MODE_ROTATE_270:
186 orient = MASK_XY_FLIP | MASK_Y_INVERT; 186 orient = MASK_XY_FLIP | MASK_Y_INVERT;
187 break; 187 break;
188 } 188 }
189 189
190 if (win->rotation & DRM_REFLECT_X) 190 if (win->rotation & DRM_MODE_REFLECT_X)
191 orient ^= MASK_X_INVERT; 191 orient ^= MASK_X_INVERT;
192 192
193 if (win->rotation & DRM_REFLECT_Y) 193 if (win->rotation & DRM_MODE_REFLECT_Y)
194 orient ^= MASK_Y_INVERT; 194 orient ^= MASK_Y_INVERT;
195 195
196 /* adjust x,y offset for flip/invert: */ 196 /* adjust x,y offset for flip/invert: */
@@ -205,9 +205,9 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
205 info->rotation_type = OMAP_DSS_ROT_TILER; 205 info->rotation_type = OMAP_DSS_ROT_TILER;
206 info->screen_width = omap_gem_tiled_stride(plane->bo, orient); 206 info->screen_width = omap_gem_tiled_stride(plane->bo, orient);
207 } else { 207 } else {
208 switch (win->rotation & DRM_ROTATE_MASK) { 208 switch (win->rotation & DRM_MODE_ROTATE_MASK) {
209 case 0: 209 case 0:
210 case DRM_ROTATE_0: 210 case DRM_MODE_ROTATE_0:
211 /* OK */ 211 /* OK */
212 break; 212 break;
213 213
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
index 9168154d749e..d3d6818c68f8 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -141,7 +141,7 @@ static void omap_plane_atomic_disable(struct drm_plane *plane,
141 struct omap_plane_state *omap_state = to_omap_plane_state(plane->state); 141 struct omap_plane_state *omap_state = to_omap_plane_state(plane->state);
142 struct omap_plane *omap_plane = to_omap_plane(plane); 142 struct omap_plane *omap_plane = to_omap_plane(plane);
143 143
144 plane->state->rotation = DRM_ROTATE_0; 144 plane->state->rotation = DRM_MODE_ROTATE_0;
145 omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY 145 omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY
146 ? 0 : omap_plane->id; 146 ? 0 : omap_plane->id;
147 147
@@ -177,7 +177,7 @@ static int omap_plane_atomic_check(struct drm_plane *plane,
177 if (state->crtc_y + state->crtc_h > crtc_state->adjusted_mode.vdisplay) 177 if (state->crtc_y + state->crtc_h > crtc_state->adjusted_mode.vdisplay)
178 return -EINVAL; 178 return -EINVAL;
179 179
180 if (state->rotation != DRM_ROTATE_0 && 180 if (state->rotation != DRM_MODE_ROTATE_0 &&
181 !omap_framebuffer_supports_rotation(state->fb)) 181 !omap_framebuffer_supports_rotation(state->fb))
182 return -EINVAL; 182 return -EINVAL;
183 183
@@ -213,15 +213,15 @@ void omap_plane_install_properties(struct drm_plane *plane,
213 if (priv->has_dmm) { 213 if (priv->has_dmm) {
214 if (!plane->rotation_property) 214 if (!plane->rotation_property)
215 drm_plane_create_rotation_property(plane, 215 drm_plane_create_rotation_property(plane,
216 DRM_ROTATE_0, 216 DRM_MODE_ROTATE_0,
217 DRM_ROTATE_0 | DRM_ROTATE_90 | 217 DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 |
218 DRM_ROTATE_180 | DRM_ROTATE_270 | 218 DRM_MODE_ROTATE_180 | DRM_MODE_ROTATE_270 |
219 DRM_REFLECT_X | DRM_REFLECT_Y); 219 DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y);
220 220
221 /* Attach the rotation property also to the crtc object */ 221 /* Attach the rotation property also to the crtc object */
222 if (plane->rotation_property && obj != &plane->base) 222 if (plane->rotation_property && obj != &plane->base)
223 drm_object_attach_property(obj, plane->rotation_property, 223 drm_object_attach_property(obj, plane->rotation_property,
224 DRM_ROTATE_0); 224 DRM_MODE_ROTATE_0);
225 } 225 }
226 226
227 drm_object_attach_property(obj, priv->zorder_prop, 0); 227 drm_object_attach_property(obj, priv->zorder_prop, 0);
@@ -273,7 +273,7 @@ static void omap_plane_reset(struct drm_plane *plane)
273 */ 273 */
274 omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY 274 omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY
275 ? 0 : omap_plane->id; 275 ? 0 : omap_plane->id;
276 omap_state->base.rotation = DRM_ROTATE_0; 276 omap_state->base.rotation = DRM_MODE_ROTATE_0;
277 277
278 plane->state = &omap_state->base; 278 plane->state = &omap_state->base;
279 plane->state->plane = plane; 279 plane->state->plane = plane;
diff --git a/drivers/gpu/drm/pl111/Kconfig b/drivers/gpu/drm/pl111/Kconfig
index ede49efd531f..309f4fd52de7 100644
--- a/drivers/gpu/drm/pl111/Kconfig
+++ b/drivers/gpu/drm/pl111/Kconfig
@@ -2,6 +2,7 @@ config DRM_PL111
2 tristate "DRM Support for PL111 CLCD Controller" 2 tristate "DRM Support for PL111 CLCD Controller"
3 depends on DRM 3 depends on DRM
4 depends on ARM || ARM64 || COMPILE_TEST 4 depends on ARM || ARM64 || COMPILE_TEST
5 depends on COMMON_CLK
5 select DRM_KMS_HELPER 6 select DRM_KMS_HELPER
6 select DRM_KMS_CMA_HELPER 7 select DRM_KMS_CMA_HELPER
7 select DRM_GEM_CMA_HELPER 8 select DRM_GEM_CMA_HELPER
diff --git a/drivers/gpu/drm/pl111/Makefile b/drivers/gpu/drm/pl111/Makefile
index 01caee727c13..59483d610ef5 100644
--- a/drivers/gpu/drm/pl111/Makefile
+++ b/drivers/gpu/drm/pl111/Makefile
@@ -2,4 +2,6 @@ pl111_drm-y += pl111_connector.o \
2 pl111_display.o \ 2 pl111_display.o \
3 pl111_drv.o 3 pl111_drv.o
4 4
5pl111_drm-$(CONFIG_DEBUG_FS) += pl111_debugfs.o
6
5obj-$(CONFIG_DRM_PL111) += pl111_drm.o 7obj-$(CONFIG_DRM_PL111) += pl111_drm.o
diff --git a/drivers/gpu/drm/pl111/pl111_debugfs.c b/drivers/gpu/drm/pl111/pl111_debugfs.c
new file mode 100644
index 000000000000..0d9dee199b2c
--- /dev/null
+++ b/drivers/gpu/drm/pl111/pl111_debugfs.c
@@ -0,0 +1,55 @@
1/*
2 * Copyright © 2017 Broadcom
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#include <linux/amba/clcd-regs.h>
10#include <linux/seq_file.h>
11#include <drm/drm_debugfs.h>
12#include <drm/drmP.h>
13#include "pl111_drm.h"
14
15#define REGDEF(reg) { reg, #reg }
16static const struct {
17 u32 reg;
18 const char *name;
19} pl111_reg_defs[] = {
20 REGDEF(CLCD_TIM0),
21 REGDEF(CLCD_TIM1),
22 REGDEF(CLCD_TIM2),
23 REGDEF(CLCD_TIM3),
24 REGDEF(CLCD_UBAS),
25 REGDEF(CLCD_PL111_CNTL),
26 REGDEF(CLCD_PL111_IENB),
27};
28
29int pl111_debugfs_regs(struct seq_file *m, void *unused)
30{
31 struct drm_info_node *node = (struct drm_info_node *)m->private;
32 struct drm_device *dev = node->minor->dev;
33 struct pl111_drm_dev_private *priv = dev->dev_private;
34 int i;
35
36 for (i = 0; i < ARRAY_SIZE(pl111_reg_defs); i++) {
37 seq_printf(m, "%s (0x%04x): 0x%08x\n",
38 pl111_reg_defs[i].name, pl111_reg_defs[i].reg,
39 readl(priv->regs + pl111_reg_defs[i].reg));
40 }
41
42 return 0;
43}
44
45static const struct drm_info_list pl111_debugfs_list[] = {
46 {"regs", pl111_debugfs_regs, 0},
47};
48
49int
50pl111_debugfs_init(struct drm_minor *minor)
51{
52 return drm_debugfs_create_files(pl111_debugfs_list,
53 ARRAY_SIZE(pl111_debugfs_list),
54 minor->debugfs_root, minor);
55}
diff --git a/drivers/gpu/drm/pl111/pl111_display.c b/drivers/gpu/drm/pl111/pl111_display.c
index 39a5c33bce7d..3e0a4fa73ddb 100644
--- a/drivers/gpu/drm/pl111/pl111_display.c
+++ b/drivers/gpu/drm/pl111/pl111_display.c
@@ -108,7 +108,7 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe,
108 u32 cntl; 108 u32 cntl;
109 u32 ppl, hsw, hfp, hbp; 109 u32 ppl, hsw, hfp, hbp;
110 u32 lpp, vsw, vfp, vbp; 110 u32 lpp, vsw, vfp, vbp;
111 u32 cpl; 111 u32 cpl, tim2;
112 int ret; 112 int ret;
113 113
114 ret = clk_set_rate(priv->clk, mode->clock * 1000); 114 ret = clk_set_rate(priv->clk, mode->clock * 1000);
@@ -142,20 +142,28 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe,
142 (vfp << 16) | 142 (vfp << 16) |
143 (vbp << 24), 143 (vbp << 24),
144 priv->regs + CLCD_TIM1); 144 priv->regs + CLCD_TIM1);
145 /* XXX: We currently always use CLCDCLK with no divisor. We 145
146 * could probably reduce power consumption by using HCLK 146 spin_lock(&priv->tim2_lock);
147 * (apb_pclk) with a divisor when it gets us near our target 147
148 * pixel clock. 148 tim2 = readl(priv->regs + CLCD_TIM2);
149 */ 149 tim2 &= (TIM2_BCD | TIM2_PCD_LO_MASK | TIM2_PCD_HI_MASK);
150 writel(((mode->flags & DRM_MODE_FLAG_NHSYNC) ? TIM2_IHS : 0) | 150
151 ((mode->flags & DRM_MODE_FLAG_NVSYNC) ? TIM2_IVS : 0) | 151 if (mode->flags & DRM_MODE_FLAG_NHSYNC)
152 ((connector->display_info.bus_flags & 152 tim2 |= TIM2_IHS;
153 DRM_BUS_FLAG_DE_LOW) ? TIM2_IOE : 0) | 153
154 ((connector->display_info.bus_flags & 154 if (mode->flags & DRM_MODE_FLAG_NVSYNC)
155 DRM_BUS_FLAG_PIXDATA_NEGEDGE) ? TIM2_IPC : 0) | 155 tim2 |= TIM2_IVS;
156 TIM2_BCD | 156
157 (cpl << 16), 157 if (connector->display_info.bus_flags & DRM_BUS_FLAG_DE_LOW)
158 priv->regs + CLCD_TIM2); 158 tim2 |= TIM2_IOE;
159
160 if (connector->display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
161 tim2 |= TIM2_IPC;
162
163 tim2 |= cpl << 16;
164 writel(tim2, priv->regs + CLCD_TIM2);
165 spin_unlock(&priv->tim2_lock);
166
159 writel(0, priv->regs + CLCD_TIM3); 167 writel(0, priv->regs + CLCD_TIM3);
160 168
161 drm_panel_prepare(priv->connector.panel); 169 drm_panel_prepare(priv->connector.panel);
@@ -280,7 +288,7 @@ static int pl111_display_prepare_fb(struct drm_simple_display_pipe *pipe,
280 return drm_fb_cma_prepare_fb(&pipe->plane, plane_state); 288 return drm_fb_cma_prepare_fb(&pipe->plane, plane_state);
281} 289}
282 290
283const struct drm_simple_display_pipe_funcs pl111_display_funcs = { 291static const struct drm_simple_display_pipe_funcs pl111_display_funcs = {
284 .check = pl111_display_check, 292 .check = pl111_display_check,
285 .enable = pl111_display_enable, 293 .enable = pl111_display_enable,
286 .disable = pl111_display_disable, 294 .disable = pl111_display_disable,
@@ -288,6 +296,126 @@ const struct drm_simple_display_pipe_funcs pl111_display_funcs = {
288 .prepare_fb = pl111_display_prepare_fb, 296 .prepare_fb = pl111_display_prepare_fb,
289}; 297};
290 298
299static int pl111_clk_div_choose_div(struct clk_hw *hw, unsigned long rate,
300 unsigned long *prate, bool set_parent)
301{
302 int best_div = 1, div;
303 struct clk_hw *parent = clk_hw_get_parent(hw);
304 unsigned long best_prate = 0;
305 unsigned long best_diff = ~0ul;
306 int max_div = (1 << (TIM2_PCD_LO_BITS + TIM2_PCD_HI_BITS)) - 1;
307
308 for (div = 1; div < max_div; div++) {
309 unsigned long this_prate, div_rate, diff;
310
311 if (set_parent)
312 this_prate = clk_hw_round_rate(parent, rate * div);
313 else
314 this_prate = *prate;
315 div_rate = DIV_ROUND_UP_ULL(this_prate, div);
316 diff = abs(rate - div_rate);
317
318 if (diff < best_diff) {
319 best_div = div;
320 best_diff = diff;
321 best_prate = this_prate;
322 }
323 }
324
325 *prate = best_prate;
326 return best_div;
327}
328
329static long pl111_clk_div_round_rate(struct clk_hw *hw, unsigned long rate,
330 unsigned long *prate)
331{
332 int div = pl111_clk_div_choose_div(hw, rate, prate, true);
333
334 return DIV_ROUND_UP_ULL(*prate, div);
335}
336
337static unsigned long pl111_clk_div_recalc_rate(struct clk_hw *hw,
338 unsigned long prate)
339{
340 struct pl111_drm_dev_private *priv =
341 container_of(hw, struct pl111_drm_dev_private, clk_div);
342 u32 tim2 = readl(priv->regs + CLCD_TIM2);
343 int div;
344
345 if (tim2 & TIM2_BCD)
346 return prate;
347
348 div = tim2 & TIM2_PCD_LO_MASK;
349 div |= (tim2 & TIM2_PCD_HI_MASK) >>
350 (TIM2_PCD_HI_SHIFT - TIM2_PCD_LO_BITS);
351 div += 2;
352
353 return DIV_ROUND_UP_ULL(prate, div);
354}
355
356static int pl111_clk_div_set_rate(struct clk_hw *hw, unsigned long rate,
357 unsigned long prate)
358{
359 struct pl111_drm_dev_private *priv =
360 container_of(hw, struct pl111_drm_dev_private, clk_div);
361 int div = pl111_clk_div_choose_div(hw, rate, &prate, false);
362 u32 tim2;
363
364 spin_lock(&priv->tim2_lock);
365 tim2 = readl(priv->regs + CLCD_TIM2);
366 tim2 &= ~(TIM2_BCD | TIM2_PCD_LO_MASK | TIM2_PCD_HI_MASK);
367
368 if (div == 1) {
369 tim2 |= TIM2_BCD;
370 } else {
371 div -= 2;
372 tim2 |= div & TIM2_PCD_LO_MASK;
373 tim2 |= (div >> TIM2_PCD_LO_BITS) << TIM2_PCD_HI_SHIFT;
374 }
375
376 writel(tim2, priv->regs + CLCD_TIM2);
377 spin_unlock(&priv->tim2_lock);
378
379 return 0;
380}
381
382static const struct clk_ops pl111_clk_div_ops = {
383 .recalc_rate = pl111_clk_div_recalc_rate,
384 .round_rate = pl111_clk_div_round_rate,
385 .set_rate = pl111_clk_div_set_rate,
386};
387
388static int
389pl111_init_clock_divider(struct drm_device *drm)
390{
391 struct pl111_drm_dev_private *priv = drm->dev_private;
392 struct clk *parent = devm_clk_get(drm->dev, "clcdclk");
393 struct clk_hw *div = &priv->clk_div;
394 const char *parent_name;
395 struct clk_init_data init = {
396 .name = "pl111_div",
397 .ops = &pl111_clk_div_ops,
398 .parent_names = &parent_name,
399 .num_parents = 1,
400 .flags = CLK_SET_RATE_PARENT,
401 };
402 int ret;
403
404 if (IS_ERR(parent)) {
405 dev_err(drm->dev, "CLCD: unable to get clcdclk.\n");
406 return PTR_ERR(parent);
407 }
408 parent_name = __clk_get_name(parent);
409
410 spin_lock_init(&priv->tim2_lock);
411 div->init = &init;
412
413 ret = devm_clk_hw_register(drm->dev, div);
414
415 priv->clk = div->clk;
416 return ret;
417}
418
291int pl111_display_init(struct drm_device *drm) 419int pl111_display_init(struct drm_device *drm)
292{ 420{
293 struct pl111_drm_dev_private *priv = drm->dev_private; 421 struct pl111_drm_dev_private *priv = drm->dev_private;
@@ -333,6 +461,10 @@ int pl111_display_init(struct drm_device *drm)
333 return -EINVAL; 461 return -EINVAL;
334 } 462 }
335 463
464 ret = pl111_init_clock_divider(drm);
465 if (ret)
466 return ret;
467
336 ret = drm_simple_display_pipe_init(drm, &priv->pipe, 468 ret = drm_simple_display_pipe_init(drm, &priv->pipe,
337 &pl111_display_funcs, 469 &pl111_display_funcs,
338 formats, ARRAY_SIZE(formats), 470 formats, ARRAY_SIZE(formats),
diff --git a/drivers/gpu/drm/pl111/pl111_drm.h b/drivers/gpu/drm/pl111/pl111_drm.h
index f381593921b7..5c685bfc8fdc 100644
--- a/drivers/gpu/drm/pl111/pl111_drm.h
+++ b/drivers/gpu/drm/pl111/pl111_drm.h
@@ -21,9 +21,12 @@
21 21
22#include <drm/drm_gem.h> 22#include <drm/drm_gem.h>
23#include <drm/drm_simple_kms_helper.h> 23#include <drm/drm_simple_kms_helper.h>
24#include <linux/clk-provider.h>
24 25
25#define CLCD_IRQ_NEXTBASE_UPDATE BIT(2) 26#define CLCD_IRQ_NEXTBASE_UPDATE BIT(2)
26 27
28struct drm_minor;
29
27struct pl111_drm_connector { 30struct pl111_drm_connector {
28 struct drm_connector connector; 31 struct drm_connector connector;
29 struct drm_panel *panel; 32 struct drm_panel *panel;
@@ -37,7 +40,14 @@ struct pl111_drm_dev_private {
37 struct drm_fbdev_cma *fbdev; 40 struct drm_fbdev_cma *fbdev;
38 41
39 void *regs; 42 void *regs;
43 /* The pixel clock (a reference to our clock divider off of CLCDCLK). */
40 struct clk *clk; 44 struct clk *clk;
45 /* pl111's internal clock divider. */
46 struct clk_hw clk_div;
47 /* Lock to sync access to CLCD_TIM2 between the common clock
48 * subsystem and pl111_display_enable().
49 */
50 spinlock_t tim2_lock;
41}; 51};
42 52
43#define to_pl111_connector(x) \ 53#define to_pl111_connector(x) \
@@ -52,5 +62,6 @@ int pl111_encoder_init(struct drm_device *dev);
52int pl111_dumb_create(struct drm_file *file_priv, 62int pl111_dumb_create(struct drm_file *file_priv,
53 struct drm_device *dev, 63 struct drm_device *dev,
54 struct drm_mode_create_dumb *args); 64 struct drm_mode_create_dumb *args);
65int pl111_debugfs_init(struct drm_minor *minor);
55 66
56#endif /* _PL111_DRM_H_ */ 67#endif /* _PL111_DRM_H_ */
diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c
index 936403f65508..e96efad37d27 100644
--- a/drivers/gpu/drm/pl111/pl111_drv.c
+++ b/drivers/gpu/drm/pl111/pl111_drv.c
@@ -50,8 +50,8 @@
50 * - Read back hardware state at boot to skip reprogramming the 50 * - Read back hardware state at boot to skip reprogramming the
51 * hardware when doing a no-op modeset. 51 * hardware when doing a no-op modeset.
52 * 52 *
53 * - Use the internal clock divisor to reduce power consumption by 53 * - Use the CLKSEL bit to support switching between the two external
54 * using HCLK (apb_pclk) when appropriate. 54 * clock parents.
55 */ 55 */
56 56
57#include <linux/amba/bus.h> 57#include <linux/amba/bus.h>
@@ -72,7 +72,7 @@
72 72
73#define DRIVER_DESC "DRM module for PL111" 73#define DRIVER_DESC "DRM module for PL111"
74 74
75struct drm_mode_config_funcs mode_config_funcs = { 75static struct drm_mode_config_funcs mode_config_funcs = {
76 .fb_create = drm_fb_cma_create, 76 .fb_create = drm_fb_cma_create,
77 .atomic_check = drm_atomic_helper_check, 77 .atomic_check = drm_atomic_helper_check,
78 .atomic_commit = drm_atomic_helper_commit, 78 .atomic_commit = drm_atomic_helper_commit,
@@ -173,6 +173,10 @@ static struct drm_driver pl111_drm_driver = {
173 .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, 173 .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
174 .gem_prime_export = drm_gem_prime_export, 174 .gem_prime_export = drm_gem_prime_export,
175 .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, 175 .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
176
177#if defined(CONFIG_DEBUG_FS)
178 .debugfs_init = pl111_debugfs_init,
179#endif
176}; 180};
177 181
178#ifdef CONFIG_ARM_AMBA 182#ifdef CONFIG_ARM_AMBA
@@ -195,17 +199,10 @@ static int pl111_amba_probe(struct amba_device *amba_dev,
195 priv->drm = drm; 199 priv->drm = drm;
196 drm->dev_private = priv; 200 drm->dev_private = priv;
197 201
198 priv->clk = devm_clk_get(dev, "clcdclk");
199 if (IS_ERR(priv->clk)) {
200 dev_err(dev, "CLCD: unable to get clk.\n");
201 ret = PTR_ERR(priv->clk);
202 goto dev_unref;
203 }
204
205 priv->regs = devm_ioremap_resource(dev, &amba_dev->res); 202 priv->regs = devm_ioremap_resource(dev, &amba_dev->res);
206 if (!priv->regs) { 203 if (IS_ERR(priv->regs)) {
207 dev_err(dev, "%s failed mmio\n", __func__); 204 dev_err(dev, "%s failed mmio\n", __func__);
208 return -EINVAL; 205 return PTR_ERR(priv->regs);
209 } 206 }
210 207
211 /* turn off interrupts before requesting the irq */ 208 /* turn off interrupts before requesting the irq */
diff --git a/drivers/gpu/drm/qxl/Makefile b/drivers/gpu/drm/qxl/Makefile
index bacc4aff1201..33a7d0c434b7 100644
--- a/drivers/gpu/drm/qxl/Makefile
+++ b/drivers/gpu/drm/qxl/Makefile
@@ -2,8 +2,6 @@
2# Makefile for the drm device driver. This driver provides support for the 2# Makefile for the drm device driver. This driver provides support for the
3# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. 3# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
4 4
5ccflags-y := -Iinclude/drm
6
7qxl-y := qxl_drv.o qxl_kms.o qxl_display.o qxl_ttm.o qxl_fb.o qxl_object.o qxl_gem.o qxl_cmd.o qxl_image.o qxl_draw.o qxl_debugfs.o qxl_irq.o qxl_dumb.o qxl_ioctl.o qxl_release.o qxl_prime.o 5qxl-y := qxl_drv.o qxl_kms.o qxl_display.o qxl_ttm.o qxl_fb.o qxl_object.o qxl_gem.o qxl_cmd.o qxl_image.o qxl_draw.o qxl_debugfs.o qxl_irq.o qxl_dumb.o qxl_ioctl.o qxl_release.o qxl_prime.o
8 6
9obj-$(CONFIG_DRM_QXL)+= qxl.o 7obj-$(CONFIG_DRM_QXL)+= qxl.o
diff --git a/drivers/gpu/drm/qxl/qxl_debugfs.c b/drivers/gpu/drm/qxl/qxl_debugfs.c
index ffe821b61f7d..15c84068d3fb 100644
--- a/drivers/gpu/drm/qxl/qxl_debugfs.c
+++ b/drivers/gpu/drm/qxl/qxl_debugfs.c
@@ -30,7 +30,7 @@
30 30
31#include <linux/debugfs.h> 31#include <linux/debugfs.h>
32 32
33#include "drmP.h" 33#include <drm/drmP.h>
34#include "qxl_drv.h" 34#include "qxl_drv.h"
35#include "qxl_object.h" 35#include "qxl_object.h"
36 36
diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index 058340a002c2..f5ef81595f5a 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -23,16 +23,15 @@
23 * Alon Levy 23 * Alon Levy
24 */ 24 */
25 25
26
27#include <linux/crc32.h> 26#include <linux/crc32.h>
28 27#include <drm/drm_crtc_helper.h>
29#include "qxl_drv.h"
30#include "qxl_object.h"
31#include "drm_crtc_helper.h"
32#include <drm/drm_plane_helper.h> 28#include <drm/drm_plane_helper.h>
33#include <drm/drm_atomic_helper.h> 29#include <drm/drm_atomic_helper.h>
34#include <drm/drm_atomic.h> 30#include <drm/drm_atomic.h>
35 31
32#include "qxl_drv.h"
33#include "qxl_object.h"
34
36static bool qxl_head_enabled(struct qxl_head *head) 35static bool qxl_head_enabled(struct qxl_head *head)
37{ 36{
38 return head->width && head->height; 37 return head->width && head->height;
diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c
index abf7b8360361..c2fc201d9e1b 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.c
+++ b/drivers/gpu/drm/qxl/qxl_drv.c
@@ -31,9 +31,9 @@
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/console.h> 32#include <linux/console.h>
33 33
34#include "drmP.h" 34#include <drm/drmP.h>
35#include "drm/drm.h" 35#include <drm/drm.h>
36#include "drm_crtc_helper.h" 36#include <drm/drm_crtc_helper.h>
37#include "qxl_drv.h" 37#include "qxl_drv.h"
38#include "qxl_object.h" 38#include "qxl_object.h"
39 39
diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h
index 5ea290a33a68..3591d2330a09 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.h
+++ b/drivers/gpu/drm/qxl/qxl_drv.h
@@ -36,20 +36,18 @@
36#include <linux/firmware.h> 36#include <linux/firmware.h>
37#include <linux/platform_device.h> 37#include <linux/platform_device.h>
38 38
39#include "drmP.h" 39#include <drm/drm_crtc.h>
40#include "drm_crtc.h"
41#include <ttm/ttm_bo_api.h>
42#include <ttm/ttm_bo_driver.h>
43#include <ttm/ttm_placement.h>
44#include <ttm/ttm_module.h>
45
46#include <drm/drm_encoder.h> 40#include <drm/drm_encoder.h>
47#include <drm/drm_gem.h> 41#include <drm/drm_gem.h>
48 42#include <drm/drmP.h>
43#include <drm/ttm/ttm_bo_api.h>
44#include <drm/ttm/ttm_bo_driver.h>
49/* just for ttm_validate_buffer */ 45/* just for ttm_validate_buffer */
50#include <ttm/ttm_execbuf_util.h> 46#include <drm/ttm/ttm_execbuf_util.h>
51 47#include <drm/ttm/ttm_module.h>
48#include <drm/ttm/ttm_placement.h>
52#include <drm/qxl_drm.h> 49#include <drm/qxl_drm.h>
50
53#include "qxl_dev.h" 51#include "qxl_dev.h"
54 52
55#define DRIVER_AUTHOR "Dave Airlie" 53#define DRIVER_AUTHOR "Dave Airlie"
diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c
index 14e2a49a4dcf..573e7e9a5f98 100644
--- a/drivers/gpu/drm/qxl/qxl_fb.c
+++ b/drivers/gpu/drm/qxl/qxl_fb.c
@@ -25,14 +25,15 @@
25 */ 25 */
26#include <linux/module.h> 26#include <linux/module.h>
27 27
28#include "drmP.h" 28#include <drm/drmP.h>
29#include "drm/drm.h" 29#include <drm/drm.h>
30#include "drm/drm_crtc.h" 30#include <drm/drm_crtc.h>
31#include "drm/drm_crtc_helper.h" 31#include <drm/drm_crtc_helper.h>
32#include <drm/drm_fb_helper.h>
33
32#include "qxl_drv.h" 34#include "qxl_drv.h"
33 35
34#include "qxl_object.h" 36#include "qxl_object.h"
35#include "drm_fb_helper.h"
36 37
37#define QXL_DIRTY_DELAY (HZ / 30) 38#define QXL_DIRTY_DELAY (HZ / 30)
38 39
diff --git a/drivers/gpu/drm/qxl/qxl_gem.c b/drivers/gpu/drm/qxl/qxl_gem.c
index 3f185c4da5b7..85f546719adb 100644
--- a/drivers/gpu/drm/qxl/qxl_gem.c
+++ b/drivers/gpu/drm/qxl/qxl_gem.c
@@ -23,8 +23,9 @@
23 * Alon Levy 23 * Alon Levy
24 */ 24 */
25 25
26#include "drmP.h" 26#include <drm/drmP.h>
27#include "drm/drm.h" 27#include <drm/drm.h>
28
28#include "qxl_drv.h" 29#include "qxl_drv.h"
29#include "qxl_object.h" 30#include "qxl_object.h"
30 31
diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c
index 0fdedee4509d..87fc1dbd0a2f 100644
--- a/drivers/gpu/drm/qxl/qxl_ttm.c
+++ b/drivers/gpu/drm/qxl/qxl_ttm.c
@@ -23,11 +23,11 @@
23 * Alon Levy 23 * Alon Levy
24 */ 24 */
25 25
26#include <ttm/ttm_bo_api.h> 26#include <drm/ttm/ttm_bo_api.h>
27#include <ttm/ttm_bo_driver.h> 27#include <drm/ttm/ttm_bo_driver.h>
28#include <ttm/ttm_placement.h> 28#include <drm/ttm/ttm_placement.h>
29#include <ttm/ttm_page_alloc.h> 29#include <drm/ttm/ttm_page_alloc.h>
30#include <ttm/ttm_module.h> 30#include <drm/ttm/ttm_module.h>
31#include <drm/drmP.h> 31#include <drm/drmP.h>
32#include <drm/drm.h> 32#include <drm/drm.h>
33#include <drm/qxl_drm.h> 33#include <drm/qxl_drm.h>
diff --git a/drivers/gpu/drm/r128/Makefile b/drivers/gpu/drm/r128/Makefile
index 1cc72ae3a880..1a6700ebaf09 100644
--- a/drivers/gpu/drm/r128/Makefile
+++ b/drivers/gpu/drm/r128/Makefile
@@ -2,7 +2,6 @@
2# Makefile for the drm device driver. This driver provides support for the 2# Makefile for the drm device driver. This driver provides support for the
3# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. 3# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
4 4
5ccflags-y := -Iinclude/drm
6r128-y := r128_drv.o r128_cce.o r128_state.o r128_irq.o 5r128-y := r128_drv.o r128_cce.o r128_state.o r128_irq.o
7 6
8r128-$(CONFIG_COMPAT) += r128_ioc32.o 7r128-$(CONFIG_COMPAT) += r128_ioc32.o
diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile
index 08bd17d3925c..a5d3cd3ecb5f 100644
--- a/drivers/gpu/drm/radeon/Makefile
+++ b/drivers/gpu/drm/radeon/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the drm device driver. This driver provides support for the 2# Makefile for the drm device driver. This driver provides support for the
3# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. 3# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
4 4
5ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/amd/include 5ccflags-y := -Idrivers/gpu/drm/amd/include
6 6
7hostprogs-y := mkregtable 7hostprogs-y := mkregtable
8clean-files := rn50_reg_safe.h r100_reg_safe.h r200_reg_safe.h rv515_reg_safe.h r300_reg_safe.h r420_reg_safe.h rs600_reg_safe.h r600_reg_safe.h evergreen_reg_safe.h cayman_reg_safe.h 8clean-files := rn50_reg_safe.h r100_reg_safe.h r200_reg_safe.h rv515_reg_safe.h r300_reg_safe.h r420_reg_safe.h rs600_reg_safe.h r600_reg_safe.h evergreen_reg_safe.h cayman_reg_safe.h
diff --git a/drivers/gpu/drm/radeon/btc_dpm.c b/drivers/gpu/drm/radeon/btc_dpm.c
index 38e5123708e7..95652e643da1 100644
--- a/drivers/gpu/drm/radeon/btc_dpm.c
+++ b/drivers/gpu/drm/radeon/btc_dpm.c
@@ -22,7 +22,7 @@
22 * Authors: Alex Deucher 22 * Authors: Alex Deucher
23 */ 23 */
24 24
25#include "drmP.h" 25#include <drm/drmP.h>
26#include "radeon.h" 26#include "radeon.h"
27#include "radeon_asic.h" 27#include "radeon_asic.h"
28#include "btcd.h" 28#include "btcd.h"
diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c
index 7ba450832e6b..f0cf99783c62 100644
--- a/drivers/gpu/drm/radeon/ci_dpm.c
+++ b/drivers/gpu/drm/radeon/ci_dpm.c
@@ -22,7 +22,7 @@
22 */ 22 */
23 23
24#include <linux/firmware.h> 24#include <linux/firmware.h>
25#include "drmP.h" 25#include <drm/drmP.h>
26#include "radeon.h" 26#include "radeon.h"
27#include "radeon_asic.h" 27#include "radeon_asic.h"
28#include "radeon_ucode.h" 28#include "radeon_ucode.h"
diff --git a/drivers/gpu/drm/radeon/ci_smc.c b/drivers/gpu/drm/radeon/ci_smc.c
index 24760ee3063e..3356a21d97ec 100644
--- a/drivers/gpu/drm/radeon/ci_smc.c
+++ b/drivers/gpu/drm/radeon/ci_smc.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include <linux/firmware.h> 25#include <linux/firmware.h>
26#include "drmP.h" 26#include <drm/drmP.h>
27#include "radeon.h" 27#include "radeon.h"
28#include "cikd.h" 28#include "cikd.h"
29#include "ppsmc.h" 29#include "ppsmc.h"
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index ccebe0f8d2e1..e368ce22bcc4 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -24,7 +24,7 @@
24#include <linux/firmware.h> 24#include <linux/firmware.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include "drmP.h" 27#include <drm/drmP.h>
28#include "radeon.h" 28#include "radeon.h"
29#include "radeon_asic.h" 29#include "radeon_asic.h"
30#include "radeon_audio.h" 30#include "radeon_audio.h"
diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c b/drivers/gpu/drm/radeon/cypress_dpm.c
index a4edd0702718..3eb7899a4035 100644
--- a/drivers/gpu/drm/radeon/cypress_dpm.c
+++ b/drivers/gpu/drm/radeon/cypress_dpm.c
@@ -22,7 +22,7 @@
22 * Authors: Alex Deucher 22 * Authors: Alex Deucher
23 */ 23 */
24 24
25#include "drmP.h" 25#include <drm/drmP.h>
26#include "radeon.h" 26#include "radeon.h"
27#include "radeon_asic.h" 27#include "radeon_asic.h"
28#include "evergreend.h" 28#include "evergreend.h"
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c
index a7e978677937..ae1529b0ef6f 100644
--- a/drivers/gpu/drm/radeon/kv_dpm.c
+++ b/drivers/gpu/drm/radeon/kv_dpm.c
@@ -21,7 +21,7 @@
21 * 21 *
22 */ 22 */
23 23
24#include "drmP.h" 24#include <drm/drmP.h>
25#include "radeon.h" 25#include "radeon.h"
26#include "cikd.h" 26#include "cikd.h"
27#include "r600_dpm.h" 27#include "r600_dpm.h"
diff --git a/drivers/gpu/drm/radeon/kv_smc.c b/drivers/gpu/drm/radeon/kv_smc.c
index 0000b59a6d05..af60bd32a287 100644
--- a/drivers/gpu/drm/radeon/kv_smc.c
+++ b/drivers/gpu/drm/radeon/kv_smc.c
@@ -22,7 +22,7 @@
22 * Authors: Alex Deucher 22 * Authors: Alex Deucher
23 */ 23 */
24 24
25#include "drmP.h" 25#include <drm/drmP.h>
26#include "radeon.h" 26#include "radeon.h"
27#include "cikd.h" 27#include "cikd.h"
28#include "kv_dpm.h" 28#include "kv_dpm.h"
diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c
index 4a601f990562..9416e72f86aa 100644
--- a/drivers/gpu/drm/radeon/ni_dpm.c
+++ b/drivers/gpu/drm/radeon/ni_dpm.c
@@ -21,7 +21,7 @@
21 * 21 *
22 */ 22 */
23 23
24#include "drmP.h" 24#include <drm/drmP.h>
25#include "radeon.h" 25#include "radeon.h"
26#include "radeon_asic.h" 26#include "radeon_asic.h"
27#include "nid.h" 27#include "nid.h"
diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c
index c7fc1dbfd192..31d1b4710844 100644
--- a/drivers/gpu/drm/radeon/r600_dpm.c
+++ b/drivers/gpu/drm/radeon/r600_dpm.c
@@ -22,7 +22,7 @@
22 * Authors: Alex Deucher 22 * Authors: Alex Deucher
23 */ 23 */
24 24
25#include "drmP.h" 25#include <drm/drmP.h>
26#include "radeon.h" 26#include "radeon.h"
27#include "radeon_asic.h" 27#include "radeon_asic.h"
28#include "r600d.h" 28#include "r600d.h"
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index c1c8e2208a21..342e3b1fb9c7 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -68,11 +68,11 @@
68#include <linux/hashtable.h> 68#include <linux/hashtable.h>
69#include <linux/dma-fence.h> 69#include <linux/dma-fence.h>
70 70
71#include <ttm/ttm_bo_api.h> 71#include <drm/ttm/ttm_bo_api.h>
72#include <ttm/ttm_bo_driver.h> 72#include <drm/ttm/ttm_bo_driver.h>
73#include <ttm/ttm_placement.h> 73#include <drm/ttm/ttm_placement.h>
74#include <ttm/ttm_module.h> 74#include <drm/ttm/ttm_module.h>
75#include <ttm/ttm_execbuf_util.h> 75#include <drm/ttm/ttm_execbuf_util.h>
76 76
77#include <drm/drm_gem.h> 77#include <drm/drm_gem.h>
78 78
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
index 3ac671f6c8e1..00b22af70f5c 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -87,7 +87,8 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p)
87 p->dma_reloc_idx = 0; 87 p->dma_reloc_idx = 0;
88 /* FIXME: we assume that each relocs use 4 dwords */ 88 /* FIXME: we assume that each relocs use 4 dwords */
89 p->nrelocs = chunk->length_dw / 4; 89 p->nrelocs = chunk->length_dw / 4;
90 p->relocs = drm_calloc_large(p->nrelocs, sizeof(struct radeon_bo_list)); 90 p->relocs = kvmalloc_array(p->nrelocs, sizeof(struct radeon_bo_list),
91 GFP_KERNEL | __GFP_ZERO);
91 if (p->relocs == NULL) { 92 if (p->relocs == NULL) {
92 return -ENOMEM; 93 return -ENOMEM;
93 } 94 }
@@ -341,7 +342,7 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
341 continue; 342 continue;
342 } 343 }
343 344
344 p->chunks[i].kdata = drm_malloc_ab(size, sizeof(uint32_t)); 345 p->chunks[i].kdata = kvmalloc_array(size, sizeof(uint32_t), GFP_KERNEL);
345 size *= sizeof(uint32_t); 346 size *= sizeof(uint32_t);
346 if (p->chunks[i].kdata == NULL) { 347 if (p->chunks[i].kdata == NULL) {
347 return -ENOMEM; 348 return -ENOMEM;
@@ -440,10 +441,10 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error, bo
440 } 441 }
441 } 442 }
442 kfree(parser->track); 443 kfree(parser->track);
443 drm_free_large(parser->relocs); 444 kvfree(parser->relocs);
444 drm_free_large(parser->vm_bos); 445 kvfree(parser->vm_bos);
445 for (i = 0; i < parser->nchunks; i++) 446 for (i = 0; i < parser->nchunks; i++)
446 drm_free_large(parser->chunks[i].kdata); 447 kvfree(parser->chunks[i].kdata);
447 kfree(parser->chunks); 448 kfree(parser->chunks);
448 kfree(parser->chunks_array); 449 kfree(parser->chunks_array);
449 radeon_ib_free(parser->rdev, &parser->ib); 450 radeon_ib_free(parser->rdev, &parser->ib);
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index ef8a75940980..6f906abd612b 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -41,7 +41,7 @@
41#include <drm/drm_gem.h> 41#include <drm/drm_gem.h>
42#include <drm/drm_fb_helper.h> 42#include <drm/drm_fb_helper.h>
43 43
44#include "drm_crtc_helper.h" 44#include <drm/drm_crtc_helper.h>
45#include "radeon_kfd.h" 45#include "radeon_kfd.h"
46 46
47/* 47/*
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
index dddb372de2b9..574bf7e6b118 100644
--- a/drivers/gpu/drm/radeon/radeon_gem.c
+++ b/drivers/gpu/drm/radeon/radeon_gem.c
@@ -587,7 +587,7 @@ error_unreserve:
587 ttm_eu_backoff_reservation(&ticket, &list); 587 ttm_eu_backoff_reservation(&ticket, &list);
588 588
589error_free: 589error_free:
590 drm_free_large(vm_bos); 590 kvfree(vm_bos);
591 591
592 if (r && r != -ERESTARTSYS) 592 if (r && r != -ERESTARTSYS)
593 DRM_ERROR("Couldn't update BO_VA (%d)\n", r); 593 DRM_ERROR("Couldn't update BO_VA (%d)\n", r);
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c
index 8c7872339c2a..84802b201bef 100644
--- a/drivers/gpu/drm/radeon/radeon_ring.c
+++ b/drivers/gpu/drm/radeon/radeon_ring.c
@@ -314,7 +314,7 @@ unsigned radeon_ring_backup(struct radeon_device *rdev, struct radeon_ring *ring
314 } 314 }
315 315
316 /* and then save the content of the ring */ 316 /* and then save the content of the ring */
317 *data = drm_malloc_ab(size, sizeof(uint32_t)); 317 *data = kvmalloc_array(size, sizeof(uint32_t), GFP_KERNEL);
318 if (!*data) { 318 if (!*data) {
319 mutex_unlock(&rdev->ring_lock); 319 mutex_unlock(&rdev->ring_lock);
320 return 0; 320 return 0;
@@ -356,7 +356,7 @@ int radeon_ring_restore(struct radeon_device *rdev, struct radeon_ring *ring,
356 } 356 }
357 357
358 radeon_ring_unlock_commit(rdev, ring, false); 358 radeon_ring_unlock_commit(rdev, ring, false);
359 drm_free_large(data); 359 kvfree(data);
360 return 0; 360 return 0;
361} 361}
362 362
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index 8b7623b5a624..faa021396da3 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -29,11 +29,11 @@
29 * Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> 29 * Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
30 * Dave Airlie 30 * Dave Airlie
31 */ 31 */
32#include <ttm/ttm_bo_api.h> 32#include <drm/ttm/ttm_bo_api.h>
33#include <ttm/ttm_bo_driver.h> 33#include <drm/ttm/ttm_bo_driver.h>
34#include <ttm/ttm_placement.h> 34#include <drm/ttm/ttm_placement.h>
35#include <ttm/ttm_module.h> 35#include <drm/ttm/ttm_module.h>
36#include <ttm/ttm_page_alloc.h> 36#include <drm/ttm/ttm_page_alloc.h>
37#include <drm/drmP.h> 37#include <drm/drmP.h>
38#include <drm/radeon_drm.h> 38#include <drm/radeon_drm.h>
39#include <linux/seq_file.h> 39#include <linux/seq_file.h>
diff --git a/drivers/gpu/drm/radeon/radeon_vm.c b/drivers/gpu/drm/radeon/radeon_vm.c
index a1358748cea5..5f68245579a3 100644
--- a/drivers/gpu/drm/radeon/radeon_vm.c
+++ b/drivers/gpu/drm/radeon/radeon_vm.c
@@ -132,8 +132,8 @@ struct radeon_bo_list *radeon_vm_get_bos(struct radeon_device *rdev,
132 struct radeon_bo_list *list; 132 struct radeon_bo_list *list;
133 unsigned i, idx; 133 unsigned i, idx;
134 134
135 list = drm_malloc_ab(vm->max_pde_used + 2, 135 list = kvmalloc_array(vm->max_pde_used + 2,
136 sizeof(struct radeon_bo_list)); 136 sizeof(struct radeon_bo_list), GFP_KERNEL);
137 if (!list) 137 if (!list)
138 return NULL; 138 return NULL;
139 139
diff --git a/drivers/gpu/drm/radeon/rs780_dpm.c b/drivers/gpu/drm/radeon/rs780_dpm.c
index 94b48fc1e266..b5e4e09a8996 100644
--- a/drivers/gpu/drm/radeon/rs780_dpm.c
+++ b/drivers/gpu/drm/radeon/rs780_dpm.c
@@ -22,7 +22,7 @@
22 * Authors: Alex Deucher 22 * Authors: Alex Deucher
23 */ 23 */
24 24
25#include "drmP.h" 25#include <drm/drmP.h>
26#include "radeon.h" 26#include "radeon.h"
27#include "radeon_asic.h" 27#include "radeon_asic.h"
28#include "rs780d.h" 28#include "rs780d.h"
diff --git a/drivers/gpu/drm/radeon/rv6xx_dpm.c b/drivers/gpu/drm/radeon/rv6xx_dpm.c
index 25e29303b119..d91aa3944593 100644
--- a/drivers/gpu/drm/radeon/rv6xx_dpm.c
+++ b/drivers/gpu/drm/radeon/rv6xx_dpm.c
@@ -22,7 +22,7 @@
22 * Authors: Alex Deucher 22 * Authors: Alex Deucher
23 */ 23 */
24 24
25#include "drmP.h" 25#include <drm/drmP.h>
26#include "radeon.h" 26#include "radeon.h"
27#include "radeon_asic.h" 27#include "radeon_asic.h"
28#include "rv6xxd.h" 28#include "rv6xxd.h"
diff --git a/drivers/gpu/drm/radeon/rv730_dpm.c b/drivers/gpu/drm/radeon/rv730_dpm.c
index d37ba2cb886e..38fdb4152e2a 100644
--- a/drivers/gpu/drm/radeon/rv730_dpm.c
+++ b/drivers/gpu/drm/radeon/rv730_dpm.c
@@ -22,7 +22,7 @@
22 * Authors: Alex Deucher 22 * Authors: Alex Deucher
23 */ 23 */
24 24
25#include "drmP.h" 25#include <drm/drmP.h>
26#include "radeon.h" 26#include "radeon.h"
27#include "rv730d.h" 27#include "rv730d.h"
28#include "r600_dpm.h" 28#include "r600_dpm.h"
diff --git a/drivers/gpu/drm/radeon/rv740_dpm.c b/drivers/gpu/drm/radeon/rv740_dpm.c
index 4b850824fe06..afd597ec5085 100644
--- a/drivers/gpu/drm/radeon/rv740_dpm.c
+++ b/drivers/gpu/drm/radeon/rv740_dpm.c
@@ -22,7 +22,7 @@
22 * Authors: Alex Deucher 22 * Authors: Alex Deucher
23 */ 23 */
24 24
25#include "drmP.h" 25#include <drm/drmP.h>
26#include "radeon.h" 26#include "radeon.h"
27#include "rv740d.h" 27#include "rv740d.h"
28#include "r600_dpm.h" 28#include "r600_dpm.h"
diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c b/drivers/gpu/drm/radeon/rv770_dpm.c
index a010decf59af..cb2a7ec4e217 100644
--- a/drivers/gpu/drm/radeon/rv770_dpm.c
+++ b/drivers/gpu/drm/radeon/rv770_dpm.c
@@ -22,7 +22,7 @@
22 * Authors: Alex Deucher 22 * Authors: Alex Deucher
23 */ 23 */
24 24
25#include "drmP.h" 25#include <drm/drmP.h>
26#include "radeon.h" 26#include "radeon.h"
27#include "radeon_asic.h" 27#include "radeon_asic.h"
28#include "rv770d.h" 28#include "rv770d.h"
diff --git a/drivers/gpu/drm/radeon/rv770_smc.c b/drivers/gpu/drm/radeon/rv770_smc.c
index b2a224407365..2b7ddee3984c 100644
--- a/drivers/gpu/drm/radeon/rv770_smc.c
+++ b/drivers/gpu/drm/radeon/rv770_smc.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include <linux/firmware.h> 25#include <linux/firmware.h>
26#include "drmP.h" 26#include <drm/drmP.h>
27#include "radeon.h" 27#include "radeon.h"
28#include "rv770d.h" 28#include "rv770d.h"
29#include "rv770_dpm.h" 29#include "rv770_dpm.h"
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index c7af9fdd20c7..ee3e74266a13 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -21,7 +21,7 @@
21 * 21 *
22 */ 22 */
23 23
24#include "drmP.h" 24#include <drm/drmP.h>
25#include "radeon.h" 25#include "radeon.h"
26#include "radeon_asic.h" 26#include "radeon_asic.h"
27#include "sid.h" 27#include "sid.h"
diff --git a/drivers/gpu/drm/radeon/si_smc.c b/drivers/gpu/drm/radeon/si_smc.c
index e5bb92f16775..51155abda8d8 100644
--- a/drivers/gpu/drm/radeon/si_smc.c
+++ b/drivers/gpu/drm/radeon/si_smc.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include <linux/firmware.h> 25#include <linux/firmware.h>
26#include "drmP.h" 26#include <drm/drmP.h>
27#include "radeon.h" 27#include "radeon.h"
28#include "sid.h" 28#include "sid.h"
29#include "ppsmc.h" 29#include "ppsmc.h"
diff --git a/drivers/gpu/drm/radeon/sumo_dpm.c b/drivers/gpu/drm/radeon/sumo_dpm.c
index f0d5c1724f55..fd4804829e46 100644
--- a/drivers/gpu/drm/radeon/sumo_dpm.c
+++ b/drivers/gpu/drm/radeon/sumo_dpm.c
@@ -21,7 +21,7 @@
21 * 21 *
22 */ 22 */
23 23
24#include "drmP.h" 24#include <drm/drmP.h>
25#include "radeon.h" 25#include "radeon.h"
26#include "radeon_asic.h" 26#include "radeon_asic.h"
27#include "sumod.h" 27#include "sumod.h"
diff --git a/drivers/gpu/drm/radeon/sumo_smc.c b/drivers/gpu/drm/radeon/sumo_smc.c
index fb081d2ae374..cc051be42362 100644
--- a/drivers/gpu/drm/radeon/sumo_smc.c
+++ b/drivers/gpu/drm/radeon/sumo_smc.c
@@ -21,7 +21,7 @@
21 * 21 *
22 */ 22 */
23 23
24#include "drmP.h" 24#include <drm/drmP.h>
25#include "radeon.h" 25#include "radeon.h"
26#include "sumod.h" 26#include "sumod.h"
27#include "sumo_dpm.h" 27#include "sumo_dpm.h"
diff --git a/drivers/gpu/drm/radeon/trinity_dpm.c b/drivers/gpu/drm/radeon/trinity_dpm.c
index 6730367ac228..2ef7c4e5e495 100644
--- a/drivers/gpu/drm/radeon/trinity_dpm.c
+++ b/drivers/gpu/drm/radeon/trinity_dpm.c
@@ -21,7 +21,7 @@
21 * 21 *
22 */ 22 */
23 23
24#include "drmP.h" 24#include <drm/drmP.h>
25#include "radeon.h" 25#include "radeon.h"
26#include "radeon_asic.h" 26#include "radeon_asic.h"
27#include "trinityd.h" 27#include "trinityd.h"
diff --git a/drivers/gpu/drm/radeon/trinity_smc.c b/drivers/gpu/drm/radeon/trinity_smc.c
index 99dd0455334d..0310e36e3159 100644
--- a/drivers/gpu/drm/radeon/trinity_smc.c
+++ b/drivers/gpu/drm/radeon/trinity_smc.c
@@ -21,7 +21,7 @@
21 * 21 *
22 */ 22 */
23 23
24#include "drmP.h" 24#include <drm/drmP.h>
25#include "radeon.h" 25#include "radeon.h"
26#include "trinityd.h" 26#include "trinityd.h"
27#include "trinity_dpm.h" 27#include "trinity_dpm.h"
diff --git a/drivers/gpu/drm/savage/Makefile b/drivers/gpu/drm/savage/Makefile
index d8f84ac7bb26..cfd436bb28e4 100644
--- a/drivers/gpu/drm/savage/Makefile
+++ b/drivers/gpu/drm/savage/Makefile
@@ -2,7 +2,6 @@
2# Makefile for the drm device driver. This driver provides support for the 2# Makefile for the drm device driver. This driver provides support for the
3# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. 3# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
4 4
5ccflags-y = -Iinclude/drm
6savage-y := savage_drv.o savage_bci.o savage_state.o 5savage-y := savage_drv.o savage_bci.o savage_state.o
7 6
8obj-$(CONFIG_DRM_SAVAGE)+= savage.o 7obj-$(CONFIG_DRM_SAVAGE)+= savage.o
diff --git a/drivers/gpu/drm/sis/Makefile b/drivers/gpu/drm/sis/Makefile
index 441c061c3ad0..7bf4c130c8fd 100644
--- a/drivers/gpu/drm/sis/Makefile
+++ b/drivers/gpu/drm/sis/Makefile
@@ -2,7 +2,6 @@
2# Makefile for the drm device driver. This driver provides support for the 2# Makefile for the drm device driver. This driver provides support for the
3# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. 3# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
4 4
5ccflags-y = -Iinclude/drm
6sis-y := sis_drv.o sis_mm.o 5sis-y := sis_drv.o sis_mm.o
7 6
8obj-$(CONFIG_DRM_SIS) += sis.o 7obj-$(CONFIG_DRM_SIS) += sis.o
diff --git a/drivers/gpu/drm/sti/sti_compositor.c b/drivers/gpu/drm/sti/sti_compositor.c
index 11d4e885893a..6e4bf68262db 100644
--- a/drivers/gpu/drm/sti/sti_compositor.c
+++ b/drivers/gpu/drm/sti/sti_compositor.c
@@ -129,7 +129,7 @@ static int sti_compositor_bind(struct device *dev,
129 } 129 }
130 break; 130 break;
131 default: 131 default:
132 DRM_ERROR("Unknown subdev compoment type\n"); 132 DRM_ERROR("Unknown subdev component type\n");
133 return 1; 133 return 1;
134 } 134 }
135 135
diff --git a/drivers/gpu/drm/stm/Makefile b/drivers/gpu/drm/stm/Makefile
index e114d45dbd42..a09ecf450218 100644
--- a/drivers/gpu/drm/stm/Makefile
+++ b/drivers/gpu/drm/stm/Makefile
@@ -1,5 +1,3 @@
1ccflags-y := -Iinclude/drm
2
3stm-drm-y := \ 1stm-drm-y := \
4 drv.o \ 2 drv.o \
5 ltdc.o 3 ltdc.o
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index a40418cda74a..700cc0800e51 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -463,7 +463,7 @@ static void ltdc_crtc_mode_set_nofb(struct drm_crtc *crtc)
463 clk_enable(ldev->pixel_clk); 463 clk_enable(ldev->pixel_clk);
464 464
465 /* Configures the HS, VS, DE and PC polarities. */ 465 /* Configures the HS, VS, DE and PC polarities. */
466 val = HSPOL_AL | HSPOL_AL | DEPOL_AL | PCPOL_IPC; 466 val = HSPOL_AL | VSPOL_AL | DEPOL_AL | PCPOL_IPC;
467 467
468 if (vm.flags & DISPLAY_FLAGS_HSYNC_HIGH) 468 if (vm.flags & DISPLAY_FLAGS_HSYNC_HIGH)
469 val |= HSPOL_AH; 469 val |= HSPOL_AH;
diff --git a/drivers/gpu/drm/tdfx/Makefile b/drivers/gpu/drm/tdfx/Makefile
index 0379f294b32a..74bd4ae32348 100644
--- a/drivers/gpu/drm/tdfx/Makefile
+++ b/drivers/gpu/drm/tdfx/Makefile
@@ -2,7 +2,6 @@
2# Makefile for the drm device driver. This driver provides support for the 2# Makefile for the drm device driver. This driver provides support for the
3# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. 3# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
4 4
5ccflags-y := -Iinclude/drm
6tdfx-y := tdfx_drv.o 5tdfx-y := tdfx_drv.o
7 6
8obj-$(CONFIG_DRM_TDFX) += tdfx.o 7obj-$(CONFIG_DRM_TDFX) += tdfx.o
diff --git a/drivers/gpu/drm/tilcdc/Makefile b/drivers/gpu/drm/tilcdc/Makefile
index 6f675175a9e5..55ebd516728f 100644
--- a/drivers/gpu/drm/tilcdc/Makefile
+++ b/drivers/gpu/drm/tilcdc/Makefile
@@ -1,4 +1,3 @@
1ccflags-y := -Iinclude/drm
2ifeq (, $(findstring -W,$(EXTRA_CFLAGS))) 1ifeq (, $(findstring -W,$(EXTRA_CFLAGS)))
3 ccflags-y += -Werror 2 ccflags-y += -Werror
4endif 3endif
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index d7ae5be56d12..d67e18983a7d 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -22,6 +22,7 @@
22#include <linux/suspend.h> 22#include <linux/suspend.h>
23#include <drm/drm_atomic.h> 23#include <drm/drm_atomic.h>
24#include <drm/drm_atomic_helper.h> 24#include <drm/drm_atomic_helper.h>
25#include <drm/drm_fb_helper.h>
25 26
26#include "tilcdc_drv.h" 27#include "tilcdc_drv.h"
27#include "tilcdc_regs.h" 28#include "tilcdc_regs.h"
@@ -29,8 +30,6 @@
29#include "tilcdc_panel.h" 30#include "tilcdc_panel.h"
30#include "tilcdc_external.h" 31#include "tilcdc_external.h"
31 32
32#include "drm_fb_helper.h"
33
34static LIST_HEAD(module_list); 33static LIST_HEAD(module_list);
35 34
36static const u32 tilcdc_rev1_formats[] = { DRM_FORMAT_RGB565 }; 35static const u32 tilcdc_rev1_formats[] = { DRM_FORMAT_RGB565 };
diff --git a/drivers/gpu/drm/ttm/Makefile b/drivers/gpu/drm/ttm/Makefile
index f92325800f8a..4d0c938ff4b2 100644
--- a/drivers/gpu/drm/ttm/Makefile
+++ b/drivers/gpu/drm/ttm/Makefile
@@ -1,7 +1,6 @@
1# 1#
2# Makefile for the drm device driver. This driver provides support for the 2# Makefile for the drm device driver. This driver provides support for the
3 3
4ccflags-y := -Iinclude/drm
5ttm-y := ttm_memory.o ttm_tt.o ttm_bo.o \ 4ttm-y := ttm_memory.o ttm_tt.o ttm_bo.o \
6 ttm_bo_util.o ttm_bo_vm.o ttm_module.o \ 5 ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
7 ttm_object.o ttm_lock.o ttm_execbuf_util.o ttm_page_alloc.o \ 6 ttm_object.o ttm_lock.o ttm_execbuf_util.o ttm_page_alloc.o \
diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c
index 9f53df95f35c..b442d12f2f7d 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
@@ -30,9 +30,9 @@
30 30
31#define pr_fmt(fmt) "[TTM] " fmt 31#define pr_fmt(fmt) "[TTM] " fmt
32 32
33#include <ttm/ttm_module.h> 33#include <drm/ttm/ttm_module.h>
34#include <ttm/ttm_bo_driver.h> 34#include <drm/ttm/ttm_bo_driver.h>
35#include <ttm/ttm_placement.h> 35#include <drm/ttm/ttm_placement.h>
36#include <drm/drm_vma_manager.h> 36#include <drm/drm_vma_manager.h>
37#include <linux/mm.h> 37#include <linux/mm.h>
38#include <linux/pfn_t.h> 38#include <linux/pfn_t.h>
diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
index 5260179d788a..8ebc8d3560c3 100644
--- a/drivers/gpu/drm/ttm/ttm_tt.c
+++ b/drivers/gpu/drm/ttm/ttm_tt.c
@@ -39,7 +39,6 @@
39#include <linux/slab.h> 39#include <linux/slab.h>
40#include <linux/export.h> 40#include <linux/export.h>
41#include <drm/drm_cache.h> 41#include <drm/drm_cache.h>
42#include <drm/drm_mem_util.h>
43#include <drm/ttm/ttm_module.h> 42#include <drm/ttm/ttm_module.h>
44#include <drm/ttm/ttm_bo_driver.h> 43#include <drm/ttm/ttm_bo_driver.h>
45#include <drm/ttm/ttm_placement.h> 44#include <drm/ttm/ttm_placement.h>
@@ -53,14 +52,16 @@
53 */ 52 */
54static void ttm_tt_alloc_page_directory(struct ttm_tt *ttm) 53static void ttm_tt_alloc_page_directory(struct ttm_tt *ttm)
55{ 54{
56 ttm->pages = drm_calloc_large(ttm->num_pages, sizeof(void*)); 55 ttm->pages = kvmalloc_array(ttm->num_pages, sizeof(void*),
56 GFP_KERNEL | __GFP_ZERO);
57} 57}
58 58
59static void ttm_dma_tt_alloc_page_directory(struct ttm_dma_tt *ttm) 59static void ttm_dma_tt_alloc_page_directory(struct ttm_dma_tt *ttm)
60{ 60{
61 ttm->ttm.pages = drm_calloc_large(ttm->ttm.num_pages, 61 ttm->ttm.pages = kvmalloc_array(ttm->ttm.num_pages,
62 sizeof(*ttm->ttm.pages) + 62 sizeof(*ttm->ttm.pages) +
63 sizeof(*ttm->dma_address)); 63 sizeof(*ttm->dma_address),
64 GFP_KERNEL | __GFP_ZERO);
64 ttm->dma_address = (void *) (ttm->ttm.pages + ttm->ttm.num_pages); 65 ttm->dma_address = (void *) (ttm->ttm.pages + ttm->ttm.num_pages);
65} 66}
66 67
@@ -208,7 +209,7 @@ EXPORT_SYMBOL(ttm_tt_init);
208 209
209void ttm_tt_fini(struct ttm_tt *ttm) 210void ttm_tt_fini(struct ttm_tt *ttm)
210{ 211{
211 drm_free_large(ttm->pages); 212 kvfree(ttm->pages);
212 ttm->pages = NULL; 213 ttm->pages = NULL;
213} 214}
214EXPORT_SYMBOL(ttm_tt_fini); 215EXPORT_SYMBOL(ttm_tt_fini);
@@ -243,7 +244,7 @@ void ttm_dma_tt_fini(struct ttm_dma_tt *ttm_dma)
243{ 244{
244 struct ttm_tt *ttm = &ttm_dma->ttm; 245 struct ttm_tt *ttm = &ttm_dma->ttm;
245 246
246 drm_free_large(ttm->pages); 247 kvfree(ttm->pages);
247 ttm->pages = NULL; 248 ttm->pages = NULL;
248 ttm_dma->dma_address = NULL; 249 ttm_dma->dma_address = NULL;
249} 250}
diff --git a/drivers/gpu/drm/udl/Makefile b/drivers/gpu/drm/udl/Makefile
index 195bcac0b6c8..36f2e825102b 100644
--- a/drivers/gpu/drm/udl/Makefile
+++ b/drivers/gpu/drm/udl/Makefile
@@ -1,6 +1,3 @@
1
2ccflags-y := -Iinclude/drm
3
4udl-y := udl_drv.o udl_modeset.o udl_connector.o udl_encoder.o udl_main.o udl_fb.o udl_transfer.o udl_gem.o udl_dmabuf.o 1udl-y := udl_drv.o udl_modeset.o udl_connector.o udl_encoder.o udl_main.o udl_fb.o udl_transfer.o udl_gem.o udl_dmabuf.o
5 2
6obj-$(CONFIG_DRM_UDL) := udl.o 3obj-$(CONFIG_DRM_UDL) := udl.o
diff --git a/drivers/gpu/drm/udl/udl_dmabuf.c b/drivers/gpu/drm/udl/udl_dmabuf.c
index ed0e636243b2..2e031a894813 100644
--- a/drivers/gpu/drm/udl/udl_dmabuf.c
+++ b/drivers/gpu/drm/udl/udl_dmabuf.c
@@ -228,7 +228,7 @@ static int udl_prime_create(struct drm_device *dev,
228 return -ENOMEM; 228 return -ENOMEM;
229 229
230 obj->sg = sg; 230 obj->sg = sg;
231 obj->pages = drm_malloc_ab(npages, sizeof(struct page *)); 231 obj->pages = kvmalloc_array(npages, sizeof(struct page *), GFP_KERNEL);
232 if (obj->pages == NULL) { 232 if (obj->pages == NULL) {
233 DRM_ERROR("obj pages is NULL %d\n", npages); 233 DRM_ERROR("obj pages is NULL %d\n", npages);
234 return -ENOMEM; 234 return -ENOMEM;
diff --git a/drivers/gpu/drm/udl/udl_gem.c b/drivers/gpu/drm/udl/udl_gem.c
index 775c50e4f02c..db9ceceba30e 100644
--- a/drivers/gpu/drm/udl/udl_gem.c
+++ b/drivers/gpu/drm/udl/udl_gem.c
@@ -146,7 +146,7 @@ int udl_gem_get_pages(struct udl_gem_object *obj)
146void udl_gem_put_pages(struct udl_gem_object *obj) 146void udl_gem_put_pages(struct udl_gem_object *obj)
147{ 147{
148 if (obj->base.import_attach) { 148 if (obj->base.import_attach) {
149 drm_free_large(obj->pages); 149 kvfree(obj->pages);
150 obj->pages = NULL; 150 obj->pages = NULL;
151 return; 151 return;
152 } 152 }
diff --git a/drivers/gpu/drm/vc4/Kconfig b/drivers/gpu/drm/vc4/Kconfig
index 973b4203c0b2..b16aefe4a8d3 100644
--- a/drivers/gpu/drm/vc4/Kconfig
+++ b/drivers/gpu/drm/vc4/Kconfig
@@ -1,6 +1,6 @@
1config DRM_VC4 1config DRM_VC4
2 tristate "Broadcom VC4 Graphics" 2 tristate "Broadcom VC4 Graphics"
3 depends on ARCH_BCM2835 || COMPILE_TEST 3 depends on ARCH_BCM || ARCH_BCM2835 || COMPILE_TEST
4 depends on DRM 4 depends on DRM
5 depends on SND && SND_SOC 5 depends on SND && SND_SOC
6 depends on COMMON_CLK 6 depends on COMMON_CLK
diff --git a/drivers/gpu/drm/vc4/Makefile b/drivers/gpu/drm/vc4/Makefile
index ab687fba4916..25bd5d30415d 100644
--- a/drivers/gpu/drm/vc4/Makefile
+++ b/drivers/gpu/drm/vc4/Makefile
@@ -1,5 +1,3 @@
1ccflags-y := -Iinclude/drm
2
3# Please keep these build lists sorted! 1# Please keep these build lists sorted!
4 2
5# core driver code 3# core driver code
diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index 1b4dbe9e1c6d..0bfc4d88e4c2 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -32,13 +32,13 @@
32 * ones that set the clock. 32 * ones that set the clock.
33 */ 33 */
34 34
35#include "drm_atomic.h" 35#include <drm/drm_atomic.h>
36#include "drm_atomic_helper.h" 36#include <drm/drm_atomic_helper.h>
37#include "drm_crtc_helper.h" 37#include <drm/drm_crtc_helper.h>
38#include "linux/clk.h" 38#include <linux/clk.h>
39#include "drm_fb_cma_helper.h" 39#include <drm/drm_fb_cma_helper.h>
40#include "linux/component.h" 40#include <linux/component.h>
41#include "linux/of_device.h" 41#include <linux/of_device.h>
42#include "vc4_drv.h" 42#include "vc4_drv.h"
43#include "vc4_regs.h" 43#include "vc4_regs.h"
44 44
diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c
index c6d703903fd9..39d68080873c 100644
--- a/drivers/gpu/drm/vc4/vc4_dpi.c
+++ b/drivers/gpu/drm/vc4/vc4_dpi.c
@@ -22,14 +22,14 @@
22 * ALT2 function. 22 * ALT2 function.
23 */ 23 */
24 24
25#include "drm_atomic_helper.h" 25#include <drm/drm_atomic_helper.h>
26#include "drm_crtc_helper.h" 26#include <drm/drm_crtc_helper.h>
27#include "drm_edid.h" 27#include <drm/drm_edid.h>
28#include "drm_panel.h" 28#include <drm/drm_panel.h>
29#include "linux/clk.h" 29#include <linux/clk.h>
30#include "linux/component.h" 30#include <linux/component.h>
31#include "linux/of_graph.h" 31#include <linux/of_graph.h>
32#include "linux/of_platform.h" 32#include <linux/of_platform.h>
33#include "vc4_drv.h" 33#include "vc4_drv.h"
34#include "vc4_regs.h" 34#include "vc4_regs.h"
35 35
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 863974942c66..136bb4213dc0 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -31,7 +31,7 @@
31#include <linux/of_platform.h> 31#include <linux/of_platform.h>
32#include <linux/platform_device.h> 32#include <linux/platform_device.h>
33#include <linux/pm_runtime.h> 33#include <linux/pm_runtime.h>
34#include "drm_fb_cma_helper.h" 34#include <drm/drm_fb_cma_helper.h>
35#include <drm/drm_fb_helper.h> 35#include <drm/drm_fb_helper.h>
36 36
37#include "uapi/drm/vc4_drm.h" 37#include "uapi/drm/vc4_drm.h"
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index 5ba281361fb7..a97556f7ccba 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -6,12 +6,10 @@
6 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
7 */ 7 */
8 8
9#include "drmP.h"
10#include "drm_gem_cma_helper.h"
11#include "drm_gem_cma_helper.h"
12
13#include <linux/reservation.h> 9#include <linux/reservation.h>
10#include <drm/drmP.h>
14#include <drm/drm_encoder.h> 11#include <drm/drm_encoder.h>
12#include <drm/drm_gem_cma_helper.h>
15 13
16struct vc4_dev { 14struct vc4_dev {
17 struct drm_device *dev; 15 struct drm_device *dev;
diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
index 160f981d1cf4..0ef41df3915f 100644
--- a/drivers/gpu/drm/vc4/vc4_dsi.c
+++ b/drivers/gpu/drm/vc4/vc4_dsi.c
@@ -29,20 +29,20 @@
29 * hopefully present. 29 * hopefully present.
30 */ 30 */
31 31
32#include "drm_atomic_helper.h" 32#include <drm/drm_atomic_helper.h>
33#include "drm_crtc_helper.h" 33#include <drm/drm_crtc_helper.h>
34#include "drm_edid.h" 34#include <drm/drm_edid.h>
35#include "drm_mipi_dsi.h" 35#include <drm/drm_mipi_dsi.h>
36#include "drm_panel.h" 36#include <drm/drm_panel.h>
37#include "linux/clk.h" 37#include <linux/clk.h>
38#include "linux/clk-provider.h" 38#include <linux/clk-provider.h>
39#include "linux/completion.h" 39#include <linux/completion.h>
40#include "linux/component.h" 40#include <linux/component.h>
41#include "linux/dmaengine.h" 41#include <linux/dmaengine.h>
42#include "linux/i2c.h" 42#include <linux/i2c.h>
43#include "linux/of_address.h" 43#include <linux/of_address.h>
44#include "linux/of_platform.h" 44#include <linux/of_platform.h>
45#include "linux/pm_runtime.h" 45#include <linux/pm_runtime.h>
46#include "vc4_drv.h" 46#include "vc4_drv.h"
47#include "vc4_regs.h" 47#include "vc4_regs.h"
48 48
@@ -519,7 +519,8 @@ struct vc4_dsi {
519 /* DSI channel for the panel we're connected to. */ 519 /* DSI channel for the panel we're connected to. */
520 u32 channel; 520 u32 channel;
521 u32 lanes; 521 u32 lanes;
522 enum mipi_dsi_pixel_format format; 522 u32 format;
523 u32 divider;
523 u32 mode_flags; 524 u32 mode_flags;
524 525
525 /* Input clock from CPRMAN to the digital PHY, for the DSI 526 /* Input clock from CPRMAN to the digital PHY, for the DSI
@@ -906,13 +907,67 @@ static void vc4_dsi_encoder_disable(struct drm_encoder *encoder)
906 pm_runtime_put(dev); 907 pm_runtime_put(dev);
907} 908}
908 909
910/* Extends the mode's blank intervals to handle BCM2835's integer-only
911 * DSI PLL divider.
912 *
913 * On 2835, PLLD is set to 2Ghz, and may not be changed by the display
914 * driver since most peripherals are hanging off of the PLLD_PER
915 * divider. PLLD_DSI1, which drives our DSI bit clock (and therefore
916 * the pixel clock), only has an integer divider off of DSI.
917 *
918 * To get our panel mode to refresh at the expected 60Hz, we need to
919 * extend the horizontal blank time. This means we drive a
920 * higher-than-expected clock rate to the panel, but that's what the
921 * firmware does too.
922 */
923static bool vc4_dsi_encoder_mode_fixup(struct drm_encoder *encoder,
924 const struct drm_display_mode *mode,
925 struct drm_display_mode *adjusted_mode)
926{
927 struct vc4_dsi_encoder *vc4_encoder = to_vc4_dsi_encoder(encoder);
928 struct vc4_dsi *dsi = vc4_encoder->dsi;
929 struct clk *phy_parent = clk_get_parent(dsi->pll_phy_clock);
930 unsigned long parent_rate = clk_get_rate(phy_parent);
931 unsigned long pixel_clock_hz = mode->clock * 1000;
932 unsigned long pll_clock = pixel_clock_hz * dsi->divider;
933 int divider;
934
935 /* Find what divider gets us a faster clock than the requested
936 * pixel clock.
937 */
938 for (divider = 1; divider < 8; divider++) {
939 if (parent_rate / divider < pll_clock) {
940 divider--;
941 break;
942 }
943 }
944
945 /* Now that we've picked a PLL divider, calculate back to its
946 * pixel clock.
947 */
948 pll_clock = parent_rate / divider;
949 pixel_clock_hz = pll_clock / dsi->divider;
950
951 /* Round up the clk_set_rate() request slightly, since
952 * PLLD_DSI1 is an integer divider and its rate selection will
953 * never round up.
954 */
955 adjusted_mode->clock = pixel_clock_hz / 1000 + 1;
956
957 /* Given the new pixel clock, adjust HFP to keep vrefresh the same. */
958 adjusted_mode->htotal = pixel_clock_hz / (mode->vrefresh * mode->vtotal);
959 adjusted_mode->hsync_end += adjusted_mode->htotal - mode->htotal;
960 adjusted_mode->hsync_start += adjusted_mode->htotal - mode->htotal;
961
962 return true;
963}
964
909static void vc4_dsi_encoder_enable(struct drm_encoder *encoder) 965static void vc4_dsi_encoder_enable(struct drm_encoder *encoder)
910{ 966{
911 struct drm_display_mode *mode = &encoder->crtc->mode; 967 struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode;
912 struct vc4_dsi_encoder *vc4_encoder = to_vc4_dsi_encoder(encoder); 968 struct vc4_dsi_encoder *vc4_encoder = to_vc4_dsi_encoder(encoder);
913 struct vc4_dsi *dsi = vc4_encoder->dsi; 969 struct vc4_dsi *dsi = vc4_encoder->dsi;
914 struct device *dev = &dsi->pdev->dev; 970 struct device *dev = &dsi->pdev->dev;
915 u32 format = 0, divider = 0;
916 bool debug_dump_regs = false; 971 bool debug_dump_regs = false;
917 unsigned long hs_clock; 972 unsigned long hs_clock;
918 u32 ui_ns; 973 u32 ui_ns;
@@ -940,26 +995,7 @@ static void vc4_dsi_encoder_enable(struct drm_encoder *encoder)
940 vc4_dsi_dump_regs(dsi); 995 vc4_dsi_dump_regs(dsi);
941 } 996 }
942 997
943 switch (dsi->format) { 998 phy_clock = pixel_clock_hz * dsi->divider;
944 case MIPI_DSI_FMT_RGB888:
945 format = DSI_PFORMAT_RGB888;
946 divider = 24 / dsi->lanes;
947 break;
948 case MIPI_DSI_FMT_RGB666:
949 format = DSI_PFORMAT_RGB666;
950 divider = 24 / dsi->lanes;
951 break;
952 case MIPI_DSI_FMT_RGB666_PACKED:
953 format = DSI_PFORMAT_RGB666_PACKED;
954 divider = 18 / dsi->lanes;
955 break;
956 case MIPI_DSI_FMT_RGB565:
957 format = DSI_PFORMAT_RGB565;
958 divider = 16 / dsi->lanes;
959 break;
960 }
961
962 phy_clock = pixel_clock_hz * divider;
963 ret = clk_set_rate(dsi->pll_phy_clock, phy_clock); 999 ret = clk_set_rate(dsi->pll_phy_clock, phy_clock);
964 if (ret) { 1000 if (ret) {
965 dev_err(&dsi->pdev->dev, 1001 dev_err(&dsi->pdev->dev,
@@ -1134,8 +1170,9 @@ static void vc4_dsi_encoder_enable(struct drm_encoder *encoder)
1134 1170
1135 if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO) { 1171 if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO) {
1136 DSI_PORT_WRITE(DISP0_CTRL, 1172 DSI_PORT_WRITE(DISP0_CTRL,
1137 VC4_SET_FIELD(divider, DSI_DISP0_PIX_CLK_DIV) | 1173 VC4_SET_FIELD(dsi->divider,
1138 VC4_SET_FIELD(format, DSI_DISP0_PFORMAT) | 1174 DSI_DISP0_PIX_CLK_DIV) |
1175 VC4_SET_FIELD(dsi->format, DSI_DISP0_PFORMAT) |
1139 VC4_SET_FIELD(DSI_DISP0_LP_STOP_PERFRAME, 1176 VC4_SET_FIELD(DSI_DISP0_LP_STOP_PERFRAME,
1140 DSI_DISP0_LP_STOP_CTRL) | 1177 DSI_DISP0_LP_STOP_CTRL) |
1141 DSI_DISP0_ST_END | 1178 DSI_DISP0_ST_END |
@@ -1347,9 +1384,31 @@ static int vc4_dsi_host_attach(struct mipi_dsi_host *host,
1347 1384
1348 dsi->lanes = device->lanes; 1385 dsi->lanes = device->lanes;
1349 dsi->channel = device->channel; 1386 dsi->channel = device->channel;
1350 dsi->format = device->format;
1351 dsi->mode_flags = device->mode_flags; 1387 dsi->mode_flags = device->mode_flags;
1352 1388
1389 switch (device->format) {
1390 case MIPI_DSI_FMT_RGB888:
1391 dsi->format = DSI_PFORMAT_RGB888;
1392 dsi->divider = 24 / dsi->lanes;
1393 break;
1394 case MIPI_DSI_FMT_RGB666:
1395 dsi->format = DSI_PFORMAT_RGB666;
1396 dsi->divider = 24 / dsi->lanes;
1397 break;
1398 case MIPI_DSI_FMT_RGB666_PACKED:
1399 dsi->format = DSI_PFORMAT_RGB666_PACKED;
1400 dsi->divider = 18 / dsi->lanes;
1401 break;
1402 case MIPI_DSI_FMT_RGB565:
1403 dsi->format = DSI_PFORMAT_RGB565;
1404 dsi->divider = 16 / dsi->lanes;
1405 break;
1406 default:
1407 dev_err(&dsi->pdev->dev, "Unknown DSI format: %d.\n",
1408 dsi->format);
1409 return 0;
1410 }
1411
1353 if (!(dsi->mode_flags & MIPI_DSI_MODE_VIDEO)) { 1412 if (!(dsi->mode_flags & MIPI_DSI_MODE_VIDEO)) {
1354 dev_err(&dsi->pdev->dev, 1413 dev_err(&dsi->pdev->dev,
1355 "Only VIDEO mode panels supported currently.\n"); 1414 "Only VIDEO mode panels supported currently.\n");
@@ -1397,6 +1456,7 @@ static const struct mipi_dsi_host_ops vc4_dsi_host_ops = {
1397static const struct drm_encoder_helper_funcs vc4_dsi_encoder_helper_funcs = { 1456static const struct drm_encoder_helper_funcs vc4_dsi_encoder_helper_funcs = {
1398 .disable = vc4_dsi_encoder_disable, 1457 .disable = vc4_dsi_encoder_disable,
1399 .enable = vc4_dsi_encoder_enable, 1458 .enable = vc4_dsi_encoder_enable,
1459 .mode_fixup = vc4_dsi_encoder_mode_fixup,
1400}; 1460};
1401 1461
1402static const struct of_device_id vc4_dsi_dt_match[] = { 1462static const struct of_device_id vc4_dsi_dt_match[] = {
diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
index 735412e3725a..9dc7646d49ed 100644
--- a/drivers/gpu/drm/vc4/vc4_gem.c
+++ b/drivers/gpu/drm/vc4/vc4_gem.c
@@ -660,14 +660,15 @@ vc4_cl_lookup_bos(struct drm_device *dev,
660 return -EINVAL; 660 return -EINVAL;
661 } 661 }
662 662
663 exec->bo = drm_calloc_large(exec->bo_count, 663 exec->bo = kvmalloc_array(exec->bo_count,
664 sizeof(struct drm_gem_cma_object *)); 664 sizeof(struct drm_gem_cma_object *),
665 GFP_KERNEL | __GFP_ZERO);
665 if (!exec->bo) { 666 if (!exec->bo) {
666 DRM_ERROR("Failed to allocate validated BO pointers\n"); 667 DRM_ERROR("Failed to allocate validated BO pointers\n");
667 return -ENOMEM; 668 return -ENOMEM;
668 } 669 }
669 670
670 handles = drm_malloc_ab(exec->bo_count, sizeof(uint32_t)); 671 handles = kvmalloc_array(exec->bo_count, sizeof(uint32_t), GFP_KERNEL);
671 if (!handles) { 672 if (!handles) {
672 ret = -ENOMEM; 673 ret = -ENOMEM;
673 DRM_ERROR("Failed to allocate incoming GEM handles\n"); 674 DRM_ERROR("Failed to allocate incoming GEM handles\n");
@@ -699,7 +700,7 @@ vc4_cl_lookup_bos(struct drm_device *dev,
699 spin_unlock(&file_priv->table_lock); 700 spin_unlock(&file_priv->table_lock);
700 701
701fail: 702fail:
702 drm_free_large(handles); 703 kvfree(handles);
703 return ret; 704 return ret;
704} 705}
705 706
@@ -737,7 +738,7 @@ vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec)
737 * read the contents back for validation, and I think the 738 * read the contents back for validation, and I think the
738 * bo->vaddr is uncached access. 739 * bo->vaddr is uncached access.
739 */ 740 */
740 temp = drm_malloc_ab(temp_size, 1); 741 temp = kvmalloc_array(temp_size, 1, GFP_KERNEL);
741 if (!temp) { 742 if (!temp) {
742 DRM_ERROR("Failed to allocate storage for copying " 743 DRM_ERROR("Failed to allocate storage for copying "
743 "in bin/render CLs.\n"); 744 "in bin/render CLs.\n");
@@ -812,7 +813,7 @@ vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec)
812 ret = vc4_wait_for_seqno(dev, exec->bin_dep_seqno, ~0ull, true); 813 ret = vc4_wait_for_seqno(dev, exec->bin_dep_seqno, ~0ull, true);
813 814
814fail: 815fail:
815 drm_free_large(temp); 816 kvfree(temp);
816 return ret; 817 return ret;
817} 818}
818 819
@@ -832,7 +833,7 @@ vc4_complete_exec(struct drm_device *dev, struct vc4_exec_info *exec)
832 if (exec->bo) { 833 if (exec->bo) {
833 for (i = 0; i < exec->bo_count; i++) 834 for (i = 0; i < exec->bo_count; i++)
834 drm_gem_object_unreference_unlocked(&exec->bo[i]->base); 835 drm_gem_object_unreference_unlocked(&exec->bo[i]->base);
835 drm_free_large(exec->bo); 836 kvfree(exec->bo);
836 } 837 }
837 838
838 while (!list_empty(&exec->unref_list)) { 839 while (!list_empty(&exec->unref_list)) {
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 3c2723f6345c..ed63d4e85762 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -42,21 +42,21 @@
42 * encoder block has CEC support. 42 * encoder block has CEC support.
43 */ 43 */
44 44
45#include "drm_atomic_helper.h" 45#include <drm/drm_atomic_helper.h>
46#include "drm_crtc_helper.h" 46#include <drm/drm_crtc_helper.h>
47#include "drm_edid.h" 47#include <drm/drm_edid.h>
48#include "linux/clk.h" 48#include <linux/clk.h>
49#include "linux/component.h" 49#include <linux/component.h>
50#include "linux/i2c.h" 50#include <linux/i2c.h>
51#include "linux/of_address.h" 51#include <linux/of_address.h>
52#include "linux/of_gpio.h" 52#include <linux/of_gpio.h>
53#include "linux/of_platform.h" 53#include <linux/of_platform.h>
54#include "linux/pm_runtime.h" 54#include <linux/pm_runtime.h>
55#include "linux/rational.h" 55#include <linux/rational.h>
56#include "sound/dmaengine_pcm.h" 56#include <sound/dmaengine_pcm.h>
57#include "sound/pcm_drm_eld.h" 57#include <sound/pcm_drm_eld.h>
58#include "sound/pcm_params.h" 58#include <sound/pcm_params.h>
59#include "sound/soc.h" 59#include <sound/soc.h>
60#include "vc4_drv.h" 60#include "vc4_drv.h"
61#include "vc4_regs.h" 61#include "vc4_regs.h"
62 62
diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c
index fd421ba3c5d7..2b62fc5b8d85 100644
--- a/drivers/gpu/drm/vc4/vc4_hvs.c
+++ b/drivers/gpu/drm/vc4/vc4_hvs.c
@@ -22,7 +22,7 @@
22 * each CRTC. 22 * each CRTC.
23 */ 23 */
24 24
25#include "linux/component.h" 25#include <linux/component.h>
26#include "vc4_drv.h" 26#include "vc4_drv.h"
27#include "vc4_regs.h" 27#include "vc4_regs.h"
28 28
diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
index 237a504f11f0..928d191ef90f 100644
--- a/drivers/gpu/drm/vc4/vc4_kms.c
+++ b/drivers/gpu/drm/vc4/vc4_kms.c
@@ -14,12 +14,12 @@
14 * crtc, HDMI encoder). 14 * crtc, HDMI encoder).
15 */ 15 */
16 16
17#include "drm_crtc.h" 17#include <drm/drm_crtc.h>
18#include "drm_atomic.h" 18#include <drm/drm_atomic.h>
19#include "drm_atomic_helper.h" 19#include <drm/drm_atomic_helper.h>
20#include "drm_crtc_helper.h" 20#include <drm/drm_crtc_helper.h>
21#include "drm_plane_helper.h" 21#include <drm/drm_plane_helper.h>
22#include "drm_fb_cma_helper.h" 22#include <drm/drm_fb_cma_helper.h>
23#include "vc4_drv.h" 23#include "vc4_drv.h"
24 24
25static void vc4_output_poll_changed(struct drm_device *dev) 25static void vc4_output_poll_changed(struct drm_device *dev)
diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index d34cd5393a9b..da18dec21696 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -18,12 +18,13 @@
18 * into the region of the HVS that it has allocated for us. 18 * into the region of the HVS that it has allocated for us.
19 */ 19 */
20 20
21#include <drm/drm_atomic.h>
22#include <drm/drm_atomic_helper.h>
23#include <drm/drm_fb_cma_helper.h>
24#include <drm/drm_plane_helper.h>
25
21#include "vc4_drv.h" 26#include "vc4_drv.h"
22#include "vc4_regs.h" 27#include "vc4_regs.h"
23#include "drm_atomic.h"
24#include "drm_atomic_helper.h"
25#include "drm_fb_cma_helper.h"
26#include "drm_plane_helper.h"
27 28
28enum vc4_scaling_mode { 29enum vc4_scaling_mode {
29 VC4_SCALING_NONE, 30 VC4_SCALING_NONE,
diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c
index c53afec34586..5ae5518e605b 100644
--- a/drivers/gpu/drm/vc4/vc4_v3d.c
+++ b/drivers/gpu/drm/vc4/vc4_v3d.c
@@ -16,9 +16,9 @@
16 * this program. If not, see <http://www.gnu.org/licenses/>. 16 * this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 18
19#include "linux/clk.h" 19#include <linux/clk.h>
20#include "linux/component.h" 20#include <linux/component.h>
21#include "linux/pm_runtime.h" 21#include <linux/pm_runtime.h>
22#include "vc4_drv.h" 22#include "vc4_drv.h"
23#include "vc4_regs.h" 23#include "vc4_regs.h"
24 24
diff --git a/drivers/gpu/drm/vc4/vc4_validate.c b/drivers/gpu/drm/vc4/vc4_validate.c
index 3de8f11595c0..814b512c6b9a 100644
--- a/drivers/gpu/drm/vc4/vc4_validate.c
+++ b/drivers/gpu/drm/vc4/vc4_validate.c
@@ -172,7 +172,8 @@ vc4_check_tex_size(struct vc4_exec_info *exec, struct drm_gem_cma_object *fbo,
172 * our math. 172 * our math.
173 */ 173 */
174 if (width > 4096 || height > 4096) { 174 if (width > 4096 || height > 4096) {
175 DRM_ERROR("Surface dimesions (%d,%d) too large", width, height); 175 DRM_ERROR("Surface dimensions (%d,%d) too large",
176 width, height);
176 return false; 177 return false;
177 } 178 }
178 179
diff --git a/drivers/gpu/drm/vgem/Makefile b/drivers/gpu/drm/vgem/Makefile
index bfcdea1330e6..cb5d413b9c93 100644
--- a/drivers/gpu/drm/vgem/Makefile
+++ b/drivers/gpu/drm/vgem/Makefile
@@ -1,4 +1,3 @@
1ccflags-y := -Iinclude/drm
2vgem-y := vgem_drv.o vgem_fence.o 1vgem-y := vgem_drv.o vgem_fence.o
3 2
4obj-$(CONFIG_DRM_VGEM) += vgem.o 3obj-$(CONFIG_DRM_VGEM) += vgem.o
diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
index 4b23ba049632..18f401b442c2 100644
--- a/drivers/gpu/drm/vgem/vgem_drv.c
+++ b/drivers/gpu/drm/vgem/vgem_drv.c
@@ -51,7 +51,7 @@ static void vgem_gem_free_object(struct drm_gem_object *obj)
51{ 51{
52 struct drm_vgem_gem_object *vgem_obj = to_vgem_bo(obj); 52 struct drm_vgem_gem_object *vgem_obj = to_vgem_bo(obj);
53 53
54 drm_free_large(vgem_obj->pages); 54 kvfree(vgem_obj->pages);
55 55
56 if (obj->import_attach) 56 if (obj->import_attach)
57 drm_prime_gem_destroy(obj, vgem_obj->table); 57 drm_prime_gem_destroy(obj, vgem_obj->table);
@@ -328,7 +328,7 @@ static struct drm_gem_object *vgem_prime_import_sg_table(struct drm_device *dev,
328 npages = PAGE_ALIGN(attach->dmabuf->size) / PAGE_SIZE; 328 npages = PAGE_ALIGN(attach->dmabuf->size) / PAGE_SIZE;
329 329
330 obj->table = sg; 330 obj->table = sg;
331 obj->pages = drm_malloc_ab(npages, sizeof(struct page *)); 331 obj->pages = kvmalloc_array(npages, sizeof(struct page *), GFP_KERNEL);
332 if (!obj->pages) { 332 if (!obj->pages) {
333 __vgem_gem_destroy(obj); 333 __vgem_gem_destroy(obj);
334 return ERR_PTR(-ENOMEM); 334 return ERR_PTR(-ENOMEM);
@@ -438,8 +438,8 @@ static int __init vgem_init(void)
438 438
439 vgem_device->platform = 439 vgem_device->platform =
440 platform_device_register_simple("vgem", -1, NULL, 0); 440 platform_device_register_simple("vgem", -1, NULL, 0);
441 if (!vgem_device->platform) { 441 if (IS_ERR(vgem_device->platform)) {
442 ret = -ENODEV; 442 ret = PTR_ERR(vgem_device->platform);
443 goto out_fini; 443 goto out_fini;
444 } 444 }
445 445
diff --git a/drivers/gpu/drm/via/Makefile b/drivers/gpu/drm/via/Makefile
index d59e258e2c13..751fa8b8a014 100644
--- a/drivers/gpu/drm/via/Makefile
+++ b/drivers/gpu/drm/via/Makefile
@@ -2,7 +2,6 @@
2# Makefile for the drm device driver. This driver provides support for the 2# Makefile for the drm device driver. This driver provides support for the
3# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. 3# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
4 4
5ccflags-y := -Iinclude/drm
6via-y := via_irq.o via_drv.o via_map.o via_mm.o via_dma.o via_verifier.o via_video.o via_dmablit.o 5via-y := via_irq.o via_drv.o via_map.o via_mm.o via_dma.o via_verifier.o via_video.o via_dmablit.o
7 6
8obj-$(CONFIG_DRM_VIA) +=via.o 7obj-$(CONFIG_DRM_VIA) +=via.o
diff --git a/drivers/gpu/drm/virtio/Makefile b/drivers/gpu/drm/virtio/Makefile
index 3fb8eac1084f..7684f613bdc3 100644
--- a/drivers/gpu/drm/virtio/Makefile
+++ b/drivers/gpu/drm/virtio/Makefile
@@ -2,8 +2,6 @@
2# Makefile for the drm device driver. This driver provides support for the 2# Makefile for the drm device driver. This driver provides support for the
3# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. 3# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
4 4
5ccflags-y := -Iinclude/drm
6
7virtio-gpu-y := virtgpu_drv.o virtgpu_kms.o virtgpu_drm_bus.o virtgpu_gem.o \ 5virtio-gpu-y := virtgpu_drv.o virtgpu_kms.o virtgpu_drm_bus.o virtgpu_gem.o \
8 virtgpu_fb.o virtgpu_display.o virtgpu_vq.o virtgpu_ttm.o \ 6 virtgpu_fb.o virtgpu_display.o virtgpu_vq.o virtgpu_ttm.o \
9 virtgpu_fence.o virtgpu_object.o virtgpu_debugfs.o virtgpu_plane.o \ 7 virtgpu_fence.o virtgpu_object.o virtgpu_debugfs.o virtgpu_plane.o \
diff --git a/drivers/gpu/drm/virtio/virtgpu_debugfs.c b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
index f51240aa720d..73dc99046c43 100644
--- a/drivers/gpu/drm/virtio/virtgpu_debugfs.c
+++ b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
@@ -24,8 +24,8 @@
24 */ 24 */
25 25
26#include <linux/debugfs.h> 26#include <linux/debugfs.h>
27#include <drm/drmP.h>
27 28
28#include "drmP.h"
29#include "virtgpu_drv.h" 29#include "virtgpu_drv.h"
30 30
31static int 31static int
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c
index 2d29b0141545..63d35c7e416c 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.c
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.c
@@ -29,8 +29,8 @@
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/console.h> 30#include <linux/console.h>
31#include <linux/pci.h> 31#include <linux/pci.h>
32#include "drmP.h" 32#include <drm/drmP.h>
33#include "drm/drm.h" 33#include <drm/drm.h>
34 34
35#include "virtgpu_drv.h" 35#include "virtgpu_drv.h"
36static struct drm_driver driver; 36static struct drm_driver driver;
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
index 1328185bfd59..3a66abb8fd50 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.h
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
@@ -36,10 +36,10 @@
36#include <drm/drm_atomic.h> 36#include <drm/drm_atomic.h>
37#include <drm/drm_crtc_helper.h> 37#include <drm/drm_crtc_helper.h>
38#include <drm/drm_encoder.h> 38#include <drm/drm_encoder.h>
39#include <ttm/ttm_bo_api.h> 39#include <drm/ttm/ttm_bo_api.h>
40#include <ttm/ttm_bo_driver.h> 40#include <drm/ttm/ttm_bo_driver.h>
41#include <ttm/ttm_placement.h> 41#include <drm/ttm/ttm_placement.h>
42#include <ttm/ttm_module.h> 42#include <drm/ttm/ttm_module.h>
43 43
44#define DRIVER_NAME "virtio_gpu" 44#define DRIVER_NAME "virtio_gpu"
45#define DRIVER_DESC "virtio GPU" 45#define DRIVER_DESC "virtio GPU"
diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index 61f3a963af95..b94bd5440e57 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -26,9 +26,10 @@
26 */ 26 */
27 27
28#include <drm/drmP.h> 28#include <drm/drmP.h>
29#include "virtgpu_drv.h"
30#include <drm/virtgpu_drm.h> 29#include <drm/virtgpu_drm.h>
31#include "ttm/ttm_execbuf_util.h" 30#include <drm/ttm/ttm_execbuf_util.h>
31
32#include "virtgpu_drv.h"
32 33
33static void convert_to_hw_box(struct virtio_gpu_box *dst, 34static void convert_to_hw_box(struct virtio_gpu_box *dst,
34 const struct drm_virtgpu_3d_box *src) 35 const struct drm_virtgpu_3d_box *src)
@@ -119,13 +120,14 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
119 INIT_LIST_HEAD(&validate_list); 120 INIT_LIST_HEAD(&validate_list);
120 if (exbuf->num_bo_handles) { 121 if (exbuf->num_bo_handles) {
121 122
122 bo_handles = drm_malloc_ab(exbuf->num_bo_handles, 123 bo_handles = kvmalloc_array(exbuf->num_bo_handles,
123 sizeof(uint32_t)); 124 sizeof(uint32_t), GFP_KERNEL);
124 buflist = drm_calloc_large(exbuf->num_bo_handles, 125 buflist = kvmalloc_array(exbuf->num_bo_handles,
125 sizeof(struct ttm_validate_buffer)); 126 sizeof(struct ttm_validate_buffer),
127 GFP_KERNEL | __GFP_ZERO);
126 if (!bo_handles || !buflist) { 128 if (!bo_handles || !buflist) {
127 drm_free_large(bo_handles); 129 kvfree(bo_handles);
128 drm_free_large(buflist); 130 kvfree(buflist);
129 return -ENOMEM; 131 return -ENOMEM;
130 } 132 }
131 133
@@ -133,16 +135,16 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
133 if (copy_from_user(bo_handles, user_bo_handles, 135 if (copy_from_user(bo_handles, user_bo_handles,
134 exbuf->num_bo_handles * sizeof(uint32_t))) { 136 exbuf->num_bo_handles * sizeof(uint32_t))) {
135 ret = -EFAULT; 137 ret = -EFAULT;
136 drm_free_large(bo_handles); 138 kvfree(bo_handles);
137 drm_free_large(buflist); 139 kvfree(buflist);
138 return ret; 140 return ret;
139 } 141 }
140 142
141 for (i = 0; i < exbuf->num_bo_handles; i++) { 143 for (i = 0; i < exbuf->num_bo_handles; i++) {
142 gobj = drm_gem_object_lookup(drm_file, bo_handles[i]); 144 gobj = drm_gem_object_lookup(drm_file, bo_handles[i]);
143 if (!gobj) { 145 if (!gobj) {
144 drm_free_large(bo_handles); 146 kvfree(bo_handles);
145 drm_free_large(buflist); 147 kvfree(buflist);
146 return -ENOENT; 148 return -ENOENT;
147 } 149 }
148 150
@@ -151,7 +153,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
151 153
152 list_add(&buflist[i].head, &validate_list); 154 list_add(&buflist[i].head, &validate_list);
153 } 155 }
154 drm_free_large(bo_handles); 156 kvfree(bo_handles);
155 } 157 }
156 158
157 ret = virtio_gpu_object_list_validate(&ticket, &validate_list); 159 ret = virtio_gpu_object_list_validate(&ticket, &validate_list);
@@ -171,7 +173,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
171 173
172 /* fence the command bo */ 174 /* fence the command bo */
173 virtio_gpu_unref_list(&validate_list); 175 virtio_gpu_unref_list(&validate_list);
174 drm_free_large(buflist); 176 kvfree(buflist);
175 dma_fence_put(&fence->f); 177 dma_fence_put(&fence->f);
176 return 0; 178 return 0;
177 179
@@ -179,7 +181,7 @@ out_unresv:
179 ttm_eu_backoff_reservation(&ticket, &validate_list); 181 ttm_eu_backoff_reservation(&ticket, &validate_list);
180out_free: 182out_free:
181 virtio_gpu_unref_list(&validate_list); 183 virtio_gpu_unref_list(&validate_list);
182 drm_free_large(buflist); 184 kvfree(buflist);
183 return ret; 185 return ret;
184} 186}
185 187
diff --git a/drivers/gpu/drm/virtio/virtgpu_ttm.c b/drivers/gpu/drm/virtio/virtgpu_ttm.c
index 4e8e27d50922..c1f2af4ca4ca 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ttm.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ttm.c
@@ -25,11 +25,11 @@
25 * OTHER DEALINGS IN THE SOFTWARE. 25 * OTHER DEALINGS IN THE SOFTWARE.
26 */ 26 */
27 27
28#include <ttm/ttm_bo_api.h> 28#include <drm/ttm/ttm_bo_api.h>
29#include <ttm/ttm_bo_driver.h> 29#include <drm/ttm/ttm_bo_driver.h>
30#include <ttm/ttm_placement.h> 30#include <drm/ttm/ttm_placement.h>
31#include <ttm/ttm_page_alloc.h> 31#include <drm/ttm/ttm_page_alloc.h>
32#include <ttm/ttm_module.h> 32#include <drm/ttm/ttm_module.h>
33#include <drm/drmP.h> 33#include <drm/drmP.h>
34#include <drm/drm.h> 34#include <drm/drm.h>
35#include <drm/virtgpu_drm.h> 35#include <drm/virtgpu_drm.h>
diff --git a/drivers/gpu/drm/vmwgfx/Makefile b/drivers/gpu/drm/vmwgfx/Makefile
index aac17a640cce..a365330bbb82 100644
--- a/drivers/gpu/drm/vmwgfx/Makefile
+++ b/drivers/gpu/drm/vmwgfx/Makefile
@@ -1,6 +1,3 @@
1
2ccflags-y := -Iinclude/drm
3
4vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr.o vmwgfx_kms.o vmwgfx_drv.o \ 1vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr.o vmwgfx_kms.o vmwgfx_drv.o \
5 vmwgfx_fb.o vmwgfx_ioctl.o vmwgfx_resource.o vmwgfx_buffer.o \ 2 vmwgfx_fb.o vmwgfx_ioctl.o vmwgfx_resource.o vmwgfx_buffer.o \
6 vmwgfx_fifo.o vmwgfx_irq.o vmwgfx_ldu.o vmwgfx_ttm_glue.o \ 3 vmwgfx_fifo.o vmwgfx_irq.o vmwgfx_ldu.o vmwgfx_ttm_glue.o \
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
index 77cb7c627e09..99a7f4ab7d97 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
@@ -25,8 +25,9 @@
25 * 25 *
26 **************************************************************************/ 26 **************************************************************************/
27 27
28#include <drm/ttm/ttm_bo_api.h>
29
28#include "vmwgfx_drv.h" 30#include "vmwgfx_drv.h"
29#include "ttm/ttm_bo_api.h"
30 31
31/* 32/*
32 * Size of inline command buffers. Try to make sure that a page size is a 33 * Size of inline command buffers. Try to make sure that a page size is a
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
index 443d1ed00de7..bcc6d4136c87 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
@@ -25,10 +25,11 @@
25 * 25 *
26 **************************************************************************/ 26 **************************************************************************/
27 27
28#include <drm/ttm/ttm_placement.h>
29
28#include "vmwgfx_drv.h" 30#include "vmwgfx_drv.h"
29#include "vmwgfx_resource_priv.h" 31#include "vmwgfx_resource_priv.h"
30#include "vmwgfx_binding.h" 32#include "vmwgfx_binding.h"
31#include "ttm/ttm_placement.h"
32 33
33struct vmw_user_context { 34struct vmw_user_context {
34 struct ttm_base_object base; 35 struct ttm_base_object base;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
index 265c81e6cf39..6c026d75c180 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
@@ -30,9 +30,10 @@
30 * whenever the backing MOB is evicted. 30 * whenever the backing MOB is evicted.
31 */ 31 */
32 32
33#include <drm/ttm/ttm_placement.h>
34
33#include "vmwgfx_drv.h" 35#include "vmwgfx_drv.h"
34#include "vmwgfx_resource_priv.h" 36#include "vmwgfx_resource_priv.h"
35#include <ttm/ttm_placement.h>
36#include "vmwgfx_so.h" 37#include "vmwgfx_so.h"
37 38
38/** 39/**
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index ef9f3a2a4030..a8876b070168 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -566,7 +566,7 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
566 566
567 ret = drm_plane_helper_check_update(plane, state->crtc, new_fb, 567 ret = drm_plane_helper_check_update(plane, state->crtc, new_fb,
568 &src, &dest, &clip, 568 &src, &dest, &clip,
569 DRM_ROTATE_0, 569 DRM_MODE_ROTATE_0,
570 DRM_PLANE_HELPER_NO_SCALING, 570 DRM_PLANE_HELPER_NO_SCALING,
571 DRM_PLANE_HELPER_NO_SCALING, 571 DRM_PLANE_HELPER_NO_SCALING,
572 false, true, &visible); 572 false, true, &visible);
@@ -845,7 +845,7 @@ void vmw_du_plane_reset(struct drm_plane *plane)
845 845
846 plane->state = &vps->base; 846 plane->state = &vps->base;
847 plane->state->plane = plane; 847 plane->state->plane = plane;
848 plane->state->rotation = DRM_ROTATE_0; 848 plane->state->rotation = DRM_MODE_ROTATE_0;
849} 849}
850 850
851 851
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
index e57a0bad7a62..6063c9636d4a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
@@ -30,7 +30,7 @@
30#include <linux/kernel.h> 30#include <linux/kernel.h>
31#include <linux/frame.h> 31#include <linux/frame.h>
32#include <asm/hypervisor.h> 32#include <asm/hypervisor.h>
33#include "drmP.h" 33#include <drm/drmP.h>
34#include "vmwgfx_msg.h" 34#include "vmwgfx_msg.h"
35 35
36 36
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
index 92f8b1d04f0f..68f135c5b0d8 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
@@ -25,10 +25,11 @@
25 * 25 *
26 **************************************************************************/ 26 **************************************************************************/
27 27
28#include <drm/ttm/ttm_placement.h>
29
28#include "vmwgfx_drv.h" 30#include "vmwgfx_drv.h"
29#include "vmwgfx_resource_priv.h" 31#include "vmwgfx_resource_priv.h"
30#include "vmwgfx_binding.h" 32#include "vmwgfx_binding.h"
31#include "ttm/ttm_placement.h"
32 33
33struct vmw_shader { 34struct vmw_shader {
34 struct vmw_resource res; 35 struct vmw_resource res;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index 7681341fe32b..5900cff5bbc3 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -25,11 +25,12 @@
25 * 25 *
26 **************************************************************************/ 26 **************************************************************************/
27 27
28#include <drm/ttm/ttm_placement.h>
29
28#include "vmwgfx_drv.h" 30#include "vmwgfx_drv.h"
29#include "vmwgfx_resource_priv.h" 31#include "vmwgfx_resource_priv.h"
30#include "vmwgfx_so.h" 32#include "vmwgfx_so.h"
31#include "vmwgfx_binding.h" 33#include "vmwgfx_binding.h"
32#include <ttm/ttm_placement.h>
33#include "device_include/svga3d_surfacedefs.h" 34#include "device_include/svga3d_surfacedefs.h"
34 35
35 36