Files
android_kernel_motorola_sm6225/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
…
…
…
…
…
…
2011-03-11 14:25:50 +00:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2023-08-08 19:49:17 +02:00
…
…
…
…
…
…
…
…
2023-12-20 15:38:01 +01:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-01-01 12:40:27 -07:00
…
…
…
…
…
…
…
…
…
2014-12-31 13:06:50 -05:00
2021-12-08 08:50:13 +01:00
…
…
…
…
…
…
2024-04-13 12:50:14 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-03-26 08:53:43 -06:00
…
…
…
…
…
…
…
…
…
…
2022-10-26 13:19:35 +02:00
…
2018-06-22 13:43:27 +09:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2022-08-25 11:15:23 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2019-12-31 16:35:38 +01:00
…
…
…
…
…
…
…
…
…
…
…
…
2023-09-23 10:47:59 +02:00
…
…
2021-06-30 08:48:18 -04:00
2025-04-04 11:11:26 +02:00
2023-06-21 15:39:57 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-01-31 17:18:37 -08:00
…
…
2017-11-09 10:23:28 +01:00
…
…
…
…
…
…
…
…
…
2023-02-22 12:47:17 +01:00
…
2018-07-21 10:43:12 -05:00
…
…
…
…
…
…
2017-12-16 02:05:48 +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
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-12-14 10:18:04 +01:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-08-16 12:14:42 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2024-07-05 09:00:35 +02:00
…
…
…
…
2018-11-13 11:08:51 -08:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2024-02-23 08:12:39 +01:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-12-14 10:18:06 +01:00
…
…
…
…
…
…
…
…
…
…
…
…
…
2017-08-15 09:02:08 -07:00
…