Skip to content

Commit

Permalink
drm/vmwgfx: Fix the refuse_dma mode when using guest-backed objects
Browse files Browse the repository at this point in the history
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 <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
  • Loading branch information
Thomas Hellstrom committed Mar 12, 2020
1 parent d3bd37f commit 81a0096
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,8 @@ int vmw_cmdbuf_set_pool_size(struct vmw_cmdbuf_man *man,
* actually call into the already enabled manager, when
* binding the MOB.
*/
if (!(dev_priv->capabilities & SVGA_CAP_DX))
if (!(dev_priv->capabilities & SVGA_CAP_DX) ||
!dev_priv->has_mob)
return -ENOMEM;

ret = ttm_bo_create(&dev_priv->bdev, size, ttm_bo_type_device,
Expand Down
6 changes: 4 additions & 2 deletions drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -682,8 +682,10 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)

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

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

if (dev_priv->capabilities & SVGA_CAP_GBOBJECTS) {
if (dev_priv->capabilities & SVGA_CAP_GBOBJECTS && !refuse_dma) {
dev_priv->has_mob = true;
if (ttm_bo_init_mm(&dev_priv->bdev, VMW_PL_MOB,
VMW_PL_MOB) != 0) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1888,7 +1888,7 @@ int vmw_kms_stdu_init_display(struct vmw_private *dev_priv)


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

if (!(dev_priv->capabilities & SVGA_CAP_GBOBJECTS))
Expand Down

0 comments on commit 81a0096

Please sign in to comment.