From patchwork Mon Apr 25 18:47:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 8931321 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 E1BF59F39D for ; Mon, 25 Apr 2016 18:51:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 05A10201EF for ; Mon, 25 Apr 2016 18:51:55 +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 225A6201C7 for ; Mon, 25 Apr 2016 18:51:54 +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 1aula9-0002Ds-9n; Mon, 25 Apr 2016 18:50:05 +0000 Received: from mail-bn1on0649.outbound.protection.outlook.com ([2a01:111:f400:fc10::649] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aula5-0001l9-9N for linux-arm-kernel@lists.infradead.org; Mon, 25 Apr 2016 18:50:02 +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=g+dzlEKLx7Wr/8Z9ibNvVvG41J6o/50Hex3wyB4M9T0=; b=uBlcFyFs2AzoUIeWgvk9VpWEZji+YV2WsPq3gblRmemaM8DV+XjPzXngxpDGlrtFBWv6dkU9WCQUMJ1U0l6/S0X93YUK58xDNZAubfZ2v6meRQMmsQzTSe/PUoj1TXOjgPpeKWduyWnMrILm2cg9DS7YYUy5yUyZ1Z090xuU3wE= Authentication-Results: arm.com; dkim=none (message not signed) header.d=none; arm.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost (95.143.213.121) by CY1PR07MB2230.namprd07.prod.outlook.com (10.164.112.144) with Microsoft SMTP Server (TLS) id 15.1.466.19; Mon, 25 Apr 2016 18:49:37 +0000 Date: Mon, 25 Apr 2016 21:47:40 +0300 From: Yury Norov To: Catalin Marinas Subject: Re: [PATCH 20/25] arm64:ilp32: add sys_ilp32.c and a separate table (in entry.S) to use it Message-ID: <20160425184740.GA2559@yury-N73SV> References: <1459894127-17698-1-git-send-email-ynorov@caviumnetworks.com> <1459894127-17698-21-git-send-email-ynorov@caviumnetworks.com> <20160425172656.GI9614@e104818-lin.cambridge.arm.com> <20160425181913.GA30125@yury-N73SV> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160425181913.GA30125@yury-N73SV> User-Agent: Mutt/1.5.23 (2014-03-12) X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: AM4PR01CA0004.eurprd01.prod.exchangelabs.com (10.164.74.142) To CY1PR07MB2230.namprd07.prod.outlook.com (10.164.112.144) X-MS-Office365-Filtering-Correlation-Id: a454b481-96d5-45d9-fe9f-08d36d3a5a2d X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2230; 2:Ya3ZT+cJvVlDHm/xipEVtC881tYS1PHGGf0sbCsKbk3dAOgi4tGIK5A/edB/Qb2T4Kkufjqu8zmWCEzIg8Ok7IMXMLJeGuHJT3Q4NsdUxeCVETlLQD/441vRMqs82i2pWYgNi4pyIGvNcsm8vMPBlCIqyZx6doaFp+9Z7fuRckBabyMNCB1ukVNJQMixoBZ5; 3:FzSQJpCFtvNg+kk0Dc1klMoyw/EC36umZQgvLcfs1+m4krbDk2oqAGFUk7SoIK/LcOra8CQlRHYS9ZuWpwxfG1N8PViZUtvrOFs2Eq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2ZXsGImRUuZE00ZVNwpxywSCbrOGvLhXFEHqHM58vDWCo4a8Vn6l3W8SfhaCZEXeFuCB6J6QSmNoCJL76QZprLdt2oWXPGcz0y01Qbdjlpd+zFtAhHccFgnbSaE4VNLCrvvZk218TT2tlRZNRFwxuMTdZeoVEJNu+uP/6/fbH2z3fwpKNwAMSSWPDnzHoh1t+ydQEC4UV/JF/9LQ8cUlApaeSRikvR4iyhNdv4wqZjdFnvbNHTV3yI6LpfQhGQHUXENY2Loy4vpD5Y4Ua+405M8VjPXwq1Jzh3e7TaN20ICYhufEmTgQOFLE9/ePQrIVsgGgNNBkYY4ntP1+R9bafqZTHDzPSGsT5ULjE0Jc+Mscw3j890UYUAhT4t+h6YWg4ZyeRQsT8LueViq3FYhj1RJ/oa5R6A= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(9101521072)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:CY1PR07MB2230; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2230; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2230; 4:t0RWkCR19ZblEXxfveksjEYcboEiQgG7HsLPVchxu5aygltVAEckJo+uxgOtJwgnGdPPgGQvNYP6C2D0Lzsk0TtDL6ngF/ZQWNGoISl7ZgCBtsZaO2uxQlLyD3aRGKc6r/slj93Mu9nUs0CUiC9cFWa0PoI4XBe6tosA46/agQ5pPL7muMp5e2/TrRZj2PXI2GdTxqI1hIwpx8t+B/rHnWHqX5q5QFI8hdGbqWgsmRIapTeYUJTSQk5TPZUbDL1rAlmJ6lp6XFf+UYwJRZCx5YngwcCKpBIQpAIgXHRXkPraS+CP81xvJ5B74l/I9QZoZcB5qM9kIuoy17LHIJuFEk4PwTYEsUwD+HCJLyBUesbRXt+MakVTscrDoNHNzbQZgKwHPCoKj1zp5N+V8U8SmA== X-Forefront-PRVS: 0923977CCA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(24454002)(83506001)(33656002)(81166005)(4326007)(66066001)(1096002)(5008740100001)(47776003)(76506005)(93886004)(3846002)(42186005)(54356999)(33716001)(46406003)(6116002)(50986999)(76176999)(77096005)(5004730100002)(1076002)(92566002)(23726003)(110136002)(586003)(97756001)(9686002)(189998001)(2906002)(2950100001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2230; H:localhost; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2230; 23:K2t5K+ibS8heonwgttEZZrCfloiUT+DVMAEbdiIUZekzkRLPzui7AArLwbXtgfLOHHgrGyQAOKGzBOq+P3hFjcK1WqZk0upBdMDxg2aF3IL1QAorg7P2OBS4khASNNYJN4p30DbPrr6gNxSuFEyI8G71pHarJkutoZmq8LVqGdnVLmifZJZdP3a6/iNqDb2nsbzsIibn49YFjjSJWcuKmmzQ0lCO0WI9p/3EJHVykj4KkdJV+Rnxl+tuhzl3YaL0cjb7dxGVitRT8PmkYc8XMt4ElAhM9rpiNz2hiZks+eZtX2RW0kNq+g918jb6KnZ5aZ1xS5f1fpPTTIGwRKRdsSgPKe8H/lPqbRR5IiFZlclzOpbMWJZKn2/GxcSxdVJ4KzFq7ET/vAiAXhw6/bhE5vdcnQk4H3oR7rOHQdft2VJiMTohHxsJwddKNbEed+bmAoGIw7JSTPovzYdzeiI5BMlxyLQO8j5ybOjL72Msk0hRLXZ5eXXUe4dy5tNtjVeY4SOxttajSVGEICdQgKCNAnHYUBsrGL1LdcUnMCXZ/ko0sEqWmpjNsGShqv72fDk5Hg4eIl14r8qYm1hkCJb4o2ic0iGxEuhvB6AsyzXue2sVUfGn51baw8XATZQiXPLquRfPaIsgtbE5sGGdUDisLV4d3Ql0lbmxq5fJzj9ePfb9TTq45R24oolyWJQ+nkWkq9gBOMHCKPs+63/igQ42S+D2CFjAWfNiOCNRvAwhy1qZzdToBfVnWq7wYF26zQBXB1kSIHDQH9vEC+a6TUCJ6/ZCxRRvh4tv4nn+Rn8tNgN+IpNUy3rpn4OOqqAAK6S8hEjgoCUmhf28/WG44lbKczXFKSmE8NF8Pg8aMp6uf4hsRt1eXpLqQP8QcXEUjk5JRVYFbkwaxgjcU9vylkbxMA== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2230; 5:70makZ5Ss/HP+3JYxQfUC73dBq7r8LW6Yi0O8FVcSRz7nc1WkvzxgHlwpBfw9LTI4FguPnovTdGL3HfhmmxYSQeRqXgd/fokbnxt4skQcLF+4gogveo7bvLD7Fo0al+th76jtfMfJcTnejIoovUo4lMifetr1un3+QyPSai6RqaktW12OagoiLovPR72kuHj; 24:DCvrzit8hLyWR6WG6SDYmeGKAiJMRR+Cre+mu1ms+V2DVdCqbN7o+tnXyWaNqqIybGvbF5pt0+73w6VROx+5yxKIze9FGDhzd8POVIMsAyk=; 7:2Xqj1kKFwIjV8DrSE3a4BGwUCSY7Y5eU0LnypWQaPfXQ1oVpdJaMRZt/MF7vTdizQ3UxAQz/ueAL/RXinkUaCyaR2tup6Lhv5i+3xS+hTqSEbpeqm0498tOQb0ErXydnKzgNm8KXq1qfHmJz+nzXmAE1ClDd3JDFQHlCQgh08vjw/VMP79TzpmSj4tG/qvYBWLbWBgaWalwgbHX+AL7cFpkSxk4VdpCSEvjWOHZrl9o= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2016 18:49:37.3803 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2230 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160425_115001_607265_073D7703 X-CRM114-Status: GOOD ( 10.08 ) 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, arnd@arndb.de, pinskia@gmail.com, Prasun.Kapoor@caviumnetworks.com, schwab@suse.de, joseph@codesourcery.com, linux-doc@vger.kernel.org, heiko.carstens@de.ibm.com, linux-kernel@vger.kernel.org, agraf@suse.de, klimov.linux@gmail.com, Andrew Pinski , broonie@kernel.org, bamvor.zhangjian@huawei.com, Andrew Pinski , schwidefsky@de.ibm.com, Nathan_Lynch@mentor.com, linux-arm-kernel@lists.infradead.org, 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=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 On Mon, Apr 25, 2016 at 09:19:13PM +0300, Yury Norov wrote: > On Mon, Apr 25, 2016 at 06:26:56PM +0100, Catalin Marinas wrote: > > On Wed, Apr 06, 2016 at 01:08:42AM +0300, Yury Norov wrote: > > > --- a/arch/arm64/kernel/entry.S > > > +++ b/arch/arm64/kernel/entry.S > > > @@ -715,9 +715,13 @@ ENDPROC(ret_from_fork) > > > */ > > > .align 6 > > > el0_svc: > > > - adrp stbl, sys_call_table // load syscall table pointer > > > uxtw scno, w8 // syscall number in w8 > > > mov sc_nr, #__NR_syscalls > > > +#ifdef CONFIG_ARM64_ILP32 > > > + ldr x16, [tsk, #TI_FLAGS] > > > + tbnz x16, #TIF_32BIT_AARCH64, el0_ilp32_svc // We are using ILP32 > > > +#endif > > > > There is another ldr x16, [tsk, #TI_FLAGS] load further down in the > > el0_svc_naked block. We should rework these a bit to avoid loading the > > same location twice unnecessarily. E.g. move the ldr x16 just before > > el0_svc_naked and branch one line after in case of the ILP32 syscall. > > > > Yes, I thiks we can refactor it. Thanks for a catch. Now it's better, I think diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index cf4d1ae..21312bb 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -715,16 +715,22 @@ ENDPROC(ret_from_fork) */ .align 6 el0_svc: - adrp stbl, sys_call_table // load syscall table pointer uxtw scno, w8 // syscall number in w8 mov sc_nr, #__NR_syscalls + ldr x16, [tsk, #TI_FLAGS] +#ifdef CONFIG_ARM64_ILP32 + tbz x16, #TIF_32BIT_AARCH64, el0_lp64_svc // We are using ILP32 + adrp stbl, sys_call_ilp32_table // load ilp32 syscall table pointer + b el0_svc_naked +el0_lp64_svc: +#endif + adrp stbl, sys_call_table // load syscall table pointer el0_svc_naked: // compat entry point stp x0, scno, [sp, #S_ORIG_X0] // save the original x0 and syscall number enable_dbg_and_irq ct_user_exit 1 - ldr x16, [tsk, #TI_FLAGS] // check for syscall hooks - tst x16, #_TIF_SYSCALL_WORK + tst x16, #_TIF_SYSCALL_WORK // check for syscall hooks b.ne __sys_trace cmp scno, sc_nr // check upper syscall limit b.hs ni_sys