From patchwork Mon Jan 9 11:29:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 9504483 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 7B34A60757 for ; Mon, 9 Jan 2017 11:48:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F12528487 for ; Mon, 9 Jan 2017 11:48:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50D81284AA; Mon, 9 Jan 2017 11:48:22 +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 AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BFC3E28487 for ; Mon, 9 Jan 2017 11:48:21 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cQYR0-0003QY-KD; Mon, 09 Jan 2017 11:48:18 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cQYQx-0003Am-J5 for linux-arm-kernel@bombadil.infradead.org; Mon, 09 Jan 2017 11:48:15 +0000 Received: from mail-by2nam01on0070.outbound.protection.outlook.com ([104.47.34.70] helo=NAM01-BY2-obe.outbound.protection.outlook.com) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cQYCO-000559-4T for linux-arm-kernel@lists.infradead.org; Mon, 09 Jan 2017 11:33:14 +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=0LxkUd8DtRSUoOpGSVGAf+FMhwnIpj3TVrLRuOsmckg=; b=jKhMOh4PeeosbJ24qoNBeL6rKLpKbGvly0v/2ZhPHYK++tXozMdDJuU8z8fjFVZzEJbFX+0Zi5yiwCh61DhgVdXUM+rlEtVk1TuW5uP4SomOSFhiqAfIQFrrpWemyI8AbXOYxThqDxrKtiBWRT9z+HDgWix+kZVAcdY3skg+y30= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (103.78.20.242) by SN1PR07MB2254.namprd07.prod.outlook.com (10.164.47.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.829.7; Mon, 9 Jan 2017 11:32:48 +0000 From: Yury Norov To: , , , "linux-arch @ vger . kernel . org Arnd Bergmann" , Catalin Marinas Subject: [PATCH 10/20] arm64: ilp32: add is_ilp32_compat_{task, thread} and TIF_32BIT_AARCH64 Date: Mon, 9 Jan 2017 16:59:47 +0530 Message-ID: <1483961397-8599-11-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483961397-8599-1-git-send-email-ynorov@caviumnetworks.com> References: <1483961397-8599-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [103.78.20.242] X-ClientProxiedBy: AM4PR0701CA0006.eurprd07.prod.outlook.com (10.165.102.16) To SN1PR07MB2254.namprd07.prod.outlook.com (10.164.47.148) X-MS-Office365-Filtering-Correlation-Id: 1e85e0ee-2fe4-42a4-aae9-08d438833dc3 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:SN1PR07MB2254; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2254; 3:lmATQtKe3J6IQdvp67mweUwjO9qwzy4oBS+50jgMIGeJx9ScDa9+NCDkCNlsrIkWf50EHFJiqagZyGZr+5XIK/BsUdkvO/WPC5lKwGGZpisYnJMSvu9M4thUAkBweCgLTKzLrEo+BKyWlasZBVHFwoBGDxk7uFSOto1p/ELbMK8pgliyu4UqYVZb99N4kOnxXG2fIRoxGagP2TTB8dHpm5bqYn735IvUfOYdp+osU4j+BLctxlzLASS9htw/O+38la5iCp14kZqKoi4Bnugs0A==; 25:Lhag5ONeTrWa+swm3lNPqTFq31RlovObxeQBMG4u53Hv18bfrSlrDpG+elbr5GWhzDq/gsDK4oeHaE0UaKN57NuOi3LhHvkhZjk6yDJT1lvt8R9zAx69ezZ2KRyB1IRjM1QUVgbQVBXvjzhStuDiozPUDhddWhJ1dziJ+XJhWvrC5SX//D4N9pCunpVr6DUGje3aUTMxosRWwVpvPGz/ZnQn0w9aNB5MzvtcK1WHDejCawNqwcWAfG5a0b6dCIeDx2g6Cv0iHVSBFRc2dbfE6J8jc2P+Dp1MC0VZxMJt4veSjRxyMI0hJswhENHnAxFcnB4576EkDXHmA8x5DnhXKdcvAQ/U/xKyG3fLj/f++u1x7lOY+5Gfj2HMD6pK0GX2viOAMZiD/tJnsoIqtySdaIouC8ElPQBv3+IMAa+Iw1uqyrQTLJ3TJAuXElcjHB3acHJ+D8i+YTiwdLGcXsyrtQ== X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2254; 31:EZdEazU/76Eet19vpjs5Rc2JzGuG2KxhusJzw4LlqixrHTRcBm8rtN5ypL6ZIIk/hhvutFdKuntV1JHjOinLwrleoDSYn+TkDYjiuOih33y5T1wVJOj04LRmIAjZ/fz8WFSFPraKc5tFNjQhaps6MX1lrmN+KfR5+xHu7eRO7S3pn1empmDLFCTCAr9AwBe793vmKBNz5gXouNE/vEgIX9sznLF4VEA9yeachScc8Ls2NpwMwKXSxBhFTMp+zeCy; 20:7exU1EXGZXju04E1cm2QsYIOnsEfVF81qGUtYvJ3XTF7tLxE9zxucH15+z/toGQxK9ihRSk26+xNnAqVfaF9MGfhBflriAYwAjqSBDCfGOv9dF9PInznu94/sOD4/eoqxbn6XKnSh7Ju6T9mKdLRl64thV0lYoVw1+3sNMEKhWxG0t4YTITwi/Qn79z7MJhITJ7iYU0KY8BcqhFqvU1t1xM/mF6yKEccnAluHzga8S0U9O/VayGvihF8GJM+Kvm7wwupvH0EODSq3AvObndUliQ5ddXy2SNnKGLm/yC1QlJqxWPLYUa9uMR/lk48n8w7XSIp9c9PNguhQIn5eM9Ot/yUaO38p2UOWAHQNNW0bKel2H7C/YVqULJA2WKkcuVThx9yr3zHA6KQ3RIgahCM1F2SjpGAUp81Pk7eAKemrjlk6VUgSssZtw/0svB0G5Hd3fSO+Ypn93D8ed6HX8SmMX7yBB2FmoVVqCxUL1mF2fP9NUSl4BliFzcoHP3/fvLSv3zy1yzKIcK2ZTNil3fYE2OQil+CKPobMyBuk+KmSHLqT40FkNSEVTFDbvww6WwDP6wAhiyl24/7U/Dk0AuYY35ET0JyJnxooxMypV/zWzc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(6072148); SRVR:SN1PR07MB2254; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2254; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2254; 4:jBeV1bRmdMzQTbBzBhA4SWK4YnN5QJAmnxkIsMdaF01VBFAMFvWIS2U0Ai6wK4noCjBiEWgWfgEt+4HCQ53dgqaYE4hj0InGs4+rLg56c2n14sIGE/4DohKZVMHa25eHNS1JNktnPiE9UrVVuT59TnNOgKI3EwNXFMtII6yQBE6lREGR8zMo4osTPDriQOeAcvJcrPysBIlwkxjlXOAUzbmBQ9/MYsy06pfHhAwYbMM9TTLkRBQ9A2w78MZXTXAWtV/xV/RqAJbC0XIin70IaZpZmAfrTURbFpkAm/rKM3Zxp63+hiEdXtcw56C0NDLI72vnMM8JSYCtDhKcWqWqlhINJExhOCXVyK3EF5aFUnpfaPTTdf6aGjF4EBxd3GOZKl95ZdPpNAZEzKKojkfLCcxiAlT54FC1Pz4ojCKjfsgpKiNO5CRHMGAuSI6LllsNd52HRe7W9miBLcZx9o4pU0mUU6zs+vfZMJ8oC42fnMsYZEm8xWz65P8qlKrghVbfp8ERFdheBJ7Oehx+9S/B3yEb5kiidllbPW7oDI/IQidRd/L2NNxij/pRD4MVZ/otFbpLSpZdWQygiNBW4hi4ow== X-Forefront-PRVS: 0182DBBB05 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(39450400003)(189002)(199003)(50226002)(2201001)(101416001)(5003940100001)(48376002)(54906002)(305945005)(68736007)(92566002)(7736002)(189998001)(50466002)(33646002)(2906002)(66066001)(47776003)(8676002)(3846002)(105586002)(106356001)(81156014)(81166006)(6496003)(6486002)(6116002)(5001770100001)(39060400001)(38730400001)(97736004)(7416002)(25786008)(76506005)(50986999)(36756003)(76176999)(2950100002)(42186005)(5660300001)(4326007)(15760500002)(142933001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2254; 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; SN1PR07MB2254; 23:qbS2kmw4PKC0rsE9LUppfUCYHXdDsTOVZ/7QK3Jw8?= =?us-ascii?Q?rIHx0GR7IVw3bdYYd1TePZQkFTrPNovfdMd5rISytJZyXVmdfdmtruYK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adata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2254; 7:Qy2gY2x5q93507lRZusi+v4mYGQE6zSkDF63uJ0AY740pmi4X5yEpMIFx63cAqes5OiB0Pj0ivEN7BsiGfDgPbY0/KXQRHMup64JBWYhF1GZapgj3gzzl30oWsdTkeTKbxn/PtaQbJ8+azwu+xGeMxHwNsMrs605nYAMvruNTmh82R8LRuDW/e2gyPAi2YUps1CrmXm3Nto7azcFLT7djL45gjZzGElyfB/RT6BtlSWyLic9HePKCiHVuK8L3eIPMwUx8WlHklgfn9y0UPVWQQTlUwcpX3wiGsDt04O4BR6HJAwB710lAzgFKQCMIlrueK6/WecD5Y68BLZIlFj6KvwuM+jeIU2CXNXwnW3d+/7MksmrCKgoZfFPeg3UMmohhB7YihNRDnWnZMI0QmoNZYUeec8qfUmr2c8SCzUUtD45/XuQEm8pe9A290th75Q41nmeQA/7x2xc+WzgcgHCJA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2017 11:32:48.6290 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2254 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170109_113312_498097_B6E0B5F6 X-CRM114-Status: GOOD ( 12.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Pinski , Heiko Carstens , Chris Metcalf , Yury Norov , philipp.tomsich@theobroma-systems.com, Joseph Myers , zhouchengming1@huawei.com, Steve Ellcey , Prasun.Kapoor@caviumnetworks.com, Andreas Schwab , agraf@suse.de, szabolcs.nagy@arm.com, geert@linux-m68k.org, Adam Borowski , manuel.montezelo@gmail.com, Chris Metcalf , Andrew Pinski , linyongting@huawei.com, klimov.linux@gmail.com, broonie@kernel.org, Bamvor Zhangjian , Maxim Kuvyrkov , Florian Weimer , Nathan_Lynch@mentor.com, Ramana Radhakrishnan , schwidefsky@de.ibm.com, davem@davemloft.net, 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 | 2 ++ arch/arm64/include/asm/is_compat.h | 30 ++++++++++++++++++++++++++++-- arch/arm64/include/asm/thread_info.h | 2 ++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index 192d295..a0188e2 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -145,6 +145,7 @@ typedef struct user_fpsimd_state elf_fpregset_t; #define SET_PERSONALITY(ex) \ ({ \ clear_bit(TIF_32BIT, ¤t->mm->context.flags); \ + clear_thread_flag(TIF_32BIT_AARCH64); \ clear_thread_flag(TIF_32BIT); \ }) @@ -190,6 +191,7 @@ typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_ELF_NGREG]; #define COMPAT_SET_PERSONALITY(ex) \ ({ \ set_bit(TIF_32BIT, ¤t->mm->context.flags); \ + clear_thread_flag(TIF_32BIT_AARCH64); \ set_thread_flag(TIF_32BIT); \ }) #define COMPAT_ARCH_DLINFO 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 a7ffea2..abb60b5 100644 --- a/arch/arm64/include/asm/thread_info.h +++ b/arch/arm64/include/asm/thread_info.h @@ -96,6 +96,7 @@ struct thread_info { #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) @@ -108,6 +109,7 @@ struct thread_info { #define _TIF_SECCOMP (1 << TIF_SECCOMP) #define _TIF_UPROBE (1 << TIF_UPROBE) #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 | \