From patchwork Fri Mar 8 22:41:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tivy, Robert" X-Patchwork-Id: 2240521 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by patchwork2.kernel.org (Postfix) with ESMTP id 906C9DF215 for ; Fri, 8 Mar 2013 22:48:59 +0000 (UTC) Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r28Mj7rp015433; Fri, 8 Mar 2013 16:45:07 -0600 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r28Mj7dV030351; Fri, 8 Mar 2013 16:45:07 -0600 Received: from dlelxv24.itg.ti.com (172.17.1.199) by dfle72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.1.323.3; Fri, 8 Mar 2013 16:45:07 -0600 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv24.itg.ti.com (8.13.8/8.13.8) with ESMTP id r28Mj7hH005327; Fri, 8 Mar 2013 16:45:07 -0600 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 031FC80664; Fri, 8 Mar 2013 16:45:03 -0600 (CST) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dlelxv30.itg.ti.com (dlelxv30.itg.ti.com [172.17.2.17]) by linux.omap.com (Postfix) with ESMTP id 1267380628 for ; Fri, 8 Mar 2013 16:43:58 -0600 (CST) Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r28MhwxI026894; Fri, 8 Mar 2013 16:43:58 -0600 Received: from dlelxv24.itg.ti.com (172.17.1.199) by dfle73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.1.323.3; Fri, 8 Mar 2013 16:43:57 -0600 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlelxv24.itg.ti.com (8.13.8/8.13.8) with ESMTP id r28MhvEf003108; Fri, 8 Mar 2013 16:43:57 -0600 Received: from sanblnx02.sanb.design.ti.com (sanblnx02.sanb.design.ti.com [146.252.160.81]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id r28MhuV16999; Fri, 8 Mar 2013 16:43:57 -0600 (CST) Received: from sanblnx02.sanb.design.ti.com (localhost [127.0.0.1]) by sanblnx02.sanb.design.ti.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id r28MhthW004395; Fri, 8 Mar 2013 14:43:55 -0800 Received: (from a0783933@localhost) by sanblnx02.sanb.design.ti.com (8.13.6/8.13.6/Submit) id r28Mhtcr004392; Fri, 8 Mar 2013 14:43:55 -0800 From: Robert Tivy To: , , , , , , , , Subject: [PATCH v8 2/7] Allow "all virtqueues" processing in rproc_vq_interrupt() Date: Fri, 8 Mar 2013 14:41:43 -0800 Message-ID: <1362782508-3166-3-git-send-email-rtivy@ti.com> X-Mailer: git-send-email 1.7.9.4 In-Reply-To: <1362782508-3166-1-git-send-email-rtivy@ti.com> References: <1362782508-3166-1-git-send-email-rtivy@ti.com> MIME-Version: 1.0 X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com Add support to rproc_vq_interrupt() for a notifyid of -1 which will cause all valid virtqueues to be processed. Signed-off-by: Robert Tivy --- drivers/remoteproc/remoteproc_virtio.c | 34 ++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c index 9e198e5..07fa6cb 100644 --- a/drivers/remoteproc/remoteproc_virtio.c +++ b/drivers/remoteproc/remoteproc_virtio.c @@ -41,6 +41,21 @@ static void rproc_virtio_notify(struct virtqueue *vq) rproc->ops->kick(rproc, notifyid); } +/* processing function when iterating all virtqueues */ +static int rproc_vring_interrupt(int id, void *p, void *data) +{ + struct rproc_vring *rvring = (struct rproc_vring *)p; + irqreturn_t *retp = (irqreturn_t *)data; + + if (!rvring->vq) + return 0; + + if (vring_interrupt(0, rvring->vq) == IRQ_HANDLED) + *retp = IRQ_HANDLED; + + return 0; +} + /** * rproc_vq_interrupt() - tell remoteproc that a virtqueue is interrupted * @rproc: handle to the remote processor @@ -52,18 +67,29 @@ static void rproc_virtio_notify(struct virtqueue *vq) * * Returns IRQ_NONE if no message was found in the @notifyid virtqueue, * and otherwise returns IRQ_HANDLED. + * + * A @notifyid value of -1 can be passed in order to signal all available + * virtqueues for this @rproc. In this case this function returns IRQ_HANDLED + * if any virtqueue contained a message, and IRQ_NONE if none of them did. */ irqreturn_t rproc_vq_interrupt(struct rproc *rproc, int notifyid) { struct rproc_vring *rvring; + irqreturn_t ret = IRQ_NONE; dev_dbg(&rproc->dev, "vq index %d is interrupted\n", notifyid); - rvring = idr_find(&rproc->notifyids, notifyid); - if (!rvring || !rvring->vq) - return IRQ_NONE; + if (notifyid >= 0) { + rvring = idr_find(&rproc->notifyids, notifyid); + if (!rvring || !rvring->vq) + return IRQ_NONE; - return vring_interrupt(0, rvring->vq); + return vring_interrupt(0, rvring->vq); + } else { + idr_for_each(&rproc->notifyids, rproc_vring_interrupt, &ret); + } + + return ret; } EXPORT_SYMBOL(rproc_vq_interrupt);