1============== 2DMA Test Guide 3============== 4 5Andy Shevchenko <andriy.shevchenko@linux.intel.com> 6 7This small document introduces how to test DMA drivers using dmatest module. 8 9.. note:: 10 The test suite works only on the channels that have at least one 11 capability of the following: DMA_MEMCPY (memory-to-memory), DMA_MEMSET 12 (const-to-memory or memory-to-memory, when emulated), DMA_XOR, DMA_PQ. 13 14.. note:: 15 In case of any related questions use the official mailing list 16 dmaengine@vger.kernel.org. 17 18Part 1 - How to build the test module 19===================================== 20 21The menuconfig contains an option that could be found by following path: 22 23 Device Drivers -> DMA Engine support -> DMA Test client 24 25In the configuration file the option called CONFIG_DMATEST. The dmatest could 26be built as module or inside kernel. Let's consider those cases. 27 28Part 2 - When dmatest is built as a module 29========================================== 30 31Example of usage:: 32 33 % modprobe dmatest channel=dma0chan0 timeout=2000 iterations=1 run=1 34 35...or:: 36 37 % modprobe dmatest 38 % echo dma0chan0 > /sys/module/dmatest/parameters/channel 39 % echo 2000 > /sys/module/dmatest/parameters/timeout 40 % echo 1 > /sys/module/dmatest/parameters/iterations 41 % echo 1 > /sys/module/dmatest/parameters/run 42 43...or on the kernel command line:: 44 45 dmatest.channel=dma0chan0 dmatest.timeout=2000 dmatest.iterations=1 dmatest.run=1 46 47.. hint:: 48 available channel list could be extracted by running the following command:: 49 50 % ls -1 /sys/class/dma/ 51 52Once started a message like "dmatest: Started 1 threads using dma0chan0" is 53emitted. After that only test failure messages are reported until the test 54stops. 55 56Note that running a new test will not stop any in progress test. 57 58The following command returns the state of the test. :: 59 60 % cat /sys/module/dmatest/parameters/run 61 62To wait for test completion userpace can poll 'run' until it is false, or use 63the wait parameter. Specifying 'wait=1' when loading the module causes module 64initialization to pause until a test run has completed, while reading 65/sys/module/dmatest/parameters/wait waits for any running test to complete 66before returning. For example, the following scripts wait for 42 tests 67to complete before exiting. Note that if 'iterations' is set to 'infinite' then 68waiting is disabled. 69 70Example:: 71 72 % modprobe dmatest run=1 iterations=42 wait=1 73 % modprobe -r dmatest 74 75...or:: 76 77 % modprobe dmatest run=1 iterations=42 78 % cat /sys/module/dmatest/parameters/wait 79 % modprobe -r dmatest 80 81Part 3 - When built-in in the kernel 82==================================== 83 84The module parameters that is supplied to the kernel command line will be used 85for the first performed test. After user gets a control, the test could be 86re-run with the same or different parameters. For the details see the above 87section `Part 2 - When dmatest is built as a module`_. 88 89In both cases the module parameters are used as the actual values for the test 90case. You always could check them at run-time by running :: 91 92 % grep -H . /sys/module/dmatest/parameters/* 93 94Part 4 - Gathering the test results 95=================================== 96 97Test results are printed to the kernel log buffer with the format:: 98 99 "dmatest: result <channel>: <test id>: '<error msg>' with src_off=<val> dst_off=<val> len=<val> (<err code>)" 100 101Example of output:: 102 103 % dmesg | tail -n 1 104 dmatest: result dma0chan0-copy0: #1: No errors with src_off=0x7bf dst_off=0x8ad len=0x3fea (0) 105 106The message format is unified across the different types of errors. A 107number in the parentheses represents additional information, e.g. error 108code, error counter, or status. A test thread also emits a summary line at 109completion listing the number of tests executed, number that failed, and a 110result code. 111 112Example:: 113 114 % dmesg | tail -n 1 115 dmatest: dma0chan0-copy0: summary 1 test, 0 failures 1000 iops 100000 KB/s (0) 116 117The details of a data miscompare error are also emitted, but do not follow the 118above format. 119