From patchwork Thu Jan 14 17:23:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 8034611 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C01779F744 for ; Thu, 14 Jan 2016 17:31:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D0B992044B for ; Thu, 14 Jan 2016 17:31:19 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id D62CC20430 for ; Thu, 14 Jan 2016 17:31:18 +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 1aJliX-0008SM-56; Thu, 14 Jan 2016 17:29:49 +0000 Received: from mail-bl2on0057.outbound.protection.outlook.com ([65.55.169.57] helo=na01-bl2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aJlep-0004YQ-Qd for linux-arm-kernel@lists.infradead.org; Thu, 14 Jan 2016 17:26:09 +0000 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (95.143.213.121) by BLUPR07MB612.namprd07.prod.outlook.com (10.141.207.27) with Microsoft SMTP Server (TLS) id 15.1.365.19; Thu, 14 Jan 2016 17:25:34 +0000 From: Yury Norov To: , , , Subject: [PATCH v6 09/21] arm64: ilp32: add is_ilp32_compat_{task, thread} and TIF_32BIT_AARCH64 Date: Thu, 14 Jan 2016 20:23:06 +0300 Message-ID: <1452792198-10718-10-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1452792198-10718-1-git-send-email-ynorov@caviumnetworks.com> References: <1452792198-10718-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: DB5PR02CA0008.eurprd02.prod.outlook.com (25.161.237.18) To BLUPR07MB612.namprd07.prod.outlook.com (10.141.207.27) X-Microsoft-Exchange-Diagnostics: 1; BLUPR07MB612; 2:MYPgcZktBP1Pv5UnRb+NFWC/SSjYsolzqy6dob7ERh86Z7U9ANPNB7QBeM13K6NL6kqHWc9sjl7hoWKTXNiAUPE1RtlHNnLD1a0MFpaApN0IBGK2aYUW9i3JPniqSYGWSqPpF2XLVvdXo3AIaeEQRw==; 3:cOAdB2/svOiAAl86DofWSkgs64SLjjMaVSJUb7ni7YsVfdyZ5wrqVZYA+Ht3hx8yO1D6CARyod1NHwBqoe84BsCy6ED+25YBEDP/Bku0mo+GM/ghSyq9m4UxMf1XL7Z4; 25:MId/H0/c8ZXBbk94+euuJX8j8F+C3TTPOOAvXKRJBnf8PQz1kIGDi27k+bWb+4Ob6KKeLh6oWLUK6T8oomdaTaP8vR7vi5eGriQ27MWDAwNTtwteqM4weUG+sG9g92T21y0xlgHpRdpLHekRbi10zJM3NZfdZsUifYzUJbzh/A7W+unnbQa11mqFHCd28/4FLY+ux0L5LroBtEMTmyZE1y5EqUcuBEG37MiC3dAxkY/j1c5Vlm+tvy4ioD4QXf7K X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR07MB612; X-MS-Office365-Filtering-Correlation-Id: 541f5ef9-68ae-4195-676d-08d31d07b5ea X-Microsoft-Exchange-Diagnostics: 1; BLUPR07MB612; 20:THSLCePNk9SnGspgFpLpzBYNHwsC3uCEJsUGN2Upto3Av6N0fUMzZZKeUcDkiPVEtXRnD5NtNDzWKAV/w4HBqw22aSL2lXRdKXjXaVAufZniMIyabxCBeXG5VKwk72yDbKS7ckN6OjzS/3VKB8XDMC8UsLuLkcG7UgFZqOaZDemJazWh9GIdpUHtqA5gjlTVIhBl8XQUkOtEJxqAWuS4VN5slCl7Lv2HbzccqfquWJI/xOqy9IElTUV3Vtiw/WvSsfmI7pUEuNYqKYb+vEqw7Wsg497w6UA6Y151Kc2lrmCDh72H+/NROHF8soxAuRxOSUu1NwC6F9CUDmfqds6/wrpv7wOUSDyi6p2ECPmezCFaTb4s/j1ESUPwuyf4A5gnbsOlY7wqhWPSKOvfWOWFmaNHQ4UpX6VAcnVTNJvHNt+SFd9N8qzpt1i80+5NiX1a6qp8MsxO/CGGlfDYv0pwcwKFa4/xUQwQe4YT7Ug8tA7e/GzZwk5plmDRZBybqBFpBr8O7sxyWfhZk6Nb2ICAyaiJMCq+OXY+ISngjmNf8gVPgL4hDhtnhdfl2PGRiKVhd2A/JXE1CW1/tdDYbdteBLYTwbv0IHfL5scWR6DrJ6k= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236414709691187); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(3002001)(10201501046); SRVR:BLUPR07MB612; BCL:0; PCL:0; RULEID:; SRVR:BLUPR07MB612; X-Microsoft-Exchange-Diagnostics: 1; BLUPR07MB612; 4:SU8u1Kwf6DNgau2k1TDrr8L5lFu53yaQ6RARpMUUa93N5alMkZHf3Netov1cz7dbUgKw/CY0bFDbRFO/ObwWxXp1Bf3BlEs6h3pzmdXEqeH+f280EZZr/7TM/8TeKnpIaYbrrTaGBBP/OpaziAG0w300EcmWVk+tb8ivrg1fPw/AlgygkboeJCtMnEVsvI3Y8ybAwYgdB1+4Qz/6bpVkdJvUDeCU+f9CuEGNL+Im/KsIfScVn7GrJ7z7eUCXvE51t0gdHTzwTODOTUtsza3ck9kkVwknrFOCGIWyVITKa7V4R6uMmJh43mY3WysKSgs6KtDcYBHfL95tBg+9+qQ1/ibRA00su+uPHnm34XsZt7LnwKozDkyaKZG8FhZU7/SgDOPFgg4VRPEO8Ri5lEXjGM+7i5eAUx/jgw5hVL/zQ2nfZR+AY3Cr+2OXFOY1FXf0 X-Forefront-PRVS: 08213D42D3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6069001)(199003)(189002)(4326007)(5001770100001)(2201001)(5001960100002)(189998001)(106356001)(97736004)(2906002)(105586002)(77096005)(36756003)(122386002)(50226001)(76506005)(42186005)(5003940100001)(81156007)(5004730100002)(6116002)(3846002)(87976001)(101416001)(229853001)(5008740100001)(1096002)(33646002)(50466002)(48376002)(586003)(40100003)(19580395003)(47776003)(92566002)(19580405001)(76176999)(50986999)(66066001)(2950100001)(142933001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR07MB612; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; BLUPR07MB612; 23:sHGjI+7AlLiYZQSD5OjWHtD/myVijRWkmO5S6Fx57X?= =?us-ascii?Q?bv5Tfs6TY7+gwU00VS9EGnYCqTN6s1jlh3bzqAbFekAgyi9txIjhCiV4auB+?= =?us-ascii?Q?vqzlOJ3mSi/jVpPuM/3C0tiPV9Ceg5/ngKqn3nqUCMGSltZ31tuF9a66KrOf?= =?us-ascii?Q?RjVMVsTGF1k1xkYjQ/QQV33KRYjc6yOy5NEu7UY8g2C0HWdpmLIcsJR5MXHE?= =?us-ascii?Q?9USKPI43AHJxDTBrftrKjePgnRYnjsxb7OX3RFF4IsY06lNDTL8XVZPruRwC?= =?us-ascii?Q?FqbRrwLqz5BJ5Chqpm+NcwRq2/WgrXxfiX3PpGeNpsfA16JGmNuA0bL18WpA?= =?us-ascii?Q?2iRRFHza7onVAw4bNj/pup9KhaPWrLg5mV4tbZD569M0v44YdUlbYjknRe3y?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GXYU9wJyxzRlHbe130f64usM+nzbdAENyxuFuqnmweqw==; 24:31Z1pn5L4+ERf16rVeCr0WnQJlpAiwV3jpsusFoAj95pzmYthmvGIRky9sgXwj0/UCK2XVECw1Ds/QbIVxYKFhVtAQAuqwO0vFAsKCHaVRI= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jan 2016 17:25:34.0105 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR07MB612 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160114_092600_608942_03D7B123 X-CRM114-Status: UNSURE ( 9.53 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) 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: pinskia@gmail.com, Prasun.Kapoor@caviumnetworks.com, schwab@suse.de, broonie@kernel.org, heiko.carstens@de.ibm.com, agraf@suse.de, klimov.linux@gmail.com, Andrew Pinski , ynorov@caviumnetworks.com, jan.dakinevich@gmail.com, schwidefsky@de.ibm.com, Nathan_Lynch@mentor.com, Philipp Tomsich , 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.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 are 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 | 1 + 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index 2f62ded..5e27a64 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -135,7 +135,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 { \ @@ -174,7 +178,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 dd046c5..c74d4f5 100644 --- a/arch/arm64/include/asm/thread_info.h +++ b/arch/arm64/include/asm/thread_info.h @@ -113,6 +113,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)