drm/tegra: uapi: Allocate gather data using DMA API

This needs to be DMA-able data because it's eventually passed to the
host1x CDMA.

Bug 200768479

Signed-off-by: Thierry Reding <treding@nvidia.com>
Change-Id: Ia209c9fac79e3edf3590288fc0739bc803609bc2
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2596396
(cherry picked from commit 4e064281d0bc8371e228b03386c128661a1a52a9)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2620150
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Thierry Reding
2021-09-17 15:10:46 +02:00
committed by Laxman Dewangan
parent f1ec6fabaf
commit abbda4e63b
3 changed files with 8 additions and 2 deletions

View File

@@ -82,8 +82,10 @@ static int submit_copy_gather_data(struct drm_device *drm,
kref_init(&bo->ref);
host1x_bo_init(&bo->base, &gather_bo_ops);
bo->dev = drm->dev;
bo->gather_data = kmalloc(copy_len, GFP_KERNEL | __GFP_NOWARN);
bo->gather_data = dma_alloc_attrs(bo->dev, copy_len, &bo->gather_data_dma,
GFP_KERNEL | __GFP_NOWARN, 0);
if (!bo->gather_data) {
kfree(bo);
return -ENOMEM;
@@ -93,6 +95,7 @@ static int submit_copy_gather_data(struct drm_device *drm,
u64_to_user_ptr(args->gather_data_ptr),
copy_len);
if (copy_err) {
dma_free_attrs(drm->dev, copy_len, bo->gather_data, bo->gather_data_dma, 0);
kfree(bo->gather_data);
kfree(bo);
return -EFAULT;