From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753160AbcDDHKF (ORCPT ); Mon, 4 Apr 2016 03:10:05 -0400 Received: from mail-pf0-f169.google.com ([209.85.192.169]:34577 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751010AbcDDHKD (ORCPT ); Mon, 4 Apr 2016 03:10:03 -0400 Date: Mon, 4 Apr 2016 00:09:58 -0700 From: Brian Norris To: Ard Biesheuvel Cc: =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= , linux-mtd@lists.infradead.org, "Maciej W. Rozycki" , Javier Martinez Canillas , Linux Kernel Mailing List , Fengguang Wu , Michael Ellerman , Luis de Bethencourt , Jeremy Kerr , Neelesh Gupta , David Woodhouse , Cyril Bur , Ralf Baechle , Hauke Mehrtens , Dan Williams Subject: Re: [PATCH V2] mtd: bcm47xxsflash: use ioremap_cache() instead of KSEG0ADDR() Message-ID: <20160404070958.GF13995@localhost> References: <1452991370-20121-1-git-send-email-zajec5@gmail.com> <1456483828-5583-1-git-send-email-zajec5@gmail.com> <20160305005459.GH55664@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 18, 2016 at 12:22:05PM +0100, Ard Biesheuvel wrote: > On 5 March 2016 at 01:54, Brian Norris wrote: > > + others > > > > On Fri, Feb 26, 2016 at 11:50:28AM +0100, Rafał Miłecki wrote: > >> From: Brian Norris > >> > >> Using KSEG0ADDR makes code highly MIPS dependent and not portable. > >> Thanks to the fix a68f376 ("MIPS: io.h: Define `ioremap_cache'") we can > >> use ioremap_cache which is generic and supported on MIPS as well now. > >> > >> KSEG0ADDR was translating 0x1c000000 into 0x9c000000. With ioremap_cache > >> we use MIPS's __ioremap (and then remap_area_pages). This results in > >> different address (e.g. 0xc0080000) but it still should be cached as > >> expected and it was successfully tested with BCM47186B0. > >> > >> Other than that drivers/bcma/driver_chipcommon_sflash.c nicely setups a > >> struct resource for access window, but we wren't using it. Use it now > >> and drop duplicated info. > >> > >> Signed-off-by: Brian Norris > >> Signed-off-by: Rafał Miłecki > >> --- > >> V2: > >> 1) Use ioremap_cache as we already have commit a68f376 in l2-mtd > >> 2) Add iounmap to the error path > >> 3) Update commit message > > > > Hmm, I'm a bit out of the loop on some things here, but it looks like > > ioremap_cache() is going away. See kernel/memremap.c: > > > > /* temporary while we convert existing ioremap_cache users to memremap */ > > __weak void __iomem *ioremap_cache(resource_size_t offset, unsigned long size) > > > > Are we supposed to move to using memremap() here? (If so, > > devm_memremap() can help us.) > > > > I don't think that ioremap_cache() necessarily has to go away, but > what we do need to address is its abuse to map things like firmware > tables that reside in normal memory that may not be owned/tracked by > the kernel. So for that case, we now have memremap() which should just > give you a mapping of the requested region, either via the linear > mapping if it happens to be mapped already, or via the vmalloc region > if it is highmem or otherwise unavailable directly. > > However, memory mapped NOR flash remains a special case, since the > __iomem annotation may or may not be appropriate depending on context > (i.e., reads and writes may both have either memory or strongly > ordered semantics) OK, pushed to l2-mtd.git.