From patchwork Wed May 6 10:45:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King - ARM Linux X-Patchwork-Id: 6348831 Return-Path: X-Original-To: patchwork-linux-fbdev@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 8BDC09F1C2 for ; Wed, 6 May 2015 10:45:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 98B9920295 for ; Wed, 6 May 2015 10:45:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ABB4220265 for ; Wed, 6 May 2015 10:45:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750735AbbEFKpe (ORCPT ); Wed, 6 May 2015 06:45:34 -0400 Received: from pandora.arm.linux.org.uk ([78.32.30.218]:54170 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750738AbbEFKpd (ORCPT ); Wed, 6 May 2015 06:45:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=GydZei+BQTPapR3qrNzkuQahzFIIjdWpsZqXXxRRYkY=; b=X3El7hbX4OHCuiXyGpLS7WJ9a3J8CjLqBWxlsWDuPEe/k6nFvSx1RDA09aEQ+OVB9gdgt7R5vQ3CeiMljWqQmjEfh6ZpvY/Kgc1QeiejYdYqEo2lJoFpiVgaNAyrVpggR8v1NDjt/hHos6sPlGfJ6ERZVNz7X+b+uQYok+O6l24=; Received: from n2100.arm.linux.org.uk ([fd8f:7570:feb6:1:214:fdff:fe10:4f86]:35124) by pandora.arm.linux.org.uk with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1YpwpG-0004D0-Jw; Wed, 06 May 2015 11:45:14 +0100 Received: from linux by n2100.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1Ypwp8-0005E8-Kw; Wed, 06 May 2015 11:45:06 +0100 Date: Wed, 6 May 2015 11:45:04 +0100 From: Russell King - ARM Linux To: Nicolas Pitre Cc: Geert Uytterhoeven , Tomi Valkeinen , Pavel Machek , Archit Taneja , Marek Vasut , kernel list , Dinh Nguyen , Jean-Christophe PLAGNIOL-VILLARD , Grant Likely , Rob Herring , Jingoo Han , Rob Clark , Linux Fbdev development list , "devicetree@vger.kernel.org" , Alexander Shiyan , H Hartley Sweeten Subject: Re: simple framebuffer slower by factor of 20, on socfpga (arm) platform Message-ID: <20150506104504.GM2067@n2100.arm.linux.org.uk> References: <20150409110634.GA27407@amd> <552660C7.4020805@ti.com> <552663C2.70308@ti.com> <55277650.8070607@codeaurora.org> <20150424132923.GA11729@amd> <553A47D3.2070107@ti.com> <20150428134848.GC12732@n2100.arm.linux.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,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 On Tue, Apr 28, 2015 at 11:28:53AM -0400, Nicolas Pitre wrote: > On Tue, 28 Apr 2015, Russell King - ARM Linux wrote: > > > On Fri, Apr 24, 2015 at 03:46:56PM +0200, Geert Uytterhoeven wrote: > > > So please optimize ARM's _memcpy_fromio(), _memcpy_toio(), and _memset_io(). > > > That will benefit other drivers on ARM, too. > > > > That's not going to happen. > > > > I've had a patch which does that, but people are concerned that it changes > > the behaviour of the functions by changing the access size, which could > > cause regressions. It seems people are far too worried about that to even > > consider trying. :( > > What about making the optimized implementation available via kconfig? I'd prefer not to. My personal feeling is to put the patch in and just be done with it - these functions are supposed to be used on IO areas which don't care about access size (in other words, are memory-like rather than being register-like.) Here's the rather old patch: From: Russell King Subject: [PATCH] ARM: optimize memset_io()/memcpy_fromio()/memcpy_toio() If we are building for a LE platform, and we haven't overriden the MMIO ops, then we can optimize the mem*io operations using the standard string functions. Signed-off-by: Russell King Acked-by: Nicolas Pitre Tested-by: Pavel Machek Acked-by: Pavel Machek --- arch/arm/include/asm/io.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index d070741b2b37..358c8206419b 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h @@ -23,6 +23,7 @@ #ifdef __KERNEL__ +#include #include #include #include @@ -312,9 +313,33 @@ extern void _memset_io(volatile void __iomem *, int, size_t); #define writesw(p,d,l) __raw_writesw(p,d,l) #define writesl(p,d,l) __raw_writesl(p,d,l) +#ifndef __ARMBE__ +static inline void memset_io(volatile void __iomem *dst, unsigned c, + size_t count) +{ + memset((void __force *)dst, c, count); +} +#define memset_io(dst,c,count) memset_io(dst,c,count) + +static inline void memcpy_fromio(void *to, const volatile void __iomem *from, + size_t count) +{ + memcpy(to, (const void __force *)from, count); +} +#define memcpy_fromio(to,from,count) memcpy_fromio(to,from,count) + +static inline void memcpy_toio(volatile void __iomem *to, const void *from, + size_t count) +{ + memcpy((void __force *)to, from, count); +} +#define memcpy_toio(to,from,count) memcpy_toio(to,from,count) + +#else #define memset_io(c,v,l) _memset_io(c,(v),(l)) #define memcpy_fromio(a,c,l) _memcpy_fromio((a),c,(l)) #define memcpy_toio(c,a,l) _memcpy_toio(c,(a),(l)) +#endif #endif /* readl */