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
..
2023-01-18 11:29:59 +01:00
2022-08-25 11:15:23 +02:00
2025-07-17 10:07:57 +02:00
2022-03-16 13:20:26 +01:00
2022-06-14 16:59:39 +02:00
2023-08-11 11:45:16 +02:00
2022-09-05 10:26:29 +02:00
2022-09-15 12:17:02 +02:00
2023-05-30 12:42:14 +01:00
2025-05-08 11:55:42 +02:00
2024-02-23 08:12:39 +01:00
2024-07-18 11:39:39 +02:00
2025-08-13 09:44:37 +02:00
2022-03-23 09:10:43 +01:00
2015-08-05 13:38:07 +01:00
2018-06-15 18:10:01 -03:00
2017-02-16 10:08:41 +05:30
2013-03-12 13:59:14 -07:00
2017-11-02 11:10:55 +01:00
2022-10-26 13:19:32 +02:00
2025-07-17 10:08:05 +02:00
2018-06-19 10:43:55 -04:00
2016-10-11 15:06:31 -07:00
2017-11-07 10:32:44 +01:00
2021-08-08 08:54:29 +02:00
2025-06-11 10:19:25 +02:00
2018-07-04 10:32:48 +01:00
2017-11-02 11:10:55 +01:00
2011-03-11 14:25:50 +00:00
2024-09-04 13:12:59 +02:00
2023-06-09 10:23:56 +02:00
2022-11-10 17:46:56 +01:00
2022-04-15 14:14:41 +02:00
2024-12-05 10:59:42 +01:00
2017-11-02 11:10:55 +01:00
2021-09-22 11:47:59 +02:00
2024-02-23 08:12:46 +01:00
2022-09-15 12:17:02 +02:00
2019-10-05 13:09:54 +02:00
2020-12-30 11:25:39 +01:00
2021-09-26 13:39:48 +02:00
2017-11-02 11:10:55 +01:00
2018-08-02 15:22:13 -06:00
2022-07-21 21:09:26 +02:00
2022-12-14 11:28:27 +01:00
2024-11-08 16:19:18 +01:00
2018-01-04 15:13:29 -08:00
2018-07-19 17:08:52 -07:00
2019-08-06 19:06:52 +02:00
2017-11-02 11:10:55 +01:00
2024-07-18 11:39:31 +02:00
2019-02-27 10:08:53 +01:00
2021-10-06 15:31:17 +02:00
2018-01-08 17:30:45 +01:00
2017-11-02 11:10:55 +01:00
2021-05-26 11:48:35 +02:00
2021-11-26 11:36:02 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-12-07 22:52:01 +01:00
2013-09-13 15:09:52 +02:00
2023-08-08 19:49:17 +02:00
2019-12-31 16:36:22 +01:00
2023-12-13 17:42:15 +01:00
2024-09-04 13:12:59 +02:00
2023-04-05 11:15:42 +02:00
2023-12-20 15:38:01 +01:00
2018-07-18 07:27:22 -04:00
2015-11-16 09:27:32 +05:30
2020-11-05 11:08:35 +01:00
2017-11-02 11:10:55 +01:00
2023-05-17 11:13:06 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-04-17 10:48:45 +02:00
2016-09-06 13:08:40 +09:00
2017-10-26 17:08:40 +09:00
2021-03-04 09:39:57 +01:00
2024-02-23 08:12:40 +01:00
2017-11-02 11:10:55 +01:00
2025-09-16 13:55:07 +02:00
2024-02-23 08:12:53 +01:00
2018-03-16 19:58:27 +01:00
2022-10-26 13:19:31 +02:00
2017-11-15 11:56:19 -08:00
2025-02-07 03:34:24 +01:00
2022-11-10 17:46:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2021-10-27 09:53:13 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-01-01 12:40:27 -07:00
2024-05-17 11:42:37 +02:00
2018-04-27 11:53:02 -04:00
2023-09-23 10:47:59 +02:00
2017-11-02 11:10:55 +01:00
2024-09-04 13:13:08 +02:00
2013-09-26 15:06:58 -07:00
2017-11-02 11:10:55 +01:00
2018-01-30 21:54:32 +01:00
2014-12-31 13:06:50 -05:00
2021-12-08 08:50:13 +01:00
2021-11-26 11:35:59 +01:00
2017-11-02 11:10:55 +01:00
2018-05-14 16:44:41 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2024-04-13 12:50:14 +02:00
2021-09-22 11:47:56 +02:00
2021-09-22 11:47:56 +02:00
2024-07-18 11:39:35 +02:00
2023-04-20 12:04:39 +02:00
2017-11-02 11:10:55 +01:00
2024-04-13 12:50:12 +02:00
2018-08-02 10:24:51 +02:00
2016-05-28 15:48:31 -04:00
2017-11-02 11:10:55 +01:00
2025-07-17 10:08:05 +02:00
2024-03-26 18:22:37 -04:00
2024-02-23 08:12:55 +01:00
2021-07-11 12:49:27 +02:00
2023-02-22 12:47:20 +01:00
2022-06-25 11:49:07 +02:00
2024-08-19 05:31:56 +02:00
2025-02-07 03:34:27 +01:00
2018-03-08 12:30:37 +01:00
2012-10-13 10:46:48 +01:00
2023-09-23 10:48:11 +02:00
2023-10-10 21:44:57 +02:00
2025-02-07 03:34:27 +01:00
2023-03-11 16:31:51 +01:00
2023-10-25 11:16:17 +02:00
2018-03-26 08:53:43 -06:00
2021-08-26 08:36:39 -04:00
2018-07-21 10:43:12 -05:00
2017-11-02 11:10:55 +01:00
2014-05-14 16:40:04 -07:00
2017-10-19 16:54:49 -07:00
2025-05-08 11:55:41 +02:00
2017-09-08 18:26:49 -07:00
2017-11-02 11:10:55 +01:00
2022-10-26 13:19:35 +02:00
2014-09-23 23:13:13 -07:00
2021-12-08 08:50:11 +01:00
2018-06-22 13:43:27 +09:00
2023-06-28 10:15:27 +02:00
2018-04-18 10:23:06 -05:00
2021-08-26 08:36:40 -04:00
2024-11-08 16:19:06 +01:00
2024-12-05 10:59:31 +01:00
2025-04-03 10:09:44 +02:00
2017-11-02 11:10:55 +01:00
2021-01-09 13:43:48 +01:00
2023-03-11 16:31:35 +01:00
2023-02-06 07:49:46 +01:00
2017-11-02 11:10:55 +01:00
2022-07-02 16:27:39 +02:00
2022-08-25 11:15:23 +02:00
2012-07-21 10:34:00 -07:00
2018-08-18 11:44:53 -07:00
2023-03-11 16:31:51 +01:00
2025-04-03 10:09:49 +02:00
2017-11-02 11:10:55 +01:00
2025-02-07 03:34:23 +01:00
2023-10-10 21:45:00 +02:00
2018-01-11 14:39:07 -06:00
2018-02-02 16:50:28 -08:00
2021-09-22 11:47:57 +02:00
2018-04-17 13:42:48 +02:00
2017-11-02 11:10:55 +01:00
2015-11-25 09:22:02 -07:00
2024-02-23 08:12:58 +01:00
2022-06-14 16:59:25 +02:00
2018-12-29 13:37:59 +01:00
2023-01-18 11:30:49 +01:00
2023-10-25 11:16:31 +02:00
2021-10-09 14:11:03 +02:00
2021-09-22 11:48:12 +02:00
2020-01-29 16:43:27 +01:00
2019-12-31 16:35:38 +01:00
2018-02-13 16:25:06 +01:00
2022-06-25 11:49:12 +02:00
2022-12-08 11:18:34 +01:00
2022-04-15 14:15:07 +02:00
2022-11-23 07:53:44 +01:00
2021-05-22 10:59:23 +02:00
2024-06-16 13:23:35 +02:00
2017-11-02 11:10:55 +01:00
2018-03-24 11:25:35 -05:00
2021-08-26 08:36:41 -04:00
2023-09-23 10:47:59 +02:00
2021-06-30 08:48:18 -04:00
2022-05-18 09:42:47 +02:00
2025-04-04 11:11:26 +02:00
2023-06-21 15:39:57 +02:00
2023-06-21 15:39:57 +02:00
2018-07-24 10:04:49 -07:00
2025-05-05 15:34:17 +02:00
2022-04-15 14:15:03 +02:00
2025-06-11 10:19:26 +02:00
2023-09-23 10:47:58 +02:00
2023-08-11 11:45:06 +02:00
2022-06-14 16:59:38 +02:00
2023-02-25 11:51:51 +01:00
2017-11-02 11:10:55 +01:00
2024-07-05 09:00:32 +02:00
2021-12-08 08:50:11 +01:00
2018-05-03 16:25:08 +02:00
2021-01-06 14:45:00 +01:00
2022-11-01 19:05:40 +01:00
2018-07-08 11:13:25 +09:00
2025-04-03 10:09:42 +02:00
2021-08-08 08:54:30 +02:00
2021-07-11 12:49:30 +02:00
2018-01-31 17:18:37 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-09 10:23:28 +01:00
2018-07-23 17:04:13 -05:00
2025-04-04 11:11:27 +02:00
2023-09-23 10:48:11 +02:00
2025-06-11 10:19:55 +02:00
2023-12-13 17:42:19 +01:00
2018-01-03 10:38:54 -05:00
2023-02-22 12:47:17 +01:00
2018-07-21 10:43:12 -05:00
2023-11-08 11:22:18 +01:00
2023-08-11 11:45:40 +02:00
2017-12-16 02:05:48 +01:00
2025-03-11 08:34:59 +01:00
2023-06-09 10:23:54 +02:00
2012-10-13 10:46:48 +01:00
2025-04-04 11:35:21 +02:00
2022-06-25 11:49:11 +02:00
2023-11-20 10:29:18 +01:00
2017-11-02 11:10:55 +01:00
2023-05-17 11:13:28 +02:00
2023-01-18 11:30:11 +01:00
2017-11-02 11:10:55 +01:00
2021-06-30 08:48:19 -04:00
2019-01-09 17:38:33 +01:00
2022-06-14 16:59:13 +02:00
2023-11-28 16:46:33 +00:00
2024-03-26 18:22:40 -04:00
2017-11-02 11:10:55 +01:00
2023-10-25 11:16:20 +02:00
2023-10-25 11:16:20 +02:00
2023-08-30 16:31:56 +02:00
2023-02-25 11:51:50 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2022-07-02 16:27:31 +02:00
2023-06-28 10:15:28 +02:00
2017-11-03 15:24:11 +00:00
2019-12-05 09:19:38 +01:00
2018-06-15 13:37:07 +02:00
2024-09-12 11:02:55 +02:00
2022-09-05 10:26:34 +02:00
2017-05-03 15:52:09 -07:00
2017-11-02 11:10:55 +01:00
2023-11-08 11:22:19 +01:00
2018-07-25 11:22:19 +02:00
2021-12-14 10:18:04 +01:00
2022-07-12 16:29:03 +02:00
2022-09-05 10:26:28 +02:00
2017-06-05 11:14:35 +01:00
2018-05-05 00:51:44 +02:00
2024-02-23 08:12:58 +01:00
2018-03-22 21:30:56 -05:00
2018-04-11 10:28:36 -07:00
2020-10-01 13:14:30 +02:00
2023-08-11 11:45:22 +02:00
2024-05-02 16:17:14 +02:00
2012-10-13 10:46:48 +01:00
2020-06-22 09:05:03 +02:00
2023-03-22 13:27:11 +01:00
2018-08-22 10:52:43 -07:00
2022-06-25 11:49:11 +02:00
2018-03-08 13:49:26 +00:00
2018-05-17 12:46:54 -04:00
2021-09-22 11:48:11 +02:00
2021-06-30 08:48:18 -04:00
2017-01-12 09:33:39 +01:00
2017-01-12 09:33:39 +01:00
2018-08-16 12:14:42 -07:00
2018-05-30 10:11:34 +02:00
2016-03-25 16:37:42 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-06-05 16:57:31 -07:00
2017-11-02 11:10:55 +01:00
2021-03-17 16:43:51 +01:00
2023-05-30 12:42:13 +01:00
2024-05-25 16:16:19 +02:00
2018-04-28 15:01:14 -07:00
2020-01-27 14:50:22 +01:00
2017-08-18 14:07:26 -03:00
2017-11-02 11:10:55 +01:00
2024-07-05 09:00:35 +02:00
2023-02-06 07:49:44 +01:00
2021-03-07 12:19:01 +01:00
2017-08-17 16:29:19 -07:00
2017-11-02 11:10:55 +01:00
2018-11-13 11:08:51 -08:00
2023-08-11 11:45:27 +02:00
2022-01-05 12:34:57 +01:00
2017-11-02 11:10:55 +01:00
2023-05-17 11:13:22 +02:00
2018-08-22 15:11:35 +02:00
2020-11-18 19:18:40 +01:00
2024-04-13 12:50:03 +02:00
2017-11-02 11:10:55 +01:00
2023-01-18 11:30:05 +01:00
2022-06-25 11:49:10 +02:00
2022-03-23 09:10:41 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2025-02-07 03:34:27 +01:00
2017-12-04 07:14:30 -05:00
2018-07-09 09:07:54 -06:00
2023-03-22 13:27:11 +01:00
2022-07-29 17:10:37 +02:00
2023-05-17 11:13:27 +02:00
2025-07-17 10:07:54 +02:00
2017-11-02 11:10:55 +01:00
2024-02-23 08:12:39 +01:00
2025-03-11 08:35:00 +01:00
2025-02-07 03:34:21 +01:00
2018-04-23 13:41:55 +02:00
2018-08-16 09:57:20 -07:00
2017-11-02 11:10:55 +01:00
2022-03-16 13:20:27 +01:00
2023-08-30 16:31:49 +02:00
2022-03-16 13:20:27 +01:00
2023-05-17 11:13:15 +02:00
2017-11-02 11:10:55 +01:00
2018-05-03 09:25:47 -06:00
2021-12-14 10:18:06 +01:00
2023-08-11 11:45:17 +02:00
2017-08-15 09:02:08 -07:00