Re: [PATCH v5 2/2] drm/msm/a6xx: Use the DMA API for GMU memory objects

From: Christoph Hellwig
Date: Tue Mar 17 2020 - 09:20:34 EST


> @@ -942,7 +932,6 @@ static struct a6xx_gmu_bo *a6xx_gmu_memory_alloc(struct a6xx_gmu *gmu,
> size_t size)
> {
> struct a6xx_gmu_bo *bo;
> - int ret, count, i;
>
> bo = kzalloc(sizeof(*bo), GFP_KERNEL);
> if (!bo)
> @@ -950,86 +939,14 @@ static struct a6xx_gmu_bo *a6xx_gmu_memory_alloc(struct a6xx_gmu *gmu,
>
> bo->size = PAGE_ALIGN(size);
>
> - count = bo->size >> PAGE_SHIFT;
> + bo->virt = dma_alloc_wc(gmu->dev, bo->size, &bo->iova, GFP_KERNEL);

No really new in this patch, but why do you need the a6xx_gmu_bo,
and even more so, why does it need to be allocated dynamically?

Also please check for errors when setting the dma mask