作者

QQ群:852283276
微信:arm80x86
微信公众号:青儿创客基地
B站:主页 https://space.bilibili.com/208826118

参考

QorIQ SDK v2.0-1703 Documentation

方法

usdpaa_mem的驱动位于drivers\staging\fsl_qbman\fsl_usdpaa.c,sdk2.0手册以下两个章节描述了DMA memory内存相关使用方法,

  • 9.8.1.3.3 DMA memory management
  • 9.8.2.6 USDPAA DMA API

性能测试

可以看到,malloc内存到malloc内存拷贝速度为2424.24MB/s,dma内存到malloc内存为2666.67MB/s,malloc内存到dma内存为720.72MB/s,dma内存到dma内存拷贝速度为634.92MB/s,

root@t2080rdb:~# ./cmem_benchmark -h                  
Usage: cmem_benchmark [OPTION]...
test memory speed

-s  [num],        source memory mode
                    0: malloc
                    1: kmalloc
                    2: cached
                    3: coherent
                    4: write combine
-d  [num],        destination memory mode
                    same as -s
-l  [num],        test size, default 4M
-n  [num],        test cycle, default 1
-h       ,        show this help

Example:
malloc -> malloc: cmem_benchmark -s 0 -d 0
malloc -> coherent: cmem_benchmark -s 0 -d 3
coherent -> malloc: cmem_benchmark -s 3 -d 0
coherent -> coherent: cmem_benchmark -s 3 -d 3
root@t2080rdb:~# ./cmem_benchmark -s 0 -d 0
speed=1333.33MB/s, test size = 4194304[0x400000]
root@t2080rdb:~# ./cmem_benchmark -s 0 -d 0 -n 20
speed=2424.24MB/s, test size = 83886080[0x5000000]
root@t2080rdb:~# ./cmem_benchmark -s 3 -d 0 -n 20  
cmemapi_init cmem pool size=0x10000000
Map 0x1001d600: v=0x20000000,p=3758096384,sz=0x10000000,bufs=0x1
  [0x0-0x400000] len=0x400000, bufinfo=0x2ffffff4
speed=2666.67MB/s, test size = 83886080[0x5000000]
root@t2080rdb:~# ./cmem_benchmark -s 0 -d 3 -n 20  
cmemapi_init cmem pool size=0x10000000
Map 0x1001d600: v=0x20000000,p=3758096384,sz=0x10000000,bufs=0x1
  [0x0-0x400000] len=0x400000, bufinfo=0x2ffffff4
speed=720.72MB/s, test size = 83886080[0x5000000]
root@t2080rdb:~# ./cmem_benchmark -s 3 -d 3 -n 20 
cmemapi_init cmem pool size=0x10000000
Map 0x1001d600: v=0x20000000,p=3758096384,sz=0x10000000,bufs=0x1
  [0x0-0x400000] len=0x400000, bufinfo=0x2ffffff4
Map 0x1001d600: v=0x20000000,p=3758096384,sz=0x10000000,bufs=0x2
  [0x0-0x400000] len=0x400000, bufinfo=0x2ffffff4
  [0x400000-0x800000] len=0x400000, bufinfo=0x2fffffec
speed=634.92MB/s, test size = 83886080[0x5000000]
Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