summaryrefslogtreecommitdiff
path: root/include/linux/remoteproc.h
diff options
context:
space:
mode:
authorOhad Ben-Cohen <ohad@wizery.com>2012-02-14 01:30:39 +0400
committerOhad Ben-Cohen <ohad@wizery.com>2012-03-06 21:14:12 +0400
commit7a186941626d19f668b08108db158379b32e6e02 (patch)
treed478210fa3ae45ef8b3eaf6a6432eadc49cbb55a /include/linux/remoteproc.h
parent41a6ee09ee8dd7ac3a6ac12a24e26279b5d93385 (diff)
downloadlinux-7a186941626d19f668b08108db158379b32e6e02.tar.xz
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/remoteproc.h')
-rw-r--r--include/linux/remoteproc.h41
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 @@
#include <linux/mutex.h>
#include <linux/virtio.h>
#include <linux/completion.h>
+#include <linux/idr.h>
/*
* The alignment between the consumer and producer parts of the vring.
@@ -387,7 +388,8 @@ enum rproc_state {
* @mappings: list of iommu mappings we initiated, needed on shutdown
* @firmware_loading_complete: marks e/o asynchronous firmware loading
* @bootaddr: address of first instruction to boot rproc with (optional)
- * @rvdev: virtio device (we only support a single rpmsg virtio device for now)
+ * @rvdevs: list of remote virtio devices
+ * @notifyids: idr for dynamically assigning rproc-wide unique notify ids
*/
struct rproc {
struct klist_node node;
@@ -408,23 +410,47 @@ struct rproc {
struct list_head mappings;
struct completion firmware_loading_complete;
u32 bootaddr;
+ struct list_head rvdevs;
+ struct idr notifyids;
+};
+
+/* we currently support only two vrings per rvdev */
+#define RVDEV_NUM_VRINGS 2
+
+/**
+ * struct rproc_vring - remoteproc vring state
+ * @va: virtual address
+ * @dma: dma address
+ * @len: length, in bytes
+ * @da: device address
+ * @notifyid: rproc-specific unique vring index
+ * @rvdev: remote vdev
+ * @vq: the virtqueue of this vring
+ */
+struct rproc_vring {
+ void *va;
+ dma_addr_t dma;
+ int len;
+ u32 da;
+ int notifyid;
struct rproc_vdev *rvdev;
+ struct virtqueue *vq;
};
/**
* struct rproc_vdev - remoteproc state for a supported virtio device
+ * @node: list node
* @rproc: the rproc handle
* @vdev: the virio device
- * @vq: the virtqueues for this vdev
* @vring: the vrings for this vdev
* @dfeatures: virtio device features
* @gfeatures: virtio guest features
*/
struct rproc_vdev {
+ struct list_head node;
struct rproc *rproc;
struct virtio_device vdev;
- struct virtqueue *vq[2];
- struct rproc_mem_entry vring[2];
+ struct rproc_vring vring[RVDEV_NUM_VRINGS];
unsigned long dfeatures;
unsigned long gfeatures;
};
@@ -442,9 +468,14 @@ int rproc_unregister(struct rproc *rproc);
int rproc_boot(struct rproc *rproc);
void rproc_shutdown(struct rproc *rproc);
+static inline struct rproc_vdev *vdev_to_rvdev(struct virtio_device *vdev)
+{
+ return container_of(vdev, struct rproc_vdev, vdev);
+}
+
static inline struct rproc *vdev_to_rproc(struct virtio_device *vdev)
{
- struct rproc_vdev *rvdev = container_of(vdev, struct rproc_vdev, vdev);
+ struct rproc_vdev *rvdev = vdev_to_rvdev(vdev);
return rvdev->rproc;
}