Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2617100rdb; Wed, 4 Oct 2023 06:46:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHEsFjtRGxMojPmkffJ972YTe6djyHK6llUtGOyltnlofOm1xwFdY+9+pQb2ia49rN/EfS0 X-Received: by 2002:a05:6a21:a101:b0:162:6588:7174 with SMTP id aq1-20020a056a21a10100b0016265887174mr1960236pzc.28.1696427199185; Wed, 04 Oct 2023 06:46:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696427199; cv=none; d=google.com; s=arc-20160816; b=YpVz4c4vfdjqEn4NXBeVoRy+dmrz1FIjOuGmy5YCR11x6841xWdIej1Ybevu8Ryhnq gbuPQhmId3HktaJHsKcIGUiv5CZ1tQjwX9xcY+H49pCCqcpQ0XeEj2WM7f+RKNGxUa1n W2HUvHrK+EWDJzmRzR0XMtsUEidydW4s0m71qmRLPBNh9OqlcRapRwMhJSNj+zEhQgSx TlUGRkoxOWhVyS4y8taafMi6ir/ebqmSzH61UkHlRbzT3vQPyX5jn4yEB0LyWIr+hVlM J9+XquvhddFK9mioERf/fd+vpboRgyCqozxLxd9Jl++FJcnWkstQB4IrlMUzztMYuvuT LEhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=fwOGu+DkDH30izq83G9EVCQYFtiKMOkD35hdCKx8FHs=; fh=J5tv91JoObPSODyr+XGWnPjGg2hS6kq59Ri2KHI1ZbE=; b=TqlyAVdXmXtUzvz85czF5Gzy7J+qoJ7esVI8as+S6WV9JtasDX2nTOpSZYQP8UNEIn in63KDROJ+7UhyVEUUBQO+MEw9xUfqNQ4ot0pj/JaqJArRVwTN0IQvMi2Y3iMxafmDfq eG0jRj8P91nmmU6kEq9Zkxo9dhfRa2BSWEUFdBuMxBx+uvCfyGTryeZBs5w60F0RpLLP m1+3EAnvTPpqzeS/h3Rt/r3qmiRqYpWmE/iMRThu3vSPVlgQdkZ/WLAoUtBZ1gJNY4O/ CWBSQaF90AJQLtJs/cUG+p7X68Iga/r9KUia1MiVr/h5vu6Z9t7OUSuXGGUFr0LNYWJ6 1Qzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=R9wnh80R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id h15-20020a056a001a4f00b0069026fd5a31si3860856pfv.272.2023.10.04.06.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 06:46:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=R9wnh80R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 95C51809A79F; Wed, 4 Oct 2023 06:46:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233338AbjJDNqM (ORCPT + 99 others); Wed, 4 Oct 2023 09:46:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233066AbjJDNqK (ORCPT ); Wed, 4 Oct 2023 09:46:10 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53331A9; Wed, 4 Oct 2023 06:46:07 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13389C433C7; Wed, 4 Oct 2023 13:46:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696427166; bh=HFpyoczoeu93B+eyyu6aLGqXz6EFGkxrIUbFli4Gm9Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=R9wnh80R+hyC3UCzgdQOevuIaFw10AHaxEtnkhDeM9CZVHt5suUFQbRfVqoBG0NfN YvOVJtocj4W1zPS5tY6h++IK+YC1Ry+VQly3iHEyBj7oVIcj8BOfNh9YghmGBR93iG HA0npNiH6hS+aZsvwYuw2W9obVnKMSlfhaX7kB4E8HG2/y41qD4PUMKOg90/BNtC30 D2w/qzlxcwEi3KLRV3G3wn7adzEFWgnVyzBz7qoT5wbTwvrpaFPBsUU5aZr5BrRoDT qGoKCmg4yFlxJaxIh/WBQ8KxBZSUj1sZYCthploXGKeZyjKmeEN/O/HIzd4ZZ3PK2L DUyDfQY1PhKGg== Date: Wed, 4 Oct 2023 19:16:01 +0530 From: Vinod Koul To: Martin =?utf-8?Q?Povi=C5=A1er?= Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , asahi@lists.linux.dev, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] dmaengine: apple-sio: Add Apple SIO driver Message-ID: References: <20230828170013.75820-1-povik+lin@cutebit.org> <20230828170013.75820-3-povik+lin@cutebit.org> <06444557-414A-4710-88A0-620975BB258A@cutebit.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <06444557-414A-4710-88A0-620975BB258A@cutebit.org> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 04 Oct 2023 06:46:36 -0700 (PDT) On 04-10-23, 15:32, Martin Povišer wrote: > >> + * There are two kinds of 'transaction descriptors' in play here. > >> + * > >> + * There's the struct sio_tx, and the struct dma_async_tx_descriptor embedded > >> + * inside, which jointly represent a transaction to the dmaengine subsystem. > >> + * At this time we only support those transactions to be cyclic. > >> + * > >> + * Then there are the coprocessor descriptors, which is what the coprocessor > >> + * knows and understands. These don't seem to have a cyclic regime, so we can't > >> + * map the dmaengine transaction on an exact coprocessor counterpart. Instead > >> + * we continually queue up many coprocessor descriptors to implement a cyclic > >> + * transaction. > >> + * > >> + * The number below is the maximum of how far ahead (how many) coprocessor > >> + * descriptors we should be queuing up, per channel, for a cyclic transaction. > >> + * Basically it's a made-up number. > >> + */ > >> +#define SIO_MAX_NINFLIGHT 4 > > > > you meant SIO_MAX_INFLIGHT if not what is NINFLIGHT? > > I mean the number is arbitrary, it doesn’t reflect any coprocessor limit since > I haven’t run the tests to figure one out. It's supposed to be a small reasonable > number. Sorry that was not my question. Should this macro be SIO_MAX_NINFLIGHT or SIO_MAX_INFLIGHT..? > >> +static int sio_device_config(struct dma_chan *chan, > >> + struct dma_slave_config *config) > >> +{ > >> + struct sio_chan *siochan = to_sio_chan(chan); > >> + struct sio_data *sio = siochan->host; > >> + bool is_tx = sio_chan_direction(siochan->no) == DMA_MEM_TO_DEV; > >> + struct sio_shmem_chan_config *cfg = sio->shmem; > >> + int ret; > >> + > >> + switch (is_tx ? config->dst_addr_width : config->src_addr_width) { > >> + case DMA_SLAVE_BUSWIDTH_1_BYTE: > >> + cfg->datashape = 0; > >> + break; > >> + case DMA_SLAVE_BUSWIDTH_2_BYTES: > >> + cfg->datashape = 1; > >> + break; > >> + case DMA_SLAVE_BUSWIDTH_4_BYTES: > >> + cfg->datashape = 2; > >> + break; > >> + default: > >> + return -EINVAL; > >> + } > >> + > >> + cfg->fifo = 0x800; > >> + cfg->limit = 0x800; > >> + cfg->threshold = 0x800; > >> + dma_wmb(); > > > > ?? > > Again, shared memory > > >> + > >> + ret = sio_call(sio, FIELD_PREP(SIOMSG_TYPE, MSG_CONFIGURE) | > >> + FIELD_PREP(SIOMSG_EP, siochan->no)); > > > > this does not sound okay, can you explain why this call is here > > We are sending the configuration to the coprocessor, it will NACK > it if invalid, seems very fitting here. I dont this so, purpose of the device_config() is to send peripheral config to driver for use on the next descriptor which is submitted. So sending to co-processor now (when we might even have a txn going on) does not seem right What would be the behaviour if already a txn is progressing on the co-processor -- ~Vinod