dmaengine Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v1] dmaengine: tegra-apb: Error out if DMA_PREP_INTERRUPT flag is unset
@ 2019-05-29 21:43 Dmitry Osipenko
  2019-05-30 12:01 ` Jon Hunter
  2019-06-04 12:16 ` Vinod Koul
  0 siblings, 2 replies; 4+ messages in thread
From: Dmitry Osipenko @ 2019-05-29 21:43 UTC (permalink / raw)
  To: Laxman Dewangan, Vinod Koul, Thierry Reding, Jonathan Hunter, Ben Dooks
  Cc: dmaengine, linux-tegra, linux-kernel

Apparently driver was never tested with DMA_PREP_INTERRUPT flag being
unset since it completely disables interrupt handling instead of skipping
the callbacks invocations, hence putting channel into unusable state.

The flag is always set by all of kernel drivers that use APB DMA, so let's
error out in otherwise case for consistency. It won't be difficult to
support that case properly if ever will be needed.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/dma/tegra20-apb-dma.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
index cf462b1abc0b..2c84a660ba36 100644
--- a/drivers/dma/tegra20-apb-dma.c
+++ b/drivers/dma/tegra20-apb-dma.c
@@ -988,8 +988,12 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_slave_sg(
 		csr |= tdc->slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT;
 	}
 
-	if (flags & DMA_PREP_INTERRUPT)
+	if (flags & DMA_PREP_INTERRUPT) {
 		csr |= TEGRA_APBDMA_CSR_IE_EOC;
+	} else {
+		WARN_ON_ONCE(1);
+		return NULL;
+	}
 
 	apb_seq |= TEGRA_APBDMA_APBSEQ_WRAP_WORD_1;
 
@@ -1131,8 +1135,12 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic(
 		csr |= tdc->slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT;
 	}
 
-	if (flags & DMA_PREP_INTERRUPT)
+	if (flags & DMA_PREP_INTERRUPT) {
 		csr |= TEGRA_APBDMA_CSR_IE_EOC;
+	} else {
+		WARN_ON_ONCE(1);
+		return NULL;
+	}
 
 	apb_seq |= TEGRA_APBDMA_APBSEQ_WRAP_WORD_1;
 
-- 
2.21.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] dmaengine: tegra-apb: Error out if DMA_PREP_INTERRUPT flag is unset
  2019-05-29 21:43 [PATCH v1] dmaengine: tegra-apb: Error out if DMA_PREP_INTERRUPT flag is unset Dmitry Osipenko
@ 2019-05-30 12:01 ` Jon Hunter
  2019-05-30 17:32   ` Dmitry Osipenko
  2019-06-04 12:16 ` Vinod Koul
  1 sibling, 1 reply; 4+ messages in thread
From: Jon Hunter @ 2019-05-30 12:01 UTC (permalink / raw)
  To: Dmitry Osipenko, Laxman Dewangan, Vinod Koul, Thierry Reding, Ben Dooks
  Cc: dmaengine, linux-tegra, linux-kernel


On 29/05/2019 22:43, Dmitry Osipenko wrote:
> Apparently driver was never tested with DMA_PREP_INTERRUPT flag being
> unset since it completely disables interrupt handling instead of skipping
> the callbacks invocations, hence putting channel into unusable state.
> 
> The flag is always set by all of kernel drivers that use APB DMA, so let's
> error out in otherwise case for consistency. It won't be difficult to
> support that case properly if ever will be needed.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/dma/tegra20-apb-dma.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
> index cf462b1abc0b..2c84a660ba36 100644
> --- a/drivers/dma/tegra20-apb-dma.c
> +++ b/drivers/dma/tegra20-apb-dma.c
> @@ -988,8 +988,12 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_slave_sg(
>  		csr |= tdc->slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT;
>  	}
>  
> -	if (flags & DMA_PREP_INTERRUPT)
> +	if (flags & DMA_PREP_INTERRUPT) {
>  		csr |= TEGRA_APBDMA_CSR_IE_EOC;
> +	} else {
> +		WARN_ON_ONCE(1);
> +		return NULL;
> +	}
>  
>  	apb_seq |= TEGRA_APBDMA_APBSEQ_WRAP_WORD_1;
>  
> @@ -1131,8 +1135,12 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic(
>  		csr |= tdc->slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT;
>  	}
>  
> -	if (flags & DMA_PREP_INTERRUPT)
> +	if (flags & DMA_PREP_INTERRUPT) {
>  		csr |= TEGRA_APBDMA_CSR_IE_EOC;
> +	} else {
> +		WARN_ON_ONCE(1);
> +		return NULL;
> +	}
>  
>  	apb_seq |= TEGRA_APBDMA_APBSEQ_WRAP_WORD_1;

Looks good to me.

Acked-by: Jon Hunter <jonathanh@nvidia.com>

Cheers
Jon

-- 
nvpublic

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] dmaengine: tegra-apb: Error out if DMA_PREP_INTERRUPT flag is unset
  2019-05-30 12:01 ` Jon Hunter
