aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-21 03:11:18 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-21 03:11:18 -0400
commita38fd7d808e6a9dcc8fac30fc870ccb88ce07221 (patch)
tree59940901934cf4939733e70ef34fbc47ab15eede /drivers
parent234b69e3e089d850a98e7b3145bd00e9b52b1111 (diff)
parent4fcb7f8be829d21bcbb24eef2204fb6b34ed1f80 (diff)
Merge tag 'drm-fixes-2018-09-21' of git://anongit.freedesktop.org/drm/drm
David writes: "drm fixes for 4.19-rc5: - core: fix debugfs for atomic, fix the check for atomic for non-modesetting drivers - amdgpu: adds a new PCI id, some kfd fixes and a sdma fix - i915: a bunch of GVT fixes. - vc4: scaling fix - vmwgfx: modesetting fixes and a old buffer eviction fix - udl: framebuffer destruction fix - sun4i: disable on R40 fix until next kernel - pl111: NULL termination on table fix" * tag 'drm-fixes-2018-09-21' of git://anongit.freedesktop.org/drm/drm: (21 commits) drm/amdkfd: Fix ATS capablity was not reported correctly on some APUs drm/amdkfd: Change the control stack MTYPE from UC to NC on GFX9 drm/amdgpu: Fix SDMA HQD destroy error on gfx_v7 drm/vmwgfx: Fix buffer object eviction drm/vmwgfx: Don't impose STDU limits on framebuffer size drm/vmwgfx: limit mode size for all display unit to texture_max drm/vmwgfx: limit screen size to stdu_max during check_modeset drm/vmwgfx: don't check for old_crtc_state enable status drm/amdgpu: add new polaris pci id drm: sun4i: drop second PLL from A64 HDMI PHY drm: fix drm_drv_uses_atomic_modeset on non modesetting drivers. drm/i915/gvt: clear ggtt entries when destroy vgpu drm/i915/gvt: request srcu_read_lock before checking if one gfn is valid drm/i915/gvt: Add GEN9_CLKGATE_DIS_4 to default BXT mmio handler drm/i915/gvt: Init PHY related registers for BXT drm/atomic: Use drm_drv_uses_atomic_modeset() for debugfs creation drm/fb-helper: Remove set but not used variable 'connector_funcs' drm: udl: Destroy framebuffer only if it was initialized drm/sun4i: Remove R40 display pipeline compatibles drm/pl111: Make sure of_device_id tables are NULL terminated ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c6
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c14
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c1
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_device.c3
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_iommu.c13
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c2
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_priv.h1
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_topology.c21
-rw-r--r--drivers/gpu/drm/amd/include/kgd_kfd_interface.h2
-rw-r--r--drivers/gpu/drm/drm_atomic.c2
-rw-r--r--drivers/gpu/drm/drm_debugfs.c2
-rw-r--r--drivers/gpu/drm/drm_fb_helper.c3
-rw-r--r--drivers/gpu/drm/i915/gvt/handlers.c1
-rw-r--r--drivers/gpu/drm/i915/gvt/kvmgt.c7
-rw-r--r--drivers/gpu/drm/i915/gvt/mmio.c28
-rw-r--r--drivers/gpu/drm/i915/gvt/vgpu.c1
-rw-r--r--drivers/gpu/drm/pl111/pl111_vexpress.c3
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_drv.c1
-rw-r--r--drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c1
-rw-r--r--drivers/gpu/drm/sun4i/sun8i_mixer.c24
-rw-r--r--drivers/gpu/drm/sun4i/sun8i_tcon_top.c1
-rw-r--r--drivers/gpu/drm/udl/udl_fb.c8
-rw-r--r--drivers/gpu/drm/vc4/vc4_plane.c25
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c2
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_kms.c42
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c25
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_surface.c24
29 files changed, 151 insertions, 116 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
index f8bbbb3a9504..0c791e35acf0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
@@ -272,7 +272,7 @@ void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd)
272 272
273int alloc_gtt_mem(struct kgd_dev *kgd, size_t size, 273int alloc_gtt_mem(struct kgd_dev *kgd, size_t size,
274 void **mem_obj, uint64_t *gpu_addr, 274 void **mem_obj, uint64_t *gpu_addr,
275 void **cpu_ptr) 275 void **cpu_ptr, bool mqd_gfx9)
276{ 276{
277 struct amdgpu_device *adev = (struct amdgpu_device *)kgd; 277 struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
278 struct amdgpu_bo *bo = NULL; 278 struct amdgpu_bo *bo = NULL;
@@ -287,6 +287,10 @@ int alloc_gtt_mem(struct kgd_dev *kgd, size_t size,
287 bp.flags = AMDGPU_GEM_CREATE_CPU_GTT_USWC; 287 bp.flags = AMDGPU_GEM_CREATE_CPU_GTT_USWC;
288 bp.type = ttm_bo_type_kernel; 288 bp.type = ttm_bo_type_kernel;
289 bp.resv = NULL; 289 bp.resv = NULL;
290
291 if (mqd_gfx9)
292 bp.flags |= AMDGPU_GEM_CREATE_MQD_GFX9;
293
290 r = amdgpu_bo_create(adev, &bp, &bo); 294 r = amdgpu_bo_create(adev, &bp, &bo);
291 if (r) { 295 if (r) {
292 dev_err(adev->dev, 296 dev_err(adev->dev,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
index 2f379c183ed2..cc9aeab5468c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
@@ -136,7 +136,7 @@ void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd);
136/* Shared API */ 136/* Shared API */
137int alloc_gtt_mem(struct kgd_dev *kgd, size_t size, 137int alloc_gtt_mem(struct kgd_dev *kgd, size_t size,
138 void **mem_obj, uint64_t *gpu_addr, 138 void **mem_obj, uint64_t *gpu_addr,
139 void **cpu_ptr); 139 void **cpu_ptr, bool mqd_gfx9);
140void free_gtt_mem(struct kgd_dev *kgd, void *mem_obj); 140void free_gtt_mem(struct kgd_dev *kgd, void *mem_obj);
141void get_local_mem_info(struct kgd_dev *kgd, 141void get_local_mem_info(struct kgd_dev *kgd,
142 struct kfd_local_mem_info *mem_info); 142 struct kfd_local_mem_info *mem_info);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c
index ea3f698aef5e..9803b91f3e77 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c
@@ -685,7 +685,7 @@ static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd,
685 685
686 while (true) { 686 while (true) {
687 temp = RREG32(sdma_base_addr + mmSDMA0_RLC0_CONTEXT_STATUS); 687 temp = RREG32(sdma_base_addr + mmSDMA0_RLC0_CONTEXT_STATUS);
688 if (temp & SDMA0_STATUS_REG__RB_CMD_IDLE__SHIFT) 688 if (temp & SDMA0_RLC0_CONTEXT_STATUS__IDLE_MASK)
689 break; 689 break;
690 if (time_after(jiffies, end_jiffies)) 690 if (time_after(jiffies, end_jiffies))
691 return -ETIME; 691 return -ETIME;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
index 693ec5ea4950..8816c697b205 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
@@ -367,12 +367,14 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
367 break; 367 break;
368 case CHIP_POLARIS10: 368 case CHIP_POLARIS10:
369 if (type == CGS_UCODE_ID_SMU) { 369 if (type == CGS_UCODE_ID_SMU) {
370 if ((adev->pdev->device == 0x67df) && 370 if (((adev->pdev->device == 0x67df) &&
371 ((adev->pdev->revision == 0xe0) || 371 ((adev->pdev->revision == 0xe0) ||
372 (adev->pdev->revision == 0xe3) || 372 (adev->pdev->revision == 0xe3) ||
373 (adev->pdev->revision == 0xe4) || 373 (adev->pdev->revision == 0xe4) ||
374 (adev->pdev->revision == 0xe5) || 374 (adev->pdev->revision == 0xe5) ||
375 (adev->pdev->revision == 0xe7) || 375 (adev->pdev->revision == 0xe7) ||
376 (adev->pdev->revision == 0xef))) ||
377 ((adev->pdev->device == 0x6fdf) &&
376 (adev->pdev->revision == 0xef))) { 378 (adev->pdev->revision == 0xef))) {
377 info->is_kicker = true; 379 info->is_kicker = true;
378 strcpy(fw_name, "amdgpu/polaris10_k_smc.bin"); 380 strcpy(fw_name, "amdgpu/polaris10_k_smc.bin");
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 8843a06360fa..0f41d8647376 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -740,6 +740,7 @@ static const struct pci_device_id pciidlist[] = {
740 {0x1002, 0x67CA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10}, 740 {0x1002, 0x67CA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
741 {0x1002, 0x67CC, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10}, 741 {0x1002, 0x67CC, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
742 {0x1002, 0x67CF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10}, 742 {0x1002, 0x67CF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
743 {0x1002, 0x6FDF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
743 /* Polaris12 */ 744 /* Polaris12 */
744 {0x1002, 0x6980, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12}, 745 {0x1002, 0x6980, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
745 {0x1002, 0x6981, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12}, 746 {0x1002, 0x6981, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
index 1b048715ab8a..29ac74f40dce 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
@@ -457,7 +457,8 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
457 457
458 if (kfd->kfd2kgd->init_gtt_mem_allocation( 458 if (kfd->kfd2kgd->init_gtt_mem_allocation(
459 kfd->kgd, size, &kfd->gtt_mem, 459 kfd->kgd, size, &kfd->gtt_mem,
460 &kfd->gtt_start_gpu_addr, &kfd->gtt_start_cpu_ptr)){ 460 &kfd->gtt_start_gpu_addr, &kfd->gtt_start_cpu_ptr,
461 false)) {
461 dev_err(kfd_device, "Could not allocate %d bytes\n", size); 462 dev_err(kfd_device, "Could not allocate %d bytes\n", size);
462 goto out; 463 goto out;
463 } 464 }
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_iommu.c b/drivers/gpu/drm/amd/amdkfd/kfd_iommu.c
index 7a61f38c09e6..01494752c36a 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_iommu.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_iommu.c
@@ -62,9 +62,20 @@ int kfd_iommu_device_init(struct kfd_dev *kfd)
62 struct amd_iommu_device_info iommu_info; 62 struct amd_iommu_device_info iommu_info;
63 unsigned int pasid_limit; 63 unsigned int pasid_limit;
64 int err; 64 int err;
65 struct kfd_topology_device *top_dev;
65 66
66 if (!kfd->device_info->needs_iommu_device) 67 top_dev = kfd_topology_device_by_id(kfd->id);
68
69 /*
70 * Overwrite ATS capability according to needs_iommu_device to fix
71 * potential missing corresponding bit in CRAT of BIOS.
72 */
73 if (!kfd->device_info->needs_iommu_device) {
74 top_dev->node_props.capability &= ~HSA_CAP_ATS_PRESENT;
67 return 0; 75 return 0;
76 }
77
78 top_dev->node_props.capability |= HSA_CAP_ATS_PRESENT;
68 79
69 iommu_info.flags = 0; 80 iommu_info.flags = 0;
70 err = amd_iommu_device_info(kfd->pdev, &iommu_info); 81 err = amd_iommu_device_info(kfd->pdev, &iommu_info);
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
index f5fc3675f21e..0cedb37cf513 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
@@ -88,7 +88,7 @@ static int init_mqd(struct mqd_manager *mm, void **mqd,
88 ALIGN(sizeof(struct v9_mqd), PAGE_SIZE), 88 ALIGN(sizeof(struct v9_mqd), PAGE_SIZE),
89 &((*mqd_mem_obj)->gtt_mem), 89 &((*mqd_mem_obj)->gtt_mem),
90 &((*mqd_mem_obj)->gpu_addr), 90 &((*mqd_mem_obj)->gpu_addr),
91 (void *)&((*mqd_mem_obj)->cpu_ptr)); 91 (void *)&((*mqd_mem_obj)->cpu_ptr), true);
92 } else 92 } else
93 retval = kfd_gtt_sa_allocate(mm->dev, sizeof(struct v9_mqd), 93 retval = kfd_gtt_sa_allocate(mm->dev, sizeof(struct v9_mqd),
94 mqd_mem_obj); 94 mqd_mem_obj);
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
index f971710f1c91..92b285ca73aa 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -806,6 +806,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu);
806int kfd_topology_remove_device(struct kfd_dev *gpu); 806int kfd_topology_remove_device(struct kfd_dev *gpu);
807struct kfd_topology_device *kfd_topology_device_by_proximity_domain( 807struct kfd_topology_device *kfd_topology_device_by_proximity_domain(
808 uint32_t proximity_domain); 808 uint32_t proximity_domain);
809struct kfd_topology_device *kfd_topology_device_by_id(uint32_t gpu_id);
809struct kfd_dev *kfd_device_by_id(uint32_t gpu_id); 810struct kfd_dev *kfd_device_by_id(uint32_t gpu_id);
810struct kfd_dev *kfd_device_by_pci_dev(const struct pci_dev *pdev); 811struct kfd_dev *kfd_device_by_pci_dev(const struct pci_dev *pdev);
811int kfd_topology_enum_kfd_devices(uint8_t idx, struct kfd_dev **kdev); 812int kfd_topology_enum_kfd_devices(uint8_t idx, struct kfd_dev **kdev);
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
index bc95d4dfee2e..80f5db4ef75f 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
@@ -63,22 +63,33 @@ struct kfd_topology_device *kfd_topology_device_by_proximity_domain(
63 return device; 63 return device;
64} 64}
65 65
66struct kfd_dev *kfd_device_by_id(uint32_t gpu_id) 66struct kfd_topology_device *kfd_topology_device_by_id(uint32_t gpu_id)
67{ 67{
68 struct kfd_topology_device *top_dev; 68 struct kfd_topology_device *top_dev = NULL;
69 struct kfd_dev *device = NULL; 69 struct kfd_topology_device *ret = NULL;
70 70
71 down_read(&topology_lock); 71 down_read(&topology_lock);
72 72
73 list_for_each_entry(top_dev, &topology_device_list, list) 73 list_for_each_entry(top_dev, &topology_device_list, list)
74 if (top_dev->gpu_id == gpu_id) { 74 if (top_dev->gpu_id == gpu_id) {
75 device = top_dev->gpu; 75 ret = top_dev;
76 break; 76 break;
77 } 77 }
78 78
79 up_read(&topology_lock); 79 up_read(&topology_lock);
80 80
81 return device; 81 return ret;
82}
83
84struct kfd_dev *kfd_device_by_id(uint32_t gpu_id)
85{
86 struct kfd_topology_device *top_dev;
87
88 top_dev = kfd_topology_device_by_id(gpu_id);
89 if (!top_dev)
90 return NULL;
91
92 return top_dev->gpu;
82} 93}
83 94
84struct kfd_dev *kfd_device_by_pci_dev(const struct pci_dev *pdev) 95struct kfd_dev *kfd_device_by_pci_dev(const struct pci_dev *pdev)
diff --git a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
index 14391b06080c..43b82e14007e 100644
--- a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
+++ b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
@@ -292,7 +292,7 @@ struct tile_config {
292struct kfd2kgd_calls { 292struct kfd2kgd_calls {
293 int (*init_gtt_mem_allocation)(struct kgd_dev *kgd, size_t size, 293 int (*init_gtt_mem_allocation)(struct kgd_dev *kgd, size_t size,
294 void **mem_obj, uint64_t *gpu_addr, 294 void **mem_obj, uint64_t *gpu_addr,
295 void **cpu_ptr); 295 void **cpu_ptr, bool mqd_gfx9);
296 296
297 void (*free_gtt_mem)(struct kgd_dev *kgd, void *mem_obj); 297 void (*free_gtt_mem)(struct kgd_dev *kgd, void *mem_obj);
298 298
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 3eb061e11e2e..018fcdb353d2 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -2067,7 +2067,7 @@ static void __drm_state_dump(struct drm_device *dev, struct drm_printer *p,
2067 struct drm_connector *connector; 2067 struct drm_connector *connector;
2068 struct drm_connector_list_iter conn_iter; 2068 struct drm_connector_list_iter conn_iter;
2069 2069
2070 if (!drm_core_check_feature(dev, DRIVER_ATOMIC)) 2070 if (!drm_drv_uses_atomic_modeset(dev))
2071 return; 2071 return;
2072 2072
2073 list_for_each_entry(plane, &config->plane_list, head) { 2073 list_for_each_entry(plane, &config->plane_list, head) {
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index 6f28fe58f169..373bd4c2b698 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -151,7 +151,7 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,
151 return ret; 151 return ret;
152 } 152 }
153 153
154 if (drm_core_check_feature(dev, DRIVER_ATOMIC)) { 154 if (drm_drv_uses_atomic_modeset(dev)) {
155 ret = drm_atomic_debugfs_init(minor); 155 ret = drm_atomic_debugfs_init(minor);
156 if (ret) { 156 if (ret) {
157 DRM_ERROR("Failed to create atomic debugfs files\n"); 157 DRM_ERROR("Failed to create atomic debugfs files\n");
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 4b0dd20bccb8..16ec93b75dbf 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -2370,7 +2370,6 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper,
2370{ 2370{
2371 int c, o; 2371 int c, o;
2372 struct drm_connector *connector; 2372 struct drm_connector *connector;
2373 const struct drm_connector_helper_funcs *connector_funcs;
2374 int my_score, best_score, score; 2373 int my_score, best_score, score;
2375 struct drm_fb_helper_crtc **crtcs, *crtc; 2374 struct drm_fb_helper_crtc **crtcs, *crtc;
2376 struct drm_fb_helper_connector *fb_helper_conn; 2375 struct drm_fb_helper_connector *fb_helper_conn;
@@ -2399,8 +2398,6 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper,
2399 if (drm_has_preferred_mode(fb_helper_conn, width, height)) 2398 if (drm_has_preferred_mode(fb_helper_conn, width, height))
2400 my_score++; 2399 my_score++;
2401 2400
2402 connector_funcs = connector->helper_private;
2403
2404 /* 2401 /*
2405 * select a crtc for this connector and then attempt to configure 2402 * select a crtc for this connector and then attempt to configure
2406 * remaining connectors 2403 * remaining connectors
diff --git a/drivers/gpu/drm/i915/gvt/handlers.c b/drivers/gpu/drm/i915/gvt/handlers.c
index 72afa518edd9..94c1089ecf59 100644
--- a/drivers/gpu/drm/i915/gvt/handlers.c
+++ b/drivers/gpu/drm/i915/gvt/handlers.c
@@ -3210,6 +3210,7 @@ static int init_bxt_mmio_info(struct intel_gvt *gvt)
3210 MMIO_D(BXT_DSI_PLL_ENABLE, D_BXT); 3210 MMIO_D(BXT_DSI_PLL_ENABLE, D_BXT);
3211 3211
3212 MMIO_D(GEN9_CLKGATE_DIS_0, D_BXT); 3212 MMIO_D(GEN9_CLKGATE_DIS_0, D_BXT);
3213 MMIO_D(GEN9_CLKGATE_DIS_4, D_BXT);
3213 3214
3214 MMIO_D(HSW_TVIDEO_DIP_GCP(TRANSCODER_A), D_BXT); 3215 MMIO_D(HSW_TVIDEO_DIP_GCP(TRANSCODER_A), D_BXT);
3215 MMIO_D(HSW_TVIDEO_DIP_GCP(TRANSCODER_B), D_BXT); 3216 MMIO_D(HSW_TVIDEO_DIP_GCP(TRANSCODER_B), D_BXT);
diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
index c7afee37b2b8..9ad89e38f6c0 100644
--- a/drivers/gpu/drm/i915/gvt/kvmgt.c
+++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
@@ -1833,6 +1833,8 @@ static bool kvmgt_is_valid_gfn(unsigned long handle, unsigned long gfn)
1833{ 1833{
1834 struct kvmgt_guest_info *info; 1834 struct kvmgt_guest_info *info;
1835 struct kvm *kvm; 1835 struct kvm *kvm;
1836 int idx;
1837 bool ret;
1836 1838
1837 if (!handle_valid(handle)) 1839 if (!handle_valid(handle))
1838 return false; 1840 return false;
@@ -1840,8 +1842,11 @@ static bool kvmgt_is_valid_gfn(unsigned long handle, unsigned long gfn)
1840 info = (struct kvmgt_guest_info *)handle; 1842 info = (struct kvmgt_guest_info *)handle;
1841 kvm = info->kvm; 1843 kvm = info->kvm;
1842 1844
1843 return kvm_is_visible_gfn(kvm, gfn); 1845 idx = srcu_read_lock(&kvm->srcu);
1846 ret = kvm_is_visible_gfn(kvm, gfn);
1847 srcu_read_unlock(&kvm->srcu, idx);
1844 1848
1849 return ret;
1845} 1850}
1846 1851
1847struct intel_gvt_mpt kvmgt_mpt = { 1852struct intel_gvt_mpt kvmgt_mpt = {
diff --git a/drivers/gpu/drm/i915/gvt/mmio.c b/drivers/gpu/drm/i915/gvt/mmio.c
index 994366035364..9bb9a85c992c 100644
--- a/drivers/gpu/drm/i915/gvt/mmio.c
+++ b/drivers/gpu/drm/i915/gvt/mmio.c
@@ -244,6 +244,34 @@ void intel_vgpu_reset_mmio(struct intel_vgpu *vgpu, bool dmlr)
244 244
245 /* set the bit 0:2(Core C-State ) to C0 */ 245 /* set the bit 0:2(Core C-State ) to C0 */
246 vgpu_vreg_t(vgpu, GEN6_GT_CORE_STATUS) = 0; 246 vgpu_vreg_t(vgpu, GEN6_GT_CORE_STATUS) = 0;
247
248 if (IS_BROXTON(vgpu->gvt->dev_priv)) {
249 vgpu_vreg_t(vgpu, BXT_P_CR_GT_DISP_PWRON) &=
250 ~(BIT(0) | BIT(1));
251 vgpu_vreg_t(vgpu, BXT_PORT_CL1CM_DW0(DPIO_PHY0)) &=
252 ~PHY_POWER_GOOD;
253 vgpu_vreg_t(vgpu, BXT_PORT_CL1CM_DW0(DPIO_PHY1)) &=
254 ~PHY_POWER_GOOD;
255 vgpu_vreg_t(vgpu, BXT_PHY_CTL_FAMILY(DPIO_PHY0)) &=
256 ~BIT(30);
257 vgpu_vreg_t(vgpu, BXT_PHY_CTL_FAMILY(DPIO_PHY1)) &=
258 ~BIT(30);
259 vgpu_vreg_t(vgpu, BXT_PHY_CTL(PORT_A)) &=
260 ~BXT_PHY_LANE_ENABLED;
261 vgpu_vreg_t(vgpu, BXT_PHY_CTL(PORT_A)) |=
262 BXT_PHY_CMNLANE_POWERDOWN_ACK |
263 BXT_PHY_LANE_POWERDOWN_ACK;
264 vgpu_vreg_t(vgpu, BXT_PHY_CTL(PORT_B)) &=
265 ~BXT_PHY_LANE_ENABLED;
266 vgpu_vreg_t(vgpu, BXT_PHY_CTL(PORT_B)) |=
267 BXT_PHY_CMNLANE_POWERDOWN_ACK |
268 BXT_PHY_LANE_POWERDOWN_ACK;
269 vgpu_vreg_t(vgpu, BXT_PHY_CTL(PORT_C)) &=
270 ~BXT_PHY_LANE_ENABLED;
271 vgpu_vreg_t(vgpu, BXT_PHY_CTL(PORT_C)) |=
272 BXT_PHY_CMNLANE_POWERDOWN_ACK |
273 BXT_PHY_LANE_POWERDOWN_ACK;
274 }
247 } else { 275 } else {
248#define GVT_GEN8_MMIO_RESET_OFFSET (0x44200) 276#define GVT_GEN8_MMIO_RESET_OFFSET (0x44200)
249 /* only reset the engine related, so starting with 0x44200 277 /* only reset the engine related, so starting with 0x44200
diff --git a/drivers/gpu/drm/i915/gvt/vgpu.c b/drivers/gpu/drm/i915/gvt/vgpu.c
index a4e8e3cf74fd..c628be05fbfe 100644
--- a/drivers/gpu/drm/i915/gvt/vgpu.c
+++ b/drivers/gpu/drm/i915/gvt/vgpu.c
@@ -281,6 +281,7 @@ void intel_gvt_destroy_vgpu(struct intel_vgpu *vgpu)
281 intel_vgpu_clean_submission(vgpu); 281 intel_vgpu_clean_submission(vgpu);
282 intel_vgpu_clean_display(vgpu); 282 intel_vgpu_clean_display(vgpu);
283 intel_vgpu_clean_opregion(vgpu); 283 intel_vgpu_clean_opregion(vgpu);
284 intel_vgpu_reset_ggtt(vgpu, true);
284 intel_vgpu_clean_gtt(vgpu); 285 intel_vgpu_clean_gtt(vgpu);
285 intel_gvt_hypervisor_detach_vgpu(vgpu); 286 intel_gvt_hypervisor_detach_vgpu(vgpu);
286 intel_vgpu_free_resource(vgpu); 287 intel_vgpu_free_resource(vgpu);
diff --git a/drivers/gpu/drm/pl111/pl111_vexpress.c b/drivers/gpu/drm/pl111/pl111_vexpress.c
index a534b225e31b..5fa0441bb6df 100644
--- a/drivers/gpu/drm/pl111/pl111_vexpress.c
+++ b/drivers/gpu/drm/pl111/pl111_vexpress.c
@@ -111,7 +111,8 @@ static int vexpress_muxfpga_probe(struct platform_device *pdev)
111} 111}
112 112
113static const struct of_device_id vexpress_muxfpga_match[] = { 113static const struct of_device_id vexpress_muxfpga_match[] = {
114 { .compatible = "arm,vexpress-muxfpga", } 114 { .compatible = "arm,vexpress-muxfpga", },
115 {}
115}; 116};
116 117
117static struct platform_driver vexpress_muxfpga_driver = { 118static struct platform_driver vexpress_muxfpga_driver = {
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index dd19d674055c..8b0cd08034e0 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -418,7 +418,6 @@ static const struct of_device_id sun4i_drv_of_table[] = {
418 { .compatible = "allwinner,sun8i-a33-display-engine" }, 418 { .compatible = "allwinner,sun8i-a33-display-engine" },
419 { .compatible = "allwinner,sun8i-a83t-display-engine" }, 419 { .compatible = "allwinner,sun8i-a83t-display-engine" },
420 { .compatible = "allwinner,sun8i-h3-display-engine" }, 420 { .compatible = "allwinner,sun8i-h3-display-engine" },
421 { .compatible = "allwinner,sun8i-r40-display-engine" },
422 { .compatible = "allwinner,sun8i-v3s-display-engine" }, 421 { .compatible = "allwinner,sun8i-v3s-display-engine" },
423 { .compatible = "allwinner,sun9i-a80-display-engine" }, 422 { .compatible = "allwinner,sun9i-a80-display-engine" },
424 { } 423 { }
diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
index 82502b351aec..a564b5dfe082 100644
--- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
+++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
@@ -398,7 +398,6 @@ static struct regmap_config sun8i_hdmi_phy_regmap_config = {
398 398
399static const struct sun8i_hdmi_phy_variant sun50i_a64_hdmi_phy = { 399static const struct sun8i_hdmi_phy_variant sun50i_a64_hdmi_phy = {
400 .has_phy_clk = true, 400 .has_phy_clk = true,
401 .has_second_pll = true,
402 .phy_init = &sun8i_hdmi_phy_init_h3, 401 .phy_init = &sun8i_hdmi_phy_init_h3,
403 .phy_disable = &sun8i_hdmi_phy_disable_h3, 402 .phy_disable = &sun8i_hdmi_phy_disable_h3,
404 .phy_config = &sun8i_hdmi_phy_config_h3, 403 .phy_config = &sun8i_hdmi_phy_config_h3,
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
index fc3713608f78..cb65b0ed53fd 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
@@ -545,22 +545,6 @@ static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = {
545 .vi_num = 1, 545 .vi_num = 1,
546}; 546};
547 547
548static const struct sun8i_mixer_cfg sun8i_r40_mixer0_cfg = {
549 .ccsc = 0,
550 .mod_rate = 297000000,
551 .scaler_mask = 0xf,
552 .ui_num = 3,
553 .vi_num = 1,
554};
555
556static const struct sun8i_mixer_cfg sun8i_r40_mixer1_cfg = {
557 .ccsc = 1,
558 .mod_rate = 297000000,
559 .scaler_mask = 0x3,
560 .ui_num = 1,
561 .vi_num = 1,
562};
563
564static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = { 548static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = {
565 .vi_num = 2, 549 .vi_num = 2,
566 .ui_num = 1, 550 .ui_num = 1,
@@ -583,14 +567,6 @@ static const struct of_device_id sun8i_mixer_of_table[] = {
583 .data = &sun8i_h3_mixer0_cfg, 567 .data = &sun8i_h3_mixer0_cfg,
584 }, 568 },
585 { 569 {
586 .compatible = "allwinner,sun8i-r40-de2-mixer-0",
587 .data = &sun8i_r40_mixer0_cfg,
588 },
589 {
590 .compatible = "allwinner,sun8i-r40-de2-mixer-1",
591 .data = &sun8i_r40_mixer1_cfg,
592 },
593 {
594 .compatible = "allwinner,sun8i-v3s-de2-mixer", 570 .compatible = "allwinner,sun8i-v3s-de2-mixer",
595 .data = &sun8i_v3s_mixer_cfg, 571 .data = &sun8i_v3s_mixer_cfg,
596 }, 572 },
diff --git a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
index 55fe398d8290..d5240b777a8f 100644
--- a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
+++ b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
@@ -253,7 +253,6 @@ static int sun8i_tcon_top_remove(struct platform_device *pdev)
253 253
254/* sun4i_drv uses this list to check if a device node is a TCON TOP */ 254/* sun4i_drv uses this list to check if a device node is a TCON TOP */
255const struct of_device_id sun8i_tcon_top_of_table[] = { 255const struct of_device_id sun8i_tcon_top_of_table[] = {
256 { .compatible = "allwinner,sun8i-r40-tcon-top" },
257 { /* sentinel */ } 256 { /* sentinel */ }
258}; 257};
259MODULE_DEVICE_TABLE(of, sun8i_tcon_top_of_table); 258MODULE_DEVICE_TABLE(of, sun8i_tcon_top_of_table);
diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
index dbb62f6eb48a..dd9ffded223b 100644
--- a/drivers/gpu/drm/udl/udl_fb.c
+++ b/drivers/gpu/drm/udl/udl_fb.c
@@ -432,9 +432,11 @@ static void udl_fbdev_destroy(struct drm_device *dev,
432{ 432{
433 drm_fb_helper_unregister_fbi(&ufbdev->helper); 433 drm_fb_helper_unregister_fbi(&ufbdev->helper);
434 drm_fb_helper_fini(&ufbdev->helper); 434 drm_fb_helper_fini(&ufbdev->helper);
435 drm_framebuffer_unregister_private(&ufbdev->ufb.base); 435 if (ufbdev->ufb.obj) {
436 drm_framebuffer_cleanup(&ufbdev->ufb.base); 436 drm_framebuffer_unregister_private(&ufbdev->ufb.base);
437 drm_gem_object_put_unlocked(&ufbdev->ufb.obj->base); 437 drm_framebuffer_cleanup(&ufbdev->ufb.base);
438 drm_gem_object_put_unlocked(&ufbdev->ufb.obj->base);
439 }
438} 440}
439 441
440int udl_fbdev_init(struct drm_device *dev) 442int udl_fbdev_init(struct drm_device *dev)
diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index cfb50fedfa2b..a3275fa66b7b 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -297,6 +297,9 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state)
297 vc4_state->y_scaling[0] = vc4_get_scaling_mode(vc4_state->src_h[0], 297 vc4_state->y_scaling[0] = vc4_get_scaling_mode(vc4_state->src_h[0],
298 vc4_state->crtc_h); 298 vc4_state->crtc_h);
299 299
300 vc4_state->is_unity = (vc4_state->x_scaling[0] == VC4_SCALING_NONE &&
301 vc4_state->y_scaling[0] == VC4_SCALING_NONE);
302
300 if (num_planes > 1) { 303 if (num_planes > 1) {
301 vc4_state->is_yuv = true; 304 vc4_state->is_yuv = true;
302 305
@@ -312,24 +315,17 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state)
312 vc4_get_scaling_mode(vc4_state->src_h[1], 315 vc4_get_scaling_mode(vc4_state->src_h[1],
313 vc4_state->crtc_h); 316 vc4_state->crtc_h);
314 317
315 /* YUV conversion requires that scaling be enabled, 318 /* YUV conversion requires that horizontal scaling be enabled,
316 * even on a plane that's otherwise 1:1. Choose TPZ 319 * even on a plane that's otherwise 1:1. Looks like only PPF
317 * for simplicity. 320 * works in that case, so let's pick that one.
318 */ 321 */
319 if (vc4_state->x_scaling[0] == VC4_SCALING_NONE) 322 if (vc4_state->is_unity)
320 vc4_state->x_scaling[0] = VC4_SCALING_TPZ; 323 vc4_state->x_scaling[0] = VC4_SCALING_PPF;
321 if (vc4_state->y_scaling[0] == VC4_SCALING_NONE)
322 vc4_state->y_scaling[0] = VC4_SCALING_TPZ;
323 } else { 324 } else {
324 vc4_state->x_scaling[1] = VC4_SCALING_NONE; 325 vc4_state->x_scaling[1] = VC4_SCALING_NONE;
325 vc4_state->y_scaling[1] = VC4_SCALING_NONE; 326 vc4_state->y_scaling[1] = VC4_SCALING_NONE;
326 } 327 }
327 328
328 vc4_state->is_unity = (vc4_state->x_scaling[0] == VC4_SCALING_NONE &&
329 vc4_state->y_scaling[0] == VC4_SCALING_NONE &&
330 vc4_state->x_scaling[1] == VC4_SCALING_NONE &&
331 vc4_state->y_scaling[1] == VC4_SCALING_NONE);
332
333 /* No configuring scaling on the cursor plane, since it gets 329 /* No configuring scaling on the cursor plane, since it gets
334 non-vblank-synced updates, and scaling requires requires 330 non-vblank-synced updates, and scaling requires requires
335 LBM changes which have to be vblank-synced. 331 LBM changes which have to be vblank-synced.
@@ -672,7 +668,10 @@ static int vc4_plane_mode_set(struct drm_plane *plane,
672 vc4_dlist_write(vc4_state, SCALER_CSC2_ITR_R_601_5); 668 vc4_dlist_write(vc4_state, SCALER_CSC2_ITR_R_601_5);
673 } 669 }
674 670
675 if (!vc4_state->is_unity) { 671 if (vc4_state->x_scaling[0] != VC4_SCALING_NONE ||
672 vc4_state->x_scaling[1] != VC4_SCALING_NONE ||
673 vc4_state->y_scaling[0] != VC4_SCALING_NONE ||
674 vc4_state->y_scaling[1] != VC4_SCALING_NONE) {
676 /* LBM Base Address. */ 675 /* LBM Base Address. */
677 if (vc4_state->y_scaling[0] != VC4_SCALING_NONE || 676 if (vc4_state->y_scaling[0] != VC4_SCALING_NONE ||
678 vc4_state->y_scaling[1] != VC4_SCALING_NONE) { 677 vc4_state->y_scaling[1] != VC4_SCALING_NONE) {
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index 1f134570b759..f0ab6b2313bb 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
@@ -3729,7 +3729,7 @@ int vmw_validate_single_buffer(struct vmw_private *dev_priv,
3729{ 3729{
3730 struct vmw_buffer_object *vbo = 3730 struct vmw_buffer_object *vbo =
3731 container_of(bo, struct vmw_buffer_object, base); 3731 container_of(bo, struct vmw_buffer_object, base);
3732 struct ttm_operation_ctx ctx = { interruptible, true }; 3732 struct ttm_operation_ctx ctx = { interruptible, false };
3733 int ret; 3733 int ret;
3734 3734
3735 if (vbo->pin_count > 0) 3735 if (vbo->pin_count > 0)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 23beff5d8e3c..6a712a8d59e9 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -1512,21 +1512,19 @@ static int vmw_kms_check_display_memory(struct drm_device *dev,
1512 struct drm_rect *rects) 1512 struct drm_rect *rects)
1513{ 1513{
1514 struct vmw_private *dev_priv = vmw_priv(dev); 1514 struct vmw_private *dev_priv = vmw_priv(dev);
1515 struct drm_mode_config *mode_config = &dev->mode_config;
1516 struct drm_rect bounding_box = {0}; 1515 struct drm_rect bounding_box = {0};
1517 u64 total_pixels = 0, pixel_mem, bb_mem; 1516 u64 total_pixels = 0, pixel_mem, bb_mem;
1518 int i; 1517 int i;
1519 1518
1520 for (i = 0; i < num_rects; i++) { 1519 for (i = 0; i < num_rects; i++) {
1521 /* 1520 /*
1522 * Currently this check is limiting the topology within max 1521 * For STDU only individual screen (screen target) is limited by
1523 * texture/screentarget size. This should change in future when 1522 * SCREENTARGET_MAX_WIDTH/HEIGHT registers.
1524 * user-space support multiple fb with topology.
1525 */ 1523 */
1526 if (rects[i].x1 < 0 || rects[i].y1 < 0 || 1524 if (dev_priv->active_display_unit == vmw_du_screen_target &&
1527 rects[i].x2 > mode_config->max_width || 1525 (drm_rect_width(&rects[i]) > dev_priv->stdu_max_width ||
1528 rects[i].y2 > mode_config->max_height) { 1526 drm_rect_height(&rects[i]) > dev_priv->stdu_max_height)) {
1529 DRM_ERROR("Invalid GUI layout.\n"); 1527 DRM_ERROR("Screen size not supported.\n");
1530 return -EINVAL; 1528 return -EINVAL;
1531 } 1529 }
1532 1530
@@ -1615,7 +1613,7 @@ static int vmw_kms_check_topology(struct drm_device *dev,
1615 struct drm_connector_state *conn_state; 1613 struct drm_connector_state *conn_state;
1616 struct vmw_connector_state *vmw_conn_state; 1614 struct vmw_connector_state *vmw_conn_state;
1617 1615
1618 if (!new_crtc_state->enable && old_crtc_state->enable) { 1616 if (!new_crtc_state->enable) {
1619 rects[i].x1 = 0; 1617 rects[i].x1 = 0;
1620 rects[i].y1 = 0; 1618 rects[i].y1 = 0;
1621 rects[i].x2 = 0; 1619 rects[i].x2 = 0;
@@ -2216,12 +2214,16 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector,
2216 if (dev_priv->assume_16bpp) 2214 if (dev_priv->assume_16bpp)
2217 assumed_bpp = 2; 2215 assumed_bpp = 2;
2218 2216
2217 max_width = min(max_width, dev_priv->texture_max_width);
2218 max_height = min(max_height, dev_priv->texture_max_height);
2219
2220 /*
2221 * For STDU extra limit for a mode on SVGA_REG_SCREENTARGET_MAX_WIDTH/
2222 * HEIGHT registers.
2223 */
2219 if (dev_priv->active_display_unit == vmw_du_screen_target) { 2224 if (dev_priv->active_display_unit == vmw_du_screen_target) {
2220 max_width = min(max_width, dev_priv->stdu_max_width); 2225 max_width = min(max_width, dev_priv->stdu_max_width);
2221 max_width = min(max_width, dev_priv->texture_max_width);
2222
2223 max_height = min(max_height, dev_priv->stdu_max_height); 2226 max_height = min(max_height, dev_priv->stdu_max_height);
2224 max_height = min(max_height, dev_priv->texture_max_height);
2225 } 2227 }
2226 2228
2227 /* Add preferred mode */ 2229 /* Add preferred mode */
@@ -2376,6 +2378,7 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
2376 struct drm_file *file_priv) 2378 struct drm_file *file_priv)
2377{ 2379{
2378 struct vmw_private *dev_priv = vmw_priv(dev); 2380 struct vmw_private *dev_priv = vmw_priv(dev);
2381 struct drm_mode_config *mode_config = &dev->mode_config;
2379 struct drm_vmw_update_layout_arg *arg = 2382 struct drm_vmw_update_layout_arg *arg =
2380 (struct drm_vmw_update_layout_arg *)data; 2383 (struct drm_vmw_update_layout_arg *)data;
2381 void __user *user_rects; 2384 void __user *user_rects;
@@ -2421,6 +2424,21 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
2421 drm_rects[i].y1 = curr_rect.y; 2424 drm_rects[i].y1 = curr_rect.y;
2422 drm_rects[i].x2 = curr_rect.x + curr_rect.w; 2425 drm_rects[i].x2 = curr_rect.x + curr_rect.w;
2423 drm_rects[i].y2 = curr_rect.y + curr_rect.h; 2426 drm_rects[i].y2 = curr_rect.y + curr_rect.h;
2427
2428 /*
2429 * Currently this check is limiting the topology within
2430 * mode_config->max (which actually is max texture size
2431 * supported by virtual device). This limit is here to address
2432 * window managers that create a big framebuffer for whole
2433 * topology.
2434 */
2435 if (drm_rects[i].x1 < 0 || drm_rects[i].y1 < 0 ||
2436 drm_rects[i].x2 > mode_config->max_width ||
2437 drm_rects[i].y2 > mode_config->max_height) {
2438 DRM_ERROR("Invalid GUI layout.\n");
2439 ret = -EINVAL;
2440 goto out_free;
2441 }
2424 } 2442 }
2425 2443
2426 ret = vmw_kms_check_display_memory(dev, arg->num_outputs, drm_rects); 2444 ret = vmw_kms_check_display_memory(dev, arg->num_outputs, drm_rects);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
index 93f6b96ca7bb..f30e839f7bfd 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
@@ -1600,31 +1600,6 @@ int vmw_kms_stdu_init_display(struct vmw_private *dev_priv)
1600 1600
1601 dev_priv->active_display_unit = vmw_du_screen_target; 1601 dev_priv->active_display_unit = vmw_du_screen_target;
1602 1602
1603 if (dev_priv->capabilities & SVGA_CAP_3D) {
1604 /*
1605 * For 3D VMs, display (scanout) buffer size is the smaller of
1606 * max texture and max STDU
1607 */
1608 uint32_t max_width, max_height;
1609
1610 max_width = min(dev_priv->texture_max_width,
1611 dev_priv->stdu_max_width);
1612 max_height = min(dev_priv->texture_max_height,
1613 dev_priv->stdu_max_height);
1614
1615 dev->mode_config.max_width = max_width;
1616 dev->mode_config.max_height = max_height;
1617 } else {
1618 /*
1619 * Given various display aspect ratios, there's no way to
1620 * estimate these using prim_bb_mem. So just set these to
1621 * something arbitrarily large and we will reject any layout
1622 * that doesn't fit prim_bb_mem later
1623 */
1624 dev->mode_config.max_width = 8192;
1625 dev->mode_config.max_height = 8192;
1626 }
1627
1628 vmw_kms_create_implicit_placement_property(dev_priv, false); 1603 vmw_kms_create_implicit_placement_property(dev_priv, false);
1629 1604
1630 for (i = 0; i < VMWGFX_NUM_DISPLAY_UNITS; ++i) { 1605 for (i = 0; i < VMWGFX_NUM_DISPLAY_UNITS; ++i) {
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index e125233e074b..80a01cd4c051 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -1404,22 +1404,17 @@ int vmw_surface_gb_priv_define(struct drm_device *dev,
1404 *srf_out = NULL; 1404 *srf_out = NULL;
1405 1405
1406 if (for_scanout) { 1406 if (for_scanout) {
1407 uint32_t max_width, max_height;
1408
1409 if (!svga3dsurface_is_screen_target_format(format)) { 1407 if (!svga3dsurface_is_screen_target_format(format)) {
1410 DRM_ERROR("Invalid Screen Target surface format."); 1408 DRM_ERROR("Invalid Screen Target surface format.");
1411 return -EINVAL; 1409 return -EINVAL;
1412 } 1410 }
1413 1411
1414 max_width = min(dev_priv->texture_max_width, 1412 if (size.width > dev_priv->texture_max_width ||
1415 dev_priv->stdu_max_width); 1413 size.height > dev_priv->texture_max_height) {
1416 max_height = min(dev_priv->texture_max_height,
1417 dev_priv->stdu_max_height);
1418
1419 if (size.width > max_width || size.height > max_height) {
1420 DRM_ERROR("%ux%u\n, exceeds max surface size %ux%u", 1414 DRM_ERROR("%ux%u\n, exceeds max surface size %ux%u",
1421 size.width, size.height, 1415 size.width, size.height,
1422 max_width, max_height); 1416 dev_priv->texture_max_width,
1417 dev_priv->texture_max_height);
1423 return -EINVAL; 1418 return -EINVAL;
1424 } 1419 }
1425 } else { 1420 } else {
@@ -1495,8 +1490,17 @@ int vmw_surface_gb_priv_define(struct drm_device *dev,
1495 if (srf->flags & SVGA3D_SURFACE_BIND_STREAM_OUTPUT) 1490 if (srf->flags & SVGA3D_SURFACE_BIND_STREAM_OUTPUT)
1496 srf->res.backup_size += sizeof(SVGA3dDXSOState); 1491 srf->res.backup_size += sizeof(SVGA3dDXSOState);
1497 1492
1493 /*
1494 * Don't set SVGA3D_SURFACE_SCREENTARGET flag for a scanout surface with
1495 * size greater than STDU max width/height. This is really a workaround
1496 * to support creation of big framebuffer requested by some user-space
1497 * for whole topology. That big framebuffer won't really be used for
1498 * binding with screen target as during prepare_fb a separate surface is
1499 * created so it's safe to ignore SVGA3D_SURFACE_SCREENTARGET flag.
1500 */
1498 if (dev_priv->active_display_unit == vmw_du_screen_target && 1501 if (dev_priv->active_display_unit == vmw_du_screen_target &&
1499 for_scanout) 1502 for_scanout && size.width <= dev_priv->stdu_max_width &&
1503 size.height <= dev_priv->stdu_max_height)
1500 srf->flags |= SVGA3D_SURFACE_SCREENTARGET; 1504 srf->flags |= SVGA3D_SURFACE_SCREENTARGET;
1501 1505
1502 /* 1506 /*