From patchwork Sat May 14 12:49:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 9095121 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 A9AA49F1C1 for ; Sat, 14 May 2016 12:52:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B051820220 for ; Sat, 14 May 2016 12:52:11 +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 B6DA1200E1 for ; Sat, 14 May 2016 12:52:10 +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 1b1Z1j-0000vZ-Py; Sat, 14 May 2016 12:50:39 +0000 Received: from mail-bn1on0092.outbound.protection.outlook.com ([157.56.110.92] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b1Z1g-0000sB-7t for linux-arm-kernel@lists.infradead.org; Sat, 14 May 2016 12:50:37 +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=Ziljdb5tTT86xiiseDKc7O79kqslRnnJyk3zsX+YyvE=; b=19yYBhbkpSTU5PVLritabn6tvAT6FLUma5UG4qeFag2Lb0MyNIvwNBOhFJDV1Pp1m32qdJ9eFDpCpMG60DP+Id1w30L6avtlT71w+zcOuRdi5ZeD9Cn+nVuHkZbTzm8j3AXNPtaxymXDYuf+MWc0xZhvTtp5gtPZ82+RcA70KGk= Authentication-Results: arndb.de; dkim=none (message not signed) header.d=none;arndb.de; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost (95.143.213.121) by SN1PR07MB2239.namprd07.prod.outlook.com (10.164.47.145) with Microsoft SMTP Server (TLS) id 15.1.492.11; Sat, 14 May 2016 12:50:12 +0000 Date: Sat, 14 May 2016 15:49:50 +0300 From: Yury Norov To: Arnd Bergmann Subject: Re: [PATCH 20/25] arm64:ilp32: add sys_ilp32.c and a separate table (in entry.S) to use it Message-ID: <20160514124950.GA27841@yury-N73SV> References: <1459894127-17698-1-git-send-email-ynorov@caviumnetworks.com> <2733875.IzutTZKHMc@wuerfel> <57347BD4.8010105@huawei.com> <4521594.dSmlmmAdFg@wuerfel> <20160512131948.GA30205@yury-N73SV> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160512131948.GA30205@yury-N73SV> User-Agent: Mutt/1.5.23 (2014-03-12) X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: AM2PR03CA0027.eurprd03.prod.outlook.com (10.160.207.37) To SN1PR07MB2239.namprd07.prod.outlook.com (10.164.47.145) X-MS-Office365-Filtering-Correlation-Id: ef7d81ac-93fb-41f7-ec1a-08d37bf64a82 X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2239; 2:zM5+E0Ukqhxb5CMjZeEN6CovYhjMswPRse+w80OLaEE9LhB6p70DE9RcH3ArWwudLMzHz+Zwg+PFwyKvLSs4an7Bjxzxl+HLXcBzq707yV9dIjv9e19UauzPHmX+X+fIIPf1/V3WxWgeoOvHoEKgZw8Rp9f9baoHE/mCgbjNBJzD0GUv2R9H59a6XC5HXiav; 3:Z4glwl4eMgCRXa35+o+K6yUnk0sUNJBuwF3SZ8/Y3l94cyVYsZumtTC4PmkKbIDupsUriaZ2aSAjWw9CNhwce8qPMeW4vtB0dDE2UzMpRafg8afbzJTKYlI8zwc2oLQ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AwtPIe489Re8WBm3YvLJhxVUo/lw4RLz0Eq2MF3SiC17+QRFv/cs7V60ufphjmB464lJwinJUs4zUs5O9/H2cc7j71H5Ogt50ywY1o0mrjbiNwUZolPgchY7wghLyHiK+HkZS2d2J9DC5KZkzZqhuEAqjNc+OzxWf3ina7aqOoCB+Dsy2rtSJybob5UykOnD9hbnsKgWUiZqwu6NHsBdDdl3cA6+CCvH6R1SE+3fw95HdqamxojItAxuKmJL3xATVCQqRIrTQsAE7GXnCXxjtImUSN6PvE0o8/TxsHhcuESuH+hxO3FbIZhfHQ+Nc+m1q9eZ++bPSYHCD/9g/JnPAQrnjR0zoy5Q6xxwJnSR4FsCzBilebOdvVpVvDvTTEvcsqR6enZqc7gPfSlK9m3o9WOFsLDt/5FttjIUaHx3+HdnVX+cZ8aDecWaF+AaJJP+UAuf3abbtpwqZV2W+arRI4= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:SN1PR07MB2239; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2239; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2239; 4:T+aA2mzSStCR+SuhikssbySWUqdnks30yeNiechnh8iKWdG/y1mF7ypYhn10poqVpS+VH9IUj8hAo+nNYHVOH+Of0Q0+3KBW0eTstS8LMbpyJDUDwIMh7clVxpm8yGcUIqTXmDXvVnNfArvrSN3pbZEwcUaUdmsDKOTubuleiWGukDyWv5Cs3JFyWXRW9bMnMp3U2dHKyq2/g2PS8SMT7r06AEp7B19RpGsmVStbCNGn7vtbH6bUtzzu14Ih0WI3sVv4n4FE7wXOKXAYFEnPY8KC6WTpBEuozpW0xxsp5Z4CDc5Znrillr0c4vKUQYHymF1cJCcQRdaux0zqsyo54ZVbGU3/uAb7hx9eH5NuLgIbj3eVQH6JtKnLeMfsrqm7 X-Forefront-PRVS: 094213BFEA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(51444003)(24454002)(4326007)(2950100001)(575784001)(8676002)(33656002)(189998001)(5890100001)(46406003)(4001350100001)(2906002)(50466002)(93886004)(81166006)(77096005)(586003)(9686002)(97756001)(5008740100001)(3846002)(54356999)(50986999)(76176999)(76506005)(92566002)(6116002)(66066001)(19580405001)(42186005)(19580395003)(110136002)(5004730100002)(47776003)(33716001)(1076002)(23726003); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2239; H:localhost; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR07MB2239; 23:St4n2/6GhToH7EgMdyQnllSpMtv/N7P9u6/NeIrtf?= =?us-ascii?Q?Qh77C62OYlpqULJo//4t14kFRglLYPXbbE5ow5dmF7Tb9169UAbdXNkbnaxY?= =?us-ascii?Q?3E9XeTYxolT2pBNQLlvg/xk5v3bf5WCLM++TLYXkCpC7IntMnQibPy5oFhed?= =?us-ascii?Q?TnU7wpv14gDEWd+FQxP900F+o+KI+H9c/EhNJTNzJC2yWd74X7UZJVGd2Auy?= =?us-ascii?Q?4sy7Tr4P5OblzGWaELIqwEldGBh49XxRweaY2Xgpl5alpDIzZUay0QaNGG7t?= =?us-ascii?Q?U6N6XxNjiBZm3dvXXM7/XyCSlCyJ0gcmYf4/WMsl0PE8h2AUNaLEf0UA8Vw/?= =?us-ascii?Q?nZykkkDvYaGgCi/utKuLfAa/BWMZQrF/EsknodFIAEF1aAJPEqLUli4A4QrJ?= =?us-ascii?Q?iMB3niOGGQh7GAo2dSAJPOpmRUik2fxiSKLuFNCCNvSCGtIUpbMP4plLYwsq?= =?us-ascii?Q?9/wuFRFWtnsxc7uADSqZLk/odA5uHA6eUB923tAOqpfXdmsd1G1iIUJq8IhD?= =?us-ascii?Q?tQdCXgBB4yhPvUw+x4Tfj9QBOFnREwLA6TJLM3M0eUJ2i2VhaBlfLF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RmRsRcRQedNfLBUT72/oBSqJ2wRmCjD9WgbCi6cAAGOqVkDtz SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2016 12:50:12.7574 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2239 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160514_055036_592221_3AA20DC9 X-CRM114-Status: GOOD ( 15.11 ) 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-doc@vger.kernel.org, Andrew Pinski , Catalin Marinas , heiko.carstens@de.ibm.com, Hanjun Guo , joseph@codesourcery.com, linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, "jijun \(D\)" , Prasun.Kapoor@caviumnetworks.com, schwab@suse.de, agraf@suse.de, pinskia@gmail.com, klimov.linux@gmail.com, broonie@kernel.org, "Zhangjian \(Bamvor\)" , linux-arm-kernel@lists.infradead.org, Nathan_Lynch@mentor.com, linux-kernel@vger.kernel.org, Andrew Pinski , schwidefsky@de.ibm.com, jan.dakinevich@gmail.com, 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.5 required=5.0 tests=BAD_ENC_HEADER,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 Thu, May 12, 2016 at 04:19:48PM +0300, Yury Norov wrote: [...] > > I think that's a good idea. The function used to be slightly different > > for each architecture, but now it seems we have a significant number > > of identical implementations that we could just merge them together > > into one. > > > > sys_mmap_pgoff was originally introduced as the common implementation > > and it reduced the amount of duplication a lot, but as its units > > are based on PAGE_SIZE rather than hardwired 4096 bytes, it's > > not as useful. > > > > microblaze and mips (twice) are doing like this. And aarh32 as well, > in arch/arm64/kernel/entry32.S > > In previous submissions it was a patch that shares aarch32 code to > ilp32. If we decided turn around again, I think, we'd pick up that patch. > > The other option is to make this hack generic, as so many arches use it. Hi again, I picked up that old patch from Jan, and found that it doesn't delouse addr and length, which is wrong for ilp32. So now I think we'd pick Bamvor version. Jan's patch (rebased) is attached for reference. Yury. From 02ad258662c40d457ac041634e67e1cbdbb800f3 Mon Sep 17 00:00:00 2001 From: Jan Dakinevich Date: Tue, 3 Nov 2015 02:30:41 +0300 Subject: ilp32: common 32-bit wrappers Signed-off-by: Jan Dakinevich Signed-off-by: Yury Norov diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 9dfdf86..2319042 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -30,6 +30,7 @@ arm64-obj-$(CONFIG_AARCH32_EL0) += sys32.o kuser32.o signal32.o \ ../../arm/kernel/opcodes.o binfmt_elf32.o arm64-obj-$(CONFIG_ARM64_ILP32) += binfmt_ilp32.o arm64-obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o entry-ftrace.o +arm64-obj-$(CONFIG_COMPAT) += entry32-common.o arm64-obj-$(CONFIG_MODULES) += arm64ksyms.o module.o arm64-obj-$(CONFIG_ARM64_MODULE_PLTS) += module-plts.o arm64-obj-$(CONFIG_PERF_EVENTS) += perf_regs.o perf_callchain.o diff --git a/arch/arm64/kernel/entry32-common.S b/arch/arm64/kernel/entry32-common.S new file mode 100644 index 0000000..1a0abe3 --- /dev/null +++ b/arch/arm64/kernel/entry32-common.S @@ -0,0 +1,23 @@ +#include +#include + +#include +#include +#include +#include + +/* + * Note: off_4k (w5) is always in units of 4K. If we can't do the + * requested offset because it is not page-aligned, we return -EINVAL. + */ +ENTRY(compat_sys_mmap2_wrapper) +#if PAGE_SHIFT > 12 + tst w5, #~PAGE_MASK >> 12 + b.ne 1f + lsr w5, w5, #PAGE_SHIFT - 12 +#endif + b sys_mmap_pgoff +1: mov x0, #-EINVAL + ret +ENDPROC(compat_sys_mmap2_wrapper) + diff --git a/arch/arm64/kernel/entry32.S b/arch/arm64/kernel/entry32.S index f332d5d..58cb5b0 100644 --- a/arch/arm64/kernel/entry32.S +++ b/arch/arm64/kernel/entry32.S @@ -55,21 +55,6 @@ ENTRY(compat_sys_fstatfs64_wrapper) ENDPROC(compat_sys_fstatfs64_wrapper) /* - * Note: off_4k (w5) is always in units of 4K. If we can't do the - * requested offset because it is not page-aligned, we return -EINVAL. - */ -ENTRY(compat_sys_mmap2_wrapper) -#if PAGE_SHIFT > 12 - tst w5, #~PAGE_MASK >> 12 - b.ne 1f - lsr w5, w5, #PAGE_SHIFT - 12 -#endif - b sys_mmap_pgoff -1: mov x0, #-EINVAL - ret -ENDPROC(compat_sys_mmap2_wrapper) - -/* * Wrappers for AArch32 syscalls that either take 64-bit parameters * in registers or that take 32-bit parameters which require sign * extension.