* [PATCH 0/2] spi-ti-qspi: Handle vmalloc'd buffers @ 2017-03-31 11:49 Vignesh R 2017-03-31 11:49 ` [PATCH 1/2] spi: Add can_dma like interface for spi_flash_read Vignesh R 2017-03-31 11:49 ` [PATCH 2/2] spi: spi-ti-qspi: Use bounce buffer if read buffer is not DMA'ble Vignesh R 0 siblings, 2 replies; 7+ messages in thread From: Vignesh R @ 2017-03-31 11:49 UTC (permalink / raw) To: Mark Brown Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-omap-u79uwXL29TY76Z2rM5mHXA, Vignesh R First patch, adds can_dma() like interface for spi_flash_read() interface, this will enable controller drivers to selectively use DMA based on buffer type, alignment, size or other limitations. Second patch implements bounce buffer support for ti-qspi driver to handle buffers that are not DMA'able, like vmalloc'd buffers that belong to LPAE region. This is required to work with UBIFS Vignesh R (2): spi: Add can_dma like interface for spi_flash_read spi: spi-ti-qspi: Use bounce buffer if read buffer is not DMA'ble drivers/spi/spi-ti-qspi.c | 64 +++++++++++++++++++++++++++++++++++++++++------ drivers/spi/spi.c | 2 +- include/linux/spi/spi.h | 4 +++ 3 files changed, 62 insertions(+), 8 deletions(-) -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] spi: Add can_dma like interface for spi_flash_read 2017-03-31 11:49 [PATCH 0/2] spi-ti-qspi: Handle vmalloc'd buffers Vignesh R @ 2017-03-31 11:49 ` Vignesh R [not found] ` <20170331114950.21489-2-vigneshr-l0cyMroinI0@public.gmane.org> 2017-03-31 11:49 ` [PATCH 2/2] spi: spi-ti-qspi: Use bounce buffer if read buffer is not DMA'ble Vignesh R 1 sibling, 1 reply; 7+ messages in thread From: Vignesh R @ 2017-03-31 11:49 UTC (permalink / raw) To: Mark Brown; +Cc: linux-spi, linux-kernel, linux-omap, Vignesh R Add an interface analogous to ->can_dma() for spi_flash_read() interface. This will enable SPI controller drivers to inform SPI core when not to do DMA mappings. Signed-off-by: Vignesh R <vigneshr@ti.com> --- drivers/spi/spi.c | 2 +- include/linux/spi/spi.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index f699ea530b88..57b64d2128e5 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2854,7 +2854,7 @@ int spi_flash_read(struct spi_device *spi, mutex_lock(&master->bus_lock_mutex); mutex_lock(&master->io_mutex); - if (master->dma_rx) { + if (master->dma_rx && master->spi_flash_can_dma(spi, msg)) { rx_dev = master->dma_rx->device->dev; ret = spi_map_buf(master, rx_dev, &msg->rx_sg, msg->buf, msg->len, diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 805878d61a8f..935bd2854ff1 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -376,6 +376,8 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) * @unprepare_message: undo any work done by prepare_message(). * @spi_flash_read: to support spi-controller hardwares that provide * accelerated interface to read from flash devices. + * @spi_flash_can_dma: analogous to can_dma() interface, but for + * controllers implementing spi_flash_read. * @flash_read_supported: spi device supports flash read * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS * number. Any individual value may be -ENOENT for CS lines that @@ -539,6 +541,8 @@ struct spi_master { struct spi_message *message); int (*spi_flash_read)(struct spi_device *spi, struct spi_flash_read_message *msg); + bool (*spi_flash_can_dma)(struct spi_device *spi, + struct spi_flash_read_message *msg); bool (*flash_read_supported)(struct spi_device *spi); /* -- 2.11.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
[parent not found: <20170331114950.21489-2-vigneshr-l0cyMroinI0@public.gmane.org>]
* Applied "spi: Add can_dma like interface for spi_flash_read" to the spi tree [not found] ` <20170331114950.21489-2-vigneshr-l0cyMroinI0@public.gmane.org> @ 2017-04-21 17:29 ` Mark Brown 0 siblings, 0 replies; 7+ messages in thread From: Mark Brown @ 2017-04-21 17:29 UTC (permalink / raw) To: Vignesh R Cc: Mark Brown, Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-omap-u79uwXL29TY76Z2rM5mHXA, linux-spi-u79uwXL29TY76Z2rM5mHXA The patch spi: Add can_dma like interface for spi_flash_read has been applied to the spi tree at git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From 2bca34455b257d75080d87e800ae14afe49001bf Mon Sep 17 00:00:00 2001 From: Vignesh R <vigneshr-l0cyMroinI0@public.gmane.org> Date: Tue, 11 Apr 2017 17:22:24 +0530 Subject: [PATCH] spi: Add can_dma like interface for spi_flash_read Add an interface analogous to ->can_dma() for spi_flash_read() interface. This will enable SPI controller drivers to inform SPI core when not to do DMA mappings. Signed-off-by: Vignesh R <vigneshr-l0cyMroinI0@public.gmane.org> Signed-off-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> --- drivers/spi/spi.c | 2 +- include/linux/spi/spi.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 656dd3e3220c..5e1bb43b8a8f 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2811,7 +2811,7 @@ int spi_flash_read(struct spi_device *spi, mutex_lock(&master->bus_lock_mutex); mutex_lock(&master->io_mutex); - if (master->dma_rx) { + if (master->dma_rx && master->spi_flash_can_dma(spi, msg)) { rx_dev = master->dma_rx->device->dev; ret = spi_map_buf(master, rx_dev, &msg->rx_sg, msg->buf, msg->len, diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 75c6bd0ac605..cd8ae65568e3 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -375,6 +375,8 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) * @unprepare_message: undo any work done by prepare_message(). * @spi_flash_read: to support spi-controller hardwares that provide * accelerated interface to read from flash devices. + * @spi_flash_can_dma: analogous to can_dma() interface, but for + * controllers implementing spi_flash_read. * @flash_read_supported: spi device supports flash read * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS * number. Any individual value may be -ENOENT for CS lines that @@ -538,6 +540,8 @@ struct spi_master { struct spi_message *message); int (*spi_flash_read)(struct spi_device *spi, struct spi_flash_read_message *msg); + bool (*spi_flash_can_dma)(struct spi_device *spi, + struct spi_flash_read_message *msg); bool (*flash_read_supported)(struct spi_device *spi); /* -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] spi: spi-ti-qspi: Use bounce buffer if read buffer is not DMA'ble 2017-03-31 11:49 [PATCH 0/2] spi-ti-qspi: Handle vmalloc'd buffers Vignesh R 2017-03-31 11:49 ` [PATCH 1/2] spi: Add can_dma like interface for spi_flash_read Vignesh R @ 2017-03-31 11:49 ` Vignesh R [not found] ` <20170331114950.21489-3-vigneshr-l0cyMroinI0@public.gmane.org> 1 sibling, 1 reply; 7+ messages in thread From: Vignesh R @ 2017-03-31 11:49 UTC (permalink / raw) To: Mark Brown; +Cc: linux-spi, linux-kernel, linux-omap, Vignesh R Flash filesystems like JFFS2, UBIFS and MTD block layer can provide vmalloc'd or kmap'd buffers that cannot be mapped using dma_map_sg() and can potentially be in memory region above 32bit addressable region(ie buffers belonging to memory region backed by LPAE) of DMA, implement spi_flash_can_dma() interface to inform SPI core not to map such buffers. When buffers are not mapped for DMA, then use a pre allocated bounce buffer(64K = typical flash erase sector size) to read from flash and then do a copy to actual destination buffer. This is approach is much faster than using memcpy using CPU and also reduces CPU load. With this patch, UBIFS read speed is ~18MB/s and CPU utilization <20% on DRA74 Rev H EVM. Performance degradation is negligible when compared with non bounce buffer case while using UBIFS. Signed-off-by: Vignesh R <vigneshr@ti.com> --- drivers/spi/spi-ti-qspi.c | 64 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c index 7b39bc204a30..dce6ce634143 100644 --- a/drivers/spi/spi-ti-qspi.c +++ b/drivers/spi/spi-ti-qspi.c @@ -57,6 +57,8 @@ struct ti_qspi { struct ti_qspi_regs ctx_reg; dma_addr_t mmap_phys_base; + dma_addr_t rx_bb_dma_addr; + void *rx_bb_addr; struct dma_chan *rx_chan; u32 spi_max_frequency; @@ -126,6 +128,8 @@ struct ti_qspi { #define QSPI_SETUP_ADDR_SHIFT 8 #define QSPI_SETUP_DUMMY_SHIFT 10 +#define QSPI_DMA_BUFFER_SIZE 65536U + static inline unsigned long ti_qspi_read(struct ti_qspi *qspi, unsigned long reg) { @@ -429,6 +433,34 @@ static int ti_qspi_dma_xfer(struct ti_qspi *qspi, dma_addr_t dma_dst, return 0; } +static int ti_qspi_dma_bounce_buffer(struct ti_qspi *qspi, + struct spi_flash_read_message *msg) +{ + size_t readsize = msg->len; + unsigned int to = (unsigned int)msg->buf; + dma_addr_t dma_src = qspi->mmap_phys_base + msg->from; + int ret = 0; + + /* + * Use bounce buffer as FS like jffs2, ubifs may pass + * buffers that does not belong to kernel lowmem region. + */ + while (readsize != 0) { + size_t xfer_len = min(QSPI_DMA_BUFFER_SIZE, readsize); + + ret = ti_qspi_dma_xfer(qspi, qspi->rx_bb_dma_addr, + dma_src, xfer_len); + if (ret != 0) + return ret; + memcpy((void *)to, qspi->rx_bb_addr, xfer_len); + readsize -= xfer_len; + dma_src += xfer_len; + to += xfer_len; + } + + return ret; +} + static int ti_qspi_dma_xfer_sg(struct ti_qspi *qspi, struct sg_table rx_sg, loff_t from) { @@ -496,6 +528,12 @@ static void ti_qspi_setup_mmap_read(struct spi_device *spi, QSPI_SPI_SETUP_REG(spi->chip_select)); } +static bool ti_qspi_spi_flash_can_dma(struct spi_device *spi, + struct spi_flash_read_message *msg) +{ + return virt_addr_valid(msg->buf); +} + static int ti_qspi_spi_flash_read(struct spi_device *spi, struct spi_flash_read_message *msg) { @@ -509,15 +547,12 @@ static int ti_qspi_spi_flash_read(struct spi_device *spi, ti_qspi_setup_mmap_read(spi, msg); if (qspi->rx_chan) { - if (msg->cur_msg_mapped) { + if (msg->cur_msg_mapped) ret = ti_qspi_dma_xfer_sg(qspi, msg->rx_sg, msg->from); - if (ret) - goto err_unlock; - } else { - dev_err(qspi->dev, "Invalid address for DMA\n"); - ret = -EIO; + else + ret = ti_qspi_dma_bounce_buffer(qspi, msg); + if (ret) goto err_unlock; - } } else { memcpy_fromio(msg->buf, qspi->mmap_base + msg->from, msg->len); } @@ -723,6 +758,17 @@ static int ti_qspi_probe(struct platform_device *pdev) ret = 0; goto no_dma; } + qspi->rx_bb_addr = dma_alloc_coherent(qspi->dev, + QSPI_DMA_BUFFER_SIZE, + &qspi->rx_bb_dma_addr, + GFP_KERNEL | GFP_DMA); + if (!qspi->rx_bb_addr) { + dev_err(qspi->dev, + "dma_alloc_coherent failed, using PIO mode\n"); + dma_release_channel(qspi->rx_chan); + goto no_dma; + } + master->spi_flash_can_dma = ti_qspi_spi_flash_can_dma; master->dma_rx = qspi->rx_chan; init_completion(&qspi->transfer_complete); if (res_mmap) @@ -763,6 +809,10 @@ static int ti_qspi_remove(struct platform_device *pdev) pm_runtime_put_sync(&pdev->dev); pm_runtime_disable(&pdev->dev); + if (qspi->rx_bb_addr) + dma_free_coherent(qspi->dev, QSPI_DMA_BUFFER_SIZE, + qspi->rx_bb_addr, + qspi->rx_bb_dma_addr); if (qspi->rx_chan) dma_release_channel(qspi->rx_chan); -- 2.11.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
[parent not found: <20170331114950.21489-3-vigneshr-l0cyMroinI0@public.gmane.org>]
* Re: [PATCH 2/2] spi: spi-ti-qspi: Use bounce buffer if read buffer is not DMA'ble [not found] ` <20170331114950.21489-3-vigneshr-l0cyMroinI0@public.gmane.org> @ 2017-04-02 23:33 ` kbuild test robot [not found] ` <201704030704.3H2aUqA0%fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> 2017-04-04 10:56 ` kbuild test robot 1 sibling, 1 reply; 7+ messages in thread From: kbuild test robot @ 2017-04-02 23:33 UTC (permalink / raw) To: Vignesh R Cc: kbuild-all-JC7UmRfGjtg, Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-omap-u79uwXL29TY76Z2rM5mHXA, Vignesh R [-- Attachment #1: Type: text/plain, Size: 4007 bytes --] Hi Vignesh, [auto build test WARNING on spi/for-next] [also build test WARNING on v4.11-rc4 next-20170331] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Vignesh-R/spi-ti-qspi-Handle-vmalloc-d-buffers/20170403-030332 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next config: x86_64-allmodconfig (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones prefixed by >>): include/linux/compiler.h:264:8: sparse: attribute 'no_sanitize_address': unknown attribute drivers/spi/spi-ti-qspi.c:449:35: sparse: incompatible types in comparison expression (different type sizes) drivers/spi/spi-ti-qspi.c: In function 'ti_qspi_dma_bounce_buffer': >> drivers/spi/spi-ti-qspi.c:440:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] unsigned int to = (unsigned int)msg->buf; ^ In file included from drivers/spi/spi-ti-qspi.c:16:0: include/linux/kernel.h:755:16: warning: comparison of distinct pointer types lacks a cast (void) (&min1 == &min2); \ ^ include/linux/kernel.h:758:2: note: in expansion of macro '__min' __min(typeof(x), typeof(y), \ ^~~~~ >> drivers/spi/spi-ti-qspi.c:449:21: note: in expansion of macro 'min' size_t xfer_len = min(QSPI_DMA_BUFFER_SIZE, readsize); ^~~ >> drivers/spi/spi-ti-qspi.c:455:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] memcpy((void *)to, qspi->rx_bb_addr, xfer_len); ^ sparse warnings: (new ones prefixed by >>) include/linux/compiler.h:264:8: sparse: attribute 'no_sanitize_address': unknown attribute >> drivers/spi/spi-ti-qspi.c:449:35: sparse: incompatible types in comparison expression (different type sizes) drivers/spi/spi-ti-qspi.c: In function 'ti_qspi_dma_bounce_buffer': drivers/spi/spi-ti-qspi.c:440:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] unsigned int to = (unsigned int)msg->buf; ^ In file included from drivers/spi/spi-ti-qspi.c:16:0: include/linux/kernel.h:755:16: warning: comparison of distinct pointer types lacks a cast (void) (&min1 == &min2); \ ^ include/linux/kernel.h:758:2: note: in expansion of macro '__min' __min(typeof(x), typeof(y), \ ^~~~~ drivers/spi/spi-ti-qspi.c:449:21: note: in expansion of macro 'min' size_t xfer_len = min(QSPI_DMA_BUFFER_SIZE, readsize); ^~~ drivers/spi/spi-ti-qspi.c:455:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] memcpy((void *)to, qspi->rx_bb_addr, xfer_len); ^ vim +440 drivers/spi/spi-ti-qspi.c 434 } 435 436 static int ti_qspi_dma_bounce_buffer(struct ti_qspi *qspi, 437 struct spi_flash_read_message *msg) 438 { 439 size_t readsize = msg->len; > 440 unsigned int to = (unsigned int)msg->buf; 441 dma_addr_t dma_src = qspi->mmap_phys_base + msg->from; 442 int ret = 0; 443 444 /* 445 * Use bounce buffer as FS like jffs2, ubifs may pass 446 * buffers that does not belong to kernel lowmem region. 447 */ 448 while (readsize != 0) { > 449 size_t xfer_len = min(QSPI_DMA_BUFFER_SIZE, readsize); 450 451 ret = ti_qspi_dma_xfer(qspi, qspi->rx_bb_dma_addr, 452 dma_src, xfer_len); 453 if (ret != 0) 454 return ret; > 455 memcpy((void *)to, qspi->rx_bb_addr, xfer_len); 456 readsize -= xfer_len; 457 dma_src += xfer_len; 458 to += xfer_len; --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 58860 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <201704030704.3H2aUqA0%fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH 2/2] spi: spi-ti-qspi: Use bounce buffer if read buffer is not DMA'ble [not found] ` <201704030704.3H2aUqA0%fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> @ 2017-04-03 6:22 ` Vignesh R 0 siblings, 0 replies; 7+ messages in thread From: Vignesh R @ 2017-04-03 6:22 UTC (permalink / raw) To: Mark Brown Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On Monday 03 April 2017 05:03 AM, kbuild test robot wrote: > Hi Vignesh, > > [auto build test WARNING on spi/for-next] > [also build test WARNING on v4.11-rc4 next-20170331] > [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] > > url: https://github.com/0day-ci/linux/commits/Vignesh-R/spi-ti-qspi-Handle-vmalloc-d-buffers/20170403-030332 > base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next > config: x86_64-allmodconfig (attached as .config) > compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 > reproduce: > # save the attached .config to linux build tree > make ARCH=x86_64 > > All warnings (new ones prefixed by >>): Thanks for the report. I will fix below warnings in the next version. > > include/linux/compiler.h:264:8: sparse: attribute 'no_sanitize_address': unknown attribute > drivers/spi/spi-ti-qspi.c:449:35: sparse: incompatible types in comparison expression (different type sizes) > drivers/spi/spi-ti-qspi.c: In function 'ti_qspi_dma_bounce_buffer': >>> drivers/spi/spi-ti-qspi.c:440:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] > unsigned int to = (unsigned int)msg->buf; > ^ > In file included from drivers/spi/spi-ti-qspi.c:16:0: > include/linux/kernel.h:755:16: warning: comparison of distinct pointer types lacks a cast > (void) (&min1 == &min2); \ > ^ > include/linux/kernel.h:758:2: note: in expansion of macro '__min' > __min(typeof(x), typeof(y), \ > ^~~~~ >>> drivers/spi/spi-ti-qspi.c:449:21: note: in expansion of macro 'min' > size_t xfer_len = min(QSPI_DMA_BUFFER_SIZE, readsize); > ^~~ >>> drivers/spi/spi-ti-qspi.c:455:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] > memcpy((void *)to, qspi->rx_bb_addr, xfer_len); > ^ > > sparse warnings: (new ones prefixed by >>) > > include/linux/compiler.h:264:8: sparse: attribute 'no_sanitize_address': unknown attribute >>> drivers/spi/spi-ti-qspi.c:449:35: sparse: incompatible types in comparison expression (different type sizes) > drivers/spi/spi-ti-qspi.c: In function 'ti_qspi_dma_bounce_buffer': > drivers/spi/spi-ti-qspi.c:440:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] > unsigned int to = (unsigned int)msg->buf; > ^ > In file included from drivers/spi/spi-ti-qspi.c:16:0: > include/linux/kernel.h:755:16: warning: comparison of distinct pointer types lacks a cast > (void) (&min1 == &min2); \ > ^ > include/linux/kernel.h:758:2: note: in expansion of macro '__min' > __min(typeof(x), typeof(y), \ > ^~~~~ > drivers/spi/spi-ti-qspi.c:449:21: note: in expansion of macro 'min' > size_t xfer_len = min(QSPI_DMA_BUFFER_SIZE, readsize); > ^~~ > drivers/spi/spi-ti-qspi.c:455:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] > memcpy((void *)to, qspi->rx_bb_addr, xfer_len); > ^ > > vim +440 drivers/spi/spi-ti-qspi.c > > 434 } > 435 > 436 static int ti_qspi_dma_bounce_buffer(struct ti_qspi *qspi, > 437 struct spi_flash_read_message *msg) > 438 { > 439 size_t readsize = msg->len; > > 440 unsigned int to = (unsigned int)msg->buf; > 441 dma_addr_t dma_src = qspi->mmap_phys_base + msg->from; > 442 int ret = 0; > 443 > 444 /* > 445 * Use bounce buffer as FS like jffs2, ubifs may pass > 446 * buffers that does not belong to kernel lowmem region. > 447 */ > 448 while (readsize != 0) { > > 449 size_t xfer_len = min(QSPI_DMA_BUFFER_SIZE, readsize); > 450 > 451 ret = ti_qspi_dma_xfer(qspi, qspi->rx_bb_dma_addr, > 452 dma_src, xfer_len); > 453 if (ret != 0) > 454 return ret; > > 455 memcpy((void *)to, qspi->rx_bb_addr, xfer_len); > 456 readsize -= xfer_len; > 457 dma_src += xfer_len; > 458 to += xfer_len; > > --- > 0-DAY kernel test infrastructure Open Source Technology Center > https://lists.01.org/pipermail/kbuild-all Intel Corporation > -- Regards Vignesh -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] spi: spi-ti-qspi: Use bounce buffer if read buffer is not DMA'ble [not found] ` <20170331114950.21489-3-vigneshr-l0cyMroinI0@public.gmane.org> 2017-04-02 23:33 ` kbuild test robot @ 2017-04-04 10:56 ` kbuild test robot 1 sibling, 0 replies; 7+ messages in thread From: kbuild test robot @ 2017-04-04 10:56 UTC (permalink / raw) To: Vignesh R Cc: kbuild-all-JC7UmRfGjtg, Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-omap-u79uwXL29TY76Z2rM5mHXA, Vignesh R [-- Attachment #1: Type: text/plain, Size: 2066 bytes --] Hi Vignesh, [auto build test WARNING on spi/for-next] [also build test WARNING on v4.11-rc5 next-20170404] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Vignesh-R/spi-ti-qspi-Handle-vmalloc-d-buffers/20170403-030332 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next config: tile-allmodconfig (attached as .config) compiler: tilegx-linux-gcc (GCC) 4.6.2 reproduce: wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=tile All warnings (new ones prefixed by >>): drivers//spi/spi-ti-qspi.c: In function 'ti_qspi_dma_bounce_buffer': drivers//spi/spi-ti-qspi.c:440:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] >> drivers//spi/spi-ti-qspi.c:449:21: warning: comparison of distinct pointer types lacks a cast [enabled by default] drivers//spi/spi-ti-qspi.c:455:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] vim +449 drivers//spi/spi-ti-qspi.c 434 } 435 436 static int ti_qspi_dma_bounce_buffer(struct ti_qspi *qspi, 437 struct spi_flash_read_message *msg) 438 { 439 size_t readsize = msg->len; > 440 unsigned int to = (unsigned int)msg->buf; 441 dma_addr_t dma_src = qspi->mmap_phys_base + msg->from; 442 int ret = 0; 443 444 /* 445 * Use bounce buffer as FS like jffs2, ubifs may pass 446 * buffers that does not belong to kernel lowmem region. 447 */ 448 while (readsize != 0) { > 449 size_t xfer_len = min(QSPI_DMA_BUFFER_SIZE, readsize); 450 451 ret = ti_qspi_dma_xfer(qspi, qspi->rx_bb_dma_addr, 452 dma_src, xfer_len); --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 48046 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-04-21 17:29 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-03-31 11:49 [PATCH 0/2] spi-ti-qspi: Handle vmalloc'd buffers Vignesh R 2017-03-31 11:49 ` [PATCH 1/2] spi: Add can_dma like interface for spi_flash_read Vignesh R [not found] ` <20170331114950.21489-2-vigneshr-l0cyMroinI0@public.gmane.org> 2017-04-21 17:29 ` Applied "spi: Add can_dma like interface for spi_flash_read" to the spi tree Mark Brown 2017-03-31 11:49 ` [PATCH 2/2] spi: spi-ti-qspi: Use bounce buffer if read buffer is not DMA'ble Vignesh R [not found] ` <20170331114950.21489-3-vigneshr-l0cyMroinI0@public.gmane.org> 2017-04-02 23:33 ` kbuild test robot [not found] ` <201704030704.3H2aUqA0%fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> 2017-04-03 6:22 ` Vignesh R 2017-04-04 10:56 ` kbuild test robot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).