Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964885AbcDEWOz (ORCPT ); Tue, 5 Apr 2016 18:14:55 -0400 Received: from mail-bn1on0077.outbound.protection.outlook.com ([157.56.110.77]:46656 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1760806AbcDEWMe (ORCPT ); Tue, 5 Apr 2016 18:12:34 -0400 Authentication-Results: arndb.de; dkim=none (message not signed) header.d=none;arndb.de; dmarc=none action=none header.from=caviumnetworks.com; From: Yury Norov To: , , , CC: , , , , , , , , , , , , , , , , Andrew Pinski , Philipp Tomsich 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 Content-Type: text/plain 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:jujhZFuiKlNghpsOiyf94Dv01Q9lSC62SjCFTANIrEn4rJpL8s3bME0tKiMIgRGXflrE7wTUMMWb+q9WyaXkqqploFnj50t3BwkzsClaiZKUO9hHUO6U0tQej5LlEmhQHmeqDUs+l7xPIRPBWPGoiuod3j0SRL8LvfRq+Jtpj4DIqmMvyHl+IiygrXQa326NXemuUjpgy5DRma7EMbj4elPf/yh/L655fVAheaD5HgJi7ydtL1+015bOtdVVVtVUCrmT2fzR5uAXnRA1eQCEhqGrquH9kv5tjtvnKZBHVaZTch92XQ+fpUsnwi1NxWFAGydEsDUr4cwltaT/AFltCCSii2KKioNXyAy0XneWzNNEGY6ZOAyCTuso0M0zRZOGXjTt1CUTyNNmU/Oj/PWdXBL5nJlt0unbBndw/CffOT/DghmUM6uuuxh3I/JThvW7uGv7Gem6Nh2ESgdgmrOMdza1FqkRLDpqDNfeI6ObhIjtg+SYM/DaT+hQw55J6M9gBuw9Pp+E8f86Yhio+k6CCkmnAi/KHKtVT192PIR9vBIe8VxTB8J+DOGdLTxVaGFCYKeGyTashZEJGCbAEvkePyhojH99MfeIeNqYG9BACNmf7qUHlHztIT5+q4SahXuc X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR07MB623; X-Microsoft-Exchange-Diagnostics: 1;DM2PR07MB623;20:bFAf+JPbS4dnXpKePYpJ858gCBHVTqD/wUd/4ra0kLPkSQYP644+ZfmHgsuyDUfpRGzbGqOnXHTQzCze60+yhlmtwllqkCE9ulgGETfKDG91nTorTfa5jLU57Ewc9uPgZS37udjgDQ850okUQ7UjfQgrMFJFqmed/72QOXzh0HMBPK500kKG2KDD7gnH53ZUCiuUa0bEqLPYtskZsmaBRDdegibpVWrPc4a+w/I/dxuSmvOPE8uONwC4h9bfuZZBQEqYi3Ogdm72S1ay73bJwzkxA2gUpWIYKjUwO8g73mHYzrJS1aFWEBmYG0ILCPq/ImgjiSzZnQ4ouEYtHuXTEvdVp3nksx8e3b8sG0gW00hwq+iqdRGoqtdFP4YUjd3MnmS6CYeC7IlzelBrWy0KG8uNk1aEKVlXcK4sCIGtXkn0KVVXY9qnMH2qL1m4WptlhlLf72QK+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 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3457 Lines: 106 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) -- 2.5.0