Re: [PATCH v11 2/4] dmaengine: tegra: Add tegra gpcdma driver

kernel test robot
2021-10-29T14:29:11Z

[-- Attachment #1: Type: text/plain, Size: 14157 bytes --]

Hi Akhil,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on vkoul-dmaengine/next arm64/for-next/core v5.15-rc7 next-20211029]
[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/Akhil-R/Add-NVIDIA-Tegra-GPC-DMA-driver/20211028-212920
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: openrisc-randconfig-r031-20211029 (attached as .config)
compiler: or1k-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/020f86b695432467db8b697540871173f6d751c8
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Akhil-R/Add-NVIDIA-Tegra-GPC-DMA-driver/20211028-212920
git checkout 020f86b695432467db8b697540871173f6d751c8
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=openrisc

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 >>):

include/linux/minmax.h:89:28: note: in expansion of macro 'min'
89 | #define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
| ^~~
include/linux/minmax.h:26:18: note: in expansion of macro '__typecheck'
26 | (__typecheck(x, y) && __no_side_effects(x, y))
| ^~~~~~~~~~~
include/linux/minmax.h:36:31: note: in expansion of macro '__safe_cmp'
36 | __builtin_choose_expr(__safe_cmp(x, y), \
| ^~~~~~~~~~
include/linux/minmax.h:52:25: note: in expansion of macro '__careful_cmp'
52 | #define max(x, y) __careful_cmp(x, y, >)
| ^~~~~~~~~~~~~
include/linux/minmax.h:89:45: note: in expansion of macro 'max'
89 | #define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
| ^~~
drivers/dma/tegra186-gpc-dma.c:692:9: note: in expansion of macro 'clamp'
692 | clamp(burst_mmio_width, TEGRA_GPCDMA_MMIOSEQ_BURST_MIN,
| ^~~~~
include/linux/minmax.h:20:35: warning: comparison of distinct pointer types lacks a cast
20 | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
| ^~
include/linux/minmax.h:28:40: note: in definition of macro '__cmp'
28 | #define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
| ^
include/linux/minmax.h:45:25: note: in expansion of macro '__careful_cmp'
45 | #define min(x, y) __careful_cmp(x, y, <)
| ^~~~~~~~~~~~~
include/linux/minmax.h:89:28: note: in expansion of macro 'min'
89 | #define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
| ^~~
include/linux/minmax.h:26:18: note: in expansion of macro '__typecheck'
26 | (__typecheck(x, y) && __no_side_effects(x, y))
| ^~~~~~~~~~~
include/linux/minmax.h:36:31: note: in expansion of macro '__safe_cmp'
36 | __builtin_choose_expr(__safe_cmp(x, y), \
| ^~~~~~~~~~
include/linux/minmax.h:52:25: note: in expansion of macro '__careful_cmp'
52 | #define max(x, y) __careful_cmp(x, y, >)
| ^~~~~~~~~~~~~
include/linux/minmax.h:89:45: note: in expansion of macro 'max'
89 | #define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
| ^~~
drivers/dma/tegra186-gpc-dma.c:692:9: note: in expansion of macro 'clamp'
692 | clamp(burst_mmio_width, TEGRA_GPCDMA_MMIOSEQ_BURST_MIN,
| ^~~~~
include/linux/minmax.h:20:35: warning: comparison of distinct pointer types lacks a cast
20 | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
| ^~
include/linux/minmax.h:31:24: note: in definition of macro '__cmp_once'
31 | typeof(x) unique_x = (x); \
| ^
include/linux/minmax.h:45:25: note: in expansion of macro '__careful_cmp'
45 | #define min(x, y) __careful_cmp(x, y, <)
| ^~~~~~~~~~~~~
include/linux/minmax.h:89:28: note: in expansion of macro 'min'
89 | #define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
| ^~~
include/linux/minmax.h:26:18: note: in expansion of macro '__typecheck'
26 | (__typecheck(x, y) && __no_side_effects(x, y))
| ^~~~~~~~~~~
include/linux/minmax.h:36:31: note: in expansion of macro '__safe_cmp'
36 | __builtin_choose_expr(__safe_cmp(x, y), \
| ^~~~~~~~~~
include/linux/minmax.h:52:25: note: in expansion of macro '__careful_cmp'
52 | #define max(x, y) __careful_cmp(x, y, >)
| ^~~~~~~~~~~~~
include/linux/minmax.h:89:45: note: in expansion of macro 'max'
89 | #define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
| ^~~
drivers/dma/tegra186-gpc-dma.c:692:9: note: in expansion of macro 'clamp'
692 | clamp(burst_mmio_width, TEGRA_GPCDMA_MMIOSEQ_BURST_MIN,
| ^~~~~
include/linux/minmax.h:20:35: warning: comparison of distinct pointer types lacks a cast
20 | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
| ^~
include/linux/minmax.h:31:39: note: in definition of macro '__cmp_once'
31 | typeof(x) unique_x = (x); \
| ^
include/linux/minmax.h:45:25: note: in expansion of macro '__careful_cmp'
45 | #define min(x, y) __careful_cmp(x, y, <)
| ^~~~~~~~~~~~~
include/linux/minmax.h:89:28: note: in expansion of macro 'min'
89 | #define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
| ^~~
include/linux/minmax.h:26:18: note: in expansion of macro '__typecheck'
26 | (__typecheck(x, y) && __no_side_effects(x, y))
| ^~~~~~~~~~~
include/linux/minmax.h:36:31: note: in expansion of macro '__safe_cmp'
36 | __builtin_choose_expr(__safe_cmp(x, y), \
| ^~~~~~~~~~
include/linux/minmax.h:52:25: note: in expansion of macro '__careful_cmp'
52 | #define max(x, y) __careful_cmp(x, y, >)
| ^~~~~~~~~~~~~
include/linux/minmax.h:89:45: note: in expansion of macro 'max'
89 | #define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
| ^~~
drivers/dma/tegra186-gpc-dma.c:692:9: note: in expansion of macro 'clamp'
692 | clamp(burst_mmio_width, TEGRA_GPCDMA_MMIOSEQ_BURST_MIN,
| ^~~~~
drivers/dma/tegra186-gpc-dma.c: In function 'tegra_dma_prep_dma_memset':
>> drivers/dma/tegra186-gpc-dma.c:785:74: warning: right shift count >= width of type [-Wshift-count-overflow]
785 | FIELD_PREP(TEGRA_GPCDMA_HIGH_ADDR_DST_PTR, (dest >> 32));
| ^~
drivers/dma/tegra186-gpc-dma.c: In function 'tegra_dma_prep_dma_memcpy':
drivers/dma/tegra186-gpc-dma.c:852:65: warning: right shift count >= width of type [-Wshift-count-overflow]
852 | FIELD_PREP(TEGRA_GPCDMA_HIGH_ADDR_SRC_PTR, (src >> 32));
| ^~
drivers/dma/tegra186-gpc-dma.c:854:66: warning: right shift count >= width of type [-Wshift-count-overflow]
854 | FIELD_PREP(TEGRA_GPCDMA_HIGH_ADDR_DST_PTR, (dest >> 32));
| ^~
drivers/dma/tegra186-gpc-dma.c: In function 'tegra_dma_prep_slave_sg':
drivers/dma/tegra186-gpc-dma.c:960:81: warning: right shift count >= width of type [-Wshift-count-overflow]
960 | FIELD_PREP(TEGRA_GPCDMA_HIGH_ADDR_SRC_PTR, (mem >> 32));
| ^~
drivers/dma/tegra186-gpc-dma.c:965:81: warning: right shift count >= width of type [-Wshift-count-overflow]
965 | FIELD_PREP(TEGRA_GPCDMA_HIGH_ADDR_DST_PTR, (mem >> 32));
| ^~
cc1: some warnings being treated as errors

vim +785 drivers/dma/tegra186-gpc-dma.c

676
677 static unsigned int get_burst_size(struct tegra_dma_channel *tdc,
678 u32 burst_size, enum dma_slave_buswidth slave_bw,
679 int len)
680 {
681 unsigned int burst_mmio_width, burst_byte;
682
683 /*
684 * burst_size from client is in terms of the bus_width.
685 * convert that into words.
686 * If burst_size is not specified from client, then use
687 * len to calculate the optimum burst size
688 */
689 burst_byte = burst_size ? burst_size * slave_bw : len;
690 burst_mmio_width = burst_byte / 4;
691
> 692 clamp(burst_mmio_width, TEGRA_GPCDMA_MMIOSEQ_BURST_MIN,
693 TEGRA_GPCDMA_MMIOSEQ_BURST_MAX);
694
695 return (fls(burst_mmio_width) - 1) << TEGRA_GPCDMA_MMIOSEQ_BURST_SHIFT;
696 }
697
698 static int get_transfer_param(struct tegra_dma_channel *tdc,
699 enum dma_transfer_direction direction,
700 unsigned long *apb_addr,
701 unsigned long *mmio_seq,
702 unsigned long *csr,
703 unsigned int *burst_size,
704 enum dma_slave_buswidth *slave_bw)
705 {
706 switch (direction) {
707 case DMA_MEM_TO_DEV:
708 *apb_addr = tdc->dma_sconfig.dst_addr;
709 *mmio_seq = get_bus_width(tdc, tdc->dma_sconfig.dst_addr_width);
710 *burst_size = tdc->dma_sconfig.dst_maxburst;
711 *slave_bw = tdc->dma_sconfig.dst_addr_width;
712 *csr = TEGRA_GPCDMA_CSR_DMA_MEM2IO_FC;
713 return 0;
714 case DMA_DEV_TO_MEM:
715 *apb_addr = tdc->dma_sconfig.src_addr;
716 *mmio_seq = get_bus_width(tdc, tdc->dma_sconfig.src_addr_width);
717 *burst_size = tdc->dma_sconfig.src_maxburst;
718 *slave_bw = tdc->dma_sconfig.src_addr_width;
719 *csr = TEGRA_GPCDMA_CSR_DMA_IO2MEM_FC;
720 return 0;
721 case DMA_MEM_TO_MEM:
722 *burst_size = tdc->dma_sconfig.src_addr_width;
723 *csr = TEGRA_GPCDMA_CSR_DMA_MEM2MEM;
724 return 0;
725 default:
726 dev_err(tdc2dev(tdc), "DMA direction is not supported\n");
727 }
728
729 return -EINVAL;
730 }
731
732 static struct dma_async_tx_descriptor *
733 tegra_dma_prep_dma_memset(struct dma_chan *dc, dma_addr_t dest, int value,
734 size_t len, unsigned long flags)
735 {
736 struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc);
737 unsigned int max_dma_count = tdc->tdma->chip_data->max_dma_count;
738 struct tegra_dma_desc *dma_desc;
739 unsigned long csr, mc_seq;
740
741 if ((len & 3) || (dest & 3) || len > max_dma_count) {
742 dev_err(tdc2dev(tdc),
743 "DMA length/memory address is not supported\n");
744 return NULL;
745 }
746
747 /* Set dma mode to fixed pattern */
748 csr = TEGRA_GPCDMA_CSR_DMA_FIXED_PAT;
749 /* Enable once or continuous mode */
750 csr |= TEGRA_GPCDMA_CSR_ONCE;
751 /* Enable IRQ mask */
752 csr |= TEGRA_GPCDMA_CSR_IRQ_MASK;
753 /* Enable the dma interrupt */
754 if (flags & DMA_PREP_INTERRUPT)
755 csr |= TEGRA_GPCDMA_CSR_IE_EOC;
756 /* Configure default priority weight for the channel */
757 csr |= FIELD_PREP(TEGRA_GPCDMA_CSR_WEIGHT, 1);
758
759 mc_seq = tdc_read(tdc, TEGRA_GPCDMA_CHAN_MCSEQ);
760 /* retain stream-id and clean rest */
761 mc_seq &= TEGRA_GPCDMA_MCSEQ_STREAM_ID0_MASK;
762
763 /* Set the address wrapping */
764 mc_seq |= FIELD_PREP(TEGRA_GPCDMA_MCSEQ_WRAP0,
765 TEGRA_GPCDMA_MCSEQ_WRAP_NONE);
766 mc_seq |= FIELD_PREP(TEGRA_GPCDMA_MCSEQ_WRAP1,
767 TEGRA_GPCDMA_MCSEQ_WRAP_NONE);
768
769 /* Program outstanding MC requests */
770 mc_seq |= FIELD_PREP(TEGRA_GPCDMA_MCSEQ_REQ_COUNT, 1);
771 /* Set burst size */
772 mc_seq |= TEGRA_GPCDMA_MCSEQ_BURST_16;
773
774 dma_desc = kzalloc(sizeof(*dma_desc), GFP_NOWAIT);
775 if (!dma_desc)
776 return NULL;
777
778 dma_desc->bytes_requested = 0;
779 dma_desc->bytes_transferred = 0;
780
781 dma_desc->bytes_requested += len;
782 tdc->ch_regs.src_ptr = 0;
783 tdc->ch_regs.dst_ptr = dest;
784 tdc->ch_regs.high_addr_ptr =
> 785 FIELD_PREP(TEGRA_GPCDMA_HIGH_ADDR_DST_PTR, (dest >> 32));
786 tdc->ch_regs.fixed_pattern = value;
787 /* Word count reg takes value as (N +1) words */
788 tdc->ch_regs.wcount = ((len - 4) >> 2);
789 tdc->ch_regs.csr = csr;
790 tdc->ch_regs.mmio_seq = 0;
791 tdc->ch_regs.mc_seq = mc_seq;
792
793 tdc->dma_desc = dma_desc;
794
795 return vchan_tx_prep(&tdc->vc, &dma_desc->vd, flags);
796 }
797

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33190 bytes --]