From patchwork Tue Apr 5 22:08:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 8756061 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 31A7D9F3D1 for ; Tue, 5 Apr 2016 22:18:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3C8DB2013A for ; Tue, 5 Apr 2016 22:18:11 +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 3B73E2010E for ; Tue, 5 Apr 2016 22:18:10 +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 1anZGx-0004rH-Gg; Tue, 05 Apr 2016 22:16:31 +0000 Received: from mail-bn1on0099.outbound.protection.outlook.com ([157.56.110.99] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1anZDB-0007se-UJ for linux-arm-kernel@lists.infradead.org; Tue, 05 Apr 2016 22:12:47 +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=Hkl17SvDhkIeifMDPA/KQ11GDFr/XQf9YGWQGbWI2FE=; b=0l3CvvQXvCCXrfHenA7MCh99zMFV9YvlWWx7zmfz8FJRbFEgeFpoXc4ZOpVOeEe2CgRUvPLgfpeqGQkuvihtw1S9/JJSkdp9NbJu8bWHtorW+bpT6WS2lHJaKyBHhfhGrNFAvb803DTY6X9rwZG0ob3kVXzD/V7YzGFVnYxNhJ8= 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 (95.143.213.121) by DM2PR07MB623.namprd07.prod.outlook.com (10.141.177.148) with Microsoft SMTP Server (TLS) id 15.1.447.15; Tue, 5 Apr 2016 22:12:15 +0000 From: Yury Norov To: , , , Subject: [PATCH 16/25] arm64: ilp32: add is_ilp32_compat_{task, thread} and TIF_32BIT_AARCH64 Date: Wed, 6 Apr 2016 01:08:38 +0300 Message-ID: <1459894127-17698-17-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1459894127-17698-1-git-send-email-ynorov@caviumnetworks.com> References: <1459894127-17698-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: AM2PR03CA0001.eurprd03.prod.outlook.com (10.160.207.11) To DM2PR07MB623.namprd07.prod.outlook.com (10.141.177.148) X-MS-Office365-Filtering-Correlation-Id: e224aa42-2a20-4ab4-f08b-08d35d9f58be X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB623; 2:514dmeIXaFbM9X2Fy9MzTh4ih5zt1iSNpjT0EtciK00/EUoFJnCqIAiNh8EtpEWn1qRxSsEpFOSSu92O1mHGt2A+irUP7XC8XNzpkxH/vw6FzTWuMkuU/RHf7FFWVzCoHsFX0zw+fwpeYgdHgsOMP8pLnq3oi4hJSQGVXLOGktbmzAehAKD/Y84QVpoQ/J7I; 3:+uSbM61k3BkpdTpv1/kAtlH/MiFJxOEZKxQz6MLdg8umspLA5C5Vn2aCbkA2IfLwZiwv+isbfNyptU3TsMdWrTBDhguUrBpJbxkBqFeAdSw15dqIvQPnflW1WnqIEt5C; 25:jujhZFuiKlNghpsOiyf94Dv01Q9lSC62SjCFTANIrEn4rJpL8s3bME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lXcK4sCIGtXkn0KVVXY9qnMH2qL1m4WptlhlLf72QK+zEzj7n3JPmft8N7QRfPtZ6T5yX3XtTsvtAdsawjZor8k9Tq/Uehctb7Dml4PgwxgZj1qU9Slsjg1UZ5t5l41LFH8N/MWo/AH8zBiDYYIYsFnd00e2iPs9PpG5JV1S1VPiQf9aQtEArm9+EP5VZTyV6qvCUhm5JavD4= 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)(3002001)(10201501046); SRVR:DM2PR07MB623; BCL:0; PCL:0; RULEID:; SRVR:DM2PR07MB623; X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB623; 4:BMly2KgcvMSEMMbdoYqjaEPZ0AKBXM0CEUZf+NVN2S8vr2q+tuZL2tUgUY+WPsjJVmvkm7AY749Ev4lIz1pcimZq3kYZLKFOCOlb3m4Xnh2buyTsqT6NQeX5PczIMvzCfFjI1cj9XItpHwB9QIaPgyXEr0kUJp7l0xfJKfROcZIwooTnirtd3GvVeKqLSYZmtjh+WddCjkKyAMChrI2owLRtIlYw2L3lbmKKCBkBj5Zi2NF0D5B64cDrvIjYZQL2nz0Dm2W7nLhzGIpHDE8NVUjslMY9qVo7Q6uUlv9NfC3AFcgiHtZoqrBF/C6SLizOgt4RV5IOrCIXdiztwjvQN13+w+qAAroU8RdsMcfr4hRkaXAiyiYwMQtxtLxUP+ty X-Forefront-PRVS: 0903DD1D85 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(1096002)(2201001)(81166005)(189998001)(3846002)(6116002)(36756003)(5004730100002)(586003)(229853001)(50226001)(2950100001)(76506005)(48376002)(50466002)(47776003)(42186005)(33646002)(19580395003)(92566002)(77096005)(4326007)(2906002)(66066001)(19580405001)(5001770100001)(76176999)(50986999)(5003940100001)(5008740100001)(15760500001)(142933001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR07MB623; H:localhost; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR07MB623; 23:YTki/205qzMZsY+IE4+WPDonU/J+/8W5K/Jov2Ug5w?= =?us-ascii?Q?OtlYajuLDyAgZMjSB+ziIoD3JIbO2VtUnxkBDKrJJEXp52hnMUmiLHnP+7pG?= =?us-ascii?Q?Djr4e1RWs54NzuXRVbrZBJ6Z6dXTFRJqLNPdp9lw8DlhXaxjciP6X8VFhqQI?= =?us-ascii?Q?2J1ZerFqf6k8IXfB/JoMF/epTUD7oNBkADpAwoU3Cgr6RSMh1bjhCKqS5b3z?= =?us-ascii?Q?szzjc3Pp0mjUgAL112K4UbO00bgweTtqVL5G251UI4Qn0k7EEjgVyLphvkcg?= =?us-ascii?Q?LNeJ0w5wfNk4elzWkJ2E+IoFn1+4D3BnddvZEPS4ECd02zAwueFuKjDmFFwr?= =?us-ascii?Q?gwaZRw57rvZuNEAjfETTFAiJSATB2W5SbmyWG6E3OjCe3NpoZs5o9l6HLTHd?= =?us-ascii?Q?B2gmEoe3amNEhmQGnMmPRmIjMx2t2poNP7Mf9yAD+pWiqajBtI6+5hRb7PFb?= =?us-ascii?Q?skNBX8tEkGjfMlCIXPQM1a7wVwwklKjddF5dpSdep536IOtWfQSBy/OPApTI?= =?us-ascii?Q?X/3tHPU8L9wkiLfhrmBrE5eAXKvWzjJU/9uMj0MRVNNBQV1snsGrnk13Mr9Y?= =?us-ascii?Q?cTDH0Lq61rX87lW1zlSMLkAfW8uAdoAE8bu5o8Xki6T9jig0Ef/B9djbofpp?= =?us-ascii?Q?dRPDFZdO0yTgx9iNQlVpO5MCQFq1wVW0CM2s+dimyh2NWXv4BQwVk4u/ZSKP?= =?us-ascii?Q?9ur0AXTZpzdHl4B3/Urg7V07ehh3wMQgeFmtISbMTXwRbNFiAgQfNJ4MITsO?= =?us-ascii?Q?TbpUPZnux8rLjQG1ZlSK8/yPtMzaQCxQKU8hArhV1yJcx/+FMsuqhaKhGmCR?= =?us-ascii?Q?4ZzODTIcRPv3QT8OpsEoRzbfZAvFoZsd3Kpm7drSzdC1JlWqxkh3EEMKpGD0?= =?us-ascii?Q?Aki/chdZ/l3HhiHfgnbHvLRoOpc/ubYsgy3yRuUewWd3HhkpNm5NtAYkgSJE?= =?us-ascii?Q?w48R2B3nDv89BQCe5IihpYX3RMHwB+7+6uzCgQXBNoBMcZsgeX40MsceU8ZR?= =?us-ascii?Q?U=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB623; 5:mwCiy9A1tSgDWPVqnrv1hvs0/BGFVxMBS0HKIZBrx9Lb5O6cs5TDTjHtFDcsM/qF8jAp3tL2xvUv7tG/abtYvT3o0FuXAvanhsU7KC960WPMrPuZYVvgpW5dZ2aOzFsuHjYivHoyCJnQtYi1ZFtb8w==; 24:b06a4VKgQQ0RF0KsEO5RH7BESEUqOiODEUwQWM+zSrb8AQovxShMoSW6ZkFAy17lJQ6wqTaUPW6PgjK4sB0ezqxPioIPAWLueiYBawEkJRE= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Apr 2016 22:12:15.6025 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR07MB623 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160405_151238_815095_0741BA0C X-CRM114-Status: UNSURE ( 7.58 ) 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: linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, pinskia@gmail.com, Prasun.Kapoor@caviumnetworks.com, schwab@suse.de, broonie@kernel.org, linux-doc@vger.kernel.org, heiko.carstens@de.ibm.com, agraf@suse.de, klimov.linux@gmail.com, Andrew Pinski , ynorov@caviumnetworks.com, bamvor.zhangjian@huawei.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=-5.1 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID, 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 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..8bcfa38 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)