[RFCv2 03/11] remoteproc: Set vring addresses in resource table

Sjur Brændeland
2012-12-14T16:07:32Z

Set the vring addresses in the resource table so that
the remote device can read the actual addresses used.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
---
drivers/remoteproc/remoteproc_core.c | 5 +++++
include/linux/remoteproc.h | 2 ++
2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 7d593a1..151e138 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -238,6 +238,8 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i)
rvring->dma = dma;
rvring->notifyid = notifyid;

+ rvdev->rsc->vring[i].da = dma;
+ rvdev->rsc->vring[i].notifyid = notifyid;
return 0;
}

@@ -365,6 +367,9 @@ static int rproc_handle_vdev(struct rproc *rproc, struct fw_rsc_vdev *rsc,
/* remember the device features */
rvdev->dfeatures = rsc->dfeatures;

+ /* remember the resource entry */
+ rvdev->rsc = rsc;
+
list_add_tail(&rvdev->node, &rproc->rvdevs);

/* it is now safe to add the virtio device */
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
index faf3332..cdacd66 100644
--- a/include/linux/remoteproc.h
+++ b/include/linux/remoteproc.h
@@ -464,6 +464,7 @@ struct rproc_vring {
* @vring: the vrings for this vdev
* @dfeatures: virtio device features
* @gfeatures: virtio guest features
+ * @rsc: vdev resource entry
*/
struct rproc_vdev {
struct list_head node;
@@ -472,6 +473,7 @@ struct rproc_vdev {
struct rproc_vring vring[RVDEV_NUM_VRINGS];
unsigned long dfeatures;
unsigned long gfeatures;
+ struct fw_rsc_vdev *rsc;
};

struct rproc *rproc_alloc(struct device *dev, const char *name,
--
1.7.5.4