From patchwork Wed Mar 1 19:19:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 94749 Delivered-To: patch@linaro.org Received: by 10.140.20.113 with SMTP id 104csp1970751qgi; Wed, 1 Mar 2017 11:57:45 -0800 (PST) X-Received: by 10.84.247.23 with SMTP id n23mr12575786pll.39.1488398265218; Wed, 01 Mar 2017 11:57:45 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g5si5431723pgk.270.2017.03.01.11.57.44; Wed, 01 Mar 2017 11:57:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752144AbdCAT5l (ORCPT + 25 others); Wed, 1 Mar 2017 14:57:41 -0500 Received: from mail-co1nam03on0085.outbound.protection.outlook.com ([104.47.40.85]:49237 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750947AbdCAT4X (ORCPT ); Wed, 1 Mar 2017 14:56:23 -0500 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=RgiFBvNSXIPOBptJWhKID2+rsqLBqo5FrWKPCzItt4HbrZX1Pm4N/2kmYWr10/lXusdae8DKiTwUNiVg21KYg/CmkWR9C6nHFN9b+EdGsVZXn0Dp5vKZbsCZthpNoxcrmxUtVWfmQneU+wQVN8I0MNTt1C8rATlZWIxE4TzwSSI= Authentication-Results: lists.infradead.org; dkim=none (message not signed) header.d=none; lists.infradead.org; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost (27.97.135.110) by CY1PR07MB2248.namprd07.prod.outlook.com (10.164.112.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.933.12; Wed, 1 Mar 2017 19:21:36 +0000 From: Yury Norov To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Arnd Bergmann , Catalin Marinas Cc: Yury Norov , Andrew Pinski , Andrew Pinski , Adam Borowski , Chris Metcalf , Steve Ellcey , Maxim Kuvyrkov , Ramana Radhakrishnan , Florian Weimer , Bamvor Zhangjian , Andreas Schwab , Chris Metcalf , Heiko Carstens , schwidefsky@de.ibm.com, broonie@kernel.org, Joseph Myers , christoph.muellner@theobroma-systems.com, szabolcs.nagy@arm.com, klimov.linux@gmail.com, Nathan_Lynch@mentor.com, agraf@suse.de, Prasun.Kapoor@caviumnetworks.com, geert@linux-m68k.org, philipp.tomsich@theobroma-systems.com, manuel.montezelo@gmail.com, linyongting@huawei.com, davem@davemloft.net, zhouchengming1@huawei.com Subject: [PATCH 10/20] arm64: ilp32: add is_ilp32_compat_{task, thread} and TIF_32BIT_AARCH64 Date: Thu, 2 Mar 2017 00:49:18 +0530 Message-Id: <1488395968-14313-11-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488395968-14313-1-git-send-email-ynorov@caviumnetworks.com> References: <1488395968-14313-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [27.97.135.110] X-ClientProxiedBy: VI1PR0901CA0068.eurprd09.prod.outlook.com (10.167.203.164) To CY1PR07MB2248.namprd07.prod.outlook.com (10.164.112.150) X-MS-Office365-Filtering-Correlation-Id: 2e557209-3e01-47ad-9745-08d460d82e81 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CY1PR07MB2248; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2248; 3:Pfp/Ta0q85Mr7+TpyH6QrLTqALebGaf+TzZLf/OJs1SPiiSk8qVs7xu8R7YWmtNOH+bJUrXyeTB/srdFfI6mwVfEx/rZR1DwKJRvbMLlMaQERz0tkkWK5DjYfo5d9qPMghrlAoCK1GpCV139xM7aJ+9s0tGQnBx8r1cMsh7yHnvIqqlcDh4Z/2JVoayf43V/bA9h0WeEYc3VvYGzggDFiBNELWzzwz/163EuhHXUQLSc5Ni4eo8FyWOAdYWr4WlPiced6vZBx66APEUeFPZJjw==; 25:1JjuUIZqn+4F1J8i27BOhG+gyf8babzsy5H3zwIudKuVVtK2fYLwII7BS5KWu/d36QTK80FmSZFRF/N0Norn2fAFHsTiBRlAaxo/vskMBP47+lPjeHGXmPewanY3YwhFEuVsmt7XVq4ERQibdyao0ZllCTgjmDTs3t/gSJjdUvYR5DsZvT5KHQw+j4p+8pKo43P0mvfzTbGm13AWvwyhXH50Y00F2PFRXK51WXxOnN8psY1LQt7Fj4lYb/qDPWDn4qMUUnQguyO7tQXLa/GURO7MhWzVdJ+BEIi7MbQvQAWS0RDY8Zy2HsupJsmjfMXBYQjbG/dxRrm6WApOjkljUHeRaEBc3xBFd80wznWIMiJOwlUxClrz+zg9GFye4drN73yvTUFf/oI/On9d4MfCjI1Wn5BBlsIO7eAw9Bpd9+WCdglk5xSP9Zis50TzzyNa3X5j6aouQgsQ1PDTv8U+KQ== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2248; 31:mlrKmmU/67G6U82dxeS56b47Nd1WIwQqtdK9DtvpcrTPPrzzNxFsrRO22JhcWJNbmNsmQBkZZHYU2gJbL8mknTWu3XvPDDZRgciLKFr0nSqefbHVGac9bW1ORH4X1X996/MBDYfGzwe5cwJxug48oy5ZRWCGu93wlzfVxOkL3r0nxpCepCW9DxuV0WSZEwQPhxQcIF8yS3ytHp7eh2Ggo2BpRRzDhksPTEmV8X6kIVA=; 20:ngKDJMj7Omojnx84l47WeKU04zTrEwgtiM9hEvf6ceo/Ms6mmUJXnpuCr1ex29c9MslQlo/gIHpu297oKL3qPSD6FVsmMIraDPdedvgDHa0IEm2b2oruBtKAWpFE5NNQmsNKmTdxuD2DffiFzdM7e496taW7eaoRge8Ww+LqNIsIEFG+0GPp1X/MXpMYiwTL7s3NDyf2ZkHh8FUYcYXP0Mc3+uX1JUscp6QirCKrLpppjNHzXjePksdDwDWKfCNjaA8ZX7i8ibDn4iIrsOfnRhdHj7pZ+80d/FRbC4/FS6SpRbKap3Russa4NckgLbredd6/zPycuzvsHbFhjzKfUrBA4jqzBUV4X+dpv+pir1tWn7xg+R6yVN6QuRoqsALI9D6EVE8JX/PoNPURbAtntLdRkLWH3zxvVQf5IxeyiYbExBR/qqkNZ1pZ7SQCHPd/eZ7avqrCOsfGC5CEJAvtAf+i4cx4r26RpGJ1pnBQV1JgnTft9MhuoOcWzmL/KrPd0A2Oj7IST/V6E8f+IkBXFNz4kc4gy4lxUPiwpAwZkCBqGD9daVGmCjHFC1lzy8Uxuf5uo59zNO5KnqWAlG4QM9kCRF6R41DsNvhDQ1m90Gg= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(20161123558025)(6072148); SRVR:CY1PR07MB2248; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2248; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2248; 4:9qieJLi7Cy5tODLygf3qDrR51tNkwcIzt+mGWyU/Nrr79O8y/ScWRlh36SuD6XHRA3P15xN1S+RoYVOszW/ESPtGmqT/B77ofy0vBKV2zg90AF4lDhqWC1kUO8mhs+DH8o+j7Cb8/5pS8dFLMGPhebf1ltXvDgZBIPqxYnZLQ8FHxHYqLBa8cxuKLMnQCFCg9OXmNsBOsiNZsr5QJopmAPJaBieEMoyD7rQhhRztpLkf15qHSZjDPS+2yh0UZvJcpfe8HkCC1F+L7AARBILRPMbK5k5Q8wv3w6B1ILYLxexiFXAkscB37PElsqB3qfjzuw3jeOOb1ror7uXhQuIE0i6jtdicJhzkiY2jZoc4vi0VWRMDZozeK/PsLItt+g+F+BQx8Qj1eeDZXDviZ3lRZjfNv9280B+xxDE9d0rCIYgodTMczsHwC8kX1VOGBDRZQTLnCZbLlo3TtEuqBeOlQfLL2fU8mjpBDWZDeM+cSeP5rGyJ9plYqU6Ak0dcC2AvZpjShlpyyLPo9I9zJpydi7Y5GhHU3ArdHY2Orz+2mbJViVAHpJ8ItUWEdlmgbuA6MZNxc7J6XlQ84J5K0Kn2FSgD6xfVRB/c/exvu0xWzMM= X-Forefront-PRVS: 0233768B38 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(39450400003)(50226002)(36756003)(53936002)(38730400002)(76506005)(5003940100001)(42186005)(6496005)(7736002)(6666003)(4326008)(5660300001)(2950100002)(50986999)(92566002)(76176999)(8676002)(305945005)(81166006)(5009440100003)(50466002)(6116002)(66066001)(189998001)(48376002)(54906002)(3846002)(47776003)(25786008)(7416002)(2906002)(33646002)(6486002)(15760500002)(142933001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2248; H:localhost; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2248; 23:HVISKkzFyf9WwVqqYZH1y9/41xdqjcvC3YHPYQRc2dGqU2NeY0yIc7UqrPIvDEev1NUIDQMX7oNhQPrUmr6Z7fsO6vV6extrOuZD8/UMKMl2HRWS9vOgMdHp+yuB1v/C5kAFA4iXJJjCk61jLQ+d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B1GXsn9BHMIkKme4pYKmy3ZOmPBFUeVYXRid5p83iaCPN3t3E80IFH0mBqevIEaa/KpCVWaI+MCoo+mqRzOEpTF6XvGTn2ZXMzCxCaisxlsGlMORLjcHa0WihM4xfYGl0NtnbFv9MjqzrAegDHAGDvmTxhR1R06uyS5kG8LcdJUZ4fE6FFRhIiRFXQEBOwzFtcs291s99/qVFy2hXS9ZqK2YcM6fbWs0bP6l6ENLbwcgJ/sCg==; 5:H3Gz18Vz5ITGZ8pCgDzMMbQldPDZN307PIXAPK5R7BXQMb8vh+O/6EaSQfIc9c0o6COq/UbBrzjKeCIW3uIL1A+3BTWwe+FuXOzBo1cEGEKCJuWqzHOobRSCrNweQ8Y4cZP+Cy0Egm0TTOut+42rkZwavJkGuCo29HZYHg0v8+E=; 24:93OW+JrEz5qHEndYQ9OG4buM/amdP+AAdzS9ZZGuN/SG0fjyBfzmNT4eoE6O5WRScVR9Uv2yLfKcQqAQHYwdlP77OzfFfKbYAptM0IwL2Y0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2248; 7:cmP+jeSVCFAK/Dv3l3cTmBf1drfx2jsKPhFvx2fJ2JiydblICZo/hfHGdg7FprkYVeV/P/a/TPcGWYNHivcIUmVyFCjRUmw6NeX7cTXw3rdidsuRVjE1/86WqSkwKX4MaNLnFUrgJMEUsqY4L87tbkE08es8mxvsTftjWYjZihweTU+92f1zsbPA4ye4COOOnpCESiGsKz1D6KRQCvRk2mcnYlIuDEUGyUKv0XyyqV7GRajfYCbEQ+9A7B1627OhTNJLu1f00Hs2LDA3HjzcE24SRVzotRGL8cFQC5HCDHSz2Q3BhBAPmc+9juG0D9lw/lkQf95Xg4TZqpOL93Hr6w== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2017 19:21:36.6466 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2248 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.7.4 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 | \