Subject: Re: [PATCH] 8xx: map_page() skip pinned region and tlbie debugging aid

From: Dan Malek <[email-masked]>
Date: Thu, 30 Jun 2005 13:49:19 -0400

On Jun 29, 2005, at 1:19 PM, Marcelo Tosatti wrote:

> What do you mean "everyone should use ioremap() to map them"?

All software needs to invoke some kind of mapping function such
as ioremap() in the case of drivers or functions that access 
peripherals.
You should not assume someone has done the mapping for you,
as we did in the past for some optimizations.

> Once the physical->virtual mapping for device IO space are set
> with io_block_mapping() (or with ioremap() for dynamic virtual
> addresses), why would you want to ioremap() the physical address
> again???

You shouldn't know that io_block_mapping() has done anything
for you.  It is intended to be used as an optimization, not as a
replacement for ioremap().  The ioremap() function needs to be smart
enough to detect these optimizations and return efficient mappings
if that was done.  If a platform decides to not use these optimizations
(which is sometimes beneficial for debugging), your software using
ioremap() should still work just fine.

> PS: I've had a quick try at converting the IMMAP to use
> ioremap instead (and have that dynamic virtual address stored
> in a pointer), changed drivers to use that pointer instead of
> hardcoded "IMMAP". Didnt work immediately :) Its not that the
> idea?

Yes, and we have done lots of this in the 82xx/83xx/85xx cpm2
drivers in 2.6.  In fact, in 2.6 it has to be done.

Thanks.

	-- Dan