Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hexagon: Fix build failures in linux-next

hexagon:defconfig fails to build in linux-next since commit 332fd7c4fef5
("genirq: Generic chip: Change irq_reg_{readl,writel} arguments").

The primary build failure is

arch/hexagon/include/asm/cacheflush.h: In function 'copy_to_user_page':
arch/hexagon/include/asm/cacheflush.h:89:22: error: 'VM_EXEC' undeclared

This is the result of including of <linux/io.h> from <linux/irq.h>,
which is now necessary due to the use of readl and writel from irq.h.
This causes recursive inclusions in hexagon code; cacheflush.h is included
from mm.h prior to the definition of VM_EXEC.

Fix the problem by moving copy_to_user_page from the hexagon include file to
arch/hexagon/mm/cache.c, similar to other architectures. After this change,
several redefinitions of readl and writel are reported. Those are caused
by recursive inclusions of io.h and asm/cacheflush.h. Fix those problems by
reducing the number of files included from those files. Also, it was necessary
to stop including asm-generic/cacheflush.h from asm/cacheflush.h. Instead,
functionality originally provided by asm-generic/cacheflush.h is now coded
in asm/cacheflush.h directly.

Cc: Kevin Cernekee <cernekee@gmail.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
signed-off-by: Richard Kuo <rkuo@codeaurora.org>

authored by

Guenter Roeck and committed by
Richard Kuo
cb84c2b4 b2776bf7

+31 -22
+19 -17
arch/hexagon/include/asm/cacheflush.h
··· 21 21 #ifndef _ASM_CACHEFLUSH_H 22 22 #define _ASM_CACHEFLUSH_H 23 23 24 - #include <linux/cache.h> 25 - #include <linux/mm.h> 26 - #include <asm/string.h> 27 - #include <asm-generic/cacheflush.h> 24 + #include <linux/mm_types.h> 28 25 29 26 /* Cache flushing: 30 27 * ··· 38 41 #define LINESIZE 32 39 42 #define LINEBITS 5 40 43 44 + #define flush_cache_all() do { } while (0) 45 + #define flush_cache_mm(mm) do { } while (0) 46 + #define flush_cache_dup_mm(mm) do { } while (0) 47 + #define flush_cache_range(vma, start, end) do { } while (0) 48 + #define flush_cache_page(vma, vmaddr, pfn) do { } while (0) 49 + #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 50 + #define flush_dcache_page(page) do { } while (0) 51 + #define flush_dcache_mmap_lock(mapping) do { } while (0) 52 + #define flush_dcache_mmap_unlock(mapping) do { } while (0) 53 + #define flush_icache_page(vma, pg) do { } while (0) 54 + #define flush_icache_user_range(vma, pg, adr, len) do { } while (0) 55 + #define flush_cache_vmap(start, end) do { } while (0) 56 + #define flush_cache_vunmap(start, end) do { } while (0) 57 + 41 58 /* 42 59 * Flush Dcache range through current map. 43 60 */ ··· 60 49 /* 61 50 * Flush Icache range through current map. 62 51 */ 63 - #undef flush_icache_range 64 52 extern void flush_icache_range(unsigned long start, unsigned long end); 65 53 66 54 /* ··· 89 79 /* generic_ptrace_pokedata doesn't wind up here, does it? */ 90 80 } 91 81 92 - #undef copy_to_user_page 93 - static inline void copy_to_user_page(struct vm_area_struct *vma, 94 - struct page *page, 95 - unsigned long vaddr, 96 - void *dst, void *src, int len) 97 - { 98 - memcpy(dst, src, len); 99 - if (vma->vm_flags & VM_EXEC) { 100 - flush_icache_range((unsigned long) dst, 101 - (unsigned long) dst + len); 102 - } 103 - } 82 + void copy_to_user_page(struct vm_area_struct *vma, struct page *page, 83 + unsigned long vaddr, void *dst, void *src, int len); 104 84 85 + #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ 86 + memcpy(dst, src, len) 105 87 106 88 extern void hexagon_inv_dcache_range(unsigned long start, unsigned long end); 107 89 extern void hexagon_clean_dcache_range(unsigned long start, unsigned long end);
-5
arch/hexagon/include/asm/io.h
··· 24 24 #ifdef __KERNEL__ 25 25 26 26 #include <linux/types.h> 27 - #include <linux/delay.h> 28 - #include <linux/vmalloc.h> 29 - #include <asm/string.h> 30 - #include <asm/mem-layout.h> 31 27 #include <asm/iomap.h> 32 28 #include <asm/page.h> 33 29 #include <asm/cacheflush.h> 34 - #include <asm/tlbflush.h> 35 30 36 31 /* 37 32 * We don't have PCI yet.
+1
arch/hexagon/kernel/setup.c
··· 19 19 */ 20 20 21 21 #include <linux/init.h> 22 + #include <linux/delay.h> 22 23 #include <linux/bootmem.h> 23 24 #include <linux/mmzone.h> 24 25 #include <linux/mm.h>
+10
arch/hexagon/mm/cache.c
··· 127 127 local_irq_restore(flags); 128 128 mb(); 129 129 } 130 + 131 + void copy_to_user_page(struct vm_area_struct *vma, struct page *page, 132 + unsigned long vaddr, void *dst, void *src, int len) 133 + { 134 + memcpy(dst, src, len); 135 + if (vma->vm_flags & VM_EXEC) { 136 + flush_icache_range((unsigned long) dst, 137 + (unsigned long) dst + len); 138 + } 139 + }
+1
arch/hexagon/mm/ioremap.c
··· 20 20 21 21 #include <linux/io.h> 22 22 #include <linux/vmalloc.h> 23 + #include <linux/mm.h> 23 24 24 25 void __iomem *ioremap_nocache(unsigned long phys_addr, unsigned long size) 25 26 {