dma-mapping: benchmark: add support for dma_map_sg

Support for dma scatter-gather mapping and is intended for testing
mapping performance. It achieves by introducing the dma_sg_map_param
structure and related functions, which enable the implementation of
scatter-gather mapping preparation, mapping, and unmapping operations.
Additionally, the dma_map_benchmark_ops array is updated to include
operations for scatter-gather mapping. This commit aims to provide
a wider range of mapping performance test to cater to different scenarios.

Reviewed-by: Barry Song <baohua@kernel.org>
Signed-off-by: Qinxin Xia <xiaqinxin@huawei.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/20260225093800.3625054-3-xiaqinxin@huawei.com
This commit is contained in:
Qinxin Xia
2026-02-25 17:37:59 +08:00
committed by Marek Szyprowski
parent 9cc60ec453
commit a8d14dd6e6
2 changed files with 119 additions and 1 deletions

View File

@@ -19,6 +19,7 @@
enum {
DMA_MAP_BENCH_SINGLE_MODE,
DMA_MAP_BENCH_SG_MODE,
DMA_MAP_BENCH_MODE_MAX
};
@@ -33,7 +34,9 @@ struct map_benchmark {
__u32 dma_bits; /* DMA addressing capability */
__u32 dma_dir; /* DMA data direction */
__u32 dma_trans_ns; /* time for DMA transmission in ns */
__u32 granule; /* how many PAGE_SIZE will do map/unmap once a time */
__u32 granule; /* - SINGLE_MODE: number of pages mapped/unmapped per operation
* - SG_MODE: number of scatterlist entries (each maps one page)
*/
__u8 map_mode; /* the mode of dma map */
__u8 expansion[75]; /* For future use */
};