Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1733466 > unrolled thread

[PATCH] dmaengine: edma: Reject slave configs using a buswidth of 8 and larger

Started byStefan Brüns <stefan.bruens@rwth-aachen.de>
First post2017-09-17 16:30 +0200
Last post2017-09-22 10:40 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] dmaengine: edma: Reject slave configs using a buswidth of 8 and larger Stefan Brüns <stefan.bruens@rwth-aachen.de> - 2017-09-17 16:30 +0200
    Re: [PATCH] dmaengine: edma: Reject slave configs using a buswidth  of 8 and larger Vinod Koul <vinod.koul@intel.com> - 2017-09-21 19:20 +0200
      Re: [PATCH] dmaengine: edma: Reject slave configs using a buswidth of  8 and larger Peter Ujfalusi <peter.ujfalusi@ti.com> - 2017-09-21 20:30 +0200
        Re: [PATCH] dmaengine: edma: Reject slave configs using a buswidth of  8 and larger Peter Ujfalusi <peter.ujfalusi@ti.com> - 2017-09-22 08:20 +0200
          Re: [PATCH] dmaengine: edma: Reject slave configs using a buswidth  of 8 and larger Vinod Koul <vinod.koul@intel.com> - 2017-09-22 10:40 +0200

#1733466 — [PATCH] dmaengine: edma: Reject slave configs using a buswidth of 8 and larger

