Files
kernel_oneplus_sm8250/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
..
2019-12-13 08:51:18 +01:00
2024-02-23 08:12:39 +01:00
2022-10-26 13:19:32 +02:00
2019-10-05 13:10:03 +02:00
2019-07-03 13:14:48 +02:00
2023-08-08 19:49:17 +02:00
2018-08-22 10:52:48 -07:00
2023-12-20 15:38:01 +01:00
2019-11-24 08:19:14 +01:00
2021-12-08 08:50:13 +01:00
2024-04-13 12:50:14 +02:00
2021-01-30 13:32:12 +01:00
2019-10-17 13:45:42 -07:00
2021-05-22 10:59:50 +02:00
2022-10-26 13:19:35 +02:00
2019-12-13 08:52:43 +01:00
2021-03-04 09:39:44 +01:00
2022-08-25 11:15:23 +02:00
2021-02-07 14:48:38 +01: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
2023-02-22 12:47:17 +01:00
2025-04-04 11:35:21 +02:00
2019-06-11 12:20:52 +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
2020-04-02 15:28:22 +02: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
2020-04-02 15:28:23 +02:00
2021-12-14 10:18:06 +01:00