From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <5076464A.6070309@st.com> Date: Thu, 11 Oct 2012 09:38:42 +0530 From: Vipin Kumar MIME-Version: 1.0 To: Linus Walleij Subject: Re: [PATCH 07/11] fsmc/nand: Provide contiguous buffers to dma References: <2b88c853b3691338fae037f569917fc300cd6032.1349778821.git.vipin.kumar@st.com> In-Reply-To: Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Cc: "dedekind1@gmail.com" , Vinod Koul , spear-devel , "linux-mtd@lists.infradead.org" , "plagnioj@jcrosoft.com" , "linux-arm-kernel@lists.infradead.org" List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On 10/10/2012 10:37 PM, Linus Walleij wrote: > On Tue, Oct 9, 2012 at 12:44 PM, Vipin Kumar wrote: > >> read_buf/write_buf callbacks should be able to accept a user space memory >> address (virtually contiguous memory) as buffer pointer. >> >> This patch allocates a logically contiguous memory area which is use for dma > > You mean PHYSICALLY contigous, don't you? > Yes Sorry for that :) >> xfers during read and write accesses. >> >> Signed-off-by: Vipin Kumar > > If you really want a physically contigous buffer you need to use > CMA, but I don't think that is the real problem here... > > We're already using userspace buffers in e.g. the MMCI driver > (drivers/mmc/host/mmci.c). > > The real problem is likely the DMA driver. The stuf that get > fed into dma.device_prep_dma_memcpy() needs to be > converted to a scatterlist and then set up in the LLI list > for the controller. > > IIRC SPEAr is using drivers/dma/dw_dmac.c so > check this driver's dwc_prep_dma_memcpy(). > It does seem like it is checking whether src or > dest is scattered in this for() loop: > > for (offset = 0; offset< len; offset += xfer_count<< src_width) {} > > dma_sync_single_for_device() is translating the virtual > address to physical for every chunk BTW. > > So instead of doing this copying, debug the problem, and > see if there is a bug in that for()-loop or similar, if it needs > to be rewritten or so. > I would debug again and reply to this mail soon > Yours, > Linus Walleij > . > From mboxrd@z Thu Jan 1 00:00:00 1970 From: vipin.kumar@st.com (Vipin Kumar) Date: Thu, 11 Oct 2012 09:38:42 +0530 Subject: [PATCH 07/11] fsmc/nand: Provide contiguous buffers to dma In-Reply-To: References: <2b88c853b3691338fae037f569917fc300cd6032.1349778821.git.vipin.kumar@st.com> Message-ID: <5076464A.6070309@st.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On 10/10/2012 10:37 PM, Linus Walleij wrote: > On Tue, Oct 9, 2012 at 12:44 PM, Vipin Kumar wrote: > >> read_buf/write_buf callbacks should be able to accept a user space memory >> address (virtually contiguous memory) as buffer pointer. >> >> This patch allocates a logically contiguous memory area which is use for dma > > You mean PHYSICALLY contigous, don't you? > Yes Sorry for that :) >> xfers during read and write accesses. >> >> Signed-off-by: Vipin Kumar > > If you really want a physically contigous buffer you need to use > CMA, but I don't think that is the real problem here... > > We're already using userspace buffers in e.g. the MMCI driver > (drivers/mmc/host/mmci.c). > > The real problem is likely the DMA driver. The stuf that get > fed into dma.device_prep_dma_memcpy() needs to be > converted to a scatterlist and then set up in the LLI list > for the controller. > > IIRC SPEAr is using drivers/dma/dw_dmac.c so > check this driver's dwc_prep_dma_memcpy(). > It does seem like it is checking whether src or > dest is scattered in this for() loop: > > for (offset = 0; offset< len; offset += xfer_count<< src_width) {} > > dma_sync_single_for_device() is translating the virtual > address to physical for every chunk BTW. > > So instead of doing this copying, debug the problem, and > see if there is a bug in that for()-loop or similar, if it needs > to be rewritten or so. > I would debug again and reply to this mail soon > Yours, > Linus Walleij > . >