Re: [PATCH] drm/vmwgfx: fix a warning due to missing dma_parms

From: Christoph Hellwig
Date: Fri May 24 2019 - 02:23:01 EST


On Thu, May 23, 2019 at 10:37:19PM -0400, Qian Cai wrote:
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> index bf6c3500d363..5c567b81174f 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> @@ -747,6 +747,13 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
> if (unlikely(ret != 0))
> goto out_err0;
>
> + dev->dev->dma_parms = kzalloc(sizeof(*dev->dev->dma_parms),
> + GFP_KERNEL);
> + if (!dev->dev->dma_parms)
> + goto out_err0;

What bus does this device come from? I though vmgfx was a (virtualized)
PCI device, in which case this should be provided by the PCI core.
Or are we calling DMA mapping routines on arbitrary other struct device,
in which case that is the real bug and we should switch the PCI device
instead.

> + dma_set_max_seg_size(dev->dev, *dev->dev->dma_mask);

That looks odd. If you want to support an unlimited segment size
just pass UINT_MAX here.