Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2623238pxu; Fri, 18 Dec 2020 19:36:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJzUjdvpcH613RRmNAcJNhQTPzwZ1Q5dC75Neum+jxfgWCuKPTN5bryIkW6hkhNfUEWbcDbc X-Received: by 2002:a50:d50a:: with SMTP id u10mr7307008edi.58.1608349008265; Fri, 18 Dec 2020 19:36:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608349008; cv=none; d=google.com; s=arc-20160816; b=cH8I47HYNJcA0I4LifKYxNkybHF1Q90mMZDum2dBEuCfl3ONOrqfcZEaiCc15DYwYS MfoBMYdySBdiouZs7v3Zjk0xa0zmg24wdZGNEdI8HaaIPDjzzzx2boiafspCzBOl1G3g TfagJ+s3FQzpvbzALYaOSjvr16NhbHE/euOIr5Cre/WW895XPNIsdDosHY/2RRWMNUXc m8lZ5dERggP5ruR/PY0EXgDnXPcAAoiSA0hBxTS5iLH8BFOio/SxVwqA9jFZ6/8kxkQz J3s/Ege/bC+skzHWwvwjzEM4NJlWUKUb8cGffeJtsRg/Z0uV1fepnnuXU+ZJ7kk9FurT hYqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=XWIxnd1TBokkeQDQoDs2P8h6KNdDQQlPBRCQPqQe8vw=; b=SFzDQP4FNhqrJSMPGnZPAP8WHpON+94fYFUeV5l2rvxcx3EV9g0m0N/7AFjGY/cMor CmcQasjHuK6fxkBxQuW5KmIyeEV56q9zax24o1CDY9xFLUBsf1B24GJKGO/AyjV75E90 w3gVm88U8/dUXStX/76NqnPIQrV3c6iIM+wmKEmNGzm2/SIhnSUrnnaLXBJ84cHh9UcS lsWRNuiUlfoGTZeiKXZO0g/E+40qAV0eoixVAjJ0b4ZipJRE6a73iZ3HvqPR5gYdeWpE Bt8IcRXH2KCg1bfVozThV2ak7rTK0iehdHc5Oto2xhCSlA6BqVSvh5emtiP6S3xzOGnd vqfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oT4McdXt; 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 ca26si5621766ejb.622.2020.12.18.19.36.26; Fri, 18 Dec 2020 19:36:48 -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=oT4McdXt; 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 S1726192AbgLSDgB (ORCPT + 99 others); Fri, 18 Dec 2020 22:36:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726252AbgLSDgA (ORCPT ); Fri, 18 Dec 2020 22:36:00 -0500 Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B0E7C061285 for ; Fri, 18 Dec 2020 19:35:20 -0800 (PST) Received: by mail-qt1-x834.google.com with SMTP id z3so2894784qtw.9 for ; Fri, 18 Dec 2020 19:35:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=XWIxnd1TBokkeQDQoDs2P8h6KNdDQQlPBRCQPqQe8vw=; b=oT4McdXtX1VIEqC/VVrfo0fLp43cCBc3I5eiaj9ysuFEvUHHQvIi7jdhZ30CjQYwhm 5PfHpVTU8EMUWgRoXVY+IhUgByR6sbEQzsUjUSezQxTYBJA5i6MYybCK/QjmtzwO9Mhz YGfjo66X6cNq1DYsVTfUk4QCRF4zftFk5BndhToeX5XBdfp+Y4LUd/hGBF6XziHM/Pkr qX0LmYurv2QIwATyXDmABTbmO/7E9KJ3s1JUdrdCyO0PssTAfQdiPuwN5kBytSzr7Pe9 QohicqYEs+mpz+Hr9JF5QzDFQVYBgxIxMM0eb5rmeAqtqT9OZyxNsIGjtDnymKunXWtc A+xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=XWIxnd1TBokkeQDQoDs2P8h6KNdDQQlPBRCQPqQe8vw=; b=g9NofG1OVzwJHKp+iskA7BFv+t+lSkNca+iraOLZHg+BAhe9x3qO1gGFadr0aSeVSP Ra7JvI3n92SnS7T7DLhNO8UQXGhfLQ2Esqb0xZ8MMGrv0ZlEuzYIXsnDyRohrl8F/hcD al68OFWOymbhMRTIFUr8c0CmBrOJh6L/qWk3P7p4ED41dqBq5rlBzWpFUc3Z5AEcw0PW X/P/zk+CeWz82i29LsWegcQXISkxmmWs4MGx75hmcfMlWHXc3RzimIkU8ACS8lekgGV1 6DgjSCtP0zlo+4I8H35menA5BsTVW9yjKesRgoDNA2u/EYhIKcIFgqlNfHQjzwD9dQLK +uFQ== X-Gm-Message-State: AOAM530ETCZWSb/uDdZCDUSfV+VQ+H1+C5ZBlz2+1Ihp4DRaQ2+2OzcA FpbJMMQYRulGM4Cya6Bh0v/Bog== X-Received: by 2002:ac8:464c:: with SMTP id f12mr7278436qto.272.1608348919450; Fri, 18 Dec 2020 19:35:19 -0800 (PST) Received: from [192.168.1.93] (pool-71-163-245-5.washdc.fios.verizon.net. [71.163.245.5]) by smtp.gmail.com with ESMTPSA id s19sm3298501qta.35.2020.12.18.19.35.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 18 Dec 2020 19:35:18 -0800 (PST) Subject: Re: [PATCH] dmaengine: qcom: bam_dma: Add LOCK and UNLOCK flag bit support To: Md Sadre Alam , vkoul@kernel.org, corbet@lwn.net, agross@kernel.org, bjorn.andersson@linaro.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 Cc: sricharan@codeaurora.org References: <1608215842-15381-1-git-send-email-mdalam@codeaurora.org> From: Thara Gopinath Message-ID: <6c85436d-e064-367e-736b-951af82256c8@linaro.org> Date: Fri, 18 Dec 2020 22:35:17 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <1608215842-15381-1-git-send-email-mdalam@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/17/20 9:37 AM, Md Sadre Alam wrote: > This change will add support for LOCK & UNLOCK flag bit support > on CMD descriptor. > > If DMA_PREP_LOCK flag passed in prep_slave_sg then requester of this > transaction wanted to lock the DMA controller for this transaction so > BAM driver should set LOCK bit for the HW descriptor. > > If DMA_PREP_UNLOCK flag passed in prep_slave_sg then requester of this > transaction wanted to unlock the DMA controller.so BAM driver should set > UNLOCK bit for the HW descriptor. Hi, This is a generic question. What is the point of LOCK/UNLOCK with allocating LOCK groups to the individual dma channels? By default doesn't all channels fall in the same group. This would mean that a lock does not prevent the dma controller from not executing a transaction on the other channels. -- Warm Regards Thara > > Signed-off-by: Md Sadre Alam > --- > Documentation/driver-api/dmaengine/provider.rst | 9 +++++++++ > drivers/dma/qcom/bam_dma.c | 9 +++++++++ > include/linux/dmaengine.h | 5 +++++ > 3 files changed, 23 insertions(+) > > diff --git a/Documentation/driver-api/dmaengine/provider.rst b/Documentation/driver-api/dmaengine/provider.rst > index ddb0a81..d7516e2 100644 > --- a/Documentation/driver-api/dmaengine/provider.rst > +++ b/Documentation/driver-api/dmaengine/provider.rst > @@ -599,6 +599,15 @@ DMA_CTRL_REUSE > - This flag is only supported if the channel reports the DMA_LOAD_EOT > capability. > > +- DMA_PREP_LOCK > + > + - If set , the client driver tells DMA controller I am locking you for > + this transcation. > + > +- DMA_PREP_UNLOCK > + > + - If set, the client driver will tells DMA controller I am releasing the lock > + > General Design Notes > ==================== > > diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c > index 4eeb8bb..cdbe395 100644 > --- a/drivers/dma/qcom/bam_dma.c > +++ b/drivers/dma/qcom/bam_dma.c > @@ -58,6 +58,8 @@ struct bam_desc_hw { > #define DESC_FLAG_EOB BIT(13) > #define DESC_FLAG_NWD BIT(12) > #define DESC_FLAG_CMD BIT(11) > +#define DESC_FLAG_LOCK BIT(10) > +#define DESC_FLAG_UNLOCK BIT(9) > > struct bam_async_desc { > struct virt_dma_desc vd; > @@ -644,6 +646,13 @@ static struct dma_async_tx_descriptor *bam_prep_slave_sg(struct dma_chan *chan, > > /* fill in temporary descriptors */ > desc = async_desc->desc; > + if (flags & DMA_PREP_CMD) { > + if (flags & DMA_PREP_LOCK) > + desc->flags |= cpu_to_le16(DESC_FLAG_LOCK); > + if (flags & DMA_PREP_UNLOCK) > + desc->flags |= cpu_to_le16(DESC_FLAG_UNLOCK); > + } > + > for_each_sg(sgl, sg, sg_len, i) { > unsigned int remainder = sg_dma_len(sg); > unsigned int curr_offset = 0; > diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h > index dd357a7..79ccadb4 100644 > --- a/include/linux/dmaengine.h > +++ b/include/linux/dmaengine.h > @@ -190,6 +190,9 @@ struct dma_interleaved_template { > * transaction is marked with DMA_PREP_REPEAT will cause the new transaction > * to never be processed and stay in the issued queue forever. The flag is > * ignored if the previous transaction is not a repeated transaction. > + * @DMA_PREP_LOCK: tell the driver that DMA HW engine going to be locked for this > + * transaction , until not seen DMA_PREP_UNLOCK flag set. > + * @DMA_PREP_UNLOCK: tell the driver to unlock the DMA HW engine. > */ > enum dma_ctrl_flags { > DMA_PREP_INTERRUPT = (1 << 0), > @@ -202,6 +205,8 @@ enum dma_ctrl_flags { > DMA_PREP_CMD = (1 << 7), > DMA_PREP_REPEAT = (1 << 8), > DMA_PREP_LOAD_EOT = (1 << 9), > + DMA_PREP_LOCK = (1 << 10), > + DMA_PREP_UNLOCK = (1 << 11), > }; > > /** >