Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 1 | /* |
| 2 | * DMA Engine test module |
| 3 | * |
| 4 | * Copyright (C) 2007 Atmel Corporation |
Andy Shevchenko | 851b7e1 | 2013-03-04 11:09:30 +0200 | [diff] [blame] | 5 | * Copyright (C) 2013 Intel Corporation |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | */ |
| 11 | #include <linux/delay.h> |
Alexey Dobriyan | b7f080c | 2011-06-16 11:01:34 +0000 | [diff] [blame] | 12 | #include <linux/dma-mapping.h> |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 13 | #include <linux/dmaengine.h> |
Guennadi Liakhovetski | 981ed70 | 2011-08-18 16:50:51 +0200 | [diff] [blame] | 14 | #include <linux/freezer.h> |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 15 | #include <linux/init.h> |
| 16 | #include <linux/kthread.h> |
| 17 | #include <linux/module.h> |
| 18 | #include <linux/moduleparam.h> |
| 19 | #include <linux/random.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 20 | #include <linux/slab.h> |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 21 | #include <linux/wait.h> |
Andy Shevchenko | 851b7e1 | 2013-03-04 11:09:30 +0200 | [diff] [blame] | 22 | #include <linux/ctype.h> |
| 23 | #include <linux/debugfs.h> |
| 24 | #include <linux/uaccess.h> |
| 25 | #include <linux/seq_file.h> |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 26 | |
| 27 | static unsigned int test_buf_size = 16384; |
| 28 | module_param(test_buf_size, uint, S_IRUGO); |
| 29 | MODULE_PARM_DESC(test_buf_size, "Size of the memcpy test buffer"); |
| 30 | |
Kay Sievers | 06190d8 | 2008-11-11 13:12:33 -0700 | [diff] [blame] | 31 | static char test_channel[20]; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 32 | module_param_string(channel, test_channel, sizeof(test_channel), S_IRUGO); |
| 33 | MODULE_PARM_DESC(channel, "Bus ID of the channel to test (default: any)"); |
| 34 | |
Kay Sievers | 06190d8 | 2008-11-11 13:12:33 -0700 | [diff] [blame] | 35 | static char test_device[20]; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 36 | module_param_string(device, test_device, sizeof(test_device), S_IRUGO); |
| 37 | MODULE_PARM_DESC(device, "Bus ID of the DMA Engine to test (default: any)"); |
| 38 | |
| 39 | static unsigned int threads_per_chan = 1; |
| 40 | module_param(threads_per_chan, uint, S_IRUGO); |
| 41 | MODULE_PARM_DESC(threads_per_chan, |
| 42 | "Number of threads to start per channel (default: 1)"); |
| 43 | |
| 44 | static unsigned int max_channels; |
| 45 | module_param(max_channels, uint, S_IRUGO); |
Dan Williams | 33df8ca | 2009-01-06 11:38:15 -0700 | [diff] [blame] | 46 | MODULE_PARM_DESC(max_channels, |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 47 | "Maximum number of channels to use (default: all)"); |
| 48 | |
Nicolas Ferre | 0a2ff57d | 2009-07-03 19:26:51 +0200 | [diff] [blame] | 49 | static unsigned int iterations; |
| 50 | module_param(iterations, uint, S_IRUGO); |
| 51 | MODULE_PARM_DESC(iterations, |
| 52 | "Iterations before stopping test (default: infinite)"); |
| 53 | |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 54 | static unsigned int xor_sources = 3; |
| 55 | module_param(xor_sources, uint, S_IRUGO); |
| 56 | MODULE_PARM_DESC(xor_sources, |
| 57 | "Number of xor source buffers (default: 3)"); |
| 58 | |
Dan Williams | 58691d6 | 2009-08-29 19:09:27 -0700 | [diff] [blame] | 59 | static unsigned int pq_sources = 3; |
| 60 | module_param(pq_sources, uint, S_IRUGO); |
| 61 | MODULE_PARM_DESC(pq_sources, |
| 62 | "Number of p+q source buffers (default: 3)"); |
| 63 | |
Viresh Kumar | d42efe6 | 2011-03-22 17:27:25 +0530 | [diff] [blame] | 64 | static int timeout = 3000; |
| 65 | module_param(timeout, uint, S_IRUGO); |
Joe Perches | 85ee7a1 | 2011-04-23 20:38:19 -0700 | [diff] [blame] | 66 | MODULE_PARM_DESC(timeout, "Transfer Timeout in msec (default: 3000), " |
| 67 | "Pass -1 for infinite timeout"); |
Viresh Kumar | d42efe6 | 2011-03-22 17:27:25 +0530 | [diff] [blame] | 68 | |
Andy Shevchenko | 74b5c07 | 2013-03-04 11:09:32 +0200 | [diff] [blame] | 69 | /* Maximum amount of mismatched bytes in buffer to print */ |
| 70 | #define MAX_ERROR_COUNT 32 |
| 71 | |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 72 | /* |
| 73 | * Initialization patterns. All bytes in the source buffer has bit 7 |
| 74 | * set, all bytes in the destination buffer has bit 7 cleared. |
| 75 | * |
| 76 | * Bit 6 is set for all bytes which are to be copied by the DMA |
| 77 | * engine. Bit 5 is set for all bytes which are to be overwritten by |
| 78 | * the DMA engine. |
| 79 | * |
| 80 | * The remaining bits are the inverse of a counter which increments by |
| 81 | * one for each byte address. |
| 82 | */ |
| 83 | #define PATTERN_SRC 0x80 |
| 84 | #define PATTERN_DST 0x00 |
| 85 | #define PATTERN_COPY 0x40 |
| 86 | #define PATTERN_OVERWRITE 0x20 |
| 87 | #define PATTERN_COUNT_MASK 0x1f |
| 88 | |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 89 | enum dmatest_error_type { |
| 90 | DMATEST_ET_OK, |
| 91 | DMATEST_ET_MAP_SRC, |
| 92 | DMATEST_ET_MAP_DST, |
| 93 | DMATEST_ET_PREP, |
| 94 | DMATEST_ET_SUBMIT, |
| 95 | DMATEST_ET_TIMEOUT, |
| 96 | DMATEST_ET_DMA_ERROR, |
| 97 | DMATEST_ET_DMA_IN_PROGRESS, |
| 98 | DMATEST_ET_VERIFY, |
Andy Shevchenko | d86b2f2 | 2013-03-04 11:09:34 +0200 | [diff] [blame] | 99 | DMATEST_ET_VERIFY_BUF, |
| 100 | }; |
| 101 | |
| 102 | struct dmatest_verify_buffer { |
| 103 | unsigned int index; |
| 104 | u8 expected; |
| 105 | u8 actual; |
| 106 | }; |
| 107 | |
| 108 | struct dmatest_verify_result { |
| 109 | unsigned int error_count; |
| 110 | struct dmatest_verify_buffer data[MAX_ERROR_COUNT]; |
| 111 | u8 pattern; |
| 112 | bool is_srcbuf; |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 113 | }; |
| 114 | |
| 115 | struct dmatest_thread_result { |
| 116 | struct list_head node; |
| 117 | unsigned int n; |
| 118 | unsigned int src_off; |
| 119 | unsigned int dst_off; |
| 120 | unsigned int len; |
| 121 | enum dmatest_error_type type; |
| 122 | union { |
Andy Shevchenko | d86b2f2 | 2013-03-04 11:09:34 +0200 | [diff] [blame] | 123 | unsigned long data; |
| 124 | dma_cookie_t cookie; |
| 125 | enum dma_status status; |
| 126 | int error; |
| 127 | struct dmatest_verify_result *vr; |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 128 | }; |
| 129 | }; |
| 130 | |
| 131 | struct dmatest_result { |
| 132 | struct list_head node; |
| 133 | char *name; |
| 134 | struct list_head results; |
| 135 | }; |
| 136 | |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 137 | struct dmatest_info; |
| 138 | |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 139 | struct dmatest_thread { |
| 140 | struct list_head node; |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 141 | struct dmatest_info *info; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 142 | struct task_struct *task; |
| 143 | struct dma_chan *chan; |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 144 | u8 **srcs; |
| 145 | u8 **dsts; |
| 146 | enum dma_transaction_type type; |
Andy Shevchenko | 3e5ccd8 | 2013-03-04 11:09:31 +0200 | [diff] [blame] | 147 | bool done; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 148 | }; |
| 149 | |
| 150 | struct dmatest_chan { |
| 151 | struct list_head node; |
| 152 | struct dma_chan *chan; |
| 153 | struct list_head threads; |
| 154 | }; |
| 155 | |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 156 | /** |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 157 | * struct dmatest_params - test parameters. |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 158 | * @buf_size: size of the memcpy test buffer |
| 159 | * @channel: bus ID of the channel to test |
| 160 | * @device: bus ID of the DMA Engine to test |
| 161 | * @threads_per_chan: number of threads to start per channel |
| 162 | * @max_channels: maximum number of channels to use |
| 163 | * @iterations: iterations before stopping test |
| 164 | * @xor_sources: number of xor source buffers |
| 165 | * @pq_sources: number of p+q source buffers |
| 166 | * @timeout: transfer timeout in msec, -1 for infinite timeout |
| 167 | */ |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 168 | struct dmatest_params { |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 169 | unsigned int buf_size; |
| 170 | char channel[20]; |
| 171 | char device[20]; |
| 172 | unsigned int threads_per_chan; |
| 173 | unsigned int max_channels; |
| 174 | unsigned int iterations; |
| 175 | unsigned int xor_sources; |
| 176 | unsigned int pq_sources; |
| 177 | int timeout; |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 178 | }; |
| 179 | |
| 180 | /** |
| 181 | * struct dmatest_info - test information. |
| 182 | * @params: test parameters |
Andy Shevchenko | 851b7e1 | 2013-03-04 11:09:30 +0200 | [diff] [blame] | 183 | * @lock: access protection to the fields of this structure |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 184 | */ |
| 185 | struct dmatest_info { |
| 186 | /* Test parameters */ |
| 187 | struct dmatest_params params; |
Andy Shevchenko | 838cc70 | 2013-03-04 11:09:28 +0200 | [diff] [blame] | 188 | |
| 189 | /* Internal state */ |
| 190 | struct list_head channels; |
| 191 | unsigned int nr_channels; |
Andy Shevchenko | 851b7e1 | 2013-03-04 11:09:30 +0200 | [diff] [blame] | 192 | struct mutex lock; |
| 193 | |
| 194 | /* debugfs related stuff */ |
| 195 | struct dentry *root; |
| 196 | struct dmatest_params dbgfs_params; |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 197 | |
| 198 | /* Test results */ |
| 199 | struct list_head results; |
| 200 | struct mutex results_lock; |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 201 | }; |
| 202 | |
| 203 | static struct dmatest_info test_info; |
| 204 | |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 205 | static bool dmatest_match_channel(struct dmatest_params *params, |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 206 | struct dma_chan *chan) |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 207 | { |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 208 | if (params->channel[0] == '\0') |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 209 | return true; |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 210 | return strcmp(dma_chan_name(chan), params->channel) == 0; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 211 | } |
| 212 | |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 213 | static bool dmatest_match_device(struct dmatest_params *params, |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 214 | struct dma_device *device) |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 215 | { |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 216 | if (params->device[0] == '\0') |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 217 | return true; |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 218 | return strcmp(dev_name(device->dev), params->device) == 0; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 219 | } |
| 220 | |
| 221 | static unsigned long dmatest_random(void) |
| 222 | { |
| 223 | unsigned long buf; |
| 224 | |
| 225 | get_random_bytes(&buf, sizeof(buf)); |
| 226 | return buf; |
| 227 | } |
| 228 | |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 229 | static void dmatest_init_srcs(u8 **bufs, unsigned int start, unsigned int len, |
| 230 | unsigned int buf_size) |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 231 | { |
| 232 | unsigned int i; |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 233 | u8 *buf; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 234 | |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 235 | for (; (buf = *bufs); bufs++) { |
| 236 | for (i = 0; i < start; i++) |
| 237 | buf[i] = PATTERN_SRC | (~i & PATTERN_COUNT_MASK); |
| 238 | for ( ; i < start + len; i++) |
| 239 | buf[i] = PATTERN_SRC | PATTERN_COPY |
Joe Perches | c019894 | 2009-06-28 09:26:21 -0700 | [diff] [blame] | 240 | | (~i & PATTERN_COUNT_MASK); |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 241 | for ( ; i < buf_size; i++) |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 242 | buf[i] = PATTERN_SRC | (~i & PATTERN_COUNT_MASK); |
| 243 | buf++; |
| 244 | } |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 245 | } |
| 246 | |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 247 | static void dmatest_init_dsts(u8 **bufs, unsigned int start, unsigned int len, |
| 248 | unsigned int buf_size) |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 249 | { |
| 250 | unsigned int i; |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 251 | u8 *buf; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 252 | |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 253 | for (; (buf = *bufs); bufs++) { |
| 254 | for (i = 0; i < start; i++) |
| 255 | buf[i] = PATTERN_DST | (~i & PATTERN_COUNT_MASK); |
| 256 | for ( ; i < start + len; i++) |
| 257 | buf[i] = PATTERN_DST | PATTERN_OVERWRITE |
| 258 | | (~i & PATTERN_COUNT_MASK); |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 259 | for ( ; i < buf_size; i++) |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 260 | buf[i] = PATTERN_DST | (~i & PATTERN_COUNT_MASK); |
| 261 | } |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 262 | } |
| 263 | |
Andy Shevchenko | d86b2f2 | 2013-03-04 11:09:34 +0200 | [diff] [blame] | 264 | static unsigned int dmatest_verify(struct dmatest_verify_result *vr, u8 **bufs, |
| 265 | unsigned int start, unsigned int end, unsigned int counter, |
| 266 | u8 pattern, bool is_srcbuf) |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 267 | { |
| 268 | unsigned int i; |
| 269 | unsigned int error_count = 0; |
| 270 | u8 actual; |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 271 | u8 expected; |
| 272 | u8 *buf; |
| 273 | unsigned int counter_orig = counter; |
Andy Shevchenko | d86b2f2 | 2013-03-04 11:09:34 +0200 | [diff] [blame] | 274 | struct dmatest_verify_buffer *vb; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 275 | |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 276 | for (; (buf = *bufs); bufs++) { |
| 277 | counter = counter_orig; |
| 278 | for (i = start; i < end; i++) { |
| 279 | actual = buf[i]; |
| 280 | expected = pattern | (~counter & PATTERN_COUNT_MASK); |
| 281 | if (actual != expected) { |
Andy Shevchenko | d86b2f2 | 2013-03-04 11:09:34 +0200 | [diff] [blame] | 282 | if (error_count < MAX_ERROR_COUNT && vr) { |
| 283 | vb = &vr->data[error_count]; |
| 284 | vb->index = i; |
| 285 | vb->expected = expected; |
| 286 | vb->actual = actual; |
| 287 | } |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 288 | error_count++; |
| 289 | } |
| 290 | counter++; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 291 | } |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 292 | } |
| 293 | |
Andy Shevchenko | 74b5c07 | 2013-03-04 11:09:32 +0200 | [diff] [blame] | 294 | if (error_count > MAX_ERROR_COUNT) |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 295 | pr_warning("%s: %u errors suppressed\n", |
Andy Shevchenko | 74b5c07 | 2013-03-04 11:09:32 +0200 | [diff] [blame] | 296 | current->comm, error_count - MAX_ERROR_COUNT); |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 297 | |
| 298 | return error_count; |
| 299 | } |
| 300 | |
Tejun Heo | adfa543 | 2011-11-23 09:28:16 -0800 | [diff] [blame] | 301 | /* poor man's completion - we want to use wait_event_freezable() on it */ |
| 302 | struct dmatest_done { |
| 303 | bool done; |
| 304 | wait_queue_head_t *wait; |
| 305 | }; |
| 306 | |
| 307 | static void dmatest_callback(void *arg) |
Dan Williams | e44e0aa | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 308 | { |
Tejun Heo | adfa543 | 2011-11-23 09:28:16 -0800 | [diff] [blame] | 309 | struct dmatest_done *done = arg; |
| 310 | |
| 311 | done->done = true; |
| 312 | wake_up_all(done->wait); |
Dan Williams | e44e0aa | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 313 | } |
| 314 | |
Andy Shevchenko | 632fd28 | 2012-12-17 15:59:52 -0800 | [diff] [blame] | 315 | static inline void unmap_src(struct device *dev, dma_addr_t *addr, size_t len, |
| 316 | unsigned int count) |
| 317 | { |
| 318 | while (count--) |
| 319 | dma_unmap_single(dev, addr[count], len, DMA_TO_DEVICE); |
| 320 | } |
| 321 | |
| 322 | static inline void unmap_dst(struct device *dev, dma_addr_t *addr, size_t len, |
| 323 | unsigned int count) |
| 324 | { |
| 325 | while (count--) |
| 326 | dma_unmap_single(dev, addr[count], len, DMA_BIDIRECTIONAL); |
| 327 | } |
| 328 | |
Akinobu Mita | 8be9e32b | 2012-10-28 00:49:32 +0900 | [diff] [blame] | 329 | static unsigned int min_odd(unsigned int x, unsigned int y) |
| 330 | { |
| 331 | unsigned int val = min(x, y); |
| 332 | |
| 333 | return val % 2 ? val : val - 1; |
| 334 | } |
| 335 | |
Andy Shevchenko | d86b2f2 | 2013-03-04 11:09:34 +0200 | [diff] [blame] | 336 | static char *verify_result_get_one(struct dmatest_verify_result *vr, |
| 337 | unsigned int i) |
| 338 | { |
| 339 | struct dmatest_verify_buffer *vb = &vr->data[i]; |
| 340 | u8 diff = vb->actual ^ vr->pattern; |
| 341 | static char buf[512]; |
| 342 | char *msg; |
| 343 | |
| 344 | if (vr->is_srcbuf) |
| 345 | msg = "srcbuf overwritten!"; |
| 346 | else if ((vr->pattern & PATTERN_COPY) |
| 347 | && (diff & (PATTERN_COPY | PATTERN_OVERWRITE))) |
| 348 | msg = "dstbuf not copied!"; |
| 349 | else if (diff & PATTERN_SRC) |
| 350 | msg = "dstbuf was copied!"; |
| 351 | else |
| 352 | msg = "dstbuf mismatch!"; |
| 353 | |
| 354 | snprintf(buf, sizeof(buf) - 1, "%s [0x%x] Expected %02x, got %02x", msg, |
| 355 | vb->index, vb->expected, vb->actual); |
| 356 | |
| 357 | return buf; |
| 358 | } |
| 359 | |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 360 | static char *thread_result_get(const char *name, |
| 361 | struct dmatest_thread_result *tr) |
| 362 | { |
| 363 | static const char * const messages[] = { |
| 364 | [DMATEST_ET_OK] = "No errors", |
| 365 | [DMATEST_ET_MAP_SRC] = "src mapping error", |
| 366 | [DMATEST_ET_MAP_DST] = "dst mapping error", |
| 367 | [DMATEST_ET_PREP] = "prep error", |
| 368 | [DMATEST_ET_SUBMIT] = "submit error", |
| 369 | [DMATEST_ET_TIMEOUT] = "test timed out", |
| 370 | [DMATEST_ET_DMA_ERROR] = |
| 371 | "got completion callback (DMA_ERROR)", |
| 372 | [DMATEST_ET_DMA_IN_PROGRESS] = |
| 373 | "got completion callback (DMA_IN_PROGRESS)", |
| 374 | [DMATEST_ET_VERIFY] = "errors", |
Andy Shevchenko | d86b2f2 | 2013-03-04 11:09:34 +0200 | [diff] [blame] | 375 | [DMATEST_ET_VERIFY_BUF] = "verify errors", |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 376 | }; |
| 377 | static char buf[512]; |
| 378 | |
| 379 | snprintf(buf, sizeof(buf) - 1, |
| 380 | "%s: #%u: %s with src_off=0x%x ""dst_off=0x%x len=0x%x (%lu)", |
| 381 | name, tr->n, messages[tr->type], tr->src_off, tr->dst_off, |
| 382 | tr->len, tr->data); |
| 383 | |
| 384 | return buf; |
| 385 | } |
| 386 | |
| 387 | static int thread_result_add(struct dmatest_info *info, |
| 388 | struct dmatest_result *r, enum dmatest_error_type type, |
| 389 | unsigned int n, unsigned int src_off, unsigned int dst_off, |
| 390 | unsigned int len, unsigned long data) |
| 391 | { |
| 392 | struct dmatest_thread_result *tr; |
| 393 | |
| 394 | tr = kzalloc(sizeof(*tr), GFP_KERNEL); |
| 395 | if (!tr) |
| 396 | return -ENOMEM; |
| 397 | |
| 398 | tr->type = type; |
| 399 | tr->n = n; |
| 400 | tr->src_off = src_off; |
| 401 | tr->dst_off = dst_off; |
| 402 | tr->len = len; |
| 403 | tr->data = data; |
| 404 | |
| 405 | mutex_lock(&info->results_lock); |
| 406 | list_add_tail(&tr->node, &r->results); |
| 407 | mutex_unlock(&info->results_lock); |
| 408 | |
| 409 | pr_warn("%s\n", thread_result_get(r->name, tr)); |
| 410 | return 0; |
| 411 | } |
| 412 | |
Andy Shevchenko | d86b2f2 | 2013-03-04 11:09:34 +0200 | [diff] [blame] | 413 | static unsigned int verify_result_add(struct dmatest_info *info, |
| 414 | struct dmatest_result *r, unsigned int n, |
| 415 | unsigned int src_off, unsigned int dst_off, unsigned int len, |
| 416 | u8 **bufs, int whence, unsigned int counter, u8 pattern, |
| 417 | bool is_srcbuf) |
| 418 | { |
| 419 | struct dmatest_verify_result *vr; |
| 420 | unsigned int error_count; |
| 421 | unsigned int buf_off = is_srcbuf ? src_off : dst_off; |
| 422 | unsigned int start, end; |
| 423 | |
| 424 | if (whence < 0) { |
| 425 | start = 0; |
| 426 | end = buf_off; |
| 427 | } else if (whence > 0) { |
| 428 | start = buf_off + len; |
| 429 | end = info->params.buf_size; |
| 430 | } else { |
| 431 | start = buf_off; |
| 432 | end = buf_off + len; |
| 433 | } |
| 434 | |
| 435 | vr = kmalloc(sizeof(*vr), GFP_KERNEL); |
| 436 | if (!vr) { |
| 437 | pr_warn("dmatest: No memory to store verify result\n"); |
| 438 | return dmatest_verify(NULL, bufs, start, end, counter, pattern, |
| 439 | is_srcbuf); |
| 440 | } |
| 441 | |
| 442 | vr->pattern = pattern; |
| 443 | vr->is_srcbuf = is_srcbuf; |
| 444 | |
| 445 | error_count = dmatest_verify(vr, bufs, start, end, counter, pattern, |
| 446 | is_srcbuf); |
| 447 | if (error_count) { |
| 448 | vr->error_count = error_count; |
| 449 | thread_result_add(info, r, DMATEST_ET_VERIFY_BUF, n, src_off, |
| 450 | dst_off, len, (unsigned long)vr); |
| 451 | return error_count; |
| 452 | } |
| 453 | |
| 454 | kfree(vr); |
| 455 | return 0; |
| 456 | } |
| 457 | |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 458 | static void result_free(struct dmatest_info *info, const char *name) |
| 459 | { |
| 460 | struct dmatest_result *r, *_r; |
| 461 | |
| 462 | mutex_lock(&info->results_lock); |
| 463 | list_for_each_entry_safe(r, _r, &info->results, node) { |
| 464 | struct dmatest_thread_result *tr, *_tr; |
| 465 | |
| 466 | if (name && strcmp(r->name, name)) |
| 467 | continue; |
| 468 | |
| 469 | list_for_each_entry_safe(tr, _tr, &r->results, node) { |
Andy Shevchenko | d86b2f2 | 2013-03-04 11:09:34 +0200 | [diff] [blame] | 470 | if (tr->type == DMATEST_ET_VERIFY_BUF) |
| 471 | kfree(tr->vr); |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 472 | list_del(&tr->node); |
| 473 | kfree(tr); |
| 474 | } |
| 475 | |
| 476 | kfree(r->name); |
| 477 | list_del(&r->node); |
| 478 | kfree(r); |
| 479 | } |
| 480 | |
| 481 | mutex_unlock(&info->results_lock); |
| 482 | } |
| 483 | |
| 484 | static struct dmatest_result *result_init(struct dmatest_info *info, |
| 485 | const char *name) |
| 486 | { |
| 487 | struct dmatest_result *r; |
| 488 | |
| 489 | r = kzalloc(sizeof(*r), GFP_KERNEL); |
| 490 | if (r) { |
| 491 | r->name = kstrdup(name, GFP_KERNEL); |
| 492 | INIT_LIST_HEAD(&r->results); |
| 493 | mutex_lock(&info->results_lock); |
| 494 | list_add_tail(&r->node, &info->results); |
| 495 | mutex_unlock(&info->results_lock); |
| 496 | } |
| 497 | return r; |
| 498 | } |
| 499 | |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 500 | /* |
| 501 | * This function repeatedly tests DMA transfers of various lengths and |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 502 | * offsets for a given operation type until it is told to exit by |
| 503 | * kthread_stop(). There may be multiple threads running this function |
| 504 | * in parallel for a single channel, and there may be multiple channels |
| 505 | * being tested in parallel. |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 506 | * |
| 507 | * Before each test, the source and destination buffer is initialized |
| 508 | * with a known pattern. This pattern is different depending on |
| 509 | * whether it's in an area which is supposed to be copied or |
| 510 | * overwritten, and different in the source and destination buffers. |
| 511 | * So if the DMA engine doesn't copy exactly what we tell it to copy, |
| 512 | * we'll notice. |
| 513 | */ |
| 514 | static int dmatest_func(void *data) |
| 515 | { |
Tejun Heo | adfa543 | 2011-11-23 09:28:16 -0800 | [diff] [blame] | 516 | DECLARE_WAIT_QUEUE_HEAD_ONSTACK(done_wait); |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 517 | struct dmatest_thread *thread = data; |
Tejun Heo | adfa543 | 2011-11-23 09:28:16 -0800 | [diff] [blame] | 518 | struct dmatest_done done = { .wait = &done_wait }; |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 519 | struct dmatest_info *info; |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 520 | struct dmatest_params *params; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 521 | struct dma_chan *chan; |
Akinobu Mita | 8be9e32b | 2012-10-28 00:49:32 +0900 | [diff] [blame] | 522 | struct dma_device *dev; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 523 | const char *thread_name; |
| 524 | unsigned int src_off, dst_off, len; |
| 525 | unsigned int error_count; |
| 526 | unsigned int failed_tests = 0; |
| 527 | unsigned int total_tests = 0; |
| 528 | dma_cookie_t cookie; |
| 529 | enum dma_status status; |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 530 | enum dma_ctrl_flags flags; |
Andy Shevchenko | 945b5af | 2013-03-04 11:09:26 +0200 | [diff] [blame] | 531 | u8 *pq_coefs = NULL; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 532 | int ret; |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 533 | int src_cnt; |
| 534 | int dst_cnt; |
| 535 | int i; |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 536 | struct dmatest_result *result; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 537 | |
| 538 | thread_name = current->comm; |
Tejun Heo | adfa543 | 2011-11-23 09:28:16 -0800 | [diff] [blame] | 539 | set_freezable(); |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 540 | |
| 541 | ret = -ENOMEM; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 542 | |
| 543 | smp_rmb(); |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 544 | info = thread->info; |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 545 | params = &info->params; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 546 | chan = thread->chan; |
Akinobu Mita | 8be9e32b | 2012-10-28 00:49:32 +0900 | [diff] [blame] | 547 | dev = chan->device; |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 548 | if (thread->type == DMA_MEMCPY) |
| 549 | src_cnt = dst_cnt = 1; |
| 550 | else if (thread->type == DMA_XOR) { |
Akinobu Mita | 8be9e32b | 2012-10-28 00:49:32 +0900 | [diff] [blame] | 551 | /* force odd to ensure dst = src */ |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 552 | src_cnt = min_odd(params->xor_sources | 1, dev->max_xor); |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 553 | dst_cnt = 1; |
Dan Williams | 58691d6 | 2009-08-29 19:09:27 -0700 | [diff] [blame] | 554 | } else if (thread->type == DMA_PQ) { |
Akinobu Mita | 8be9e32b | 2012-10-28 00:49:32 +0900 | [diff] [blame] | 555 | /* force odd to ensure dst = src */ |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 556 | src_cnt = min_odd(params->pq_sources | 1, dma_maxpq(dev, 0)); |
Dan Williams | 58691d6 | 2009-08-29 19:09:27 -0700 | [diff] [blame] | 557 | dst_cnt = 2; |
Andy Shevchenko | 945b5af | 2013-03-04 11:09:26 +0200 | [diff] [blame] | 558 | |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 559 | pq_coefs = kmalloc(params->pq_sources+1, GFP_KERNEL); |
Andy Shevchenko | 945b5af | 2013-03-04 11:09:26 +0200 | [diff] [blame] | 560 | if (!pq_coefs) |
| 561 | goto err_thread_type; |
| 562 | |
Anatolij Gustschin | 94de648 | 2010-02-15 22:35:23 +0100 | [diff] [blame] | 563 | for (i = 0; i < src_cnt; i++) |
Dan Williams | 58691d6 | 2009-08-29 19:09:27 -0700 | [diff] [blame] | 564 | pq_coefs[i] = 1; |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 565 | } else |
Andy Shevchenko | 945b5af | 2013-03-04 11:09:26 +0200 | [diff] [blame] | 566 | goto err_thread_type; |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 567 | |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 568 | result = result_init(info, thread_name); |
| 569 | if (!result) |
| 570 | goto err_srcs; |
| 571 | |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 572 | thread->srcs = kcalloc(src_cnt+1, sizeof(u8 *), GFP_KERNEL); |
| 573 | if (!thread->srcs) |
| 574 | goto err_srcs; |
| 575 | for (i = 0; i < src_cnt; i++) { |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 576 | thread->srcs[i] = kmalloc(params->buf_size, GFP_KERNEL); |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 577 | if (!thread->srcs[i]) |
| 578 | goto err_srcbuf; |
| 579 | } |
| 580 | thread->srcs[i] = NULL; |
| 581 | |
| 582 | thread->dsts = kcalloc(dst_cnt+1, sizeof(u8 *), GFP_KERNEL); |
| 583 | if (!thread->dsts) |
| 584 | goto err_dsts; |
| 585 | for (i = 0; i < dst_cnt; i++) { |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 586 | thread->dsts[i] = kmalloc(params->buf_size, GFP_KERNEL); |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 587 | if (!thread->dsts[i]) |
| 588 | goto err_dstbuf; |
| 589 | } |
| 590 | thread->dsts[i] = NULL; |
| 591 | |
Dan Williams | e44e0aa | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 592 | set_user_nice(current, 10); |
| 593 | |
Ira Snyder | b203bd3 | 2011-03-03 07:54:53 +0000 | [diff] [blame] | 594 | /* |
| 595 | * src buffers are freed by the DMAEngine code with dma_unmap_single() |
| 596 | * dst buffers are freed by ourselves below |
| 597 | */ |
| 598 | flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT |
| 599 | | DMA_COMPL_SKIP_DEST_UNMAP | DMA_COMPL_SRC_UNMAP_SINGLE; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 600 | |
Nicolas Ferre | 0a2ff57d | 2009-07-03 19:26:51 +0200 | [diff] [blame] | 601 | while (!kthread_should_stop() |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 602 | && !(params->iterations && total_tests >= params->iterations)) { |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 603 | struct dma_async_tx_descriptor *tx = NULL; |
| 604 | dma_addr_t dma_srcs[src_cnt]; |
| 605 | dma_addr_t dma_dsts[dst_cnt]; |
Dan Williams | 83544ae | 2009-09-08 17:42:53 -0700 | [diff] [blame] | 606 | u8 align = 0; |
Atsushi Nemoto | d86be86 | 2009-01-13 09:22:20 -0700 | [diff] [blame] | 607 | |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 608 | total_tests++; |
| 609 | |
Dan Williams | 83544ae | 2009-09-08 17:42:53 -0700 | [diff] [blame] | 610 | /* honor alignment restrictions */ |
| 611 | if (thread->type == DMA_MEMCPY) |
| 612 | align = dev->copy_align; |
| 613 | else if (thread->type == DMA_XOR) |
| 614 | align = dev->xor_align; |
| 615 | else if (thread->type == DMA_PQ) |
| 616 | align = dev->pq_align; |
| 617 | |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 618 | if (1 << align > params->buf_size) { |
Guennadi Liakhovetski | cfe4f27 | 2009-12-04 19:44:48 +0100 | [diff] [blame] | 619 | pr_err("%u-byte buffer too small for %d-byte alignment\n", |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 620 | params->buf_size, 1 << align); |
Guennadi Liakhovetski | cfe4f27 | 2009-12-04 19:44:48 +0100 | [diff] [blame] | 621 | break; |
| 622 | } |
| 623 | |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 624 | len = dmatest_random() % params->buf_size + 1; |
Dan Williams | 83544ae | 2009-09-08 17:42:53 -0700 | [diff] [blame] | 625 | len = (len >> align) << align; |
Guennadi Liakhovetski | cfe4f27 | 2009-12-04 19:44:48 +0100 | [diff] [blame] | 626 | if (!len) |
| 627 | len = 1 << align; |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 628 | src_off = dmatest_random() % (params->buf_size - len + 1); |
| 629 | dst_off = dmatest_random() % (params->buf_size - len + 1); |
Guennadi Liakhovetski | cfe4f27 | 2009-12-04 19:44:48 +0100 | [diff] [blame] | 630 | |
Dan Williams | 83544ae | 2009-09-08 17:42:53 -0700 | [diff] [blame] | 631 | src_off = (src_off >> align) << align; |
| 632 | dst_off = (dst_off >> align) << align; |
| 633 | |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 634 | dmatest_init_srcs(thread->srcs, src_off, len, params->buf_size); |
| 635 | dmatest_init_dsts(thread->dsts, dst_off, len, params->buf_size); |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 636 | |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 637 | for (i = 0; i < src_cnt; i++) { |
| 638 | u8 *buf = thread->srcs[i] + src_off; |
| 639 | |
| 640 | dma_srcs[i] = dma_map_single(dev->dev, buf, len, |
| 641 | DMA_TO_DEVICE); |
Andy Shevchenko | afde3be | 2012-12-17 15:59:53 -0800 | [diff] [blame] | 642 | ret = dma_mapping_error(dev->dev, dma_srcs[i]); |
| 643 | if (ret) { |
| 644 | unmap_src(dev->dev, dma_srcs, len, i); |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 645 | thread_result_add(info, result, |
| 646 | DMATEST_ET_MAP_SRC, |
| 647 | total_tests, src_off, dst_off, |
| 648 | len, ret); |
Andy Shevchenko | afde3be | 2012-12-17 15:59:53 -0800 | [diff] [blame] | 649 | failed_tests++; |
| 650 | continue; |
| 651 | } |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 652 | } |
Atsushi Nemoto | d86be86 | 2009-01-13 09:22:20 -0700 | [diff] [blame] | 653 | /* map with DMA_BIDIRECTIONAL to force writeback/invalidate */ |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 654 | for (i = 0; i < dst_cnt; i++) { |
| 655 | dma_dsts[i] = dma_map_single(dev->dev, thread->dsts[i], |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 656 | params->buf_size, |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 657 | DMA_BIDIRECTIONAL); |
Andy Shevchenko | afde3be | 2012-12-17 15:59:53 -0800 | [diff] [blame] | 658 | ret = dma_mapping_error(dev->dev, dma_dsts[i]); |
| 659 | if (ret) { |
| 660 | unmap_src(dev->dev, dma_srcs, len, src_cnt); |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 661 | unmap_dst(dev->dev, dma_dsts, params->buf_size, |
| 662 | i); |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 663 | thread_result_add(info, result, |
| 664 | DMATEST_ET_MAP_DST, |
| 665 | total_tests, src_off, dst_off, |
| 666 | len, ret); |
Andy Shevchenko | afde3be | 2012-12-17 15:59:53 -0800 | [diff] [blame] | 667 | failed_tests++; |
| 668 | continue; |
| 669 | } |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 670 | } |
Atsushi Nemoto | d86be86 | 2009-01-13 09:22:20 -0700 | [diff] [blame] | 671 | |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 672 | if (thread->type == DMA_MEMCPY) |
| 673 | tx = dev->device_prep_dma_memcpy(chan, |
| 674 | dma_dsts[0] + dst_off, |
| 675 | dma_srcs[0], len, |
| 676 | flags); |
| 677 | else if (thread->type == DMA_XOR) |
| 678 | tx = dev->device_prep_dma_xor(chan, |
| 679 | dma_dsts[0] + dst_off, |
Dan Williams | 67b9124 | 2010-02-28 22:20:18 -0700 | [diff] [blame] | 680 | dma_srcs, src_cnt, |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 681 | len, flags); |
Dan Williams | 58691d6 | 2009-08-29 19:09:27 -0700 | [diff] [blame] | 682 | else if (thread->type == DMA_PQ) { |
| 683 | dma_addr_t dma_pq[dst_cnt]; |
| 684 | |
| 685 | for (i = 0; i < dst_cnt; i++) |
| 686 | dma_pq[i] = dma_dsts[i] + dst_off; |
| 687 | tx = dev->device_prep_dma_pq(chan, dma_pq, dma_srcs, |
Anatolij Gustschin | 94de648 | 2010-02-15 22:35:23 +0100 | [diff] [blame] | 688 | src_cnt, pq_coefs, |
Dan Williams | 58691d6 | 2009-08-29 19:09:27 -0700 | [diff] [blame] | 689 | len, flags); |
| 690 | } |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 691 | |
Atsushi Nemoto | d86be86 | 2009-01-13 09:22:20 -0700 | [diff] [blame] | 692 | if (!tx) { |
Andy Shevchenko | 632fd28 | 2012-12-17 15:59:52 -0800 | [diff] [blame] | 693 | unmap_src(dev->dev, dma_srcs, len, src_cnt); |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 694 | unmap_dst(dev->dev, dma_dsts, params->buf_size, |
| 695 | dst_cnt); |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 696 | thread_result_add(info, result, DMATEST_ET_PREP, |
| 697 | total_tests, src_off, dst_off, |
| 698 | len, 0); |
Atsushi Nemoto | d86be86 | 2009-01-13 09:22:20 -0700 | [diff] [blame] | 699 | msleep(100); |
| 700 | failed_tests++; |
| 701 | continue; |
| 702 | } |
Dan Williams | e44e0aa | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 703 | |
Tejun Heo | adfa543 | 2011-11-23 09:28:16 -0800 | [diff] [blame] | 704 | done.done = false; |
Dan Williams | e44e0aa | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 705 | tx->callback = dmatest_callback; |
Tejun Heo | adfa543 | 2011-11-23 09:28:16 -0800 | [diff] [blame] | 706 | tx->callback_param = &done; |
Atsushi Nemoto | d86be86 | 2009-01-13 09:22:20 -0700 | [diff] [blame] | 707 | cookie = tx->tx_submit(tx); |
| 708 | |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 709 | if (dma_submit_error(cookie)) { |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 710 | thread_result_add(info, result, DMATEST_ET_SUBMIT, |
| 711 | total_tests, src_off, dst_off, |
| 712 | len, cookie); |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 713 | msleep(100); |
| 714 | failed_tests++; |
| 715 | continue; |
| 716 | } |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 717 | dma_async_issue_pending(chan); |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 718 | |
Andy Shevchenko | 77101ce | 2013-03-04 11:09:25 +0200 | [diff] [blame] | 719 | wait_event_freezable_timeout(done_wait, |
| 720 | done.done || kthread_should_stop(), |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 721 | msecs_to_jiffies(params->timeout)); |
Guennadi Liakhovetski | 981ed70 | 2011-08-18 16:50:51 +0200 | [diff] [blame] | 722 | |
Dan Williams | e44e0aa | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 723 | status = dma_async_is_tx_complete(chan, cookie, NULL, NULL); |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 724 | |
Tejun Heo | adfa543 | 2011-11-23 09:28:16 -0800 | [diff] [blame] | 725 | if (!done.done) { |
| 726 | /* |
| 727 | * We're leaving the timed out dma operation with |
| 728 | * dangling pointer to done_wait. To make this |
| 729 | * correct, we'll need to allocate wait_done for |
| 730 | * each test iteration and perform "who's gonna |
| 731 | * free it this time?" dancing. For now, just |
| 732 | * leave it dangling. |
| 733 | */ |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 734 | thread_result_add(info, result, DMATEST_ET_TIMEOUT, |
| 735 | total_tests, src_off, dst_off, |
| 736 | len, 0); |
Dan Williams | e44e0aa | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 737 | failed_tests++; |
| 738 | continue; |
| 739 | } else if (status != DMA_SUCCESS) { |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 740 | enum dmatest_error_type type = (status == DMA_ERROR) ? |
| 741 | DMATEST_ET_DMA_ERROR : DMATEST_ET_DMA_IN_PROGRESS; |
| 742 | thread_result_add(info, result, type, |
| 743 | total_tests, src_off, dst_off, |
| 744 | len, status); |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 745 | failed_tests++; |
| 746 | continue; |
| 747 | } |
Dan Williams | e44e0aa | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 748 | |
Atsushi Nemoto | d86be86 | 2009-01-13 09:22:20 -0700 | [diff] [blame] | 749 | /* Unmap by myself (see DMA_COMPL_SKIP_DEST_UNMAP above) */ |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 750 | unmap_dst(dev->dev, dma_dsts, params->buf_size, dst_cnt); |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 751 | |
| 752 | error_count = 0; |
| 753 | |
| 754 | pr_debug("%s: verifying source buffer...\n", thread_name); |
Andy Shevchenko | d86b2f2 | 2013-03-04 11:09:34 +0200 | [diff] [blame] | 755 | error_count += verify_result_add(info, result, total_tests, |
| 756 | src_off, dst_off, len, thread->srcs, -1, |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 757 | 0, PATTERN_SRC, true); |
Andy Shevchenko | d86b2f2 | 2013-03-04 11:09:34 +0200 | [diff] [blame] | 758 | error_count += verify_result_add(info, result, total_tests, |
| 759 | src_off, dst_off, len, thread->srcs, 0, |
| 760 | src_off, PATTERN_SRC | PATTERN_COPY, true); |
| 761 | error_count += verify_result_add(info, result, total_tests, |
| 762 | src_off, dst_off, len, thread->srcs, 1, |
| 763 | src_off + len, PATTERN_SRC, true); |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 764 | |
Andy Shevchenko | d86b2f2 | 2013-03-04 11:09:34 +0200 | [diff] [blame] | 765 | pr_debug("%s: verifying dest buffer...\n", thread_name); |
| 766 | error_count += verify_result_add(info, result, total_tests, |
| 767 | src_off, dst_off, len, thread->dsts, -1, |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 768 | 0, PATTERN_DST, false); |
Andy Shevchenko | d86b2f2 | 2013-03-04 11:09:34 +0200 | [diff] [blame] | 769 | error_count += verify_result_add(info, result, total_tests, |
| 770 | src_off, dst_off, len, thread->dsts, 0, |
| 771 | src_off, PATTERN_SRC | PATTERN_COPY, false); |
| 772 | error_count += verify_result_add(info, result, total_tests, |
| 773 | src_off, dst_off, len, thread->dsts, 1, |
| 774 | dst_off + len, PATTERN_DST, false); |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 775 | |
| 776 | if (error_count) { |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 777 | thread_result_add(info, result, DMATEST_ET_VERIFY, |
| 778 | total_tests, src_off, dst_off, |
| 779 | len, error_count); |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 780 | failed_tests++; |
| 781 | } else { |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 782 | thread_result_add(info, result, DMATEST_ET_OK, |
| 783 | total_tests, src_off, dst_off, |
| 784 | len, 0); |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 785 | } |
| 786 | } |
| 787 | |
| 788 | ret = 0; |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 789 | for (i = 0; thread->dsts[i]; i++) |
| 790 | kfree(thread->dsts[i]); |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 791 | err_dstbuf: |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 792 | kfree(thread->dsts); |
| 793 | err_dsts: |
| 794 | for (i = 0; thread->srcs[i]; i++) |
| 795 | kfree(thread->srcs[i]); |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 796 | err_srcbuf: |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 797 | kfree(thread->srcs); |
| 798 | err_srcs: |
Andy Shevchenko | 945b5af | 2013-03-04 11:09:26 +0200 | [diff] [blame] | 799 | kfree(pq_coefs); |
| 800 | err_thread_type: |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 801 | pr_notice("%s: terminating after %u tests, %u failures (status %d)\n", |
| 802 | thread_name, total_tests, failed_tests, ret); |
Nicolas Ferre | 0a2ff57d | 2009-07-03 19:26:51 +0200 | [diff] [blame] | 803 | |
Viresh Kumar | 9704efa | 2011-07-29 16:21:57 +0530 | [diff] [blame] | 804 | /* terminate all transfers on specified channels */ |
Shiraz Hashim | 5e034f7 | 2012-11-09 15:26:29 +0000 | [diff] [blame] | 805 | if (ret) |
| 806 | dmaengine_terminate_all(chan); |
| 807 | |
Andy Shevchenko | 3e5ccd8 | 2013-03-04 11:09:31 +0200 | [diff] [blame] | 808 | thread->done = true; |
| 809 | |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 810 | if (params->iterations > 0) |
Nicolas Ferre | 0a2ff57d | 2009-07-03 19:26:51 +0200 | [diff] [blame] | 811 | while (!kthread_should_stop()) { |
Yong Zhang | b953df7 | 2010-02-05 21:52:37 +0800 | [diff] [blame] | 812 | DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wait_dmatest_exit); |
Nicolas Ferre | 0a2ff57d | 2009-07-03 19:26:51 +0200 | [diff] [blame] | 813 | interruptible_sleep_on(&wait_dmatest_exit); |
| 814 | } |
| 815 | |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 816 | return ret; |
| 817 | } |
| 818 | |
| 819 | static void dmatest_cleanup_channel(struct dmatest_chan *dtc) |
| 820 | { |
| 821 | struct dmatest_thread *thread; |
| 822 | struct dmatest_thread *_thread; |
| 823 | int ret; |
| 824 | |
| 825 | list_for_each_entry_safe(thread, _thread, &dtc->threads, node) { |
| 826 | ret = kthread_stop(thread->task); |
| 827 | pr_debug("dmatest: thread %s exited with status %d\n", |
| 828 | thread->task->comm, ret); |
| 829 | list_del(&thread->node); |
| 830 | kfree(thread); |
| 831 | } |
Viresh Kumar | 9704efa | 2011-07-29 16:21:57 +0530 | [diff] [blame] | 832 | |
| 833 | /* terminate all transfers on specified channels */ |
Jon Mason | 944ea4d | 2012-11-11 23:03:20 +0000 | [diff] [blame] | 834 | dmaengine_terminate_all(dtc->chan); |
Viresh Kumar | 9704efa | 2011-07-29 16:21:57 +0530 | [diff] [blame] | 835 | |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 836 | kfree(dtc); |
| 837 | } |
| 838 | |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 839 | static int dmatest_add_threads(struct dmatest_info *info, |
| 840 | struct dmatest_chan *dtc, enum dma_transaction_type type) |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 841 | { |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 842 | struct dmatest_params *params = &info->params; |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 843 | struct dmatest_thread *thread; |
| 844 | struct dma_chan *chan = dtc->chan; |
| 845 | char *op; |
| 846 | unsigned int i; |
| 847 | |
| 848 | if (type == DMA_MEMCPY) |
| 849 | op = "copy"; |
| 850 | else if (type == DMA_XOR) |
| 851 | op = "xor"; |
Dan Williams | 58691d6 | 2009-08-29 19:09:27 -0700 | [diff] [blame] | 852 | else if (type == DMA_PQ) |
| 853 | op = "pq"; |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 854 | else |
| 855 | return -EINVAL; |
| 856 | |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 857 | for (i = 0; i < params->threads_per_chan; i++) { |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 858 | thread = kzalloc(sizeof(struct dmatest_thread), GFP_KERNEL); |
| 859 | if (!thread) { |
| 860 | pr_warning("dmatest: No memory for %s-%s%u\n", |
| 861 | dma_chan_name(chan), op, i); |
| 862 | |
| 863 | break; |
| 864 | } |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 865 | thread->info = info; |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 866 | thread->chan = dtc->chan; |
| 867 | thread->type = type; |
| 868 | smp_wmb(); |
| 869 | thread->task = kthread_run(dmatest_func, thread, "%s-%s%u", |
| 870 | dma_chan_name(chan), op, i); |
| 871 | if (IS_ERR(thread->task)) { |
| 872 | pr_warning("dmatest: Failed to run thread %s-%s%u\n", |
| 873 | dma_chan_name(chan), op, i); |
| 874 | kfree(thread); |
| 875 | break; |
| 876 | } |
| 877 | |
| 878 | /* srcbuf and dstbuf are allocated by the thread itself */ |
| 879 | |
| 880 | list_add_tail(&thread->node, &dtc->threads); |
| 881 | } |
| 882 | |
| 883 | return i; |
| 884 | } |
| 885 | |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 886 | static int dmatest_add_channel(struct dmatest_info *info, |
| 887 | struct dma_chan *chan) |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 888 | { |
| 889 | struct dmatest_chan *dtc; |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 890 | struct dma_device *dma_dev = chan->device; |
| 891 | unsigned int thread_count = 0; |
Kulikov Vasiliy | b9033e6 | 2010-07-17 19:19:48 +0400 | [diff] [blame] | 892 | int cnt; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 893 | |
Andrew Morton | 6fdb8bd | 2008-09-19 04:16:23 -0700 | [diff] [blame] | 894 | dtc = kmalloc(sizeof(struct dmatest_chan), GFP_KERNEL); |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 895 | if (!dtc) { |
Dan Williams | 41d5e59 | 2009-01-06 11:38:21 -0700 | [diff] [blame] | 896 | pr_warning("dmatest: No memory for %s\n", dma_chan_name(chan)); |
Dan Williams | 33df8ca | 2009-01-06 11:38:15 -0700 | [diff] [blame] | 897 | return -ENOMEM; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 898 | } |
| 899 | |
| 900 | dtc->chan = chan; |
| 901 | INIT_LIST_HEAD(&dtc->threads); |
| 902 | |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 903 | if (dma_has_cap(DMA_MEMCPY, dma_dev->cap_mask)) { |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 904 | cnt = dmatest_add_threads(info, dtc, DMA_MEMCPY); |
Nicolas Ferre | f1aef8b | 2009-07-06 18:19:44 +0200 | [diff] [blame] | 905 | thread_count += cnt > 0 ? cnt : 0; |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 906 | } |
| 907 | if (dma_has_cap(DMA_XOR, dma_dev->cap_mask)) { |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 908 | cnt = dmatest_add_threads(info, dtc, DMA_XOR); |
Nicolas Ferre | f1aef8b | 2009-07-06 18:19:44 +0200 | [diff] [blame] | 909 | thread_count += cnt > 0 ? cnt : 0; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 910 | } |
Dan Williams | 58691d6 | 2009-08-29 19:09:27 -0700 | [diff] [blame] | 911 | if (dma_has_cap(DMA_PQ, dma_dev->cap_mask)) { |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 912 | cnt = dmatest_add_threads(info, dtc, DMA_PQ); |
Dr. David Alan Gilbert | d07a74a | 2011-08-25 16:13:55 -0700 | [diff] [blame] | 913 | thread_count += cnt > 0 ? cnt : 0; |
Dan Williams | 58691d6 | 2009-08-29 19:09:27 -0700 | [diff] [blame] | 914 | } |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 915 | |
Dan Williams | b54d5cb | 2009-03-25 09:13:25 -0700 | [diff] [blame] | 916 | pr_info("dmatest: Started %u threads using %s\n", |
| 917 | thread_count, dma_chan_name(chan)); |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 918 | |
Andy Shevchenko | 838cc70 | 2013-03-04 11:09:28 +0200 | [diff] [blame] | 919 | list_add_tail(&dtc->node, &info->channels); |
| 920 | info->nr_channels++; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 921 | |
Dan Williams | 33df8ca | 2009-01-06 11:38:15 -0700 | [diff] [blame] | 922 | return 0; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 923 | } |
| 924 | |
Dan Williams | 7dd6025 | 2009-01-06 11:38:19 -0700 | [diff] [blame] | 925 | static bool filter(struct dma_chan *chan, void *param) |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 926 | { |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 927 | struct dmatest_params *params = param; |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 928 | |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 929 | if (!dmatest_match_channel(params, chan) || |
| 930 | !dmatest_match_device(params, chan->device)) |
Dan Williams | 7dd6025 | 2009-01-06 11:38:19 -0700 | [diff] [blame] | 931 | return false; |
Dan Williams | 33df8ca | 2009-01-06 11:38:15 -0700 | [diff] [blame] | 932 | else |
Dan Williams | 7dd6025 | 2009-01-06 11:38:19 -0700 | [diff] [blame] | 933 | return true; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 934 | } |
| 935 | |
Andy Shevchenko | 851b7e1 | 2013-03-04 11:09:30 +0200 | [diff] [blame] | 936 | static int __run_threaded_test(struct dmatest_info *info) |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 937 | { |
Dan Williams | 33df8ca | 2009-01-06 11:38:15 -0700 | [diff] [blame] | 938 | dma_cap_mask_t mask; |
| 939 | struct dma_chan *chan; |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 940 | struct dmatest_params *params = &info->params; |
Dan Williams | 33df8ca | 2009-01-06 11:38:15 -0700 | [diff] [blame] | 941 | int err = 0; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 942 | |
Dan Williams | 33df8ca | 2009-01-06 11:38:15 -0700 | [diff] [blame] | 943 | dma_cap_zero(mask); |
| 944 | dma_cap_set(DMA_MEMCPY, mask); |
| 945 | for (;;) { |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 946 | chan = dma_request_channel(mask, filter, params); |
Dan Williams | 33df8ca | 2009-01-06 11:38:15 -0700 | [diff] [blame] | 947 | if (chan) { |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 948 | err = dmatest_add_channel(info, chan); |
Dan Williams | c56c81a | 2009-04-08 15:08:23 -0700 | [diff] [blame] | 949 | if (err) { |
Dan Williams | 33df8ca | 2009-01-06 11:38:15 -0700 | [diff] [blame] | 950 | dma_release_channel(chan); |
| 951 | break; /* add_channel failed, punt */ |
| 952 | } |
| 953 | } else |
| 954 | break; /* no more channels available */ |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 955 | if (params->max_channels && |
| 956 | info->nr_channels >= params->max_channels) |
Dan Williams | 33df8ca | 2009-01-06 11:38:15 -0700 | [diff] [blame] | 957 | break; /* we have all we need */ |
| 958 | } |
Dan Williams | 33df8ca | 2009-01-06 11:38:15 -0700 | [diff] [blame] | 959 | return err; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 960 | } |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 961 | |
Andy Shevchenko | 851b7e1 | 2013-03-04 11:09:30 +0200 | [diff] [blame] | 962 | #ifndef MODULE |
| 963 | static int run_threaded_test(struct dmatest_info *info) |
| 964 | { |
| 965 | int ret; |
| 966 | |
| 967 | mutex_lock(&info->lock); |
| 968 | ret = __run_threaded_test(info); |
| 969 | mutex_unlock(&info->lock); |
| 970 | return ret; |
| 971 | } |
| 972 | #endif |
| 973 | |
| 974 | static void __stop_threaded_test(struct dmatest_info *info) |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 975 | { |
Dan Williams | 33df8ca | 2009-01-06 11:38:15 -0700 | [diff] [blame] | 976 | struct dmatest_chan *dtc, *_dtc; |
Dan Williams | 7cbd487 | 2009-03-04 16:06:03 -0700 | [diff] [blame] | 977 | struct dma_chan *chan; |
Dan Williams | 33df8ca | 2009-01-06 11:38:15 -0700 | [diff] [blame] | 978 | |
Andy Shevchenko | 838cc70 | 2013-03-04 11:09:28 +0200 | [diff] [blame] | 979 | list_for_each_entry_safe(dtc, _dtc, &info->channels, node) { |
Dan Williams | 33df8ca | 2009-01-06 11:38:15 -0700 | [diff] [blame] | 980 | list_del(&dtc->node); |
Dan Williams | 7cbd487 | 2009-03-04 16:06:03 -0700 | [diff] [blame] | 981 | chan = dtc->chan; |
Dan Williams | 33df8ca | 2009-01-06 11:38:15 -0700 | [diff] [blame] | 982 | dmatest_cleanup_channel(dtc); |
Andy Shevchenko | 838cc70 | 2013-03-04 11:09:28 +0200 | [diff] [blame] | 983 | pr_debug("dmatest: dropped channel %s\n", dma_chan_name(chan)); |
Dan Williams | 7cbd487 | 2009-03-04 16:06:03 -0700 | [diff] [blame] | 984 | dma_release_channel(chan); |
Dan Williams | 33df8ca | 2009-01-06 11:38:15 -0700 | [diff] [blame] | 985 | } |
Andy Shevchenko | 838cc70 | 2013-03-04 11:09:28 +0200 | [diff] [blame] | 986 | |
| 987 | info->nr_channels = 0; |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 988 | } |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 989 | |
Andy Shevchenko | 851b7e1 | 2013-03-04 11:09:30 +0200 | [diff] [blame] | 990 | static void stop_threaded_test(struct dmatest_info *info) |
| 991 | { |
| 992 | mutex_lock(&info->lock); |
| 993 | __stop_threaded_test(info); |
| 994 | mutex_unlock(&info->lock); |
| 995 | } |
| 996 | |
| 997 | static int __restart_threaded_test(struct dmatest_info *info, bool run) |
| 998 | { |
| 999 | struct dmatest_params *params = &info->params; |
| 1000 | int ret; |
| 1001 | |
| 1002 | /* Stop any running test first */ |
| 1003 | __stop_threaded_test(info); |
| 1004 | |
| 1005 | if (run == false) |
| 1006 | return 0; |
| 1007 | |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 1008 | /* Clear results from previous run */ |
| 1009 | result_free(info, NULL); |
| 1010 | |
Andy Shevchenko | 851b7e1 | 2013-03-04 11:09:30 +0200 | [diff] [blame] | 1011 | /* Copy test parameters */ |
| 1012 | memcpy(params, &info->dbgfs_params, sizeof(*params)); |
| 1013 | |
| 1014 | /* Run test with new parameters */ |
| 1015 | ret = __run_threaded_test(info); |
| 1016 | if (ret) { |
| 1017 | __stop_threaded_test(info); |
| 1018 | pr_err("dmatest: Can't run test\n"); |
| 1019 | } |
| 1020 | |
| 1021 | return ret; |
| 1022 | } |
| 1023 | |
| 1024 | static ssize_t dtf_write_string(void *to, size_t available, loff_t *ppos, |
| 1025 | const void __user *from, size_t count) |
| 1026 | { |
| 1027 | char tmp[20]; |
| 1028 | ssize_t len; |
| 1029 | |
| 1030 | len = simple_write_to_buffer(tmp, sizeof(tmp) - 1, ppos, from, count); |
| 1031 | if (len >= 0) { |
| 1032 | tmp[len] = '\0'; |
| 1033 | strlcpy(to, strim(tmp), available); |
| 1034 | } |
| 1035 | |
| 1036 | return len; |
| 1037 | } |
| 1038 | |
| 1039 | static ssize_t dtf_read_channel(struct file *file, char __user *buf, |
| 1040 | size_t count, loff_t *ppos) |
| 1041 | { |
| 1042 | struct dmatest_info *info = file->private_data; |
| 1043 | return simple_read_from_buffer(buf, count, ppos, |
| 1044 | info->dbgfs_params.channel, |
| 1045 | strlen(info->dbgfs_params.channel)); |
| 1046 | } |
| 1047 | |
| 1048 | static ssize_t dtf_write_channel(struct file *file, const char __user *buf, |
| 1049 | size_t size, loff_t *ppos) |
| 1050 | { |
| 1051 | struct dmatest_info *info = file->private_data; |
| 1052 | return dtf_write_string(info->dbgfs_params.channel, |
| 1053 | sizeof(info->dbgfs_params.channel), |
| 1054 | ppos, buf, size); |
| 1055 | } |
| 1056 | |
| 1057 | static const struct file_operations dtf_channel_fops = { |
| 1058 | .read = dtf_read_channel, |
| 1059 | .write = dtf_write_channel, |
| 1060 | .open = simple_open, |
| 1061 | .llseek = default_llseek, |
| 1062 | }; |
| 1063 | |
| 1064 | static ssize_t dtf_read_device(struct file *file, char __user *buf, |
| 1065 | size_t count, loff_t *ppos) |
| 1066 | { |
| 1067 | struct dmatest_info *info = file->private_data; |
| 1068 | return simple_read_from_buffer(buf, count, ppos, |
| 1069 | info->dbgfs_params.device, |
| 1070 | strlen(info->dbgfs_params.device)); |
| 1071 | } |
| 1072 | |
| 1073 | static ssize_t dtf_write_device(struct file *file, const char __user *buf, |
| 1074 | size_t size, loff_t *ppos) |
| 1075 | { |
| 1076 | struct dmatest_info *info = file->private_data; |
| 1077 | return dtf_write_string(info->dbgfs_params.device, |
| 1078 | sizeof(info->dbgfs_params.device), |
| 1079 | ppos, buf, size); |
| 1080 | } |
| 1081 | |
| 1082 | static const struct file_operations dtf_device_fops = { |
| 1083 | .read = dtf_read_device, |
| 1084 | .write = dtf_write_device, |
| 1085 | .open = simple_open, |
| 1086 | .llseek = default_llseek, |
| 1087 | }; |
| 1088 | |
| 1089 | static ssize_t dtf_read_run(struct file *file, char __user *user_buf, |
| 1090 | size_t count, loff_t *ppos) |
| 1091 | { |
| 1092 | struct dmatest_info *info = file->private_data; |
| 1093 | char buf[3]; |
Andy Shevchenko | 3e5ccd8 | 2013-03-04 11:09:31 +0200 | [diff] [blame] | 1094 | struct dmatest_chan *dtc; |
| 1095 | bool alive = false; |
Andy Shevchenko | 851b7e1 | 2013-03-04 11:09:30 +0200 | [diff] [blame] | 1096 | |
| 1097 | mutex_lock(&info->lock); |
Andy Shevchenko | 3e5ccd8 | 2013-03-04 11:09:31 +0200 | [diff] [blame] | 1098 | list_for_each_entry(dtc, &info->channels, node) { |
| 1099 | struct dmatest_thread *thread; |
| 1100 | |
| 1101 | list_for_each_entry(thread, &dtc->threads, node) { |
| 1102 | if (!thread->done) { |
| 1103 | alive = true; |
| 1104 | break; |
| 1105 | } |
| 1106 | } |
| 1107 | } |
| 1108 | |
| 1109 | if (alive) { |
Andy Shevchenko | 851b7e1 | 2013-03-04 11:09:30 +0200 | [diff] [blame] | 1110 | buf[0] = 'Y'; |
Andy Shevchenko | 3e5ccd8 | 2013-03-04 11:09:31 +0200 | [diff] [blame] | 1111 | } else { |
| 1112 | __stop_threaded_test(info); |
Andy Shevchenko | 851b7e1 | 2013-03-04 11:09:30 +0200 | [diff] [blame] | 1113 | buf[0] = 'N'; |
Andy Shevchenko | 3e5ccd8 | 2013-03-04 11:09:31 +0200 | [diff] [blame] | 1114 | } |
| 1115 | |
Andy Shevchenko | 851b7e1 | 2013-03-04 11:09:30 +0200 | [diff] [blame] | 1116 | mutex_unlock(&info->lock); |
| 1117 | buf[1] = '\n'; |
| 1118 | buf[2] = 0x00; |
| 1119 | return simple_read_from_buffer(user_buf, count, ppos, buf, 2); |
| 1120 | } |
| 1121 | |
| 1122 | static ssize_t dtf_write_run(struct file *file, const char __user *user_buf, |
| 1123 | size_t count, loff_t *ppos) |
| 1124 | { |
| 1125 | struct dmatest_info *info = file->private_data; |
| 1126 | char buf[16]; |
| 1127 | bool bv; |
| 1128 | int ret = 0; |
| 1129 | |
| 1130 | if (copy_from_user(buf, user_buf, min(count, (sizeof(buf) - 1)))) |
| 1131 | return -EFAULT; |
| 1132 | |
| 1133 | if (strtobool(buf, &bv) == 0) { |
| 1134 | mutex_lock(&info->lock); |
| 1135 | ret = __restart_threaded_test(info, bv); |
| 1136 | mutex_unlock(&info->lock); |
| 1137 | } |
| 1138 | |
| 1139 | return ret ? ret : count; |
| 1140 | } |
| 1141 | |
| 1142 | static const struct file_operations dtf_run_fops = { |
| 1143 | .read = dtf_read_run, |
| 1144 | .write = dtf_write_run, |
| 1145 | .open = simple_open, |
| 1146 | .llseek = default_llseek, |
| 1147 | }; |
| 1148 | |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 1149 | static int dtf_results_show(struct seq_file *sf, void *data) |
| 1150 | { |
| 1151 | struct dmatest_info *info = sf->private; |
| 1152 | struct dmatest_result *result; |
| 1153 | struct dmatest_thread_result *tr; |
Andy Shevchenko | d86b2f2 | 2013-03-04 11:09:34 +0200 | [diff] [blame] | 1154 | unsigned int i; |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 1155 | |
| 1156 | mutex_lock(&info->results_lock); |
| 1157 | list_for_each_entry(result, &info->results, node) { |
Andy Shevchenko | d86b2f2 | 2013-03-04 11:09:34 +0200 | [diff] [blame] | 1158 | list_for_each_entry(tr, &result->results, node) { |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 1159 | seq_printf(sf, "%s\n", |
| 1160 | thread_result_get(result->name, tr)); |
Andy Shevchenko | d86b2f2 | 2013-03-04 11:09:34 +0200 | [diff] [blame] | 1161 | if (tr->type == DMATEST_ET_VERIFY_BUF) { |
| 1162 | for (i = 0; i < tr->vr->error_count; i++) { |
| 1163 | seq_printf(sf, "\t%s\n", |
| 1164 | verify_result_get_one(tr->vr, i)); |
| 1165 | } |
| 1166 | } |
| 1167 | } |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 1168 | } |
| 1169 | |
| 1170 | mutex_unlock(&info->results_lock); |
| 1171 | return 0; |
| 1172 | } |
| 1173 | |
| 1174 | static int dtf_results_open(struct inode *inode, struct file *file) |
| 1175 | { |
| 1176 | return single_open(file, dtf_results_show, inode->i_private); |
| 1177 | } |
| 1178 | |
| 1179 | static const struct file_operations dtf_results_fops = { |
| 1180 | .open = dtf_results_open, |
| 1181 | .read = seq_read, |
| 1182 | .llseek = seq_lseek, |
| 1183 | .release = single_release, |
| 1184 | }; |
| 1185 | |
Andy Shevchenko | 851b7e1 | 2013-03-04 11:09:30 +0200 | [diff] [blame] | 1186 | static int dmatest_register_dbgfs(struct dmatest_info *info) |
| 1187 | { |
| 1188 | struct dentry *d; |
| 1189 | struct dmatest_params *params = &info->dbgfs_params; |
| 1190 | int ret = -ENOMEM; |
| 1191 | |
| 1192 | d = debugfs_create_dir("dmatest", NULL); |
| 1193 | if (IS_ERR(d)) |
| 1194 | return PTR_ERR(d); |
| 1195 | if (!d) |
| 1196 | goto err_root; |
| 1197 | |
| 1198 | info->root = d; |
| 1199 | |
| 1200 | /* Copy initial values */ |
| 1201 | memcpy(params, &info->params, sizeof(*params)); |
| 1202 | |
| 1203 | /* Test parameters */ |
| 1204 | |
| 1205 | d = debugfs_create_u32("test_buf_size", S_IWUSR | S_IRUGO, info->root, |
| 1206 | (u32 *)¶ms->buf_size); |
| 1207 | if (IS_ERR_OR_NULL(d)) |
| 1208 | goto err_node; |
| 1209 | |
| 1210 | d = debugfs_create_file("channel", S_IRUGO | S_IWUSR, info->root, |
| 1211 | info, &dtf_channel_fops); |
| 1212 | if (IS_ERR_OR_NULL(d)) |
| 1213 | goto err_node; |
| 1214 | |
| 1215 | d = debugfs_create_file("device", S_IRUGO | S_IWUSR, info->root, |
| 1216 | info, &dtf_device_fops); |
| 1217 | if (IS_ERR_OR_NULL(d)) |
| 1218 | goto err_node; |
| 1219 | |
| 1220 | d = debugfs_create_u32("threads_per_chan", S_IWUSR | S_IRUGO, info->root, |
| 1221 | (u32 *)¶ms->threads_per_chan); |
| 1222 | if (IS_ERR_OR_NULL(d)) |
| 1223 | goto err_node; |
| 1224 | |
| 1225 | d = debugfs_create_u32("max_channels", S_IWUSR | S_IRUGO, info->root, |
| 1226 | (u32 *)¶ms->max_channels); |
| 1227 | if (IS_ERR_OR_NULL(d)) |
| 1228 | goto err_node; |
| 1229 | |
| 1230 | d = debugfs_create_u32("iterations", S_IWUSR | S_IRUGO, info->root, |
| 1231 | (u32 *)¶ms->iterations); |
| 1232 | if (IS_ERR_OR_NULL(d)) |
| 1233 | goto err_node; |
| 1234 | |
| 1235 | d = debugfs_create_u32("xor_sources", S_IWUSR | S_IRUGO, info->root, |
| 1236 | (u32 *)¶ms->xor_sources); |
| 1237 | if (IS_ERR_OR_NULL(d)) |
| 1238 | goto err_node; |
| 1239 | |
| 1240 | d = debugfs_create_u32("pq_sources", S_IWUSR | S_IRUGO, info->root, |
| 1241 | (u32 *)¶ms->pq_sources); |
| 1242 | if (IS_ERR_OR_NULL(d)) |
| 1243 | goto err_node; |
| 1244 | |
| 1245 | d = debugfs_create_u32("timeout", S_IWUSR | S_IRUGO, info->root, |
| 1246 | (u32 *)¶ms->timeout); |
| 1247 | if (IS_ERR_OR_NULL(d)) |
| 1248 | goto err_node; |
| 1249 | |
| 1250 | /* Run or stop threaded test */ |
| 1251 | d = debugfs_create_file("run", S_IWUSR | S_IRUGO, info->root, |
| 1252 | info, &dtf_run_fops); |
| 1253 | if (IS_ERR_OR_NULL(d)) |
| 1254 | goto err_node; |
| 1255 | |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 1256 | /* Results of test in progress */ |
| 1257 | d = debugfs_create_file("results", S_IRUGO, info->root, info, |
| 1258 | &dtf_results_fops); |
| 1259 | if (IS_ERR_OR_NULL(d)) |
| 1260 | goto err_node; |
| 1261 | |
Andy Shevchenko | 851b7e1 | 2013-03-04 11:09:30 +0200 | [diff] [blame] | 1262 | return 0; |
| 1263 | |
| 1264 | err_node: |
| 1265 | debugfs_remove_recursive(info->root); |
| 1266 | err_root: |
| 1267 | pr_err("dmatest: Failed to initialize debugfs\n"); |
| 1268 | return ret; |
| 1269 | } |
| 1270 | |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 1271 | static int __init dmatest_init(void) |
| 1272 | { |
| 1273 | struct dmatest_info *info = &test_info; |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 1274 | struct dmatest_params *params = &info->params; |
Andy Shevchenko | 851b7e1 | 2013-03-04 11:09:30 +0200 | [diff] [blame] | 1275 | int ret; |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 1276 | |
| 1277 | memset(info, 0, sizeof(*info)); |
| 1278 | |
Andy Shevchenko | 851b7e1 | 2013-03-04 11:09:30 +0200 | [diff] [blame] | 1279 | mutex_init(&info->lock); |
Andy Shevchenko | 838cc70 | 2013-03-04 11:09:28 +0200 | [diff] [blame] | 1280 | INIT_LIST_HEAD(&info->channels); |
| 1281 | |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 1282 | mutex_init(&info->results_lock); |
| 1283 | INIT_LIST_HEAD(&info->results); |
| 1284 | |
Andy Shevchenko | 838cc70 | 2013-03-04 11:09:28 +0200 | [diff] [blame] | 1285 | /* Set default parameters */ |
Andy Shevchenko | 15b8a8e | 2013-03-04 11:09:29 +0200 | [diff] [blame] | 1286 | params->buf_size = test_buf_size; |
| 1287 | strlcpy(params->channel, test_channel, sizeof(params->channel)); |
| 1288 | strlcpy(params->device, test_device, sizeof(params->device)); |
| 1289 | params->threads_per_chan = threads_per_chan; |
| 1290 | params->max_channels = max_channels; |
| 1291 | params->iterations = iterations; |
| 1292 | params->xor_sources = xor_sources; |
| 1293 | params->pq_sources = pq_sources; |
| 1294 | params->timeout = timeout; |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 1295 | |
Andy Shevchenko | 851b7e1 | 2013-03-04 11:09:30 +0200 | [diff] [blame] | 1296 | ret = dmatest_register_dbgfs(info); |
| 1297 | if (ret) |
| 1298 | return ret; |
| 1299 | |
| 1300 | #ifdef MODULE |
| 1301 | return 0; |
| 1302 | #else |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 1303 | return run_threaded_test(info); |
Andy Shevchenko | 851b7e1 | 2013-03-04 11:09:30 +0200 | [diff] [blame] | 1304 | #endif |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 1305 | } |
| 1306 | /* when compiled-in wait for drivers to load first */ |
| 1307 | late_initcall(dmatest_init); |
| 1308 | |
| 1309 | static void __exit dmatest_exit(void) |
| 1310 | { |
| 1311 | struct dmatest_info *info = &test_info; |
| 1312 | |
Andy Shevchenko | 851b7e1 | 2013-03-04 11:09:30 +0200 | [diff] [blame] | 1313 | debugfs_remove_recursive(info->root); |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 1314 | stop_threaded_test(info); |
Andy Shevchenko | 95019c8 | 2013-03-04 11:09:33 +0200 | [diff] [blame] | 1315 | result_free(info, NULL); |
Andy Shevchenko | e03e93a | 2013-03-04 11:09:27 +0200 | [diff] [blame] | 1316 | } |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 1317 | module_exit(dmatest_exit); |
| 1318 | |
Jean Delvare | e05503e | 2011-05-18 16:49:24 +0200 | [diff] [blame] | 1319 | MODULE_AUTHOR("Haavard Skinnemoen (Atmel)"); |
Haavard Skinnemoen | 4a776f0 | 2008-07-08 11:58:45 -0700 | [diff] [blame] | 1320 | MODULE_LICENSE("GPL v2"); |