blob: a2b5663eae266d2dcae8fcf9400ef9eb16b24709 [file] [log] [blame]
Andy Shevchenko851b7e12013-03-04 11:09:30 +02001 DMA Test Guide
2 ==============
3
4 Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5
6This small document introduces how to test DMA drivers using dmatest module.
7
8 Part 1 - How to build the test module
9
10The menuconfig contains an option that could be found by following path:
11 Device Drivers -> DMA Engine support -> DMA Test client
12
13In the configuration file the option called CONFIG_DMATEST. The dmatest could
14be built as module or inside kernel. Let's consider those cases.
15
16 Part 2 - When dmatest is built as a module...
17
18After mounting debugfs and loading the module, the /sys/kernel/debug/dmatest
Andy Shevchenkoa6c268d2013-07-23 18:36:46 +030019folder with nodes will be created. There are two important files located. First
20is the 'run' node that controls run and stop phases of the test, and the second
21one, 'results', is used to get the test case results.
Andy Shevchenko851b7e12013-03-04 11:09:30 +020022
23Note that in this case test will not run on load automatically.
24
25Example of usage:
Andy Shevchenkoa6c268d2013-07-23 18:36:46 +030026 % echo dma0chan0 > /sys/module/dmatest/parameters/channel
27 % echo 2000 > /sys/module/dmatest/parameters/timeout
28 % echo 1 > /sys/module/dmatest/parameters/iterations
Andy Shevchenko851b7e12013-03-04 11:09:30 +020029 % echo 1 > /sys/kernel/debug/dmatest/run
30
31Hint: available channel list could be extracted by running the following
32command:
33 % ls -1 /sys/class/dma/
34
35After a while you will start to get messages about current status or error like
36in the original code.
37
Andy Shevchenkobcc567e2013-05-23 14:29:53 +030038Note that running a new test will not stop any in progress test.
Andy Shevchenko851b7e12013-03-04 11:09:30 +020039
Andy Shevchenko3e5ccd82013-03-04 11:09:31 +020040The following command should return actual state of the test.
41 % cat /sys/kernel/debug/dmatest/run
42
43To wait for test done the user may perform a busy loop that checks the state.
44
45 % while [ $(cat /sys/kernel/debug/dmatest/run) = "Y" ]
46 > do
47 > echo -n "."
48 > sleep 1
49 > done
50 > echo
51
Andy Shevchenko851b7e12013-03-04 11:09:30 +020052 Part 3 - When built-in in the kernel...
53
54The module parameters that is supplied to the kernel command line will be used
55for the first performed test. After user gets a control, the test could be
Andy Shevchenkobcc567e2013-05-23 14:29:53 +030056re-run with the same or different parameters. For the details see the above
57section "Part 2 - When dmatest is built as a module..."
Andy Shevchenko851b7e12013-03-04 11:09:30 +020058
Andy Shevchenkoa6c268d2013-07-23 18:36:46 +030059In both cases the module parameters are used as the actual values for the test
60case. You always could check them at run-time by running
Andy Shevchenko851b7e12013-03-04 11:09:30 +020061 % grep -H . /sys/module/dmatest/parameters/*
Andy Shevchenko95019c82013-03-04 11:09:33 +020062
63 Part 4 - Gathering the test results
64
65The module provides a storage for the test results in the memory. The gathered
66data could be used after test is done.
67
68The special file 'results' in the debugfs represents gathered data of the in
69progress test. The messages collected are printed to the kernel log as well.
70
71Example of output:
72 % cat /sys/kernel/debug/dmatest/results
73 dma0chan0-copy0: #1: No errors with src_off=0x7bf dst_off=0x8ad len=0x3fea (0)
74
75The message format is unified across the different types of errors. A number in
76the parens represents additional information, e.g. error code, error counter,
77or status.
78
Andy Shevchenkod86b2f22013-03-04 11:09:34 +020079Comparison between buffers is stored to the dedicated structure.
80
81Note that the verify result is now accessible only via file 'results' in the
82debugfs.