From patchwork Fri Jul 22 21:24:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 9244355 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 393E160459 for ; Fri, 22 Jul 2016 21:28:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29159280F4 for ; Fri, 22 Jul 2016 21:28:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D79D28113; Fri, 22 Jul 2016 21:28:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 622AC280F4 for ; Fri, 22 Jul 2016 21:28:17 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bQhwV-00010Y-HM; Fri, 22 Jul 2016 21:25:11 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bQhwU-00010K-9g for xen-devel@lists.xensource.com; Fri, 22 Jul 2016 21:25:10 +0000 Received: from [85.158.143.35] by server-1.bemta-6.messagelabs.com id 9F/7C-21406-53F82975; Fri, 22 Jul 2016 21:25:09 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOLMWRWlGSWpSXmKPExsVybKJsh65J/6R wg02f9C3uTXnP7sDosb1vF3sAYxRrZl5SfkUCa0brXIGC754VPxdINTD2OXQxcnEICUxllPje 0M4G4cxgkpi07BNzFyMHB5uArsTN2xIgcRGBDUwSC7/cZQdxmAWWckp8mLmNtYuRk0NYwF3i8 JPZTCA2i4CqRO+lG+wgNq+Ag8SHyZPAaiQE5CRafuxmBRnKKeAosWmpEkhYCKikeU4jWFhCoE Bi/+FoiGoviUU3LkF1qklcPbeJeQIj3wJGhlWM6sWpRWWpRbqGeklFmekZJbmJmTm6hgZmerm pxcWJ6ak5iUnFesn5uZsYgQHCAAQ7GHc+dzrEKMnBpCTK+z54UrgQX1J+SmVGYnFGfFFpTmrx IUYZDg4lCd55vUA5waLU9NSKtMwcYKjCpCU4eJREeD+ApHmLCxJzizPTIVKnGBWlxHlvgCQEQ BIZpXlwbbD4uMQoKyXMywh0iBBPQWpRbmYJqvwrRnEORiVh3u0gU3gy80rgpr8CWswEtHiOQD /I4pJEhBQw6opvPV9UeGi1rJbvklmWDUen1Ca90coyOMf4/cvHnKP7JvzefHLJfdkPm1p7Tv1 wWq4zs8/ptv/EBZM86zoib604XPt27fO1tZKi6RG7xW74Tnmd/jYqeObi7FSnIv0HR1wnOv09 uXfyI4eDifMfz72ZtJnfZJ3v1LWv8u49uZKgolxbMPHb8sIgJZbijERDLeai4kQAPH2wjooCA AA= X-Env-Sender: mcgrof@kernel.org X-Msg-Ref: server-11.tower-21.messagelabs.com!1469222707!25183657!1 X-Originating-IP: [198.145.29.136] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 56006 invoked from network); 22 Jul 2016 21:25:08 -0000 Received: from mail.kernel.org (HELO mail.kernel.org) (198.145.29.136) by server-11.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 22 Jul 2016 21:25:08 -0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EFF4B205C1; Fri, 22 Jul 2016 21:25:04 +0000 (UTC) Received: from garbanzo.do-not-panic.com (c-73-15-241-2.hsd1.ca.comcast.net [73.15.241.2]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DD8AF205BB; Fri, 22 Jul 2016 21:25:01 +0000 (UTC) From: "Luis R. Rodriguez" To: hpa@zytor.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, linux@arm.linux.org.uk, mhiramat@kernel.org, masami.hiramatsu.pt@hitachi.com, jbaron@akamai.com, heiko.carstens@de.ibm.com, ananth@linux.vnet.ibm.com, anil.s.keshavamurthy@intel.com, davem@davemloft.net, realmz6@gmail.com Date: Fri, 22 Jul 2016 14:24:38 -0700 Message-Id: <1469222687-1600-5-git-send-email-mcgrof@kernel.org> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1469222687-1600-1-git-send-email-mcgrof@kernel.org> References: <1469222687-1600-1-git-send-email-mcgrof@kernel.org> X-Virus-Scanned: ClamAV using ClamSMTP Cc: gnomes@lxorguk.ukuu.org.uk, linux-ia64@vger.kernel.org, jkosina@suse.cz, benh@kernel.crashing.org, ming.lei@canonical.com, linux@rasmusvillemoes.dk, platform-driver-x86@vger.kernel.org, paul.gortmaker@windriver.com, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org, xen-devel@lists.xensource.com, linux-sh@vger.kernel.org, x86@kernel.org, fontana@sharpeleven.org, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, dvhart@infradead.org, dwmw2@infradead.org, pali.rohar@gmail.com, keescook@chromium.org, arnd@arndb.de, will.deacon@arm.com, rusty@rustcorp.com.au, rostedt@goodmis.org, christopher.denicolo@suse.com, ak@linux.intel.com, ciaran.farrell@suse.com, jpoimboe@redhat.com, andriy.shevchenko@linux.intel.com, mcb30@ipxe.org, linux-kbuild@vger.kernel.org, alan@linux.intel.com, jgross@suse.com, pebolle@tiscali.nl, tony.luck@intel.com, ananth@in.ibm.com, gregkh@linuxfoundation.org, luto@amacapital.net, "Luis R. Rodriguez" , mmarek@suse.com, david.vrabel@citrix.com, andrew.cooper3@citrix.com, akpm@linux-foundation.org, torvalds@linux-foundation.org, korea.drzix@gmail.com Subject: [Xen-devel] [RFC v3 04/13] sections.h: guard against asm and linker script X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP We'll later add some generic helpers for use in the linker scripts and some generic asm code for all architectures. To do that we'll first need to guard against linker script and asm code. On x86 uaccess.h has a struct which is used as part of a section, move that to sections.h as we otherwise have no need for uaccess.h on sections.h v3: new to this series, needed due to the collateral of the split of tables.h into 3 files: tables.h, ranges.h and sections.h, the need to guard sections.h is due to the fact that sections.h is already included and expanded considerably in certain architectures. Signed-off-by: Luis R. Rodriguez --- arch/arm/include/asm/sections.h | 2 ++ arch/blackfin/include/asm/sections.h | 4 ++++ arch/ia64/include/asm/sections.h | 7 +++++-- arch/powerpc/include/asm/sections.h | 11 ++++++----- arch/sh/include/asm/sections.h | 2 ++ arch/sparc/include/asm/sections.h | 4 ++++ arch/tile/include/asm/sections.h | 4 ++++ arch/x86/include/asm/sections.h | 23 ++++++++++++++++++++++- arch/x86/include/asm/uaccess.h | 18 +----------------- include/asm-generic/sections.h | 4 ++++ 10 files changed, 54 insertions(+), 25 deletions(-) diff --git a/arch/arm/include/asm/sections.h b/arch/arm/include/asm/sections.h index 803bbf2b20b8..21830b9b3b6b 100644 --- a/arch/arm/include/asm/sections.h +++ b/arch/arm/include/asm/sections.h @@ -3,6 +3,8 @@ #include +#if defined(__KERNEL__) && !defined(__ASSEMBLER__) && !defined(__ASSEMBLY__) extern char _exiprom[]; +#endif /* defined(__KERNEL__) && !defined(__ASSEMBLER__) && !defined(__ASSEMBLY__) */ #endif /* _ASM_ARM_SECTIONS_H */ diff --git a/arch/blackfin/include/asm/sections.h b/arch/blackfin/include/asm/sections.h index fbd408475725..d2abd7a585dd 100644 --- a/arch/blackfin/include/asm/sections.h +++ b/arch/blackfin/include/asm/sections.h @@ -7,6 +7,8 @@ #ifndef _BLACKFIN_SECTIONS_H #define _BLACKFIN_SECTIONS_H +#if defined(__KERNEL__) && !defined(__ASSEMBLER__) && !defined(__ASSEMBLY__) + /* only used when MTD_UCLINUX */ extern unsigned long memory_mtd_start, memory_mtd_end, mtd_size; @@ -62,6 +64,8 @@ static inline int arch_is_kernel_data(unsigned long addr) } #define arch_is_kernel_data(addr) arch_is_kernel_data(addr) +#endif /* defined(__KERNEL__) && !defined(__ASSEMBLER__) && !defined(__ASSEMBLY__) */ + #include #endif diff --git a/arch/ia64/include/asm/sections.h b/arch/ia64/include/asm/sections.h index 2ab2003698ef..3318e3916122 100644 --- a/arch/ia64/include/asm/sections.h +++ b/arch/ia64/include/asm/sections.h @@ -6,9 +6,12 @@ * David Mosberger-Tang */ +#include + +#if defined(__KERNEL__) && !defined(__ASSEMBLER__) && !defined(__ASSEMBLY__) + #include #include -#include extern char __phys_per_cpu_start[]; #ifdef CONFIG_SMP @@ -37,6 +40,6 @@ static inline void *dereference_function_descriptor(void *ptr) return ptr; } +#endif /* defined(__KERNEL__) && !defined(__ASSEMBLER__) && !defined(__ASSEMBLY__) */ #endif /* _ASM_IA64_SECTIONS_H */ - diff --git a/arch/powerpc/include/asm/sections.h b/arch/powerpc/include/asm/sections.h index 7dc006b58369..f226b5bcd27c 100644 --- a/arch/powerpc/include/asm/sections.h +++ b/arch/powerpc/include/asm/sections.h @@ -1,11 +1,12 @@ #ifndef _ASM_POWERPC_SECTIONS_H #define _ASM_POWERPC_SECTIONS_H -#ifdef __KERNEL__ -#include -#include #include +#if defined(__KERNEL__) && !defined(__ASSEMBLER__) && !defined(__ASSEMBLY__) + +#include +#include #ifdef __powerpc64__ extern char __start_interrupts[]; @@ -75,7 +76,7 @@ static inline void *dereference_function_descriptor(void *ptr) } #endif /* PPC64_ELF_ABI_v1 */ -#endif +#endif /* __powerpc64__ */ +#endif /* defined(__KERNEL__) && !defined(__ASSEMBLER__) && !defined(__ASSEMBLY__) */ -#endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_SECTIONS_H */ diff --git a/arch/sh/include/asm/sections.h b/arch/sh/include/asm/sections.h index 7a99e6af6372..ad4f9cbd861d 100644 --- a/arch/sh/include/asm/sections.h +++ b/arch/sh/include/asm/sections.h @@ -3,9 +3,11 @@ #include +#if defined(__KERNEL__) && !defined(__ASSEMBLER__) && !defined(__ASSEMBLY__) extern long __machvec_start, __machvec_end; extern char __uncached_start, __uncached_end; extern char __start_eh_frame[], __stop_eh_frame[]; +#endif /* defined(__KERNEL__) && !defined(__ASSEMBLER__) && !defined(__ASSEMBLY__) */ #endif /* __ASM_SH_SECTIONS_H */ diff --git a/arch/sparc/include/asm/sections.h b/arch/sparc/include/asm/sections.h index f300d1a9b2b6..b07a2380863e 100644 --- a/arch/sparc/include/asm/sections.h +++ b/arch/sparc/include/asm/sections.h @@ -4,10 +4,14 @@ /* nothing to see, move along */ #include +#if defined(__KERNEL__) && !defined(__ASSEMBLER__) && !defined(__ASSEMBLY__) + /* sparc entry point */ extern char _start[]; extern char __leon_1insn_patch[]; extern char __leon_1insn_patch_end[]; +#endif /* defined(__KERNEL__) && !defined(__ASSEMBLER__) && !defined(__ASSEMBLY__) */ + #endif diff --git a/arch/tile/include/asm/sections.h b/arch/tile/include/asm/sections.h index 86a746243dc8..f9cce7c6d8ba 100644 --- a/arch/tile/include/asm/sections.h +++ b/arch/tile/include/asm/sections.h @@ -19,6 +19,8 @@ #include +#if defined(__KERNEL__) && !defined(__ASSEMBLER__) && !defined(__ASSEMBLY__) + /* Write-once data is writable only till the end of initialization. */ extern char __w1data_begin[], __w1data_end[]; @@ -44,4 +46,6 @@ static inline int arch_is_kernel_data(unsigned long addr) addr < (unsigned long)_end; } +#endif /* defined(__KERNEL__) && !defined(__ASSEMBLER__) && !defined(__ASSEMBLY__) */ + #endif /* _ASM_TILE_SECTIONS_H */ diff --git a/arch/x86/include/asm/sections.h b/arch/x86/include/asm/sections.h index 13b6cdd0af57..84c7044c82bf 100644 --- a/arch/x86/include/asm/sections.h +++ b/arch/x86/include/asm/sections.h @@ -2,13 +2,34 @@ #define _ASM_X86_SECTIONS_H #include -#include + +#if defined(__KERNEL__) && !defined(__ASSEMBLER__) && !defined(__ASSEMBLY__) extern char __brk_base[], __brk_limit[]; + +/* + * The exception table consists of triples of addresses relative to the + * exception table entry itself. The first address is of an instruction + * that is allowed to fault, the second is the target at which the program + * should continue. The third is a handler function to deal with the fault + * caused by the instruction in the first field. + * + * All the routines below use bits of fixup code that are out of line + * with the main instruction path. This means when everything is well, + * we don't even have to jump over them. Further, they do not intrude + * on our cache or tlb entries. + */ + +struct exception_table_entry { + int insn, fixup, handler; +}; + extern struct exception_table_entry __stop___ex_table[]; #if defined(CONFIG_X86_64) extern char __end_rodata_hpage_align[]; #endif +#endif /* defined(__KERNEL__) && !defined(__ASSEMBLER__) && !defined(__ASSEMBLY__) */ + #endif /* _ASM_X86_SECTIONS_H */ diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index a2f253c091e3..d661f28e4e00 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -90,23 +91,6 @@ static inline bool __chk_range_not_ok(unsigned long addr, unsigned long size, un #define access_ok(type, addr, size) \ likely(!__range_not_ok(addr, size, user_addr_max())) -/* - * The exception table consists of triples of addresses relative to the - * exception table entry itself. The first address is of an instruction - * that is allowed to fault, the second is the target at which the program - * should continue. The third is a handler function to deal with the fault - * caused by the instruction in the first field. - * - * All the routines below use bits of fixup code that are out of line - * with the main instruction path. This means when everything is well, - * we don't even have to jump over them. Further, they do not intrude - * on our cache or tlb entries. - */ - -struct exception_table_entry { - int insn, fixup, handler; -}; - #define ARCH_HAS_RELATIVE_EXTABLE #define swap_ex_entry_fixup(a, b, tmp, delta) \ diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index af0254c09424..efd51e70a8db 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h @@ -1,6 +1,8 @@ #ifndef _ASM_GENERIC_SECTIONS_H_ #define _ASM_GENERIC_SECTIONS_H_ +#if defined(__KERNEL__) && !defined(__ASSEMBLER__) && !defined(__ASSEMBLY__) + /* References to section boundaries */ #include @@ -128,4 +130,6 @@ static inline bool init_section_intersects(void *virt, size_t size) return memory_intersects(__init_begin, __init_end, virt, size); } +#endif /* defined(__KERNEL__) && !defined(__ASSEMBLER__) && !defined(__ASSEMBLY__) */ + #endif /* _ASM_GENERIC_SECTIONS_H_ */