]>
Commit | Line | Data |
---|---|---|
bcabbcca OBC |
1 | /* |
2 | * Virtio-based remote processor messaging bus | |
3 | * | |
4 | * Copyright (C) 2011 Texas Instruments, Inc. | |
5 | * Copyright (C) 2011 Google, Inc. | |
6 | * | |
7 | * Ohad Ben-Cohen <[email protected]> | |
8 | * Brian Swetland <[email protected]> | |
9 | * | |
10 | * This software is licensed under the terms of the GNU General Public | |
11 | * License version 2, as published by the Free Software Foundation, and | |
12 | * may be copied, distributed, and modified under those terms. | |
13 | * | |
14 | * This program is distributed in the hope that it will be useful, | |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | * GNU General Public License for more details. | |
18 | */ | |
19 | ||
20 | #define pr_fmt(fmt) "%s: " fmt, __func__ | |
21 | ||
22 | #include <linux/kernel.h> | |
23 | #include <linux/module.h> | |
24 | #include <linux/virtio.h> | |
25 | #include <linux/virtio_ids.h> | |
26 | #include <linux/virtio_config.h> | |
27 | #include <linux/scatterlist.h> | |
28 | #include <linux/dma-mapping.h> | |
29 | #include <linux/slab.h> | |
30 | #include <linux/idr.h> | |
31 | #include <linux/jiffies.h> | |
32 | #include <linux/sched.h> | |
33 | #include <linux/wait.h> | |
34 | #include <linux/rpmsg.h> | |
35 | #include <linux/mutex.h> | |
a16644cb | 36 | #include <linux/of_device.h> |
bcabbcca | 37 | |
8b881c07 BA |
38 | #include "rpmsg_internal.h" |
39 | ||
bcabbcca OBC |
40 | /** |
41 | * struct virtproc_info - virtual remote processor state | |
42 | * @vdev: the virtio device | |
43 | * @rvq: rx virtqueue | |
44 | * @svq: tx virtqueue | |
45 | * @rbufs: kernel address of rx buffers | |
46 | * @sbufs: kernel address of tx buffers | |
b1b98914 | 47 | * @num_bufs: total number of buffers for rx and tx |
bcabbcca OBC |
48 | * @last_sbuf: index of last tx buffer used |
49 | * @bufs_dma: dma base addr of the buffers | |
50 | * @tx_lock: protects svq, sbufs and sleepers, to allow concurrent senders. | |
51 | * sending a message might require waking up a dozing remote | |
52 | * processor, which involves sleeping, hence the mutex. | |
53 | * @endpoints: idr of local endpoints, allows fast retrieval | |
54 | * @endpoints_lock: lock of the endpoints set | |
55 | * @sendq: wait queue of sending contexts waiting for a tx buffers | |
56 | * @sleepers: number of senders that are waiting for a tx buffer | |
57 | * @ns_ept: the bus's name service endpoint | |
58 | * | |
59 | * This structure stores the rpmsg state of a given virtio remote processor | |
60 | * device (there might be several virtio proc devices for each physical | |
61 | * remote processor). | |
62 | */ | |
63 | struct virtproc_info { | |
64 | struct virtio_device *vdev; | |
65 | struct virtqueue *rvq, *svq; | |
66 | void *rbufs, *sbufs; | |
b1b98914 | 67 | unsigned int num_bufs; |
bcabbcca OBC |
68 | int last_sbuf; |
69 | dma_addr_t bufs_dma; | |
70 | struct mutex tx_lock; | |
71 | struct idr endpoints; | |
72 | struct mutex endpoints_lock; | |
73 | wait_queue_head_t sendq; | |
74 | atomic_t sleepers; | |
75 | struct rpmsg_endpoint *ns_ept; | |
76 | }; | |
77 | ||
3bf950ff BA |
78 | /** |
79 | * @vrp: the remote processor this channel belongs to | |
80 | */ | |
81 | struct virtio_rpmsg_channel { | |
82 | struct rpmsg_device rpdev; | |
83 | ||
84 | struct virtproc_info *vrp; | |
85 | }; | |
86 | ||
87 | #define to_virtio_rpmsg_channel(_rpdev) \ | |
88 | container_of(_rpdev, struct virtio_rpmsg_channel, rpdev) | |
89 | ||
bcabbcca | 90 | /* |
b1b98914 SA |
91 | * We're allocating buffers of 512 bytes each for communications. The |
92 | * number of buffers will be computed from the number of buffers supported | |
93 | * by the vring, upto a maximum of 512 buffers (256 in each direction). | |
bcabbcca OBC |
94 | * |
95 | * Each buffer will have 16 bytes for the msg header and 496 bytes for | |
96 | * the payload. | |
97 | * | |
b1b98914 | 98 | * This will utilize a maximum total space of 256KB for the buffers. |
bcabbcca OBC |
99 | * |
100 | * We might also want to add support for user-provided buffers in time. | |
101 | * This will allow bigger buffer size flexibility, and can also be used | |
102 | * to achieve zero-copy messaging. | |
103 | * | |
104 | * Note that these numbers are purely a decision of this driver - we | |
105 | * can change this without changing anything in the firmware of the remote | |
106 | * processor. | |
107 | */ | |
b1b98914 | 108 | #define MAX_RPMSG_NUM_BUFS (512) |
bcabbcca | 109 | #define RPMSG_BUF_SIZE (512) |
bcabbcca OBC |
110 | |
111 | /* | |
112 | * Local addresses are dynamically allocated on-demand. | |
113 | * We do not dynamically assign addresses from the low 1024 range, | |
114 | * in order to reserve that address range for predefined services. | |
115 | */ | |
116 | #define RPMSG_RESERVED_ADDRESSES (1024) | |
117 | ||
118 | /* Address 53 is reserved for advertising remote services */ | |
119 | #define RPMSG_NS_ADDR (53) | |
120 | ||
8a228ecf BA |
121 | static void virtio_rpmsg_destroy_ept(struct rpmsg_endpoint *ept); |
122 | static int virtio_rpmsg_send(struct rpmsg_endpoint *ept, void *data, int len); | |
123 | static int virtio_rpmsg_sendto(struct rpmsg_endpoint *ept, void *data, int len, | |
124 | u32 dst); | |
125 | static int virtio_rpmsg_send_offchannel(struct rpmsg_endpoint *ept, u32 src, | |
126 | u32 dst, void *data, int len); | |
127 | static int virtio_rpmsg_trysend(struct rpmsg_endpoint *ept, void *data, int len); | |
128 | static int virtio_rpmsg_trysendto(struct rpmsg_endpoint *ept, void *data, | |
129 | int len, u32 dst); | |
130 | static int virtio_rpmsg_trysend_offchannel(struct rpmsg_endpoint *ept, u32 src, | |
131 | u32 dst, void *data, int len); | |
bcabbcca | 132 | |
8a228ecf BA |
133 | static const struct rpmsg_endpoint_ops virtio_endpoint_ops = { |
134 | .destroy_ept = virtio_rpmsg_destroy_ept, | |
135 | .send = virtio_rpmsg_send, | |
136 | .sendto = virtio_rpmsg_sendto, | |
137 | .send_offchannel = virtio_rpmsg_send_offchannel, | |
138 | .trysend = virtio_rpmsg_trysend, | |
139 | .trysendto = virtio_rpmsg_trysendto, | |
140 | .trysend_offchannel = virtio_rpmsg_trysend_offchannel, | |
141 | }; | |
142 | ||
5a081caa OBC |
143 | /** |
144 | * __ept_release() - deallocate an rpmsg endpoint | |
145 | * @kref: the ept's reference count | |
146 | * | |
147 | * This function deallocates an ept, and is invoked when its @kref refcount | |
148 | * drops to zero. | |
149 | * | |
150 | * Never invoke this function directly! | |
151 | */ | |
152 | static void __ept_release(struct kref *kref) | |
153 | { | |
154 | struct rpmsg_endpoint *ept = container_of(kref, struct rpmsg_endpoint, | |
155 | refcount); | |
156 | /* | |
157 | * At this point no one holds a reference to ept anymore, | |
158 | * so we can directly free it | |
159 | */ | |
160 | kfree(ept); | |
161 | } | |
162 | ||
bcabbcca OBC |
163 | /* for more info, see below documentation of rpmsg_create_ept() */ |
164 | static struct rpmsg_endpoint *__rpmsg_create_ept(struct virtproc_info *vrp, | |
92e1de51 | 165 | struct rpmsg_device *rpdev, |
0963679c AS |
166 | rpmsg_rx_cb_t cb, |
167 | void *priv, u32 addr) | |
bcabbcca | 168 | { |
d0ffce77 | 169 | int id_min, id_max, id; |
bcabbcca OBC |
170 | struct rpmsg_endpoint *ept; |
171 | struct device *dev = rpdev ? &rpdev->dev : &vrp->vdev->dev; | |
172 | ||
bcabbcca | 173 | ept = kzalloc(sizeof(*ept), GFP_KERNEL); |
a8bb3fd9 | 174 | if (!ept) |
bcabbcca | 175 | return NULL; |
bcabbcca | 176 | |
5a081caa | 177 | kref_init(&ept->refcount); |
15fd943a | 178 | mutex_init(&ept->cb_lock); |
5a081caa | 179 | |
bcabbcca OBC |
180 | ept->rpdev = rpdev; |
181 | ept->cb = cb; | |
182 | ept->priv = priv; | |
8a228ecf | 183 | ept->ops = &virtio_endpoint_ops; |
bcabbcca OBC |
184 | |
185 | /* do we need to allocate a local address ? */ | |
d0ffce77 TH |
186 | if (addr == RPMSG_ADDR_ANY) { |
187 | id_min = RPMSG_RESERVED_ADDRESSES; | |
188 | id_max = 0; | |
189 | } else { | |
190 | id_min = addr; | |
191 | id_max = addr + 1; | |
192 | } | |
bcabbcca OBC |
193 | |
194 | mutex_lock(&vrp->endpoints_lock); | |
195 | ||
196 | /* bind the endpoint to an rpmsg address (and allocate one if needed) */ | |
d0ffce77 TH |
197 | id = idr_alloc(&vrp->endpoints, ept, id_min, id_max, GFP_KERNEL); |
198 | if (id < 0) { | |
199 | dev_err(dev, "idr_alloc failed: %d\n", id); | |
bcabbcca OBC |
200 | goto free_ept; |
201 | } | |
d0ffce77 | 202 | ept->addr = id; |
bcabbcca OBC |
203 | |
204 | mutex_unlock(&vrp->endpoints_lock); | |
205 | ||
206 | return ept; | |
207 | ||
bcabbcca OBC |
208 | free_ept: |
209 | mutex_unlock(&vrp->endpoints_lock); | |
5a081caa | 210 | kref_put(&ept->refcount, __ept_release); |
bcabbcca OBC |
211 | return NULL; |
212 | } | |
213 | ||
36b72c7d BA |
214 | static struct rpmsg_endpoint *virtio_rpmsg_create_ept(struct rpmsg_device *rpdev, |
215 | rpmsg_rx_cb_t cb, | |
216 | void *priv, | |
217 | struct rpmsg_channel_info chinfo) | |
218 | { | |
3bf950ff BA |
219 | struct virtio_rpmsg_channel *vch = to_virtio_rpmsg_channel(rpdev); |
220 | ||
221 | return __rpmsg_create_ept(vch->vrp, rpdev, cb, priv, chinfo.src); | |
36b72c7d BA |
222 | } |
223 | ||
bcabbcca | 224 | /** |
fa2d7795 OBC |
225 | * __rpmsg_destroy_ept() - destroy an existing rpmsg endpoint |
226 | * @vrp: virtproc which owns this ept | |
bcabbcca OBC |
227 | * @ept: endpoing to destroy |
228 | * | |
fa2d7795 OBC |
229 | * An internal function which destroy an ept without assuming it is |
230 | * bound to an rpmsg channel. This is needed for handling the internal | |
231 | * name service endpoint, which isn't bound to an rpmsg channel. | |
232 | * See also __rpmsg_create_ept(). | |
bcabbcca | 233 | */ |
fa2d7795 OBC |
234 | static void |
235 | __rpmsg_destroy_ept(struct virtproc_info *vrp, struct rpmsg_endpoint *ept) | |
bcabbcca | 236 | { |
15fd943a | 237 | /* make sure new inbound messages can't find this ept anymore */ |
bcabbcca OBC |
238 | mutex_lock(&vrp->endpoints_lock); |
239 | idr_remove(&vrp->endpoints, ept->addr); | |
240 | mutex_unlock(&vrp->endpoints_lock); | |
241 | ||
15fd943a OBC |
242 | /* make sure in-flight inbound messages won't invoke cb anymore */ |
243 | mutex_lock(&ept->cb_lock); | |
244 | ept->cb = NULL; | |
245 | mutex_unlock(&ept->cb_lock); | |
246 | ||
5a081caa | 247 | kref_put(&ept->refcount, __ept_release); |
bcabbcca | 248 | } |
fa2d7795 | 249 | |
8a228ecf BA |
250 | static void virtio_rpmsg_destroy_ept(struct rpmsg_endpoint *ept) |
251 | { | |
3bf950ff BA |
252 | struct virtio_rpmsg_channel *vch = to_virtio_rpmsg_channel(ept->rpdev); |
253 | ||
254 | __rpmsg_destroy_ept(vch->vrp, ept); | |
8a228ecf BA |
255 | } |
256 | ||
36b72c7d BA |
257 | static int virtio_rpmsg_announce_create(struct rpmsg_device *rpdev) |
258 | { | |
3bf950ff BA |
259 | struct virtio_rpmsg_channel *vch = to_virtio_rpmsg_channel(rpdev); |
260 | struct virtproc_info *vrp = vch->vrp; | |
36b72c7d BA |
261 | struct device *dev = &rpdev->dev; |
262 | int err = 0; | |
263 | ||
bcabbcca OBC |
264 | /* need to tell remote processor's name service about this channel ? */ |
265 | if (rpdev->announce && | |
0963679c | 266 | virtio_has_feature(vrp->vdev, VIRTIO_RPMSG_F_NS)) { |
bcabbcca OBC |
267 | struct rpmsg_ns_msg nsm; |
268 | ||
269 | strncpy(nsm.name, rpdev->id.name, RPMSG_NAME_SIZE); | |
2a48d732 | 270 | nsm.addr = rpdev->ept->addr; |
bcabbcca OBC |
271 | nsm.flags = RPMSG_NS_CREATE; |
272 | ||
2a48d732 | 273 | err = rpmsg_sendto(rpdev->ept, &nsm, sizeof(nsm), RPMSG_NS_ADDR); |
bcabbcca OBC |
274 | if (err) |
275 | dev_err(dev, "failed to announce service %d\n", err); | |
276 | } | |
277 | ||
bcabbcca OBC |
278 | return err; |
279 | } | |
280 | ||
36b72c7d | 281 | static int virtio_rpmsg_announce_destroy(struct rpmsg_device *rpdev) |
bcabbcca | 282 | { |
3bf950ff BA |
283 | struct virtio_rpmsg_channel *vch = to_virtio_rpmsg_channel(rpdev); |
284 | struct virtproc_info *vrp = vch->vrp; | |
36b72c7d | 285 | struct device *dev = &rpdev->dev; |
bcabbcca OBC |
286 | int err = 0; |
287 | ||
288 | /* tell remote processor's name service we're removing this channel */ | |
289 | if (rpdev->announce && | |
0963679c | 290 | virtio_has_feature(vrp->vdev, VIRTIO_RPMSG_F_NS)) { |
bcabbcca OBC |
291 | struct rpmsg_ns_msg nsm; |
292 | ||
293 | strncpy(nsm.name, rpdev->id.name, RPMSG_NAME_SIZE); | |
294 | nsm.addr = rpdev->src; | |
295 | nsm.flags = RPMSG_NS_DESTROY; | |
296 | ||
2a48d732 | 297 | err = rpmsg_sendto(rpdev->ept, &nsm, sizeof(nsm), RPMSG_NS_ADDR); |
bcabbcca OBC |
298 | if (err) |
299 | dev_err(dev, "failed to announce service %d\n", err); | |
300 | } | |
301 | ||
36b72c7d BA |
302 | return err; |
303 | } | |
304 | ||
36b72c7d BA |
305 | static const struct rpmsg_device_ops virtio_rpmsg_ops = { |
306 | .create_ept = virtio_rpmsg_create_ept, | |
307 | .announce_create = virtio_rpmsg_announce_create, | |
308 | .announce_destroy = virtio_rpmsg_announce_destroy, | |
309 | }; | |
310 | ||
bcabbcca OBC |
311 | /* |
312 | * create an rpmsg channel using its name and address info. | |
313 | * this function will be used to create both static and dynamic | |
314 | * channels. | |
315 | */ | |
92e1de51 BA |
316 | static struct rpmsg_device *rpmsg_create_channel(struct virtproc_info *vrp, |
317 | struct rpmsg_channel_info *chinfo) | |
bcabbcca | 318 | { |
3bf950ff | 319 | struct virtio_rpmsg_channel *vch; |
92e1de51 | 320 | struct rpmsg_device *rpdev; |
bcabbcca OBC |
321 | struct device *tmp, *dev = &vrp->vdev->dev; |
322 | int ret; | |
323 | ||
324 | /* make sure a similar channel doesn't already exist */ | |
8b881c07 | 325 | tmp = rpmsg_find_device(dev, chinfo); |
bcabbcca OBC |
326 | if (tmp) { |
327 | /* decrement the matched device's refcount back */ | |
328 | put_device(tmp); | |
329 | dev_err(dev, "channel %s:%x:%x already exist\n", | |
330 | chinfo->name, chinfo->src, chinfo->dst); | |
331 | return NULL; | |
332 | } | |
333 | ||
3bf950ff BA |
334 | vch = kzalloc(sizeof(*vch), GFP_KERNEL); |
335 | if (!vch) | |
bcabbcca | 336 | return NULL; |
bcabbcca | 337 | |
3bf950ff BA |
338 | /* Link the channel to our vrp */ |
339 | vch->vrp = vrp; | |
340 | ||
341 | /* Assign callbacks for rpmsg_channel */ | |
342 | vch->rpdev.ops = &virtio_rpmsg_ops; | |
343 | ||
344 | /* Assign public information to the rpmsg_device */ | |
345 | rpdev = &vch->rpdev; | |
bcabbcca OBC |
346 | rpdev->src = chinfo->src; |
347 | rpdev->dst = chinfo->dst; | |
36b72c7d | 348 | rpdev->ops = &virtio_rpmsg_ops; |
bcabbcca OBC |
349 | |
350 | /* | |
351 | * rpmsg server channels has predefined local address (for now), | |
352 | * and their existence needs to be announced remotely | |
353 | */ | |
c8ced113 | 354 | rpdev->announce = rpdev->src != RPMSG_ADDR_ANY; |
bcabbcca OBC |
355 | |
356 | strncpy(rpdev->id.name, chinfo->name, RPMSG_NAME_SIZE); | |
357 | ||
6eed598a BA |
358 | rpdev->dev.parent = &vrp->vdev->dev; |
359 | ret = rpmsg_register_device(rpdev); | |
360 | if (ret) | |
361 | return NULL; | |
362 | ||
363 | return rpdev; | |
364 | } | |
365 | ||
bcabbcca OBC |
366 | /* super simple buffer "allocator" that is just enough for now */ |
367 | static void *get_a_tx_buf(struct virtproc_info *vrp) | |
368 | { | |
369 | unsigned int len; | |
370 | void *ret; | |
371 | ||
372 | /* support multiple concurrent senders */ | |
373 | mutex_lock(&vrp->tx_lock); | |
374 | ||
375 | /* | |
376 | * either pick the next unused tx buffer | |
377 | * (half of our buffers are used for sending messages) | |
378 | */ | |
b1b98914 | 379 | if (vrp->last_sbuf < vrp->num_bufs / 2) |
bcabbcca OBC |
380 | ret = vrp->sbufs + RPMSG_BUF_SIZE * vrp->last_sbuf++; |
381 | /* or recycle a used one */ | |
382 | else | |
383 | ret = virtqueue_get_buf(vrp->svq, &len); | |
384 | ||
385 | mutex_unlock(&vrp->tx_lock); | |
386 | ||
387 | return ret; | |
388 | } | |
389 | ||
390 | /** | |
391 | * rpmsg_upref_sleepers() - enable "tx-complete" interrupts, if needed | |
392 | * @vrp: virtual remote processor state | |
393 | * | |
394 | * This function is called before a sender is blocked, waiting for | |
395 | * a tx buffer to become available. | |
396 | * | |
397 | * If we already have blocking senders, this function merely increases | |
398 | * the "sleepers" reference count, and exits. | |
399 | * | |
400 | * Otherwise, if this is the first sender to block, we also enable | |
401 | * virtio's tx callbacks, so we'd be immediately notified when a tx | |
402 | * buffer is consumed (we rely on virtio's tx callback in order | |
403 | * to wake up sleeping senders as soon as a tx buffer is used by the | |
404 | * remote processor). | |
405 | */ | |
406 | static void rpmsg_upref_sleepers(struct virtproc_info *vrp) | |
407 | { | |
408 | /* support multiple concurrent senders */ | |
409 | mutex_lock(&vrp->tx_lock); | |
410 | ||
411 | /* are we the first sleeping context waiting for tx buffers ? */ | |
412 | if (atomic_inc_return(&vrp->sleepers) == 1) | |
413 | /* enable "tx-complete" interrupts before dozing off */ | |
414 | virtqueue_enable_cb(vrp->svq); | |
415 | ||
416 | mutex_unlock(&vrp->tx_lock); | |
417 | } | |
418 | ||
419 | /** | |
420 | * rpmsg_downref_sleepers() - disable "tx-complete" interrupts, if needed | |
421 | * @vrp: virtual remote processor state | |
422 | * | |
423 | * This function is called after a sender, that waited for a tx buffer | |
424 | * to become available, is unblocked. | |
425 | * | |
426 | * If we still have blocking senders, this function merely decreases | |
427 | * the "sleepers" reference count, and exits. | |
428 | * | |
429 | * Otherwise, if there are no more blocking senders, we also disable | |
430 | * virtio's tx callbacks, to avoid the overhead incurred with handling | |
431 | * those (now redundant) interrupts. | |
432 | */ | |
433 | static void rpmsg_downref_sleepers(struct virtproc_info *vrp) | |
434 | { | |
435 | /* support multiple concurrent senders */ | |
436 | mutex_lock(&vrp->tx_lock); | |
437 | ||
438 | /* are we the last sleeping context waiting for tx buffers ? */ | |
439 | if (atomic_dec_and_test(&vrp->sleepers)) | |
440 | /* disable "tx-complete" interrupts */ | |
441 | virtqueue_disable_cb(vrp->svq); | |
442 | ||
443 | mutex_unlock(&vrp->tx_lock); | |
444 | } | |
445 | ||
446 | /** | |
447 | * rpmsg_send_offchannel_raw() - send a message across to the remote processor | |
448 | * @rpdev: the rpmsg channel | |
449 | * @src: source address | |
450 | * @dst: destination address | |
451 | * @data: payload of message | |
452 | * @len: length of payload | |
453 | * @wait: indicates whether caller should block in case no TX buffers available | |
454 | * | |
455 | * This function is the base implementation for all of the rpmsg sending API. | |
456 | * | |
457 | * It will send @data of length @len to @dst, and say it's from @src. The | |
458 | * message will be sent to the remote processor which the @rpdev channel | |
459 | * belongs to. | |
460 | * | |
461 | * The message is sent using one of the TX buffers that are available for | |
462 | * communication with this remote processor. | |
463 | * | |
464 | * If @wait is true, the caller will be blocked until either a TX buffer is | |
465 | * available, or 15 seconds elapses (we don't want callers to | |
466 | * sleep indefinitely due to misbehaving remote processors), and in that | |
467 | * case -ERESTARTSYS is returned. The number '15' itself was picked | |
468 | * arbitrarily; there's little point in asking drivers to provide a timeout | |
469 | * value themselves. | |
470 | * | |
471 | * Otherwise, if @wait is false, and there are no TX buffers available, | |
472 | * the function will immediately fail, and -ENOMEM will be returned. | |
473 | * | |
474 | * Normally drivers shouldn't use this function directly; instead, drivers | |
475 | * should use the appropriate rpmsg_{try}send{to, _offchannel} API | |
476 | * (see include/linux/rpmsg.h). | |
477 | * | |
478 | * Returns 0 on success and an appropriate error value on failure. | |
479 | */ | |
8a228ecf BA |
480 | static int rpmsg_send_offchannel_raw(struct rpmsg_device *rpdev, |
481 | u32 src, u32 dst, | |
482 | void *data, int len, bool wait) | |
bcabbcca | 483 | { |
3bf950ff BA |
484 | struct virtio_rpmsg_channel *vch = to_virtio_rpmsg_channel(rpdev); |
485 | struct virtproc_info *vrp = vch->vrp; | |
bcabbcca OBC |
486 | struct device *dev = &rpdev->dev; |
487 | struct scatterlist sg; | |
488 | struct rpmsg_hdr *msg; | |
489 | int err; | |
490 | ||
491 | /* bcasting isn't allowed */ | |
492 | if (src == RPMSG_ADDR_ANY || dst == RPMSG_ADDR_ANY) { | |
493 | dev_err(dev, "invalid addr (src 0x%x, dst 0x%x)\n", src, dst); | |
494 | return -EINVAL; | |
495 | } | |
496 | ||
497 | /* | |
498 | * We currently use fixed-sized buffers, and therefore the payload | |
499 | * length is limited. | |
500 | * | |
501 | * One of the possible improvements here is either to support | |
502 | * user-provided buffers (and then we can also support zero-copy | |
503 | * messaging), or to improve the buffer allocator, to support | |
504 | * variable-length buffer sizes. | |
505 | */ | |
506 | if (len > RPMSG_BUF_SIZE - sizeof(struct rpmsg_hdr)) { | |
507 | dev_err(dev, "message is too big (%d)\n", len); | |
508 | return -EMSGSIZE; | |
509 | } | |
510 | ||
511 | /* grab a buffer */ | |
512 | msg = get_a_tx_buf(vrp); | |
513 | if (!msg && !wait) | |
514 | return -ENOMEM; | |
515 | ||
516 | /* no free buffer ? wait for one (but bail after 15 seconds) */ | |
517 | while (!msg) { | |
518 | /* enable "tx-complete" interrupts, if not already enabled */ | |
519 | rpmsg_upref_sleepers(vrp); | |
520 | ||
521 | /* | |
522 | * sleep until a free buffer is available or 15 secs elapse. | |
523 | * the timeout period is not configurable because there's | |
524 | * little point in asking drivers to specify that. | |
525 | * if later this happens to be required, it'd be easy to add. | |
526 | */ | |
527 | err = wait_event_interruptible_timeout(vrp->sendq, | |
528 | (msg = get_a_tx_buf(vrp)), | |
529 | msecs_to_jiffies(15000)); | |
530 | ||
531 | /* disable "tx-complete" interrupts if we're the last sleeper */ | |
532 | rpmsg_downref_sleepers(vrp); | |
533 | ||
534 | /* timeout ? */ | |
535 | if (!err) { | |
536 | dev_err(dev, "timeout waiting for a tx buffer\n"); | |
537 | return -ERESTARTSYS; | |
538 | } | |
539 | } | |
540 | ||
541 | msg->len = len; | |
542 | msg->flags = 0; | |
543 | msg->src = src; | |
544 | msg->dst = dst; | |
545 | msg->reserved = 0; | |
546 | memcpy(msg->data, data, len); | |
547 | ||
548 | dev_dbg(dev, "TX From 0x%x, To 0x%x, Len %d, Flags %d, Reserved %d\n", | |
0963679c | 549 | msg->src, msg->dst, msg->len, msg->flags, msg->reserved); |
211e3a93 AS |
550 | #if defined(CONFIG_DYNAMIC_DEBUG) |
551 | dynamic_hex_dump("rpmsg_virtio TX: ", DUMP_PREFIX_NONE, 16, 1, | |
552 | msg, sizeof(*msg) + msg->len, true); | |
553 | #endif | |
bcabbcca OBC |
554 | |
555 | sg_init_one(&sg, msg, sizeof(*msg) + len); | |
556 | ||
557 | mutex_lock(&vrp->tx_lock); | |
558 | ||
559 | /* add message to the remote processor's virtqueue */ | |
cee51d69 | 560 | err = virtqueue_add_outbuf(vrp->svq, &sg, 1, msg, GFP_KERNEL); |
57e1a373 | 561 | if (err) { |
bcabbcca OBC |
562 | /* |
563 | * need to reclaim the buffer here, otherwise it's lost | |
564 | * (memory won't leak, but rpmsg won't use it again for TX). | |
565 | * this will wait for a buffer management overhaul. | |
566 | */ | |
cee51d69 | 567 | dev_err(dev, "virtqueue_add_outbuf failed: %d\n", err); |
bcabbcca OBC |
568 | goto out; |
569 | } | |
570 | ||
571 | /* tell the remote processor it has a pending message to read */ | |
572 | virtqueue_kick(vrp->svq); | |
bcabbcca OBC |
573 | out: |
574 | mutex_unlock(&vrp->tx_lock); | |
575 | return err; | |
576 | } | |
577 | EXPORT_SYMBOL(rpmsg_send_offchannel_raw); | |
578 | ||
8a228ecf BA |
579 | static int virtio_rpmsg_send(struct rpmsg_endpoint *ept, void *data, int len) |
580 | { | |
581 | struct rpmsg_device *rpdev = ept->rpdev; | |
582 | u32 src = ept->addr, dst = rpdev->dst; | |
583 | ||
584 | return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, true); | |
585 | } | |
586 | ||
587 | static int virtio_rpmsg_sendto(struct rpmsg_endpoint *ept, void *data, int len, | |
588 | u32 dst) | |
589 | { | |
590 | struct rpmsg_device *rpdev = ept->rpdev; | |
591 | u32 src = ept->addr; | |
592 | ||
593 | return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, true); | |
594 | } | |
595 | ||
596 | static int virtio_rpmsg_send_offchannel(struct rpmsg_endpoint *ept, u32 src, | |
597 | u32 dst, void *data, int len) | |
598 | { | |
599 | struct rpmsg_device *rpdev = ept->rpdev; | |
600 | ||
601 | return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, true); | |
602 | } | |
603 | ||
604 | static int virtio_rpmsg_trysend(struct rpmsg_endpoint *ept, void *data, int len) | |
605 | { | |
606 | struct rpmsg_device *rpdev = ept->rpdev; | |
607 | u32 src = ept->addr, dst = rpdev->dst; | |
608 | ||
609 | return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, false); | |
610 | } | |
611 | ||
612 | static int virtio_rpmsg_trysendto(struct rpmsg_endpoint *ept, void *data, | |
613 | int len, u32 dst) | |
614 | { | |
615 | struct rpmsg_device *rpdev = ept->rpdev; | |
616 | u32 src = ept->addr; | |
617 | ||
618 | return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, false); | |
619 | } | |
620 | ||
621 | static int virtio_rpmsg_trysend_offchannel(struct rpmsg_endpoint *ept, u32 src, | |
622 | u32 dst, void *data, int len) | |
623 | { | |
624 | struct rpmsg_device *rpdev = ept->rpdev; | |
625 | ||
626 | return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, false); | |
627 | } | |
628 | ||
1aa7d6a5 RT |
629 | static int rpmsg_recv_single(struct virtproc_info *vrp, struct device *dev, |
630 | struct rpmsg_hdr *msg, unsigned int len) | |
bcabbcca | 631 | { |
bcabbcca OBC |
632 | struct rpmsg_endpoint *ept; |
633 | struct scatterlist sg; | |
bcabbcca OBC |
634 | int err; |
635 | ||
bcabbcca | 636 | dev_dbg(dev, "From: 0x%x, To: 0x%x, Len: %d, Flags: %d, Reserved: %d\n", |
0963679c | 637 | msg->src, msg->dst, msg->len, msg->flags, msg->reserved); |
211e3a93 AS |
638 | #if defined(CONFIG_DYNAMIC_DEBUG) |
639 | dynamic_hex_dump("rpmsg_virtio RX: ", DUMP_PREFIX_NONE, 16, 1, | |
640 | msg, sizeof(*msg) + msg->len, true); | |
641 | #endif | |
bcabbcca | 642 | |
9648224e OBC |
643 | /* |
644 | * We currently use fixed-sized buffers, so trivially sanitize | |
645 | * the reported payload length. | |
646 | */ | |
647 | if (len > RPMSG_BUF_SIZE || | |
0963679c | 648 | msg->len > (len - sizeof(struct rpmsg_hdr))) { |
9648224e | 649 | dev_warn(dev, "inbound msg too big: (%d, %d)\n", len, msg->len); |
1aa7d6a5 | 650 | return -EINVAL; |
9648224e OBC |
651 | } |
652 | ||
bcabbcca OBC |
653 | /* use the dst addr to fetch the callback of the appropriate user */ |
654 | mutex_lock(&vrp->endpoints_lock); | |
5a081caa | 655 | |
bcabbcca | 656 | ept = idr_find(&vrp->endpoints, msg->dst); |
5a081caa OBC |
657 | |
658 | /* let's make sure no one deallocates ept while we use it */ | |
659 | if (ept) | |
660 | kref_get(&ept->refcount); | |
661 | ||
bcabbcca OBC |
662 | mutex_unlock(&vrp->endpoints_lock); |
663 | ||
15fd943a OBC |
664 | if (ept) { |
665 | /* make sure ept->cb doesn't go away while we use it */ | |
666 | mutex_lock(&ept->cb_lock); | |
bcabbcca | 667 | |
15fd943a OBC |
668 | if (ept->cb) |
669 | ept->cb(ept->rpdev, msg->data, msg->len, ept->priv, | |
670 | msg->src); | |
671 | ||
672 | mutex_unlock(&ept->cb_lock); | |
673 | ||
674 | /* farewell, ept, we don't need you anymore */ | |
5a081caa | 675 | kref_put(&ept->refcount, __ept_release); |
15fd943a | 676 | } else |
8a168ca7 | 677 | dev_warn(dev, "msg received with no recipient\n"); |
5a081caa | 678 | |
f1d9e9c7 OBC |
679 | /* publish the real size of the buffer */ |
680 | sg_init_one(&sg, msg, RPMSG_BUF_SIZE); | |
bcabbcca OBC |
681 | |
682 | /* add the buffer back to the remote processor's virtqueue */ | |
cee51d69 | 683 | err = virtqueue_add_inbuf(vrp->rvq, &sg, 1, msg, GFP_KERNEL); |
bcabbcca OBC |
684 | if (err < 0) { |
685 | dev_err(dev, "failed to add a virtqueue buffer: %d\n", err); | |
1aa7d6a5 RT |
686 | return err; |
687 | } | |
688 | ||
689 | return 0; | |
690 | } | |
691 | ||
692 | /* called when an rx buffer is used, and it's time to digest a message */ | |
693 | static void rpmsg_recv_done(struct virtqueue *rvq) | |
694 | { | |
695 | struct virtproc_info *vrp = rvq->vdev->priv; | |
696 | struct device *dev = &rvq->vdev->dev; | |
697 | struct rpmsg_hdr *msg; | |
698 | unsigned int len, msgs_received = 0; | |
699 | int err; | |
700 | ||
701 | msg = virtqueue_get_buf(rvq, &len); | |
702 | if (!msg) { | |
703 | dev_err(dev, "uhm, incoming signal, but no used buffer ?\n"); | |
bcabbcca OBC |
704 | return; |
705 | } | |
706 | ||
1aa7d6a5 RT |
707 | while (msg) { |
708 | err = rpmsg_recv_single(vrp, dev, msg, len); | |
709 | if (err) | |
710 | break; | |
711 | ||
712 | msgs_received++; | |
713 | ||
714 | msg = virtqueue_get_buf(rvq, &len); | |
6c49fbe3 | 715 | } |
1aa7d6a5 RT |
716 | |
717 | dev_dbg(dev, "Received %u messages\n", msgs_received); | |
718 | ||
bcabbcca | 719 | /* tell the remote processor we added another available rx buffer */ |
1aa7d6a5 RT |
720 | if (msgs_received) |
721 | virtqueue_kick(vrp->rvq); | |
bcabbcca OBC |
722 | } |
723 | ||
724 | /* | |
725 | * This is invoked whenever the remote processor completed processing | |
726 | * a TX msg we just sent it, and the buffer is put back to the used ring. | |
727 | * | |
728 | * Normally, though, we suppress this "tx complete" interrupt in order to | |
729 | * avoid the incurred overhead. | |
730 | */ | |
731 | static void rpmsg_xmit_done(struct virtqueue *svq) | |
732 | { | |
733 | struct virtproc_info *vrp = svq->vdev->priv; | |
734 | ||
735 | dev_dbg(&svq->vdev->dev, "%s\n", __func__); | |
736 | ||
737 | /* wake up potential senders that are waiting for a tx buffer */ | |
738 | wake_up_interruptible(&vrp->sendq); | |
739 | } | |
740 | ||
741 | /* invoked when a name service announcement arrives */ | |
92e1de51 | 742 | static void rpmsg_ns_cb(struct rpmsg_device *rpdev, void *data, int len, |
0963679c | 743 | void *priv, u32 src) |
bcabbcca OBC |
744 | { |
745 | struct rpmsg_ns_msg *msg = data; | |
92e1de51 | 746 | struct rpmsg_device *newch; |
bcabbcca OBC |
747 | struct rpmsg_channel_info chinfo; |
748 | struct virtproc_info *vrp = priv; | |
749 | struct device *dev = &vrp->vdev->dev; | |
750 | int ret; | |
751 | ||
211e3a93 AS |
752 | #if defined(CONFIG_DYNAMIC_DEBUG) |
753 | dynamic_hex_dump("NS announcement: ", DUMP_PREFIX_NONE, 16, 1, | |
754 | data, len, true); | |
755 | #endif | |
bcabbcca OBC |
756 | |
757 | if (len != sizeof(*msg)) { | |
758 | dev_err(dev, "malformed ns msg (%d)\n", len); | |
759 | return; | |
760 | } | |
761 | ||
762 | /* | |
763 | * the name service ept does _not_ belong to a real rpmsg channel, | |
764 | * and is handled by the rpmsg bus itself. | |
765 | * for sanity reasons, make sure a valid rpdev has _not_ sneaked | |
766 | * in somehow. | |
767 | */ | |
768 | if (rpdev) { | |
769 | dev_err(dev, "anomaly: ns ept has an rpdev handle\n"); | |
770 | return; | |
771 | } | |
772 | ||
773 | /* don't trust the remote processor for null terminating the name */ | |
774 | msg->name[RPMSG_NAME_SIZE - 1] = '\0'; | |
775 | ||
776 | dev_info(dev, "%sing channel %s addr 0x%x\n", | |
0963679c AS |
777 | msg->flags & RPMSG_NS_DESTROY ? "destroy" : "creat", |
778 | msg->name, msg->addr); | |
bcabbcca OBC |
779 | |
780 | strncpy(chinfo.name, msg->name, sizeof(chinfo.name)); | |
781 | chinfo.src = RPMSG_ADDR_ANY; | |
782 | chinfo.dst = msg->addr; | |
783 | ||
784 | if (msg->flags & RPMSG_NS_DESTROY) { | |
5e619b48 | 785 | ret = rpmsg_unregister_device(&vrp->vdev->dev, &chinfo); |
bcabbcca OBC |
786 | if (ret) |
787 | dev_err(dev, "rpmsg_destroy_channel failed: %d\n", ret); | |
788 | } else { | |
789 | newch = rpmsg_create_channel(vrp, &chinfo); | |
790 | if (!newch) | |
791 | dev_err(dev, "rpmsg_create_channel failed\n"); | |
792 | } | |
793 | } | |
794 | ||
795 | static int rpmsg_probe(struct virtio_device *vdev) | |
796 | { | |
797 | vq_callback_t *vq_cbs[] = { rpmsg_recv_done, rpmsg_xmit_done }; | |
f7ad26ff | 798 | static const char * const names[] = { "input", "output" }; |
bcabbcca OBC |
799 | struct virtqueue *vqs[2]; |
800 | struct virtproc_info *vrp; | |
801 | void *bufs_va; | |
802 | int err = 0, i; | |
b1b98914 | 803 | size_t total_buf_space; |
71e4b8bf | 804 | bool notify; |
bcabbcca OBC |
805 | |
806 | vrp = kzalloc(sizeof(*vrp), GFP_KERNEL); | |
807 | if (!vrp) | |
808 | return -ENOMEM; | |
809 | ||
810 | vrp->vdev = vdev; | |
811 | ||
812 | idr_init(&vrp->endpoints); | |
813 | mutex_init(&vrp->endpoints_lock); | |
814 | mutex_init(&vrp->tx_lock); | |
815 | init_waitqueue_head(&vrp->sendq); | |
816 | ||
817 | /* We expect two virtqueues, rx and tx (and in this order) */ | |
818 | err = vdev->config->find_vqs(vdev, 2, vqs, vq_cbs, names); | |
819 | if (err) | |
820 | goto free_vrp; | |
821 | ||
822 | vrp->rvq = vqs[0]; | |
823 | vrp->svq = vqs[1]; | |
824 | ||
b1b98914 SA |
825 | /* we expect symmetric tx/rx vrings */ |
826 | WARN_ON(virtqueue_get_vring_size(vrp->rvq) != | |
827 | virtqueue_get_vring_size(vrp->svq)); | |
828 | ||
829 | /* we need less buffers if vrings are small */ | |
830 | if (virtqueue_get_vring_size(vrp->rvq) < MAX_RPMSG_NUM_BUFS / 2) | |
831 | vrp->num_bufs = virtqueue_get_vring_size(vrp->rvq) * 2; | |
832 | else | |
833 | vrp->num_bufs = MAX_RPMSG_NUM_BUFS; | |
834 | ||
835 | total_buf_space = vrp->num_bufs * RPMSG_BUF_SIZE; | |
836 | ||
bcabbcca | 837 | /* allocate coherent memory for the buffers */ |
b5ab5e24 | 838 | bufs_va = dma_alloc_coherent(vdev->dev.parent->parent, |
b1b98914 SA |
839 | total_buf_space, &vrp->bufs_dma, |
840 | GFP_KERNEL); | |
3119b487 WY |
841 | if (!bufs_va) { |
842 | err = -ENOMEM; | |
bcabbcca | 843 | goto vqs_del; |
3119b487 | 844 | } |
bcabbcca | 845 | |
8d95b322 AS |
846 | dev_dbg(&vdev->dev, "buffers: va %p, dma %pad\n", |
847 | bufs_va, &vrp->bufs_dma); | |
bcabbcca OBC |
848 | |
849 | /* half of the buffers is dedicated for RX */ | |
850 | vrp->rbufs = bufs_va; | |
851 | ||
852 | /* and half is dedicated for TX */ | |
b1b98914 | 853 | vrp->sbufs = bufs_va + total_buf_space / 2; |
bcabbcca OBC |
854 | |
855 | /* set up the receive buffers */ | |
b1b98914 | 856 | for (i = 0; i < vrp->num_bufs / 2; i++) { |
bcabbcca OBC |
857 | struct scatterlist sg; |
858 | void *cpu_addr = vrp->rbufs + i * RPMSG_BUF_SIZE; | |
859 | ||
860 | sg_init_one(&sg, cpu_addr, RPMSG_BUF_SIZE); | |
861 | ||
cee51d69 | 862 | err = virtqueue_add_inbuf(vrp->rvq, &sg, 1, cpu_addr, |
0963679c | 863 | GFP_KERNEL); |
57e1a373 | 864 | WARN_ON(err); /* sanity check; this can't really happen */ |
bcabbcca OBC |
865 | } |
866 | ||
867 | /* suppress "tx-complete" interrupts */ | |
868 | virtqueue_disable_cb(vrp->svq); | |
869 | ||
870 | vdev->priv = vrp; | |
871 | ||
872 | /* if supported by the remote processor, enable the name service */ | |
873 | if (virtio_has_feature(vdev, VIRTIO_RPMSG_F_NS)) { | |
874 | /* a dedicated endpoint handles the name service msgs */ | |
875 | vrp->ns_ept = __rpmsg_create_ept(vrp, NULL, rpmsg_ns_cb, | |
876 | vrp, RPMSG_NS_ADDR); | |
877 | if (!vrp->ns_ept) { | |
878 | dev_err(&vdev->dev, "failed to create the ns ept\n"); | |
879 | err = -ENOMEM; | |
880 | goto free_coherent; | |
881 | } | |
882 | } | |
883 | ||
71e4b8bf MT |
884 | /* |
885 | * Prepare to kick but don't notify yet - we can't do this before | |
886 | * device is ready. | |
887 | */ | |
888 | notify = virtqueue_kick_prepare(vrp->rvq); | |
889 | ||
890 | /* From this point on, we can notify and get callbacks. */ | |
891 | virtio_device_ready(vdev); | |
892 | ||
bcabbcca | 893 | /* tell the remote processor it can start sending messages */ |
71e4b8bf MT |
894 | /* |
895 | * this might be concurrent with callbacks, but we are only | |
896 | * doing notify, not a full kick here, so that's ok. | |
897 | */ | |
898 | if (notify) | |
899 | virtqueue_notify(vrp->rvq); | |
bcabbcca OBC |
900 | |
901 | dev_info(&vdev->dev, "rpmsg host is online\n"); | |
902 | ||
903 | return 0; | |
904 | ||
905 | free_coherent: | |
b1b98914 SA |
906 | dma_free_coherent(vdev->dev.parent->parent, total_buf_space, |
907 | bufs_va, vrp->bufs_dma); | |
bcabbcca OBC |
908 | vqs_del: |
909 | vdev->config->del_vqs(vrp->vdev); | |
910 | free_vrp: | |
911 | kfree(vrp); | |
912 | return err; | |
913 | } | |
914 | ||
915 | static int rpmsg_remove_device(struct device *dev, void *data) | |
916 | { | |
917 | device_unregister(dev); | |
918 | ||
919 | return 0; | |
920 | } | |
921 | ||
0fe763c5 | 922 | static void rpmsg_remove(struct virtio_device *vdev) |
bcabbcca OBC |
923 | { |
924 | struct virtproc_info *vrp = vdev->priv; | |
b1b98914 | 925 | size_t total_buf_space = vrp->num_bufs * RPMSG_BUF_SIZE; |
bcabbcca OBC |
926 | int ret; |
927 | ||
928 | vdev->config->reset(vdev); | |
929 | ||
930 | ret = device_for_each_child(&vdev->dev, NULL, rpmsg_remove_device); | |
931 | if (ret) | |
932 | dev_warn(&vdev->dev, "can't remove rpmsg device: %d\n", ret); | |
933 | ||
fa2d7795 OBC |
934 | if (vrp->ns_ept) |
935 | __rpmsg_destroy_ept(vrp, vrp->ns_ept); | |
936 | ||
bcabbcca OBC |
937 | idr_destroy(&vrp->endpoints); |
938 | ||
939 | vdev->config->del_vqs(vrp->vdev); | |
940 | ||
b1b98914 SA |
941 | dma_free_coherent(vdev->dev.parent->parent, total_buf_space, |
942 | vrp->rbufs, vrp->bufs_dma); | |
bcabbcca OBC |
943 | |
944 | kfree(vrp); | |
945 | } | |
946 | ||
947 | static struct virtio_device_id id_table[] = { | |
948 | { VIRTIO_ID_RPMSG, VIRTIO_DEV_ANY_ID }, | |
949 | { 0 }, | |
950 | }; | |
951 | ||
952 | static unsigned int features[] = { | |
953 | VIRTIO_RPMSG_F_NS, | |
954 | }; | |
955 | ||
956 | static struct virtio_driver virtio_ipc_driver = { | |
957 | .feature_table = features, | |
958 | .feature_table_size = ARRAY_SIZE(features), | |
959 | .driver.name = KBUILD_MODNAME, | |
960 | .driver.owner = THIS_MODULE, | |
961 | .id_table = id_table, | |
962 | .probe = rpmsg_probe, | |
0fe763c5 | 963 | .remove = rpmsg_remove, |
bcabbcca OBC |
964 | }; |
965 | ||
966 | static int __init rpmsg_init(void) | |
967 | { | |
968 | int ret; | |
969 | ||
bcabbcca | 970 | ret = register_virtio_driver(&virtio_ipc_driver); |
5e619b48 | 971 | if (ret) |
bcabbcca | 972 | pr_err("failed to register virtio driver: %d\n", ret); |
bcabbcca OBC |
973 | |
974 | return ret; | |
975 | } | |
96342526 | 976 | subsys_initcall(rpmsg_init); |
bcabbcca OBC |
977 | |
978 | static void __exit rpmsg_fini(void) | |
979 | { | |
980 | unregister_virtio_driver(&virtio_ipc_driver); | |
bcabbcca OBC |
981 | } |
982 | module_exit(rpmsg_fini); | |
983 | ||
984 | MODULE_DEVICE_TABLE(virtio, id_table); | |
985 | MODULE_DESCRIPTION("Virtio-based remote processor messaging bus"); | |
986 | MODULE_LICENSE("GPL v2"); |