forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/Documentation/driver-api/dmaengine/dmatest.rst
....@@ -11,6 +11,10 @@
1111 capability of the following: DMA_MEMCPY (memory-to-memory), DMA_MEMSET
1212 (const-to-memory or memory-to-memory, when emulated), DMA_XOR, DMA_PQ.
1313
14
+.. note::
15
+ In case of any related questions use the official mailing list
16
+ dmaengine@vger.kernel.org.
17
+
1418 Part 1 - How to build the test module
1519 =====================================
1620
....@@ -26,28 +30,48 @@
2630
2731 Example of usage::
2832
29
- % modprobe dmatest channel=dma0chan0 timeout=2000 iterations=1 run=1
33
+ % modprobe dmatest timeout=2000 iterations=1 channel=dma0chan0 run=1
3034
3135 ...or::
3236
3337 % modprobe dmatest
34
- % echo dma0chan0 > /sys/module/dmatest/parameters/channel
3538 % echo 2000 > /sys/module/dmatest/parameters/timeout
3639 % echo 1 > /sys/module/dmatest/parameters/iterations
40
+ % echo dma0chan0 > /sys/module/dmatest/parameters/channel
3741 % echo 1 > /sys/module/dmatest/parameters/run
3842
3943 ...or on the kernel command line::
4044
41
- dmatest.channel=dma0chan0 dmatest.timeout=2000 dmatest.iterations=1 dmatest.run=1
45
+ dmatest.timeout=2000 dmatest.iterations=1 dmatest.channel=dma0chan0 dmatest.run=1
46
+
47
+Example of multi-channel test usage (new in the 5.0 kernel)::
48
+
49
+ % modprobe dmatest
50
+ % echo 2000 > /sys/module/dmatest/parameters/timeout
51
+ % echo 1 > /sys/module/dmatest/parameters/iterations
52
+ % echo dma0chan0 > /sys/module/dmatest/parameters/channel
53
+ % echo dma0chan1 > /sys/module/dmatest/parameters/channel
54
+ % echo dma0chan2 > /sys/module/dmatest/parameters/channel
55
+ % echo 1 > /sys/module/dmatest/parameters/run
56
+
57
+.. note::
58
+ For all tests, starting in the 5.0 kernel, either single- or multi-channel,
59
+ the channel parameter(s) must be set after all other parameters. It is at
60
+ that time that the existing parameter values are acquired for use by the
61
+ thread(s). All other parameters are shared. Therefore, if changes are made
62
+ to any of the other parameters, and an additional channel specified, the
63
+ (shared) parameters used for all threads will use the new values.
64
+ After the channels are specified, each thread is set as pending. All threads
65
+ begin execution when the run parameter is set to 1.
4266
4367 .. hint::
44
- available channel list could be extracted by running the following command::
68
+ A list of available channels can be found by running the following command::
4569
4670 % ls -1 /sys/class/dma/
4771
48
-Once started a message like "dmatest: Started 1 threads using dma0chan0" is
49
-emitted. After that only test failure messages are reported until the test
50
-stops.
72
+Once started a message like " dmatest: Added 1 threads using dma0chan0" is
73
+emitted. A thread for that specific channel is created and is now pending, the
74
+pending thread is started once run is to 1.
5175
5276 Note that running a new test will not stop any in progress test.
5377
....@@ -112,3 +136,87 @@
112136
113137 The details of a data miscompare error are also emitted, but do not follow the
114138 above format.
139
+
140
+Part 5 - Handling channel allocation
141
+====================================
142
+
143
+Allocating Channels
144
+-------------------
145
+
146
+Channels do not need to be configured prior to starting a test run. Attempting
147
+to run the test without configuring the channels will result in testing any
148
+channels that are available.
149
+
150
+Example::
151
+
152
+ % echo 1 > /sys/module/dmatest/parameters/run
153
+ dmatest: No channels configured, continue with any
154
+
155
+Channels are registered using the "channel" parameter. Channels can be requested by their
156
+name, once requested, the channel is registered and a pending thread is added to the test list.
157
+
158
+Example::
159
+
160
+ % echo dma0chan2 > /sys/module/dmatest/parameters/channel
161
+ dmatest: Added 1 threads using dma0chan2
162
+
163
+More channels can be added by repeating the example above.
164
+Reading back the channel parameter will return the name of last channel that was added successfully.
165
+
166
+Example::
167
+
168
+ % echo dma0chan1 > /sys/module/dmatest/parameters/channel
169
+ dmatest: Added 1 threads using dma0chan1
170
+ % echo dma0chan2 > /sys/module/dmatest/parameters/channel
171
+ dmatest: Added 1 threads using dma0chan2
172
+ % cat /sys/module/dmatest/parameters/channel
173
+ dma0chan2
174
+
175
+Another method of requesting channels is to request a channel with an empty string, Doing so
176
+will request all channels available to be tested:
177
+
178
+Example::
179
+
180
+ % echo "" > /sys/module/dmatest/parameters/channel
181
+ dmatest: Added 1 threads using dma0chan0
182
+ dmatest: Added 1 threads using dma0chan3
183
+ dmatest: Added 1 threads using dma0chan4
184
+ dmatest: Added 1 threads using dma0chan5
185
+ dmatest: Added 1 threads using dma0chan6
186
+ dmatest: Added 1 threads using dma0chan7
187
+ dmatest: Added 1 threads using dma0chan8
188
+
189
+At any point during the test configuration, reading the "test_list" parameter will
190
+print the list of currently pending tests.
191
+
192
+Example::
193
+
194
+ % cat /sys/module/dmatest/parameters/test_list
195
+ dmatest: 1 threads using dma0chan0
196
+ dmatest: 1 threads using dma0chan3
197
+ dmatest: 1 threads using dma0chan4
198
+ dmatest: 1 threads using dma0chan5
199
+ dmatest: 1 threads using dma0chan6
200
+ dmatest: 1 threads using dma0chan7
201
+ dmatest: 1 threads using dma0chan8
202
+
203
+Note: Channels will have to be configured for each test run as channel configurations do not
204
+carry across to the next test run.
205
+
206
+Releasing Channels
207
+-------------------
208
+
209
+Channels can be freed by setting run to 0.
210
+
211
+Example::
212
+
213
+ % echo dma0chan1 > /sys/module/dmatest/parameters/channel
214
+ dmatest: Added 1 threads using dma0chan1
215
+ % cat /sys/class/dma/dma0chan1/in_use
216
+ 1
217
+ % echo 0 > /sys/module/dmatest/parameters/run
218
+ % cat /sys/class/dma/dma0chan1/in_use
219
+ 0
220
+
221
+Channels allocated by previous test runs are automatically freed when a new
222
+channel is requested after completing a successful test run.