2022-06-20 06:20 AM
Hi,
I am puzzled which DMA channel to use to read from an FPGA connected to the FMC.
Using the dmatest module I found out which are free and can be used for DMA_MEMCPY
transfers:
modprobe dmatest timeout=2000 iterations=1 run=1 wait=1
[ 991.821537] dmatest: No channels configured, continue with any
[ 991.826830] dmatest: Added 1 threads using dma0chan19
[ 991.831372] dmatest: Added 1 threads using dma0chan20
[ 991.836463] dmatest: Added 1 threads using dma0chan21
[ 991.841513] dmatest: Added 1 threads using dma0chan22
[ 991.846879] dmatest: Added 1 threads using dma0chan23
[ 991.851588] dmatest: Added 1 threads using dma0chan24
[ 991.856713] dmatest: Added 1 threads using dma0chan25
[ 991.861707] dmatest: Added 1 threads using dma0chan26
[ 991.867050] dmatest: Added 1 threads using dma0chan27
[ 991.871733] dmatest: Added 1 threads using dma0chan28
[ 991.876972] dmatest: Added 1 threads using dma0chan29
[ 991.881975] dmatest: Added 1 threads using dma0chan30
[ 991.887247] dmatest: Added 1 threads using dma0chan31
[ 991.892016] dmatest: Added 1 threads using dma1chan6
[ 991.897143] dmatest: Added 1 threads using dma1chan7
[ 991.902026] dmatest: Added 1 threads using dma2chan0
[ 991.907331] dmatest: Added 1 threads using dma2chan1
[ 991.911855] dmatest: Added 1 threads using dma2chan2
[ 991.917077] dmatest: Added 1 threads using dma2chan3
[ 991.921841] dmatest: Added 1 threads using dma2chan4
[ 991.927076] dmatest: Added 1 threads using dma2chan5
[ 991.931901] dmatest: Added 1 threads using dma2chan6
[ 991.936889] dmatest: Added 1 threads using dma2chan7
[ 991.941979] dmatest: Started 1 threads using dma0chan19
[ 991.947127] dmatest: Started 1 threads using dma0chan20
[ 991.948232] dmatest: dma0chan19-copy: summary 1 tests, 0 failures 178.92 iops 0 KB/s (0)
[ 991.952384] dmatest: Started 1 threads using dma0chan21
[ 991.960951] dmatest: dma0chan20-copy: summary 1 tests, 0 failures 77.91 iops 467 KB/s (0)
[ 991.965846] dmatest: dma0chan21-copy: summary 1 tests, 0 failures 76.35 iops 534 KB/s (0)
[ 991.976867] dmatest: Started 1 threads using dma0chan22
[ 991.982391] dmatest: dma0chan22-copy: summary 1 tests, 0 failures 183.38 iops 733 KB/s (0)
[ 991.987969] dmatest: Started 1 threads using dma0chan23
[ 991.996468] dmatest: dma0chan23-copy: summary 1 tests, 0 failures 122.15 iops 1710 KB/s (0)
[ 992.002495] dmatest: Started 1 threads using dma0chan24
[ 992.009723] dmatest: dma0chan24-copy: summary 1 tests, 0 failures 144.21 iops 1009 KB/s (0)
[ 992.015529] dmatest: Started 1 threads using dma0chan25
[ 992.024914] dmatest: dma0chan25-copy: summary 1 tests, 0 failures 749.62 iops 4497 KB/s (0)
[ 992.027981] dmatest: Started 1 threads using dma0chan26
[ 992.039043] dmatest: dma0chan26-copy: summary 1 tests, 0 failures 1321.00 iops 13210 KB/s (0)
[ 992.041868] dmatest: Started 1 threads using dma0chan27
[ 992.051936] dmatest: dma0chan27-copy: summary 1 tests, 0 failures 102.65 iops 718 KB/s (0)
[ 992.055825] dmatest: Started 1 threads using dma0chan28
[ 992.065412] dmatest: dma0chan28-copy: summary 1 tests, 0 failures 107.79 iops 1509 KB/s (0)
[ 992.068906] dmatest: Started 1 threads using dma0chan29
[ 992.079423] dmatest: dma0chan29-copy: summary 1 tests, 0 failures 626.17 iops 8766 KB/s (0)
[ 992.082366] dmatest: Started 1 threads using dma0chan30
[ 992.093148] dmatest: dma0chan30-copy: summary 1 tests, 0 failures 626.56 iops 9398 KB/s (0)
[ 992.096106] dmatest: Started 1 threads using dma0chan31
[ 992.105372] dmatest: dma0chan31-copy: summary 1 tests, 0 failures 4255.31 iops 4255 KB/s (0)
[ 992.109991] dmatest: Started 1 threads using dma1chan6
[ 992.121032] dmatest: dma1chan6-copy0: summary 1 tests, 0 failures 93.46 iops 280 KB/s (0)
[ 992.123645] dmatest: Started 1 threads using dma1chan7
[ 992.133621] dmatest: dma1chan7-copy0: summary 1 tests, 0 failures 103.02 iops 1236 KB/s (0)
[ 992.136708] dmatest: Started 1 threads using dma2chan0
[ 992.147864] dmatest: dma2chan0-copy0: summary 1 tests, 0 failures 1250.00 iops 12500 KB/s (0)
[ 992.150506] dmatest: Started 1 threads using dma2chan1
[ 992.160822] dmatest: dma2chan1-copy0: summary 1 tests, 0 failures 100.26 iops 701 KB/s (0)
[ 992.163851] dmatest: Started 1 threads using dma2chan2
[ 992.175094] dmatest: dma2chan2-copy0: summary 1 tests, 0 failures 1236.09 iops 12360 KB/s (0)
[ 992.177280] dmatest: Started 1 threads using dma2chan3
[ 992.187974] dmatest: dma2chan3-copy0: summary 1 tests, 0 failures 4901.95 iops 0 KB/s (0)
[ 992.191280] dmatest: Started 1 threads using dma2chan4
[ 992.201263] dmatest: dma2chan4-copy0: summary 1 tests, 0 failures 103.78 iops 622 KB/s (0)
[ 992.204352] dmatest: Started 1 threads using dma2chan5
[ 992.215068] dmatest: dma2chan5-copy0: summary 1 tests, 0 failures 4587.15 iops 4587 KB/s (0)
[ 992.217825] dmatest: Started 1 threads using dma2chan6
[ 992.228584] dmatest: dma2chan6-copy0: summary 1 tests, 0 failures 4273.50 iops 4273 KB/s (0)
[ 992.231715] dmatest: Started 1 threads using dma2chan7
[ 992.241879] dmatest: dma2chan7-copy0: summary 1 tests, 0 failures 101.90 iops 407 KB/s (0)
I am currently using "dma2chan0" (at least trying to). Is this a valid choice?
I need to get the best performance as the FPGA provides sample data up to 50 MB/s.
Best Regards,
Gunther
2022-06-20 06:25 AM
Do I have to assign A DMA channel in the boards dts file?
Currently i look like this. I am able to read from the FPGA using /dev/mem.
/* stm32-fmc2-ebi */
&fmc {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&fmc_pins_mx>;
pinctrl-1 = <&fmc_sleep_pins_mx>;
status = "okay";
sram@0,0 {
compatible = "mtd-ram";
reg = <0 0x0 0x80000>;
bank-width = <2>;
/* Timing values are in nS */
st,fmc2-ebi-cs-transaction-type = <0>;
st,fmc2-ebi-cs-buswidth = <8>;
st,fmc2-ebi-cs-address-setup-ns = <6>;
st,fmc2-ebi-cs-address-hold-ns = <6>;
st,fmc2-ebi-cs-data-setup-ns = <60>;
st,fmc2-ebi-cs-data-hold-ns = <9>;
st,fmc2-ebi-cs-bus-turnaround-ns = <20>;
};
};