Skip to content

Commit

Permalink
remoteproc: Update max_notifyid as we allocate vrings
Browse files Browse the repository at this point in the history
Vrings are now allocated as we parse the resource table, before we
boot the rproc or register any virtio devices, so it's safe to bump
max_notifyid as part of this process.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
  • Loading branch information
Bjorn Andersson committed Nov 15, 2016
1 parent f5bcb35 commit 48f18f8
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions drivers/remoteproc/remoteproc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i)
}
notifyid = ret;

/* Potentially bump max_notifyid */
if (notifyid > rproc->max_notifyid)
rproc->max_notifyid = notifyid;

dev_dbg(dev, "vring%d: va %p dma %pad size 0x%x idr %d\n",
i, va, &dma, size, notifyid);

Expand Down Expand Up @@ -719,15 +723,6 @@ static int rproc_handle_carveout(struct rproc *rproc,
return ret;
}

static int rproc_count_vrings(struct rproc *rproc, struct fw_rsc_vdev *rsc,
int offset, int avail)
{
/* Summarize the number of notification IDs */
rproc->max_notifyid += rsc->num_of_vrings;

return 0;
}

/*
* A lookup table for resource handlers. The indices are defined in
* enum fw_resource_type.
Expand All @@ -736,7 +731,7 @@ static rproc_handle_resource_t rproc_loading_handlers[RSC_LAST] = {
[RSC_CARVEOUT] = (rproc_handle_resource_t)rproc_handle_carveout,
[RSC_DEVMEM] = (rproc_handle_resource_t)rproc_handle_devmem,
[RSC_TRACE] = (rproc_handle_resource_t)rproc_handle_trace,
[RSC_VDEV] = (rproc_handle_resource_t)rproc_count_vrings,
[RSC_VDEV] = NULL,
};

static rproc_handle_resource_t rproc_vdev_handler[RSC_LAST] = {
Expand Down

0 comments on commit 48f18f8

Please sign in to comment.