From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932625AbdGKNlL (ORCPT ); Tue, 11 Jul 2017 09:41:11 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:44639 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932229AbdGKNlK (ORCPT ); Tue, 11 Jul 2017 09:41:10 -0400 Date: Tue, 11 Jul 2017 06:39:48 -0700 From: Christoph Hellwig To: Palmer Dabbelt Cc: yamada.masahiro@socionext.com, mmarek@suse.com, will.deacon@arm.com, peterz@infradead.org, boqun.feng@gmail.com, mingo@redhat.com, daniel.lezcano@linaro.org, tglx@linutronix.de, jason@lakedaemon.net, marc.zyngier@arm.com, gregkh@linuxfoundation.org, jslaby@suse.com, davem@davemloft.net, mchehab@kernel.org, sfr@canb.auug.org.au, fweisbec@gmail.com, viro@zeniv.linux.org.uk, mcgrof@kernel.org, dledford@redhat.com, bart.vanassche@sandisk.com, sstabellini@kernel.org, daniel.vetter@ffwll.ch, mpe@ellerman.id.au, msalter@redhat.com, nicolas.dichtel@6wind.com, james.hogan@imgtec.com, paul.gortmaker@windriver.com, linux@roeck-us.net, heiko.carstens@de.ibm.com, schwidefsky@de.ibm.com, linux-kernel@vger.kernel.org, patches@groups.riscv.org, akpm@linux-foundation.org, albert@sifive.com Subject: Re: [PATCH 16/17] RISC-V: User-facing API Message-ID: <20170711133948.GA26995@infradead.org> References: <20170711013924.22085-1-palmer@dabbelt.com> <20170711013924.22085-17-palmer@dabbelt.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170711013924.22085-17-palmer@dabbelt.com> User-Agent: Mutt/1.8.0 (2017-02-23) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +++ b/arch/riscv/kernel/sys_riscv.c > @@ -0,0 +1,43 @@ > +/* > + * Copyright (C) 2012 Regents of the University of California > + * Copyright (C) 2014 Darius Rad > + * Copyright (C) 2017 SiFive > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License > + * as published by the Free Software Foundation, version 2. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + */ > + > +#include > +#include Should not be needed. > +#ifdef CONFIG_64BIT > +SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, > + unsigned long, prot, unsigned long, flags, > + unsigned long, fd, off_t, offset) > +{ > + if (unlikely(offset & (~PAGE_MASK))) > + return -EINVAL; > + return sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); > +} > +#else > +SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len, > + unsigned long, prot, unsigned long, flags, > + unsigned long, fd, off_t, offset) > +{ > + /* > + * Note that the shift for mmap2 is constant (12), > + * regardless of PAGE_SIZE > + */ > + if (unlikely(offset & (~PAGE_MASK >> 12))) > + return -EINVAL; > + return sys_mmap_pgoff(addr, len, prot, flags, fd, > + offset >> (PAGE_SHIFT - 12)); > +} > +#endif /* !CONFIG_64BIT */ Most modern ports seem to expose sys_mmap_pgoff as the syscall directly. Any reason you're doing this differently? But even the code for the older ones should probably be consolidated..