Files
android_kernel_fxtec_sm6115/include/linux
Marek Szyprowski 87ae01ac7e dma-mapping: add generic helpers for mapping sgtable objects
[ Upstream commit d9d200bcebc1f6e56f0178cbb8db9953e8cc9a11 ]

struct sg_table is a common structure used for describing a memory
buffer. 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, let's introduce a common wrappers operating
directly on the struct sg_table objects, which take care of the proper
use of the nents and orig_nents entries.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Stable-dep-of: d37c120b7312 ("drm/etnaviv: don't truncate physical page address")
Signed-off-by: Sasha Levin <sashal@kernel.org>
[uli: backport to 4.19]
Signed-off-by: Ulrich Hecht <uli@kernel.org>
2025-09-16 13:55:07 +02:00
..
2024-02-23 08:12:39 +01:00
2022-10-26 13:19:32 +02:00
2023-08-08 19:49:17 +02:00
2023-12-20 15:38:01 +01:00
2024-04-13 12:50:14 +02:00
2022-10-26 13:19:35 +02:00
2022-08-25 11:15:23 +02:00
2023-09-23 10:47:59 +02:00
2025-04-04 11:11:26 +02:00
2023-06-21 15:39:57 +02:00
2023-02-22 12:47:17 +01:00
2025-04-04 11:35:21 +02:00
2023-11-28 16:46:33 +00:00
2023-10-25 11:16:20 +02:00
2023-10-25 11:16:20 +02:00
2024-07-05 09:00:35 +02:00
2024-02-23 08:12:39 +01:00