tree: https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git test.pages head: 573a06a07d2b19f7a173fcd0de179eba85795a58 commit: 573a06a07d2b19f7a173fcd0de179eba85795a58 [51/51] microblaze consistent_alloc(): get rid of pointless casts config: microblaze-mmu_defconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout 573a06a07d2b19f7a173fcd0de179eba85795a58 # save the attached .config to linux build tree make.cross ARCH=microblaze All error/warnings (new ones prefixed by >>): arch/microblaze/mm/consistent.c: In function 'consistent_alloc': >> arch/microblaze/mm/consistent.c:64:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token unsigned long order: ^ >> arch/microblaze/mm/consistent.c:64:21: error: expected expression before ':' token >> arch/microblaze/mm/consistent.c:66:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] unsigned int i, err = 0; ^ >> arch/microblaze/mm/consistent.c:80:2: error: 'order' undeclared (first use in this function) order = get_order(size); ^ arch/microblaze/mm/consistent.c:80:2: note: each undeclared identifier is reported only once for each function it appears in >> arch/microblaze/mm/consistent.c:82:2: error: 'vaddr' undeclared (first use in this function) vaddr = (void *)__get_free_pages(gfp, order); ^ >> arch/microblaze/mm/consistent.c:117:2: error: 'ret' undeclared (first use in this function) ret = (void *)va; ^ >> arch/microblaze/mm/consistent.c:156:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ vim +64 arch/microblaze/mm/consistent.c 58 * pool as normal memory, but the handle we return is shifted up into the 59 * uncached region. This will no doubt cause big problems if memory allocated 60 * here is not also freed properly. -- JW 61 */ 62 void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle) 63 { > 64 unsigned long order: 65 void *vaddr, *ret; > 66 unsigned int i, err = 0; 67 struct page *page, *end; 68 69 #ifdef CONFIG_MMU 70 phys_addr_t pa; 71 struct vm_struct *area; 72 unsigned long va; 73 #endif 74 75 if (in_interrupt()) 76 BUG(); 77 78 /* Only allocate page size areas. */ 79 size = PAGE_ALIGN(size); > 80 order = get_order(size); 81 > 82 vaddr = (void *)__get_free_pages(gfp, order); 83 if (!vaddr) 84 return NULL; 85 86 /* 87 * we need to ensure that there are no cachelines in use, 88 * or worse dirty in this area. 89 */ 90 flush_dcache_range(virt_to_phys(vaddr), 91 virt_to_phys(vaddr) + size); 92 93 #ifndef CONFIG_MMU 94 ret = vaddr; 95 /* 96 * Here's the magic! Note if the uncached shadow is not implemented, 97 * it's up to the calling code to also test that condition and make 98 * other arranegments, such as manually flushing the cache and so on. 99 */ 100 # ifdef CONFIG_XILINX_UNCACHED_SHADOW 101 ret = (void *)((unsigned) ret | UNCACHED_SHADOW_MASK); 102 # endif 103 if ((unsigned int)ret > cpuinfo.dcache_base && 104 (unsigned int)ret < cpuinfo.dcache_high) 105 pr_warn("ERROR: Your cache coherent area is CACHED!!!\n"); 106 107 /* dma_handle is same as physical (shadowed) address */ 108 *dma_handle = (dma_addr_t)ret; 109 #else 110 /* Allocate some common virtual space to map the new pages. */ 111 area = get_vm_area(size, VM_ALLOC); 112 if (!area) { 113 free_pages(vaddr, order); 114 return NULL; 115 } 116 va = (unsigned long) area->addr; > 117 ret = (void *)va; 118 119 /* This gives us the real physical address of the first page. */ 120 *dma_handle = pa = __pa(vaddr); 121 #endif 122 123 /* 124 * free wasted pages. We skip the first page since we know 125 * that it will have count = 1 and won't require freeing. 126 * We also mark the pages in use as reserved so that 127 * remap_page_range works. 128 */ 129 page = virt_to_page(vaddr); 130 end = page + (1 << order); 131 132 split_page(page, order); 133 134 for (i = 0; i < size && err == 0; i += PAGE_SIZE) { 135 #ifdef CONFIG_MMU 136 /* MS: This is the whole magic - use cache inhibit pages */ 137 err = map_page(va + i, pa + i, _PAGE_KERNEL | _PAGE_NO_CACHE); 138 #endif 139 140 SetPageReserved(page); 141 page++; 142 } 143 144 /* Free the otherwise unused pages. */ 145 while (page < end) { 146 __free_page(page); 147 page++; 148 } 149 150 if (err) { 151 free_pages(vaddr, order); 152 return NULL; 153 } 154 155 return ret; > 156 } 157 EXPORT_SYMBOL(consistent_alloc); 158 159 #ifdef CONFIG_MMU --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: Binary data