Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4636134yba; Tue, 30 Apr 2019 01:37:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfv+9N8ttlbjnkiw8tTzgKEJosMsCfvI/y2hkUqhOj/1KlT1g4OPU+wn2AHOa8/M0tRsae X-Received: by 2002:a63:5012:: with SMTP id e18mr63654370pgb.383.1556613438343; Tue, 30 Apr 2019 01:37:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556613438; cv=none; d=google.com; s=arc-20160816; b=bfvUH3BZNRrnJdj0Cqk1eTGE/BjiDavV6Zhkxh7ON3bZHVbMFygBUr/fOnJ0tZN41e E35T7H6hAn30mBZJ8SOliDPVuoIzoHSbyDJ10dsC6fFcNHIqJM+LangmjjEu9BWDWp6E nxspH25nMA68epdS/JHuRbvn8YFNuIS0rQaxtJPsRPjiYzv/YwWC6ZnibpO1/wqtVlMu kTCrxqIfgwiUIcCT8Qr3097O6tuaMvsAe6LHDLUXQfgj3PFVlTQQ67o84ZeU3pW0JcHz NAkyZgwK0VFnc5KsWFBet1bcFAjX3+I5eTOpx6NvRU8fYe+dIFPcXRQzpv+fppiL4yyD JB7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=UZ329GyIEsSH86qncBprYdF1JcDUL5kLIJqmaDT3rzQ=; b=v52VXrQoJT941XxAKFoI09CAG9iignZ1Ui8uUrMww3h2p0757gn/UijLotxBg3ALXF awAUbY8lsI4VTFFHkCQ60oJTYI2NCWGMUFLVoTyak18tucaVja4qbuNq0VSWHwnOOuqz yiTI96Ze+vB6VQYj/1vcMy294Whd9zjGKOPZOKFJPXVLmNTi0ENbm26p5Yq9NbkmUF/B jcBZKK219ocApNoSmmxoWK4Y+W/C57zcTiZsh5dgBtu+tw0DdMxnNEW6YgqNd48hcsN7 cOMcHDusBd20ebojQB0om0e2MkSn11CB3xVS2amdj6hB/bUq6I8fIKPMHDgDvRGzvjAB TPmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qn8YUxP+; 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 h19si3612420pgg.125.2019.04.30.01.37.03; Tue, 30 Apr 2019 01:37:18 -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=Qn8YUxP+; 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 S1726586AbfD3Ieb (ORCPT + 99 others); Tue, 30 Apr 2019 04:34:31 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:42151 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726012AbfD3Ieb (ORCPT ); Tue, 30 Apr 2019 04:34:31 -0400 Received: by mail-ot1-f68.google.com with SMTP id f23so11143198otl.9 for ; Tue, 30 Apr 2019 01:34:31 -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; bh=UZ329GyIEsSH86qncBprYdF1JcDUL5kLIJqmaDT3rzQ=; b=Qn8YUxP+ZhVtL4H5Tg01cFzY9lparaT1kR+QUgl1M+fY2c3Na9oA71UHk7SH6X81lk WMBfwdbngo5K3dulsT2G5YBhIWc1F/IOG+IkuWiBsZeidf1YRjXwOki5CzGCqhGoOANV kJYjj365IUVuV/qo/q1sJKnFcqxxBePkiQIQ6CTKxHIwX88V+wc7z0m3N2id7ookKqn8 W1FPpD+mn3bPaLeQDtvXu34k/H/d6SVy5W2K6UeiTlwGHNne4qQSlcXOnak2TtrcYOSj DYStGb2IOn3YmrOdBFS0yjlZByw0WODQpJEmVa7XjUMAhMC/NSji9ZPXDbbeJAsBYkIK +xXw== 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; bh=UZ329GyIEsSH86qncBprYdF1JcDUL5kLIJqmaDT3rzQ=; b=UNHMI98CkTgRNB7x5Ava8WtYptmo4iXyEWQzw4EbiuDsZfwj7oBmyj9ghn1n40GYOd qlhXgZKEa8CSrJIu0uZg3MC3TC6ci6x0rhOsgXTa4JkdU/+H4YAteH7vZ5qAsSJ9oe/a IYLzcj7tdrjlRgnRay0N2FCmGzoSLKVQHPkXCFP1IEudZR/nF+hzkk8BaaDveqfZ4SBd 1cD8plSi0F58TrRktjsdnBHA7QTt/JIC++0wOrMWfy7rGgt2cut4ggcJfPBJEYOepn+J 8bI6bhi9StkwxpbkFX/irOjgwkg4iNs7UU/JBZknkflUvRTmyH0yqJOtRY7TpjryPhj1 yY6g== X-Gm-Message-State: APjAAAUdS6pqvOGpZrDUtrXriFjN5fTlP0MMSbbIkP3+kogNlzInZjSG R6HiLtFLJ1jXmnNGoyb5tDZuySPSoSBk1rx5cfJMUw== X-Received: by 2002:a9d:7399:: with SMTP id j25mr13905907otk.277.1556613270536; Tue, 30 Apr 2019 01:34:30 -0700 (PDT) MIME-Version: 1.0 References: <20190429115723.GK3845@vkoul-mobl.Dlink> <20190429140537.GN3845@vkoul-mobl.Dlink> <20190430082954.GQ3845@vkoul-mobl.Dlink> In-Reply-To: <20190430082954.GQ3845@vkoul-mobl.Dlink> From: Baolin Wang Date: Tue, 30 Apr 2019 16:34:19 +0800 Message-ID: Subject: Re: [PATCH 4/7] dmaengine: sprd: Add device validation to support multiple controllers To: Vinod Koul Cc: Dan Williams , eric.long@unisoc.com, Orson Zhai , Chunyan Zhang , Mark Brown , dmaengine@vger.kernel.org, LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 30 Apr 2019 at 16:30, Vinod Koul wrote: > > On 30-04-19, 13:30, Baolin Wang wrote: > > On Mon, 29 Apr 2019 at 22:05, Vinod Koul wrote: > > > > > > On 29-04-19, 20:20, Baolin Wang wrote: > > > > On Mon, 29 Apr 2019 at 19:57, Vinod Koul wrote: > > > > > > > > > > On 15-04-19, 20:14, Baolin Wang wrote: > > > > > > From: Eric Long > > > > > > > > > > > > Since we can support multiple DMA engine controllers, we should add > > > > > > device validation in filter function to check if the correct controller > > > > > > to be requested. > > > > > > > > > > > > Signed-off-by: Eric Long > > > > > > Signed-off-by: Baolin Wang > > > > > > --- > > > > > > drivers/dma/sprd-dma.c | 5 +++++ > > > > > > 1 file changed, 5 insertions(+) > > > > > > > > > > > > diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c > > > > > > index 0f92e60..9f99d4b 100644 > > > > > > --- a/drivers/dma/sprd-dma.c > > > > > > +++ b/drivers/dma/sprd-dma.c > > > > > > @@ -1020,8 +1020,13 @@ static void sprd_dma_free_desc(struct virt_dma_desc *vd) > > > > > > static bool sprd_dma_filter_fn(struct dma_chan *chan, void *param) > > > > > > { > > > > > > struct sprd_dma_chn *schan = to_sprd_dma_chan(chan); > > > > > > + struct of_phandle_args *dma_spec = > > > > > > + container_of(param, struct of_phandle_args, args[0]); > > > > > > u32 slave_id = *(u32 *)param; > > > > > > > > > > > > + if (chan->device->dev->of_node != dma_spec->np) > > > > > > > > > > Are you not using of_dma_find_controller() that does this, so this would > > > > > be useless! > > > > > > > > Yes, we can use of_dma_find_controller(), but that will be a little > > > > complicated than current solution. Since we need introduce one > > > > structure to save the node to validate in the filter function like > > > > below, which seems make things complicated. But if you still like to > > > > use of_dma_find_controller(), I can change to use it in next version. > > > > > > Sorry I should have clarified more.. > > > > > > of_dma_find_controller() is called by xlate, so you already run this > > > check, so why use this :) > > > > The of_dma_find_controller() can save the requested device node into > > dma_spec, and in the of_dma_simple_xlate() function, it will call > > dma_request_channel() to request one channel, but it did not validate > > the device node to find the corresponding dma device in > > dma_request_channel(). So we should in our filter function to validate > > the device node with the device node specified by the dma_spec. Hope I > > make things clear. > > But dma_request_channel() calls of_dma_request_slave_channel() which > invokes of_dma_find_controller() why is it broken for you if that is the > case.. No,the calling process should be: dma_request_slave_channel() --->dma_request_chan()--->of_dma_request_slave_channel()---->of_dma_simple_xlate() ----> dma_request_channel(). -- Baolin Wang Best Regards