From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4624CC282C0 for ; Wed, 23 Jan 2019 12:36:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F051821019 for ; Wed, 23 Jan 2019 12:36:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cern.onmicrosoft.com header.i=@cern.onmicrosoft.com header.b="P1VtJviq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727315AbfAWMgv (ORCPT ); Wed, 23 Jan 2019 07:36:51 -0500 Received: from mail-eopbgr150087.outbound.protection.outlook.com ([40.107.15.87]:2075 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726057AbfAWMgu (ORCPT ); Wed, 23 Jan 2019 07:36:50 -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=fIRfRq65V/OETTo3xrqQe9ugAuQqNzHxQW2Z/sfdDvg=; b=P1VtJviqmnd26a6ODIOjvq8pHIKeUTy8CJ5NeAX9DFyIDsSHCufEj5Od6PpFgiiHeAtNVGhqrDWbVMr1x8wOjYcIlvIA62maCLZl69i9BuTWB/e6BJttLYDXJFe9vdrL1cxpkrSb9argRuYUovrZ5RhxVsz/hoUA3XYuimfoLfk= Received: from VI1PR06CA0155.eurprd06.prod.outlook.com (2603:10a6:803:a0::48) by HE1PR06MB4012.eurprd06.prod.outlook.com (2603:10a6:7:9c::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1537.31; Wed, 23 Jan 2019 12:36:45 +0000 Received: from HE1EUR02FT054.eop-EUR02.prod.protection.outlook.com (2a01:111:f400:7e05::209) by VI1PR06CA0155.outlook.office365.com (2603:10a6:803:a0::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1558.17 via Frontend Transport; Wed, 23 Jan 2019 12:36:45 +0000 Authentication-Results: spf=pass (sender IP is 188.184.36.48) 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.48 as permitted sender) receiver=protection.outlook.com; client-ip=188.184.36.48; helo=cernmxgwlb4.cern.ch; Received: from cernmxgwlb4.cern.ch (188.184.36.48) by HE1EUR02FT054.mail.protection.outlook.com (10.152.11.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1558.11 via Frontend Transport; Wed, 23 Jan 2019 12:36:44 +0000 Received: from cernfe03.cern.ch (188.184.36.39) by cernmxgwlb4.cern.ch (188.184.36.48) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 23 Jan 2019 13:36:40 +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; Wed, 23 Jan 2019 13:36:39 +0100 From: Federico Vaga To: Vinod Koul Reply-To: CC: , Subject: Re: dmaengine: usage of dmaengine_get() and dma_find_channel() Date: Wed, 23 Jan 2019 13:36:40 +0100 Message-ID: <2574032.sm3A0MmqI8@pcbe13614> In-Reply-To: <20190123121521.GM4635@vkoul-mobl> References: <23108003.0nNWatJzJB@pcbe13614> <20190123121521.GM4635@vkoul-mobl> 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.48;IPV:NLI;CTRY:CH;EFV:NLI;SFV:NSPM;SFS:(10009020)(376002)(136003)(39860400002)(346002)(396003)(2980300002)(199004)(189003)(7736002)(786003)(7636002)(44832011)(316002)(74482002)(106466001)(8936002)(14444005)(2906002)(230700001)(229853002)(305945005)(486006)(97756001)(47776003)(23726003)(43066004)(86362001)(9576002)(106002)(50466002)(6246003)(46406003)(76176011)(356004)(6666004)(6116002)(426003)(6916009)(4326008)(16526019)(9686003)(336012)(11346002)(186003)(3450700001)(33716001)(126002)(446003)(476003)(8676002)(478600001)(26005)(246002)(53546011)(33896004)(54906003)(39026011);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR06MB4012;H:cernmxgwlb4.cern.ch;FPR:;SPF:Pass;LANG:en;PTR:cernmx12.cern.ch;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7baef89e-b54c-4190-e11c-08d6812f6f2c X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600110)(711020)(4605077)(4608076)(4709027)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:HE1PR06MB4012; X-MS-TrafficTypeDiagnostic: HE1PR06MB4012: X-Microsoft-Exchange-Diagnostics: 1;HE1PR06MB4012;20:o5oVB/Eg/B7aiWXr7Mf+u2gORz+UJZcrkXH5M8DI5/QQ+h9/GhCMhAwzQtc6hKt/KtNbNBjoMqHe1R8xF2MrOoi7ukciluabE1iXi8WATuwKB1lDqC3HjzSlvV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rcGLWqXmm4gKJNqj+ingWL/40KchcOEQfAgC/DU8YAo5/4ajWzKeuZePq/DQLJyn4DfrbikWtGw==;5:1f57EQEXu+weWagWM2i3kZ8H9J1r+CkSMSJfB9DGqw5QTR2bgIXND3qwUVbx1Kgc3XMyD9bzPnA5w7NmW7ILZGW0RO3Iyrat9vzbBO9UvYoObopJbT+X0GolOUI/7uTYSC4jdcNW2o+ZDmxrJ+v9hSGS6OlRIRhzQ+H0f78M12rziAzGHpXs47VbhXtP7R9O1j+oHG4JLaLD7EY0JET6bA==;7:ginHLAobruKGpEZdwBD/qVC/DE4KrHApUWy0el9oAYkT92xEGSztoNZFz6m8O0lxoW7ur18WMHrgljUg1B2ppLU66EiyqPol7tfOxYofnkduimcPZyUOzUuEK2ZWxpCvf/yg/at/7egEvkLWOLv2bQ== X-OriginatorOrg: cern.ch X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2019 12:36:44.5193 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7baef89e-b54c-4190-e11c-08d6812f6f2c 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.48];Helo=[cernmxgwlb4.cern.ch] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR06MB4012 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks for your suggestion On Wednesday, January 23, 2019 1:15:21 PM CET Vinod Koul wrote: > On 21-01-19, 17:41, Federico Vaga wrote: > > 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. > > The concept of public channel is a channel capable of doing any dma > transfer for example a system dmaengine capable of flipping bits from > system memory to memory/devices. > > For peripherals, we cannot do a generic transfer and the transfer is > specific given a set of parameters for it to work, thus the channel is > private... These channels can be used by many users as long as that is > supported by engine. In an idle world, the dmaengine should have N > channels and provide M software channels and lets users use them and > schedule these for best throughput, we are not there yet :( > > > 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. > > Please use virtual channels for that, clients can use virtual channels > and they can be submitted to a hardware 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)