From patchwork Wed Aug 17 11:46:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 9285687 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 7D51060459 for ; Wed, 17 Aug 2016 11:53:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72DA6291F4 for ; Wed, 17 Aug 2016 11:53:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 677DB291F0; Wed, 17 Aug 2016 11:53:41 +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 D14A2291F0 for ; Wed, 17 Aug 2016 11:53:40 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bZzO2-0004KG-8Y; Wed, 17 Aug 2016 11:51:58 +0000 Received: from mail-co1nam03on0050.outbound.protection.outlook.com ([104.47.40.50] helo=NAM03-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bZzKj-0000Wl-K3 for linux-arm-kernel@lists.infradead.org; Wed, 17 Aug 2016 11:48:58 +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=xqjWUMDiI8SAhioA/92Q+BJh/z7XxCb5ryQgMxpu3mg=; b=aRrex1P7Gx8QvmPlP4+2rpWc1a94bGwQsZWHv0BdPxxOF/G9XxeXGyxw2kYiB2aR5FfucG8UxrPGdD0hZ4iNY/cV/ZFIp36OhBSvg9aE8YUnaeA3KRcOqYcLeXyFGUGl1J6t45jAmXc2orC3aiJuwNlZjOw6T2Z/UpL2PneNfkI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (95.143.213.121) by CY1PR07MB2247.namprd07.prod.outlook.com (10.164.112.149) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.549.15; Wed, 17 Aug 2016 11:48:08 +0000 From: Yury Norov To: , , , , , , Subject: [PATCH 08/18] arm64: ilp32: add is_ilp32_compat_{task, thread} and TIF_32BIT_AARCH64 Date: Wed, 17 Aug 2016 14:46:33 +0300 Message-ID: <1471434403-25291-9-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1471434403-25291-1-git-send-email-ynorov@caviumnetworks.com> References: <1471434403-25291-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: AM3PR03CA012.eurprd03.prod.outlook.com (10.141.191.140) To CY1PR07MB2247.namprd07.prod.outlook.com (10.164.112.149) X-MS-Office365-Filtering-Correlation-Id: d3e3f13a-bc5b-49ee-0318-08d3c6945baf X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2247; 2:hugQHyWAQdVV2w+pa6S5vC9bdzHHzJ0aJU8G0voKWHpo+VITuBNNG7aj5kFyo12n2/CG49rgaLkx94zlUAFxJDdEr3KYH4DNLIqxpghA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TcvWxIBv0/gWXlcmpgCryArA6UA== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2247; 31:M9DtK3vjmjdCu2t87FODPBbFgdjK6nAnn/gwStX5DGgF0omQO0qYkqZpRqTRw6FGXHMizbTDo0NqO6O4PWFYR3ChBnQIpxkL+sJ8/vcLdla91AfoxF6M9KoXKoq0ZAQqiFF1USyCo5iWn1GvTK239CBcQlEq6mSoxY9ieWjND9wWpcn+Q4YxM0XHpPe99epJDSwbKgu1di/Pseqvbha68qkRdRWZJ/rrfZj3Cc3VhAM=; 20:Wz/o3uJ3y5SN7dLsl71iXvZQbOBFQ4pb5gyfeSvcSBNbBvnEkRNLll9upokGjFDAaBhmFPJK3RSnSpMRH/z3c06+eRPBGsA1AEws/r3mxGIru6L0layNec4iG5fBStWiNw0ZJn9MSU2AXZc7KBe51Fb4Dyoud8f7/CXGd+E45HPrunkw2weWsQ4W7+IdyFJFXYZxKVngj9/NnAulsWZ68PzI4+DiTRrBFgKXlsNXqTcUlkWJ9lfnQtvMpsRtZmuWG4QgZz8WgnwMdIIoLmk2HHoPf7YQR30swCH9cpI4ZbMcS7dJgm10efFEog+TloAa280oMxI2rZwOBi9HuaJPPwP4pntjiwdw0ebGc3cf9vCywYAQNPNAY6TIbQMDxf570Qqs+cfj8QLbuise9vELzENQgMneC1iIdu4OH68oCqjjGmkY7v4J1AMxH2Cn94naHB4elbLSVrqBn3Vy72dlBlM2t1dQ3M6vBfhemi3fzFCubgo4FObj+imXcI4iL9I2Ybu1cWGKVrodOPs3F8FTVC8Rwa03HyNeq0ZICzYqcD60ww1KlFg1x1SzuKiC423cP7pL/xlvv3TbJDgsw4K7c0BCY4B9D7P4yxJlqVqmAHM= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:CY1PR07MB2247; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2247; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2247; 4:ClST+34wKZ1uuzUH6Iwc1SJ6K4TgnJtrOVXq1V5+NKY8rLP9f4NjRg3RO5BLFOz6v9YXmbx9H4YwBQ7PIQcUFRDjrxmaTZsk2YX0NGO6YX/TZF1nYZsn6rTmHiiHFpFdzJlHTr88ycjAko1WfwKRDTtGk+u/OCn1YvyGH/l4cbZyl3++sszv/4T0/7YPSkytOZo7SxMyfEilf1eLvF5+d24bHr1T9KAAvxNEal+VJK8/jr2ce7a0yMZQPL289keUOuDrF2K1g0NFBXe5IyjxG+B56nUi8JzaoLE0j7LShI0bisYCBuqjutrFj23puE5NtwGYQ1+9lUPrBvrN8NQdLKBVREMlHIL49fABXqtfEL31a0qrvCzYpjU7B04eGDt0d+9XWpqWMuB7y9OIuqksfA== X-Forefront-PRVS: 0037FD6480 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(199003)(189002)(81156014)(50466002)(36756003)(50986999)(81166006)(586003)(76176999)(8676002)(47776003)(66066001)(7416002)(6116002)(3846002)(48376002)(50226002)(92566002)(2201001)(77096005)(229853001)(2950100001)(305945005)(42186005)(97736004)(105586002)(68736007)(5001770100001)(76506005)(33646002)(106356001)(7846002)(7736002)(2906002)(107886002)(189998001)(101416001)(19580405001)(4001430100002)(5003940100001)(19580395003)(4326007)(15760500001)(142933001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2247; 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; CY1PR07MB2247; 23:qt59DkMMOqrFuKuyD+3hZXsItmDrYJCsC82N/9mXI?= =?us-ascii?Q?9dkbOynJDNtYbQfgfPpt96cO0fr8vtUW8HbtWAec8+M8r03gkWnnM4r1f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Fac78lyMMPu8aklujMesDjxXm1WTNVPi3ok2eUoumeZRfR05NeIAP0AlEH93nyhJV07LHvEuxHstiT69KZ6FZqwVltu3m/S/x1L3M+Uj4eVPTPkEcEVhIZ5ovUciv0q SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2016 11:48:08.0903 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2247 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160817_044834_166280_1BCFEB04 X-CRM114-Status: UNSURE ( 9.02 ) 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: szabolcs.nagy@arm.com, heiko.carstens@de.ibm.com, cmetcalf@ezchip.com, ynorov@caviumnetworks.com, philipp.tomsich@theobroma-systems.com, joseph@codesourcery.com, zhouchengming1@huawei.com, Prasun.Kapoor@caviumnetworks.com, agraf@suse.de, Andrew Pinski , geert@linux-m68k.org, kilobyte@angband.pl, manuel.montezelo@gmail.com, pinskia@gmail.com, linyongting@huawei.com, klimov.linux@gmail.com, broonie@kernel.org, bamvor.zhangjian@huawei.com, maxim.kuvyrkov@linaro.org, Nathan_Lynch@mentor.com, 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 | 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 6a9049b..f259fe8 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) /* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */ #define ARCH_DLINFO \ @@ -183,7 +187,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)