diff options
author | Ohad Ben-Cohen <ohad@wizery.com> | 2012-02-13 16:30:39 -0500 |
---|---|---|
committer | Ohad Ben-Cohen <ohad@wizery.com> | 2012-03-06 12:14:12 -0500 |
commit | 7a186941626d19f668b08108db158379b32e6e02 (patch) | |
tree | d478210fa3ae45ef8b3eaf6a6432eadc49cbb55a /include/linux | |
parent | 41a6ee09ee8dd7ac3a6ac12a24e26279b5d93385 (diff) |
remoteproc: remove the single rpmsg vdev limitation
Now that the resource table supports publishing a virtio device
in a single resource entry, firmware images can start supporting
more than a single vdev.
This patch removes the single vdev limitation of the remoteproc
framework so multi-vdev firmwares can be leveraged: VDEV resource
entries are parsed when the rproc is registered, and as a result
their vrings are set up and the virtio devices are registered
(and they go away when the rproc goes away).
Moreover, we no longer only support VIRTIO_ID_RPMSG vdevs; any
virtio device type goes now. As a result, there's no more any
rpmsg-specific APIs or code in remoteproc: it all becomes generic
virtio handling.
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Brian Swetland <swetland@google.com>
Cc: Iliyan Malchev <malchev@google.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Mark Grosen <mgrosen@ti.com>
Cc: John Williams <john.williams@petalogix.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Loic PALLARDY <loic.pallardy@stericsson.com>
Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
Cc: Omar Ramirez Luna <omar.luna@linaro.org>
Cc: Guzman Lugo Fernando <fernando.lugo@ti.com>
Cc: Anna Suman <s-anna@ti.com>
Cc: Clark Rob <rob@ti.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Saravana Kannan <skannan@codeaurora.org>
Cc: David Brown <davidb@codeaurora.org>
Cc: Kieran Bingham <kieranbingham@gmail.com>
Cc: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/remoteproc.h | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index 6040f831f626..7750d8a30933 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/mutex.h> | 41 | #include <linux/mutex.h> |
42 | #include <linux/virtio.h> | 42 | #include <linux/virtio.h> |
43 | #include <linux/completion.h> | 43 | #include <linux/completion.h> |
44 | #include <linux/idr.h> | ||
44 | 45 | ||
45 | /* | 46 | /* |
46 | * The alignment between the consumer and producer parts of the vring. | 47 | * The alignment between the consumer and producer parts of the vring. |
@@ -387,7 +388,8 @@ enum rproc_state { | |||
387 | * @mappings: list of iommu mappings we initiated, needed on shutdown | 388 | * @mappings: list of iommu mappings we initiated, needed on shutdown |
388 | * @firmware_loading_complete: marks e/o asynchronous firmware loading | 389 | * @firmware_loading_complete: marks e/o asynchronous firmware loading |
389 | * @bootaddr: address of first instruction to boot rproc with (optional) | 390 | * @bootaddr: address of first instruction to boot rproc with (optional) |
390 | * @rvdev: virtio device (we only support a single rpmsg virtio device for now) | 391 | * @rvdevs: list of remote virtio devices |
392 | * @notifyids: idr for dynamically assigning rproc-wide unique notify ids | ||
391 | */ | 393 | */ |
392 | struct rproc { | 394 | struct rproc { |
393 | struct klist_node node; | 395 | struct klist_node node; |
@@ -408,23 +410,47 @@ struct rproc { | |||
408 | struct list_head mappings; | 410 | struct list_head mappings; |
409 | struct completion firmware_loading_complete; | 411 | struct completion firmware_loading_complete; |
410 | u32 bootaddr; | 412 | u32 bootaddr; |
413 | struct list_head rvdevs; | ||
414 | struct idr notifyids; | ||
415 | }; | ||
416 | |||
417 | /* we currently support only two vrings per rvdev */ | ||
418 | #define RVDEV_NUM_VRINGS 2 | ||
419 | |||
420 | /** | ||
421 | * struct rproc_vring - remoteproc vring state | ||
422 | * @va: virtual address | ||
423 | * @dma: dma address | ||
424 | * @len: length, in bytes | ||
425 | * @da: device address | ||
426 | * @notifyid: rproc-specific unique vring index | ||
427 | * @rvdev: remote vdev | ||
428 | * @vq: the virtqueue of this vring | ||
429 | */ | ||
430 | struct rproc_vring { | ||
431 | void *va; | ||
432 | dma_addr_t dma; | ||
433 | int len; | ||
434 | u32 da; | ||
435 | int notifyid; | ||
411 | struct rproc_vdev *rvdev; | 436 | struct rproc_vdev *rvdev; |
437 | struct virtqueue *vq; | ||
412 | }; | 438 | }; |
413 | 439 | ||
414 | /** | 440 | /** |
415 | * struct rproc_vdev - remoteproc state for a supported virtio device | 441 | * struct rproc_vdev - remoteproc state for a supported virtio device |
442 | * @node: list node | ||
416 | * @rproc: the rproc handle | 443 | * @rproc: the rproc handle |
417 | * @vdev: the virio device | 444 | * @vdev: the virio device |
418 | * @vq: the virtqueues for this vdev | ||
419 | * @vring: the vrings for this vdev | 445 | * @vring: the vrings for this vdev |
420 | * @dfeatures: virtio device features | 446 | * @dfeatures: virtio device features |
421 | * @gfeatures: virtio guest features | 447 | * @gfeatures: virtio guest features |
422 | */ | 448 | */ |
423 | struct rproc_vdev { | 449 | struct rproc_vdev { |
450 | struct list_head node; | ||
424 | struct rproc *rproc; | 451 | struct rproc *rproc; |
425 | struct virtio_device vdev; | 452 | struct virtio_device vdev; |
426 | struct virtqueue *vq[2]; | 453 | struct rproc_vring vring[RVDEV_NUM_VRINGS]; |
427 | struct rproc_mem_entry vring[2]; | ||
428 | unsigned long dfeatures; | 454 | unsigned long dfeatures; |
429 | unsigned long gfeatures; | 455 | unsigned long gfeatures; |
430 | }; | 456 | }; |
@@ -442,9 +468,14 @@ int rproc_unregister(struct rproc *rproc); | |||
442 | int rproc_boot(struct rproc *rproc); | 468 | int rproc_boot(struct rproc *rproc); |
443 | void rproc_shutdown(struct rproc *rproc); | 469 | void rproc_shutdown(struct rproc *rproc); |
444 | 470 | ||
471 | static inline struct rproc_vdev *vdev_to_rvdev(struct virtio_device *vdev) | ||
472 | { | ||
473 | return container_of(vdev, struct rproc_vdev, vdev); | ||
474 | } | ||
475 | |||
445 | static inline struct rproc *vdev_to_rproc(struct virtio_device *vdev) | 476 | static inline struct rproc *vdev_to_rproc(struct virtio_device *vdev) |
446 | { | 477 | { |
447 | struct rproc_vdev *rvdev = container_of(vdev, struct rproc_vdev, vdev); | 478 | struct rproc_vdev *rvdev = vdev_to_rvdev(vdev); |
448 | 479 | ||
449 | return rvdev->rproc; | 480 | return rvdev->rproc; |
450 | } | 481 | } |