FromStefan Brüns <stefan.bruens@rwth-aachen.de>
Date2017-09-17 16:30 +0200
Subject[PATCH] dmaengine: edma: Reject slave configs using a buswidth of 8 and larger
Message-ID<uqIK5-Ea-3@gated-at.bofh.it>
The driver would happily accept buswidth of 16/32/64 bytes and program
garbage to its registers.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
---
 drivers/dma/edma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index 3879f80a4815..c944ea339425 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -887,8 +887,8 @@ static int edma_slave_config(struct dma_chan *chan,
 {
 	struct edma_chan *echan = to_edma_chan(chan);
 
-	if (cfg->src_addr_width == DMA_SLAVE_BUSWIDTH_8_BYTES ||
-	    cfg->dst_addr_width == DMA_SLAVE_BUSWIDTH_8_BYTES)
+	if (cfg->src_addr_width >= DMA_SLAVE_BUSWIDTH_8_BYTES ||
+	    cfg->dst_addr_width >= DMA_SLAVE_BUSWIDTH_8_BYTES)
 		return -EINVAL;
 
 	memcpy(&echan->cfg, cfg, sizeof(echan->cfg));
-- 
2.14.1

[toc] | [next] | [standalone]


#1736937 — Re: [PATCH] dmaengine: edma: Reject slave configs using a buswidth of 8 and larger

FromVinod Koul <vinod.koul@intel.com>
Date2017-09-21 19:20 +0200
SubjectRe: [PATCH] dmaengine: edma: Reject slave configs using a buswidth of 8 and larger
Message-ID<usdiQ-3Se-77@gated-at.bofh.it>
In reply to#1733466
On Sun, Sep 17, 2017 at 04:25:10PM +0200, Stefan Brüns wrote:
> The driver would happily accept buswidth of 16/32/64 bytes and program
> garbage to its registers.

Peter?

> 
> Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
> ---
>  drivers/dma/edma.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
> index 3879f80a4815..c944ea339425 100644
> --- a/drivers/dma/edma.c
> +++ b/drivers/dma/edma.c
> @@ -887,8 +887,8 @@ static int edma_slave_config(struct dma_chan *chan,
>  {
>  	struct edma_chan *echan = to_edma_chan(chan);
>  
> -	if (cfg->src_addr_width == DMA_SLAVE_BUSWIDTH_8_BYTES ||
> -	    cfg->dst_addr_width == DMA_SLAVE_BUSWIDTH_8_BYTES)
> +	if (cfg->src_addr_width >= DMA_SLAVE_BUSWIDTH_8_BYTES ||
> +	    cfg->dst_addr_width >= DMA_SLAVE_BUSWIDTH_8_BYTES)
>  		return -EINVAL;
>  
>  	memcpy(&echan->cfg, cfg, sizeof(echan->cfg));
> -- 
> 2.14.1
> 

-- 
~Vinod

[toc] | [prev] | [next] | [standalone]


#1736998 — Re: [PATCH] dmaengine: edma: Reject slave configs using a buswidth of 8 and larger

FromPeter Ujfalusi <peter.ujfalusi@ti.com>
Date2017-09-21 20:30 +0200
SubjectRe: [PATCH] dmaengine: edma: Reject slave configs using a buswidth of 8 and larger
Message-ID<useox-4rm-13@gated-at.bofh.it>
In reply to#1736937



Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

On 2017-09-21 20:17, Vinod Koul wrote:
> On Sun, Sep 17, 2017 at 04:25:10PM +0200, Stefan Brüns wrote:
>> The driver would happily accept buswidth of 16/32/64 bytes and program
>> garbage to its registers.
> 
> Peter?

Well, eDMA as such has no limitation on the buswidth, the addr_width
become ACNT, counter for the inner loop - which we use to represent the
word length. In theory we could support 32K-1 long word with eDMA, which
we actually do in case of memcpy.

But the driver does state that it supports bus width of 1, 2, 3 and 4 bytes.

These are form the past and I never felt the need to check them.

I think it is fine to reject salve config when asking for longer dev
width. I might revisit later if the need comes..

Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

> 
>>
>> Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
>> ---
>>  drivers/dma/edma.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
>> index 3879f80a4815..c944ea339425 100644
>> --- a/drivers/dma/edma.c
>> +++ b/drivers/dma/edma.c
>> @@ -887,8 +887,8 @@ static int edma_slave_config(struct dma_chan *chan,
>>  {
>>  	struct edma_chan *echan = to_edma_chan(chan);
>>  
>> -	if (cfg->src_addr_width == DMA_SLAVE_BUSWIDTH_8_BYTES ||
>> -	    cfg->dst_addr_width == DMA_SLAVE_BUSWIDTH_8_BYTES)
>> +	if (cfg->src_addr_width >= DMA_SLAVE_BUSWIDTH_8_BYTES ||
>> +	    cfg->dst_addr_width >= DMA_SLAVE_BUSWIDTH_8_BYTES)
>>  		return -EINVAL;
>>  
>>  	memcpy(&echan->cfg, cfg, sizeof(echan->cfg));
>> -- 
>> 2.14.1
>>
> 

- Péter

[toc] | [prev] | [next] | [standalone]


#1737206 — Re: [PATCH] dmaengine: edma: Reject slave configs using a buswidth of 8 and larger

FromPeter Ujfalusi <peter.ujfalusi@ti.com>
Date2017-09-22 08:20 +0200
SubjectRe: [PATCH] dmaengine: edma: Reject slave configs using a buswidth of 8 and larger
Message-ID<usptE-2Gz-19@gated-at.bofh.it>
In reply to#1736998
Stefan, Vinod,


Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

On 2017-09-21 21:29, Peter Ujfalusi wrote:
> 
> 
> On 2017-09-21 20:17, Vinod Koul wrote:
>> On Sun, Sep 17, 2017 at 04:25:10PM +0200, Stefan Brüns wrote:
>>> The driver would happily accept buswidth of 16/32/64 bytes and program
>>> garbage to its registers.
>>
>> Peter?
> 
> Well, eDMA as such has no limitation on the buswidth, the addr_width
> become ACNT, counter for the inner loop - which we use to represent the
> word length. In theory we could support 32K-1 long word with eDMA, which
> we actually do in case of memcpy.
> 
> But the driver does state that it supports bus width of 1, 2, 3 and 4 bytes.
> 
> These are form the past and I never felt the need to check them.
> 
> I think it is fine to reject salve config when asking for longer dev
> width. I might revisit later if the need comes..
> 
> Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

If it is not too late, I have second thoughts about this..
It might be better to remove the src_addr_width/dst_addr_width check
from edma_slave_config() and add all DMA_SLAVE_BUSWIDTH_* to
EDMA_DMA_BUSWIDTHS.

> 
>>
>>>
>>> Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
>>> ---
>>>  drivers/dma/edma.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
>>> index 3879f80a4815..c944ea339425 100644
>>> --- a/drivers/dma/edma.c
>>> +++ b/drivers/dma/edma.c
>>> @@ -887,8 +887,8 @@ static int edma_slave_config(struct dma_chan *chan,
>>>  {
>>>  	struct edma_chan *echan = to_edma_chan(chan);
>>>  
>>> -	if (cfg->src_addr_width == DMA_SLAVE_BUSWIDTH_8_BYTES ||
>>> -	    cfg->dst_addr_width == DMA_SLAVE_BUSWIDTH_8_BYTES)
>>> +	if (cfg->src_addr_width >= DMA_SLAVE_BUSWIDTH_8_BYTES ||
>>> +	    cfg->dst_addr_width >= DMA_SLAVE_BUSWIDTH_8_BYTES)
>>>  		return -EINVAL;
>>>  
>>>  	memcpy(&echan->cfg, cfg, sizeof(echan->cfg));
>>> -- 
>>> 2.14.1
>>>
>>
> 
> - Péter
> 

- Péter

[toc] | [prev] | [next] | [standalone]


#1737274 — Re: [PATCH] dmaengine: edma: Reject slave configs using a buswidth of 8 and larger

FromVinod Koul <vinod.koul@intel.com>
Date2017-09-22 10:40 +0200
SubjectRe: [PATCH] dmaengine: edma: Reject slave configs using a buswidth of 8 and larger
Message-ID<usrF8-3T0-1@gated-at.bofh.it>
In reply to#1737206
On Fri, Sep 22, 2017 at 09:16:13AM +0300, Peter Ujfalusi wrote:
> Stefan, Vinod,
> 
> 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 
> On 2017-09-21 21:29, Peter Ujfalusi wrote:
> > 
> > 
> > On 2017-09-21 20:17, Vinod Koul wrote:
> >> On Sun, Sep 17, 2017 at 04:25:10PM +0200, Stefan Brüns wrote:
> >>> The driver would happily accept buswidth of 16/32/64 bytes and program
> >>> garbage to its registers.
> >>
> >> Peter?
> > 
> > Well, eDMA as such has no limitation on the buswidth, the addr_width
> > become ACNT, counter for the inner loop - which we use to represent the
> > word length. In theory we could support 32K-1 long word with eDMA, which
> > we actually do in case of memcpy.
> > 
> > But the driver does state that it supports bus width of 1, 2, 3 and 4 bytes.
> > 
> > These are form the past and I never felt the need to check them.
> > 
> > I think it is fine to reject salve config when asking for longer dev
> > width. I might revisit later if the need comes..
> > 
> > Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> 
> If it is not too late, I have second thoughts about this..
> It might be better to remove the src_addr_width/dst_addr_width check
> from edma_slave_config() and add all DMA_SLAVE_BUSWIDTH_* to
> EDMA_DMA_BUSWIDTHS.

fine by me, pls send updated..

-- 
~Vinod

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web