Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp7235372imm; Wed, 27 Jun 2018 23:40:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpePN+zxz6jmpEcv8rWLKAnehPYCpyDM9xP/Ou5+vJrUF4CRHmM/zxgzbsbmo7DgZpaB17wc X-Received: by 2002:a62:8917:: with SMTP id v23-v6mr8981727pfd.127.1530168014472; Wed, 27 Jun 2018 23:40:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530168014; cv=none; d=google.com; s=arc-20160816; b=nRxC3+xsmqevNRht1RRN+pskq2dshnEBTRwDeqwhu21sdEDudful4PQCfsG9Vmy06W WIS6qaoMh+6fndxB+yE7qbBX8mNQvK1q8h+k3feevm5SPQL/pOm2w1WTSZHO4z8P3vut WcU5vAC++jU8VImjP1tszKJd4dFIYSTWc1ESQ8fjHr2IVJkq3OCjHAIW/KntR7cmyX+q Y0ABomoSnddY7Q2XtlGkTTeDp3KVCMVHEY0oDvkxrrVcD0Wx3xlMtyCwzfl/bEeYEZgf QVjUBL/ZYokznimQXhHn6Cy+9DEIkCymg4SCMwvDkSILA/z6TlS4cSZ9Bk+ofwrm8HbS wmkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=Em7EK1cn4Ucs/z8doY9wSlFj8H8CwFuOwV4lqPPht1U=; b=sWyFQb55C8rAZUBwUVIUZVyW5NJ1c5agxT6NmAvlTQS1Ym6nvGEcXUtxESQWQ62pRl PMSRpqODfa2yddmTyt8V6eSetquM62TDp89c50CZd65vOp8OfbSsiGoOnVAgqQOnfbMo 2qyRdtyz0DbIbj6PkfH8ZkP7rQHjj0TbHttHAYfuqbdmyyeBlzZAQj4XPMeW9MecqljL x/G4Ja3FA08Jb80xBXYulyAmeol+reSV+gvCAwoTnhMkL8RafhlMrRKdHAapp6Ix9C3H hBdtX0rGOjPipp5uUE8xwYogQlqzcCAeaTnwa7uQmszm3R0swjFcwm+gR0VFd2Kskg41 sLeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2MhAvmj6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g6-v6si5568730pfh.346.2018.06.27.23.40.00; Wed, 27 Jun 2018 23:40:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2MhAvmj6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753518AbeF1GCu (ORCPT + 99 others); Thu, 28 Jun 2018 02:02:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:40912 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752057AbeF1GCs (ORCPT ); Thu, 28 Jun 2018 02:02:48 -0400 Received: from localhost (unknown [106.201.104.231]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CFB9E26F95; Thu, 28 Jun 2018 06:02:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1530165767; bh=JH/trfOmwWXtbtnGwza9EiSUWVKgrqTyh5G+0L0DqIg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=2MhAvmj6szf8nYWh768dvCh1JVCbaBgn7z98lQpeIQidcURztObMCj+PUfXIj0pPI yW19a85EhCFiHY909jy8sdpeqMmseQYo9ETP00fBio0z/5GPcGc5vr865kCO7NkmXP E05MEkh8S9cqYPX0zRxnEcVN/exvli8vF/ucZDTY= Date: Thu, 28 Jun 2018 11:32:39 +0530 From: Vinod To: Guodong Xu Cc: robh+dt@kernel.org, mark.rutland@arm.com, dan.j.williams@intel.com, liyu65@hisilicon.com, suzhuangluan@hisilicon.com, xuhongtao8@hisilicon.com, zhongkaihua@huawei.com, xuezhiliang@hisilicon.com, xupeng7@huawei.com, sunliang10@huawei.com, fengbaopeng@hisilicon.com, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] k3dma: add support to reserved minimum channels Message-ID: <20180628060239.GO22377@vkoul-mobl> References: <20180622032416.20133-1-guodong.xu@linaro.org> <20180622032416.20133-3-guodong.xu@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180622032416.20133-3-guodong.xu@linaro.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22-06-18, 11:24, Guodong Xu wrote: > From: Li Yu > > On k3 series of SoC, DMA controller reserves some channels for > other on-chip coprocessors. By adding support to dma_min_chan, kernel > will not be able to use these reserved channels. > > One example is on Hi3660 platform, channel 0 is reserved to lpm3. > > Please also refer to Documentation/devicetree/bindings/dma/k3dma.txt and if some other platform has channel X marked for co-processor, maybe a last channel or something in middle, how will this work then? I am thinking this should be a mask, rather than min. > > Signed-off-by: Li Yu > Signed-off-by: Guodong Xu > --- > drivers/dma/k3dma.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c > index fa31cccbe04f..13cec12742e3 100644 > --- a/drivers/dma/k3dma.c > +++ b/drivers/dma/k3dma.c > @@ -113,6 +113,7 @@ struct k3_dma_dev { > struct dma_pool *pool; > u32 dma_channels; > u32 dma_requests; > + u32 dma_min_chan; > unsigned int irq; > }; > > @@ -309,7 +310,7 @@ static void k3_dma_tasklet(unsigned long arg) > > /* check new channel request in d->chan_pending */ > spin_lock_irq(&d->lock); > - for (pch = 0; pch < d->dma_channels; pch++) { > + for (pch = d->dma_min_chan; pch < d->dma_channels; pch++) { > p = &d->phy[pch]; > > if (p->vchan == NULL && !list_empty(&d->chan_pending)) { > @@ -326,7 +327,7 @@ static void k3_dma_tasklet(unsigned long arg) > } > spin_unlock_irq(&d->lock); > > - for (pch = 0; pch < d->dma_channels; pch++) { > + for (pch = d->dma_min_chan; pch < d->dma_channels; pch++) { > if (pch_alloc & (1 << pch)) { > p = &d->phy[pch]; > c = p->vchan; > @@ -825,6 +826,8 @@ static int k3_dma_probe(struct platform_device *op) > "dma-channels", &d->dma_channels); > of_property_read_u32((&op->dev)->of_node, > "dma-requests", &d->dma_requests); > + of_property_read_u32((&op->dev)->of_node, > + "dma-min-chan", &d->dma_min_chan); > } > > d->clk = devm_clk_get(&op->dev, NULL); > @@ -848,12 +851,12 @@ static int k3_dma_probe(struct platform_device *op) > return -ENOMEM; > > /* init phy channel */ > - d->phy = devm_kcalloc(&op->dev, > - d->dma_channels, sizeof(struct k3_dma_phy), GFP_KERNEL); > + d->phy = devm_kcalloc(&op->dev, (d->dma_channels - d->dma_min_chan), > + sizeof(struct k3_dma_phy), GFP_KERNEL); > if (d->phy == NULL) > return -ENOMEM; > > - for (i = 0; i < d->dma_channels; i++) { > + for (i = d->dma_min_chan; i < d->dma_channels; i++) { > struct k3_dma_phy *p = &d->phy[i]; > > p->idx = i; > -- > 2.17.1 -- ~Vinod