From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756167AbbCCME5 (ORCPT ); Tue, 3 Mar 2015 07:04:57 -0500 Received: from mail-pd0-f178.google.com ([209.85.192.178]:40970 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755235AbbCCME4 (ORCPT ); Tue, 3 Mar 2015 07:04:56 -0500 From: Barry Song <21cnbao@gmail.com> To: ohad@wizery.com, rusty@rustcorp.com.au, mst@redhat.com, linux-kernel@vger.kernel.org Cc: workgroup.linux@csr.com, Wei Chen , Barry Song Subject: [PATCH 1/2] drivers:remoteproc:support predefined vq notifyid Date: Tue, 3 Mar 2015 20:02:45 +0800 Message-Id: <1425384165-4684-1-git-send-email-21cnbao@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wei Chen In current rproc use scenario, the vq notifyid will be allocated by Linux, and write back this notifyid to RSC table to tell DSP. But in some scenarios, we might meet the DSP predefined the vq notifyid. In these scenarios, the rproc have to read predefined vq notifyid from RSC table, and then request a same notifyid in Linux side. Signed-off-by: Wei Chen Signed-off-by: Barry Song --- drivers/remoteproc/remoteproc_core.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 3cd85a6..f9709b6 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -197,7 +197,7 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i) struct fw_rsc_vdev *rsc; dma_addr_t dma; void *va; - int ret, size, notifyid; + int ret, size, notifyid, pre_nid; /* actual size of vring (in bytes) */ size = PAGE_ALIGN(vring_size(rvring->len, rvring->align)); @@ -213,11 +213,16 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i) } /* + * read predefined notifyids (via resource table) + */ + rsc = (void *)rproc->table_ptr + rvdev->rsc_offset; + pre_nid = rsc->vring[i].notifyid; + + /* * Assign an rproc-wide unique index for this vring * TODO: assign a notifyid for rvdev updates as well - * TODO: support predefined notifyids (via resource table) */ - ret = idr_alloc(&rproc->notifyids, rvring, 0, 0, GFP_KERNEL); + ret = idr_alloc(&rproc->notifyids, rvring, pre_nid, 0, GFP_KERNEL); if (ret < 0) { dev_err(dev, "idr_alloc failed: %d\n", ret); dma_free_coherent(dev->parent, size, va, dma); @@ -238,9 +243,10 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i) * set up the iommu. In this case the device address (da) will * hold the physical address and not the device address. */ - rsc = (void *)rproc->table_ptr + rvdev->rsc_offset; rsc->vring[i].da = dma; - rsc->vring[i].notifyid = notifyid; + /* If notifyid is not predefined, write back to rsc */ + if (!pre_nid) + rsc->vring[i].notifyid = notifyid; return 0; } -- 1.9.1