Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp679731pxb; Tue, 9 Feb 2021 09:42:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJyT8xeVqRYlFUlfr8zcDJQjkpY/IC2E9mBWc60fO+h/Pp5yh2v/M5ua8spMndE+LsHYSju3 X-Received: by 2002:a17:907:770d:: with SMTP id kw13mr16004040ejc.219.1612892556415; Tue, 09 Feb 2021 09:42:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612892556; cv=none; d=google.com; s=arc-20160816; b=SoVVsX7RKYfhB89VUorxwo8P6VScyY6IZ3iFIoF+thEMT1gn24bK+lIvzen/Ak3U5x Wt3azWsV9hv49HqQFbzEIAyLvARf28DVLLeCJyRoQz34dbFLgyhb8UbUV9LVIJj8Do+R EzbBUVbVa3bayLtwcT++3KMWFvZZEE/cPJNwr7gFjZhe2RMnTJtVWPSlG3qbxwEFGiDl FlFMFdHjHjVT4CH/nHRl3oRV9oWlFOv4QujBDZ7tijSwB4l7uUYisywOAwCSc/Q25iWa 7LU6ndmMGqUiG9diq//tJ/b+P9oORjso+S/M+SypDEntwbJQoQy4UhM21pnmGOIfG0lR lvxQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2frGZv9MpWB5lKgC9m9OF/K9NIuBbPrL9HEmWyY/ZXM=; b=P0qlhGa24I/0bKG8D/V1G1lW01F9I9ych+MNcQiuiIHbj4bAcHwVAvYoat4zEY7MiM UDrrU6WiMf+wICkmnLPOIq5uc1l5DkFdQu2Xt0HTr8HmtsSMe3/UnF+gSSfrO5Uf3IsJ A6HjqNs3F4lCTF6+du6OaztDM0tjuuCdn+L0pERy5TE/lchvmhKfecN8jEnVK4o0QlYk 86vsJVY+ekScEEQe431k6ebjNwleRMoDIOz/atgtgqTzGjKLWXy/JtL8TFEXj0ZWdJIY KSreVcUL8xYv1RRN8xVsw8Te0TDIeuIGGTrI5ueHQeoaOSntNX5U5uRXNXkkGKN3/jZS 1hAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tFsX5hNX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id dn20si16687612ejc.418.2021.02.09.09.42.01; Tue, 09 Feb 2021 09:42:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tFsX5hNX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S232997AbhBIRiA (ORCPT + 99 others); Tue, 9 Feb 2021 12:38:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233259AbhBIRf4 (ORCPT ); Tue, 9 Feb 2021 12:35:56 -0500 Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D8DBC06178C for ; Tue, 9 Feb 2021 09:35:33 -0800 (PST) Received: by mail-ot1-x336.google.com with SMTP id s107so18181742otb.8 for ; Tue, 09 Feb 2021 09:35:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=2frGZv9MpWB5lKgC9m9OF/K9NIuBbPrL9HEmWyY/ZXM=; b=tFsX5hNXjRip+gDiFP26/8Y6n3Ujr7r2J/g7QT/wCIpPnNkhBWcIuMMko68VFPs8O7 iUehhxmDexfrqbRcEDYUrFYueQ3iEEnEcn5g5wCSe/r6Sae6rlswtsB9Qemj344SRPKA Y4T6r3HBxIH30RVjEKh19VsL7m3QtCJDuXOXG3OcfCabtyrXYzjTWH6UTtb8X5cYm/SR 8+uQ9XTY7JZWhs3A8WWeFlb4cnWsk3RrgdUyllSBTl/fi1hcHJ0EJ56fAfZbvvj0njOb ZxDWnVj0FBGoE7UW0RCt4KHX1toGfxIylClT41By93xJGg/wnooTHZqZPn8I6SmOrJ76 ECPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=2frGZv9MpWB5lKgC9m9OF/K9NIuBbPrL9HEmWyY/ZXM=; b=Xdc+YshsM8JarIeZaDasxAnikVZtvAgpNceOqv3VefKlxlnpaK2TsgZ5dUlQM52I5w 7TKz3aetsXzkTRIdHYmV67xGBgyb+bWWy1sHv6g1qmKs65QhjG4J6jjMdoE9F7e1O/Me k0YG7i4Ivqc9DeQJNjmiDHRBPWrViOHWsMosRWsQJyZ9g91r6nj8nMvfsgssKvPyGx/k F9yLyBtfYVa9G2tuXL+14KZmOciVFbo+DLKd2aPRmyycPXXt9nzlpV6hg3oOpctNVfRw 3JMqQuoW1WP82T3zJKDSY3gPUlShymF34rVJe9gjkRVal1fDi7yAV7dUTe64POXIUk4D XDdQ== X-Gm-Message-State: AOAM5300i9MkngnlFofyJZMVK8xDmD86BNiT6AKcRVoCH27P5YNqZlwR iBJ2/6VZh6kLIeFdpPr9SjH2eQ== X-Received: by 2002:a05:6830:1342:: with SMTP id r2mr17237593otq.216.1612892132157; Tue, 09 Feb 2021 09:35:32 -0800 (PST) Received: from builder.lan (104-57-184-186.lightspeed.austtx.sbcglobal.net. [104.57.184.186]) by smtp.gmail.com with ESMTPSA id x187sm4489883oig.3.2021.02.09.09.35.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Feb 2021 09:35:31 -0800 (PST) Date: Tue, 9 Feb 2021 11:35:29 -0600 From: Bjorn Andersson To: mdalam@codeaurora.org Cc: Vinod Koul , corbet@lwn.net, agross@kernel.org, dan.j.williams@intel.com, dmaengine@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, sricharan@codeaurora.org, mdalam=codeaurora.org@codeaurora.org Subject: Re: [PATCH] dmaengine: qcom: bam_dma: Add LOCK and UNLOCK flag bit support Message-ID: References: <20210112101056.GI2771@vkoul-mobl> <20210115055806.GE2771@vkoul-mobl> <97ce29b230164a5848a38f6448d1be60@codeaurora.org> <20210119164511.GE2771@vkoul-mobl> <534308caab7c18730ad0cc25248d116f@codeaurora.org> <20210201060508.GK2771@vkoul-mobl> <9d33d73682f24d92338757e1823ccd88@codeaurora.org> <20210201064314.GM2771@vkoul-mobl> <73c871d3d674607fafc7b79e602ec587@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <73c871d3d674607fafc7b79e602ec587@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 01 Feb 09:50 CST 2021, mdalam@codeaurora.org wrote: > On 2021-02-01 12:13, Vinod Koul wrote: > > On 01-02-21, 11:52, mdalam@codeaurora.org wrote: > > > On 2021-02-01 11:35, Vinod Koul wrote: > > > > On 27-01-21, 23:56, mdalam@codeaurora.org wrote: > > > > > > > The actual LOCK/UNLOCK flag should be set on hardware command > > > > > descriptor. > > > > > so this flag setting should be done in DMA engine driver. The user > > > > > of the > > > > > DMA > > > > > driver like (in case of IPQ5018) Crypto can use flag > > > > > "DMA_PREP_LOCK" & > > > > > "DMA_PREP_UNLOCK" > > > > > while preparing CMD descriptor before submitting to the DMA > > > > > engine. In DMA > > > > > engine driver > > > > > we are checking these flasgs on CMD descriptor and setting actual > > > > > LOCK/UNLOCK flag on hardware > > > > > descriptor. > > > > > > > > > > > > I am not sure I comprehend this yet.. when is that we would need to do > > > > this... is this for each txn submitted to dmaengine.. or something > > > > else.. > > > > > > Its not for each transaction submitted to dmaengine. We have to set > > > this > > > only > > > once on CMD descriptor. So when A53 crypto driver need to change > > > the crypto > > > configuration > > > then first it will lock the all other pipes using setting the LOCK > > > flag bit > > > on CMD > > > descriptor and then it can start the transaction , on data > > > descriptor this > > > flag will > > > not get set once all transaction will be completed the A53 crypto > > > driver > > > release the lock on > > > all other pipes using UNLOCK flag on CMD descriptor. So LOCK/UNLOCK > > > will be > > > only once and not for > > > the each transaction. > > > > Okay so why cant the bam driver check cmd descriptor and do lock/unlock > > as below, why do we need users to do this. > > > > if (flags & DMA_PREP_CMD) { > > do_lock_bam(); > > User will not decide to do this LOCK/UNLOCK mechanism. It depends on > use case. This LOCK/UNLOCK mechanism not required always. It needs > only when hardware will be shared between different core with > different driver. So you have a single piece of crypto hardware and you're using the BAM's LOCK/UNLOCK feature to implement a "mutex" on a particular BAM channel? > The LOCK/UNLOCK flags provides SW to enter ordering between pipes > execution. > (Generally, the BAM pipes are total independent from each other and work in > parallel manner). > This LOCK/UNLOCK flags are part of actual pipe hardware descriptor. > > Pipe descriptor having the following flags: > INT : Interrupt > EOT: End of transfer > EOB: End of block > NWD: Notify when done > CMD: Command > LOCK: Lock > UNLOCK: Unlock > etc. > > Here the BAM driver is common driver for (QPIC, Crypto, QUP etc. in > IPQ5018) > So here only Crypto will be shared b/w multiple cores so For crypto request > only the LOCK/UNLOCK > mechanism required. > For other request like for QPIC driver, QUPT driver etc. its not required. > So Crypto driver has to raise the flag for > LOCK/UNLOCK while preparing CMD descriptor. The actual locking will happen > in BAM driver only using condition > if (flags & DMA_PREP_CMD) { > if (flags & DMA_PREP_LOCK) > desc->flags |= cpu_to_le16(DESC_FLAG_LOCK); > } > > So Crypto driver should set this flag DMA_PREP_LOCK while preparing CMD > descriptor. > So LOCK should be set on actual hardware pipe descriptor with descriptor > type CMD. > It sounds fairly clear that the actual descriptor modification must happen in the BAM driver, but the question in my mind is how this is exposed to the DMAengine clients (e.g. crypto, QPIC etc). What is the life span of the locked state? Do you always provide a series of descriptors that starts with a LOCK and ends with an UNLOCK? Or do you envision that the crypto driver provides a LOCK descriptor and at some later point provides a UNLOCK descriptor? Finally, this patch just adds the BAM part of things, where is the patch that actually makes use of this feature? Regards, Bjorn > > > > The point here is that this seems to be internal to dma and should be > > handled by dma driver. > > > This LOCK/UNLOK flags are part of actual hardware descriptor so this > should be handled by BAM driver only. > If we set condition like this > if (flags & DMA_PREP_CMD) { > do_lock_bam(); > Then LOCK/UNLOCK will be applied for all the CMD descriptor including > (QPIC driver, QUP driver , Crypto driver etc.). > So this is not our intension. So we need to set this LOCK/UNLOCK only for > the drivers it needs. So Crypto driver needs > locking mechanism so we will set LOCK/UNLOCK flag on Crypto driver request > only for other driver request like QPIC driver, > QUP driver will not set this. > > > Also if we do this, it needs to be done for specific platforms.. > > > > > > > > > > > Thanks