linux/drivers/gpu/drm/msm
Marek Szyprowski 7690a33f22 drm: msm: fix common struct sg_table related issues
The Documentation/DMA-API-HOWTO.txt states that the dma_map_sg() function
returns the number of the created entries in the DMA address space.
However the subsequent calls to the dma_sync_sg_for_{device,cpu}() and
dma_unmap_sg must be called with the original number of the entries
passed to the dma_map_sg().

struct sg_table is a common structure used for describing a non-contiguous
memory buffer, used commonly in the DRM and graphics subsystems. It
consists of a scatterlist with memory pages and DMA addresses (sgl entry),
as well as the number of scatterlist entries: CPU pages (orig_nents entry)
and DMA mapped pages (nents entry).

It turned out that it was a common mistake to misuse nents and orig_nents
entries, calling DMA-mapping functions with a wrong number of entries or
ignoring the number of mapped entries returned by the dma_map_sg()
function.

To avoid such issues, lets use a common dma-mapping wrappers operating
directly on the struct sg_table objects and use scatterlist page
iterators where possible. This, almost always, hides references to the
nents and orig_nents entries, making the code robust, easier to follow
and copy/paste safe.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Rob Clark <robdclark@gmail.com>
2020-09-10 08:18:35 +02:00
..
adreno drm/msm/a6xx: add A640/A650 hwcg 2020-07-31 06:46:17 -07:00
disp drm/msm: use kthread_create_worker instead of kthread_run 2020-07-31 06:46:17 -07:00
dsi drm/msm/dsi: Add DSI configuration for SDM660 2020-07-31 06:46:17 -07:00
edp drm/msm: sync generated headers 2020-07-31 06:46:16 -07:00
hdmi drm/msm: sync generated headers 2020-07-31 06:46:16 -07:00
Kconfig
Makefile
msm_atomic_trace.h
msm_atomic_tracepoints.c
msm_atomic.c
msm_debugfs.c
msm_debugfs.h
msm_drv.c This tree adds the sched_set_fifo*() encapsulation APIs to remove 2020-08-06 11:55:43 -07:00
msm_drv.h drm/msm: use kthread_create_worker instead of kthread_run 2020-07-31 06:46:17 -07:00
msm_fb.c drm/msm: remove _unlocked suffix in drm_gem_object_put_unlocked 2020-05-19 22:31:33 +01:00
msm_fbdev.c
msm_fence.c
msm_fence.h
msm_gem_prime.c
msm_gem_shrinker.c
msm_gem_submit.c drm-misc-next for v5.9: 2020-06-24 15:45:51 +10:00
msm_gem_vma.c drm/msm: Refactor address space initialization 2020-05-23 13:38:16 -07:00
msm_gem.c drm: msm: fix common struct sg_table related issues 2020-09-10 08:18:35 +02:00
msm_gem.h
msm_gpu_trace.h
msm_gpu_tracepoints.c
msm_gpu.c drm: msm: a6xx: send opp instead of a frequency 2020-07-31 06:46:15 -07:00
msm_gpu.h drm: msm: a6xx: send opp instead of a frequency 2020-07-31 06:46:15 -07:00
msm_gpummu.c drm: msm: fix common struct sg_table related issues 2020-09-10 08:18:35 +02:00
msm_iommu.c drm: msm: fix common struct sg_table related issues 2020-09-10 08:18:35 +02:00
msm_kms.h
msm_mmu.h drm/msm: Update the MMU helper function APIs 2020-05-23 13:38:16 -07:00
msm_perf.c
msm_rd.c
msm_ringbuffer.c
msm_ringbuffer.h
msm_submitqueue.c drm/msm: fix potential memleak in error branch 2020-06-11 20:06:12 -07:00
NOTES