]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/vmwgfx: Fix setting of dma masks
authorThomas Hellstrom <thellstrom@vmware.com>
Mon, 28 Jan 2019 09:31:33 +0000 (10:31 +0100)
committerThomas Hellstrom <thellstrom@vmware.com>
Tue, 5 Feb 2019 12:54:21 +0000 (13:54 +0100)
Previously we set only the dma mask and not the coherent mask. Fix that.
Also, for clarity, make sure both are initially set to 64 bits.

Cc: <stable@vger.kernel.org>
Fixes: e94186aa2363: ("drm/vmwgfx: Fix the driver for large dma addresses")
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com>
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c

index 3e2bcff34032ee0bd11625d0e715d7aa45ab7401..ae9df4432bfcfc3017847b1f472113619842563e 100644 (file)
@@ -600,13 +600,16 @@ static int vmw_dma_select_mode(struct vmw_private *dev_priv)
 static int vmw_dma_masks(struct vmw_private *dev_priv)
 {
        struct drm_device *dev = dev_priv->dev;
+       int ret = 0;
 
-       if (intel_iommu_enabled &&
+       ret = dma_set_mask_and_coherent(dev->dev, DMA_BIT_MASK(64));
+       if (dev_priv->map_mode != vmw_dma_phys &&
            (sizeof(unsigned long) == 4 || vmw_restrict_dma_mask)) {
                DRM_INFO("Restricting DMA addresses to 44 bits.\n");
-               return dma_set_mask(dev->dev, DMA_BIT_MASK(44));
+               return dma_set_mask_and_coherent(dev->dev, DMA_BIT_MASK(44));
        }
-       return 0;
+
+       return ret;
 }
 
 static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)