Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1304347imm; Thu, 5 Jul 2018 20:06:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcBO7fOItlMZFGEDZmPevRpRdIu0HVB68ZkYuCweU5DvQ9rj0ip3Dge/sJOz7mQmkwk5jOb X-Received: by 2002:a62:4083:: with SMTP id f3-v6mr6343793pfd.229.1530846389004; Thu, 05 Jul 2018 20:06:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530846388; cv=none; d=google.com; s=arc-20160816; b=xqrzUSS/cd9fkw4qEEmmDjnfiNcAyG731QKEKJHamDOJegB6xn/oKZgPJWGbDe4jtC SeT+M9WbbF8VCZ4vzLeQ4FQ7YXhWDPO1wcNKmWd1Vm4wKYJJGW6IJBAM1iMcNzgTVKXE mmAmQmfMnQVvNnMjvvWIsT+066+MzVkU9m71I4rrbXgmLf4PpijEX84I5Yc5yaTs6sCE gnzY0MKNcob7xSwzWpr7j+d2q/yDA24G+Bj26ciTRBvqtfFD92YR5Ygv6q9di6Yx/p9S 8I62mnz5l2xuOIRxOJ0QFiRrweaZOgHmL1UiSYAtkTCflkWeDG7DLFu9YnH8Dl1vRxiv aISg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature:arc-authentication-results; bh=XX4KKy3Ve7bCN/yUFHtsYfMuTLdbKUv+QoByC9P+MLU=; b=QpvCuEfXfX45AHUKSF9ci7LQzYgrmcSQab2lns+Rw+hdgsI2LsCNzruVPlymcU/rSa UVNkkwTl/pQ2ZTXYA9Sn0V2EtBK2m1QA0Hvq8+qiwsx1IR8ScXZ8Ivwr7PlbXZAnDlzW 8UQ6PaF1AjegApatUWeCrGRwsTfXRz1Edi36CQDsW+87+RdnDRtI6YaHkYcWvB2vtsr6 1UbxaT0wzS8XAAVb0YfHuZoEnA49YbrRm+0P6OQu1uCsuxQ74d2+CdpKSonEvdrwlpr+ DNZRJ6TJqVlzFHMtDnt4rAAS90wWc3xS9cEc+RWMsJzW0DxG6mvqsK4OUAKt0+yH0kRP D6ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iIEdd5FC; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u7-v6si7604974pfi.96.2018.07.05.20.06.13; Thu, 05 Jul 2018 20:06:28 -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=@linaro.org header.s=google header.b=iIEdd5FC; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753902AbeGFDFe (ORCPT + 99 others); Thu, 5 Jul 2018 23:05:34 -0400 Received: from mail-yw0-f194.google.com ([209.85.161.194]:38727 "EHLO mail-yw0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753775AbeGFDFc (ORCPT ); Thu, 5 Jul 2018 23:05:32 -0400 Received: by mail-yw0-f194.google.com with SMTP id r3-v6so3699902ywc.5 for ; Thu, 05 Jul 2018 20:05:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=XX4KKy3Ve7bCN/yUFHtsYfMuTLdbKUv+QoByC9P+MLU=; b=iIEdd5FCg3Vb8NdbEbqJZGpm/trStzJ1GX1o0vWTNpZIZWGGVVHcaA4mRZnUAZi0kZ RQy4QueEX9cSEjiwbadnETLIH2ABu5uURGb5iNYvSM5OnlOZbfScKbyg+ZtUaG4Y1Nfc mXl3IWSgo7zRMKK6Ec4XHDAcHmkKErOBYlysg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=XX4KKy3Ve7bCN/yUFHtsYfMuTLdbKUv+QoByC9P+MLU=; b=R7tmUcJn/5ofVYLPF9r5NZjkIp4HAyo+22GTSnyM3Xk0UnCcHq8+sLs8p+V2Xd5KVV NrRBd0FUZXjkMqB8RpaGkzQBe7eptr5IrDawtsEL3/8d6R85GxTvLWYKRRo/ORy9cxp0 qxg3osnej6RtbpXso2qsS46zIJPug8/TBXq6PhNDzCc8qby8/72GD/vNJ15KoyARTgRi LvvkMUyCsOZPF+birVmPVW2gTBk/K71gUiG7YXuoaWEEghVwIW2e8erwre9qCUlTxaai m0/8cFiUackQbgnoaT0jBe842zpeteA8c5qyMTYxjTA4E5JBDr/Okx8WoRKkNI4V1yFb l3HA== X-Gm-Message-State: APt69E0Yd8G045qA+/go4FJ2xHCPYjJskdNzPOyFUlfqlgfv0Hf5GekH /Pn5jSGSBXYKITE4DngtFAyS/wZhevBTsByfN7Y3Sw== X-Received: by 2002:a81:5b8b:: with SMTP id p133-v6mr3929712ywb.365.1530846332004; Thu, 05 Jul 2018 20:05:32 -0700 (PDT) MIME-Version: 1.0 References: <20180622032416.20133-1-guodong.xu@linaro.org> <20180622032416.20133-3-guodong.xu@linaro.org> <20180628060239.GO22377@vkoul-mobl> In-Reply-To: <20180628060239.GO22377@vkoul-mobl> From: Guodong Xu Date: Fri, 6 Jul 2018 11:05:21 +0800 Message-ID: Subject: Re: [PATCH 2/3] k3dma: add support to reserved minimum channels To: vkoul@kernel.org Cc: Rob Herring , Mark Rutland , dan.j.williams@intel.com, liyu65@hisilicon.com, Suzhuangluan , "xuhongtao (A)" , zhongkaihua , Xuezhiliang , "xupeng (Q)" , sunliang10@huawei.com, "Fengbaopeng (kevin, Kirin Solution Dept)" , dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 28, 2018 at 2:02 PM Vinod wrote: > > 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? > Hi=EF=BC=8C Vinod Sorry for delayed response. We checked with Kirin hardware design team, so far their design strategy is all Kirin SoC series reserve only from minimum side, saying channel 0, then 1, then 2. That impacts the current SoC in upstreaming, Kirin960 (Hi3660), and next versions in Kirin SoC, Kirin970 and 980, which may hit upstream later. > I am thinking this should be a mask, rather than min. > So, since this driver k3dma.c is only used by Kirin SoC DMA controllers, I would prefer to keep the current design dma_min_chan unchanged. What do you think? -Guodong > > > > 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 =3D 0; pch < d->dma_channels; pch++) { > > + for (pch =3D d->dma_min_chan; pch < d->dma_channels; pch++) { > > p =3D &d->phy[pch]; > > > > if (p->vchan =3D=3D 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 =3D 0; pch < d->dma_channels; pch++) { > > + for (pch =3D d->dma_min_chan; pch < d->dma_channels; pch++) { > > if (pch_alloc & (1 << pch)) { > > p =3D &d->phy[pch]; > > c =3D 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 =3D devm_clk_get(&op->dev, NULL); > > @@ -848,12 +851,12 @@ static int k3_dma_probe(struct platform_device *o= p) > > return -ENOMEM; > > > > /* init phy channel */ > > - d->phy =3D devm_kcalloc(&op->dev, > > - d->dma_channels, sizeof(struct k3_dma_phy), GFP_KERNEL); > > + d->phy =3D devm_kcalloc(&op->dev, (d->dma_channels - d->dma_min_c= han), > > + sizeof(struct k3_dma_phy), GFP_KERNEL); > > if (d->phy =3D=3D NULL) > > return -ENOMEM; > > > > - for (i =3D 0; i < d->dma_channels; i++) { > > + for (i =3D d->dma_min_chan; i < d->dma_channels; i++) { > > struct k3_dma_phy *p =3D &d->phy[i]; > > > > p->idx =3D i; > > -- > > 2.17.1 > > -- > ~Vinod