@ 2019-05-30 17:32   ` Dmitry Osipenko
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Osipenko @ 2019-05-30 17:32 UTC (permalink / raw)
  To: Jon Hunter, Laxman Dewangan, Vinod Koul, Thierry Reding, Ben Dooks
  Cc: dmaengine, linux-tegra, linux-kernel

30.05.2019 15:01, Jon Hunter пишет:
> 
> On 29/05/2019 22:43, Dmitry Osipenko wrote:
>> Apparently driver was never tested with DMA_PREP_INTERRUPT flag being
>> unset since it completely disables interrupt handling instead of skipping
>> the callbacks invocations, hence putting channel into unusable state.
>>
>> The flag is always set by all of kernel drivers that use APB DMA, so let's
>> error out in otherwise case for consistency. It won't be difficult to
>> support that case properly if ever will be needed.
>>
>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>> ---
>>  drivers/dma/tegra20-apb-dma.c | 12 ++++++++++--
>>  1 file changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
>> index cf462b1abc0b..2c84a660ba36 100644
>> --- a/drivers/dma/tegra20-apb-dma.c
>> +++ b/drivers/dma/tegra20-apb-dma.c
>> @@ -988,8 +988,12 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_slave_sg(
>>  		csr |= tdc->slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT;
>>  	}
>>  
>> -	if (flags & DMA_PREP_INTERRUPT)
>> +	if (flags & DMA_PREP_INTERRUPT) {
>>  		csr |= TEGRA_APBDMA_CSR_IE_EOC;
>> +	} else {
>> +		WARN_ON_ONCE(1);
>> +		return NULL;
>> +	}
>>  
>>  	apb_seq |= TEGRA_APBDMA_APBSEQ_WRAP_WORD_1;
>>  
>> @@ -1131,8 +1135,12 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic(
>>  		csr |= tdc->slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT;
>>  	}
>>  
>> -	if (flags & DMA_PREP_INTERRUPT)
>> +	if (flags & DMA_PREP_INTERRUPT) {
>>  		csr |= TEGRA_APBDMA_CSR_IE_EOC;
>> +	} else {
>> +		WARN_ON_ONCE(1);
>> +		return NULL;
>> +	}
>>  
>>  	apb_seq |= TEGRA_APBDMA_APBSEQ_WRAP_WORD_1;
> 
> Looks good to me.
> 
> Acked-by: Jon Hunter <jonathanh@nvidia.com>
> 
> Cheers
> Jon
> 

Thanks

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] dmaengine: tegra-apb: Error out if DMA_PREP_INTERRUPT flag is unset
  2019-05-29 21:43 [PATCH v1] dmaengine: tegra-apb: Error out if DMA_PREP_INTERRUPT flag is unset Dmitry Osipenko
  2019-05-30 12:01 ` Jon Hunter
@ 2019-06-04 12:16 ` Vinod Koul
  1 sibling, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2019-06-04 12:16 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Laxman Dewangan, Thierry Reding, Jonathan Hunter, Ben Dooks,
	dmaengine, linux-tegra, linux-kernel

On 30-05-19, 00:43, Dmitry Osipenko wrote:
> Apparently driver was never tested with DMA_PREP_INTERRUPT flag being
> unset since it completely disables interrupt handling instead of skipping
> the callbacks invocations, hence putting channel into unusable state.
> 
> The flag is always set by all of kernel drivers that use APB DMA, so let's
> error out in otherwise case for consistency. It won't be difficult to
> support that case properly if ever will be needed.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-29 21:43 [PATCH v1] dmaengine: tegra-apb: Error out if DMA_PREP_INTERRUPT flag is unset Dmitry Osipenko
2019-05-30 12:01 ` Jon Hunter
2019-05-30 17:32   ` Dmitry Osipenko
2019-06-04 12:16 ` Vinod Koul

dmaengine Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dmaengine/0 dmaengine/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dmaengine dmaengine/ https://lore.kernel.org/dmaengine \
		dmaengine@vger.kernel.org dmaengine@archiver.kernel.org
	public-inbox-index dmaengine


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.dmaengine


AGPL code for this site: git clone https://public-inbox.org/ public-inbox