Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6428539imu; Mon, 21 Jan 2019 08:44:53 -0800 (PST) X-Google-Smtp-Source: ALg8bN5yZKZl+OzTS6zZxUKVnOoayrPeuvKKsVHbLPV6vQFaNWHVsH/h3sfBrR8YHRZnmIJ1pGie X-Received: by 2002:a65:51ca:: with SMTP id i10mr28015891pgq.371.1548089093364; Mon, 21 Jan 2019 08:44:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548089093; cv=none; d=google.com; s=arc-20160816; b=YJh85Z7sJqv00bGMf0RwbwOFD6B5RLLuB9Ew7pe0YlV/eKi9Lbd8446BJoCkwli7IW NpN9iQQmL55co2v9wE0E+3mlSga6RJKkCiJIC6k4C+pCA7zYq/RVRKz12+gdI689vxXG D+fwvOiGAzwzpHkqyGfN8vAVovx3ymWAPny0B+4AGEuh61x583V7+0VItJsyc/BRc2p+ WLbSwAt4iEXmnCs1F/d6I59C6fNokjzIYJkvdWuT7tVhtWyaEdFnoiYk79Xt/jLJLKM4 hbwKXD8DkfWER4q7o6dQV5cZ0q5HNLwfmIdVjI20pXO6RaIManSuXSI9tlXheF+Iy7Qr w14A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:mime-version :message-id:date:subject:cc:reply-to:to:from:dkim-signature; bh=f8zUWP11okN8Bu0QBfuGf74LiUIIfzFAx139RdKcFUU=; b=PU66S7KmGMmOoPIXAlxxLh5BAWRj5eCQvEqz/xAqDiww2wL+C9bvLK2DQho2ZzhbFc yW0VQcTq3kL5YtICyEO59Gv8pipOGRTzlxaxwIbc3vH/sESdId+LfSCyxW5r0MsGe7KE GPh1jBfaPbLEyZJJfKWzL2gv///fUd/NDutca89w5Z28DDGowlqUHT4zDYICj0y8LIq4 blPx5UsI6A0UdajDkWPWg+3lXEsWUUTfuXNwG3yRW+DPZwfJC0v1xho9BgOmSTi5D4tB gfXTAIRjf/yvKFwuIE2xcoCFbScGJVUx4fnN5hieFA2Ly+sIzWEjPMHX/LCceo2nG3oT Y7Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cern.onmicrosoft.com header.s=selector1-cern-ch header.b=PuUeoSxz; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d17si13462519pgl.484.2019.01.21.08.44.36; Mon, 21 Jan 2019 08:44:53 -0800 (PST) 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=@cern.onmicrosoft.com header.s=selector1-cern-ch header.b=PuUeoSxz; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730568AbfAUQmK (ORCPT + 99 others); Mon, 21 Jan 2019 11:42:10 -0500 Received: from mail-eopbgr130055.outbound.protection.outlook.com ([40.107.13.55]:20608 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729075AbfAUQmI (ORCPT ); Mon, 21 Jan 2019 11:42:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cern.onmicrosoft.com; s=selector1-cern-ch; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=f8zUWP11okN8Bu0QBfuGf74LiUIIfzFAx139RdKcFUU=; b=PuUeoSxzzwGrkXvhHR4+vaI8lDm4z90fZdHPu5cSSpHSQiKH7fbPeQvIaKKUWEjlaxabWpOYNk0K/yjTjDTjGy82p4lSdFWcqBV9IqRSOCncgSbYbR1hSELqQIg3ruzRn5od23zseJ0EZMx0pB6oGkuJiVw/NNBAASwchBcF4YM= Received: from VI1PR0602CA0013.eurprd06.prod.outlook.com (2603:10a6:800:bc::23) by HE1PR06MB4009.eurprd06.prod.outlook.com (2603:10a6:7:9c::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1537.30; Mon, 21 Jan 2019 16:42:02 +0000 Received: from VE1EUR02FT038.eop-EUR02.prod.protection.outlook.com (2a01:111:f400:7e06::202) by VI1PR0602CA0013.outlook.office365.com (2603:10a6:800:bc::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1537.26 via Frontend Transport; Mon, 21 Jan 2019 16:42:02 +0000 Authentication-Results: spf=pass (sender IP is 188.184.36.50) smtp.mailfrom=cern.ch; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=bestguesspass action=none header.from=cern.ch; Received-SPF: Pass (protection.outlook.com: domain of cern.ch designates 188.184.36.50 as permitted sender) receiver=protection.outlook.com; client-ip=188.184.36.50; helo=cernmxgwlb4.cern.ch; Received: from cernmxgwlb4.cern.ch (188.184.36.50) by VE1EUR02FT038.mail.protection.outlook.com (10.152.13.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1558.11 via Frontend Transport; Mon, 21 Jan 2019 16:42:02 +0000 Received: from cernfe03.cern.ch (188.184.36.39) by cernmxgwlb4.cern.ch (188.184.36.50) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 21 Jan 2019 17:42:01 +0100 Received: from pcbe13614.localnet (2001:1458:202:121::100:40) by smtp.cern.ch (2001:1458:201:66::100:14) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 21 Jan 2019 17:41:58 +0100 From: Federico Vaga To: Vinod Koul , Reply-To: CC: Subject: dmaengine: usage of dmaengine_get() and dma_find_channel() Date: Mon, 21 Jan 2019 17:41:58 +0100 Message-ID: <23108003.0nNWatJzJB@pcbe13614> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Originating-IP: [2001:1458:202:121::100:40] X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:188.184.36.50;IPV:NLI;CTRY:CH;EFV:NLI;SFV:NSPM;SFS:(10009020)(376002)(346002)(396003)(39860400002)(136003)(2980300002)(189003)(199004)(74482002)(426003)(106466001)(44832011)(336012)(47776003)(9576002)(246002)(486006)(8936002)(126002)(476003)(356004)(478600001)(8676002)(46406003)(50466002)(9686003)(110136005)(33716001)(3450700001)(16526019)(186003)(786003)(26005)(7636002)(106002)(97756001)(7736002)(43066004)(6116002)(230700001)(14444005)(4326008)(2906002)(86362001)(23726003)(33896004)(316002)(305945005)(39026011);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR06MB4009;H:cernmxgwlb4.cern.ch;FPR:;SPF:Pass;LANG:en;PTR:cernmx11.cern.ch;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0895405f-6990-4a31-9f65-08d67fbf5ed4 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600109)(711020)(4608076)(4709027)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:HE1PR06MB4009; X-MS-TrafficTypeDiagnostic: HE1PR06MB4009: X-Microsoft-Exchange-Diagnostics: 1;HE1PR06MB4009;20:U9qFsMhXmvRydPuHG8+tAxSDJ37wzboNJWMfkUU++/kNDUSiPfDIIyIBAzCy3fGEOLGtg72GnWhpBsqMaKZ3RSa9YdV4rdeya2AcA0si9Q6vc45RLx6AP5Dokmb5SP6jHUi6+SzipqIaT3ueX/4WCHIY/OJJ8jQzFoJSLw5ai+z0s++s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g+5YWbOhpcT6eTx?= =?us-ascii?Q?xt4cXT0Dh0TXC/hValt2TnC3OjYaXKxR/tveTVA9v7tD7dkjctiYrLZW9reZ?= =?us-ascii?Q?mJnZh6pOv9dBkzOr8Y7sg2wv39aerrhrljUB/gmuYfzwjSVPcYi2nf0A39LF?= =?us-ascii?Q?FluqHK/ADEKYhV6PO8SO6UUItJbqQfW3pagx9H+Q5cIBWhvhmaoNdgObG5es?= =?us-ascii?Q?P8lCMRPxQsNW+0WOvsA9SWWnKr+CmnkQMyJjLzl/ZXW8humvHjmb5oTNiZ2o?= =?us-ascii?Q?HvvOxW+626AbKahA9TCjEkZf0ruSf381m2uZCArLBpnCg6NltSXYc19frBB0?= =?us-ascii?Q?fG7tTS0Nmg8IodpOPOcCz/7ILqYLf4uZyhmhwul3fk9v4FJ+hWrJISMJzR5h?= =?us-ascii?Q?zTeh+7PP5uf5rPrRsBjQrTE2v+hSsWJ/+z603aczIuu13bAgyU9OedWQAjnx?= =?us-ascii?Q?WnDRBOI39fJDUc2x/BnAIa2LyGi6URAUhRZhQ8UQOnEKy/gQVezVo88H6tEt?= =?us-ascii?Q?wkQ+9kimzZ9eRP+IkziUUBY95X7p2+3kDyhD2W4/kxbb3G/HCcegPs+/hknL?= =?us-ascii?Q?lx5hxIBd5Ir+zdxpEHWomsBuyD7fOWCFybwdNAddSuhm0Z+A7XAXNWTztepK?= =?us-ascii?Q?BjzbSmEq1576z0+7XnlBL+eEQwVdQSFnaS9EXMhYMBdWCq9oXaUqyeecSGay?= =?us-ascii?Q?uVmBAarxVZxsU1VP+aFhl87eIzl8LmovrgT8yLDS4xlx530pkw8cPlAOSi0c?= =?us-ascii?Q?I7cua86Vd388lNlV4PdCOLfo5n1wy1QQJa2pCAqoTcuSZPX4j1Oopzzw70SS?= =?us-ascii?Q?p+YxzRrol/3OxM4xc4TZyR9MJ/B?= X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: hie7tlSARTQCnElqEwwY7nHpS9o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7N6hziwX+qyrK+HqX+2CbaJth0chftyrdwoo58JzZPuCXw==;7:CK9VZr41OvTXQuDDeHGzn7fB+rjwuRSCFp4HotY21VHU9G/RCuQLyOeX6ypESJ2lRFfuDPX/k2GMaNPD2d9pl5vkRpBzsb9hZAavGfKoo5iMk0e0kezJ8nuGdR/UybkEYpDtJGutxCKuIYYyWZ4Raw== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cern.ch X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2019 16:42:02.3321 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0895405f-6990-4a31-9f65-08d67fbf5ed4 X-MS-Exchange-CrossTenant-Id: c80d3499-4a40-4a8c-986e-abce017d6b19 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=c80d3499-4a40-4a8c-986e-abce017d6b19;Ip=[188.184.36.50];Helo=[cernmxgwlb4.cern.ch] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR06MB4009 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, I am a bit puzzle about the proper usage these two functions: void dmaengine_get(void) struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type) Looking into the kernel sources dma_find_channel is not used, despite the fact that it looks as one of the suggested mechanism to access a DMA engine. So, I cannot find a valid example of its usage. The same for dmaengine_get(). On the other hand, at least this function is used in: drivers/video/fbdev/mx3fb.c. But I believe that its usage is wrong because it uses: dmaengine_get() + dma_request_channel(), instead of dmaengine_get() + dma_find_channel(). Reading the code my understanding is that dmaengine_get() + dma_find_channel() should be used for "public" (not private) DMA engine channels. It's here where things are getting obscure to me. My understanding is that DMA channels which are not private can be used by several drivers at the same time. In principle they submit all their transfers and the DMA engine will process them and then the DMA engine will notify the drivers about their completion. My understanding is also that the dmaengine subsystem assumes that "public" channels of the same type are interchangeable. In my use case I wrote a DMA engine which is specific for a subset of driver, and it cannot be used by others (so is sharable among a group of drivers). All these drivers, potentially, they can submit their transfers to the DMA engine in parallel; but I cannot do it because I'm forced to use dma_request_channel() in order to be able to filter the DMA channels, and this will make automatically the channel PRIVATE which prevents other drivers to use the same channel. With the current API I do not see alternative for me. I have to use dma_request_channel() in order to filter DMA channels. But I am wondering if it make sense for you, and if it does, is there a solution today? Or, is it possibile to design one? Thanks (I do not know if this message is clear enough)