tree: https://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git dma-sync-rework head: 985cd64f3b17b82468e68c6269e09a5556d3720e commit: a0183b361d4212de180444305367f20ad14f89fd [7/22] powerpc: dma-mapping: split out cache operation logic config: powerpc-taishan_defconfig (https://download.01.org/0day-ci/archive/20230325/202303251809.m9CxUNxz-lkp@xxxxxxxxx/config) compiler: powerpc-linux-gcc (GCC) 12.1.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://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git/commit/?id=a0183b361d4212de180444305367f20ad14f89fd git remote add arnd-asm-generic https://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git git fetch --no-tags arnd-asm-generic dma-sync-rework git checkout a0183b361d4212de180444305367f20ad14f89fd # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@xxxxxxxxx> | Link: https://lore.kernel.org/oe-kbuild-all/202303251809.m9CxUNxz-lkp@xxxxxxxxx/ All errors (new ones prefixed by >>): >> arch/powerpc/mm/dma-noncoherent.c:91:59: error: unknown type name 'dma_cache_op' 91 | static void __dma_phys_op(phys_addr_t paddr, size_t size, dma_cache_op op) | ^~~~~~~~~~~~ arch/powerpc/mm/dma-noncoherent.c: In function 'arch_sync_dma_for_device': arch/powerpc/mm/dma-noncoherent.c:107:17: error: 'direction' undeclared (first use in this function); did you mean 'irqaction'? 107 | switch (direction) { | ^~~~~~~~~ | irqaction arch/powerpc/mm/dma-noncoherent.c:107:17: note: each undeclared identifier is reported only once for each function it appears in >> arch/powerpc/mm/dma-noncoherent.c:115:22: error: 'start' undeclared (first use in this function); did you mean 'stat'? 115 | if ((start | end) & (L1_CACHE_BYTES - 1)) | ^~~~~ | stat >> arch/powerpc/mm/dma-noncoherent.c:115:30: error: 'end' undeclared (first use in this function) 115 | if ((start | end) & (L1_CACHE_BYTES - 1)) | ^~~ >> arch/powerpc/mm/dma-noncoherent.c:116:25: error: implicit declaration of function '__dma_phys_op'; did you mean '__dma_op'? [-Werror=implicit-function-declaration] 116 | __dma_phys_op(start, end, DMA_CACHE_FLUSH); | ^~~~~~~~~~~~~ | __dma_op arch/powerpc/mm/dma-noncoherent.c: In function 'arch_sync_dma_for_cpu': arch/powerpc/mm/dma-noncoherent.c:132:17: error: 'direction' undeclared (first use in this function); did you mean 'irqaction'? 132 | switch (direction) { | ^~~~~~~~~ | irqaction arch/powerpc/mm/dma-noncoherent.c:140:22: error: 'start' undeclared (first use in this function); did you mean 'stat'? 140 | if ((start | end) & (L1_CACHE_BYTES - 1)) | ^~~~~ | stat arch/powerpc/mm/dma-noncoherent.c:140:30: error: 'end' undeclared (first use in this function) 140 | if ((start | end) & (L1_CACHE_BYTES - 1)) | ^~~ arch/powerpc/mm/dma-noncoherent.c: At top level: >> arch/powerpc/mm/dma-noncoherent.c:28:13: error: '__dma_op' defined but not used [-Werror=unused-function] 28 | static void __dma_op(void *vaddr, size_t size, enum dma_cache_op op) | ^~~~~~~~ cc1: all warnings being treated as errors vim +/dma_cache_op +91 arch/powerpc/mm/dma-noncoherent.c 24 25 /* 26 * make an area consistent. 27 */ > 28 static void __dma_op(void *vaddr, size_t size, enum dma_cache_op op) 29 { 30 unsigned long start = (unsigned long)vaddr; 31 unsigned long end = start + size; 32 33 switch (op) { 34 case DMA_CACHE_CLEAN: 35 clean_dcache_range(start, end); 36 break; 37 case DMA_CACHE_INVAL: 38 invalidate_dcache_range(start, end); 39 break; 40 case DMA_CACHE_FLUSH: 41 flush_dcache_range(start, end); 42 break; 43 } 44 } 45 46 #ifdef CONFIG_HIGHMEM 47 /* 48 * __dma_highmem_op() implementation for systems using highmem. 49 * In this case, each page of a buffer must be kmapped/kunmapped 50 * in order to have a virtual address for __dma_op(). This must 51 * not sleep so kmap_atomic()/kunmap_atomic() are used. 52 * 53 * Note: yes, it is possible and correct to have a buffer extend 54 * beyond the first page. 55 */ 56 static inline void __dma_highmem_op(struct page *page, 57 unsigned long offset, size_t size, enum dma_cache_op op) 58 { 59 size_t seg_size = min((size_t)(PAGE_SIZE - offset), size); 60 size_t cur_size = seg_size; 61 unsigned long flags, start, seg_offset = offset; 62 int nr_segs = 1 + ((size - seg_size) + PAGE_SIZE - 1)/PAGE_SIZE; 63 int seg_nr = 0; 64 65 local_irq_save(flags); 66 67 do { 68 start = (unsigned long)kmap_atomic(page + seg_nr) + seg_offset; 69 70 /* Sync this buffer segment */ 71 __dma_op((void *)start, seg_size, op); 72 kunmap_atomic((void *)start); 73 seg_nr++; 74 75 /* Calculate next buffer segment size */ 76 seg_size = min((size_t)PAGE_SIZE, size - cur_size); 77 78 /* Add the segment size to our running total */ 79 cur_size += seg_size; 80 seg_offset = 0; 81 } while (seg_nr < nr_segs); 82 83 local_irq_restore(flags); 84 } 85 #endif /* CONFIG_HIGHMEM */ 86 87 /* 88 * __dma_phys_op makes memory consistent. identical to __dma_op, but 89 * takes a phys_addr_t instead of a virtual address 90 */ > 91 static void __dma_phys_op(phys_addr_t paddr, size_t size, dma_cache_op op) 92 { 93 struct page *page = pfn_to_page(paddr >> PAGE_SHIFT); 94 unsigned offset = paddr & ~PAGE_MASK; 95 96 #ifdef CONFIG_HIGHMEM 97 __dma_highmem_op(page, offset, size, op); 98 #else 99 unsigned long start = (unsigned long)page_address(page) + offset; 100 __dma_op((void *)start, size, op); 101 #endif 102 } 103 104 void arch_sync_dma_for_device(phys_addr_t paddr, size_t size, 105 enum dma_data_direction dir) 106 { 107 switch (direction) { 108 case DMA_NONE: 109 BUG(); 110 case DMA_FROM_DEVICE: 111 /* 112 * invalidate only when cache-line aligned otherwise there is 113 * the potential for discarding uncommitted data from the cache 114 */ > 115 if ((start | end) & (L1_CACHE_BYTES - 1)) > 116 __dma_phys_op(start, end, DMA_CACHE_FLUSH); 117 else 118 __dma_phys_op(start, end, DMA_CACHE_INVAL); 119 break; 120 case DMA_TO_DEVICE: /* writeback only */ 121 __dma_phys_op(start, end, DMA_CACHE_CLEAN); 122 break; 123 case DMA_BIDIRECTIONAL: /* writeback and invalidate */ 124 __dma_phys_op(start, end, DMA_CACHE_FLUSH); 125 break; 126 } 127 } 128 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests