[jsarha:topic/chromeos-4.19-s0ix 9297/9999] arch/arm/mm/dma-mapping.c:1009:6: warning: no previous prototype for 'arch_sync_dma_for_device'

From: kernel test robot
Date: Sun Apr 10 2022 - 23:26:34 EST


tree: https://github.com/jsarha/linux topic/chromeos-4.19-s0ix
head: 430bdaa0a8c38697780f45a148964d71951df11f
commit: 22bd488f5bfd457167372ea73c57300d586ca53e [9297/9999] CHROMIUM: arm: add arch_sync_dma_for_*()
config: arm-pxa255-idp_defconfig (https://download.01.org/0day-ci/archive/20220411/202204111138.VtjigEGJ-lkp@xxxxxxxxx/config)
compiler: arm-linux-gnueabi-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/jsarha/linux/commit/22bd488f5bfd457167372ea73c57300d586ca53e
git remote add jsarha https://github.com/jsarha/linux
git fetch --no-tags jsarha topic/chromeos-4.19-s0ix
git checkout 22bd488f5bfd457167372ea73c57300d586ca53e
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

arch/arm/mm/dma-mapping.c:459:13: warning: no previous prototype for 'dma_contiguous_early_fixup' [-Wmissing-prototypes]
459 | void __init dma_contiguous_early_fixup(phys_addr_t base, unsigned long size)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> arch/arm/mm/dma-mapping.c:1009:6: warning: no previous prototype for 'arch_sync_dma_for_device' [-Wmissing-prototypes]
1009 | void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
| ^~~~~~~~~~~~~~~~~~~~~~~~
>> arch/arm/mm/dma-mapping.c:1050:6: warning: no previous prototype for 'arch_sync_dma_for_cpu' [-Wmissing-prototypes]
1050 | void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
| ^~~~~~~~~~~~~~~~~~~~~
>> arch/arm/mm/dma-mapping.c:1061:7: warning: no previous prototype for 'arch_dma_alloc' [-Wmissing-prototypes]
1061 | void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
| ^~~~~~~~~~~~~~
>> arch/arm/mm/dma-mapping.c:1066:6: warning: no previous prototype for 'arch_dma_free' [-Wmissing-prototypes]
1066 | void arch_dma_free(struct device *dev, size_t size, void *vaddr,
| ^~~~~~~~~~~~~
arch/arm/mm/dma-mapping.c: In function 'dma_contiguous_early_fixup':
arch/arm/mm/dma-mapping.c:461:22: warning: array subscript <unknown> is outside array bounds of 'struct dma_contig_early_reserve[0]' [-Warray-bounds]
461 | dma_mmu_remap[dma_mmu_remap_num].base = base;
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
arch/arm/mm/dma-mapping.c:455:40: note: while referencing 'dma_mmu_remap'
455 | static struct dma_contig_early_reserve dma_mmu_remap[MAX_CMA_AREAS] __initdata;
| ^~~~~~~~~~~~~
arch/arm/mm/dma-mapping.c:462:22: warning: array subscript <unknown> is outside array bounds of 'struct dma_contig_early_reserve[0]' [-Warray-bounds]
462 | dma_mmu_remap[dma_mmu_remap_num].size = size;
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
arch/arm/mm/dma-mapping.c:455:40: note: while referencing 'dma_mmu_remap'
455 | static struct dma_contig_early_reserve dma_mmu_remap[MAX_CMA_AREAS] __initdata;
| ^~~~~~~~~~~~~
arch/arm/mm/dma-mapping.c: In function 'dma_contiguous_remap':
arch/arm/mm/dma-mapping.c:470:50: warning: array subscript i is outside array bounds of 'struct dma_contig_early_reserve[0]' [-Warray-bounds]
470 | phys_addr_t start = dma_mmu_remap[i].base;
| ~~~~~~~~~~~~~^~~
arch/arm/mm/dma-mapping.c:455:40: note: while referencing 'dma_mmu_remap'
455 | static struct dma_contig_early_reserve dma_mmu_remap[MAX_CMA_AREAS] __initdata;
| ^~~~~~~~~~~~~
arch/arm/mm/dma-mapping.c:471:56: warning: array subscript i is outside array bounds of 'struct dma_contig_early_reserve[0]' [-Warray-bounds]
471 | phys_addr_t end = start + dma_mmu_remap[i].size;
| ~~~~~~~~~~~~~^~~
arch/arm/mm/dma-mapping.c:455:40: note: while referencing 'dma_mmu_remap'
455 | static struct dma_contig_early_reserve dma_mmu_remap[MAX_CMA_AREAS] __initdata;
| ^~~~~~~~~~~~~
arch/arm/mm/dma-mapping.c:132: warning: Function parameter or member 'attrs' not described in 'arm_dma_map_page'
arch/arm/mm/dma-mapping.c:161: warning: Function parameter or member 'attrs' not described in 'arm_dma_unmap_page'
arch/arm/mm/dma-mapping.c:1089: warning: Function parameter or member 'attrs' not described in 'arm_dma_map_sg'
arch/arm/mm/dma-mapping.c:1123: warning: Function parameter or member 'attrs' not described in 'arm_dma_unmap_sg'
arch/arm/mm/dma-mapping.c:1818: warning: Function parameter or member 'attrs' not described in 'arm_coherent_iommu_map_sg'
arch/arm/mm/dma-mapping.c:1836: warning: Function parameter or member 'attrs' not described in 'arm_iommu_map_sg'
arch/arm/mm/dma-mapping.c:1870: warning: Function parameter or member 'attrs' not described in 'arm_coherent_iommu_unmap_sg'
arch/arm/mm/dma-mapping.c:1887: warning: Function parameter or member 'attrs' not described in 'arm_iommu_unmap_sg'
arch/arm/mm/dma-mapping.c:1940: warning: Function parameter or member 'attrs' not described in 'arm_coherent_iommu_map_page'
arch/arm/mm/dma-mapping.c:1974: warning: Function parameter or member 'attrs' not described in 'arm_iommu_map_page'
arch/arm/mm/dma-mapping.c:1992: warning: Function parameter or member 'attrs' not described in 'arm_coherent_iommu_unmap_page'
arch/arm/mm/dma-mapping.c:2016: warning: Function parameter or member 'attrs' not described in 'arm_iommu_unmap_page'
arch/arm/mm/dma-mapping.c:2043: warning: Function parameter or member 'attrs' not described in 'arm_iommu_map_resource'
arch/arm/mm/dma-mapping.c:2077: warning: Function parameter or member 'attrs' not described in 'arm_iommu_unmap_resource'


vim +/arch_sync_dma_for_device +1009 arch/arm/mm/dma-mapping.c

1008
> 1009 void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
1010 size_t size, enum dma_data_direction dir)
1011 {
1012 __dma_page_cpu_to_dev(phys_to_page(paddr), paddr % PAGE_SIZE, size, dir);
1013 }
1014 EXPORT_SYMBOL_GPL(arch_sync_dma_for_device);
1015
1016 static void __dma_page_dev_to_cpu(struct page *page, unsigned long off,
1017 size_t size, enum dma_data_direction dir)
1018 {
1019 phys_addr_t paddr = page_to_phys(page) + off;
1020
1021 /* FIXME: non-speculating: not required */
1022 /* in any case, don't bother invalidating if DMA to device */
1023 if (dir != DMA_TO_DEVICE) {
1024 outer_inv_range(paddr, paddr + size);
1025
1026 dma_cache_maint_page(page, off, size, dir, dmac_unmap_area);
1027 }
1028
1029 /*
1030 * Mark the D-cache clean for these pages to avoid extra flushing.
1031 */
1032 if (dir != DMA_TO_DEVICE && size >= PAGE_SIZE) {
1033 unsigned long pfn;
1034 size_t left = size;
1035
1036 pfn = page_to_pfn(page) + off / PAGE_SIZE;
1037 off %= PAGE_SIZE;
1038 if (off) {
1039 pfn++;
1040 left -= PAGE_SIZE - off;
1041 }
1042 while (left >= PAGE_SIZE) {
1043 page = pfn_to_page(pfn++);
1044 set_bit(PG_dcache_clean, &page->flags);
1045 left -= PAGE_SIZE;
1046 }
1047 }
1048 }
1049
> 1050 void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
1051 size_t size, enum dma_data_direction dir)
1052 {
1053 __dma_page_dev_to_cpu(phys_to_page(paddr), paddr % PAGE_SIZE, size, dir);
1054 }
1055 EXPORT_SYMBOL_GPL(arch_sync_dma_for_cpu);
1056
1057 /*
1058 * arch_dma_{alloc,free} fail-stubs needed to avoid link-errors in dma/direct.c
1059 * (which is not actually used on arch/arm)
1060 */
> 1061 void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
1062 gfp_t flags, unsigned long attrs)
1063 {
1064 return NULL;
1065 }
> 1066 void arch_dma_free(struct device *dev, size_t size, void *vaddr,
1067 dma_addr_t dma_handle, unsigned long attrs)
1068 {
1069 }
1070

--
0-DAY CI Kernel Test Service
https://01.org/lkp