Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751848AbdIVGQP (ORCPT ); Fri, 22 Sep 2017 02:16:15 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:42359 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751637AbdIVGQN (ORCPT ); Fri, 22 Sep 2017 02:16:13 -0400 Subject: Re: [PATCH] dmaengine: edma: Reject slave configs using a buswidth of 8 and larger To: Vinod Koul , =?UTF-8?Q?Stefan_Br=c3=bcns?= References: <20170917142510.3111-1-stefan.bruens@rwth-aachen.de> <20170921171743.GI30097@localhost> <13ff5f5c-3872-4af5-1baf-205fe01bb0f2@ti.com> CC: , , Dan Williams From: Peter Ujfalusi Message-ID: <83394991-4b17-46e6-aa4f-89c60b43e10a@ti.com> Date: Fri, 22 Sep 2017 09:16:13 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <13ff5f5c-3872-4af5-1baf-205fe01bb0f2@ti.com> Content-Type: text/plain; charset="utf-8" X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v8M6GJDY010026 Content-Length: 2078 Lines: 67 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 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 >>> --- >>> 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