drm/tegra: gem: Fix CPU-cache maintenance for BO's allocated using get_pages()
PATCH 1/1 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.
--- drivers/gpu/drm/tegra/gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tegra/gem.c +2 -2
@@ -204,7 +204,7 @@ static void tegra_bo_free(struct drm_device *drm, struct tegra_bo *bo) {if (bo->pages) {dma_unmap_sg (drm->dev, bo->sgt->sgl, bo->sgt->nents, -DMA_BIDIRECTIONAL ); +DMA_FROM_DEVICE );drm_gem_put_pages (&bo->gem, bo->pages, true, true);sg_free_table (bo->sgt);kfree (bo->sgt);
@@ -230,7 +230,7 @@ static int tegra_bo_get_pages(struct drm_device *drm, struct tegra_bo *bo) } err =dma_map_sg (drm->dev, bo->sgt->sgl, bo->sgt->nents, -DMA_BIDIRECTIONAL ); +DMA_FROM_DEVICE );if (err ==0 ) { err = -EFAULT ; goto free_sgt;
Signature · 1 line
2.20.1
07.03.2019 1:55, Dmitry Osipenko пишет:
Quoted 6 lines
The allocated pages need to be invalidated in CPU caches. On ARM32 the
DMA_BIDIRECTIONALflag only ensures that data is written-back to DRAM and the data stays in CPU cache lines. While theDMA_FROM_DEVICEflag ensures that the corresponding CPU cache lines are getting invalidated and nothing more, that's exactly what is needed for a newly allocated pages.
Quoted 8 lines
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.
Cc stable <[email protected]>Signed-off-by Dmitry Osipenko <[email protected]>
Thierry, please don't forget about this patch.
Thierry Reding
AppliedQuoted 12 lines · Dmitry Osipenko
The allocated pages need to be invalidated in CPU caches. On ARM32 the
DMA_BIDIRECTIONALflag only ensures that data is written-back to DRAM and the data stays in CPU cache lines. While theDMA_FROM_DEVICEflag 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.
Quoted 5 lines
Cc stable <[email protected]>Signed-off-by Dmitry Osipenko <[email protected]>--- drivers/gpu/drm/tegra/gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Applied, thanks.
Thierry
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel