Received: by 10.192.165.156 with SMTP id m28csp231791imm; Thu, 12 Apr 2018 20:49:33 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/3JotF5ihh6VZyw5lvdKp2PEWFpy95teTR9lrSVt3sNKoIEa+MCvraofH0wIoOFLQZw7Zc X-Received: by 10.98.178.207 with SMTP id z76mr10058138pfl.37.1523591373462; Thu, 12 Apr 2018 20:49:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523591373; cv=none; d=google.com; s=arc-20160816; b=XJqroEyveHVKm6wFx7DrnYII+fvT0fv+0xC4lW+p3sttxRp3/Ceb85WzAMKSElRJkk SCeK/qQ2liIr6A8YV4Wqwqt1hz+oSuSmtN6r25+h+/7oE2kIPshytQMFexSrol6xuOiX +SY5nQ53pYE/T4bUApztUXVxFrfth/iI8Kihhdckav8PQeLKxJYZbeT4eEOA9MFxL3wF scBfOf0prTEW0XwqMguFWSfaZ0q+gG98VTvx5Y2/bLDtNUHrHjc7fKgDQTVf7RqrzowD iv4XtOSV4JrvnTVQI0hB7jwQiGVP1W04sQUYtLa3ylMjncLQCW2S3vRimEdnnY8ODoyq 6eKw== 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:arc-authentication-results; bh=JdJAAVVLmEGSUAjSyGM1NDqsmwtDdudZZE79Q7N2auY=; b=ATqX0/KbRoTpyx2M3HHKFmW0ftjRnv7oaCCT/oEr8H4NMBe8Vuw/I2+KeI5LrYQsCe 76Lz3th123zKqbyyWtKNzLZnfaUxggmvz2sbX4CfnyPRuqljH23XBH0JzfdJSwhuFzVl iEDyy6/LSCzCkGLBbzHJPcYPLtbvSLATRIxKGoGjhGQfTq9VfoKNjm4BO12rY+wFWlY+ h/DOpr8e8qrVAf0gn+7cCVGEfiIWZ7qDIOCgH+JPnO2a6TPOpVoheEjc2X4LDivMKyRA OTKG0+ZBroMT6T/Y7Iv+72FM65Th51LLsOc0pNdCkuTGS6c9v/0Ci20Dxn1wvtztVZGb mdew== ARC-Authentication-Results: i=1; mx.google.com; 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 b75si3783184pfc.303.2018.04.12.20.49.19; Thu, 12 Apr 2018 20:49:33 -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; 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 S1753704AbeDMDjG (ORCPT + 99 others); Thu, 12 Apr 2018 23:39:06 -0400 Received: from mga09.intel.com ([134.134.136.24]:23921 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752170AbeDMDjF (ORCPT ); Thu, 12 Apr 2018 23:39:05 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Apr 2018 20:39:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,444,1517904000"; d="scan'208";a="42971379" Received: from vkoul-udesk7.iind.intel.com (HELO localhost) ([10.223.84.143]) by orsmga003.jf.intel.com with ESMTP; 12 Apr 2018 20:39:02 -0700 Date: Fri, 13 Apr 2018 09:13:33 +0530 From: Vinod Koul To: Baolin Wang Cc: Dan Williams , Eric Long , Mark Brown , dmaengine@vger.kernel.org, LKML Subject: Re: [PATCH 4/5] dmaengine: sprd: Add Spreadtrum DMA configuration Message-ID: <20180413034332.GI6014@localhost> References: <0c2b76aba6a49e583f920ae582d6815fa9cc4361.1523346135.git.baolin.wang@linaro.org> <20180411093634.GC6014@localhost> <20180412093735.GF6014@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 12, 2018 at 07:36:34PM +0800, Baolin Wang wrote: > >>> >> +/* > >>> >> + * struct sprd_dma_config - DMA configuration structure > >>> >> + * @config: dma slave channel config > >>> >> + * @fragment_len: specify one fragment transfer length > >>> >> + * @block_len: specify one block transfer length > >>> >> + * @transcation_len: specify one transcation transfer length > >>> >> + * @wrap_ptr: wrap pointer address, once the transfer address reaches the > >>> >> + * 'wrap_ptr', the next transfer address will jump to the 'wrap_to' address. > >>> >> + * @wrap_to: wrap jump to address > >>> >> + * @req_mode: specify the DMA request mode > >>> >> + * @int_mode: specify the DMA interrupt type > >>> >> + */ > >>> >> +struct sprd_dma_config { > >>> >> + struct dma_slave_config config; > >>> >> + u32 fragment_len; > >>> > > >>> > why not use _maxburst? > >>> > >>> Yes, I can use maxburst. > >>> > >>> > > >>> >> + u32 block_len; > >>> >> + u32 transcation_len; > >>> > > >>> > what does block and transaction len refer to here > >>> > >>> Our DMA has 3 transfer mode: transaction transfer, block transfer and > >>> fragment transfer. One transaction transfer can contain several blocks > >>> transfer, and each block can be set proper block step. One block can > >>> contain several fragments transfer with proper fragment step. It can > >>> generate interrupts when one transaction transfer or block transfer or > >>> fragment transfer is completed if user set the interrupt type. So here > >>> we should set the length for transaction transfer, block transfer and > >>> fragment transfer. > >> > >> what are the max size these types support? > > > > These types max size definition: > > > > #define SPRD_DMA_FRG_LEN_MASK GENMASK(16, 0) > > > > #define SPRD_DMA_BLK_LEN_MASK GENMASK(16, 0) > > > > #define SPRD_DMA_TRSC_LEN_MASK GENMASK(27, 0) > > > >>> > >>> > > >>> >> + phys_addr_t wrap_ptr; > >>> >> + phys_addr_t wrap_to; > >>> > > >>> > this sound sg_list to me, why are we not using that here > >>> > >>> It is similar to sg list, but it is not one software action, we have > >>> hardware registers to help to jump one specified address. > >>> > >>> > > >>> >> + enum sprd_dma_req_mode req_mode; > >>> > > >>> > Looking at definition of request mode we have frag, block, transaction list > >>> > etc.. That should depend upon dma request. If you have been asked to > >>> > transfer a list, you shall configure list mode. if it is a single > >>> > transaction then it should be transaction mode! > >>> > >>> If I understand your points correctly, you mean we can specify the > >>> request mode when requesting one slave channel by > >>> 'dma_request_slave_channel()'. But we need change the request mode > >>> dynamically following different transfer task for this channel, so I > >>> am afraid we can not specify the request mode of this channel at > >>> requesting time. > >> > >> Nope a channel has nothing to do with request type. You request and grab a > >> channel. Then you prepare a descriptor for a dma transaction. Based on > >> transaction requested you should intelligently break it down and create a > >> descriptor which uses transaction/block/fragment so that DMA throughput is > >> efficient. If prepare has sg list then you should use link list mode. > >> Further if you support max length, say 16KB and request is for 20KB you may > >> break it down for link list with two segments. > > > > OK. So I can add one more cell to specify the request mode for this channel. > > > > dmas = <&apdma 11 SPRD_DMA_BLK_REQ> > > > >> > >> Each prep call has flags associated, that can help you configure interrupt > >> behaviour. > > After more thinking, I think this will be not useful for users, since > users need configure one DMA channel through different 3 places, > specify the request mode in dts, specify the interrupt type through > prep call flags, and other configuration need to be configured through > 'struct sprd_dma_config'. That is not one good design for users. What > do you think? Thanks. Agreed, users only care about grabbing a channel, setting a descriptor and submitting that. I think you need to go back and think about this a bit, please do go thru dmaengine documentation and see other driver examples. We don't typically expose these to users, they give us a transfer and we set that up in hardware for efficient. Its DMA so people expect us to use fastest mechanism available. I would say setup as Link list for sg transfers and use one of them modes (again think efficiency) for single transfers. Also use all the parameters in dma_slave_config and also setup capabilities if not done. -- ~Vinod