[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <da4u6uceevf264ycemxvutkvmw77z6vlt6td2vtwuz7zm2csqk@4km3vnletgky>
Date: Tue, 11 Mar 2025 18:02:04 +0200
From: Dmitry Baryshkov <lumag@...nel.org>
To: Bartosz Golaszewski <brgl@...ev.pl>
Cc: Thara Gopinath <thara.gopinath@...il.com>,
Herbert Xu <herbert@...dor.apana.org.au>, "David S. Miller" <davem@...emloft.net>,
Vinod Koul <vkoul@...nel.org>, Jonathan Corbet <corbet@....net>,
Md Sadre Alam <quic_mdalam@...cinc.com>, Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
linux-crypto@...r.kernel.org, linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
dmaengine@...r.kernel.org, linux-doc@...r.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH v7 3/8] dmaengine: qcom: bam_dma: add bam_pipe_lock flag
support
On Tue, Mar 11, 2025 at 10:25:34AM +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
>
> Extend the device match data with a flag indicating whether the IP
> supports the BAM lock/unlock feature. Set it to true on BAM IP versions
> 1.4.0 and above.
This is obvious from the patch itself. I think this might be a good
place for the description that you had in patch 1.
>
> Co-developed-by: Md Sadre Alam <quic_mdalam@...cinc.com>
> Signed-off-by: Md Sadre Alam <quic_mdalam@...cinc.com>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
> ---
> drivers/dma/qcom/bam_dma.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
> index 8861245314b1..737fce396c2e 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;
> @@ -113,6 +115,7 @@ struct reg_offset_data {
>
> struct bam_device_data {
> const struct reg_offset_data *reg_info;
> + bool bam_pipe_lock;
> };
>
> static const struct reg_offset_data bam_v1_3_reg_info[] = {
> @@ -179,6 +182,7 @@ static const struct reg_offset_data bam_v1_4_reg_info[] = {
>
> static const struct bam_device_data bam_v1_4_data = {
> .reg_info = bam_v1_4_reg_info,
> + .bam_pipe_lock = true,
> };
>
> static const struct reg_offset_data bam_v1_7_reg_info[] = {
> @@ -212,6 +216,7 @@ static const struct reg_offset_data bam_v1_7_reg_info[] = {
>
> static const struct bam_device_data bam_v1_7_data = {
> .reg_info = bam_v1_7_reg_info,
> + .bam_pipe_lock = true,
> };
>
> /* BAM CTRL */
> @@ -707,8 +712,15 @@ static struct dma_async_tx_descriptor *bam_prep_slave_sg(struct dma_chan *chan,
> unsigned int curr_offset = 0;
>
> do {
> - if (flags & DMA_PREP_CMD)
> + if (flags & DMA_PREP_CMD) {
> desc->flags |= cpu_to_le16(DESC_FLAG_CMD);
> + if (bdev->dev_data->bam_pipe_lock) {
> + if (flags & DMA_PREP_LOCK)
> + desc->flags |= cpu_to_le16(DESC_FLAG_LOCK);
> + else if (flags & DMA_PREP_UNLOCK)
> + desc->flags |= cpu_to_le16(DESC_FLAG_UNLOCK);
Should it fail if there is no support for those flags?
Is it an error to set the UNLOCK flag if there was no LOCK set
beforehand?
> + }
> + }
>
> desc->addr = cpu_to_le32(sg_dma_address(sg) +
> curr_offset);
>
> --
> 2.45.2
>
--
With best wishes
Dmitry
Powered by blists - more mailing lists