Message ID | 20211115085403.360194-8-arnd@kernel.org |
---|---|
State | Superseded |
Headers | show |
Series | dmaengine: kill off dma_slave_config->slave_id | expand |
Hi Arnd, I love your patch! Perhaps something to improve: [auto build test WARNING on vkoul-dmaengine/next] [also build test WARNING on tiwai-sound/for-next staging/staging-testing linus/master v5.16-rc1 next-20211118] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Arnd-Bergmann/dmaengine-kill-off-dma_slave_config-slave_id/20211115-165731 base: https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git next config: xtensa-buildonly-randconfig-r005-20211115 (attached as .config) compiler: xtensa-linux-gcc (GCC) 11.2.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/f2e7f9ee67ce784864f75db39f20d1060c932279 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Arnd-Bergmann/dmaengine-kill-off-dma_slave_config-slave_id/20211115-165731 git checkout f2e7f9ee67ce784864f75db39f20d1060c932279 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=xtensa If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): >> drivers/dma/qcom/qcom_adm.c:712:18: warning: no previous prototype for 'adm_dma_xlate' [-Wmissing-prototypes] 712 | struct dma_chan *adm_dma_xlate(struct of_phandle_args *dma_spec, | ^~~~~~~~~~~~~ vim +/adm_dma_xlate +712 drivers/dma/qcom/qcom_adm.c 700 701 /** 702 * adm_dma_xlate 703 * @dma_spec: pointer to DMA specifier as found in the device tree 704 * @ofdma: pointer to DMA controller data 705 * 706 * This can use either 1-cell or 2-cell formats, the first cell 707 * identifies the slave device, while the optional second cell 708 * contains the crci value. 709 * 710 * Returns pointer to appropriate dma channel on success or NULL on error. 711 */ > 712 struct dma_chan *adm_dma_xlate(struct of_phandle_args *dma_spec, 713 struct of_dma *ofdma) 714 { 715 struct dma_device *dev = ofdma->of_dma_data; 716 struct dma_chan *chan, *candidate = NULL; 717 struct adm_chan *achan; 718 719 if (!dev || dma_spec->args_count > 2) 720 return NULL; 721 722 list_for_each_entry(chan, &dev->channels, device_node) 723 if (chan->chan_id == dma_spec->args[0]) { 724 candidate = chan; 725 break; 726 } 727 728 if (!candidate) 729 return NULL; 730 731 achan = to_adm_chan(candidate); 732 if (dma_spec->args_count == 2) 733 achan->crci = dma_spec->args[1]; 734 else 735 achan->crci = 0; 736 737 return dma_get_slave_channel(candidate); 738 } 739 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Arnd, I love your patch! Perhaps something to improve: [auto build test WARNING on vkoul-dmaengine/next] [also build test WARNING on tiwai-sound/for-next staging/staging-testing linus/master v5.16-rc2 next-20211125] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Arnd-Bergmann/dmaengine-kill-off-dma_slave_config-slave_id/20211115-165731 base: https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git next config: riscv-randconfig-r016-20211115 (https://download.01.org/0day-ci/archive/20211125/202111251538.x6sJNCka-lkp@intel.com/config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project fbe72e41b99dc7994daac300d208a955be3e4a0a) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install riscv cross compiling tool for clang build # apt-get install binutils-riscv64-linux-gnu # https://github.com/0day-ci/linux/commit/f2e7f9ee67ce784864f75db39f20d1060c932279 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Arnd-Bergmann/dmaengine-kill-off-dma_slave_config-slave_id/20211115-165731 git checkout f2e7f9ee67ce784864f75db39f20d1060c932279 # save the config file to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): >> drivers/dma/qcom/qcom_adm.c:712:18: warning: no previous prototype for function 'adm_dma_xlate' [-Wmissing-prototypes] struct dma_chan *adm_dma_xlate(struct of_phandle_args *dma_spec, ^ drivers/dma/qcom/qcom_adm.c:712:1: note: declare 'static' if the function is not intended to be used outside of this translation unit struct dma_chan *adm_dma_xlate(struct of_phandle_args *dma_spec, ^ static 1 warning generated. vim +/adm_dma_xlate +712 drivers/dma/qcom/qcom_adm.c 700 701 /** 702 * adm_dma_xlate 703 * @dma_spec: pointer to DMA specifier as found in the device tree 704 * @ofdma: pointer to DMA controller data 705 * 706 * This can use either 1-cell or 2-cell formats, the first cell 707 * identifies the slave device, while the optional second cell 708 * contains the crci value. 709 * 710 * Returns pointer to appropriate dma channel on success or NULL on error. 711 */ > 712 struct dma_chan *adm_dma_xlate(struct of_phandle_args *dma_spec, 713 struct of_dma *ofdma) 714 { 715 struct dma_device *dev = ofdma->of_dma_data; 716 struct dma_chan *chan, *candidate = NULL; 717 struct adm_chan *achan; 718 719 if (!dev || dma_spec->args_count > 2) 720 return NULL; 721 722 list_for_each_entry(chan, &dev->channels, device_node) 723 if (chan->chan_id == dma_spec->args[0]) { 724 candidate = chan; 725 break; 726 } 727 728 if (!candidate) 729 return NULL; 730 731 achan = to_adm_chan(candidate); 732 if (dma_spec->args_count == 2) 733 achan->crci = dma_spec->args[1]; 734 else 735 achan->crci = 0; 736 737 return dma_get_slave_channel(candidate); 738 } 739 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
On Thu, Nov 25, 2021 at 8:57 AM kernel test robot <lkp@intel.com> wrote: > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot <lkp@intel.com> > > All warnings (new ones prefixed by >>): > > >> drivers/dma/qcom/qcom_adm.c:712:18: warning: no previous prototype for function 'adm_dma_xlate' [-Wmissing-prototypes] > struct dma_chan *adm_dma_xlate(struct of_phandle_args *dma_spec, > ^ > drivers/dma/qcom/qcom_adm.c:712:1: note: declare 'static' if the function is not intended to be used outside of this translation unit > struct dma_chan *adm_dma_xlate(struct of_phandle_args *dma_spec, > ^ > static > 1 warning generated. I noticed this mistake slipped into v2 as well, the function needs to be marked 'static'. Vinod, let me know how you want me to address this. Should I just fold the fix (see below) and the final Acks into the patch and send an updated pull request, or do a complete v3 submission? Arnd 8<--- diff --git a/drivers/dma/qcom/qcom_adm.c b/drivers/dma/qcom/qcom_adm.c index bb338b303af6..65697bee4db0 100644 --- a/drivers/dma/qcom/qcom_adm.c +++ b/drivers/dma/qcom/qcom_adm.c @@ -709,8 +709,8 @@ static void adm_channel_init(struct adm_device *adev, struct adm_chan *achan, * * Returns pointer to appropriate dma channel on success or NULL on error. */ -struct dma_chan *adm_dma_xlate(struct of_phandle_args *dma_spec, - struct of_dma *ofdma) +static struct dma_chan *adm_dma_xlate(struct of_phandle_args *dma_spec, + struct of_dma *ofdma) { struct dma_device *dev = ofdma->of_dma_data; struct dma_chan *chan, *candidate = NULL;
On 25-11-21, 09:25, Arnd Bergmann wrote: > On Thu, Nov 25, 2021 at 8:57 AM kernel test robot <lkp@intel.com> wrote: > > > > If you fix the issue, kindly add following tag as appropriate > > Reported-by: kernel test robot <lkp@intel.com> > > > > All warnings (new ones prefixed by >>): > > > > >> drivers/dma/qcom/qcom_adm.c:712:18: warning: no previous prototype for function 'adm_dma_xlate' [-Wmissing-prototypes] > > struct dma_chan *adm_dma_xlate(struct of_phandle_args *dma_spec, > > ^ > > drivers/dma/qcom/qcom_adm.c:712:1: note: declare 'static' if the function is not intended to be used outside of this translation unit > > struct dma_chan *adm_dma_xlate(struct of_phandle_args *dma_spec, > > ^ > > static > > 1 warning generated. > > I noticed this mistake slipped into v2 as well, the function needs to > be marked 'static'. > > Vinod, let me know how you want me to address this. Should I just fold > the fix (see below) > and the final Acks into the patch and send an updated pull request, or > do a complete v3 > submission? I can fold this while applying, the series lgtm, I will wait a day before applying... Thanks > > Arnd > > 8<--- > diff --git a/drivers/dma/qcom/qcom_adm.c b/drivers/dma/qcom/qcom_adm.c > index bb338b303af6..65697bee4db0 100644 > --- a/drivers/dma/qcom/qcom_adm.c > +++ b/drivers/dma/qcom/qcom_adm.c > @@ -709,8 +709,8 @@ static void adm_channel_init(struct adm_device > *adev, struct adm_chan *achan, > * > * Returns pointer to appropriate dma channel on success or NULL on error. > */ > -struct dma_chan *adm_dma_xlate(struct of_phandle_args *dma_spec, > - struct of_dma *ofdma) > +static struct dma_chan *adm_dma_xlate(struct of_phandle_args *dma_spec, > + struct of_dma *ofdma) > { > struct dma_device *dev = ofdma->of_dma_data; > struct dma_chan *chan, *candidate = NULL;
diff --git a/drivers/dma/qcom/qcom_adm.c b/drivers/dma/qcom/qcom_adm.c index ee78bed8d60d..bb338b303af6 100644 --- a/drivers/dma/qcom/qcom_adm.c +++ b/drivers/dma/qcom/qcom_adm.c @@ -8,6 +8,7 @@ #include <linux/device.h> #include <linux/dmaengine.h> #include <linux/dma-mapping.h> +#include <linux/dma/qcom_adm.h> #include <linux/init.h> #include <linux/interrupt.h> #include <linux/io.h> @@ -140,6 +141,8 @@ struct adm_chan { struct adm_async_desc *curr_txd; struct dma_slave_config slave; + u32 crci; + u32 mux; struct list_head node; int error; @@ -379,8 +382,8 @@ static struct dma_async_tx_descriptor *adm_prep_slave_sg(struct dma_chan *chan, return ERR_PTR(-EINVAL); } - crci = achan->slave.slave_id & 0xf; - if (!crci || achan->slave.slave_id > 0x1f) { + crci = achan->crci & 0xf; + if (!crci || achan->crci > 0x1f) { dev_err(adev->dev, "invalid crci value\n"); return ERR_PTR(-EINVAL); } @@ -403,9 +406,7 @@ static struct dma_async_tx_descriptor *adm_prep_slave_sg(struct dma_chan *chan, if (!async_desc) return ERR_PTR(-ENOMEM); - if (crci) - async_desc->mux = achan->slave.slave_id & ADM_CRCI_MUX_SEL ? - ADM_CRCI_CTL_MUX_SEL : 0; + async_desc->mux = achan->mux ? ADM_CRCI_CTL_MUX_SEL : 0; async_desc->crci = crci; async_desc->blk_size = blk_size; async_desc->dma_len = single_count * sizeof(struct adm_desc_hw_single) + @@ -488,10 +489,13 @@ static int adm_terminate_all(struct dma_chan *chan) static int adm_slave_config(struct dma_chan *chan, struct dma_slave_config *cfg) { struct adm_chan *achan = to_adm_chan(chan); + struct qcom_adm_peripheral_config *config = cfg->peripheral_config; unsigned long flag; spin_lock_irqsave(&achan->vc.lock, flag); memcpy(&achan->slave, cfg, sizeof(struct dma_slave_config)); + if (cfg->peripheral_size == sizeof(config)) + achan->crci = config->crci; spin_unlock_irqrestore(&achan->vc.lock, flag); return 0; @@ -694,6 +698,45 @@ static void adm_channel_init(struct adm_device *adev, struct adm_chan *achan, achan->vc.desc_free = adm_dma_free_desc; } +/** + * adm_dma_xlate + * @dma_spec: pointer to DMA specifier as found in the device tree + * @ofdma: pointer to DMA controller data + * + * This can use either 1-cell or 2-cell formats, the first cell + * identifies the slave device, while the optional second cell + * contains the crci value. + * + * Returns pointer to appropriate dma channel on success or NULL on error. + */ +struct dma_chan *adm_dma_xlate(struct of_phandle_args *dma_spec, + struct of_dma *ofdma) +{ + struct dma_device *dev = ofdma->of_dma_data; + struct dma_chan *chan, *candidate = NULL; + struct adm_chan *achan; + + if (!dev || dma_spec->args_count > 2) + return NULL; + + list_for_each_entry(chan, &dev->channels, device_node) + if (chan->chan_id == dma_spec->args[0]) { + candidate = chan; + break; + } + + if (!candidate) + return NULL; + + achan = to_adm_chan(candidate); + if (dma_spec->args_count == 2) + achan->crci = dma_spec->args[1]; + else + achan->crci = 0; + + return dma_get_slave_channel(candidate); +} + static int adm_dma_probe(struct platform_device *pdev) { struct adm_device *adev; @@ -838,8 +881,7 @@ static int adm_dma_probe(struct platform_device *pdev) goto err_disable_clks; } - ret = of_dma_controller_register(pdev->dev.of_node, - of_dma_xlate_by_chan_id, + ret = of_dma_controller_register(pdev->dev.of_node, adm_dma_xlate, &adev->common); if (ret) goto err_unregister_dma; diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c index 04e6f7b26706..7c6efa3b6255 100644 --- a/drivers/mtd/nand/raw/qcom_nandc.c +++ b/drivers/mtd/nand/raw/qcom_nandc.c @@ -6,6 +6,7 @@ #include <linux/clk.h> #include <linux/slab.h> #include <linux/bitops.h> +#include <linux/dma/qcom_adm.h> #include <linux/dma-mapping.h> #include <linux/dmaengine.h> #include <linux/module.h> @@ -952,6 +953,7 @@ static int prep_adm_dma_desc(struct qcom_nand_controller *nandc, bool read, struct dma_async_tx_descriptor *dma_desc; struct scatterlist *sgl; struct dma_slave_config slave_conf; + struct qcom_adm_peripheral_config periph_conf = {}; enum dma_transfer_direction dir_eng; int ret; @@ -983,11 +985,19 @@ static int prep_adm_dma_desc(struct qcom_nand_controller *nandc, bool read, if (read) { slave_conf.src_maxburst = 16; slave_conf.src_addr = nandc->base_dma + reg_off; - slave_conf.slave_id = nandc->data_crci; + if (nandc->data_crci) { + periph_conf.crci = nandc->data_crci; + slave_conf.peripheral_config = &periph_conf; + slave_conf.peripheral_size = sizeof(periph_conf); + } } else { slave_conf.dst_maxburst = 16; slave_conf.dst_addr = nandc->base_dma + reg_off; - slave_conf.slave_id = nandc->cmd_crci; + if (nandc->cmd_crci) { + periph_conf.crci = nandc->cmd_crci; + slave_conf.peripheral_config = &periph_conf; + slave_conf.peripheral_size = sizeof(periph_conf); + } } ret = dmaengine_slave_config(nandc->chan, &slave_conf); diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c index fcef7a961430..c6be09f44dc1 100644 --- a/drivers/tty/serial/msm_serial.c +++ b/drivers/tty/serial/msm_serial.c @@ -9,6 +9,7 @@ #include <linux/kernel.h> #include <linux/atomic.h> +#include <linux/dma/qcom_adm.h> #include <linux/dma-mapping.h> #include <linux/dmaengine.h> #include <linux/module.h> @@ -290,6 +291,7 @@ static void msm_request_tx_dma(struct msm_port *msm_port, resource_size_t base) { struct device *dev = msm_port->uart.dev; struct dma_slave_config conf; + struct qcom_adm_peripheral_config periph_conf = {}; struct msm_dma *dma; u32 crci = 0; int ret; @@ -308,7 +310,11 @@ static void msm_request_tx_dma(struct msm_port *msm_port, resource_size_t base) conf.device_fc = true; conf.dst_addr = base + UARTDM_TF; conf.dst_maxburst = UARTDM_BURST_SIZE; - conf.slave_id = crci; + if (crci) { + conf.peripheral_config = &periph_conf; + conf.peripheral_size = sizeof(periph_conf); + periph_conf.crci = crci; + } ret = dmaengine_slave_config(dma->chan, &conf); if (ret) @@ -333,6 +339,7 @@ static void msm_request_rx_dma(struct msm_port *msm_port, resource_size_t base) { struct device *dev = msm_port->uart.dev; struct dma_slave_config conf; + struct qcom_adm_peripheral_config periph_conf = {}; struct msm_dma *dma; u32 crci = 0; int ret; @@ -355,7 +362,11 @@ static void msm_request_rx_dma(struct msm_port *msm_port, resource_size_t base) conf.device_fc = true; conf.src_addr = base + UARTDM_RF; conf.src_maxburst = UARTDM_BURST_SIZE; - conf.slave_id = crci; + if (crci) { + conf.peripheral_config = &periph_conf; + conf.peripheral_size = sizeof(periph_conf); + periph_conf.crci = crci; + } ret = dmaengine_slave_config(dma->chan, &conf); if (ret) diff --git a/include/linux/dma/qcom_adm.h b/include/linux/dma/qcom_adm.h new file mode 100644 index 000000000000..af20df674f0c --- /dev/null +++ b/include/linux/dma/qcom_adm.h @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0-only +#ifndef __LINUX_DMA_QCOM_ADM_H +#define __LINUX_DMA_QCOM_ADM_H + +#include <linux/types.h> + +struct qcom_adm_peripheral_config { + u32 crci; + u32 mux; +}; + +#endif /* __LINUX_DMA_QCOM_ADM_H */