Re: [PATCH] ioremap_cached()

Matthew Wilcox
2006-03-30T20:14:36Z

On Thu, Mar 30, 2006 at 09:50:05PM +0200, Andi Kleen wrote:
> > That doesn't make any sense. What's the point of ioremap_nocache() if
> > ioremap() does magic things that make things uncached?
>
> In theory ioremap_nocache would force uncached even if there is no MTRR
> and is better/clearer.
>
> But on x86 there normally is, so lots of code gets it wrong.
>
> My point is just that forcing a semantics that's not enforced
> on x86 would be a uphill battle for everybody else. Probably not
> a good idea. Better fake x86.

I think you misunderstood. The right interface to call, that should
work everywhere, should be the simple, obvious one. ioremap(). That
effectively is what everyone gets anyway (since they test on x86).
So change the *definition* of ioremap() to be uncached. Then we can add
ioremap_wc() and ioremap_cached() for these special purpose mappings.

> It's unfortunately tricky to get it fully right on x86. The issue
> is to have a good way avoid illegal cache aliases. There were some
> attempts, but so far they never were polished up from the initial
> prototypes.

I know there's similar issues with Itanium. IIRC, the EFI memory map
helps here by saying how various different types of memory should be
mapped.