Skip to content

Commit 81a0096

Browse files
committed
drm/vmwgfx: Fix the refuse_dma mode when using guest-backed objects
When we refuse DMA from system pages for whatever reason, we don't handle that correctly when guest-backed objects was enabled. Since guest-backed objects by definition require DMA to and from system pages, disable all functionality that relies on them. That basically amounts to 3D acceleration and screen targets. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]>
1 parent d3bd37f commit 81a0096

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,8 @@ int vmw_cmdbuf_set_pool_size(struct vmw_cmdbuf_man *man,
12411241
* actually call into the already enabled manager, when
12421242
* binding the MOB.
12431243
*/
1244-
if (!(dev_priv->capabilities & SVGA_CAP_DX))
1244+
if (!(dev_priv->capabilities & SVGA_CAP_DX) ||
1245+
!dev_priv->has_mob)
12451246
return -ENOMEM;
12461247

12471248
ret = ttm_bo_create(&dev_priv->bdev, size, ttm_bo_type_device,

drivers/gpu/drm/vmwgfx/vmwgfx_drv.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,8 +682,10 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
682682

683683
ret = vmw_dma_select_mode(dev_priv);
684684
if (unlikely(ret != 0)) {
685-
DRM_INFO("Restricting capabilities due to IOMMU setup.\n");
685+
DRM_INFO("Restricting capabilities since DMA not available.\n");
686686
refuse_dma = true;
687+
if (dev_priv->capabilities & SVGA_CAP_GBOBJECTS)
688+
DRM_INFO("Disabling 3D acceleration.\n");
687689
}
688690

689691
dev_priv->vram_size = vmw_read(dev_priv, SVGA_REG_VRAM_SIZE);
@@ -866,7 +868,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
866868
dev_priv->has_gmr = false;
867869
}
868870

869-
if (dev_priv->capabilities & SVGA_CAP_GBOBJECTS) {
871+
if (dev_priv->capabilities & SVGA_CAP_GBOBJECTS && !refuse_dma) {
870872
dev_priv->has_mob = true;
871873
if (ttm_bo_init_mm(&dev_priv->bdev, VMW_PL_MOB,
872874
VMW_PL_MOB) != 0) {

drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1888,7 +1888,7 @@ int vmw_kms_stdu_init_display(struct vmw_private *dev_priv)
18881888

18891889

18901890
/* Do nothing if Screen Target support is turned off */
1891-
if (!VMWGFX_ENABLE_SCREEN_TARGET_OTABLE)
1891+
if (!VMWGFX_ENABLE_SCREEN_TARGET_OTABLE || !dev_priv->has_mob)
18921892
return -ENOSYS;
18931893

18941894
if (!(dev_priv->capabilities & SVGA_CAP_GBOBJECTS))

0 commit comments

Comments
 (0)