From patchwork Tue Dec 15 21:42:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 7857671 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 B24679F1C2 for ; Tue, 15 Dec 2015 21:54:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B54E9203E3 for ; Tue, 15 Dec 2015 21:54:20 +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 BB918203C2 for ; Tue, 15 Dec 2015 21:54:19 +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 1a8xWF-0002Gr-DR; Tue, 15 Dec 2015 21:52:27 +0000 Received: from mail-bl2on0074.outbound.protection.outlook.com ([65.55.169.74] helo=na01-bl2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a8xTS-0007B0-SK for linux-arm-kernel@lists.infradead.org; Tue, 15 Dec 2015 21:49:38 +0000 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (95.143.213.121) by DM2PR07MB624.namprd07.prod.outlook.com (10.141.177.154) with Microsoft SMTP Server (TLS) id 15.1.337.19; Tue, 15 Dec 2015 21:49:11 +0000 From: Yury Norov To: , , , Subject: [PATCH v6 13/20] arm64: ilp32: share aarch32 syscall wrappers to ilp32 Date: Wed, 16 Dec 2015 00:42:39 +0300 Message-ID: <1450215766-14765-14-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1450215766-14765-1-git-send-email-ynorov@caviumnetworks.com> References: <1450215766-14765-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: AM3PR01CA032.eurprd01.prod.exchangelabs.com (10.141.191.22) To DM2PR07MB624.namprd07.prod.outlook.com (10.141.177.154) X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB624; 2:jISepgeqKqZcURrOdTxOmclqKhgTQx3R1FsnRnVhn3OtiwCgtCHEwOdzoc3X7cE2jtNpCKJqcYLnu4npfXAICLSHzFIydl+rfCOaOLuadxQn8oxi2U2WuwoCeFZUqWOu8qFswjjNaCrIIJGPa4bxvA==; 3:8yh2vwO0AEhjWm8pRYL/Vg7nnNDs8kGJuTBs21f9tEPLPZoEQ5OhJRwZRXWUrQv/h3Cev8mwtYeJsDW57ZclsKOzJLnn2rJge0irBT36Sd3WuawIgTJe+0KSheorAAai; 25:gX1XMnPJ699hMA8Jjenn+V/31amHrY69P46yzV5p/351iwNZuwbEPprjL/ACIsn7ypgLX4/fguIklKTZv+MS74pEoEgNIevTkFPqX03yGhk+YtuDqUgB4uUbKGLxNKrSHZ3qd6BSRnxpHIZxxBA3f/NlaSs9RCYKRU0yrHZwLV8cgAzL/MWYT2oTkZBQduheddKSyi4lI6sdG2FbU3soaKLHiCknEV/RUBICDUK1B1qPYQ3Ho0IkyNw/3td4+DuRr1DNwfSJ2hzcc4R8NNSjXA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR07MB624; X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB624; 20:I4JLQGXDjq2pkv2jsZnE7AEnFbxYLVCJ1j4xwMtKOfrpA19zfkobGZjMX1jau6P4lQwt9qA9B65GUByKkSHpDGi/fteUE5kPMcmd2nno6LSHLTchtEXLqEERUanKjTnj3aoutW2eLOnKFYU4A2eOwIZ+Tq8i4XiJ56pPkIR6SKh7MaK84jQ1cukWaAA5s/DKrNVTJTAsdQLiiaSVea8/00rR3hsfvhMqtdHNj5kL0Lu6WwaMvVi5ZB76wtc+uhRlHgriaOOdxqc7onbOjStkBqg/bNQa+a1rKIUrf7bjawn2oKll5FXQ6GWP4EzopaKkZLKjNiCC8c0jSeq8gK2O/9cl4TGHN6rfiYkdo5TBPxF7gIo16cOKxrSvVC0nKBHrTSuB1cT4vl+Dwwz5rK/VfZMO1m2wFwffMamyDZ7p6MkhH6w4ytpWxBxvaa3S0Mt/Qum/EDV6u0LLa/NAlf1YYyB0sp0nEZXj1Rze5HbJbjxGgmzpvcdKdLNEn8rKsPCThP24vinhh+0qsUsgPAwhM7odwb0AWsS/dpFNhOsFtvr+BxHySDXN61S8wOWj09XuXHJQvMM7S/3DEcPV43h+PaWIyZwUy5xGo5AOe6Err9U= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236414709691187); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(10201501046)(3002001); SRVR:DM2PR07MB624; BCL:0; PCL:0; RULEID:; SRVR:DM2PR07MB624; X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB624; 4:QyrGYIGmt4uKvV2XBUyavPxLEV1crBU6ka89/2Lc6ahHfQCIoqiLpqkYhhkz0gaDq+YIKlkL/77CUMw61v5I2nu++TwVeFDqu5Ww60ErA4RYb49PbQj/H4Er4nTSCQy5JXOpN4uOW4yPns2NdFt64s5PHXOM8zwsgWMgpucfvCYVNXU9BnJC74/6oaxpIOk2nBNkFUGIBnxUMvXyQM93Y3oglXMfQWRAKnTI3jvUoWrCC0DcL+2JHgP4u/mAPOTux/leGs+jG7e68H7eMwLSLGiv7w0l0NxTF6KAd6wIkcRmhrlDwBdywoXjh8L0eqjq+pxv1nI04oRadcTwuR+4LemSwQlz5sGanzdLp6cabx/2UhxBDfInzbSemszmfYBRvvyE2gxYrmnFYJllDmcqev8lBqKT3V4k9MLMXbHjeHwbu7YjHTuNESlLaRkk4Jw1 X-Forefront-PRVS: 07915F544A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6069001)(199003)(189002)(87976001)(66066001)(229853001)(77096005)(42186005)(2201001)(122386002)(5008740100001)(92566002)(105586002)(50986999)(76176999)(76506005)(40100003)(106356001)(2950100001)(5003940100001)(19580405001)(3846002)(5001770100001)(50226001)(50466002)(47776003)(5004730100002)(5001960100002)(33646002)(19580395003)(101416001)(81156007)(586003)(36756003)(6116002)(189998001)(48376002)(97736004)(1096002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR07MB624; 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; DM2PR07MB624; 23:Y8RedHr6wVxUkaP/rZcG3s6faENSspFwmFsEoEVGsW?= =?us-ascii?Q?XnMAqhhLCORwdcfZO9L6ncgBCRaF/DNNRHDcM/54tiE+PX7TcNbQ0haTLW/L?= =?us-ascii?Q?CXBNhqS1aKcuz0009JqSwiTBIwMvFuGrdN5yE/g96XxM1c+nTONZIb8hMfxq?= =?us-ascii?Q?rcZxEUT9a12+ELG3jt6sHEe0sHCwQV55BirOrH8qsLcvP5KqejzFfqkhtMZq?= =?us-ascii?Q?MPtQU41/Ju+BW0O0Gy+SBw1NDRwjfVKhxpSNnb4Nk8sV0xLIZ6hFotTBdosx?= =?us-ascii?Q?VLM0oi5iWuon4DWuqyOWjPWputfIMTch64hFi1YFIuVe1Ez6YcKSFOlyb6hM?= =?us-ascii?Q?jbIbVMfPzL5Zh2nJkBMRaKNC2/UGPYZZ+lsf8QrEo/GrS6EbATPFx4pCsXxH?= =?us-ascii?Q?eqJLrx7y/hMMYF2yN1qCIV1RYWjkrsGrb+QpFU8hg9TY8kPYFs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/u06DqDLXMgI/LOeQIOlF/GNGEcxUYBONTC8ed4= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2015 21:49:11.9638 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR07MB624 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151215_134935_403194_AC9194CA X-CRM114-Status: GOOD ( 10.31 ) 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: pinskia@gmail.com, Prasun.Kapoor@caviumnetworks.com, schwab@suse.de, broonie@kernel.org, Nathan_Lynch@mentor.com, agraf@suse.de, klimov.linux@gmail.com, ynorov@caviumnetworks.com, jan.dakinevich@gmail.com, ddaney.cavm@gmail.com, bamvor.zhangjian@huawei.com, philipp.tomsich@theobroma-systems.com, joseph@codesourcery.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=-4.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, 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 From: Jan Dakinevich statfs64, fstat64 and mmap_pgoff has wrappers that needed both by aarch32 and ilp32 to workaround some issues. Here we create common file to share aarch32 workarounds to with ilp32 code. Reviewed-by: David Daney Signed-off-by: Yury Norov Signed-off-by: Jan Dakinevich --- arch/arm64/kernel/Makefile | 1 + arch/arm64/kernel/entry32-common.S | 37 +++++++++++++++++++++++++++++++++++++ arch/arm64/kernel/entry32.S | 29 ----------------------------- arch/arm64/kernel/sys_ilp32.c | 9 +++++++++ 4 files changed, 47 insertions(+), 29 deletions(-) create mode 100644 arch/arm64/kernel/entry32-common.S diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 8787347..837d730 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -25,6 +25,7 @@ arm64-obj-$(CONFIG_AARCH32_EL0) += sys32.o kuser32.o signal32.o \ ../../arm/kernel/opcodes.o arm64-obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o entry-ftrace.o arm64-obj-$(CONFIG_ARM64_ILP32) += sys_ilp32.o +arm64-obj-$(CONFIG_COMPAT) += entry32-common.o arm64-obj-$(CONFIG_MODULES) += arm64ksyms.o module.o arm64-obj-$(CONFIG_PERF_EVENTS) += perf_regs.o perf_callchain.o arm64-obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o diff --git a/arch/arm64/kernel/entry32-common.S b/arch/arm64/kernel/entry32-common.S new file mode 100644 index 0000000..2ad5912 --- /dev/null +++ b/arch/arm64/kernel/entry32-common.S @@ -0,0 +1,37 @@ +#include +#include + +#include +#include +#include +#include + +ENTRY(compat_sys_statfs64_wrapper) + mov w3, #84 + cmp w1, #88 + csel w1, w3, w1, eq + b compat_sys_statfs64 +ENDPROC(compat_sys_statfs64_wrapper) + +ENTRY(compat_sys_fstatfs64_wrapper) + mov w3, #84 + cmp w1, #88 + csel w1, w3, w1, eq + b compat_sys_fstatfs64 +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) + diff --git a/arch/arm64/kernel/entry32.S b/arch/arm64/kernel/entry32.S index f332d5d..8026129 100644 --- a/arch/arm64/kernel/entry32.S +++ b/arch/arm64/kernel/entry32.S @@ -40,35 +40,6 @@ ENTRY(compat_sys_rt_sigreturn_wrapper) b compat_sys_rt_sigreturn ENDPROC(compat_sys_rt_sigreturn_wrapper) -ENTRY(compat_sys_statfs64_wrapper) - mov w3, #84 - cmp w1, #88 - csel w1, w3, w1, eq - b compat_sys_statfs64 -ENDPROC(compat_sys_statfs64_wrapper) - -ENTRY(compat_sys_fstatfs64_wrapper) - mov w3, #84 - cmp w1, #88 - csel w1, w3, w1, eq - b compat_sys_fstatfs64 -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 diff --git a/arch/arm64/kernel/sys_ilp32.c b/arch/arm64/kernel/sys_ilp32.c index 8ce79db..c282fa2 100644 --- a/arch/arm64/kernel/sys_ilp32.c +++ b/arch/arm64/kernel/sys_ilp32.c @@ -45,6 +45,15 @@ #define compat_sys_open_by_handle_at sys_open_by_handle_at #define compat_sys_openat sys_openat +asmlinkage long compat_sys_mmap2_wrapper(void); +#define sys_mmap2 compat_sys_mmap2_wrapper + +asmlinkage long compat_sys_fstatfs64_wrapper(void); +#define compat_sys_fstatfs64 compat_sys_fstatfs64_wrapper + +asmlinkage long compat_sys_statfs64_wrapper(void); +#define compat_sys_statfs64 compat_sys_statfs64_wrapper + #include #undef __SYSCALL