All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafał Miłecki" <zajec5@gmail.com>
To: "Maciej W. Rozycki" <macro@imgtec.com>
Cc: Brian Norris <computersforpeace@gmail.com>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	Javier Martinez Canillas <javier@osg.samsung.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Fengguang Wu <fengguang.wu@intel.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Luis de Bethencourt <luisbg@osg.samsung.com>,
	Jeremy Kerr <jk@ozlabs.org>,
	Neelesh Gupta <neelegup@linux.vnet.ibm.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Cyril Bur <cyrilbur@gmail.com>,
	Ralf Baechle <ralf@linux-mips.org>
Subject: Re: [PATCH] mtd: bcm47xxsflash: use ioremap_cachable() instead of KSEG0ADDR()
Date: Fri, 26 Feb 2016 17:31:53 +0100	[thread overview]
Message-ID: <CACna6rx5ajqRq3m4nLr8jRy+-RjCuTsSYCnjNhj6Q0F0LJtQYQ@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1602261411591.15885@tp.orcam.me.uk>

On 26 February 2016 at 15:18, Maciej W. Rozycki <macro@imgtec.com> wrote:
> On Fri, 26 Feb 2016, Rafał Miłecki wrote:
>
>> >> KSEG0ADDR was translating 0x1c000000 into 0x9c000000. With
>> >> ioremap_cachable we use MIPS's __ioremap (and 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.
>> >
>> >  This is due to this piece:
>> >
>> >         /*
>> >          * Map uncached objects in the low 512mb of address space using KSEG1,
>> >          * otherwise map using page tables.
>> >          */
>> >         if (IS_LOW512(phys_addr) && IS_LOW512(last_addr) &&
>> >             flags == _CACHE_UNCACHED)
>> >                 return (void __iomem *) CKSEG1ADDR(phys_addr);
>> >
>> > special-casing uncached mapping only (replicated in 2 places).  I think
>> > there will really be no harm from returning a KSEG0 mapping for calls
>> > requesting a caching mode equal to `_page_cachable_default', which --
>> > depending on the cache architecture -- will have been either hardwired or
>> > prearranged via Config.K0.  I think there's really no need to put pressure
>> > on the TLB, which may be small, in cases where a fixed mapping will do.
>>
>> No, it isn't hitting condition you pointed. We call ioremap_cachable
>> which uses _page_cachable_default as a flag. This flag
>> (_page_cachable_default) isn't equal to the _CACHE_UNCACHED.
>
>  That's exactly what I wrote: code I quoted is "special-casing uncached
> mapping only" -- which as you have correctly observed does not apply after
> your change anymore.  Which is why previously you got an address in the
> unmapped KSEG1 segment and now you get an address in the mapped KSEG2
> rather than the unmapped KSEG0 segment.
>
>> Moreover code you pointed uses CKSEG1ADDR which would result in
>> setting bit KSEG1 (0xa0000000). As I pointed in the commit message
>> address it ORed with KSEG2 (0xc0000000).
>
>  It's not merely ORed, it's actually mapped via the TLB.
>
>  I hope this makes things clear.

Ah, sorry, I missed the point of your explanation. Now it's clear, thanks!

-- 
Rafał

  reply	other threads:[~2016-02-26 16:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-17  0:42 [PATCH] mtd: bcm47xxsflash: use ioremap_cachable() instead of KSEG0ADDR() Rafał Miłecki
2016-01-24 20:17 ` Maciej W. Rozycki
2016-01-25  4:04   ` Brian Norris
2016-01-25 19:15     ` Maciej W. Rozycki
2016-01-25 19:30       ` Brian Norris
2016-02-26 10:41   ` Rafał Miłecki
2016-02-26 14:18     ` Maciej W. Rozycki
2016-02-26 16:31       ` Rafał Miłecki [this message]
2016-02-26 10:50 ` [PATCH V2] mtd: bcm47xxsflash: use ioremap_cache() " Rafał Miłecki
2016-03-05  0:54   ` Brian Norris
2016-03-18 11:22     ` Ard Biesheuvel
2016-04-04  7:09       ` Brian Norris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACna6rx5ajqRq3m4nLr8jRy+-RjCuTsSYCnjNhj6Q0F0LJtQYQ@mail.gmail.com \
    --to=zajec5@gmail.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrilbur@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=fengguang.wu@intel.com \
    --cc=javier@osg.samsung.com \
    --cc=jk@ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=luisbg@osg.samsung.com \
    --cc=macro@imgtec.com \
    --cc=mpe@ellerman.id.au \
    --cc=neelegup@linux.vnet.ibm.com \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.