Lines Matching full:map

38 	struct map_benchmark_data *map = data;  in map_benchmark_thread()  local
39 int npages = map->bparam.granule; in map_benchmark_thread()
58 if (map->dir != DMA_FROM_DEVICE) in map_benchmark_thread()
62 dma_addr = dma_map_single(map->dev, buf, size, map->dir); in map_benchmark_thread()
63 if (unlikely(dma_mapping_error(map->dev, dma_addr))) { in map_benchmark_thread()
65 dev_name(map->dev)); in map_benchmark_thread()
73 ndelay(map->bparam.dma_trans_ns); in map_benchmark_thread()
76 dma_unmap_single(map->dev, dma_addr, size, map->dir); in map_benchmark_thread()
87 atomic64_add(map_100ns, &map->sum_map_100ns); in map_benchmark_thread()
88 atomic64_add(unmap_100ns, &map->sum_unmap_100ns); in map_benchmark_thread()
89 atomic64_add(map_sq, &map->sum_sq_map); in map_benchmark_thread()
90 atomic64_add(unmap_sq, &map->sum_sq_unmap); in map_benchmark_thread()
91 atomic64_inc(&map->loops); in map_benchmark_thread()
115 static int do_map_benchmark(struct map_benchmark_data *map) in do_map_benchmark() argument
118 int threads = map->bparam.threads; in do_map_benchmark()
119 int node = map->bparam.node; in do_map_benchmark()
128 get_device(map->dev); in do_map_benchmark()
131 tsk[i] = kthread_create_on_node(map_benchmark_thread, map, in do_map_benchmark()
132 map->bparam.node, "dma-map-benchmark/%d", i); in do_map_benchmark()
146 atomic64_set(&map->sum_map_100ns, 0); in do_map_benchmark()
147 atomic64_set(&map->sum_unmap_100ns, 0); in do_map_benchmark()
148 atomic64_set(&map->sum_sq_map, 0); in do_map_benchmark()
149 atomic64_set(&map->sum_sq_unmap, 0); in do_map_benchmark()
150 atomic64_set(&map->loops, 0); in do_map_benchmark()
157 msleep_interruptible(map->bparam.seconds * 1000); in do_map_benchmark()
170 loops = atomic64_read(&map->loops); in do_map_benchmark()
173 u64 sum_map = atomic64_read(&map->sum_map_100ns); in do_map_benchmark()
174 u64 sum_unmap = atomic64_read(&map->sum_unmap_100ns); in do_map_benchmark()
175 u64 sum_sq_map = atomic64_read(&map->sum_sq_map); in do_map_benchmark()
176 u64 sum_sq_unmap = atomic64_read(&map->sum_sq_unmap); in do_map_benchmark()
179 map->bparam.avg_map_100ns = div64_u64(sum_map, loops); in do_map_benchmark()
180 map->bparam.avg_unmap_100ns = div64_u64(sum_unmap, loops); in do_map_benchmark()
184 map->bparam.avg_map_100ns * in do_map_benchmark()
185 map->bparam.avg_map_100ns; in do_map_benchmark()
187 map->bparam.avg_unmap_100ns * in do_map_benchmark()
188 map->bparam.avg_unmap_100ns; in do_map_benchmark()
189 map->bparam.map_stddev = int_sqrt64(map_variance); in do_map_benchmark()
190 map->bparam.unmap_stddev = int_sqrt64(unmap_variance); in do_map_benchmark()
194 put_device(map->dev); in do_map_benchmark()
202 struct map_benchmark_data *map = file->private_data; in map_benchmark_ioctl() local
207 if (copy_from_user(&map->bparam, argp, sizeof(map->bparam))) in map_benchmark_ioctl()
212 if (map->bparam.threads == 0 || in map_benchmark_ioctl()
213 map->bparam.threads > DMA_MAP_MAX_THREADS) { in map_benchmark_ioctl()
218 if (map->bparam.seconds == 0 || in map_benchmark_ioctl()
219 map->bparam.seconds > DMA_MAP_MAX_SECONDS) { in map_benchmark_ioctl()
224 if (map->bparam.dma_trans_ns > DMA_MAP_MAX_TRANS_DELAY) { in map_benchmark_ioctl()
229 if (map->bparam.node != NUMA_NO_NODE && in map_benchmark_ioctl()
230 (map->bparam.node < 0 || map->bparam.node >= MAX_NUMNODES || in map_benchmark_ioctl()
231 !node_possible(map->bparam.node))) { in map_benchmark_ioctl()
236 if (map->bparam.granule < 1 || map->bparam.granule > 1024) { in map_benchmark_ioctl()
241 switch (map->bparam.dma_dir) { in map_benchmark_ioctl()
243 map->dir = DMA_BIDIRECTIONAL; in map_benchmark_ioctl()
246 map->dir = DMA_FROM_DEVICE; in map_benchmark_ioctl()
249 map->dir = DMA_TO_DEVICE; in map_benchmark_ioctl()
256 old_dma_mask = dma_get_mask(map->dev); in map_benchmark_ioctl()
258 ret = dma_set_mask(map->dev, in map_benchmark_ioctl()
259 DMA_BIT_MASK(map->bparam.dma_bits)); in map_benchmark_ioctl()
262 dev_name(map->dev)); in map_benchmark_ioctl()
266 ret = do_map_benchmark(map); in map_benchmark_ioctl()
274 dma_set_mask(map->dev, old_dma_mask); in map_benchmark_ioctl()
283 if (copy_to_user(argp, &map->bparam, sizeof(map->bparam))) in map_benchmark_ioctl()
296 struct map_benchmark_data *map = (struct map_benchmark_data *)data; in map_benchmark_remove_debugfs() local
298 debugfs_remove(map->debugfs); in map_benchmark_remove_debugfs()
304 struct map_benchmark_data *map; in __map_benchmark_probe() local
307 map = devm_kzalloc(dev, sizeof(*map), GFP_KERNEL); in __map_benchmark_probe()
308 if (!map) in __map_benchmark_probe()
310 map->dev = dev; in __map_benchmark_probe()
312 ret = devm_add_action(dev, map_benchmark_remove_debugfs, map); in __map_benchmark_probe()
322 entry = debugfs_create_file("dma_map_benchmark", 0600, NULL, map, in __map_benchmark_probe()
326 map->debugfs = entry; in __map_benchmark_probe()