From patchwork Fri Jun 17 23:54:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 9185221 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 CD1C6601C0 for ; Fri, 17 Jun 2016 23:59:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8CD9208C2 for ; Fri, 17 Jun 2016 23:59:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AD02F280B0; Fri, 17 Jun 2016 23:59:53 +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 2D26C208C2 for ; Fri, 17 Jun 2016 23:59:53 +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 1bE3eI-0004xA-JM; Fri, 17 Jun 2016 23:58:06 +0000 Received: from mail-bn1bon0092.outbound.protection.outlook.com ([157.56.111.92] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bE3bs-0001Wi-Rn for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2016 23:55:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-caviumnetworks-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=xihnPXA+/RPcNvL31u6VsflkFfsPkJkiGZ3CoOP4Y2M=; b=owwcy19JbK2yQNc+3Z2GuzXQitfh2B2CocONNmFr8IQDLa9u0qBHXznUSMz35fA+XE1TJXMbHA8u1bFxzU1ie06lDggA5bJ4tguYuaMj9GUZ9Z1iF/C3YPOx9p4BwNjZUvlUHFw+/SZevOPRkW2kS/IOEcreKPcesYjfP25VHEQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (50.233.148.158) by DM3PR07MB2249.namprd07.prod.outlook.com (10.164.33.147) with Microsoft SMTP Server (TLS) id 15.1.523.12; Fri, 17 Jun 2016 23:55:14 +0000 From: Yury Norov To: , , , , , , Subject: [PATCH 09/19] arm64: ilp32: add is_ilp32_compat_{task, thread} and TIF_32BIT_AARCH64 Date: Sat, 18 Jun 2016 02:54:18 +0300 Message-ID: <1466207668-10549-10-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1466207668-10549-1-git-send-email-ynorov@caviumnetworks.com> References: <1466207668-10549-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [50.233.148.158] X-ClientProxiedBy: BY2PR07CA0096.namprd07.prod.outlook.com (10.166.107.49) To DM3PR07MB2249.namprd07.prod.outlook.com (10.164.33.147) X-MS-Office365-Filtering-Correlation-Id: b14615b5-4890-4514-975a-08d3970ad3d1 X-Microsoft-Exchange-Diagnostics: 1; DM3PR07MB2249; 2:9chiCYlyRDE2+7zNLkOkI1U51WQifvMIJ5rXFnI2ccGAnODtHHU8qjrbzegzmrVqnSlN4k3vwgkfOiqbncLxMtO/97em3WSzsnBCxribtONmLOQlpuKbE2cQT5wAFMleg9ir9HzKJKjv0meHzxTgCddu/ypA3o7WegMnV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: 1; DM3PR07MB2249; 20:5WoCzYt6P2pPviYDDiQGDlOmra8UFd1lg56pi/svyishtfLnOY938MCwB1Ltoss8cK/hCnI1+9qY4wB7L4I4iHXVX9ANPbgbwSmUEjvhhH2x+lQSNTQuPwER8ldaw9AERNH43vEg0FksNCPc4PUrcQvOlKC2UkSZld9y1OYJ2xeraHHzZJwE2QgpGqYBFIiv8Fq0iNGhHmd2wwttb/f3bmasXAkx+dsFArzKssFKOA+nwtGAzgUGwsU871boB5bAhzfKAo/TGyFPMLCnJykO9FgSLoSSGbm6KaDHHQBUdlgefnmgkjxYmG7bzlnLI69mk88KgnhGrUizbF1MBSESV5TJGZE53qs9nBgO7klHaRyQNUBtsd6OUkVx/Fv62n3Xd1kFRnrO21kQMuc+GYdvSiaIB+jDFmDO6saiWmTQ4EN4NQZVe5pRsTfmSapeba+KaFlXekvQ46DVTQmjlVkrDao+u9soWr49q8uh4T7xUgDE48/V1WaELLj0I4+4nnx9TMpRAo3gC22aGbDO8BRdQIbGV2JV4VRk8yOWX8+SfvKXnXAPcFsGgtFBOvIp641zO7dK/B/+OCBNWKmibijUj1WUarrX23hRqdyGtdYBwoc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:DM3PR07MB2249; BCL:0; PCL:0; RULEID:; SRVR:DM3PR07MB2249; X-Microsoft-Exchange-Diagnostics: 1; DM3PR07MB2249; 4:1+gIyAimkdPnTZo0iAgJ7izv0+KX48Sqnvl9TK1v9dUDJuB8HDG12iWjo76CXa2CagwZOKzswpuZ4oA+xd3dehNjsej+tDu3ktABww19/XrWSiUsz1Y2h4UP3fBgQ1lBVONe669NqQep2GTm5QV+64cwXXkpX6Juvs2/HZkX7UyNIBUHnlQ16bPVHx3W2EQ0Me6XM+ZaqmW7sqeOYrU8P2fZ1SH34jyRDJo8FmN/gGGrdMVOau3xfkA+sEvBACSNmagwW8B8xyL/TgtccJlSVMQJVzO6i4rmHhtpF65VjTd9EDiWP++hk4ax4Bs5ncq7cQR/WnUaOLdIrNSutLrJzEPHgNOYnWwTHpcKDY9PGQ4ommkU+s0e0BdtCIoGs3p/ X-Forefront-PRVS: 09760A0505 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(189002)(199003)(76176999)(50986999)(3846002)(6116002)(66066001)(586003)(4001430100002)(47776003)(97736004)(105586002)(5001770100001)(50226002)(107886002)(189998001)(2201001)(2950100001)(229853001)(81166006)(77096005)(81156014)(8676002)(106356001)(68736007)(42186005)(36756003)(2906002)(76506005)(19580395003)(4326007)(19580405001)(101416001)(50466002)(48376002)(7846002)(92566002)(5004730100002)(5003940100001)(33646002)(15760500001)(142933001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM3PR07MB2249; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM3PR07MB2249; 23:LRQLEWMT6pKC7nKpr/EHIPVngqWi3aHCP9eaRNpzS?= =?us-ascii?Q?KPGLxskOCqB+aUxIri80uBEMPGmfsTGhwoUw2dyOYH2SURciKpcSHfJ49dbF?= =?us-ascii?Q?IA20bydmDgc35R3pAph6HewDIr//NXwbt8+IlgHLsmhK6/MoLfHE90YOVQlb?= =?us-ascii?Q?HA3xdQ06vqo/kS3va0EWVu3wlHzORorJIWj/1BYPfMZP2dkq7XhzwZ1swWTc?= =?us-ascii?Q?SXNylUJNVlRvdkOzA1EOgSCygaUR0CyewjxzQTRzcl/KPaff3douINfdRFM7?= =?us-ascii?Q?TA6bd3WcsTR2rHa/sZZZoyPkzc5Gs9rNnmmbrcHTGMBnZc4SqGYYQOGBjGZT?= =?us-ascii?Q?u+V13GsKrCnb3FzYoD8jpeH/1DWQDZm2qpIx2Zb+Ie9AWoqMsJ6fVQTrh0Kz?= =?us-ascii?Q?yjb3iRQcbAlEwAddOchcemF10RcDYb9SREk6CmbSq9GJ01Rctv+rvOQieHg9?= =?us-ascii?Q?XkuyV5ziL4SdOBO7bTlwsws6glttpgd+p/EviCgtVEbX6KRhm1isRTDimZOo?= =?us-ascii?Q?hfd0esA6rURP7n84/7KhS1Qqslqiv/tKuNqZfLd/Isazk5NXV5SDoeWJ9HTD?= =?us-ascii?Q?xlynRIEsLxK9trYMZqWV78y0laTkVFLlFG6oQkzfHO/Xhl0SltSYhryyf9Vb?= =?us-ascii?Q?u0MyeSnsRtTgZ0XjAgwLk8jajxVW/fim4Clb3hw/OyR6yLDST2/lmrrdcxtI?= =?us-ascii?Q?YQALQj91g6OPze5DS8z12C80zl0lkDsHjEdD8OTCmTI6WcqruAPeYIU8301W?= =?us-ascii?Q?9em0vLRslxaUr/p/5ZTABt/AcpXmJSgaiSOj0zkHx2+uqsKiZSU1IfhWNNoA?= =?us-ascii?Q?VXnPrYrpXIb0dwJMfvM7N43TtgG6+1rkHDRH1g02kpq0wJgK9a+3/o4kIIRW?= =?us-ascii?Q?9yi02FBCyhxBP3wP+M4I0576CRoi0rqLCbxWn6NN/t1oocLmYvNcsemljHs+?= =?us-ascii?Q?B21NjOSHQRAs8Yd2KHbpQEHP4p/UxibKHrPB0mi+K00tZqYoXGtmdtbGNn61?= =?us-ascii?Q?uRakhg6q5XyyGDEOOJRdFWJMVOG5qmBPxbJdGR32QMIFkkbN1EDPvWnYGwvc?= =?us-ascii?Q?1qRfGkM8G2De1vhi/oXOh8ABLpzJv/PzLVZrWhKABrTlbYGIKON5UFbx559e?= =?us-ascii?Q?kg3tW3Mc2f4KGdRn/yRRXnkwTv7sTNQbrRJs99x1KabPr0C6T1F0Z87XmaZl?= =?us-ascii?Q?u74lvA9oLOBqVNC6uAv3s9RdoQSDp7t0iux?= X-Microsoft-Exchange-Diagnostics: 1; DM3PR07MB2249; 6:oGdZGRUcGHtkP3zTJlWXu2IXHPOE9N6xNK47Hm1qF+FMOT/WF1qOt4u8UymEuLhy/1+iROVv3Bvsa/pMJH0Pw93R0RHYAsytCpjA7263ob2907AMhyeS5pI36P9/u/SEoaUmRHF2mjEhYZYS4hfjdg8quxsErIFVrlPNmZRo13MCl2ZtWcLaxIfMGKr92hbOTmHc3Ck0bBss43FueX8faASoH8yKRs4PqmP/Tz00DJCwZ3VqYJXq00WvkkYTyZIMDws3r7y/9mk/tn5sVIZjBe+mbwW9fqhsJeRE8DA1nrY=; 5:R4zz438yRrjKVoxHcJXv/GeIwpXgxgr+tUh+Ybldl9cxFazfGw61sVH4A6gowv5VBZ+bqGveGfiAsOh91Lbqe5hSOF4NMtGTWLshYraXU98dVr4sAB2jpbcDlOF4BbMkDomukuXiivD9zerOC+XsIg==; 24:vbILigW6T5ath8bUBn10Td0DL8io5Mg1TI1V33hPCGumVqW82f/3HnMSCq1/Yu4A8lnLZxJD7buG3fbrt0WNgYojVDWMK2uvxhe03fM56Z8=; 7:i93J4CSRKOE3qskv/IfUrevcr5MsbgvYNMpZp0gomRT4rnPD9mD5J1OxQv2DpDYFZ/zWDi6w+iISEs60Oz0lYtIlS3lBcT5Gyu1kx76uorrvZ5Ne/Efc0A7s9a8bjI0LoKfvEpeKresrPAUcFMGa+8PLPMsfQoY3kBDQirNHa6mUZsjQ9pirDDcX2zz1fpVy3Koyo/5wMOqRWBGlXLQ8cnu+L7X5p3HbJEqFWKW9jbhHpk9UnjgmOczktPnZtGwn SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2016 23:55:14.7556 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR07MB2249 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160617_165537_546322_578F85DC X-CRM114-Status: UNSURE ( 8.31 ) 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, manuel.montezelo@gmail.com, 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, maxim.kuvyrkov@linaro.org, schwidefsky@de.ibm.com, bamvor.zhangjian@huawei.com, philipp.tomsich@theobroma-systems.com, linyongting@huawei.com, davem@davemloft.net, 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 | 30 ++++++++++++++++++++++++++++-- arch/arm64/include/asm/thread_info.h | 2 ++ 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index bef2d90..a967726 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 { \ @@ -182,7 +186,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 8dba5ca..7726beb 100644 --- a/arch/arm64/include/asm/is_compat.h +++ b/arch/arm64/include/asm/is_compat.h @@ -45,18 +45,44 @@ 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 */ static inline int is_compat_thread(struct thread_info *thread) { - return is_a32_compat_thread(thread); + return is_a32_compat_thread(thread) || is_ilp32_compat_thread(thread); } 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)