aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/tegra
diff options
context:
space:
mode:
authorDmitry Osipenko <digetx@gmail.com>2019-03-06 17:55:19 -0500
committerThierry Reding <treding@nvidia.com>2019-04-18 05:48:09 -0400
commit61b51fb51c01a519a249d28ec55c6513a13be5a3 (patch)
tree5707e7222b4a94dc6dfdc7b13244c2ef3ae9daab /drivers/gpu/drm/tegra
parent11c632e1cfd3dcb49f2d04625d31c818a4c3b426 (diff)
drm/tegra: gem: Fix CPU-cache maintenance for BO's allocated using get_pages()
The allocated pages need to be invalidated in CPU caches. On ARM32 the DMA_BIDIRECTIONAL flag only ensures that data is written-back to DRAM and the data stays in CPU cache lines. While the DMA_FROM_DEVICE flag ensures that the corresponding CPU cache lines are getting invalidated and nothing more, that's exactly what is needed for a newly allocated pages. This fixes randomly failing rendercheck tests on Tegra30 using the Opentegra driver for tests that use small-sized pixmaps (10x10 and less, i.e. 1-2 memory pages) because apparently CPU reads out stale data from caches and/or that data is getting evicted to DRAM at the time of HW job execution. Fixes: bd43c9f0fa1f ("drm/tegra: gem: Map pages via the DMA API") Cc: stable <stable@vger.kernel.org> Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/drm/tegra')
-rw-r--r--drivers/gpu/drm/tegra/gem.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
index 4f80100ff5f3..4cce11fd8836 100644
--- a/drivers/gpu/drm/tegra/gem.c
+++ b/drivers/gpu/drm/tegra/gem.c
@@ -204,7 +204,7 @@ static void tegra_bo_free(struct drm_device *drm, struct tegra_bo *bo)
204{ 204{
205 if (bo->pages) { 205 if (bo->pages) {
206 dma_unmap_sg(drm->dev, bo->sgt->sgl, bo->sgt->nents, 206 dma_unmap_sg(drm->dev, bo->sgt->sgl, bo->sgt->nents,
207 DMA_BIDIRECTIONAL); 207 DMA_FROM_DEVICE);
208 drm_gem_put_pages(&bo->gem, bo->pages, true, true); 208 drm_gem_put_pages(&bo->gem, bo->pages, true, true);
209 sg_free_table(bo->sgt); 209 sg_free_table(bo->sgt);
210 kfree(bo->sgt); 210 kfree(bo->sgt);
@@ -230,7 +230,7 @@ static int tegra_bo_get_pages(struct drm_device *drm, struct tegra_bo *bo)
230 } 230 }
231 231
232 err = dma_map_sg(drm->dev, bo->sgt->sgl, bo->sgt->nents, 232 err = dma_map_sg(drm->dev, bo->sgt->sgl, bo->sgt->nents,
233 DMA_BIDIRECTIONAL); 233 DMA_FROM_DEVICE);
234 if (err == 0) { 234 if (err == 0) {
235 err = -EFAULT; 235 err = -EFAULT;
236 goto free_sgt; 236 goto free_sgt;