Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 296009
b: refs/heads/master
c: 63140e0
h: refs/heads/master
i:
  296007: 19264e7
v: v3
  • Loading branch information
Ohad Ben-Cohen committed Mar 6, 2012
1 parent feaa07d commit 3e774e6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 55f34080d99be0ac75122a27e7b151c76a5b070d
refs/heads/master: 63140e0ed2e69bdafe62bc19fd6551d9213f80a7
12 changes: 7 additions & 5 deletions trunk/drivers/remoteproc/remoteproc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,15 @@ __rproc_handle_vring(struct rproc_vdev *rvdev, struct fw_rsc_vdev *rsc, int i)
return -EINVAL;
}

/* the firmware must provide the expected queue size */
if (!vring->num) {
dev_err(dev, "invalid qsz (%d)\n", vring->num);
/* verify queue size and vring alignment are sane */
if (!vring->num || !vring->align) {
dev_err(dev, "invalid qsz (%d) or alignment (%d)\n",
vring->num, vring->align);
return -EINVAL;
}

/* actual size of vring (in bytes) */
size = PAGE_ALIGN(vring_size(vring->num, AMP_VRING_ALIGN));
size = PAGE_ALIGN(vring_size(vring->num, vring->align));

if (!idr_pre_get(&rproc->notifyids, GFP_KERNEL)) {
dev_err(dev, "idr_pre_get failed\n");
Expand Down Expand Up @@ -340,6 +341,7 @@ __rproc_handle_vring(struct rproc_vdev *rvdev, struct fw_rsc_vdev *rsc, int i)
dma, size, notifyid);

rvdev->vring[i].len = vring->num;
rvdev->vring[i].align = vring->align;
rvdev->vring[i].va = va;
rvdev->vring[i].dma = dma;
rvdev->vring[i].notifyid = notifyid;
Expand All @@ -354,7 +356,7 @@ static void __rproc_free_vrings(struct rproc_vdev *rvdev, int i)

for (i--; i > 0; i--) {
struct rproc_vring *rvring = &rvdev->vring[i];
int size = PAGE_ALIGN(vring_size(rvring->len, AMP_VRING_ALIGN));
int size = PAGE_ALIGN(vring_size(rvring->len, rvring->align));

dma_free_coherent(rproc->dev, size, rvring->va, rvring->dma);
idr_remove(&rproc->notifyids, rvring->notifyid);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/remoteproc/remoteproc_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static struct virtqueue *rp_find_vq(struct virtio_device *vdev,
* Create the new vq, and tell virtio we're not interested in
* the 'weak' smp barriers, since we're talking with a real device.
*/
vq = vring_new_virtqueue(len, AMP_VRING_ALIGN, vdev, false, addr,
vq = vring_new_virtqueue(len, rvring->align, vdev, false, addr,
rproc_virtio_notify, callback, name);
if (!vq) {
dev_err(rproc->dev, "vring_new_virtqueue %s failed\n", name);
Expand Down
9 changes: 2 additions & 7 deletions trunk/include/linux/remoteproc.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@
#include <linux/completion.h>
#include <linux/idr.h>

/*
* The alignment between the consumer and producer parts of the vring.
* Note: this is part of the "wire" protocol. If you change this, you need
* to update your peers too.
*/
#define AMP_VRING_ALIGN (4096)

/**
* struct resource_table - firmware resource table header
* @ver: version number
Expand Down Expand Up @@ -423,6 +416,7 @@ struct rproc {
* @dma: dma address
* @len: length, in bytes
* @da: device address
* @align: vring alignment
* @notifyid: rproc-specific unique vring index
* @rvdev: remote vdev
* @vq: the virtqueue of this vring
Expand All @@ -432,6 +426,7 @@ struct rproc_vring {
dma_addr_t dma;
int len;
u32 da;
u32 align;
int notifyid;
struct rproc_vdev *rvdev;
struct virtqueue *vq;
Expand Down

0 comments on commit 3e774e6

Please sign in to comment.