[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACna6rwAfXQxX8o0+DxroB6vOGZax70VVdPOAjeoGGUsDjdNhA@mail.gmail.com>
Date: Sat, 16 Jan 2016 01:38:11 +0100
From: Rafał Miłecki <zajec5@...il.com>
To: "Maciej W. Rozycki" <macro@...ux-mips.org>
Cc: Brian Norris <computersforpeace@...il.com>,
Ralf Baechle <ralf@...ux-mips.org>,
Javier Martinez Canillas <javier@....samsung.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Fengguang Wu <fengguang.wu@...el.com>,
Michael Ellerman <mpe@...erman.id.au>,
Luis de Bethencourt <luisbg@....samsung.com>,
Jeremy Kerr <jk@...abs.org>,
Neelesh Gupta <neelegup@...ux.vnet.ibm.com>,
"linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
David Woodhouse <dwmw2@...radead.org>,
Cyril Bur <cyrilbur@...il.com>
Subject: Re: [PATCH] mtd: bcm47xxsflash: use devm_ioremap_nocache() instead of KSEG0ADDR()
On 9 January 2016 at 03:10, Maciej W. Rozycki <macro@...ux-mips.org> wrote:
> On Fri, 8 Jan 2016, Brian Norris wrote:
>> > > It results in different address than KSEG0ADDR:
>> > > [ 1.339752] [bcm47xxsflash_bcma_probe] KSEG0ADDR(BCMA_SOC_FLASH2):9c000000
>> > > [ 1.346848] [bcm47xxsflash_bcma_probe] devm_ioremap_nocache:bc000000
>> > >
>> > > But it still works as expected! :)
>> > > [ 1.609426] 6 bcm47xxpart partitions found on MTD device bcm47xxsflash
>> > > [ 1.616169] Creating 6 MTD partitions on "bcm47xxsflash":
>> >
>> > It is a functional change though and I think the change from a cached to
>> > uncached mapping (i.e. from `ioremap' to `ioremap_nocache') has to be a
>> > separate patch, so that both changes can be reviewed independently.
>>
>> As I noted before sending my patch, I don't think this driver should
>> have been using KSEG0 anyway; it should have been KSEG1, right? I can
>> note that in the patch description, but I don't really see why it needs
>> to be a separate patch.
>
> You did mention that, but didn't actually justify why an uncached mapping
> is required here.
>
> This code is in a function called `bcm47xxsflash_read' and reads from an
> MMIO region, presumably flash memory which behaves like ordinary memory on
> reads (i.e. no side effects). Therefore using a cached mapping will in
> most cases result in much better performance as the CPU will load
> (prefetch) data in cacheline-sized quantities rather than hitting the
> external bus every time with a word-sized quantity transferred only.
So I wanted to stick to the cached mapping, but it appears it's not
possible with devm_*. We have two options:
1) devm_ioremap_nocache - it obviously won't be cached mapping
2) devm_ioremap_resource - it uses devm_ioremap which uses ioremap
which is nocache on MIPS
Should I introduce a new
devm_ioremap_resource_cache
with some
devm_ioremap_cache
helper? And then use it in bcm47xxsflash?
--
Rafał
Powered by blists - more mailing lists