linux_dsm_epyc7002/drivers/gpu/drm/armada
Marek Szyprowski efcb3730ef drm: armada: 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>
2020-09-10 08:17:48 +02:00
..
armada_510.c drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
armada_crtc.c drm/armada: remove _unlocked suffix in drm_gem_object_put_unlocked 2020-05-19 22:31:32 +01:00
armada_crtc.h drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
armada_debugfs.c drm/armada: drop use of drmP.h 2019-08-14 18:31:10 +02:00
armada_drm.h drm/armada: drop use of drmP.h 2019-08-14 18:31:10 +02:00
armada_drv.c drm pull for 5.8-rc1 2020-06-02 15:04:15 -07:00
armada_fb.c drm/armada: remove _unlocked suffix in drm_gem_object_put_unlocked 2020-05-19 22:31:32 +01:00
armada_fb.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
armada_fbdev.c drm/armada: remove _unlocked suffix in drm_gem_object_put_unlocked 2020-05-19 22:31:32 +01:00
armada_gem.c drm: armada: fix common struct sg_table related issues 2020-09-10 08:17:48 +02:00
armada_gem.h Linus 5.3-rc1 2019-07-22 21:24:10 +02:00
armada_hw.h drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
armada_ioctlP.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
armada_overlay.c drm/armada: drop use of drmP.h 2019-08-14 18:31:10 +02:00
armada_plane.c drm/armada: drop use of drmP.h 2019-08-14 18:31:10 +02:00
armada_plane.h
armada_trace.c
armada_trace.h drm/armada: drop use of drmP.h 2019-08-14 18:31:10 +02:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile