gpu: host1x: Set DMA direction only for DMA-mapped buffer objects
authorThierry Reding <treding@nvidia.com>
Tue, 4 Feb 2020 13:59:26 +0000 (14:59 +0100)
committerThierry Reding <treding@nvidia.com>
Thu, 6 Feb 2020 17:23:12 +0000 (18:23 +0100)
The DMA direction is only used by the DMA API, so there is no use in
setting it when a buffer object isn't mapped with the DMA API.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
drivers/gpu/host1x/job.c

index 0d53c08e9972dd07c976e3c8c21096d519addbe8..6c689b5cc32c234a8ad55897fc3a12759a58bd74 100644 (file)
@@ -248,6 +248,7 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
                                goto unpin;
                        }
 
+                       job->unpins[job->num_unpins].dir = DMA_TO_DEVICE;
                        job->unpins[job->num_unpins].dev = host->dev;
                        phys_addr = sg_dma_address(sgt->sgl);
                }
@@ -255,7 +256,6 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
                job->addr_phys[job->num_unpins] = phys_addr;
                job->gather_addr_phys[i] = phys_addr;
 
-               job->unpins[job->num_unpins].dir = DMA_TO_DEVICE;
                job->unpins[job->num_unpins].bo = g->bo;
                job->unpins[job->num_unpins].sgt = sgt;
                job->num_unpins++;