From patchwork Tue May 24 00:04:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 9132565 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 544CB607D3 for ; Tue, 24 May 2016 00:13:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4876F2824F for ; Tue, 24 May 2016 00:13:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BC332825E; Tue, 24 May 2016 00:13:09 +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.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4A5BD2824F for ; Tue, 24 May 2016 00:13:08 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b4zwd-0004iW-1y; Tue, 24 May 2016 00:11:35 +0000 Received: from mail-bl2on0086.outbound.protection.outlook.com ([65.55.169.86] helo=na01-bl2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b4zrD-0005SW-97 for linux-arm-kernel@lists.infradead.org; Tue, 24 May 2016 00:06:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-caviumnetworks-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=UXEevWDybOlGso7A5ApRmuJKPL9skYi3Oz5pwFgX6Wg=; b=ySL3Zbt1JJ0hzmwTaz85VMg8rErDuA30gLo2kiq7AJ6M0wVaYwmSA6cUMt4va8YT5DbkBdUVWx69WsRZwk/ZT/eNbF5Vqveb+z/dLRU42fAXtGOVHVAIgANd3W1TVYxyJPHF6AoAuiHyl3TAj+TG23KRA8MH8tncO53xY4Kuy38= Authentication-Results: arndb.de; dkim=none (message not signed) header.d=none;arndb.de; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost (50.233.148.158) by SN1PR07MB2239.namprd07.prod.outlook.com (10.164.47.145) with Microsoft SMTP Server (TLS) id 15.1.497.12; Tue, 24 May 2016 00:05:56 +0000 From: Yury Norov To: , , , , , , , Subject: [PATCH 14/23] arm64: ilp32: add is_ilp32_compat_{task, thread} and TIF_32BIT_AARCH64 Date: Tue, 24 May 2016 03:04:43 +0300 Message-ID: <1464048292-30136-15-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1464048292-30136-1-git-send-email-ynorov@caviumnetworks.com> References: <1464048292-30136-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [50.233.148.158] X-ClientProxiedBy: SN1PR16CA0017.namprd16.prod.outlook.com (10.169.34.27) To SN1PR07MB2239.namprd07.prod.outlook.com (10.164.47.145) X-MS-Office365-Filtering-Correlation-Id: 92fc22d7-4d55-4d82-8bd0-08d383672e3d X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2239; 2:ndi+nzBlNsPLjBal5ndXT53FbIolTH/zWkq6uu3fvFwY4Db0XT1WZ+9GAP0ASWnxCdxKCBRdU68uO/7Vzjq6tIH1Ey8KjBswjPxBmR3QM+orQmOMv8zHon9LxwUMC6NJNURC6GpjH/rCGi4M1LjpCX0BiTUvh2L0D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N1PR07MB2239; 20:GybeE6JtbNSzjOTfV+z4fbMGdXpz5T7ZBGnglT0SQB2OlMoen7VFBaxLNoD5jcKsrziSAyRx3U8xRVDyw9WmLz186/64UjlJY+Ji08dHF3jlSLJUmf2G5WKRvKFEMzw4D2d5SZkrxXpZSGrGDN5rBxE9qZiuyLPLbStyqx3ydBnsjcc4vGMSmJrUmAkw75Lykg2zxkMh2jibDSBMLdB8KiEWcZjJygt+nQus22eebC2jSb2lFmWQj/XFrTNHhJNEYFEfYERLC29t43wxoqogV06+GQo/XhN3slVFqSCR9zJYcDVGFgTu8bx75d6Ej4/lrIKq4skcW190kFuSRQkPvP23TIlXaSp0v0hLdTbfpvrTF+/NvTUamlK5vqAFKVzjW7eZcClGXgVURvzwk0Pu1E3SFKBdjuwIwXItRJRTSJqzSukIVIvRMytrL5RLIzyPLTz2djEI5GRFmG+jWeOa47G4is3mecvS89iRQZCLG2IfLkNi1D11fbiL48JtTCjFoZYQ+ToH2jVmtn5YD5LQDt3FG24kXgjTWW+OlW66pjDZu39+yY815v6dAUACjgMZQQvDFRZyPhJH5qLo6KsH777kMmHKdmhCh33FPXeL9yY= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001); SRVR:SN1PR07MB2239; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2239; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2239; 4:vCZgChJviQfZUbDuNjhimpLrqW6oro9OlP1/Lezjyq+hrBuOXv/jHFDw/4mPRnZgIkvSAWas7Y74/fbGU19AcSaFtjn1GtrBBM9uHpJVzwa1tOZfkK6SL6ki1R9q7bjSABbNpgj/DdlHsuLpCjLlJErj65pF60TRb7flw30iz3wMkquaVhhv3Gc8VY19xHI45gKd1EK4z1YAJukzest+2VIzBZ8SrNXQfUid+EjjTJKaOZM6poHDjlcWFAJIEjAv8K0xDQ2sd5IKHM0We9HDQnsuLj6SZOl7aRAeulX0jEY3o3D3rPeGLlK82Ugh8tu0MQPnZJSEvFzPGN2rrqUXw8oqoNLB9821QzlRSmkhERPpNssDXO6LYVKUqwMrgatr X-Forefront-PRVS: 09525C61DB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(76176999)(81166006)(50466002)(107886002)(36756003)(8676002)(47776003)(66066001)(5003940100001)(4001430100002)(48376002)(92566002)(4326007)(5008740100001)(5001770100001)(33646002)(229853001)(50226002)(2906002)(19580395003)(19580405001)(5004730100002)(2201001)(50986999)(2950100001)(42186005)(77096005)(76506005)(189998001)(6116002)(586003)(15760500001)(142933001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2239; H:localhost; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR07MB2239; 23:Ce77xRoroJCJ0mjgssl+H9bydW+UvDp0TdAGgTbw4?= =?us-ascii?Q?rpFN8/wbIGnBHtRx/5CZNBoTx3UblRojL9W8wad2FC/AsE+iD5OnHJaJ/OQ+?= =?us-ascii?Q?2Eh/MphqPTipH45HkLPjM5yfQHAccl5dn2hKrT5Y+7C7D6iFUN+DOnI+KjM0?= =?us-ascii?Q?ZQUBbKKi/IedwmyDFp9+HYxPA4wdUiFSkanMDrymZlvLsXXQSl4mXmiXp8Vu?= =?us-ascii?Q?pwv8zLzlYyvENYSVU+0R+201EloeIG9Cv05iuCaZK2Qq4o1Vx0X5fOOHwAKj?= =?us-ascii?Q?4gj+48w+Mm9GhOIPCUubdsZRGhQtq/9qbq5D2owJHkZvH+wZFDJzAoYpSamF?= =?us-ascii?Q?rbWC/6KR+cX1GoeiU2Ha8FSvb88i74fgCKYcIVq9lb7fw3gxHULhEAKk05dC?= =?us-ascii?Q?BwU5fsbz6w7/zlHT7maSfeujmv56rMnDgtZ6QhAnRjqFD0tfQ8BKBh5AQRgX?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hwgjVfDf5d9FkvsG9CVVl0eh6REcG7EgFSG6JPjXMJeAYBfK+8vW2QrLeJ7wtoVse7TgxA4fQCWwmN+pRLws3ojA+jtaYQBCtt3jS4y7vGlORLuijfRyc SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2016 00:05:56.8308 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2239 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160523_170559_499905_3E27938B X-CRM114-Status: UNSURE ( 9.10 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kilobyte@angband.pl, pinskia@gmail.com, szabolcs.nagy@arm.com, Nathan_Lynch@mentor.com, heiko.carstens@de.ibm.com, agraf@suse.de, geert@linux-m68k.org, Prasun.Kapoor@caviumnetworks.com, klimov.linux@gmail.com, Andrew Pinski , broonie@kernel.org, ynorov@caviumnetworks.com, schwidefsky@de.ibm.com, bamvor.zhangjian@huawei.com, philipp.tomsich@theobroma-systems.com, joseph@codesourcery.com, christoph.muellner@theobroma-systems.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP ILP32 tasks are needed to be distinguished from lp64 and aarch32. This patch adds helper functions is_ilp32_compat_{task,thread} and thread flag TIF_32BIT_AARCH64 to address it. This is a preparation for following patches in ilp32 patchset. For consistency, SET_PERSONALITY is changed here accordingly. Signed-off-by: Andrew Pinski Signed-off-by: Philipp Tomsich Signed-off-by: Christoph Muellner Signed-off-by: Yury Norov Reviewed-by: David Daney --- arch/arm64/include/asm/elf.h | 13 +++++++++++-- arch/arm64/include/asm/is_compat.h | 28 +++++++++++++++++++++++++++- arch/arm64/include/asm/thread_info.h | 2 ++ 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index b5437c5..e18bb8a 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -142,7 +142,11 @@ typedef struct user_fpsimd_state elf_fpregset_t; */ #define ELF_PLAT_INIT(_r, load_addr) (_r)->regs[0] = 0 -#define SET_PERSONALITY(ex) clear_thread_flag(TIF_32BIT); +#define SET_PERSONALITY(ex) \ +do { \ + clear_thread_flag(TIF_32BIT_AARCH64); \ + clear_thread_flag(TIF_32BIT); \ +} while (0) #define ARCH_DLINFO \ do { \ @@ -181,7 +185,12 @@ typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_ELF_NGREG]; ((x)->e_flags & EF_ARM_EABI_MASK)) #define compat_start_thread compat_start_thread -#define COMPAT_SET_PERSONALITY(ex) set_thread_flag(TIF_32BIT); +#define COMPAT_SET_PERSONALITY(ex) \ +do { \ + clear_thread_flag(TIF_32BIT_AARCH64); \ + set_thread_flag(TIF_32BIT); \ +} while (0) + #define COMPAT_ARCH_DLINFO extern int aarch32_setup_vectors_page(struct linux_binprm *bprm, int uses_interp); diff --git a/arch/arm64/include/asm/is_compat.h b/arch/arm64/include/asm/is_compat.h index 6139b5a..55134cf 100644 --- a/arch/arm64/include/asm/is_compat.h +++ b/arch/arm64/include/asm/is_compat.h @@ -45,11 +45,37 @@ static inline int is_a32_compat_thread(struct thread_info *thread) #endif /* CONFIG_AARCH32_EL0 */ +#ifdef CONFIG_ARM64_ILP32 + +static inline int is_ilp32_compat_task(void) +{ + return test_thread_flag(TIF_32BIT_AARCH64); +} + +static inline int is_ilp32_compat_thread(struct thread_info *thread) +{ + return test_ti_thread_flag(thread, TIF_32BIT_AARCH64); +} + +#else + +static inline int is_ilp32_compat_task(void) +{ + return 0; +} + +static inline int is_ilp32_compat_thread(struct thread_info *thread) +{ + return 0; +} + +#endif /* CONFIG_ARM64_ILP32 */ + #ifdef CONFIG_COMPAT static inline int is_compat_task(void) { - return is_a32_compat_task(); + return is_a32_compat_task() || is_ilp32_compat_task(); } #endif /* CONFIG_COMPAT */ diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h index 4daa559..8802645 100644 --- a/arch/arm64/include/asm/thread_info.h +++ b/arch/arm64/include/asm/thread_info.h @@ -119,6 +119,7 @@ static inline struct thread_info *current_thread_info(void) #define TIF_RESTORE_SIGMASK 20 #define TIF_SINGLESTEP 21 #define TIF_32BIT 22 /* AARCH32 process */ +#define TIF_32BIT_AARCH64 23 /* 32 bit process on AArch64(ILP32) */ #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) @@ -130,6 +131,7 @@ static inline struct thread_info *current_thread_info(void) #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) #define _TIF_SECCOMP (1 << TIF_SECCOMP) #define _TIF_32BIT (1 << TIF_32BIT) +#define _TIF_32BIT_AARCH64 (1 << TIF_32BIT_AARCH64) #define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \ _TIF_NOTIFY_RESUME | _TIF_FOREIGN_FPSTATE)