diff options
| -rw-r--r-- | Documentation/driver-api/dmaengine/dmatest.rst | 109 |
1 files changed, 103 insertions, 6 deletions
diff --git a/Documentation/driver-api/dmaengine/dmatest.rst b/Documentation/driver-api/dmaengine/dmatest.rst index 7ce5e71c353e..dd5263a19c7b 100644 --- a/Documentation/driver-api/dmaengine/dmatest.rst +++ b/Documentation/driver-api/dmaengine/dmatest.rst | |||
| @@ -26,28 +26,43 @@ Part 2 - When dmatest is built as a module | |||
| 26 | 26 | ||
| 27 | Example of usage:: | 27 | Example of usage:: |
| 28 | 28 | ||
| 29 | % modprobe dmatest channel=dma0chan0 timeout=2000 iterations=1 run=1 | 29 | % modprobe dmatest timeout=2000 iterations=1 channel=dma0chan0 run=1 |
| 30 | 30 | ||
| 31 | ...or:: | 31 | ...or:: |
| 32 | 32 | ||
| 33 | % modprobe dmatest | 33 | % modprobe dmatest |
| 34 | % echo dma0chan0 > /sys/module/dmatest/parameters/channel | ||
| 35 | % echo 2000 > /sys/module/dmatest/parameters/timeout | 34 | % echo 2000 > /sys/module/dmatest/parameters/timeout |
| 36 | % echo 1 > /sys/module/dmatest/parameters/iterations | 35 | % echo 1 > /sys/module/dmatest/parameters/iterations |
| 36 | % echo dma0chan0 > /sys/module/dmatest/parameters/channel | ||
| 37 | % echo 1 > /sys/module/dmatest/parameters/run | 37 | % echo 1 > /sys/module/dmatest/parameters/run |
| 38 | 38 | ||
| 39 | ...or on the kernel command line:: | 39 | ...or on the kernel command line:: |
| 40 | 40 | ||
| 41 | dmatest.channel=dma0chan0 dmatest.timeout=2000 dmatest.iterations=1 dmatest.run=1 | 41 | dmatest.timeout=2000 dmatest.iterations=1 dmatest.channel=dma0chan0 dmatest.run=1 |
| 42 | |||
| 43 | Example of multi-channel test usage: | ||
| 44 | % modprobe dmatest | ||
| 45 | % echo 2000 > /sys/module/dmatest/parameters/timeout | ||
| 46 | % echo 1 > /sys/module/dmatest/parameters/iterations | ||
| 47 | % echo dma0chan0 > /sys/module/dmatest/parameters/channel | ||
| 48 | % echo dma0chan1 > /sys/module/dmatest/parameters/channel | ||
| 49 | % echo dma0chan2 > /sys/module/dmatest/parameters/channel | ||
| 50 | % echo 1 > /sys/module/dmatest/parameters/run | ||
| 42 | 51 | ||
| 52 | Note: the channel parameter should always be the last parameter set prior to | ||
| 53 | running the test (setting run=1), this is because upon setting the channel | ||
| 54 | parameter, that specific channel is requested using the dmaengine and a thread | ||
| 55 | is created with the existing parameters. This thread is set as pending | ||
| 56 | and will be executed once run is set to 1. Any parameters set after the thread | ||
| 57 | is created are not applied. | ||
| 43 | .. hint:: | 58 | .. hint:: |
| 44 | available channel list could be extracted by running the following command:: | 59 | available channel list could be extracted by running the following command:: |
| 45 | 60 | ||
| 46 | % ls -1 /sys/class/dma/ | 61 | % ls -1 /sys/class/dma/ |
| 47 | 62 | ||
| 48 | Once started a message like "dmatest: Started 1 threads using dma0chan0" is | 63 | Once started a message like " dmatest: Added 1 threads using dma0chan0" is |
| 49 | emitted. After that only test failure messages are reported until the test | 64 | emitted. A thread for that specific channel is created and is now pending, the |
| 50 | stops. | 65 | pending thread is started once run is to 1. |
| 51 | 66 | ||
| 52 | Note that running a new test will not stop any in progress test. | 67 | Note that running a new test will not stop any in progress test. |
| 53 | 68 | ||
| @@ -112,3 +127,85 @@ Example:: | |||
| 112 | 127 | ||
| 113 | The details of a data miscompare error are also emitted, but do not follow the | 128 | The details of a data miscompare error are also emitted, but do not follow the |
| 114 | above format. | 129 | above format. |
| 130 | |||
| 131 | Part 5 - Handling channel allocation | ||
| 132 | ==================================== | ||
| 133 | |||
| 134 | Allocating Channels | ||
| 135 | ------------------- | ||
| 136 | |||
| 137 | Channels are required to be configured prior to starting the test run. | ||
| 138 | Attempting to run the test without configuring the channels will fail. | ||
| 139 | |||
| 140 | Example:: | ||
| 141 | |||
| 142 | % echo 1 > /sys/module/dmatest/parameters/run | ||
| 143 | dmatest: Could not start test, no channels configured | ||
| 144 | |||
| 145 | Channels are registered using the "channel" parameter. Channels can be requested by their | ||
| 146 | name, once requested, the channel is registered and a pending thread is added to the test list. | ||
| 147 | |||
| 148 | Example:: | ||
| 149 | |||
| 150 | % echo dma0chan2 > /sys/module/dmatest/parameters/channel | ||
| 151 | dmatest: Added 1 threads using dma0chan2 | ||
| 152 | |||
| 153 | More channels can be added by repeating the example above. | ||
| 154 | Reading back the channel parameter will return the name of last channel that was added successfully. | ||
| 155 | |||
| 156 | Example:: | ||
| 157 | |||
| 158 | % echo dma0chan1 > /sys/module/dmatest/parameters/channel | ||
| 159 | dmatest: Added 1 threads using dma0chan1 | ||
| 160 | % echo dma0chan2 > /sys/module/dmatest/parameters/channel | ||
| 161 | dmatest: Added 1 threads using dma0chan2 | ||
| 162 | % cat /sys/module/dmatest/parameters/channel | ||
| 163 | dma0chan2 | ||
| 164 | |||
| 165 | Another method of requesting channels is to request a channel with an empty string, Doing so | ||
| 166 | will request all channels available to be tested: | ||
| 167 | |||
| 168 | Example:: | ||
| 169 | |||
| 170 | % echo "" > /sys/module/dmatest/parameters/channel | ||
| 171 | dmatest: Added 1 threads using dma0chan0 | ||
| 172 | dmatest: Added 1 threads using dma0chan3 | ||
| 173 | dmatest: Added 1 threads using dma0chan4 | ||
| 174 | dmatest: Added 1 threads using dma0chan5 | ||
| 175 | dmatest: Added 1 threads using dma0chan6 | ||
| 176 | dmatest: Added 1 threads using dma0chan7 | ||
| 177 | dmatest: Added 1 threads using dma0chan8 | ||
| 178 | |||
| 179 | At any point during the test configuration, reading the "test_list" parameter will | ||
| 180 | print the list of currently pending tests. | ||
| 181 | |||
| 182 | Example:: | ||
| 183 | |||
| 184 | % cat /sys/module/dmatest/parameters/test_list | ||
| 185 | dmatest: 1 threads using dma0chan0 | ||
| 186 | dmatest: 1 threads using dma0chan3 | ||
| 187 | dmatest: 1 threads using dma0chan4 | ||
| 188 | dmatest: 1 threads using dma0chan5 | ||
| 189 | dmatest: 1 threads using dma0chan6 | ||
| 190 | dmatest: 1 threads using dma0chan7 | ||
| 191 | dmatest: 1 threads using dma0chan8 | ||
| 192 | |||
| 193 | Note: Channels will have to be configured for each test run as channel configurations do not | ||
| 194 | carry across to the next test run. | ||
| 195 | |||
| 196 | Releasing Channels | ||
| 197 | ------------------- | ||
| 198 | |||
| 199 | Channels can be freed by setting run to 0. | ||
| 200 | |||
| 201 | Example:: | ||
| 202 | % echo dma0chan1 > /sys/module/dmatest/parameters/channel | ||
| 203 | dmatest: Added 1 threads using dma0chan1 | ||
| 204 | % cat /sys/class/dma/dma0chan1/in_use | ||
| 205 | 1 | ||
| 206 | % echo 0 > /sys/module/dmatest/parameters/run | ||
| 207 | % cat /sys/class/dma/dma0chan1/in_use | ||
| 208 | 0 | ||
| 209 | |||
| 210 | Channels allocated by previous test runs are automatically freed when a new | ||
| 211 | channel is requested after completing a successful test run. | ||
