在 英特尔® Stratix® 10 SoC FPGA 或 英特尔 Agilex® 7 SoC FPGA中运行 DMAC 时,在将 test_buf_size 更改为更大的值( test_buf_size 的默认值为 16 KB)时,您可能会发现以下错误:
root@agilex:~# 响应 1 >/sys/module/dmatest/parameters/run
[ 149.931113] dmatest:没有配置的通道,请继续任何通道
[ 149.937236] dmatest:使用 dma0chan0 添加了 1 个线程
[ 149.942349] dmatest:使用 dma0chan0 启动 1 个线程
root@agilex:~# [ 149.963288] dma-pl330 ffda0000.pdma:swiotlb 缓冲区已满(sz:2097152字节),总 32768(插槽),使用 1024(插槽)
[ 149.974096] dma-pl330 ffda0000.pdma:溢出0x00000003ebc00000+ 2097152 DMA 口罩 ffffff 总线掩码 0
[ 149.983622] ------------[ 在此处剪切 ]------------
根本原因是 DMAC 330 只有 32 位地址宽度;SWIOTLB 默认缓冲区大小不足以支持 DMAC 330 访问整个 DDR 范围。
要解决此问题,您可以使用以下解决方案之一:
- 配置 Linux 仅使用前 2 GB 的 DDR;DMAC 可以使用 32 位宽度地址访问 2 GB 内存范围,因此无需增加 SWIOTLB 缓冲区。
- 修改 内核源和 U-boot 命令行,以使 SWIOTLB 缓冲区更大:
在 /include/linux/swiotlb.h 中,将 IO_TLB_SEGSIZE 更改为更大的数字 (应该是 2 的功率);例如, #define IO_TLB_SEGSIZE 1024
更改 U-boot 环境以添加定制的 swiotlb 值;例如, Setenv bootargs earlycon console=ttyPS0,115200 swiotlb=32768