[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1360496352-29482-6-git-send-email-sjur.brandeland@stericsson.com>
Date: Sun, 10 Feb 2013 12:39:08 +0100
From: sjur.brandeland@...ricsson.com
To: Ido Yariv <ido@...ery.com>, Ohad Ben-Cohen <ohad@...ery.com>
Cc: linux-kernel@...r.kernel.org,
Dmitry Tarnyagin <dmitry.tarnyagin@...ricsson.com>,
Linus Walleij <linus.walleij@...aro.org>,
Erwan Yvin <erwan.yvin@...ricsson.com>, sjur@...ndeland.net,
Sjur Brændeland <sjur.brandeland@...ricsson.com>
Subject: [PATCH 5/9] remoteproc: Set vring addresses in resource table
From: Sjur Brændeland <sjur.brandeland@...ricsson.com>
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@...ricsson.com>
---
drivers/remoteproc/remoteproc_core.c | 13 +++++++++++--
include/linux/remoteproc.h | 2 ++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index dd3bfaf..c12a385 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -207,7 +207,6 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i)
/*
* Allocate non-cacheable memory for the vring. In the future
* this call will also configure the IOMMU for us
- * TODO: let the rproc know the da of this vring
*/
va = dma_alloc_coherent(dev->parent, size, &dma, GFP_KERNEL);
if (!va) {
@@ -218,7 +217,6 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i)
/*
* Assign an rproc-wide unique index for this vring
* TODO: assign a notifyid for rvdev updates as well
- * TODO: let the rproc know the notifyid of this vring
* TODO: support predefined notifyids (via resource table)
*/
ret = idr_get_new(&rproc->notifyids, rvring, ¬ifyid);
@@ -238,6 +236,14 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i)
rvring->dma = dma;
rvring->notifyid = notifyid;
+ /*
+ * Let the rproc know the notifyid and da of this vring.
+ * Not all platforms use dma_alloc_coherent to automatically
+ * set up the iommu. In this case the device address (da) will
+ * hold the physical address and not the device address.
+ */
+ rvdev->rsc->vring[i].da = dma;
+ rvdev->rsc->vring[i].notifyid = notifyid;
return 0;
}
@@ -365,6 +371,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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists